<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[186169] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/186169">186169</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2015-06-30 23:17:20 -0700 (Tue, 30 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update ANGLE to b11e2483742db884bd0af41f78f528240577356b.
https://bugs.webkit.org/show_bug.cgi?id=145010

Reviewed by Dean Jackson.

Source/ThirdParty/ANGLE:

Huge list of source changes omitted.
ROLL DEPS!

Source/WebCore:

* CMakeLists.txt:
* platform/graphics/ANGLEWebKitBridge.cpp:
(WebCore::appendSymbol):
(WebCore::getStructInfo):
(WebCore::getSymbolInfo):
(WebCore::ANGLEWebKitBridge::cleanupCompilers):
(WebCore::ANGLEWebKitBridge::compileShaderSource):
(WebCore::getValidationResultValue): Deleted.
* platform/graphics/ANGLEWebKitBridge.h:
(WebCore::ANGLEShaderSymbol::isSampler):
* platform/graphics/GraphicsContext3D.h:
(WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo):
* platform/graphics/mac/GraphicsContext3DMac.mm:
* platform/graphics/opengl/Extensions3DOpenGL.cpp:
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::checkVaryingsPacking):
(WebCore::GraphicsContext3D::precisionsMatch):
Update WebCore to reflect changes in ANGLE.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEANGLEplist">trunk/Source/ThirdParty/ANGLE/ANGLE.plist</a></li>
<li><a href="#trunkSourceThirdPartyANGLEANGLExcodeprojprojectpbxproj">trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceThirdPartyANGLEAUTHORS">trunk/Source/ThirdParty/ANGLE/AUTHORS</a></li>
<li><a href="#trunkSourceThirdPartyANGLECONTRIBUTORS">trunk/Source/ThirdParty/ANGLE/CONTRIBUTORS</a></li>
<li><a href="#trunkSourceThirdPartyANGLEChangeLog">trunk/Source/ThirdParty/ANGLE/ChangeLog</a></li>
<li><a href="#trunkSourceThirdPartyANGLEDEPS">trunk/Source/ThirdParty/ANGLE/DEPS</a></li>
<li><a href="#trunkSourceThirdPartyANGLEchangesdiff">trunk/Source/ThirdParty/ANGLE/changes.diff</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeEGLeglh">trunk/Source/ThirdParty/ANGLE/include/EGL/egl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeEGLeglexth">trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeEGLeglplatformh">trunk/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeGLSLANGShaderLangh">trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommith">trunk/Source/ThirdParty/ANGLE/src/commit.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonangleutilsh">trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommondebugcpp">trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommondebugh">trunk/Source/ThirdParty/ANGLE/src/common/debug.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonevent_tracercpp">trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonevent_tracerh">trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonmathutilcpp">trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonmathutilh">trunk/Source/ThirdParty/ANGLE/src/common/mathutil.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonutilitiescpp">trunk/Source/ThirdParty/ANGLE/src/common/utilities.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonutilitiesh">trunk/Source/ThirdParty/ANGLE/src/common/utilities.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonversionh">trunk/Source/ThirdParty/ANGLE/src/common/version.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessor64bittokenizersafetypatch">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/64bit-tokenizer-safety.patch</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorDiagnosticsBasecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorDiagnosticsBaseh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveHandlerBaseh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveParsercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveParserh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParserh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsery">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorInputcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorInputh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorLexerh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacrocpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacroh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacroExpandercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacroExpanderh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorPreprocessorcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorPreprocessorh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorSourceLocationh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/SourceLocation.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokencpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizerh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizerl">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessornumeric_lexh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilerpreprocessorpp_utilsh">trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/pp_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslator64bitlexersafetypatch">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBaseTypesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorCodeGencpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CodeGen.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorCommonh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorCompilercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorConstantUnionh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ConstantUnion.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDiagnosticscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDiagnosticsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDirectiveHandlercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDirectiveHandlerh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorExtensionBehaviorh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ExtensionBehavior.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorFlagStd140Structsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorForLoopUnrollcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorForLoopUnrollh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorHashNamesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/HashNames.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInfoSinkh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InfoSink.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeDllcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeDllh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeGlobalsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeGlobals.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeParseContextcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeParseContexth">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeVariablescpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeVariablesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorIntermTraversecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermTraverse.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorIntermediatecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorLoopInfocpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorLoopInfoh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorMMaph">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MMap.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorNodeSearchh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/NodeSearch.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputESSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputESSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLBasecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLBaseh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOutputHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorParseContextcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorParseContexth">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorPoolAlloccpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorPoolAlloch">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorPragmah">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Pragma.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorQualifierAlivecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorQualifierAliveh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRenameFunctionh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RenameFunction.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRewriteElseBlockscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRewriteElseBlocksh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSearchSymbolcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSearchSymbolh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorShaderLangcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSymbolTablecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSymbolTableh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorESSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorESSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorGLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorGLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTypesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuith">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitASTcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitASTh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorValidateLimitationscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorValidateLimitationsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorValidateOutputsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorVariableInfocpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorVariableInfoh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorVariablePackercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorVariablePackerh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorVersionGLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorVersionGLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraph.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphBuildercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphBuilderh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphOutputh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphOutput.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorglslangh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorglslangl">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorglslangy">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.y</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_lexcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_tabcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_tabh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorintermOutcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorintermediateh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermediate.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorlength_limitsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorparseConstcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictFragmentShaderTimingh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictVertexShaderTimingh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorutilcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorutilh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLlibEGLcpp">trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLlibEGLdef">trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLlibEGLrc">trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2def">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2rc">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partycompilerArrayBoundsClamperh">trunk/Source/ThirdParty/ANGLE/src/third_party/compiler/ArrayBoundsClamper.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partymurmurhashMurmurHash3cpp">trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partymurmurhashMurmurHash3h">trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partytrace_eventtrace_eventh">trunk/Source/ThirdParty/ANGLE/src/third_party/trace_event/trace_event.h</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsANGLEWebKitBridgecpp">trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsANGLEWebKitBridgeh">trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsContext3Dh">trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacGraphicsContext3DMacmm">trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLcpp">trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLCommoncpp">trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEBUILDgn">trunk/Source/ThirdParty/ANGLE/BUILD.gn</a></li>
<li><a href="#trunkSourceThirdPartyANGLEREADMEmd">trunk/Source/ThirdParty/ANGLE/README.md</a></li>
<li><a href="#trunkSourceThirdPartyANGLEangleisolate">trunk/Source/ThirdParty/ANGLE/angle.isolate</a></li>
<li>trunk/Source/ThirdParty/ANGLE/extensions/</li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_depth_texturetxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_depth_texture.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_framebuffer_blittxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_blit.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_framebuffer_multisampletxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_multisample.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_instanced_arraystxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_instanced_arrays.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_pack_reverse_row_ordertxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_pack_reverse_row_order.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_platform_angletxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_platform_angle_d3dtxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_d3d.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_platform_angle_opengltxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_opengl.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_program_binarytxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_program_binary.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_robust_resource_initializationtxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_robust_resource_initialization.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_texture_compression_dxttxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_compression_dxt.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_texture_usagetxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_usage.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_timer_querytxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_timer_query.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsANGLE_translated_shader_sourcetxt">trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_translated_shader_source.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_d3d_share_handle_client_buffertxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_d3d_share_handle_client_buffer.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_device_d3dtxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_device_d3d.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_direct3d_displaytxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_direct3d_display.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_query_surface_pointertxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_query_surface_pointer.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_robust_resource_initializationtxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_robust_resource_initialization.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_software_displaytxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_software_display.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_surface_d3d_texture_2d_share_handletxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_window_fixed_sizetxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_window_fixed_size.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_EXT_create_context_robustnesstxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_create_context_robustness.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEGL_EXT_device_querytxt">trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_device_query.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEXT_blend_minmaxtxt">trunk/Source/ThirdParty/ANGLE/extensions/EXT_blend_minmax.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEXT_color_buffer_floattxt">trunk/Source/ThirdParty/ANGLE/extensions/EXT_color_buffer_float.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEXT_draw_bufferstxt">trunk/Source/ThirdParty/ANGLE/extensions/EXT_draw_buffers.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEXT_robustnesstxt">trunk/Source/ThirdParty/ANGLE/extensions/EXT_robustness.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEXT_shader_framebuffer_fetchtxt">trunk/Source/ThirdParty/ANGLE/extensions/EXT_shader_framebuffer_fetch.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEXT_texture_rgtxt">trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_rg.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEextensionsEXT_texture_storagetxt">trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_storage.txt</a></li>
<li><a href="#trunkSourceThirdPartyANGLEgenerate_winrt_projectspy">trunk/Source/ThirdParty/ANGLE/generate_winrt_projects.py</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeGLSLANGShaderVarsh">trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderVars.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeangle_glh">trunk/Source/ThirdParty/ANGLE/include/angle_gl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeangle_windowsstoreh">trunk/Source/ThirdParty/ANGLE/include/angle_windowsstore.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEincludeexporth">trunk/Source/ThirdParty/ANGLE/include/export.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/include/platform/</li>
<li><a href="#trunkSourceThirdPartyANGLEincludeplatformPlatformh">trunk/Source/ThirdParty/ANGLE/include/platform/Platform.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcanglegyp">trunk/Source/ThirdParty/ANGLE/src/angle.gyp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommit_idpy">trunk/Source/ThirdParty/ANGLE/src/commit_id.py</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonMemoryBuffercpp">trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonMemoryBufferh">trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonOptionalh">trunk/Source/ThirdParty/ANGLE/src/common/Optional.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonOptional_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/common/Optional_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonangleutilscpp">trunk/Source/ThirdParty/ANGLE/src/common/angleutils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonplatformh">trunk/Source/ThirdParty/ANGLE/src/common/platform.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommontlscpp">trunk/Source/ThirdParty/ANGLE/src/common/tls.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommontlsh">trunk/Source/ThirdParty/ANGLE/src/common/tls.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonutilities_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/common/utilities_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorASTMetadataHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorASTMetadataHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorArrayReturnValueToOutParametercpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorArrayReturnValueToOutParameterh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorGLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorGLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorCallDAGcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorCallDAGh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorCompilerh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorEmulatePrecisioncpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorEmulatePrecisionh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorIntermNodecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorIntermNodeh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOperatorcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorOperatorh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorPruneEmptyDeclarationscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorPruneEmptyDeclarationsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRegenerateStructNamescpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRegenerateStructNamesh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveSwitchFallThroughcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveSwitchFallThroughh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorScalarizeVecAndMatConstructorArgscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorScalarizeVecAndMatConstructorArgsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateArrayInitializationcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateArrayInitializationh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateDeclarationscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateDeclarationsh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorShaderVarscpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderVars.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSimplifyArrayAssignmentcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorSimplifyArrayAssignmenth">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorStructureHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorStructureHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorTypescpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUniformHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUniformHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUtilsHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorUtilsHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorValidateSwitchcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorValidateSwitchh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayoutcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayouth">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayoutHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayoutHLSLh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilergypi">trunk/Source/ThirdParty/ANGLE/src/compiler.gypi</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccopy_compiler_dllbat">trunk/Source/ThirdParty/ANGLE/src/copy_compiler_dll.bat</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEAttributeMapcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEAttributeMaph">trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEBinaryStreamh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/BinaryStream.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEBuffercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEBufferh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLECapscpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLECapsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLECompilercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLECompilerh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEConfigcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEConfigh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEConfig_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEConstantsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEContextcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEContexth">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEDatacpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEDatah">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEDevicecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEDeviceh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEDisplaycpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEDisplayh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEErrorcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEErrorh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEErrorinl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.inl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFencecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFenceh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFence_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFloat16ToFloat32cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFloat16ToFloat32py">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.py</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFramebuffercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFramebufferh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFramebufferAttachmentcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEFramebufferAttachmenth">trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEHandleAllocatorcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEHandleAllocatorh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEHandleAllocator_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEImageIndexcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEImageIndexh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEImageIndexIterator_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndexIterator_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEPlatformcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Platform.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEProgramcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEProgramh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEQuerycpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEQueryh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLERefCountObjectcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLERefCountObjecth">trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLERenderbuffercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLERenderbufferh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEResourceManagercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEResourceManagerh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEResourceManager_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLESamplercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLESamplerh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEShadercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEShaderh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEStatecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEStateh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLESurfacecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLESurfaceh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLESurface_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLETexturecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLETextureh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLETransformFeedbackcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLETransformFeedbackh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLETransformFeedback_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEUniformcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEUniformh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEVertexArraycpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEVertexArrayh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEVertexAttributecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEVertexAttributeh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEangletypescpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEangletypesh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEfeaturesh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/features.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEformatutilscpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEformatutilsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEhistogram_macrosh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/histogram_macros.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEqueryconversionscpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEqueryconversionsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererBufferImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererBufferImpl_mockh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl_mock.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererCompilerImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/CompilerImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererDeviceImplcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererDeviceImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererDisplayImplcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererDisplayImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererFenceNVImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceNVImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererFenceSyncImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceSyncImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererFramebufferImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FramebufferImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererImplFactoryh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ImplFactory.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererIndexRangeCachecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererIndexRangeCacheh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererProgramImplcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererProgramImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererQueryImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/QueryImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererRenderbufferImplcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererRenderbufferImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererRenderercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererRendererh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererShaderImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ShaderImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererSurfaceImplcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererSurfaceImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererTextureImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TextureImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererTransformFeedbackImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererTransformFeedbackImpl_mockh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl_mock.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererVertexArrayImplh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/VertexArrayImpl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererWorkaroundsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Workarounds.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dBufferD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dBufferD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dCompilerD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dCompilerD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDeviceD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDeviceD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDisplayD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDisplayD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDynamicHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDynamicHLSLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dFramebufferD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dFramebufferD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dHLSLCompilercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dHLSLCompilerh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dImageD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dImageD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexBuffercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexBufferh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexDataManagercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexDataManagerh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dProgramD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dProgramD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderTargetD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderTargetD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderbufferD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderbufferD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRendererD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRendererD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderExecutableD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderExecutableD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dSurfaceD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dSurfaceD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dSwapChainD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SwapChainD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureStoragecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureStorageh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTransformFeedbackD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTransformFeedbackD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexBuffercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexBufferh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexDataManagercpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexDataManagerh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dcopyimagecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dcopyimageh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dcopyimageinl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.inl</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Blit11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Blit11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Buffer11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Buffer11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Clear11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Clear11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11DebugAnnotator11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11DebugAnnotator11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Fence11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Fence11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Framebuffer11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Framebuffer11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Image11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Image11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11IndexBuffer11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11IndexBuffer11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11InputLayoutCachecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11InputLayoutCacheh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11NativeWindowh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/NativeWindow.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11PixelTransfer11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11PixelTransfer11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Query11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Query11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderStateCachecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderStateCacheh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderTarget11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderTarget11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Renderer11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Renderer11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11ShaderExecutable11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11ShaderExecutable11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11SwapChain11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11SwapChain11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11TextureStorage11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11TextureStorage11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Trim11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Trim11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11VertexArray11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11VertexBuffer11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11VertexBuffer11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11copyvertexh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11copyvertexinl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11formatutils11cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11formatutils11h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11renderer11_utilscpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11renderer11_utilsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersBufferToTexture11hlsl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersClear11hlsl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersPassthrough2D11hlsl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersPassthrough3D11hlsl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersSwizzle11hlsl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_gsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_ps_4fh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_ps_4ih">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_ps_4uih">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_vsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearfloat11_fl9psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearfloat11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearfloat11vsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearsint11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearsint11vsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearuint11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearuint11vsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthrough2d11vsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthrough3d11gsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthrough3d11vsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughdepth2d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlum2d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlum3d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlumalpha2d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlumalpha3d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr2d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr2di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr2dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr3d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr3di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr3dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg2d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg2di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg2dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg3d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg3di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg3dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb2d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb2di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb2dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb3d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb3di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb3dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba2d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba2di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba2dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba3d11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba3di11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba3dui11psh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlef2darraypsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlef2dpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlef3dpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlei2darraypsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlei2dpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlei3dpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzleui2darraypsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzleui2dpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzleui3dpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersgenerate_shadersbat">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/generate_shaders.bat</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/win32/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11win32NativeWindowcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtCoreWindowNativeWindowcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtCoreWindowNativeWindowh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtCoreWindowNativeWindow_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow_unittest.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtInspectableNativeWindowcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtInspectableNativeWindowh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtSwapChainPanelNativeWindowcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtSwapChainPanelNativeWindowh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtSwapChainPanelNativeWindow_unittestcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow_unittest.cpp</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Blit9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Blit9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Buffer9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Buffer9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9DebugAnnotator9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9DebugAnnotator9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Fence9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Fence9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Framebuffer9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Framebuffer9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Image9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Image9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9IndexBuffer9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9IndexBuffer9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Query9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Query9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9RenderTarget9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9RenderTarget9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Renderer9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Renderer9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9ShaderCacheh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9ShaderExecutable9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9ShaderExecutable9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9SwapChain9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9SwapChain9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9TextureStorage9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9TextureStorage9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexArray9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexBuffer9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexBuffer9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexDeclarationCachecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexDeclarationCacheh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9formatutils9cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9formatutils9h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9renderer9_utilscpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9renderer9_utilsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shadersBlitps">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shadersBlitvs">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledcomponentmaskpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledflipyvsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledluminancepsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledpassthroughpsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledstandardvsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shadersgenerate_shadersbat">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/generate_shaders.bat</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9vertexconversionh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dformatutilsD3Dcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dformatutilsD3Dh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dgeneratemiph">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dgeneratemipinl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.inl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dimageformatsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/imageformats.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimagecpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimageh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimageinl">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.inl</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimageSSE2cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimageSSE2.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErenderergenerate_new_rendererpy">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/generate_new_renderer.py</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglBufferGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglBufferGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglCompilerGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglCompilerGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglDisplayGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglDisplayGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceNVGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceNVGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceSyncGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceSyncGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFramebufferGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFramebufferGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFunctionsGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglFunctionsGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglProgramGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglProgramGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglQueryGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglQueryGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglRenderbufferGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglRenderbufferGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglRendererGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglRendererGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglShaderGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglShaderGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglStateManagerGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglStateManagerGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglSurfaceGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglSurfaceGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglTextureGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglTextureGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglTransformFeedbackGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglTransformFeedbackGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglVertexArrayGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglVertexArrayGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglformatutilsglcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglformatutilsglh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglfunctionsgl_enumsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_enums.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglfunctionsgl_typedefsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_typedefs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglrenderergl_utilscpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglrenderergl_utilsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglDisplayWGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglDisplayWGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglFunctionsWGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglFunctionsWGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglPbufferSurfaceWGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglPbufferSurfaceWGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglWindowSurfaceWGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglWindowSurfaceWGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglfunctionswgl_typedefsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/functionswgl_typedefs.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglwgl_utilscpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLErendererglwglwgl_utilsh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationEGLcpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationEGLh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationEScpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationESh">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationES2cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationES2h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationES3cpp">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibANGLEvalidationES3h">trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLgypi">trunk/Source/ThirdParty/ANGLE/src/libEGL.gypi</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_eglcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_eglh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_egl_extcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_egl_exth">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0_extcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0_exth">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0_extcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0_exth">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2global_statecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2global_stateh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2gypi">trunk/Source/ThirdParty/ANGLE/src/libGLESv2.gypi</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/third_party/khronos/</li>
<li>trunk/Source/ThirdParty/ANGLE/src/third_party/khronos/GL/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partykhronosGLwglexth">trunk/Source/ThirdParty/ANGLE/src/third_party/khronos/GL/wglext.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partysysteminfoSystemInfocpp">trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrcthird_partysysteminfoSystemInfoh">trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/util/</li>
<li><a href="#trunkSourceThirdPartyANGLEutilEGLWindowcpp">trunk/Source/ThirdParty/ANGLE/util/EGLWindow.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilEGLWindowh">trunk/Source/ThirdParty/ANGLE/util/EGLWindow.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilEventh">trunk/Source/ThirdParty/ANGLE/util/Event.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilOSWindowcpp">trunk/Source/ThirdParty/ANGLE/util/OSWindow.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilOSWindowh">trunk/Source/ThirdParty/ANGLE/util/OSWindow.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilTimerh">trunk/Source/ThirdParty/ANGLE/util/Timer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilcom_utilsh">trunk/Source/ThirdParty/ANGLE/util/com_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilkeyboardh">trunk/Source/ThirdParty/ANGLE/util/keyboard.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilmouseh">trunk/Source/ThirdParty/ANGLE/util/mouse.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilpath_utilsh">trunk/Source/ThirdParty/ANGLE/util/path_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilrandom_utilscpp">trunk/Source/ThirdParty/ANGLE/util/random_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilrandom_utilsh">trunk/Source/ThirdParty/ANGLE/util/random_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilshader_utilscpp">trunk/Source/ThirdParty/ANGLE/util/shader_utils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilshader_utilsh">trunk/Source/ThirdParty/ANGLE/util/shader_utils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutiltestfixturetypesh">trunk/Source/ThirdParty/ANGLE/util/testfixturetypes.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilutilgyp">trunk/Source/ThirdParty/ANGLE/util/util.gyp</a></li>
<li>trunk/Source/ThirdParty/ANGLE/util/win32/</li>
<li><a href="#trunkSourceThirdPartyANGLEutilwin32Win32Timercpp">trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilwin32Win32Timerh">trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilwin32Win32Windowcpp">trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilwin32Win32Windowh">trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEutilwin32Win32_path_utilscpp">trunk/Source/ThirdParty/ANGLE/util/win32/Win32_path_utils.cpp</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonRefCountObjectcpp">trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonRefCountObjecth">trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonblocklayoutcpp">trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonblocklayouth">trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonshadervarscpp">trunk/Source/ThirdParty/ANGLE/src/common/shadervars.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccommonshadervarsh">trunk/Source/ThirdParty/ANGLE/src/common/shadervars.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDetectCallDepthcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDetectCallDepthh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDetectDiscontinuitycpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorDetectDiscontinuityh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveTreecpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveTreeh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorShHandleh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorcompilerdebugcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorcompilerdebugh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorlocalintermediateh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorosincludeh">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/osinclude.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorossource_posixcpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_posix.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrccompilertranslatorossource_wincpp">trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLConfigcpp">trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLConfigh">trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLDisplaycpp">trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLDisplayh">trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLSurfacecpp">trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLSurfaceh">trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLmaincpp">trunk/Source/ThirdParty/ANGLE/src/libEGL/main.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibEGLmainh">trunk/Source/ThirdParty/ANGLE/src/libEGL/main.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2BinaryStreamh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/BinaryStream.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Buffercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Bufferh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Contextcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Contexth">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2DynamicHLSLcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2DynamicHLSLh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Fencecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Fenceh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Float16ToFloat32cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Float16ToFloat32py">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.py</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Framebuffercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Framebufferh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2HandleAllocatorcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2HandleAllocatorh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Programcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Programh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2ProgramBinarycpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2ProgramBinaryh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Querycpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Queryh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Renderbuffercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Renderbufferh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2RenderbufferProxySetcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2RenderbufferProxySeth">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2ResourceManagercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2ResourceManagerh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Samplercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Samplerh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Shadercpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Shaderh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Texturecpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Textureh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2TransformFeedbackcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2TransformFeedbackh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Uniformcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2Uniformh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2VertexArraycpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2VertexArrayh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2VertexAttributeh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexAttribute.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2angletypescpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2angletypesh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2constantsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/constants.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2formatutilscpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2formatutilsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2maincpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2mainh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2precompiledcpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2precompiledh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2queryconversionscpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2queryconversionsh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.h</a></li>
<li>trunk/Source/ThirdParty/ANGLE/src/libGLESv2/renderer/</li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2validationEScpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2validationESh">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2validationES2cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2validationES2h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.h</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2validationES3cpp">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.cpp</a></li>
<li><a href="#trunkSourceThirdPartyANGLEsrclibGLESv2validationES3h">trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceThirdPartyANGLEANGLEplist"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ANGLE.plist (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/ANGLE.plist        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/ANGLE.plist        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -10,7 +10,7 @@
</span><span class="cx">         &lt;key&gt;OpenSourceWebsiteURL&lt;/key&gt;
</span><span class="cx">         &lt;string&gt;http://code.google.com/p/angleproject/&lt;/string&gt;
</span><span class="cx">         &lt;key&gt;OpenSourceSCM&lt;/key&gt;
</span><del>-        &lt;string&gt;git clone https://chromium.googlesource.com/angle/angle &amp;amp;&amp;amp; cd angle &amp;amp;&amp;amp; git checkout e7a453a5bd76705ccb151117fa844846d4aa90af&lt;/string&gt;
</del><ins>+        &lt;string&gt;git clone https://chromium.googlesource.com/angle/angle &amp;amp;&amp;amp; cd angle &amp;amp;&amp;amp; git checkout b11e2483742db884bd0af41f78f528240577356b&lt;/string&gt;
</ins><span class="cx">         &lt;key&gt;OpenSourceImportDate&lt;/key&gt;
</span><span class="cx">         &lt;string&gt;2014-04-29&lt;/string&gt;
</span><span class="cx">         &lt;key&gt;OpenSourceLicense&lt;/key&gt;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEANGLExcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/ANGLE.xcodeproj/project.pbxproj        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -21,10 +21,6 @@
</span><span class="cx">                 31012E1F18B97B9B0039062F /* DependencyGraphOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DAE18B97B9B0039062F /* DependencyGraphOutput.cpp */; };
</span><span class="cx">                 31012E2018B97B9B0039062F /* DependencyGraphOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DAF18B97B9B0039062F /* DependencyGraphOutput.h */; };
</span><span class="cx">                 31012E2118B97B9B0039062F /* DependencyGraphTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DB018B97B9B0039062F /* DependencyGraphTraverse.cpp */; };
</span><del>-                31012E2218B97B9B0039062F /* DetectCallDepth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DB118B97B9B0039062F /* DetectCallDepth.cpp */; };
-                31012E2318B97B9B0039062F /* DetectCallDepth.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DB218B97B9B0039062F /* DetectCallDepth.h */; };
-                31012E2418B97B9B0039062F /* DetectDiscontinuity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DB318B97B9B0039062F /* DetectDiscontinuity.cpp */; };
-                31012E2518B97B9B0039062F /* DetectDiscontinuity.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DB418B97B9B0039062F /* DetectDiscontinuity.h */; };
</del><span class="cx">                 31012E2618B97B9B0039062F /* Diagnostics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DB518B97B9B0039062F /* Diagnostics.cpp */; };
</span><span class="cx">                 31012E2718B97B9B0039062F /* Diagnostics.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DB618B97B9B0039062F /* Diagnostics.h */; };
</span><span class="cx">                 31012E2818B97B9B0039062F /* DirectiveHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DB718B97B9B0039062F /* DirectiveHandler.cpp */; };
</span><span class="lines">@@ -49,14 +45,10 @@
</span><span class="cx">                 31012E3D18B97B9B0039062F /* InitializeVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DCD18B97B9B0039062F /* InitializeVariables.cpp */; };
</span><span class="cx">                 31012E3E18B97B9B0039062F /* InitializeVariables.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DCE18B97B9B0039062F /* InitializeVariables.h */; };
</span><span class="cx">                 31012E3F18B97B9B0039062F /* Intermediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DCF18B97B9B0039062F /* Intermediate.cpp */; };
</span><del>-                31012E4018B97B9B0039062F /* intermediate.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD018B97B9B0039062F /* intermediate.h */; };
</del><span class="cx">                 31012E4118B97B9B0039062F /* intermOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DD118B97B9B0039062F /* intermOut.cpp */; };
</span><span class="cx">                 31012E4218B97B9B0039062F /* IntermTraverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DD218B97B9B0039062F /* IntermTraverse.cpp */; };
</span><del>-                31012E4318B97B9B0039062F /* localintermediate.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD318B97B9B0039062F /* localintermediate.h */; };
</del><span class="cx">                 31012E4618B97B9B0039062F /* MMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD618B97B9B0039062F /* MMap.h */; };
</span><span class="cx">                 31012E4718B97B9B0039062F /* NodeSearch.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD718B97B9B0039062F /* NodeSearch.h */; };
</span><del>-                31012E4818B97B9B0039062F /* osinclude.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DD818B97B9B0039062F /* osinclude.h */; };
-                31012E4918B97B9B0039062F /* ossource_posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DD918B97B9B0039062F /* ossource_posix.cpp */; };
</del><span class="cx">                 31012E4B18B97B9B0039062F /* OutputESSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DDB18B97B9B0039062F /* OutputESSL.cpp */; };
</span><span class="cx">                 31012E4C18B97B9B0039062F /* OutputESSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DDC18B97B9B0039062F /* OutputESSL.h */; };
</span><span class="cx">                 31012E4D18B97B9B0039062F /* OutputGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DDD18B97B9B0039062F /* OutputGLSL.cpp */; };
</span><span class="lines">@@ -73,15 +65,12 @@
</span><span class="cx">                 31012E5818B97B9B0039062F /* Pragma.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DE818B97B9B0039062F /* Pragma.h */; };
</span><span class="cx">                 31012E5918B97B9B0039062F /* QualifierAlive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DE918B97B9B0039062F /* QualifierAlive.cpp */; };
</span><span class="cx">                 31012E5A18B97B9B0039062F /* QualifierAlive.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DEA18B97B9B0039062F /* QualifierAlive.h */; };
</span><del>-                31012E5B18B97B9B0039062F /* RemoveTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DEB18B97B9B0039062F /* RemoveTree.cpp */; };
-                31012E5C18B97B9B0039062F /* RemoveTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DEC18B97B9B0039062F /* RemoveTree.h */; };
</del><span class="cx">                 31012E5D18B97B9B0039062F /* RenameFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DED18B97B9B0039062F /* RenameFunction.h */; };
</span><span class="cx">                 31012E5E18B97B9B0039062F /* RewriteElseBlocks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DEE18B97B9B0039062F /* RewriteElseBlocks.cpp */; };
</span><span class="cx">                 31012E5F18B97B9B0039062F /* RewriteElseBlocks.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DEF18B97B9B0039062F /* RewriteElseBlocks.h */; };
</span><span class="cx">                 31012E6018B97B9B0039062F /* SearchSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DF018B97B9B0039062F /* SearchSymbol.cpp */; };
</span><span class="cx">                 31012E6118B97B9B0039062F /* SearchSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DF118B97B9B0039062F /* SearchSymbol.h */; };
</span><span class="cx">                 31012E6218B97B9B0039062F /* ShaderLang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DF218B97B9B0039062F /* ShaderLang.cpp */; };
</span><del>-                31012E6318B97B9B0039062F /* ShHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DF318B97B9B0039062F /* ShHandle.h */; };
</del><span class="cx">                 31012E6418B97B9B0039062F /* SymbolTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DF418B97B9B0039062F /* SymbolTable.cpp */; };
</span><span class="cx">                 31012E6518B97B9B0039062F /* SymbolTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012DF518B97B9B0039062F /* SymbolTable.h */; };
</span><span class="cx">                 31012E6618B97B9B0039062F /* RestrictFragmentShaderTiming.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012DF718B97B9B0039062F /* RestrictFragmentShaderTiming.cpp */; };
</span><span class="lines">@@ -109,10 +98,133 @@
</span><span class="cx">                 31012E7E18B97B9B0039062F /* VariablePacker.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E0F18B97B9B0039062F /* VariablePacker.h */; };
</span><span class="cx">                 31012E7F18B97B9B0039062F /* VersionGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012E1018B97B9B0039062F /* VersionGLSL.cpp */; };
</span><span class="cx">                 31012E8018B97B9B0039062F /* VersionGLSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E1118B97B9B0039062F /* VersionGLSL.h */; };
</span><del>-                31012E8318B97C860039062F /* compilerdebug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31012E8118B97C860039062F /* compilerdebug.cpp */; };
-                31012E8418B97C860039062F /* compilerdebug.h in Headers */ = {isa = PBXBuildFile; fileRef = 31012E8218B97C860039062F /* compilerdebug.h */; };
</del><span class="cx">                 312BDB0C15FECAC90097EBC7 /* ANGLE.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 312BDB0915FEC91E0097EBC7 /* ANGLE.plist */; };
</span><span class="cx">                 312BDB0E15FECAE50097EBC7 /* ANGLE.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 312BDB0A15FECA3A0097EBC7 /* ANGLE.txt */; };
</span><ins>+                5C1DBBE61B04075B00235552 /* ShaderVars.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBE51B04075B00235552 /* ShaderVars.h */; settings = {ATTRIBUTES = (Public, ); }; };
+                5C1DBBF01B0436EC00235552 /* angleutils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBBE71B0436EC00235552 /* angleutils.cpp */; };
+                5C1DBBF11B0436EC00235552 /* MemoryBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBBE81B0436EC00235552 /* MemoryBuffer.cpp */; };
+                5C1DBBF21B0436EC00235552 /* MemoryBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBE91B0436EC00235552 /* MemoryBuffer.h */; };
+                5C1DBBF41B0436EC00235552 /* Optional.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBEB1B0436EC00235552 /* Optional.h */; };
+                5C1DBBF51B0436EC00235552 /* platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBEC1B0436EC00235552 /* platform.h */; };
+                5C1DBBF61B0436EC00235552 /* tls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBBED1B0436EC00235552 /* tls.cpp */; };
+                5C1DBBF71B0436EC00235552 /* tls.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBEE1B0436EC00235552 /* tls.h */; };
+                5C1DBC201B04375F00235552 /* ArrayReturnValueToOutParameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBBF91B04375E00235552 /* ArrayReturnValueToOutParameter.cpp */; };
+                5C1DBC211B04375F00235552 /* ArrayReturnValueToOutParameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBFA1B04375E00235552 /* ArrayReturnValueToOutParameter.h */; };
+                5C1DBC221B04375F00235552 /* ASTMetadataHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBBFB1B04375F00235552 /* ASTMetadataHLSL.cpp */; };
+                5C1DBC231B04375F00235552 /* ASTMetadataHLSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBFC1B04375F00235552 /* ASTMetadataHLSL.h */; };
+                5C1DBC241B04375F00235552 /* blocklayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBBFD1B04375F00235552 /* blocklayout.cpp */; };
+                5C1DBC251B04375F00235552 /* blocklayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBBFE1B04375F00235552 /* blocklayout.h */; };
+                5C1DBC261B04375F00235552 /* blocklayoutHLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBBFF1B04375F00235552 /* blocklayoutHLSL.cpp */; };
+                5C1DBC271B04375F00235552 /* blocklayoutHLSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC001B04375F00235552 /* blocklayoutHLSL.h */; };
+                5C1DBC281B04375F00235552 /* BuiltInFunctionEmulatorGLSL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC011B04375F00235552 /* BuiltInFunctionEmulatorGLSL.cpp */; };
+                5C1DBC291B04375F00235552 /* BuiltInFunctionEmulatorGLSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC021B04375F00235552 /* BuiltInFunctionEmulatorGLSL.h */; };
+                5C1DBC2A1B04375F00235552 /* CallDAG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC031B04375F00235552 /* CallDAG.cpp */; };
+                5C1DBC2B1B04375F00235552 /* CallDAG.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC041B04375F00235552 /* CallDAG.h */; };
+                5C1DBC2C1B04375F00235552 /* Compiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC051B04375F00235552 /* Compiler.h */; };
+                5C1DBC2D1B04375F00235552 /* EmulatePrecision.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC061B04375F00235552 /* EmulatePrecision.cpp */; };
+                5C1DBC2E1B04375F00235552 /* EmulatePrecision.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC071B04375F00235552 /* EmulatePrecision.h */; };
+                5C1DBC2F1B04375F00235552 /* Intermediate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC081B04375F00235552 /* Intermediate.h */; };
+                5C1DBC301B04375F00235552 /* IntermNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC091B04375F00235552 /* IntermNode.cpp */; };
+                5C1DBC311B04375F00235552 /* IntermNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC0A1B04375F00235552 /* IntermNode.h */; };
+                5C1DBC321B04375F00235552 /* length_limits.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC0B1B04375F00235552 /* length_limits.h */; };
+                5C1DBC331B04375F00235552 /* Operator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC0C1B04375F00235552 /* Operator.cpp */; };
+                5C1DBC341B04375F00235552 /* Operator.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC0D1B04375F00235552 /* Operator.h */; };
+                5C1DBC351B04375F00235552 /* PruneEmptyDeclarations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC0E1B04375F00235552 /* PruneEmptyDeclarations.cpp */; };
+                5C1DBC361B04375F00235552 /* PruneEmptyDeclarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC0F1B04375F00235552 /* PruneEmptyDeclarations.h */; };
+                5C1DBC371B04375F00235552 /* RegenerateStructNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC101B04375F00235552 /* RegenerateStructNames.cpp */; };
+                5C1DBC381B04375F00235552 /* RegenerateStructNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC111B04375F00235552 /* RegenerateStructNames.h */; };
+                5C1DBC391B04375F00235552 /* RemoveSwitchFallThrough.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC121B04375F00235552 /* RemoveSwitchFallThrough.cpp */; };
+                5C1DBC3A1B04375F00235552 /* RemoveSwitchFallThrough.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC131B04375F00235552 /* RemoveSwitchFallThrough.h */; };
+                5C1DBC3B1B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC141B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.cpp */; };
+                5C1DBC3C1B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC151B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.h */; };
+                5C1DBC3D1B04375F00235552 /* SeparateArrayInitialization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC161B04375F00235552 /* SeparateArrayInitialization.cpp */; };
+                5C1DBC3E1B04375F00235552 /* SeparateArrayInitialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC171B04375F00235552 /* SeparateArrayInitialization.h */; };
+                5C1DBC3F1B04375F00235552 /* SeparateDeclarations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC181B04375F00235552 /* SeparateDeclarations.cpp */; };
+                5C1DBC401B04375F00235552 /* SeparateDeclarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC191B04375F00235552 /* SeparateDeclarations.h */; };
+                5C1DBC411B04375F00235552 /* ShaderVars.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC1A1B04375F00235552 /* ShaderVars.cpp */; };
+                5C1DBC421B04375F00235552 /* SimplifyArrayAssignment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC1B1B04375F00235552 /* SimplifyArrayAssignment.cpp */; };
+                5C1DBC431B04375F00235552 /* SimplifyArrayAssignment.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC1C1B04375F00235552 /* SimplifyArrayAssignment.h */; };
+                5C1DBC441B04375F00235552 /* Types.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC1D1B04375F00235552 /* Types.cpp */; };
+                5C1DBC451B04375F00235552 /* ValidateSwitch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC1E1B04375F00235552 /* ValidateSwitch.cpp */; };
+                5C1DBC461B04375F00235552 /* ValidateSwitch.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC1F1B04375F00235552 /* ValidateSwitch.h */; };
+                5C1DBDD31B0438D300235552 /* angletypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC481B0438D200235552 /* angletypes.cpp */; };
+                5C1DBDD41B0438D300235552 /* angletypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC491B0438D200235552 /* angletypes.h */; };
+                5C1DBDD51B0438D300235552 /* AttributeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC4A1B0438D200235552 /* AttributeMap.cpp */; };
+                5C1DBDD61B0438D300235552 /* AttributeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC4B1B0438D200235552 /* AttributeMap.h */; };
+                5C1DBDD71B0438D300235552 /* BinaryStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC4C1B0438D200235552 /* BinaryStream.h */; };
+                5C1DBDD81B0438D300235552 /* Buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC4D1B0438D200235552 /* Buffer.cpp */; };
+                5C1DBDD91B0438D300235552 /* Buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC4E1B0438D200235552 /* Buffer.h */; };
+                5C1DBDDA1B0438D300235552 /* Caps.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC4F1B0438D200235552 /* Caps.cpp */; };
+                5C1DBDDB1B0438D300235552 /* Caps.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC501B0438D200235552 /* Caps.h */; };
+                5C1DBDDC1B0438D300235552 /* Compiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC511B0438D200235552 /* Compiler.cpp */; };
+                5C1DBDDD1B0438D300235552 /* Compiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC521B0438D200235552 /* Compiler.h */; };
+                5C1DBDDF1B0438D300235552 /* Config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC541B0438D200235552 /* Config.cpp */; };
+                5C1DBDE01B0438D300235552 /* Config.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC551B0438D200235552 /* Config.h */; };
+                5C1DBDE11B0438D300235552 /* Constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC561B0438D200235552 /* Constants.h */; };
+                5C1DBDE21B0438D300235552 /* Context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC571B0438D200235552 /* Context.cpp */; };
+                5C1DBDE31B0438D300235552 /* Context.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC581B0438D200235552 /* Context.h */; };
+                5C1DBDE41B0438D300235552 /* Data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC591B0438D200235552 /* Data.cpp */; };
+                5C1DBDE51B0438D300235552 /* Data.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC5A1B0438D200235552 /* Data.h */; };
+                5C1DBDE61B0438D300235552 /* Device.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC5B1B0438D200235552 /* Device.cpp */; };
+                5C1DBDE71B0438D300235552 /* Device.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC5C1B0438D200235552 /* Device.h */; };
+                5C1DBDE81B0438D300235552 /* Display.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC5D1B0438D200235552 /* Display.cpp */; };
+                5C1DBDE91B0438D300235552 /* Display.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC5E1B0438D200235552 /* Display.h */; };
+                5C1DBDEA1B0438D300235552 /* Error.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC5F1B0438D200235552 /* Error.cpp */; };
+                5C1DBDEB1B0438D300235552 /* Error.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC601B0438D200235552 /* Error.h */; };
+                5C1DBDEC1B0438D300235552 /* features.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC621B0438D200235552 /* features.h */; };
+                5C1DBDEE1B0438D300235552 /* Fence.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC641B0438D200235552 /* Fence.cpp */; };
+                5C1DBDEF1B0438D300235552 /* Fence.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC651B0438D200235552 /* Fence.h */; };
+                5C1DBDF01B0438D300235552 /* Float16ToFloat32.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC661B0438D200235552 /* Float16ToFloat32.cpp */; };
+                5C1DBDF11B0438D300235552 /* formatutils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC681B0438D200235552 /* formatutils.cpp */; };
+                5C1DBDF21B0438D300235552 /* formatutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC691B0438D200235552 /* formatutils.h */; };
+                5C1DBDF31B0438D300235552 /* Framebuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC6A1B0438D200235552 /* Framebuffer.cpp */; };
+                5C1DBDF41B0438D300235552 /* Framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC6B1B0438D200235552 /* Framebuffer.h */; };
+                5C1DBDF51B0438D300235552 /* FramebufferAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC6C1B0438D200235552 /* FramebufferAttachment.cpp */; };
+                5C1DBDF61B0438D300235552 /* FramebufferAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC6D1B0438D200235552 /* FramebufferAttachment.h */; };
+                5C1DBDF81B0438D300235552 /* HandleAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC6F1B0438D200235552 /* HandleAllocator.cpp */; };
+                5C1DBDF91B0438D300235552 /* HandleAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC701B0438D200235552 /* HandleAllocator.h */; };
+                5C1DBDFA1B0438D300235552 /* histogram_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC711B0438D200235552 /* histogram_macros.h */; };
+                5C1DBDFB1B0438D300235552 /* ImageIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC721B0438D200235552 /* ImageIndex.cpp */; };
+                5C1DBDFC1B0438D300235552 /* ImageIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC731B0438D200235552 /* ImageIndex.h */; };
+                5C1DBDFE1B0438D300235552 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC751B0438D200235552 /* Platform.cpp */; };
+                5C1DBDFF1B0438D300235552 /* Program.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC761B0438D200235552 /* Program.cpp */; };
+                5C1DBE001B0438D300235552 /* Program.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC771B0438D200235552 /* Program.h */; };
+                5C1DBE011B0438D300235552 /* Query.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC781B0438D200235552 /* Query.cpp */; };
+                5C1DBE021B0438D300235552 /* Query.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC791B0438D200235552 /* Query.h */; };
+                5C1DBE031B0438D300235552 /* queryconversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC7A1B0438D200235552 /* queryconversions.cpp */; };
+                5C1DBE041B0438D300235552 /* queryconversions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC7B1B0438D200235552 /* queryconversions.h */; };
+                5C1DBE051B0438D300235552 /* RefCountObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC7C1B0438D200235552 /* RefCountObject.cpp */; };
+                5C1DBE061B0438D300235552 /* RefCountObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC7D1B0438D200235552 /* RefCountObject.h */; };
+                5C1DBE071B0438D300235552 /* Renderbuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBC7E1B0438D200235552 /* Renderbuffer.cpp */; };
+                5C1DBE081B0438D300235552 /* Renderbuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBC7F1B0438D200235552 /* Renderbuffer.h */; };
+                5C1DBF251B0438D300235552 /* ResourceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDB51B0438D200235552 /* ResourceManager.cpp */; };
+                5C1DBF261B0438D300235552 /* ResourceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDB61B0438D200235552 /* ResourceManager.h */; };
+                5C1DBF271B0438D300235552 /* Sampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDB71B0438D200235552 /* Sampler.cpp */; };
+                5C1DBF281B0438D300235552 /* Sampler.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDB81B0438D200235552 /* Sampler.h */; };
+                5C1DBF291B0438D300235552 /* Shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDB91B0438D200235552 /* Shader.cpp */; };
+                5C1DBF2A1B0438D300235552 /* Shader.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDBA1B0438D200235552 /* Shader.h */; };
+                5C1DBF2B1B0438D300235552 /* State.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDBB1B0438D300235552 /* State.cpp */; };
+                5C1DBF2C1B0438D300235552 /* State.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDBC1B0438D300235552 /* State.h */; };
+                5C1DBF2E1B0438D300235552 /* Surface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDBE1B0438D300235552 /* Surface.cpp */; };
+                5C1DBF2F1B0438D300235552 /* Surface.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDBF1B0438D300235552 /* Surface.h */; };
+                5C1DBF301B0438D300235552 /* Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDC01B0438D300235552 /* Texture.cpp */; };
+                5C1DBF311B0438D300235552 /* Texture.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDC11B0438D300235552 /* Texture.h */; };
+                5C1DBF331B0438D300235552 /* TransformFeedback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDC31B0438D300235552 /* TransformFeedback.cpp */; };
+                5C1DBF341B0438D300235552 /* TransformFeedback.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDC41B0438D300235552 /* TransformFeedback.h */; };
+                5C1DBF351B0438D300235552 /* Uniform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDC51B0438D300235552 /* Uniform.cpp */; };
+                5C1DBF361B0438D300235552 /* Uniform.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDC61B0438D300235552 /* Uniform.h */; };
+                5C1DBF371B0438D300235552 /* validationEGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDC71B0438D300235552 /* validationEGL.cpp */; };
+                5C1DBF381B0438D300235552 /* validationEGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDC81B0438D300235552 /* validationEGL.h */; };
+                5C1DBF391B0438D300235552 /* validationES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDC91B0438D300235552 /* validationES.cpp */; };
+                5C1DBF3A1B0438D300235552 /* validationES.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDCA1B0438D300235552 /* validationES.h */; };
+                5C1DBF3B1B0438D300235552 /* validationES2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDCB1B0438D300235552 /* validationES2.cpp */; };
+                5C1DBF3C1B0438D300235552 /* validationES2.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDCC1B0438D300235552 /* validationES2.h */; };
+                5C1DBF3D1B0438D300235552 /* validationES3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDCD1B0438D300235552 /* validationES3.cpp */; };
+                5C1DBF3E1B0438D300235552 /* validationES3.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDCE1B0438D300235552 /* validationES3.h */; };
+                5C1DBF3F1B0438D300235552 /* VertexArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDCF1B0438D300235552 /* VertexArray.cpp */; };
+                5C1DBF401B0438D300235552 /* VertexArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDD01B0438D300235552 /* VertexArray.h */; };
+                5C1DBF411B0438D300235552 /* VertexAttribute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1DBDD11B0438D300235552 /* VertexAttribute.cpp */; };
+                5C1DBF421B0438D300235552 /* VertexAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1DBDD21B0438D300235552 /* VertexAttribute.h */; };
</ins><span class="cx">                 5C9FFF4E19102A000025B8FA /* FlagStd140Structs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9FFF4C19102A000025B8FA /* FlagStd140Structs.cpp */; };
</span><span class="cx">                 5C9FFF4F19102A000025B8FA /* FlagStd140Structs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9FFF4D19102A000025B8FA /* FlagStd140Structs.h */; };
</span><span class="cx">                 5CC7D452191024E4000B8C1F /* LoopInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D44B191024E3000B8C1F /* LoopInfo.cpp */; };
</span><span class="lines">@@ -120,19 +232,12 @@
</span><span class="cx">                 5CC7D457191024E4000B8C1F /* ValidateOutputs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D450191024E4000B8C1F /* ValidateOutputs.cpp */; };
</span><span class="cx">                 5CC7D458191024E4000B8C1F /* ValidateOutputs.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D451191024E4000B8C1F /* ValidateOutputs.h */; };
</span><span class="cx">                 5CC7D46B19102620000B8C1F /* angleutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D45A19102620000B8C1F /* angleutils.h */; };
</span><del>-                5CC7D46C19102620000B8C1F /* blocklayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D45B19102620000B8C1F /* blocklayout.cpp */; };
-                5CC7D46D19102620000B8C1F /* blocklayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D45C19102620000B8C1F /* blocklayout.h */; };
</del><span class="cx">                 5CC7D46E19102621000B8C1F /* debug.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D45D19102620000B8C1F /* debug.cpp */; };
</span><span class="cx">                 5CC7D46F19102621000B8C1F /* debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D45E19102620000B8C1F /* debug.h */; };
</span><span class="cx">                 5CC7D47019102621000B8C1F /* event_tracer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D45F19102620000B8C1F /* event_tracer.cpp */; };
</span><span class="cx">                 5CC7D47119102621000B8C1F /* event_tracer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46019102620000B8C1F /* event_tracer.h */; };
</span><span class="cx">                 5CC7D47219102621000B8C1F /* mathutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D46119102620000B8C1F /* mathutil.cpp */; };
</span><span class="cx">                 5CC7D47319102621000B8C1F /* mathutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46219102620000B8C1F /* mathutil.h */; };
</span><del>-                5CC7D47419102621000B8C1F /* RefCountObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D46319102620000B8C1F /* RefCountObject.cpp */; };
-                5CC7D47519102621000B8C1F /* RefCountObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46419102620000B8C1F /* RefCountObject.h */; };
-                5CC7D47619102621000B8C1F /* shadervars.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D46519102620000B8C1F /* shadervars.cpp */; };
-                5CC7D47719102621000B8C1F /* shadervars.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46619102620000B8C1F /* shadervars.h */; };
-                5CC7D47819102621000B8C1F /* system.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46719102620000B8C1F /* system.h */; };
</del><span class="cx">                 5CC7D47919102621000B8C1F /* utilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CC7D46819102620000B8C1F /* utilities.cpp */; };
</span><span class="cx">                 5CC7D47A19102621000B8C1F /* utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46919102620000B8C1F /* utilities.h */; };
</span><span class="cx">                 5CC7D47B19102621000B8C1F /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CC7D46A19102620000B8C1F /* version.h */; };
</span><span class="lines">@@ -205,10 +310,6 @@
</span><span class="cx">                 31012DAE18B97B9B0039062F /* DependencyGraphOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraphOutput.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DAF18B97B9B0039062F /* DependencyGraphOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DependencyGraphOutput.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DB018B97B9B0039062F /* DependencyGraphTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DependencyGraphTraverse.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31012DB118B97B9B0039062F /* DetectCallDepth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetectCallDepth.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                31012DB218B97B9B0039062F /* DetectCallDepth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetectCallDepth.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                31012DB318B97B9B0039062F /* DetectDiscontinuity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DetectDiscontinuity.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                31012DB418B97B9B0039062F /* DetectDiscontinuity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetectDiscontinuity.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 31012DB518B97B9B0039062F /* Diagnostics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Diagnostics.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DB618B97B9B0039062F /* Diagnostics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Diagnostics.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DB718B97B9B0039062F /* DirectiveHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectiveHandler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -233,14 +334,10 @@
</span><span class="cx">                 31012DCD18B97B9B0039062F /* InitializeVariables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitializeVariables.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DCE18B97B9B0039062F /* InitializeVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeVariables.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DCF18B97B9B0039062F /* Intermediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Intermediate.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31012DD018B97B9B0039062F /* intermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intermediate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 31012DD118B97B9B0039062F /* intermOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = intermOut.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DD218B97B9B0039062F /* IntermTraverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermTraverse.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31012DD318B97B9B0039062F /* localintermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = localintermediate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 31012DD618B97B9B0039062F /* MMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMap.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DD718B97B9B0039062F /* NodeSearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeSearch.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31012DD818B97B9B0039062F /* osinclude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osinclude.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                31012DD918B97B9B0039062F /* ossource_posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ossource_posix.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 31012DDB18B97B9B0039062F /* OutputESSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputESSL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DDC18B97B9B0039062F /* OutputESSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutputESSL.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DDD18B97B9B0039062F /* OutputGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OutputGLSL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -257,15 +354,12 @@
</span><span class="cx">                 31012DE818B97B9B0039062F /* Pragma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pragma.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DE918B97B9B0039062F /* QualifierAlive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifierAlive.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DEA18B97B9B0039062F /* QualifierAlive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QualifierAlive.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31012DEB18B97B9B0039062F /* RemoveTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveTree.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                31012DEC18B97B9B0039062F /* RemoveTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveTree.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 31012DED18B97B9B0039062F /* RenameFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenameFunction.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DEE18B97B9B0039062F /* RewriteElseBlocks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RewriteElseBlocks.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DEF18B97B9B0039062F /* RewriteElseBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RewriteElseBlocks.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DF018B97B9B0039062F /* SearchSymbol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SearchSymbol.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DF118B97B9B0039062F /* SearchSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchSymbol.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DF218B97B9B0039062F /* ShaderLang.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderLang.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31012DF318B97B9B0039062F /* ShHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShHandle.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 31012DF418B97B9B0039062F /* SymbolTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolTable.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DF518B97B9B0039062F /* SymbolTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolTable.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012DF718B97B9B0039062F /* RestrictFragmentShaderTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestrictFragmentShaderTiming.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -293,10 +387,134 @@
</span><span class="cx">                 31012E0F18B97B9B0039062F /* VariablePacker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VariablePacker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012E1018B97B9B0039062F /* VersionGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VersionGLSL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31012E1118B97B9B0039062F /* VersionGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VersionGLSL.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                31012E8118B97C860039062F /* compilerdebug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = compilerdebug.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                31012E8218B97C860039062F /* compilerdebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compilerdebug.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 312BDB0915FEC91E0097EBC7 /* ANGLE.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ANGLE.plist; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 312BDB0A15FECA3A0097EBC7 /* ANGLE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ANGLE.txt; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                5C1DBBE51B04075B00235552 /* ShaderVars.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShaderVars.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBE71B0436EC00235552 /* angleutils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = angleutils.cpp; path = src/common/angleutils.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBE81B0436EC00235552 /* MemoryBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemoryBuffer.cpp; path = src/common/MemoryBuffer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBE91B0436EC00235552 /* MemoryBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MemoryBuffer.h; path = src/common/MemoryBuffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBEB1B0436EC00235552 /* Optional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Optional.h; path = src/common/Optional.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBEC1B0436EC00235552 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform.h; path = src/common/platform.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBED1B0436EC00235552 /* tls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tls.cpp; path = src/common/tls.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBEE1B0436EC00235552 /* tls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tls.h; path = src/common/tls.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBF91B04375E00235552 /* ArrayReturnValueToOutParameter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayReturnValueToOutParameter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBFA1B04375E00235552 /* ArrayReturnValueToOutParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayReturnValueToOutParameter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBFB1B04375F00235552 /* ASTMetadataHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ASTMetadataHLSL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBFC1B04375F00235552 /* ASTMetadataHLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASTMetadataHLSL.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBFD1B04375F00235552 /* blocklayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = blocklayout.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBFE1B04375F00235552 /* blocklayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blocklayout.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBBFF1B04375F00235552 /* blocklayoutHLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = blocklayoutHLSL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC001B04375F00235552 /* blocklayoutHLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blocklayoutHLSL.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC011B04375F00235552 /* BuiltInFunctionEmulatorGLSL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BuiltInFunctionEmulatorGLSL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC021B04375F00235552 /* BuiltInFunctionEmulatorGLSL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BuiltInFunctionEmulatorGLSL.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC031B04375F00235552 /* CallDAG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallDAG.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC041B04375F00235552 /* CallDAG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallDAG.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC051B04375F00235552 /* Compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Compiler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC061B04375F00235552 /* EmulatePrecision.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmulatePrecision.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC071B04375F00235552 /* EmulatePrecision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmulatePrecision.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC081B04375F00235552 /* Intermediate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Intermediate.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC091B04375F00235552 /* IntermNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntermNode.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC0A1B04375F00235552 /* IntermNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntermNode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC0B1B04375F00235552 /* length_limits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = length_limits.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC0C1B04375F00235552 /* Operator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Operator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC0D1B04375F00235552 /* Operator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Operator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC0E1B04375F00235552 /* PruneEmptyDeclarations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PruneEmptyDeclarations.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC0F1B04375F00235552 /* PruneEmptyDeclarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PruneEmptyDeclarations.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC101B04375F00235552 /* RegenerateStructNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegenerateStructNames.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC111B04375F00235552 /* RegenerateStructNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegenerateStructNames.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC121B04375F00235552 /* RemoveSwitchFallThrough.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoveSwitchFallThrough.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC131B04375F00235552 /* RemoveSwitchFallThrough.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveSwitchFallThrough.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC141B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScalarizeVecAndMatConstructorArgs.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC151B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScalarizeVecAndMatConstructorArgs.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC161B04375F00235552 /* SeparateArrayInitialization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SeparateArrayInitialization.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC171B04375F00235552 /* SeparateArrayInitialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SeparateArrayInitialization.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC181B04375F00235552 /* SeparateDeclarations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SeparateDeclarations.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC191B04375F00235552 /* SeparateDeclarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SeparateDeclarations.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC1A1B04375F00235552 /* ShaderVars.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShaderVars.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC1B1B04375F00235552 /* SimplifyArrayAssignment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimplifyArrayAssignment.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC1C1B04375F00235552 /* SimplifyArrayAssignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimplifyArrayAssignment.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC1D1B04375F00235552 /* Types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Types.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC1E1B04375F00235552 /* ValidateSwitch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValidateSwitch.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC1F1B04375F00235552 /* ValidateSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidateSwitch.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC481B0438D200235552 /* angletypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = angletypes.cpp; path = src/libANGLE/angletypes.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC491B0438D200235552 /* angletypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = angletypes.h; path = src/libANGLE/angletypes.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC4A1B0438D200235552 /* AttributeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AttributeMap.cpp; path = src/libANGLE/AttributeMap.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC4B1B0438D200235552 /* AttributeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttributeMap.h; path = src/libANGLE/AttributeMap.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC4C1B0438D200235552 /* BinaryStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BinaryStream.h; path = src/libANGLE/BinaryStream.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC4D1B0438D200235552 /* Buffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Buffer.cpp; path = src/libANGLE/Buffer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC4E1B0438D200235552 /* Buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Buffer.h; path = src/libANGLE/Buffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC4F1B0438D200235552 /* Caps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Caps.cpp; path = src/libANGLE/Caps.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC501B0438D200235552 /* Caps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Caps.h; path = src/libANGLE/Caps.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC511B0438D200235552 /* Compiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Compiler.cpp; path = src/libANGLE/Compiler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC521B0438D200235552 /* Compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Compiler.h; path = src/libANGLE/Compiler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC541B0438D200235552 /* Config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Config.cpp; path = src/libANGLE/Config.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC551B0438D200235552 /* Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Config.h; path = src/libANGLE/Config.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC561B0438D200235552 /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Constants.h; path = src/libANGLE/Constants.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC571B0438D200235552 /* Context.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Context.cpp; path = src/libANGLE/Context.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC581B0438D200235552 /* Context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Context.h; path = src/libANGLE/Context.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC591B0438D200235552 /* Data.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Data.cpp; path = src/libANGLE/Data.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC5A1B0438D200235552 /* Data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Data.h; path = src/libANGLE/Data.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC5B1B0438D200235552 /* Device.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Device.cpp; path = src/libANGLE/Device.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC5C1B0438D200235552 /* Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Device.h; path = src/libANGLE/Device.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC5D1B0438D200235552 /* Display.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Display.cpp; path = src/libANGLE/Display.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC5E1B0438D200235552 /* Display.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Display.h; path = src/libANGLE/Display.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC5F1B0438D200235552 /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Error.cpp; path = src/libANGLE/Error.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC601B0438D200235552 /* Error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Error.h; path = src/libANGLE/Error.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC611B0438D200235552 /* Error.inl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Error.inl; path = src/libANGLE/Error.inl; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC621B0438D200235552 /* features.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = features.h; path = src/libANGLE/features.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC641B0438D200235552 /* Fence.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fence.cpp; path = src/libANGLE/Fence.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC651B0438D200235552 /* Fence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Fence.h; path = src/libANGLE/Fence.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC661B0438D200235552 /* Float16ToFloat32.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Float16ToFloat32.cpp; path = src/libANGLE/Float16ToFloat32.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC681B0438D200235552 /* formatutils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = formatutils.cpp; path = src/libANGLE/formatutils.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC691B0438D200235552 /* formatutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = formatutils.h; path = src/libANGLE/formatutils.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC6A1B0438D200235552 /* Framebuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Framebuffer.cpp; path = src/libANGLE/Framebuffer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC6B1B0438D200235552 /* Framebuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Framebuffer.h; path = src/libANGLE/Framebuffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC6C1B0438D200235552 /* FramebufferAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FramebufferAttachment.cpp; path = src/libANGLE/FramebufferAttachment.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC6D1B0438D200235552 /* FramebufferAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FramebufferAttachment.h; path = src/libANGLE/FramebufferAttachment.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC6F1B0438D200235552 /* HandleAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HandleAllocator.cpp; path = src/libANGLE/HandleAllocator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC701B0438D200235552 /* HandleAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HandleAllocator.h; path = src/libANGLE/HandleAllocator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC711B0438D200235552 /* histogram_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = histogram_macros.h; path = src/libANGLE/histogram_macros.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC721B0438D200235552 /* ImageIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ImageIndex.cpp; path = src/libANGLE/ImageIndex.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC731B0438D200235552 /* ImageIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageIndex.h; path = src/libANGLE/ImageIndex.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC751B0438D200235552 /* Platform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Platform.cpp; path = src/libANGLE/Platform.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC761B0438D200235552 /* Program.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Program.cpp; path = src/libANGLE/Program.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC771B0438D200235552 /* Program.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Program.h; path = src/libANGLE/Program.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC781B0438D200235552 /* Query.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Query.cpp; path = src/libANGLE/Query.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC791B0438D200235552 /* Query.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Query.h; path = src/libANGLE/Query.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC7A1B0438D200235552 /* queryconversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = queryconversions.cpp; path = src/libANGLE/queryconversions.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC7B1B0438D200235552 /* queryconversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = queryconversions.h; path = src/libANGLE/queryconversions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC7C1B0438D200235552 /* RefCountObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RefCountObject.cpp; path = src/libANGLE/RefCountObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC7D1B0438D200235552 /* RefCountObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RefCountObject.h; path = src/libANGLE/RefCountObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC7E1B0438D200235552 /* Renderbuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Renderbuffer.cpp; path = src/libANGLE/Renderbuffer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBC7F1B0438D200235552 /* Renderbuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Renderbuffer.h; path = src/libANGLE/Renderbuffer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDB51B0438D200235552 /* ResourceManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ResourceManager.cpp; path = src/libANGLE/ResourceManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDB61B0438D200235552 /* ResourceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ResourceManager.h; path = src/libANGLE/ResourceManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDB71B0438D200235552 /* Sampler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sampler.cpp; path = src/libANGLE/Sampler.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDB81B0438D200235552 /* Sampler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sampler.h; path = src/libANGLE/Sampler.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDB91B0438D200235552 /* Shader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Shader.cpp; path = src/libANGLE/Shader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDBA1B0438D200235552 /* Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Shader.h; path = src/libANGLE/Shader.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDBB1B0438D300235552 /* State.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = State.cpp; path = src/libANGLE/State.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDBC1B0438D300235552 /* State.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = State.h; path = src/libANGLE/State.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDBE1B0438D300235552 /* Surface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Surface.cpp; path = src/libANGLE/Surface.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDBF1B0438D300235552 /* Surface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Surface.h; path = src/libANGLE/Surface.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC01B0438D300235552 /* Texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Texture.cpp; path = src/libANGLE/Texture.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC11B0438D300235552 /* Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Texture.h; path = src/libANGLE/Texture.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC31B0438D300235552 /* TransformFeedback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TransformFeedback.cpp; path = src/libANGLE/TransformFeedback.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC41B0438D300235552 /* TransformFeedback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformFeedback.h; path = src/libANGLE/TransformFeedback.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC51B0438D300235552 /* Uniform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Uniform.cpp; path = src/libANGLE/Uniform.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC61B0438D300235552 /* Uniform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Uniform.h; path = src/libANGLE/Uniform.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC71B0438D300235552 /* validationEGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = validationEGL.cpp; path = src/libANGLE/validationEGL.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC81B0438D300235552 /* validationEGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = validationEGL.h; path = src/libANGLE/validationEGL.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDC91B0438D300235552 /* validationES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = validationES.cpp; path = src/libANGLE/validationES.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDCA1B0438D300235552 /* validationES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = validationES.h; path = src/libANGLE/validationES.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDCB1B0438D300235552 /* validationES2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = validationES2.cpp; path = src/libANGLE/validationES2.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDCC1B0438D300235552 /* validationES2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = validationES2.h; path = src/libANGLE/validationES2.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDCD1B0438D300235552 /* validationES3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = validationES3.cpp; path = src/libANGLE/validationES3.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDCE1B0438D300235552 /* validationES3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = validationES3.h; path = src/libANGLE/validationES3.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDCF1B0438D300235552 /* VertexArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VertexArray.cpp; path = src/libANGLE/VertexArray.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDD01B0438D300235552 /* VertexArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexArray.h; path = src/libANGLE/VertexArray.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDD11B0438D300235552 /* VertexAttribute.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VertexAttribute.cpp; path = src/libANGLE/VertexAttribute.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5C1DBDD21B0438D300235552 /* VertexAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VertexAttribute.h; path = src/libANGLE/VertexAttribute.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 5C9FFF4C19102A000025B8FA /* FlagStd140Structs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FlagStd140Structs.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5C9FFF4D19102A000025B8FA /* FlagStd140Structs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlagStd140Structs.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D44B191024E3000B8C1F /* LoopInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoopInfo.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -304,19 +522,12 @@
</span><span class="cx">                 5CC7D450191024E4000B8C1F /* ValidateOutputs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValidateOutputs.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D451191024E4000B8C1F /* ValidateOutputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValidateOutputs.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D45A19102620000B8C1F /* angleutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = angleutils.h; path = src/common/angleutils.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                5CC7D45B19102620000B8C1F /* blocklayout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = blocklayout.cpp; path = src/common/blocklayout.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                5CC7D45C19102620000B8C1F /* blocklayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blocklayout.h; path = src/common/blocklayout.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 5CC7D45D19102620000B8C1F /* debug.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = debug.cpp; path = src/common/debug.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D45E19102620000B8C1F /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = debug.h; path = src/common/debug.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D45F19102620000B8C1F /* event_tracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = event_tracer.cpp; path = src/common/event_tracer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D46019102620000B8C1F /* event_tracer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = event_tracer.h; path = src/common/event_tracer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D46119102620000B8C1F /* mathutil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mathutil.cpp; path = src/common/mathutil.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D46219102620000B8C1F /* mathutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mathutil.h; path = src/common/mathutil.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                5CC7D46319102620000B8C1F /* RefCountObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RefCountObject.cpp; path = src/common/RefCountObject.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                5CC7D46419102620000B8C1F /* RefCountObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RefCountObject.h; path = src/common/RefCountObject.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                5CC7D46519102620000B8C1F /* shadervars.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = shadervars.cpp; path = src/common/shadervars.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                5CC7D46619102620000B8C1F /* shadervars.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = shadervars.h; path = src/common/shadervars.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                5CC7D46719102620000B8C1F /* system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = system.h; path = src/common/system.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 5CC7D46819102620000B8C1F /* utilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utilities.cpp; path = src/common/utilities.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D46919102620000B8C1F /* utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utilities.h; path = src/common/utilities.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5CC7D46A19102620000B8C1F /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = version.h; path = src/common/version.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -369,6 +580,45 @@
</span><span class="cx">                 31012D9F18B97B9B0039062F /* translator */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                5C1DBBF91B04375E00235552 /* ArrayReturnValueToOutParameter.cpp */,
+                                5C1DBBFA1B04375E00235552 /* ArrayReturnValueToOutParameter.h */,
+                                5C1DBBFB1B04375F00235552 /* ASTMetadataHLSL.cpp */,
+                                5C1DBBFC1B04375F00235552 /* ASTMetadataHLSL.h */,
+                                5C1DBBFD1B04375F00235552 /* blocklayout.cpp */,
+                                5C1DBBFE1B04375F00235552 /* blocklayout.h */,
+                                5C1DBBFF1B04375F00235552 /* blocklayoutHLSL.cpp */,
+                                5C1DBC001B04375F00235552 /* blocklayoutHLSL.h */,
+                                5C1DBC011B04375F00235552 /* BuiltInFunctionEmulatorGLSL.cpp */,
+                                5C1DBC021B04375F00235552 /* BuiltInFunctionEmulatorGLSL.h */,
+                                5C1DBC031B04375F00235552 /* CallDAG.cpp */,
+                                5C1DBC041B04375F00235552 /* CallDAG.h */,
+                                5C1DBC051B04375F00235552 /* Compiler.h */,
+                                5C1DBC061B04375F00235552 /* EmulatePrecision.cpp */,
+                                5C1DBC071B04375F00235552 /* EmulatePrecision.h */,
+                                5C1DBC081B04375F00235552 /* Intermediate.h */,
+                                5C1DBC091B04375F00235552 /* IntermNode.cpp */,
+                                5C1DBC0A1B04375F00235552 /* IntermNode.h */,
+                                5C1DBC0B1B04375F00235552 /* length_limits.h */,
+                                5C1DBC0C1B04375F00235552 /* Operator.cpp */,
+                                5C1DBC0D1B04375F00235552 /* Operator.h */,
+                                5C1DBC0E1B04375F00235552 /* PruneEmptyDeclarations.cpp */,
+                                5C1DBC0F1B04375F00235552 /* PruneEmptyDeclarations.h */,
+                                5C1DBC101B04375F00235552 /* RegenerateStructNames.cpp */,
+                                5C1DBC111B04375F00235552 /* RegenerateStructNames.h */,
+                                5C1DBC121B04375F00235552 /* RemoveSwitchFallThrough.cpp */,
+                                5C1DBC131B04375F00235552 /* RemoveSwitchFallThrough.h */,
+                                5C1DBC141B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.cpp */,
+                                5C1DBC151B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.h */,
+                                5C1DBC161B04375F00235552 /* SeparateArrayInitialization.cpp */,
+                                5C1DBC171B04375F00235552 /* SeparateArrayInitialization.h */,
+                                5C1DBC181B04375F00235552 /* SeparateDeclarations.cpp */,
+                                5C1DBC191B04375F00235552 /* SeparateDeclarations.h */,
+                                5C1DBC1A1B04375F00235552 /* ShaderVars.cpp */,
+                                5C1DBC1B1B04375F00235552 /* SimplifyArrayAssignment.cpp */,
+                                5C1DBC1C1B04375F00235552 /* SimplifyArrayAssignment.h */,
+                                5C1DBC1D1B04375F00235552 /* Types.cpp */,
+                                5C1DBC1E1B04375F00235552 /* ValidateSwitch.cpp */,
+                                5C1DBC1F1B04375F00235552 /* ValidateSwitch.h */,
</ins><span class="cx">                                 5C9FFF4C19102A000025B8FA /* FlagStd140Structs.cpp */,
</span><span class="cx">                                 5C9FFF4D19102A000025B8FA /* FlagStd140Structs.h */,
</span><span class="cx">                                 5CC7D44B191024E3000B8C1F /* LoopInfo.cpp */,
</span><span class="lines">@@ -382,14 +632,8 @@
</span><span class="cx">                                 31012DA218B97B9B0039062F /* BuiltInFunctionEmulator.h */,
</span><span class="cx">                                 31012DA318B97B9B0039062F /* CodeGen.cpp */,
</span><span class="cx">                                 31012DA418B97B9B0039062F /* Common.h */,
</span><del>-                                31012E8118B97C860039062F /* compilerdebug.cpp */,
-                                31012E8218B97C860039062F /* compilerdebug.h */,
</del><span class="cx">                                 31012DA518B97B9B0039062F /* Compiler.cpp */,
</span><span class="cx">                                 31012DA818B97B9B0039062F /* ConstantUnion.h */,
</span><del>-                                31012DB118B97B9B0039062F /* DetectCallDepth.cpp */,
-                                31012DB218B97B9B0039062F /* DetectCallDepth.h */,
-                                31012DB318B97B9B0039062F /* DetectDiscontinuity.cpp */,
-                                31012DB418B97B9B0039062F /* DetectDiscontinuity.h */,
</del><span class="cx">                                 31012DB518B97B9B0039062F /* Diagnostics.cpp */,
</span><span class="cx">                                 31012DB618B97B9B0039062F /* Diagnostics.h */,
</span><span class="cx">                                 31012DB718B97B9B0039062F /* DirectiveHandler.cpp */,
</span><span class="lines">@@ -414,14 +658,10 @@
</span><span class="cx">                                 31012DCD18B97B9B0039062F /* InitializeVariables.cpp */,
</span><span class="cx">                                 31012DCE18B97B9B0039062F /* InitializeVariables.h */,
</span><span class="cx">                                 31012DCF18B97B9B0039062F /* Intermediate.cpp */,
</span><del>-                                31012DD018B97B9B0039062F /* intermediate.h */,
</del><span class="cx">                                 31012DD118B97B9B0039062F /* intermOut.cpp */,
</span><span class="cx">                                 31012DD218B97B9B0039062F /* IntermTraverse.cpp */,
</span><del>-                                31012DD318B97B9B0039062F /* localintermediate.h */,
</del><span class="cx">                                 31012DD618B97B9B0039062F /* MMap.h */,
</span><span class="cx">                                 31012DD718B97B9B0039062F /* NodeSearch.h */,
</span><del>-                                31012DD818B97B9B0039062F /* osinclude.h */,
-                                31012DD918B97B9B0039062F /* ossource_posix.cpp */,
</del><span class="cx">                                 31012DDB18B97B9B0039062F /* OutputESSL.cpp */,
</span><span class="cx">                                 31012DDC18B97B9B0039062F /* OutputESSL.h */,
</span><span class="cx">                                 31012DDD18B97B9B0039062F /* OutputGLSL.cpp */,
</span><span class="lines">@@ -438,15 +678,12 @@
</span><span class="cx">                                 31012DE818B97B9B0039062F /* Pragma.h */,
</span><span class="cx">                                 31012DE918B97B9B0039062F /* QualifierAlive.cpp */,
</span><span class="cx">                                 31012DEA18B97B9B0039062F /* QualifierAlive.h */,
</span><del>-                                31012DEB18B97B9B0039062F /* RemoveTree.cpp */,
-                                31012DEC18B97B9B0039062F /* RemoveTree.h */,
</del><span class="cx">                                 31012DED18B97B9B0039062F /* RenameFunction.h */,
</span><span class="cx">                                 31012DEE18B97B9B0039062F /* RewriteElseBlocks.cpp */,
</span><span class="cx">                                 31012DEF18B97B9B0039062F /* RewriteElseBlocks.h */,
</span><span class="cx">                                 31012DF018B97B9B0039062F /* SearchSymbol.cpp */,
</span><span class="cx">                                 31012DF118B97B9B0039062F /* SearchSymbol.h */,
</span><span class="cx">                                 31012DF218B97B9B0039062F /* ShaderLang.cpp */,
</span><del>-                                31012DF318B97B9B0039062F /* ShHandle.h */,
</del><span class="cx">                                 31012DF418B97B9B0039062F /* SymbolTable.cpp */,
</span><span class="cx">                                 31012DF518B97B9B0039062F /* SymbolTable.h */,
</span><span class="cx">                                 31012DFB18B97B9B0039062F /* TranslatorESSL.cpp */,
</span><span class="lines">@@ -508,23 +745,109 @@
</span><span class="cx">                         name = misc;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="cx">                 };
</span><ins>+                5C1DBC471B0438B700235552 /* libANGLE */ = {
+                        isa = PBXGroup;
+                        children = (
+                                5C1DBC481B0438D200235552 /* angletypes.cpp */,
+                                5C1DBC491B0438D200235552 /* angletypes.h */,
+                                5C1DBC4A1B0438D200235552 /* AttributeMap.cpp */,
+                                5C1DBC4B1B0438D200235552 /* AttributeMap.h */,
+                                5C1DBC4C1B0438D200235552 /* BinaryStream.h */,
+                                5C1DBC4D1B0438D200235552 /* Buffer.cpp */,
+                                5C1DBC4E1B0438D200235552 /* Buffer.h */,
+                                5C1DBC4F1B0438D200235552 /* Caps.cpp */,
+                                5C1DBC501B0438D200235552 /* Caps.h */,
+                                5C1DBC511B0438D200235552 /* Compiler.cpp */,
+                                5C1DBC521B0438D200235552 /* Compiler.h */,
+                                5C1DBC541B0438D200235552 /* Config.cpp */,
+                                5C1DBC551B0438D200235552 /* Config.h */,
+                                5C1DBC561B0438D200235552 /* Constants.h */,
+                                5C1DBC571B0438D200235552 /* Context.cpp */,
+                                5C1DBC581B0438D200235552 /* Context.h */,
+                                5C1DBC591B0438D200235552 /* Data.cpp */,
+                                5C1DBC5A1B0438D200235552 /* Data.h */,
+                                5C1DBC5B1B0438D200235552 /* Device.cpp */,
+                                5C1DBC5C1B0438D200235552 /* Device.h */,
+                                5C1DBC5D1B0438D200235552 /* Display.cpp */,
+                                5C1DBC5E1B0438D200235552 /* Display.h */,
+                                5C1DBC5F1B0438D200235552 /* Error.cpp */,
+                                5C1DBC601B0438D200235552 /* Error.h */,
+                                5C1DBC611B0438D200235552 /* Error.inl */,
+                                5C1DBC621B0438D200235552 /* features.h */,
+                                5C1DBC641B0438D200235552 /* Fence.cpp */,
+                                5C1DBC651B0438D200235552 /* Fence.h */,
+                                5C1DBC661B0438D200235552 /* Float16ToFloat32.cpp */,
+                                5C1DBC681B0438D200235552 /* formatutils.cpp */,
+                                5C1DBC691B0438D200235552 /* formatutils.h */,
+                                5C1DBC6A1B0438D200235552 /* Framebuffer.cpp */,
+                                5C1DBC6B1B0438D200235552 /* Framebuffer.h */,
+                                5C1DBC6C1B0438D200235552 /* FramebufferAttachment.cpp */,
+                                5C1DBC6D1B0438D200235552 /* FramebufferAttachment.h */,
+                                5C1DBC6F1B0438D200235552 /* HandleAllocator.cpp */,
+                                5C1DBC701B0438D200235552 /* HandleAllocator.h */,
+                                5C1DBC711B0438D200235552 /* histogram_macros.h */,
+                                5C1DBC721B0438D200235552 /* ImageIndex.cpp */,
+                                5C1DBC731B0438D200235552 /* ImageIndex.h */,
+                                5C1DBC751B0438D200235552 /* Platform.cpp */,
+                                5C1DBC761B0438D200235552 /* Program.cpp */,
+                                5C1DBC771B0438D200235552 /* Program.h */,
+                                5C1DBC781B0438D200235552 /* Query.cpp */,
+                                5C1DBC791B0438D200235552 /* Query.h */,
+                                5C1DBC7A1B0438D200235552 /* queryconversions.cpp */,
+                                5C1DBC7B1B0438D200235552 /* queryconversions.h */,
+                                5C1DBC7C1B0438D200235552 /* RefCountObject.cpp */,
+                                5C1DBC7D1B0438D200235552 /* RefCountObject.h */,
+                                5C1DBC7E1B0438D200235552 /* Renderbuffer.cpp */,
+                                5C1DBC7F1B0438D200235552 /* Renderbuffer.h */,
+                                5C1DBDB51B0438D200235552 /* ResourceManager.cpp */,
+                                5C1DBDB61B0438D200235552 /* ResourceManager.h */,
+                                5C1DBDB71B0438D200235552 /* Sampler.cpp */,
+                                5C1DBDB81B0438D200235552 /* Sampler.h */,
+                                5C1DBDB91B0438D200235552 /* Shader.cpp */,
+                                5C1DBDBA1B0438D200235552 /* Shader.h */,
+                                5C1DBDBB1B0438D300235552 /* State.cpp */,
+                                5C1DBDBC1B0438D300235552 /* State.h */,
+                                5C1DBDBE1B0438D300235552 /* Surface.cpp */,
+                                5C1DBDBF1B0438D300235552 /* Surface.h */,
+                                5C1DBDC01B0438D300235552 /* Texture.cpp */,
+                                5C1DBDC11B0438D300235552 /* Texture.h */,
+                                5C1DBDC31B0438D300235552 /* TransformFeedback.cpp */,
+                                5C1DBDC41B0438D300235552 /* TransformFeedback.h */,
+                                5C1DBDC51B0438D300235552 /* Uniform.cpp */,
+                                5C1DBDC61B0438D300235552 /* Uniform.h */,
+                                5C1DBDC71B0438D300235552 /* validationEGL.cpp */,
+                                5C1DBDC81B0438D300235552 /* validationEGL.h */,
+                                5C1DBDC91B0438D300235552 /* validationES.cpp */,
+                                5C1DBDCA1B0438D300235552 /* validationES.h */,
+                                5C1DBDCB1B0438D300235552 /* validationES2.cpp */,
+                                5C1DBDCC1B0438D300235552 /* validationES2.h */,
+                                5C1DBDCD1B0438D300235552 /* validationES3.cpp */,
+                                5C1DBDCE1B0438D300235552 /* validationES3.h */,
+                                5C1DBDCF1B0438D300235552 /* VertexArray.cpp */,
+                                5C1DBDD01B0438D300235552 /* VertexArray.h */,
+                                5C1DBDD11B0438D300235552 /* VertexAttribute.cpp */,
+                                5C1DBDD21B0438D300235552 /* VertexAttribute.h */,
+                        );
+                        name = libANGLE;
+                        sourceTree = &quot;&lt;group&gt;&quot;;
+                };
</ins><span class="cx">                 5CC7D45919102608000B8C1F /* common */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                5C1DBBE71B0436EC00235552 /* angleutils.cpp */,
+                                5C1DBBE81B0436EC00235552 /* MemoryBuffer.cpp */,
+                                5C1DBBE91B0436EC00235552 /* MemoryBuffer.h */,
+                                5C1DBBEB1B0436EC00235552 /* Optional.h */,
+                                5C1DBBEC1B0436EC00235552 /* platform.h */,
+                                5C1DBBED1B0436EC00235552 /* tls.cpp */,
+                                5C1DBBEE1B0436EC00235552 /* tls.h */,
</ins><span class="cx">                                 5CC7D45A19102620000B8C1F /* angleutils.h */,
</span><del>-                                5CC7D45B19102620000B8C1F /* blocklayout.cpp */,
-                                5CC7D45C19102620000B8C1F /* blocklayout.h */,
</del><span class="cx">                                 5CC7D45D19102620000B8C1F /* debug.cpp */,
</span><span class="cx">                                 5CC7D45E19102620000B8C1F /* debug.h */,
</span><span class="cx">                                 5CC7D45F19102620000B8C1F /* event_tracer.cpp */,
</span><span class="cx">                                 5CC7D46019102620000B8C1F /* event_tracer.h */,
</span><span class="cx">                                 5CC7D46119102620000B8C1F /* mathutil.cpp */,
</span><span class="cx">                                 5CC7D46219102620000B8C1F /* mathutil.h */,
</span><del>-                                5CC7D46319102620000B8C1F /* RefCountObject.cpp */,
-                                5CC7D46419102620000B8C1F /* RefCountObject.h */,
-                                5CC7D46519102620000B8C1F /* shadervars.cpp */,
-                                5CC7D46619102620000B8C1F /* shadervars.h */,
-                                5CC7D46719102620000B8C1F /* system.h */,
</del><span class="cx">                                 5CC7D46819102620000B8C1F /* utilities.cpp */,
</span><span class="cx">                                 5CC7D46919102620000B8C1F /* utilities.h */,
</span><span class="cx">                                 5CC7D46A19102620000B8C1F /* version.h */,
</span><span class="lines">@@ -591,6 +914,7 @@
</span><span class="cx">                 FB39D0841200EDEB00088E69 /* src */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                5C1DBC471B0438B700235552 /* libANGLE */,
</ins><span class="cx">                                 5CC7D45919102608000B8C1F /* common */,
</span><span class="cx">                                 FB39D2201200F35A00088E69 /* compiler */,
</span><span class="cx">                                 A08C3CD816D6CB35003F0B83 /* third_party */,
</span><span class="lines">@@ -651,6 +975,7 @@
</span><span class="cx">                 FB39D2BD1200F3E600088E69 /* GLSLANG */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                5C1DBBE51B04075B00235552 /* ShaderVars.h */,
</ins><span class="cx">                                 FB39D2BF1200F3E600088E69 /* ShaderLang.h */,
</span><span class="cx">                         );
</span><span class="cx">                         name = GLSLANG;
</span><span class="lines">@@ -667,87 +992,140 @@
</span><span class="cx">                                 31012E3C18B97B9B0039062F /* InitializeParseContext.h in Headers */,
</span><span class="cx">                                 A08C3CDD16D6CB61003F0B83 /* ArrayBoundsClamper.h in Headers */,
</span><span class="cx">                                 5CC7D46F19102621000B8C1F /* debug.h in Headers */,
</span><del>-                                5CC7D47519102621000B8C1F /* RefCountObject.h in Headers */,
</del><ins>+                                5C1DBDDD1B0438D300235552 /* Compiler.h in Headers */,
</ins><span class="cx">                                 31012E3E18B97B9B0039062F /* InitializeVariables.h in Headers */,
</span><ins>+                                5C1DBF2A1B0438D300235552 /* Shader.h in Headers */,
</ins><span class="cx">                                 31012E1418B97B9B0039062F /* BuiltInFunctionEmulator.h in Headers */,
</span><span class="cx">                                 31012E5518B97B9B0039062F /* ParseContext.h in Headers */,
</span><del>-                                5CC7D47719102621000B8C1F /* shadervars.h in Headers */,
</del><ins>+                                5C1DBDEF1B0438D300235552 /* Fence.h in Headers */,
</ins><span class="cx">                                 31012E2C18B97B9B0039062F /* ForLoopUnroll.h in Headers */,
</span><span class="cx">                                 31012E6D18B97B9B0039062F /* TranslatorGLSL.h in Headers */,
</span><ins>+                                5C1DBC3E1B04375F00235552 /* SeparateArrayInitialization.h in Headers */,
</ins><span class="cx">                                 31012E4618B97B9B0039062F /* MMap.h in Headers */,
</span><ins>+                                5C1DBC431B04375F00235552 /* SimplifyArrayAssignment.h in Headers */,
</ins><span class="cx">                                 5CC7D47319102621000B8C1F /* mathutil.h in Headers */,
</span><span class="cx">                                 31012E6B18B97B9B0039062F /* TranslatorESSL.h in Headers */,
</span><ins>+                                5C1DBE001B0438D300235552 /* Program.h in Headers */,
+                                5C1DBC2B1B04375F00235552 /* CallDAG.h in Headers */,
</ins><span class="cx">                                 31012E1618B97B9B0039062F /* Common.h in Headers */,
</span><span class="cx">                                 31012E2018B97B9B0039062F /* DependencyGraphOutput.h in Headers */,
</span><span class="cx">                                 31012E7C18B97B9B0039062F /* VariableInfo.h in Headers */,
</span><ins>+                                5C1DBDDB1B0438D300235552 /* Caps.h in Headers */,
+                                5C1DBE021B0438D300235552 /* Query.h in Headers */,
</ins><span class="cx">                                 31012E6118B97B9B0039062F /* SearchSymbol.h in Headers */,
</span><ins>+                                5C1DBF311B0438D300235552 /* Texture.h in Headers */,
</ins><span class="cx">                                 31012E4718B97B9B0039062F /* NodeSearch.h in Headers */,
</span><span class="cx">                                 A264F8AD16974DED006FAA5A /* DiagnosticsBase.h in Headers */,
</span><ins>+                                5C1DBE041B0438D300235552 /* queryconversions.h in Headers */,
</ins><span class="cx">                                 31012E4C18B97B9B0039062F /* OutputESSL.h in Headers */,
</span><ins>+                                5C1DBF261B0438D300235552 /* ResourceManager.h in Headers */,
+                                5C1DBF421B0438D300235552 /* VertexAttribute.h in Headers */,
+                                5C1DBF3E1B0438D300235552 /* validationES3.h in Headers */,
+                                5C1DBC2F1B04375F00235552 /* Intermediate.h in Headers */,
</ins><span class="cx">                                 31012E5F18B97B9B0039062F /* RewriteElseBlocks.h in Headers */,
</span><span class="cx">                                 A264F8AF16974DED006FAA5A /* DirectiveHandlerBase.h in Headers */,
</span><span class="cx">                                 31012E7E18B97B9B0039062F /* VariablePacker.h in Headers */,
</span><span class="cx">                                 31012E5018B97B9B0039062F /* OutputGLSLBase.h in Headers */,
</span><del>-                                31012E4018B97B9B0039062F /* intermediate.h in Headers */,
</del><span class="cx">                                 5CC7D47119102621000B8C1F /* event_tracer.h in Headers */,
</span><del>-                                31012E2518B97B9B0039062F /* DetectDiscontinuity.h in Headers */,
</del><ins>+                                5C1DBDE71B0438D300235552 /* Device.h in Headers */,
+                                5C1DBE061B0438D300235552 /* RefCountObject.h in Headers */,
</ins><span class="cx">                                 31012E5D18B97B9B0039062F /* RenameFunction.h in Headers */,
</span><ins>+                                5C1DBDFA1B0438D300235552 /* histogram_macros.h in Headers */,
+                                5C1DBDD71B0438D300235552 /* BinaryStream.h in Headers */,
</ins><span class="cx">                                 31012E3A18B97B9B0039062F /* InitializeGlobals.h in Headers */,
</span><ins>+                                5C1DBC291B04375F00235552 /* BuiltInFunctionEmulatorGLSL.h in Headers */,
+                                5C1DBBE61B04075B00235552 /* ShaderVars.h in Headers */,
+                                5C1DBC251B04375F00235552 /* blocklayout.h in Headers */,
+                                5C1DBC271B04375F00235552 /* blocklayoutHLSL.h in Headers */,
</ins><span class="cx">                                 31012E8018B97B9B0039062F /* VersionGLSL.h in Headers */,
</span><span class="cx">                                 5C9FFF4F19102A000025B8FA /* FlagStd140Structs.h in Headers */,
</span><ins>+                                5C1DBDF91B0438D300235552 /* HandleAllocator.h in Headers */,
+                                5C1DBDD91B0438D300235552 /* Buffer.h in Headers */,
</ins><span class="cx">                                 31012E2718B97B9B0039062F /* Diagnostics.h in Headers */,
</span><ins>+                                5C1DBC361B04375F00235552 /* PruneEmptyDeclarations.h in Headers */,
+                                5C1DBDF61B0438D300235552 /* FramebufferAttachment.h in Headers */,
</ins><span class="cx">                                 5CC7D46B19102620000B8C1F /* angleutils.h in Headers */,
</span><span class="cx">                                 31012E3218B97B9B0039062F /* glslang_tab.h in Headers */,
</span><span class="cx">                                 A264F8B116974DED006FAA5A /* DirectiveParser.h in Headers */,
</span><ins>+                                5C1DBF341B0438D300235552 /* TransformFeedback.h in Headers */,
</ins><span class="cx">                                 31012E5818B97B9B0039062F /* Pragma.h in Headers */,
</span><ins>+                                5C1DBDE01B0438D300235552 /* Config.h in Headers */,
</ins><span class="cx">                                 31012E6518B97B9B0039062F /* SymbolTable.h in Headers */,
</span><ins>+                                5C1DBC321B04375F00235552 /* length_limits.h in Headers */,
</ins><span class="cx">                                 5CC7D458191024E4000B8C1F /* ValidateOutputs.h in Headers */,
</span><span class="cx">                                 31012E7418B97B9B0039062F /* UnfoldShortCircuitAST.h in Headers */,
</span><ins>+                                5C1DBDF41B0438D300235552 /* Framebuffer.h in Headers */,
</ins><span class="cx">                                 31012E7218B97B9B0039062F /* UnfoldShortCircuit.h in Headers */,
</span><span class="cx">                                 A264F8B316974DED006FAA5A /* ExpressionParser.h in Headers */,
</span><del>-                                31012E5C18B97B9B0039062F /* RemoveTree.h in Headers */,
-                                31012E4818B97B9B0039062F /* osinclude.h in Headers */,
</del><span class="cx">                                 31012E3518B97B9B0039062F /* InfoSink.h in Headers */,
</span><del>-                                5CC7D47819102621000B8C1F /* system.h in Headers */,
</del><ins>+                                5C1DBF3A1B0438D300235552 /* validationES.h in Headers */,
+                                5C1DBF401B0438D300235552 /* VertexArray.h in Headers */,
+                                5C1DBDEB1B0438D300235552 /* Error.h in Headers */,
+                                5C1DBC2C1B04375F00235552 /* Compiler.h in Headers */,
+                                5C1DBDD41B0438D300235552 /* angletypes.h in Headers */,
</ins><span class="cx">                                 31012E1C18B97B9B0039062F /* DependencyGraph.h in Headers */,
</span><del>-                                31012E6318B97B9B0039062F /* ShHandle.h in Headers */,
</del><span class="cx">                                 31012E7018B97B9B0039062F /* Types.h in Headers */,
</span><ins>+                                5C1DBC3A1B04375F00235552 /* RemoveSwitchFallThrough.h in Headers */,
</ins><span class="cx">                                 31012E6718B97B9B0039062F /* RestrictFragmentShaderTiming.h in Headers */,
</span><del>-                                31012E4318B97B9B0039062F /* localintermediate.h in Headers */,
</del><span class="cx">                                 5CC7D47B19102621000B8C1F /* version.h in Headers */,
</span><ins>+                                5C1DBF281B0438D300235552 /* Sampler.h in Headers */,
+                                5C1DBF381B0438D300235552 /* validationEGL.h in Headers */,
+                                5C1DBF3C1B0438D300235552 /* validationES2.h in Headers */,
</ins><span class="cx">                                 31012E7818B97B9B0039062F /* util.h in Headers */,
</span><ins>+                                5C1DBDEC1B0438D300235552 /* features.h in Headers */,
</ins><span class="cx">                                 A264F8B516974DED006FAA5A /* Input.h in Headers */,
</span><span class="cx">                                 5CC7D453191024E4000B8C1F /* LoopInfo.h in Headers */,
</span><ins>+                                5C1DBBF41B0436EC00235552 /* Optional.h in Headers */,
</ins><span class="cx">                                 A264F8CD169762AA006FAA5A /* khrplatform.h in Headers */,
</span><ins>+                                5C1DBBF71B0436EC00235552 /* tls.h in Headers */,
+                                5C1DBBF51B0436EC00235552 /* platform.h in Headers */,
</ins><span class="cx">                                 5CC7D47A19102621000B8C1F /* utilities.h in Headers */,
</span><del>-                                31012E2318B97B9B0039062F /* DetectCallDepth.h in Headers */,
</del><span class="cx">                                 31012E3918B97B9B0039062F /* InitializeDll.h in Headers */,
</span><ins>+                                5C1DBBF21B0436EC00235552 /* MemoryBuffer.h in Headers */,
</ins><span class="cx">                                 A264F8B716974DED006FAA5A /* Lexer.h in Headers */,
</span><del>-                                31012E8418B97C860039062F /* compilerdebug.h in Headers */,
</del><span class="cx">                                 A264F8B916974DED006FAA5A /* Macro.h in Headers */,
</span><span class="cx">                                 31012E5A18B97B9B0039062F /* QualifierAlive.h in Headers */,
</span><span class="cx">                                 31012E5718B97B9B0039062F /* PoolAlloc.h in Headers */,
</span><ins>+                                5C1DBC311B04375F00235552 /* IntermNode.h in Headers */,
</ins><span class="cx">                                 31012E3718B97B9B0039062F /* Initialize.h in Headers */,
</span><span class="cx">                                 31012E5218B97B9B0039062F /* OutputHLSL.h in Headers */,
</span><del>-                                5CC7D46D19102620000B8C1F /* blocklayout.h in Headers */,
</del><ins>+                                5C1DBC211B04375F00235552 /* ArrayReturnValueToOutParameter.h in Headers */,
</ins><span class="cx">                                 31012E1A18B97B9B0039062F /* ConstantUnion.h in Headers */,
</span><ins>+                                5C1DBDE31B0438D300235552 /* Context.h in Headers */,
+                                5C1DBF361B0438D300235552 /* Uniform.h in Headers */,
+                                5C1DBDFC1B0438D300235552 /* ImageIndex.h in Headers */,
</ins><span class="cx">                                 A264F8BB16974DED006FAA5A /* MacroExpander.h in Headers */,
</span><ins>+                                5C1DBDE11B0438D300235552 /* Constants.h in Headers */,
</ins><span class="cx">                                 31012E2D18B97B9B0039062F /* glslang.h in Headers */,
</span><ins>+                                5C1DBF2F1B0438D300235552 /* Surface.h in Headers */,
+                                5C1DBF2C1B0438D300235552 /* State.h in Headers */,
+                                5C1DBC381B04375F00235552 /* RegenerateStructNames.h in Headers */,
</ins><span class="cx">                                 A264F8BC16974DED006FAA5A /* numeric_lex.h in Headers */,
</span><ins>+                                5C1DBC3C1B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.h in Headers */,
</ins><span class="cx">                                 31012E6918B97B9B0039062F /* RestrictVertexShaderTiming.h in Headers */,
</span><span class="cx">                                 A264F8BD16974DED006FAA5A /* pp_utils.h in Headers */,
</span><span class="cx">                                 31012E2A18B97B9B0039062F /* ExtensionBehavior.h in Headers */,
</span><ins>+                                5C1DBC231B04375F00235552 /* ASTMetadataHLSL.h in Headers */,
+                                5C1DBC2E1B04375F00235552 /* EmulatePrecision.h in Headers */,
</ins><span class="cx">                                 31012E6F18B97B9B0039062F /* TranslatorHLSL.h in Headers */,
</span><ins>+                                5C1DBC461B04375F00235552 /* ValidateSwitch.h in Headers */,
</ins><span class="cx">                                 A264F8BF16974DED006FAA5A /* Preprocessor.h in Headers */,
</span><span class="cx">                                 FB39D76E120110FC00088E69 /* ShaderLang.h in Headers */,
</span><span class="cx">                                 A264F8C016974DED006FAA5A /* SourceLocation.h in Headers */,
</span><span class="cx">                                 31012E4E18B97B9B0039062F /* OutputGLSL.h in Headers */,
</span><ins>+                                5C1DBDF21B0438D300235552 /* formatutils.h in Headers */,
</ins><span class="cx">                                 31012E1E18B97B9B0039062F /* DependencyGraphBuilder.h in Headers */,
</span><ins>+                                5C1DBDE91B0438D300235552 /* Display.h in Headers */,
</ins><span class="cx">                                 31012E7A18B97B9B0039062F /* ValidateLimitations.h in Headers */,
</span><ins>+                                5C1DBC341B04375F00235552 /* Operator.h in Headers */,
+                                5C1DBC401B04375F00235552 /* SeparateDeclarations.h in Headers */,
+                                5C1DBDD61B0438D300235552 /* AttributeMap.h in Headers */,
</ins><span class="cx">                                 31012E3318B97B9B0039062F /* HashNames.h in Headers */,
</span><span class="cx">                                 A264F8C216974DED006FAA5A /* Token.h in Headers */,
</span><span class="cx">                                 31012E2918B97B9B0039062F /* DirectiveHandler.h in Headers */,
</span><span class="cx">                                 31012E1218B97B9B0039062F /* BaseTypes.h in Headers */,
</span><ins>+                                5C1DBDE51B0438D300235552 /* Data.h in Headers */,
+                                5C1DBE081B0438D300235552 /* Renderbuffer.h in Headers */,
</ins><span class="cx">                                 A264F8C416974DED006FAA5A /* Tokenizer.h in Headers */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="lines">@@ -811,72 +1189,124 @@
</span><span class="cx">                                 31012E3D18B97B9B0039062F /* InitializeVariables.cpp in Sources */,
</span><span class="cx">                                 31012E7F18B97B9B0039062F /* VersionGLSL.cpp in Sources */,
</span><span class="cx">                                 A08C3CDC16D6CB61003F0B83 /* ArrayBoundsClamper.cpp in Sources */,
</span><ins>+                                5C1DBC451B04375F00235552 /* ValidateSwitch.cpp in Sources */,
+                                5C1DBDF51B0438D300235552 /* FramebufferAttachment.cpp in Sources */,
+                                5C1DBC441B04375F00235552 /* Types.cpp in Sources */,
</ins><span class="cx">                                 72309A56183C27DE00370B93 /* Tokenizer.cpp in Sources */,
</span><span class="cx">                                 31012E6C18B97B9B0039062F /* TranslatorGLSL.cpp in Sources */,
</span><ins>+                                5C1DBF411B0438D300235552 /* VertexAttribute.cpp in Sources */,
</ins><span class="cx">                                 A264F8AC16974DED006FAA5A /* DiagnosticsBase.cpp in Sources */,
</span><ins>+                                5C1DBDE41B0438D300235552 /* Data.cpp in Sources */,
+                                5C1DBF291B0438D300235552 /* Shader.cpp in Sources */,
</ins><span class="cx">                                 31012E1518B97B9B0039062F /* CodeGen.cpp in Sources */,
</span><ins>+                                5C1DBDF81B0438D300235552 /* HandleAllocator.cpp in Sources */,
</ins><span class="cx">                                 31012E3F18B97B9B0039062F /* Intermediate.cpp in Sources */,
</span><span class="cx">                                 5CC7D47219102621000B8C1F /* mathutil.cpp in Sources */,
</span><ins>+                                5C1DBE071B0438D300235552 /* Renderbuffer.cpp in Sources */,
</ins><span class="cx">                                 31012E3B18B97B9B0039062F /* InitializeParseContext.cpp in Sources */,
</span><ins>+                                5C1DBE051B0438D300235552 /* RefCountObject.cpp in Sources */,
</ins><span class="cx">                                 5CC7D47019102621000B8C1F /* event_tracer.cpp in Sources */,
</span><ins>+                                5C1DBF371B0438D300235552 /* validationEGL.cpp in Sources */,
</ins><span class="cx">                                 31012E3118B97B9B0039062F /* glslang_tab.cpp in Sources */,
</span><ins>+                                5C1DBF271B0438D300235552 /* Sampler.cpp in Sources */,
+                                5C1DBDFB1B0438D300235552 /* ImageIndex.cpp in Sources */,
+                                5C1DBDDA1B0438D300235552 /* Caps.cpp in Sources */,
</ins><span class="cx">                                 31012E2118B97B9B0039062F /* DependencyGraphTraverse.cpp in Sources */,
</span><span class="cx">                                 31012E5E18B97B9B0039062F /* RewriteElseBlocks.cpp in Sources */,
</span><ins>+                                5C1DBC2A1B04375F00235552 /* CallDAG.cpp in Sources */,
+                                5C1DBC2D1B04375F00235552 /* EmulatePrecision.cpp in Sources */,
+                                5C1DBC221B04375F00235552 /* ASTMetadataHLSL.cpp in Sources */,
</ins><span class="cx">                                 31012E5418B97B9B0039062F /* ParseContext.cpp in Sources */,
</span><span class="cx">                                 A264F8AE16974DED006FAA5A /* DirectiveHandlerBase.cpp in Sources */,
</span><span class="cx">                                 31012E4D18B97B9B0039062F /* OutputGLSL.cpp in Sources */,
</span><del>-                                5CC7D47619102621000B8C1F /* shadervars.cpp in Sources */,
</del><span class="cx">                                 31012E3018B97B9B0039062F /* glslang_lex.cpp in Sources */,
</span><ins>+                                5C1DBDE61B0438D300235552 /* Device.cpp in Sources */,
+                                5C1DBDDF1B0438D300235552 /* Config.cpp in Sources */,
+                                5C1DBDEA1B0438D300235552 /* Error.cpp in Sources */,
+                                5C1DBF301B0438D300235552 /* Texture.cpp in Sources */,
</ins><span class="cx">                                 31012E4118B97B9B0039062F /* intermOut.cpp in Sources */,
</span><ins>+                                5C1DBC371B04375F00235552 /* RegenerateStructNames.cpp in Sources */,
</ins><span class="cx">                                 31012E6E18B97B9B0039062F /* TranslatorHLSL.cpp in Sources */,
</span><span class="cx">                                 A264F8B016974DED006FAA5A /* DirectiveParser.cpp in Sources */,
</span><del>-                                31012E4918B97B9B0039062F /* ossource_posix.cpp in Sources */,
</del><ins>+                                5C1DBC241B04375F00235552 /* blocklayout.cpp in Sources */,
+                                5C1DBC391B04375F00235552 /* RemoveSwitchFallThrough.cpp in Sources */,
</ins><span class="cx">                                 31012E4218B97B9B0039062F /* IntermTraverse.cpp in Sources */,
</span><ins>+                                5C1DBC331B04375F00235552 /* Operator.cpp in Sources */,
</ins><span class="cx">                                 31012E6018B97B9B0039062F /* SearchSymbol.cpp in Sources */,
</span><span class="cx">                                 72309A58183C27F300370B93 /* ExpressionParser.cpp in Sources */,
</span><span class="cx">                                 31012E2818B97B9B0039062F /* DirectiveHandler.cpp in Sources */,
</span><span class="cx">                                 31012E5918B97B9B0039062F /* QualifierAlive.cpp in Sources */,
</span><span class="cx">                                 31012E7118B97B9B0039062F /* UnfoldShortCircuit.cpp in Sources */,
</span><span class="cx">                                 31012E6418B97B9B0039062F /* SymbolTable.cpp in Sources */,
</span><ins>+                                5C1DBF351B0438D300235552 /* Uniform.cpp in Sources */,
+                                5C1DBC261B04375F00235552 /* blocklayoutHLSL.cpp in Sources */,
</ins><span class="cx">                                 A264F8B416974DED006FAA5A /* Input.cpp in Sources */,
</span><ins>+                                5C1DBC301B04375F00235552 /* IntermNode.cpp in Sources */,
</ins><span class="cx">                                 5CC7D47919102621000B8C1F /* utilities.cpp in Sources */,
</span><ins>+                                5C1DBBF11B0436EC00235552 /* MemoryBuffer.cpp in Sources */,
</ins><span class="cx">                                 A264F8B616974DED006FAA5A /* Lexer.cpp in Sources */,
</span><span class="cx">                                 31012E6218B97B9B0039062F /* ShaderLang.cpp in Sources */,
</span><ins>+                                5C1DBF2E1B0438D300235552 /* Surface.cpp in Sources */,
+                                5C1DBF3B1B0438D300235552 /* validationES2.cpp in Sources */,
</ins><span class="cx">                                 31012E3818B97B9B0039062F /* InitializeDll.cpp in Sources */,
</span><ins>+                                5C1DBF3F1B0438D300235552 /* VertexArray.cpp in Sources */,
+                                5C1DBDF01B0438D300235552 /* Float16ToFloat32.cpp in Sources */,
+                                5C1DBF3D1B0438D300235552 /* validationES3.cpp in Sources */,
+                                5C1DBDE81B0438D300235552 /* Display.cpp in Sources */,
</ins><span class="cx">                                 A264F8B816974DED006FAA5A /* Macro.cpp in Sources */,
</span><del>-                                31012E5B18B97B9B0039062F /* RemoveTree.cpp in Sources */,
</del><span class="cx">                                 A264F8BA16974DED006FAA5A /* MacroExpander.cpp in Sources */,
</span><span class="cx">                                 31012E7318B97B9B0039062F /* UnfoldShortCircuitAST.cpp in Sources */,
</span><del>-                                31012E2418B97B9B0039062F /* DetectDiscontinuity.cpp in Sources */,
</del><ins>+                                5C1DBE031B0438D300235552 /* queryconversions.cpp in Sources */,
</ins><span class="cx">                                 31012E6818B97B9B0039062F /* RestrictVertexShaderTiming.cpp in Sources */,
</span><span class="cx">                                 31012E1318B97B9B0039062F /* BuiltInFunctionEmulator.cpp in Sources */,
</span><ins>+                                5C1DBC411B04375F00235552 /* ShaderVars.cpp in Sources */,
+                                5C1DBF331B0438D300235552 /* TransformFeedback.cpp in Sources */,
</ins><span class="cx">                                 31012E3418B97B9B0039062F /* InfoSink.cpp in Sources */,
</span><span class="cx">                                 31012E5318B97B9B0039062F /* parseConst.cpp in Sources */,
</span><ins>+                                5C1DBC201B04375F00235552 /* ArrayReturnValueToOutParameter.cpp in Sources */,
</ins><span class="cx">                                 31012E5618B97B9B0039062F /* PoolAlloc.cpp in Sources */,
</span><span class="cx">                                 31012E6618B97B9B0039062F /* RestrictFragmentShaderTiming.cpp in Sources */,
</span><ins>+                                5C1DBC351B04375F00235552 /* PruneEmptyDeclarations.cpp in Sources */,
+                                5C1DBDF11B0438D300235552 /* formatutils.cpp in Sources */,
</ins><span class="cx">                                 31012E7918B97B9B0039062F /* ValidateLimitations.cpp in Sources */,
</span><del>-                                31012E8318B97C860039062F /* compilerdebug.cpp in Sources */,
</del><span class="cx">                                 31012E7718B97B9B0039062F /* util.cpp in Sources */,
</span><ins>+                                5C1DBDE21B0438D300235552 /* Context.cpp in Sources */,
</ins><span class="cx">                                 31012E5118B97B9B0039062F /* OutputHLSL.cpp in Sources */,
</span><span class="cx">                                 31012E3618B97B9B0039062F /* Initialize.cpp in Sources */,
</span><del>-                                5CC7D47419102621000B8C1F /* RefCountObject.cpp in Sources */,
</del><ins>+                                5C1DBE011B0438D300235552 /* Query.cpp in Sources */,
+                                5C1DBF391B0438D300235552 /* validationES.cpp in Sources */,
+                                5C1DBDFF1B0438D300235552 /* Program.cpp in Sources */,
</ins><span class="cx">                                 31012E7B18B97B9B0039062F /* VariableInfo.cpp in Sources */,
</span><ins>+                                5C1DBF2B1B0438D300235552 /* State.cpp in Sources */,
+                                5C1DBBF61B0436EC00235552 /* tls.cpp in Sources */,
</ins><span class="cx">                                 5CC7D452191024E4000B8C1F /* LoopInfo.cpp in Sources */,
</span><ins>+                                5C1DBC3F1B04375F00235552 /* SeparateDeclarations.cpp in Sources */,
</ins><span class="cx">                                 31012E1D18B97B9B0039062F /* DependencyGraphBuilder.cpp in Sources */,
</span><span class="cx">                                 31012E7D18B97B9B0039062F /* VariablePacker.cpp in Sources */,
</span><ins>+                                5C1DBDF31B0438D300235552 /* Framebuffer.cpp in Sources */,
</ins><span class="cx">                                 31012E1F18B97B9B0039062F /* DependencyGraphOutput.cpp in Sources */,
</span><del>-                                5CC7D46C19102620000B8C1F /* blocklayout.cpp in Sources */,
</del><ins>+                                5C1DBDD81B0438D300235552 /* Buffer.cpp in Sources */,
+                                5C1DBDD31B0438D300235552 /* angletypes.cpp in Sources */,
+                                5C1DBF251B0438D300235552 /* ResourceManager.cpp in Sources */,
</ins><span class="cx">                                 31012E4B18B97B9B0039062F /* OutputESSL.cpp in Sources */,
</span><span class="cx">                                 A264F8BE16974DED006FAA5A /* Preprocessor.cpp in Sources */,
</span><ins>+                                5C1DBDEE1B0438D300235552 /* Fence.cpp in Sources */,
</ins><span class="cx">                                 5CC7D457191024E4000B8C1F /* ValidateOutputs.cpp in Sources */,
</span><ins>+                                5C1DBBF01B0436EC00235552 /* angleutils.cpp in Sources */,
+                                5C1DBC421B04375F00235552 /* SimplifyArrayAssignment.cpp in Sources */,
</ins><span class="cx">                                 31012E2B18B97B9B0039062F /* ForLoopUnroll.cpp in Sources */,
</span><ins>+                                5C1DBC3D1B04375F00235552 /* SeparateArrayInitialization.cpp in Sources */,
</ins><span class="cx">                                 5C9FFF4E19102A000025B8FA /* FlagStd140Structs.cpp in Sources */,
</span><del>-                                31012E2218B97B9B0039062F /* DetectCallDepth.cpp in Sources */,
</del><span class="cx">                                 31012E1718B97B9B0039062F /* Compiler.cpp in Sources */,
</span><span class="cx">                                 5CC7D46E19102621000B8C1F /* debug.cpp in Sources */,
</span><ins>+                                5C1DBC281B04375F00235552 /* BuiltInFunctionEmulatorGLSL.cpp in Sources */,
+                                5C1DBDD51B0438D300235552 /* AttributeMap.cpp in Sources */,
</ins><span class="cx">                                 31012E6A18B97B9B0039062F /* TranslatorESSL.cpp in Sources */,
</span><span class="cx">                                 31012E4F18B97B9B0039062F /* OutputGLSLBase.cpp in Sources */,
</span><span class="cx">                                 31012E1B18B97B9B0039062F /* DependencyGraph.cpp in Sources */,
</span><ins>+                                5C1DBC3B1B04375F00235552 /* ScalarizeVecAndMatConstructorArgs.cpp in Sources */,
+                                5C1DBDDC1B0438D300235552 /* Compiler.cpp in Sources */,
+                                5C1DBDFE1B0438D300235552 /* Platform.cpp in Sources */,
</ins><span class="cx">                                 A264F8C116974DED006FAA5A /* Token.cpp in Sources */,
</span><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEAUTHORS"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/AUTHORS (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/AUTHORS        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/AUTHORS        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -16,14 +16,22 @@
</span><span class="cx"> BlackBerry Limited
</span><span class="cx"> Cable Television Laboratories, Inc.
</span><span class="cx"> Cloud Party, Inc.
</span><ins>+Imagination Technologies Ltd.
</ins><span class="cx"> Intel Corporation
</span><span class="cx"> Mozilla Corporation
</span><span class="cx"> Turbulenz
</span><span class="cx"> Klarälvdalens Datakonsult AB
</span><ins>+Microsoft Corporation
+Microsoft Open Technologies, Inc.
+NVIDIA Corporation
+Opera Software ASA
+The Qt Company Ltd.
</ins><span class="cx"> 
</span><span class="cx"> Jacek Caban
</span><span class="cx"> Mark Callow
</span><span class="cx"> Ginn Chen
</span><ins>+Tibor den Ouden
+Régis Fénéon
</ins><span class="cx"> James Hauxwell
</span><span class="cx"> Sam Hocevar
</span><span class="cx"> Pierre Leveille
</span><span class="lines">@@ -32,3 +40,4 @@
</span><span class="cx"> Aitor Moreno
</span><span class="cx"> Yuri O'Donnell
</span><span class="cx"> Josh Soref
</span><ins>+Maks Naumov
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEBUILDgn"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/BUILD.gn (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/BUILD.gn                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/BUILD.gn        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,323 @@
</span><ins>+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+gles_gypi = exec_script(
+  &quot;//build/gypi_to_gn.py&quot;,
+  [ rebase_path(&quot;src/libGLESv2.gypi&quot;) ],
+  &quot;scope&quot;,
+  [ &quot;src/libGLESv2.gypi&quot; ])
+
+compiler_gypi = exec_script(
+  &quot;//build/gypi_to_gn.py&quot;,
+  [ rebase_path(&quot;src/compiler.gypi&quot;) ],
+  &quot;scope&quot;,
+  [ &quot;src/compiler.gypi&quot; ])
+
+# This config is exported to dependent targets (and also applied to internal
+# ones).
+config(&quot;external_config&quot;) {
+  include_dirs = [
+    &quot;include&quot;,
+  ]
+}
+
+# This config is applied to internal Angle targets (not pushed to dependents).
+config(&quot;internal_config&quot;) {
+  include_dirs = [
+    &quot;include&quot;,
+    &quot;src&quot;,
+  ]
+}
+
+angle_enable_d3d9 = false
+angle_enable_d3d11 = false
+angle_enable_gl = false
+
+if (is_win) {
+  angle_enable_d3d9 = true
+  angle_enable_d3d11 = true
+  angle_enable_gl = true
+
+  import(&quot;//build/config/win/visual_studio_version.gni&quot;)
+  copy(&quot;copy_compiler_dll&quot;) {
+    sources = [ &quot;$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll&quot; ]
+    outputs = [ &quot;$root_build_dir/d3dcompiler_47.dll&quot; ]
+  }
+
+}  # is_win
+
+angle_enable_hlsl = false
+
+if (angle_enable_d3d9 || angle_enable_d3d11) {
+  angle_enable_hlsl = true
+}
+
+component(&quot;translator&quot;) {
+  sources = [
+    &quot;src/compiler/translator/ShaderLang.cpp&quot;,
+    &quot;src/compiler/translator/ShaderVars.cpp&quot;,
+  ]
+
+  defines = [ &quot;ANGLE_TRANSLATOR_IMPLEMENTATION&quot; ]
+
+  if (angle_enable_hlsl) {
+    sources += rebase_path(compiler_gypi.angle_translator_lib_hlsl_sources, &quot;.&quot;, &quot;src&quot;)
+    defines += [ &quot;ANGLE_ENABLE_HLSL&quot; ]
+  }
+
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:internal_config&quot;,
+    &quot;//build/config/compiler:no_chromium_code&quot;,
+  ]
+
+  public_deps = [
+    &quot;:translator_lib&quot;,
+  ]
+}
+
+# Holds the shared includes so we only need to list them once.
+source_set(&quot;includes&quot;) {
+  sources = [
+    &quot;include/EGL/egl.h&quot;,
+    &quot;include/EGL/eglext.h&quot;,
+    &quot;include/EGL/eglplatform.h&quot;,
+    &quot;include/GLES2/gl2.h&quot;,
+    &quot;include/GLES2/gl2ext.h&quot;,
+    &quot;include/GLES2/gl2platform.h&quot;,
+    &quot;include/GLES3/gl3.h&quot;,
+    &quot;include/GLES3/gl3ext.h&quot;,
+    &quot;include/GLES3/gl3platform.h&quot;,
+    &quot;include/GLSLANG/ShaderLang.h&quot;,
+    &quot;include/KHR/khrplatform.h&quot;,
+  ]
+}
+
+static_library(&quot;preprocessor&quot;) {
+  sources = rebase_path(compiler_gypi.angle_preprocessor_sources, &quot;.&quot;, &quot;src&quot;)
+
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:internal_config&quot;,
+    &quot;//build/config/compiler:no_chromium_code&quot;,
+  ]
+}
+
+config(&quot;translator_static_config&quot;) {
+  defines = [ &quot;ANGLE_TRANSLATOR_STATIC&quot; ]
+}
+
+static_library(&quot;angle_common&quot;) {
+  sources = rebase_path(gles_gypi.libangle_common_sources, &quot;.&quot;, &quot;src&quot;)
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:internal_config&quot;,
+  ]
+}
+
+static_library(&quot;translator_lib&quot;) {
+  sources = rebase_path(compiler_gypi.angle_translator_lib_sources, &quot;.&quot;, &quot;src&quot;)
+
+  if (angle_enable_hlsl) {
+    sources += rebase_path(compiler_gypi.angle_translator_lib_hlsl_sources, &quot;.&quot;, &quot;src&quot;)
+    defines = [ &quot;ANGLE_ENABLE_HLSL&quot; ]
+  }
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:internal_config&quot;,
+    &quot;:translator_static_config&quot;,
+    &quot;//build/config/compiler:no_chromium_code&quot;,
+  ]
+  public_configs = [ &quot;:external_config&quot; ]
+
+  deps = [
+    &quot;:includes&quot;,
+    &quot;:preprocessor&quot;,
+  ]
+
+  public_deps = [
+    &quot;:angle_common&quot;,
+  ]
+}
+
+static_library(&quot;translator_static&quot;) {
+  sources = [
+    &quot;src/compiler/translator/ShaderLang.cpp&quot;,
+    &quot;src/compiler/translator/ShaderVars.cpp&quot;,
+  ]
+
+  if (angle_enable_hlsl) {
+    defines = [ &quot;ANGLE_ENABLE_HLSL&quot; ]
+  }
+
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:internal_config&quot;,
+    &quot;//build/config/compiler:no_chromium_code&quot;,
+  ]
+  public_configs = [ &quot;:translator_static_config&quot; ]
+
+  public_deps = [
+    &quot;:translator_lib&quot;,
+  ]
+}
+
+config(&quot;commit_id_config&quot;) {
+  include_dirs = [ &quot;$root_gen_dir/angle&quot; ]
+}
+
+action(&quot;commit_id&quot;) {
+  script = &quot;src/commit_id.py&quot;
+
+  output_file = &quot;$root_gen_dir/angle/id/commit.h&quot;
+  outputs = [ output_file ]
+
+  args = [
+    &quot;gen&quot;,
+    rebase_path(&quot;.&quot;, root_build_dir),
+    rebase_path(output_file, root_build_dir),
+  ]
+
+  public_configs = [ &quot;:commit_id_config&quot; ]
+}
+
+config(&quot;libANGLE_config&quot;) {
+  cflags = []
+  defines = []
+  if (angle_enable_d3d9) {
+    defines += [ &quot;ANGLE_ENABLE_D3D9&quot; ]
+  }
+  if (angle_enable_d3d11) {
+    defines += [ &quot;ANGLE_ENABLE_D3D11&quot; ]
+  }
+  if (angle_enable_gl) {
+    defines += [ &quot;ANGLE_ENABLE_OPENGL&quot; ]
+  }
+  defines += [
+    &quot;GL_APICALL=&quot;,
+    &quot;GL_GLEXT_PROTOTYPES=&quot;,
+    &quot;EGLAPI=&quot;,
+  ]
+  if (is_win) {
+    cflags += [ &quot;/wd4530&quot; ]  # C++ exception handler used, but unwind semantics are not enabled.
+  }
+}
+
+static_library(&quot;libANGLE&quot;) {
+  sources = rebase_path(gles_gypi.libangle_sources, &quot;.&quot;, &quot;src&quot;)
+
+  include_dirs = []
+  libs = []
+  defines = [
+    &quot;LIBANGLE_IMPLEMENTATION&quot;,
+  ]
+
+  # Shared D3D sources.
+  if (angle_enable_d3d9 || angle_enable_d3d11) {
+    sources += rebase_path(gles_gypi.libangle_d3d_shared_sources, &quot;.&quot;, &quot;src&quot;)
+
+    defines += [
+      &quot;ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ &quot; +
+        &quot;\&quot;d3dcompiler_47.dll\&quot;, \&quot;d3dcompiler_46.dll\&quot;, \&quot;d3dcompiler_43.dll\&quot; }&quot;,
+    ]
+  }
+
+  if (angle_enable_d3d9) {
+    sources += rebase_path(gles_gypi.libangle_d3d9_sources, &quot;.&quot;, &quot;src&quot;)
+    libs += [ &quot;d3d9.lib&quot; ]
+  }
+
+  if (angle_enable_d3d11) {
+    sources += rebase_path(gles_gypi.libangle_d3d11_sources, &quot;.&quot;, &quot;src&quot;)
+    sources += rebase_path(gles_gypi.libangle_d3d11_win32_sources, &quot;.&quot;, &quot;src&quot;)
+    libs += [ &quot;dxguid.lib&quot; ]
+  }
+
+  if (angle_enable_gl) {
+    sources += rebase_path(gles_gypi.libangle_gl_sources, &quot;.&quot;, &quot;src&quot;)
+    include_dirs += [ &quot;src/third_party/khronos&quot; ]
+
+    if (is_win) {
+      sources += rebase_path(gles_gypi.libangle_gl_wgl_sources, &quot;.&quot;, &quot;src&quot;)
+    }
+  }
+
+  if (is_debug) {
+    defines += [
+      &quot;ANGLE_GENERATE_SHADER_DEBUG_INFO&quot;,
+      &quot;ANGLE_ENABLE_DEBUG_ANNOTATIONS&quot;,
+    ]
+  }
+
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:commit_id_config&quot;,
+    &quot;:libANGLE_config&quot;,
+    &quot;:internal_config&quot;,
+    &quot;//build/config/compiler:no_chromium_code&quot;,
+  ]
+
+  deps = [
+    &quot;:commit_id&quot;,
+    &quot;:includes&quot;,
+    &quot;:translator_static&quot;,
+    &quot;:angle_common&quot;,
+  ]
+
+  if (is_win) {
+    deps += [ &quot;:copy_compiler_dll&quot; ]
+  }
+}
+
+shared_library(&quot;libGLESv2&quot;) {
+  sources = rebase_path(gles_gypi.libglesv2_sources, &quot;.&quot;, &quot;src&quot;)
+
+  if (is_win) {
+    ldflags = [ &quot;/DEF:&quot; +
+                rebase_path(&quot;src/libGLESv2/libGLESv2.def&quot;, root_build_dir) ]
+  }
+
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:internal_config&quot;,
+    &quot;:commit_id_config&quot;,
+    &quot;:libANGLE_config&quot;,
+    &quot;//build/config/compiler:no_chromium_code&quot;,
+  ]
+
+  defines = [
+    &quot;LIBGLESV2_IMPLEMENTATION&quot;,
+  ]
+
+  deps = [
+    &quot;:includes&quot;,
+    &quot;:libANGLE&quot;,
+  ]
+}
+
+shared_library(&quot;libEGL&quot;) {
+  sources = rebase_path(gles_gypi.libegl_sources, &quot;.&quot;, &quot;src&quot;)
+
+  if (is_win) {
+    ldflags = [ &quot;/DEF:&quot; +
+                rebase_path(&quot;src/libEGL/libEGL.def&quot;, root_build_dir) ]
+  }
+
+  configs -= [ &quot;//build/config/compiler:chromium_code&quot; ]
+  configs += [
+    &quot;:internal_config&quot;,
+    &quot;:commit_id_config&quot;,
+    &quot;:libANGLE_config&quot;,
+    &quot;//build/config/compiler:no_chromium_code&quot;,
+  ]
+
+  defines = [
+    &quot;LIBEGL_IMPLEMENTATION&quot;,
+  ]
+
+  deps = [
+    &quot;:includes&quot;,
+    &quot;:libGLESv2&quot;,
+  ]
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLECONTRIBUTORS"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/CONTRIBUTORS (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/CONTRIBUTORS        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/CONTRIBUTORS        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-# This is the official list of people who can contribute
</del><ins>+# This is the official list of people who can contribute
</ins><span class="cx"> # (and who have contributed) code to the ANGLE project
</span><span class="cx"> # repository.
</span><span class="cx"> # The AUTHORS file lists the copyright holders; this file
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx">  thestig@chromium.org
</span><span class="cx">  Justin Schuh
</span><span class="cx">  Scott Graham
</span><ins>+ Corentin Wallez
</ins><span class="cx"> 
</span><span class="cx"> Adobe Systems Inc.
</span><span class="cx">  Alexandru Chiculita
</span><span class="lines">@@ -52,10 +53,17 @@
</span><span class="cx"> Cloud Party, Inc.
</span><span class="cx">  Conor Dickinson
</span><span class="cx"> 
</span><ins>+The Qt Company Ltd.
+ Andrew Knight
+
+Imagination Technologies Ltd.
+ Gregoire Payen de La Garanderie
+
</ins><span class="cx"> Intel Corporation
</span><span class="cx">  Jin Yang
</span><span class="cx">  Andy Chen
</span><span class="cx">  Josh Triplett
</span><ins>+ Sudarsana Nagineni
</ins><span class="cx"> 
</span><span class="cx"> Klarälvdalens Datakonsult AB
</span><span class="cx">  Milian Wolff
</span><span class="lines">@@ -74,4 +82,23 @@
</span><span class="cx"> Ulrik Persson (ddefrostt)
</span><span class="cx"> Mark Banner (standard8mbp)
</span><span class="cx"> David Kilzer
</span><ins>+Jacek Caban
+Tibor den Ouden
+Régis Fénéon
</ins><span class="cx"> 
</span><ins>+Microsoft Corporation
+ Cooper Partin
+ Austin Kinross
+ Minmin Gong
+
+Microsoft Open Technologies, Inc.
+ Cooper Partin
+ Austin Kinross
+
+NVIDIA Corporation
+ Olli Etuaho
+ Arun Patole
+ Qingqing Deng
+
+Opera Software ASA
+ Daniel Bratell
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/ChangeLog        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-06-30  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Update ANGLE to b11e2483742db884bd0af41f78f528240577356b.
+        https://bugs.webkit.org/show_bug.cgi?id=145010
+
+        Reviewed by Dean Jackson.
+
+        Huge list of source changes omitted.
+        ROLL DEPS!
+
</ins><span class="cx"> 2015-05-26  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;rdar://problem/21104551&gt; Update build settings
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEDEPS"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/DEPS (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/DEPS        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/DEPS        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,12 +1,23 @@
</span><span class="cx"> deps = {
</span><span class="cx">   &quot;third_party/gyp&quot;:
</span><del>-      &quot;http://gyp.googlecode.com/svn/trunk@1806&quot;,
</del><ins>+      &quot;http://gyp.googlecode.com/svn/trunk@1987&quot;,
</ins><span class="cx"> 
</span><del>-  &quot;tests/third_party/googletest&quot;:
</del><ins>+  # TODO(kbr): figure out how to better stay in sync with Chromium's
+  # versions of googletest and googlemock.
+  &quot;src/tests/third_party/googletest&quot;:
</ins><span class="cx">       &quot;http://googletest.googlecode.com/svn/trunk@629&quot;,
</span><span class="cx"> 
</span><del>-  &quot;tests/third_party/googlemock&quot;:
</del><ins>+  &quot;src/tests/third_party/googlemock&quot;:
</ins><span class="cx">       &quot;http://googlemock.googlecode.com/svn/trunk@410&quot;,
</span><ins>+
+  &quot;src/tests/third_party/deqp&quot;:
+      &quot;https://android.googlesource.com/platform/external/deqp@c7661bcd3bcec04b1abf6c3b290c4150db565604&quot;,
+
+  &quot;src/tests/third_party/libpng&quot;:
+      &quot;https://android.googlesource.com/platform/external/libpng@094e181e79a3d6c23fd005679025058b7df1ad6c&quot;,
+
+  &quot;src/tests/third_party/zlib&quot;:
+      &quot;https://chromium.googlesource.com/chromium/src/third_party/zlib@afd8c4593c010c045902f6c0501718f1823064a3&quot;,
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> hooks = [
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEREADMEmd"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/README.md (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/README.md                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/README.md        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+#ANGLE
+The goal of ANGLE is to allow Windows users to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to DirectX 9 or DirectX 11 API calls.
+
+ANGLE is a conformant implementation of the OpenGL ES 2.0 specification that is hardware‐accelerated via Direct3D. ANGLE v1.0.772 was certified compliant by passing the ES 2.0.3 conformance tests in October 2011. ANGLE also provides an implementation of the EGL 1.4 specification. Work on ANGLE's OpenGL ES 3.0 implementation is currently in progress, but should not be considered stable.
+
+ANGLE is used as the default WebGL backend for both Google Chrome and Mozilla Firefox on Windows platforms. Chrome uses ANGLE for all graphics rendering on Windows, including the accelerated Canvas2D implementation and the Native Client sandbox environment.
+
+Portions of the ANGLE shader compiler are used as a shader validator and translator by WebGL implementations across multiple platforms. It is used on Mac OS X, Linux, and in mobile variants of the browsers. Having one shader validator helps to ensure that a consistent set of GLSL ES shaders are accepted across browsers and platforms. The shader translator can be used to translate shaders to other shading languages, and to optionally apply shader modifications to work around bugs or quirks in the native graphics drivers. The translator targets Desktop GLSL, Direct3D HLSL, and even ESSL for native GLES2 platforms.
+
+##Building
+For building instructions, visit the [dev setup wiki](https://code.google.com/p/angleproject/wiki/DevSetup).
+
+##Contributing
+* Join our [Google group](https://groups.google.com/group/angleproject) to keep up to date.
+* Join us on IRC in the #ANGLEproject channel on FreeNode.
+* Read about ANGLE development on the [wiki](http://code.google.com/p/angleproject/w/list).
+* Become a [code contributor](https://code.google.com/p/angleproject/wiki/ContributingCode).
+* File bugs in the [issue tracker](http://code.google.com/p/angleproject/issues/list) (preferably with an isolated test-case).
+* Read about WebGL on the [Khronos WebGL Wiki](http://khronos.org/webgl/wiki/Main_Page).
+* Learn about implementation details in the [OpenGL Insights chapter on ANGLE](http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-ANGLE.pdf) and this [ANGLE presentation](https://code.google.com/p/angleproject/downloads/detail?name=ANGLE%20and%20Cross-Platform%20WebGL%20Support.pdf&amp;can=2&amp;q=).
+* Learn about the past, present, and future of the ANGLE implementation in [this recent presentation](https://docs.google.com/presentation/d/1CucIsdGVDmdTWRUbg68IxLE5jXwCb2y1E9YVhQo0thg/pub?start=false&amp;loop=false).
+* If you use ANGLE in your own project, we'd love to hear about it!
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEangleisolate"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/angle.isolate (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/angle.isolate                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/angle.isolate        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+# Copyright 2015 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.
+{
+  'conditions': [
+    ['OS==&quot;win&quot;', {
+      'variables': {
+        'files': [
+          '&lt;(PRODUCT_DIR)/d3dcompiler_47.dll',
+          '&lt;(PRODUCT_DIR)/libEGL.dll',
+          '&lt;(PRODUCT_DIR)/libGLESv2.dll',
+        ],
+      },
+    }],
+  ],
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEchangesdiff"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/changes.diff (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/changes.diff        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/changes.diff        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,77 +1,18 @@
</span><del>-diff --git a/include/EGL/egl.h b/include/EGL/egl.h
-index b55e6c6..eeb16af 100644
---- a/include/EGL/egl.h
-+++ b/include/EGL/egl.h
-@@ -246,6 +246,10 @@ typedef void *EGLClientBuffer;

- /* EGL Functions */

-+#if defined(_MSC_VER) &amp;&amp; !defined(ANGLE_WEBKIT_WIN)
-+#include &lt;EGL/eglsoftlinking.h&gt;
-+#else
-+
- EGLAPI EGLint EGLAPIENTRY eglGetError(void);

- EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
-@@ -322,6 +326,8 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void);
- EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
-        eglGetProcAddress(const char *procname);

-+#endif
-+
- #ifdef __cplusplus
- }
- #endif
-diff --git a/include/GLES2/gl2.h b/include/GLES2/gl2.h
-index c2d8357..9ab5832 100644
---- a/include/GLES2/gl2.h
-+++ b/include/GLES2/gl2.h
-@@ -470,6 +470,10 @@ typedef khronos_ssize_t  GLsizeiptr;
-  * GL core functions.
-  *-----------------------------------------------------------------------*/

-+#if defined(_MSC_VER) &amp;&amp; !defined(ANGLE_WEBKIT_WIN)
-+#include &lt;GLES2/gl2softlinking.h&gt;
-+#else
-+
- GL_APICALL void         GL_APIENTRY glActiveTexture (GLenum texture);
- GL_APICALL void         GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
- GL_APICALL void         GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
-@@ -613,6 +617,8 @@ GL_APICALL void         GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloa
- GL_APICALL void         GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
- GL_APICALL void         GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);

-+#endif
-+
- #ifdef __cplusplus
- }
- #endif
</del><span class="cx"> diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h
</span><del>-index 7970bfa..b716c6f 100644
</del><ins>+index e750e32..7d3f415 100644
</ins><span class="cx"> --- a/include/GLSLANG/ShaderLang.h
</span><span class="cx"> +++ b/include/GLSLANG/ShaderLang.h
</span><del>-@@ -23,7 +23,7 @@
- #define COMPILER_EXPORT
- #endif
</del><ins>+@@ -25,7 +25,7 @@
</ins><span class="cx">  
</span><ins>+ #include &lt;stddef.h&gt;

</ins><span class="cx"> -#include &quot;KHR/khrplatform.h&quot;
</span><span class="cx"> +#include &quot;khrplatform.h&quot;
</span><del>- #include &lt;stddef.h&gt;
</del><span class="cx">  
</span><del>- //
-@@ -423,8 +423,8 @@ COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog);
- // Returns null-terminated object code for a compiled shader.
- // Parameters:
- // handle: Specifies the compiler
--// infoLog: Specifies an array of characters that is used to return
--//          the object code. It is assumed that infoLog has enough memory to
-+// objCode: Specifies an array of characters that is used to return
-+//          the object code. It is assumed that objCode has enough memory to
- //          accomodate the object code. The size of the buffer required to
- //          store the returned object code can be obtained by calling
- //          ShGetInfo with SH_OBJECT_CODE_LENGTH.
</del><ins>+ #include &lt;map&gt;
+ #include &lt;string&gt;
</ins><span class="cx"> diff --git a/src/common/mathutil.h b/src/common/mathutil.h
</span><del>-index 9061bbd..0b4f384 100644
</del><ins>+index 9f5c9fd..7959da8 100644
</ins><span class="cx"> --- a/src/common/mathutil.h
</span><span class="cx"> +++ b/src/common/mathutil.h
</span><span class="cx"> @@ -478,7 +478,7 @@ inline unsigned int average(unsigned int a, unsigned int b)
</span><span class="lines">@@ -83,385 +24,538 @@
</span><span class="cx">  }
</span><span class="cx">  
</span><span class="cx">  inline float average(float a, float b)
</span><del>-diff --git a/src/common/shadervars.cpp b/src/common/shadervars.cpp
-index c9843dc..bc3d1c0 100644
---- a/src/common/shadervars.cpp
-+++ b/src/common/shadervars.cpp
-@@ -59,7 +59,7 @@ void Varying::resetRegisterAssignment()
-     elementIndex = GL_INVALID_INDEX;
- }
</del><ins>+diff --git a/src/common/version.h b/src/common/version.h
+index 758c78d..2a44709 100644
+--- a/src/common/version.h
++++ b/src/common/version.h
+@@ -7,7 +7,7 @@
+ #ifndef COMMON_VERSION_H_
+ #define COMMON_VERSION_H_
</ins><span class="cx">  
</span><del>--BlockMemberInfo::BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
-+BlockMemberInfo::BlockMemberInfo(long offset, long arrayStride, long matrixStride, bool isRowMajorMatrix)
-     : offset(offset),
-       arrayStride(arrayStride),
-       matrixStride(matrixStride),
-diff --git a/src/common/shadervars.h b/src/common/shadervars.h
-index eba0141..7466777 100644
---- a/src/common/shadervars.h
-+++ b/src/common/shadervars.h
-@@ -42,8 +42,8 @@ struct ShaderVariable
</del><ins>+-#include &quot;id/commit.h&quot;
++#include &quot;commit.h&quot;
</ins><span class="cx">  
</span><del>- struct Uniform : public ShaderVariable
- {
--    unsigned int registerIndex;
--    unsigned int elementIndex;     // For struct varyings
-+    unsigned long registerIndex;
-+    unsigned long elementIndex;     // For struct varyings
-     std::vector&lt;Uniform&gt; fields;

-     Uniform(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn,
-@@ -88,11 +88,11 @@ struct Varying : public ShaderVariable

- struct BlockMemberInfo
- {
--    BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix);
-+    BlockMemberInfo(long offset, long arrayStride, long matrixStride, bool isRowMajorMatrix);

--    int offset;
--    int arrayStride;
--    int matrixStride;
-+    long offset;
-+    long arrayStride;
-+    long matrixStride;
-     bool isRowMajorMatrix;

-     static const BlockMemberInfo defaultBlockInfo;
</del><ins>+ #define ANGLE_MAJOR_VERSION 2
+ #define ANGLE_MINOR_VERSION 1
</ins><span class="cx"> diff --git a/src/compiler/preprocessor/ExpressionParser.cpp b/src/compiler/preprocessor/ExpressionParser.cpp
</span><del>-index 7c6adc6..fe7a653 100644
</del><ins>+index 683195c..851183e 100644
</ins><span class="cx"> --- a/src/compiler/preprocessor/ExpressionParser.cpp
</span><span class="cx"> +++ b/src/compiler/preprocessor/ExpressionParser.cpp
</span><span class="cx"> @@ -1,5 +1,7 @@
</span><del>- /* A Bison parser, made by GNU Bison 2.7.1.  */
</del><ins>+ /* A Bison parser, made by GNU Bison 3.0.4.  */
</ins><span class="cx">  
</span><del>-+/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */
</del><ins>++/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */ 
</ins><span class="cx"> +
</span><span class="cx">  /* Bison implementation for Yacc-like parsers in C
</span><del>-    
-       Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
</del><ins>+ 
+    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
</ins><span class="cx"> diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
</span><del>-index 25aefa9..de8efff 100644
</del><ins>+index 75df434..dd9d41a 100644
</ins><span class="cx"> --- a/src/compiler/preprocessor/Tokenizer.cpp
</span><span class="cx"> +++ b/src/compiler/preprocessor/Tokenizer.cpp
</span><del>-@@ -549,6 +549,12 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
- #pragma GCC diagnostic ignored &quot;-Wmissing-noreturn&quot;
- #endif
</del><ins>+@@ -6,6 +6,11 @@
+ //
</ins><span class="cx">  
</span><ins>+ // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
++// This file was edited anyways to ignore clang warnings.
</ins><span class="cx"> +#if defined(__clang__)
</span><span class="cx"> +#pragma clang diagnostic push
</span><del>-+#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-+#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
</del><ins>++#pragma GCC diagnostic ignored &quot;-Wunneeded-internal-declaration&quot;
</ins><span class="cx"> +#endif
</span><del>-+
- typedef std::string YYSTYPE;
- typedef pp::SourceLocation YYLTYPE;
</del><span class="cx">  
</span><del>-@@ -698,6 +704,8 @@ static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
- static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
- #endif
</del><span class="cx">  
</span><del>-+#define YY_NO_INPUT
-+
- #ifndef YY_NO_INPUT
</del><span class="cx">  
</span><del>- #ifdef __cplusplus
-@@ -2314,6 +2322,10 @@ void ppfree (void * ptr , yyscan_t yyscanner)
</del><ins>+diff --git a/src/compiler/translator/CallDAG.cpp b/src/compiler/translator/CallDAG.cpp
+index 1d1eb8b..95dbea1 100644
+--- a/src/compiler/translator/CallDAG.cpp
++++ b/src/compiler/translator/CallDAG.cpp
+@@ -71,10 +71,10 @@ class CallDAG::CallDAGCreator : public TIntermTraverser
+             record.callees.reserve(data.callees.size());
+             for (auto &amp;callee : data.callees)
+             {
+-                record.callees.push_back(callee-&gt;index);
++                record.callees.push_back(static_cast&lt;int&gt;(callee-&gt;index));
+             }
</ins><span class="cx">  
</span><del>- #define YYTABLES_NAME &quot;yytables&quot;
</del><ins>+-            (*idToIndex)[data.node-&gt;getFunctionId()] = data.index;
++            (*idToIndex)[data.node-&gt;getFunctionId()] = static_cast&lt;int&gt;(data.index);
+         }
+     }
</ins><span class="cx">  
</span><del>-+#if defined(__clang__)
-+#pragma clang diagnostic pop
-+#endif
-+
- namespace pp {
</del><ins>+diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
+index 8b5b12f..5c029ba 100644
+--- a/src/compiler/translator/Compiler.cpp
++++ b/src/compiler/translator/Compiler.cpp
+@@ -528,15 +528,15 @@ bool TCompiler::checkCallDepth()
+             infoSink.info &lt;&lt; &quot;Call stack too deep (larger than &quot; &lt;&lt; maxCallStackDepth
+                           &lt;&lt; &quot;) with the following call chain: &quot; &lt;&lt; record.name;
</ins><span class="cx">  
</span><del>- Tokenizer::Tokenizer(Diagnostics* diagnostics)
-diff --git a/src/compiler/preprocessor/Tokenizer.l b/src/compiler/preprocessor/Tokenizer.l
-index ab9d99a..850c639 100644
---- a/src/compiler/preprocessor/Tokenizer.l
-+++ b/src/compiler/preprocessor/Tokenizer.l
-@@ -33,6 +33,12 @@ IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
- #pragma GCC diagnostic ignored &quot;-Wmissing-noreturn&quot;
- #endif
</del><ins>+-            int currentFunction = i;
++            signed long long currentFunction = i;
+             int currentDepth = depth;
</ins><span class="cx">  
</span><del>-+#if defined(__clang__)
-+#pragma clang diagnostic push
-+#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-+#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
-+#endif
-+
- typedef std::string YYSTYPE;
- typedef pp::SourceLocation YYLTYPE;
</del><ins>+             while (currentFunction != -1)
+             {
+-                infoSink.info &lt;&lt; &quot; -&gt; &quot; &lt;&lt; mCallDag.getRecordFromIndex(currentFunction).name;
++                infoSink.info &lt;&lt; &quot; -&gt; &quot; &lt;&lt; mCallDag.getRecordFromIndex(static_cast&lt;size_t&gt;(currentFunction)).name;
</ins><span class="cx">  
</span><del>-@@ -265,6 +271,10 @@ FRACTIONAL_CONSTANT  ({DIGIT}*&quot;.&quot;{DIGIT}+)|({DIGIT}+&quot;.&quot;)
</del><ins>+                 int nextFunction = -1;
+-                for (auto&amp; calleeIndex : mCallDag.getRecordFromIndex(currentFunction).callees)
++                for (auto&amp; calleeIndex : mCallDag.getRecordFromIndex(static_cast&lt;size_t&gt;(currentFunction)).callees)
+                 {
+                     if (depths[calleeIndex] == currentDepth - 1)
+                     {
+@@ -558,7 +558,7 @@ bool TCompiler::checkCallDepth()
+ bool TCompiler::tagUsedFunctions()
+ {
+     // Search from main, starting from the end of the DAG as it usually is the root.
+-    for (int i = mCallDag.size(); i-- &gt; 0;)
++    for (size_t i = mCallDag.size(); i--;)
+     {
+         if (mCallDag.getRecordFromIndex(i).name == &quot;main(&quot;)
+         {
+diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
+index cd7ffc4..1cd787c 100644
+--- a/src/compiler/translator/ParseContext.cpp
++++ b/src/compiler/translator/ParseContext.cpp
+@@ -511,7 +511,7 @@ bool TParseContext::constructorErrorCheck(const TSourceLoc&amp; line, TIntermNode* n
+     {
+         if (type-&gt;isUnsizedArray())
+         {
+-            type-&gt;setArraySize(function.getParamCount());
++            type-&gt;setArraySize(static_cast&lt;int&gt;(function.getParamCount()));
+         }
+         else if (static_cast&lt;size_t&gt;(type-&gt;getArraySize()) != function.getParamCount())
+         {
+diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
+index 808db95..1aa9e59 100644
+--- a/src/compiler/translator/VariableInfo.cpp
++++ b/src/compiler/translator/VariableInfo.cpp
+@@ -55,7 +55,7 @@ void ExpandVariable(const ShaderVariable &amp;variable,
+     {
+         if (variable.isArray())
+         {
+-            for (size_t elementIndex = 0; elementIndex &lt; variable.elementCount(); elementIndex++)
++            for (unsigned int elementIndex = 0; elementIndex &lt; variable.elementCount(); elementIndex++)
+             {
+                 std::string lname = name + ::ArrayString(elementIndex);
+                 std::string lmappedName = mappedName + ::ArrayString(elementIndex);
+diff --git a/src/compiler/translator/blocklayout.cpp b/src/compiler/translator/blocklayout.cpp
+index 7c74105..7cc6315 100644
+--- a/src/compiler/translator/blocklayout.cpp
++++ b/src/compiler/translator/blocklayout.cpp
+@@ -27,7 +27,7 @@ BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySi
</ins><span class="cx">  
</span><del>- %%
</del><ins>+     getBlockLayoutInfo(type, arraySize, isRowMajorMatrix, &amp;arrayStride, &amp;matrixStride);
</ins><span class="cx">  
</span><del>-+#if defined(__clang__)
-+#pragma clang diagnostic pop
-+#endif
</del><ins>+-    const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
++    const BlockMemberInfo memberInfo(static_cast&lt;int&gt;(mCurrentOffset * BytesPerComponent), arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);

+     advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);

+diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
+index 03cef93..6fb0d46 100644
+--- a/src/compiler/translator/glslang_tab.cpp
++++ b/src/compiler/translator/glslang_tab.cpp
+@@ -1,5 +1,7 @@
+ /* A Bison parser, made by GNU Bison 3.0.4.  */

++/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */ 
</ins><span class="cx"> +
</span><del>- namespace pp {
</del><ins>+ /* Bison implementation for Yacc-like parsers in C
</ins><span class="cx">  
</span><del>- Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
-diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp
-index 1864cd8..c3111c1 100644
---- a/src/compiler/translator/Compiler.cpp
-+++ b/src/compiler/translator/Compiler.cpp
-@@ -96,6 +96,7 @@ TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
-     : shaderType(type),
-       shaderSpec(spec),
-       maxUniformVectors(0),
-+      maxVaryingVectors(0),
-       maxExpressionComplexity(0),
-       maxCallStackDepth(0),
-       fragmentPrecisionHigh(false),
-@@ -114,6 +115,7 @@ bool TCompiler::Init(const ShBuiltInResources&amp; resources)
-     maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
-         resources.MaxVertexUniformVectors :
-         resources.MaxFragmentUniformVectors;
-+    maxVaryingVectors = resources.MaxVaryingVectors;
-     maxExpressionComplexity = resources.MaxExpressionComplexity;
-     maxCallStackDepth = resources.MaxCallStackDepth;
</del><ins>+    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+diff --git a/src/libANGLE/Config.cpp b/src/libANGLE/Config.cpp
+index 1b1fc50..2a68d5b 100644
+--- a/src/libANGLE/Config.cpp
++++ b/src/libANGLE/Config.cpp
+@@ -64,7 +64,7 @@ Config::Config()
+ EGLint ConfigSet::add(const Config &amp;config)
+ {
+     // Set the config's ID to a small number that starts at 1 ([EGL 1.5] section 3.4)
+-    EGLint id = mConfigs.size() + 1;
++    EGLint id = static_cast&lt;EGLint&gt;(mConfigs.size() + 1);
</ins><span class="cx">  
</span><del>-@@ -238,14 +240,7 @@ bool TCompiler::compile(const char* const shaderStrings[],
</del><ins>+     Config copyConfig(config);
+     copyConfig.configID = id;
+diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
+index 545284a..c8ea993 100644
+--- a/src/libANGLE/Context.cpp
++++ b/src/libANGLE/Context.cpp
+@@ -838,7 +838,7 @@ void Context::getIntegerv(GLenum pname, GLint *params)
+       case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mCaps.maxTransformFeedbackInterleavedComponents; break;
+       case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:       *params = mCaps.maxTransformFeedbackSeparateAttributes;    break;
+       case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:    *params = mCaps.maxTransformFeedbackSeparateComponents;    break;
+-      case GL_NUM_COMPRESSED_TEXTURE_FORMATS:           *params = mCaps.compressedTextureFormats.size();                break;
++      case GL_NUM_COMPRESSED_TEXTURE_FORMATS:           *params = static_cast&lt;GLint&gt;(mCaps.compressedTextureFormats.size());  break;
+       case GL_MAX_SAMPLES_ANGLE:                        *params = mCaps.maxSamples;                                     break;
+       case GL_MAX_VIEWPORT_DIMS:
</ins><span class="cx">          {
</span><del>-             collectVariables(root);
-             if (compileOptions &amp; SH_ENFORCE_PACKING_RESTRICTIONS)
--            {
-                 success = enforcePackingRestrictions();
--                if (!success)
--                {
--                    infoSink.info.prefix(EPrefixError);
--                    infoSink.info &lt;&lt; &quot;too many uniforms&quot;;
--                }
--            }
-             if (success &amp;&amp; shaderType == SH_VERTEX_SHADER &amp;&amp;
-                 (compileOptions &amp; SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
-                 initializeVaryingsWithoutStaticUse(root);
-@@ -458,7 +453,21 @@ void TCompiler::collectVariables(TIntermNode* root)
- bool TCompiler::enforcePackingRestrictions()
</del><ins>+@@ -853,13 +853,13 @@ void Context::getIntegerv(GLenum pname, GLint *params)
+         *params = mResetStrategy;
+         break;
+       case GL_NUM_SHADER_BINARY_FORMATS:
+-        *params = mCaps.shaderBinaryFormats.size();
++        *params = static_cast&lt;GLint&gt;(mCaps.shaderBinaryFormats.size());
+         break;
+       case GL_SHADER_BINARY_FORMATS:
+         std::copy(mCaps.shaderBinaryFormats.begin(), mCaps.shaderBinaryFormats.end(), params);
+         break;
+       case GL_NUM_PROGRAM_BINARY_FORMATS:
+-        *params = mCaps.programBinaryFormats.size();
++        *params = static_cast&lt;GLint&gt;(mCaps.programBinaryFormats.size());
+         break;
+       case GL_PROGRAM_BINARY_FORMATS:
+         std::copy(mCaps.programBinaryFormats.begin(), mCaps.programBinaryFormats.end(), params);
+@@ -939,19 +939,19 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
+       case GL_COMPRESSED_TEXTURE_FORMATS:
+         {
+             *type = GL_INT;
+-            *numParams = mCaps.compressedTextureFormats.size();
++            *numParams = static_cast&lt;unsigned int&gt;(mCaps.compressedTextureFormats.size());
+         }
+         return true;
+       case GL_PROGRAM_BINARY_FORMATS_OES:
+         {
+             *type = GL_INT;
+-            *numParams = mCaps.programBinaryFormats.size();
++            *numParams = static_cast&lt;unsigned int&gt;(mCaps.programBinaryFormats.size());
+         }
+         return true;
+       case GL_SHADER_BINARY_FORMATS:
+         {
+             *type = GL_INT;
+-            *numParams = mCaps.shaderBinaryFormats.size();
++            *numParams = static_cast&lt;unsigned int&gt;(mCaps.shaderBinaryFormats.size());
+         }
+         return true;

+diff --git a/src/libANGLE/Framebuffer.cpp b/src/libANGLE/Framebuffer.cpp
+index faee83c..3870e69 100644
+--- a/src/libANGLE/Framebuffer.cpp
++++ b/src/libANGLE/Framebuffer.cpp
+@@ -269,7 +269,7 @@ bool Framebuffer::hasEnabledColorAttachment() const
</ins><span class="cx">  {
</span><del>-     VariablePacker packer;
--    return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
-+    bool success = packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
-+    if (!success) {
-+        infoSink.info.prefix(EPrefixError);
-+        infoSink.info &lt;&lt; &quot;too many uniforms&quot;;
-+        return false;
-+    }
-+
-+    success = packer.CheckVariablesWithinPackingLimits(maxVaryingVectors, varyings);
-+
-+    if (!success) {
-+        infoSink.info.prefix(EPrefixError);
-+        infoSink.info &lt;&lt; &quot;too many varyings&quot;;
-+        return false;
-+    }
-+    return true;
</del><ins>+     for (size_t colorAttachment = 0; colorAttachment &lt; mData.mColorAttachments.size(); ++colorAttachment)
+     {
+-        if (isEnabledColorAttachment(colorAttachment))
++        if (static_cast&lt;unsigned int&gt;(isEnabledColorAttachment(colorAttachment)))
+         {
+             return true;
+         }
+@@ -287,7 +287,7 @@ bool Framebuffer::usingExtendedDrawBuffers() const
+ {
+     for (size_t colorAttachment = 1; colorAttachment &lt; mData.mColorAttachments.size(); ++colorAttachment)
+     {
+-        if (isEnabledColorAttachment(colorAttachment))
++        if (static_cast&lt;unsigned int&gt;(isEnabledColorAttachment(colorAttachment)))
+         {
+             return true;
+         }
+diff --git a/src/libANGLE/ImageIndex.cpp b/src/libANGLE/ImageIndex.cpp
+index ac7302d..538258f 100644
+--- a/src/libANGLE/ImageIndex.cpp
++++ b/src/libANGLE/ImageIndex.cpp
+@@ -35,7 +35,7 @@ ImageIndex ImageIndex::Make2D(GLint mipIndex)
+ ImageIndex ImageIndex::MakeCube(GLenum target, GLint mipIndex)
+ {
+     ASSERT(gl::IsCubeMapTextureTarget(target));
+-    return ImageIndex(target, mipIndex, CubeMapTextureTargetToLayerIndex(target));
++    return ImageIndex(target, mipIndex, static_cast&lt;int&gt;(CubeMapTextureTargetToLayerIndex(target)));
</ins><span class="cx">  }
</span><span class="cx">  
</span><del>- void TCompiler::initializeGLPosition(TIntermNode* root)
-diff --git a/src/compiler/translator/ShHandle.h b/src/compiler/translator/ShHandle.h
-index 50a8d58..687ff63 100644
---- a/src/compiler/translator/ShHandle.h
-+++ b/src/compiler/translator/ShHandle.h
-@@ -95,7 +95,7 @@ protected:
-     // 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.
-+    // Appendix A, section 7, the shader does not use too many uniforms or varyings.
-     bool enforcePackingRestrictions();
-     // Insert statements to initialize varyings without static use in the beginning
-     // of main(). It is to work around a Mac driver where such varyings in a vertex
-@@ -130,6 +130,7 @@ private:
-     ShShaderSpec shaderSpec;
</del><ins>+ ImageIndex ImageIndex::Make2DArray(GLint mipIndex, GLint layerIndex)
+@@ -50,7 +50,7 @@ ImageIndex ImageIndex::Make3D(GLint mipIndex, GLint layerIndex)
</ins><span class="cx">  
</span><del>-     int maxUniformVectors;
-+    int maxVaryingVectors;
-     int maxExpressionComplexity;
-     int maxCallStackDepth;
</del><ins>+ ImageIndex ImageIndex::MakeGeneric(GLenum target, GLint mipIndex)
+ {
+-    GLint layerIndex = IsCubeMapTextureTarget(target) ? CubeMapTextureTargetToLayerIndex(target) : ENTIRE_LEVEL;
++    GLint layerIndex = IsCubeMapTextureTarget(target) ? static_cast&lt;GLint&gt;(CubeMapTextureTargetToLayerIndex(target)) : ENTIRE_LEVEL;
+     return ImageIndex(target, mipIndex, layerIndex);
+ }
</ins><span class="cx">  
</span><del>-diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp
-index b98c371..dd26873 100644
---- a/src/compiler/translator/ShaderLang.cpp
-+++ b/src/compiler/translator/ShaderLang.cpp
-@@ -242,8 +242,12 @@ void ShGetInfoLog(const ShHandle handle, char* infoLog)
-     TCompiler* compiler = base-&gt;getAsCompiler();
-     if (!compiler) return;
</del><ins>+diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp
+index e215379..42f09b9 100644
+--- a/src/libANGLE/Program.cpp
++++ b/src/libANGLE/Program.cpp
+@@ -483,7 +483,7 @@ Error Program::saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, G
+         return error;
+     }
</ins><span class="cx">  
</span><del>-+    size_t infoLogLength = 0;
-+    ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &amp;infoLogLength);
-+
-     TInfoSink&amp; infoSink = compiler-&gt;getInfoSink();
--    strcpy(infoLog, infoSink.info.c_str());
-+    strncpy(infoLog, infoSink.info.c_str(), infoLogLength);
-+    infoLog[infoLogLength - 1] = '\0';
</del><ins>+-    GLsizei streamLength = stream.length();
++    GLsizei streamLength = static_cast&lt;GLsizei&gt;(stream.length());
+     const void *streamData = stream.data();

+     if (streamLength &gt; bufSize)
+@@ -645,7 +645,7 @@ void Program::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length,

+             if (length)
+             {
+-                *length = strlen(name);
++                *length = static_cast&lt;GLsizei&gt;(strlen(name));
+             }
+         }

+@@ -762,7 +762,7 @@ void Program::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, G

+             if (length)
+             {
+-                *length = strlen(name);
++                *length = static_cast&lt;GLsizei&gt;(strlen(name));
+             }
+         }

+@@ -790,7 +790,7 @@ GLint Program::getActiveUniformCount()
+ {
+     if (mLinked)
+     {
+-        return mProgram-&gt;getUniforms().size();
++        return static_cast&lt;GLint&gt;(mProgram-&gt;getUniforms().size());
+     }
+     else
+     {
+@@ -804,7 +804,7 @@ GLint Program::getActiveUniformMaxLength()

+     if (mLinked)
+     {
+-        unsigned int numUniforms = mProgram-&gt;getUniforms().size();
++        unsigned int numUniforms = static_cast&lt;unsigned int&gt;(mProgram-&gt;getUniforms().size());
+         for (unsigned int uniformIndex = 0; uniformIndex &lt; numUniforms; uniformIndex++)
+         {
+             if (!mProgram-&gt;getUniforms()[uniformIndex]-&gt;name.empty())
+@@ -1042,7 +1042,7 @@ void Program::updateSamplerMapping()

+ GLuint Program::getActiveUniformBlockCount()
+ {
+-    return mProgram-&gt;getUniformBlocks().size();
++    return static_cast&lt;GLuint&gt;(mProgram-&gt;getUniformBlocks().size());
</ins><span class="cx">  }
</span><span class="cx">  
</span><del>- //
-@@ -258,8 +262,12 @@ void ShGetObjectCode(const ShHandle handle, char* objCode)
-     TCompiler* compiler = base-&gt;getAsCompiler();
-     if (!compiler) return;
</del><ins>+ void Program::getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const
+@@ -1065,7 +1065,7 @@ void Program::getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSiz
</ins><span class="cx">  
</span><del>-+    size_t objCodeLength = 0;
-+    ShGetInfo(handle, SH_OBJECT_CODE_LENGTH, &amp;objCodeLength);
-+
-     TInfoSink&amp; infoSink = compiler-&gt;getInfoSink();
--    strcpy(objCode, infoSink.obj.c_str());
-+    strncpy(objCode, infoSink.obj.c_str(), objCodeLength);
-+    objCode[objCodeLength - 1] = '\0';
</del><ins>+         if (length)
+         {
+-            *length = strlen(uniformBlockName);
++            *length = static_cast&lt;GLsizei&gt;(strlen(uniformBlockName));
+         }
+     }
</ins><span class="cx">  }
</span><ins>+@@ -1111,13 +1111,13 @@ GLint Program::getActiveUniformBlockMaxLength()
</ins><span class="cx">  
</span><del>- void ShGetVariableInfo(const ShHandle handle,
-diff --git a/src/compiler/translator/glslang.l b/src/compiler/translator/glslang.l
-index 518b78d..c8ff855 100644
---- a/src/compiler/translator/glslang.l
-+++ b/src/compiler/translator/glslang.l
-@@ -33,6 +33,11 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
- #pragma warning(disable: 4505)
- #pragma warning(disable: 4701)
- #endif
-+#if defined(__clang__)
-+#pragma clang diagnostic push
-+#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-+#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
-+#endif
</del><ins>+     if (mLinked)
+     {
+-        unsigned int numUniformBlocks = mProgram-&gt;getUniformBlocks().size();
++        unsigned int numUniformBlocks = static_cast&lt;unsigned int&gt;(mProgram-&gt;getUniformBlocks().size());
+         for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; numUniformBlocks; uniformBlockIndex++)
+         {
+             const UniformBlock &amp;uniformBlock = *mProgram-&gt;getUniformBlocks()[uniformBlockIndex];
+             if (!uniformBlock.name.empty())
+             {
+-                const int length = uniformBlock.name.length() + 1;
++                const int length = static_cast&lt;int&gt;(uniformBlock.name.length() + 1);

+                 // Counting in &quot;[0]&quot;.
+                 const int arrayLength = (uniformBlock.isArrayElement() ? 3 : 0);
+@@ -1466,7 +1466,7 @@ bool Program::areMatchingInterfaceBlocks(gl::InfoLog &amp;infoLog, const sh::Interfa
+         infoLog.append(&quot;Layout qualifiers differ for interface block '%s' between vertex and fragment shaders&quot;, blockName);
+         return false;
+     }
+-    const unsigned int numBlockMembers = vertexInterfaceBlock.fields.size();
++    const unsigned int numBlockMembers = static_cast&lt;unsigned int&gt;(vertexInterfaceBlock.fields.size());
+     for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; numBlockMembers; blockMemberIndex++)
+     {
+         const sh::InterfaceBlockField &amp;vertexMember = vertexInterfaceBlock.fields[blockMemberIndex];
+@@ -1510,7 +1510,7 @@ bool Program::linkValidateVariablesBase(InfoLog &amp;infoLog, const std::string &amp;var
+         infoLog.append(&quot;Structure lengths for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
+         return false;
+     }
+-    const unsigned int numMembers = vertexVariable.fields.size();
++    const unsigned int numMembers = static_cast&lt;unsigned int&gt;(vertexVariable.fields.size());
+     for (unsigned int memberIndex = 0; memberIndex &lt; numMembers; memberIndex++)
+     {
+         const sh::ShaderVariable &amp;vertexMember = vertexVariable.fields[memberIndex];
+diff --git a/src/libANGLE/Renderbuffer.cpp b/src/libANGLE/Renderbuffer.cpp
+index 85b920b..34cc365 100644
+--- a/src/libANGLE/Renderbuffer.cpp
++++ b/src/libANGLE/Renderbuffer.cpp
+@@ -42,8 +42,8 @@ Error Renderbuffer::setStorage(GLenum internalformat, size_t width, size_t heigh
+         return error;
+     }

+-    mWidth = width;
+-    mHeight = height;
++    mWidth = static_cast&lt;GLsizei&gt;(width);
++    mHeight = static_cast&lt;GLsizei&gt;(height);
+     mInternalFormat = internalformat;
+     mSamples = 0;

+@@ -58,10 +58,10 @@ Error Renderbuffer::setStorageMultisample(size_t samples, GLenum internalformat,
+         return error;
+     }

+-    mWidth = width;
+-    mHeight = height;
++    mWidth = static_cast&lt;GLsizei&gt;(width);
++    mHeight = static_cast&lt;GLsizei&gt;(height);
+     mInternalFormat = internalformat;
+-    mSamples = samples;
++    mSamples = static_cast&lt;GLsizei&gt;(samples);

+     return Error(GL_NO_ERROR);
</ins><span class="cx">  }
</span><ins>+diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp
+index 7af4ff3..5106e95 100644
+--- a/src/libANGLE/Shader.cpp
++++ b/src/libANGLE/Shader.cpp
+@@ -66,7 +66,7 @@ void Shader::setSource(GLsizei count, const char *const *string, const GLint *le
</ins><span class="cx">  
</span><del>- %{
-@@ -379,6 +384,10 @@ O           [0-7]
</del><ins>+ int Shader::getInfoLogLength() const
+ {
+-    return  mShader-&gt;getInfoLog().empty() ? 0 : (mShader-&gt;getInfoLog().length() + 1);
++    return  mShader-&gt;getInfoLog().empty() ? 0 : static_cast&lt;int&gt;(mShader-&gt;getInfoLog().length() + 1);
+ }
</ins><span class="cx">  
</span><del>- %%
</del><ins>+ void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
+@@ -89,12 +89,12 @@ void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
</ins><span class="cx">  
</span><del>-+#if defined(__clang__)
-+#pragma clang diagnostic pop
-+#endif
-+
- yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
-     pp::Token token;
-     yyget_extra(yyscanner)-&gt;preprocessor.lex(&amp;token);
-diff --git a/src/compiler/translator/glslang_lex.cpp b/src/compiler/translator/glslang_lex.cpp
-index 5cfbba6..456491b 100644
---- a/src/compiler/translator/glslang_lex.cpp
-+++ b/src/compiler/translator/glslang_lex.cpp
-@@ -18,8 +18,11 @@
- #pragma warning(disable: 4505)
- #pragma warning(disable: 4701)
- #endif
--
--
-+#if defined(__clang__)
-+#pragma clang diagnostic push
-+#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-+#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
-+#endif
</del><ins>+ int Shader::getSourceLength() const
+ {
+-    return mSource.empty() ? 0 : (mSource.length() + 1);
++    return mSource.empty() ? 0 : static_cast&lt;int&gt;(mSource.length() + 1);
+ }
</ins><span class="cx">  
</span><del>- #line 25 &quot;./glslang_lex.cpp&quot;
</del><ins>+ int Shader::getTranslatedSourceLength() const
+ {
+-    return mShader-&gt;getTranslatedSource().empty() ? 0 : (mShader-&gt;getTranslatedSource().length() + 1);
++    return mShader-&gt;getTranslatedSource().empty() ? 0 : static_cast&lt;int&gt;(mShader-&gt;getTranslatedSource().length() + 1);
+ }
</ins><span class="cx">  
</span><del>-@@ -3181,6 +3184,10 @@ void yyfree (void * ptr , yyscan_t yyscanner)
</del><ins>+ void Shader::getSourceImpl(const std::string &amp;source, GLsizei bufSize, GLsizei *length, char *buffer)
+diff --git a/src/libANGLE/State.cpp b/src/libANGLE/State.cpp
+index f731774..f6837f4 100644
+--- a/src/libANGLE/State.cpp
++++ b/src/libANGLE/State.cpp
+@@ -569,7 +569,7 @@ void State::setActiveSampler(unsigned int active)
</ins><span class="cx">  
</span><del>- #define YYTABLES_NAME &quot;yytables&quot;
</del><ins>+ unsigned int State::getActiveSampler() const
+ {
+-    return mActiveSampler;
++    return static_cast&lt;unsigned int&gt;(mActiveSampler);
+ }
</ins><span class="cx">  
</span><del>-+#if defined(__clang__)
-+#pragma clang diagnostic pop
-+#endif
-+
- yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
-     pp::Token token;
-     yyget_extra(yyscanner)-&gt;preprocessor.lex(&amp;token);
-diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
-index 70d46d8..cba3cc4 100644
---- a/src/compiler/translator/glslang_tab.cpp
-+++ b/src/compiler/translator/glslang_tab.cpp
-@@ -1,5 +1,7 @@
- /* A Bison parser, made by GNU Bison 2.7.1.  */
</del><ins>+ void State::setSamplerTexture(GLenum type, Texture *texture)
+@@ -1192,7 +1192,7 @@ void State::getIntegerv(const gl::Data &amp;data, GLenum pname, GLint *params)
+       case GL_UNPACK_ROW_LENGTH:                        *params = mUnpack.rowLength;                              break;
+       case GL_GENERATE_MIPMAP_HINT:                     *params = mGenerateMipmapHint;                            break;
+       case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:      *params = mFragmentShaderDerivativeHint;                  break;
+-      case GL_ACTIVE_TEXTURE:                           *params = (mActiveSampler + GL_TEXTURE0);                 break;
++      case GL_ACTIVE_TEXTURE:                           *params = static_cast&lt;GLint&gt;(mActiveSampler + GL_TEXTURE0);     break;
+       case GL_STENCIL_FUNC:                             *params = mDepthStencil.stencilFunc;                      break;
+       case GL_STENCIL_REF:                              *params = mStencilRef;                                    break;
+       case GL_STENCIL_VALUE_MASK:                       *params = clampToInt(mDepthStencil.stencilMask);          break;
+@@ -1316,19 +1316,19 @@ void State::getIntegerv(const gl::Data &amp;data, GLenum pname, GLint *params)
+         break;
+       case GL_TEXTURE_BINDING_2D:
+         ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+-        *params = getSamplerTextureId(mActiveSampler, GL_TEXTURE_2D) ;
++        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_2D) ;
+         break;
+       case GL_TEXTURE_BINDING_CUBE_MAP:
+         ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+-        *params = getSamplerTextureId(mActiveSampler, GL_TEXTURE_CUBE_MAP);
++        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_CUBE_MAP);
+         break;
+       case GL_TEXTURE_BINDING_3D:
+         ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+-        *params = getSamplerTextureId(mActiveSampler, GL_TEXTURE_3D);
++        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_3D);
+         break;
+       case GL_TEXTURE_BINDING_2D_ARRAY:
+         ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+-        *params = getSamplerTextureId(mActiveSampler, GL_TEXTURE_2D_ARRAY);
++        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_2D_ARRAY);
+         break;
+       case GL_UNIFORM_BUFFER_BINDING:
+         *params = mGenericUniformBuffer.id();
+diff --git a/src/libANGLE/Surface.cpp b/src/libANGLE/Surface.cpp
+index c42b69d..9742f5d 100644
+--- a/src/libANGLE/Surface.cpp
++++ b/src/libANGLE/Surface.cpp
+@@ -135,12 +135,12 @@ EGLint Surface::isFixedSize() const
</ins><span class="cx">  
</span><del>-+/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */
-+
- /* Bison implementation for Yacc-like parsers in C
-    
-       Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-diff --git a/src/compiler/translator/glslang_tab.h b/src/compiler/translator/glslang_tab.h
-index c6a61dc..09a38d4 100644
---- a/src/compiler/translator/glslang_tab.h
-+++ b/src/compiler/translator/glslang_tab.h
-@@ -1,5 +1,7 @@
- /* A Bison parser, made by GNU Bison 2.7.1.  */
</del><ins>+ EGLint Surface::getWidth() const
+ {
+-    return mFixedSize ? mFixedWidth : mImplementation-&gt;getWidth();
++    return mFixedSize ? static_cast&lt;EGLint&gt;(mFixedWidth) : mImplementation-&gt;getWidth();
+ }
</ins><span class="cx">  
</span><del>-+/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */
-+
- /* Bison interface for Yacc-like parsers in C
-    
-       Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-diff --git a/src/libGLESv2/Program.cpp b/src/libGLESv2/Program.cpp
-index 8a9fb04..46db788 100644
---- a/src/libGLESv2/Program.cpp
-+++ b/src/libGLESv2/Program.cpp
-@@ -101,22 +101,27 @@ void InfoLog::append(const char *format, ...)
-     va_end(vararg);
</del><ins>+ EGLint Surface::getHeight() const
+ {
+-    return mFixedSize ? mFixedHeight : mImplementation-&gt;getHeight();
++    return mFixedSize ? static_cast&lt;EGLint&gt;(mFixedHeight) : mImplementation-&gt;getHeight();
+ }
</ins><span class="cx">  
</span><del>-     char *logPointer = NULL;
-+    size_t logLength = 0;
</del><ins>+ Error Surface::bindTexImage(gl::Texture *texture, EGLint buffer)
+diff --git a/src/libANGLE/Texture.cpp b/src/libANGLE/Texture.cpp
+index 1ab5c7d..437ba0d 100644
+--- a/src/libANGLE/Texture.cpp
++++ b/src/libANGLE/Texture.cpp
+@@ -266,7 +266,7 @@ Error Texture::setStorage(GLenum target, size_t levels, GLenum internalFormat, c
</ins><span class="cx">  
</span><del>-     if (!mInfoLog)
</del><ins>+     releaseTexImage();

+-    mImmutableLevelCount = levels;
++    mImmutableLevelCount = static_cast&lt;GLsizei&gt;(levels);
+     clearImageDescs();
+     setImageDescChain(levels, size, internalFormat);

+@@ -295,16 +295,16 @@ void Texture::setImageDescChain(size_t levels, Extents baseSize, GLenum sizedInt
+ {
+     for (size_t level = 0; level &lt; levels; level++)
</ins><span class="cx">      {
</span><del>-         mInfoLog = new char[infoLength + 2];
-         logPointer = mInfoLog;
-+        logLength = infoLength + 2;
-     }
-     else
-     {
-         size_t currentlogLength = strlen(mInfoLog);
--        char *newLog = new char[currentlogLength + infoLength + 2];
--        strcpy(newLog, mInfoLog);
-+        size_t newInfoLogLength = currentlogLength + infoLength + 2;
-+        char *newLog = new char[newInfoLogLength];
-+        strncpy(newLog, mInfoLog, newInfoLogLength);
-+        newLog[newInfoLogLength - 1] = '\0';
</del><ins>+-        Extents levelSize(std::max&lt;size_t&gt;(baseSize.width &gt;&gt; level, 1),
+-                          std::max&lt;size_t&gt;(baseSize.height &gt;&gt; level, 1),
+-                          (mTarget == GL_TEXTURE_2D_ARRAY) ? baseSize.depth : std::max&lt;size_t&gt;(baseSize.depth &gt;&gt; level, 1));
++        Extents levelSize(std::max&lt;int&gt;(baseSize.width &gt;&gt; level, 1),
++                          std::max&lt;int&gt;(baseSize.height &gt;&gt; level, 1),
++                          (mTarget == GL_TEXTURE_2D_ARRAY) ? baseSize.depth : std::max&lt;int&gt;(baseSize.depth &gt;&gt; level, 1));
+         ImageDesc levelInfo(levelSize, sizedInternalFormat);
</ins><span class="cx">  
</span><del>-         delete[] mInfoLog;
-         mInfoLog = newLog;
</del><ins>+         if (mTarget == GL_TEXTURE_CUBE_MAP)
+         {
+             for (size_t face = FirstCubeMapTextureTarget; face &lt;= LastCubeMapTextureTarget; face++)
+             {
+-                setImageDesc(face, level, levelInfo);
++                setImageDesc(static_cast&lt;GLenum&gt;(face), level, levelInfo);
+             }
+         }
+         else
+@@ -571,12 +571,12 @@ Texture::SamplerCompletenessCache::SamplerCompletenessCache()
</ins><span class="cx">  
</span><del>-         logPointer = mInfoLog + currentlogLength;
-+        logLength = newInfoLogLength - currentlogLength;
</del><ins>+ GLsizei Texture::getAttachmentWidth(const gl::FramebufferAttachment::Target &amp;target) const
+ {
+-    return getWidth(target.textureIndex().type, target.textureIndex().mipIndex);
++    return static_cast&lt;GLsizei&gt;(getWidth(target.textureIndex().type, target.textureIndex().mipIndex));
+ }

+ GLsizei Texture::getAttachmentHeight(const gl::FramebufferAttachment::Target &amp;target) const
+ {
+-    return getHeight(target.textureIndex().type, target.textureIndex().mipIndex);
++    return static_cast&lt;GLsizei&gt;(getHeight(target.textureIndex().type, target.textureIndex().mipIndex));
+ }

+ GLenum Texture::getAttachmentInternalFormat(const gl::FramebufferAttachment::Target &amp;target) const
+diff --git a/src/libANGLE/validationES.cpp b/src/libANGLE/validationES.cpp
+index 1896138..2a288a2 100644
+--- a/src/libANGLE/validationES.cpp
++++ b/src/libANGLE/validationES.cpp
+@@ -174,7 +174,7 @@ bool ValidMipLevel(const Context *context, GLenum target, GLint level)
+       default: UNREACHABLE();
</ins><span class="cx">      }
</span><span class="cx">  
</span><del>-     va_start(vararg, format);
-@@ -124,7 +129,8 @@ void InfoLog::append(const char *format, ...)
-     va_end(vararg);

-     logPointer[infoLength] = 0;
--    strcpy(logPointer + infoLength, &quot;\n&quot;);
-+    strncpy(logPointer + infoLength, &quot;\n&quot;, logLength - infoLength);
-+    logPointer[logLength - 1] = '\0';
</del><ins>+-    return level &lt;= gl::log2(maxDimension);
++    return level &lt;= gl::log2(static_cast&lt;int&gt;(maxDimension));
</ins><span class="cx">  }
</span><span class="cx">  
</span><del>- void InfoLog::reset()
-diff --git a/src/libGLESv2/renderer/VertexBuffer.cpp b/src/libGLESv2/renderer/VertexBuffer.cpp
-index 4e732e1..20050e1 100644
---- a/src/libGLESv2/renderer/VertexBuffer.cpp
-+++ b/src/libGLESv2/renderer/VertexBuffer.cpp
-@@ -166,7 +166,7 @@ bool VertexBufferInterface::directStoragePossible(const gl::VertexAttribute &amp;att
-     //  (Undocumented, and experimentally confirmed)
-     unsigned int outputElementSize;
-     getVertexBuffer()-&gt;getSpaceRequired(attrib, 1, 0, &amp;outputElementSize);
--    size_t alignment = std::min(static_cast&lt;size_t&gt;(outputElementSize), 4u);
-+    size_t alignment = std::min&lt;size_t&gt;(static_cast&lt;size_t&gt;(outputElementSize), 4);

-     bool isAligned = (static_cast&lt;size_t&gt;(attrib.stride()) % alignment == 0) &amp;&amp;
-                      (static_cast&lt;size_t&gt;(attrib.mOffset) % alignment == 0);
-diff --git a/src/libGLESv2/precompiled.h b/src/libGLESv2/precompiled.h
-index ceef507..a1da38c 100644
---- a/src/libGLESv2/precompiled.h
-+++ b/src/libGLESv2/precompiled.h
-@@ -46,6 +46,8 @@
- #include &lt;D3D10_1.h&gt;
- #include &lt;D3D11.h&gt;
- #include &lt;dxgi.h&gt;
-+#if !ANGLE_SKIP_DXGI_1_2_CHECK
- #include &lt;dxgi1_2.h&gt;
-+#endif
- #include &lt;D3Dcompiler.h&gt;
- #endif // ANGLE_ENABLE_D3D11
</del><ins>+ bool ValidImageSize(const Context *context, GLenum target, GLint level,
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_depth_texturetxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_depth_texture.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_depth_texture.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_depth_texture.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,402 @@
</span><ins>+Name
+
+    ANGLE_depth_texture
+
+Name Strings
+
+    GL_ANGLE_depth_texture
+
+Contributors
+
+    Nicolas Capens, TransGaming
+    Daniel Koch, TransGaming
+    Shannon Woods, TransGaming
+    Kenneth Russell, Google
+    Vangelis Kokkevis, Google
+    Gregg Tavares, Google
+    Contributors to OES_depth_texture
+    Contributors to OES_packed_depth_stencil
+
+Contact
+
+    Shannon Woods, TransGaming (shannon 'dot' woods 'at' transgaming.com)
+
+Status
+
+    Implemented in ANGLE.
+
+Version
+
+    Last Modified Date: February 25, 2013
+    Revision: #4
+
+Number
+
+    TBD
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+    This extension is written against the OpenGL ES 2.0.25 specification
+
+    OES_packed_depth_stencil affects the definition of this extension.
+
+    EXT_texture_storage affects the definition of this extension.
+
+Overview
+
+    This extension defines support for 2D depth and depth-stencil
+    textures in an OpenGL ES implementation.
+
+    This extension incorporates the depth texturing functionality of 
+    OES_depth_texture and OES_packed_depth_stencil, but does not 
+    provide the ability to load existing data via TexImage2D or
+    TexSubImage2D. This extension also allows implementation 
+    variability in which components from a sampled depth texture
+    contain the depth data. Depth textures created with this
+    extension only support 1 level.
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted by the &lt;format&gt; parameter of TexImage2D and TexSubImage2D and
+    &lt;internalformat&gt; parameter of TexImage2D:
+    
+        DEPTH_COMPONENT             0x1902
+        DEPTH_STENCIL_OES           0x84F9
+        
+    Accepted by the &lt;type&gt; parameter of TexImage2D, TexSubImage2D: 
+
+        UNSIGNED_SHORT              0x1403
+        UNSIGNED_INT                0x1405
+        UNSIGNED_INT_24_8_OES       0x84FA
+
+    Accepted by the &lt;internalformat&gt; parameter of TexStorage2DEXT:
+
+        DEPTH_COMPONENT16           0x81A5
+        DEPTH_COMPONENT32_OES       0x81A7
+        DEPTH24_STENCIL8_OES        0x88F0
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
+
+    Update Section 2.10.5 &quot;Shader Execution&quot; in the subsection titled 
+    &quot;Texture Access&quot; add a new paragraph before the last paragraph add
+    this line:
+
+    &quot;The stencil index texture internal component is ignored if the base
+    internal format is DEPTH_STENCIL_OES.
+
+    If a vertex shader uses...&quot;
+
+Additions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterization)
+
+    Add the following rows to Table 3.2 (page 62):
+
+      type Parameter           GL Data Type    Special
+      ------------------------------------------------
+      ...                      ...              ...
+      UNSIGNED_SHORT           ushort           No
+      UNSIGNED_INT             uint             No
+      UNSIGNED_INT_24_8_OES    uint             Yes
+
+    Add the following rows to Table 3.3 (page 62):
+
+      Format Name       Element Meaning and Order      Target Buffer
+      ------------------------------------------------------------------
+      ...               ...                            ...
+      DEPTH_COMPONENT   Depth                          Depth
+      DEPTH_STENCIL_OES Depth and Stencil Index        Depth and Stencil
+      ...               ...                            ...
+
+    Add a row to Table 3.5 &quot;Packed pixel formats&quot; (page 64):
+
+      type Parameter               GL Type  Components  Pixel Formats
+      ------------------------------------------------------------------
+      ...                          ...      ...         ...
+      UNSIGNED_INT_24_8_OES        uint     2           DEPTH_STENCIL_OES
+
+    Add a new table after Table 3.6 (page 64):
+
+    UNSIGNED_INT_24_8_OES
+
+       31 30 29 28 27 26 ... 12 11 10 9 8 7 6 5 4 3 2 1 0
+      +----------------------------------+---------------+
+      |           1st Component          | 2nd Component |
+      +----------------------------------+---------------+
+
+      Table 3.6.B: UNSIGNED_INT formats
+
+    Add a row to Table 3.7 &quot;Packed pixel field assignments&quot; (page 65):
+
+      Format            |  1st     2nd     3rd     4th
+      ------------------+-------------------------------
+      ...               |  ...     ...     ...     ...
+      DEPTH_STENCIL_OES |  depth   stencil N/A     N/A
+
+    Add the following paragraph to the end of the section &quot;Conversion to
+    floating-point&quot; (page 65):
+
+    &quot;For groups of components that contain both standard components and index
+    elements, such as DEPTH_STENCIL_OES, the index elements are not converted.&quot;
+
+    In section 3.7.1 &quot;Texture Image Specification&quot;, update page 67 to
+    say:
+
+    &quot;The selected groups are processed as described in section 3.6.2, stopping
+    just before final conversion.  Each R, G, B, A, or depth value so generated
+    is clamped to [0, 1], while the stencil index values are masked by 2^n-1,
+    where n is the number of stencil bits in the internal format resolution
+    (see below).
+
+    Components are then selected from the resulting R, G, B, A, depth, or
+    stencil index values to obtain a texture with the base internal format
+    specified by &lt;internalformat&gt;.  Table 3.8 summarizes the mapping of R, G,
+    B, A, depth, or stencil values to texture components, as a function of the
+    base internal format of the texture image.  &lt;internalformat&gt; may be
+    specified as one of the internal format symbolic constants listed in
+    table 3.8. Specifying a value for &lt;internalformat&gt; that is not one of the
+    above values generates the error INVALID_VALUE. If &lt;internalformat&gt; does
+    not match &lt;format&gt;, the error INVALID_OPERATION is generated.
+
+    Textures with a base internal format of DEPTH_COMPONENT or 
+    DEPTH_STENCIL_OES are supported by texture image specification commands
+    only if &lt;target&gt; is TEXTURE_2D.  Using these formats in conjunction with
+    any other &lt;target&gt; will result in an INVALID_OPERATION error.
+
+    Textures with a base internal format of DEPTH_COMPONENT or
+    DEPTH_STENCIL_OES only support one level of image data.  Specifying a
+    non-zero value for &lt;level&gt; will result in an INVALID_OPERATION error.
+
+    Textures with a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES
+    require either depth component data or depth/stencil component data.
+    Textures with other base internal formats require RGBA component data.  The
+    error INVALID_OPERATION is generated if the base internal format is
+    DEPTH_COMPONENT or DEPTH_STENCIL_OES and &lt;format&gt; is not DEPTH_COMPONENT or
+    DEPTH_STENCIL_OES, or if the base internal format is not DEPTH_COMPONENT or
+    DEPTH_STENCIL_OES and &lt;format&gt; is DEPTH_COMPONENT or DEPTH_STENCIL_OES.
+
+    Textures with a base internal format of DEPTH_COMPONENT or
+    DEPTH_STENCIL_OES do not support loading image data via the TexImage
+    commands. They can only have their contents specified by rendering
+    to them. The INVALID_OPERATION error is generated by the TexImage2D
+    command if &lt;data&gt; is not NULL for such textures.&quot;
+
+    Add a row to table 3.8 (page 68), and update the title of the
+    second column:
+
+      Base Internal Format  RGBA, Depth and Stencil Values  Internal Components
+      -------------------------------------------------------------------------
+      ...                   ...                             ...
+      DEPTH_COMPONENT       Depth                           D
+      DEPTH_STENCIL_OES     Depth,Stencil                   D,S
+      ...                   ...                             ...
+
+    Update the caption for table 3.8 (page 68)
+
+    &quot;Table 3.8: Conversion from RGBA, depth, and stencil pixel components to
+    internal texture components.  Texture components R, G, B, A, and L are 
+    converted back to RGBA colors during filtering as shown in table 3.12.
+    Texture components D are converted to RGBA colors as described in 
+    section 3.7.8-1/2.&quot;
+
+    Add the following to section 3.7.2 &quot;Alternate Texture Image Specification
+    Commands&quot;:
+
+    &quot;CopyTexImage2D and CopyTexSubImage2D generate the INVALID_OPERATION 
+    error if the base internal format of the destination texture is 
+    DEPTH_COMPONENT or DEPTH_STENCIL_OES.
+
+    TexSubImage2D generates the INVALID_OPERATION error if the base internal
+    format of the texture is DEPTH_COMPONENT or DEPTH_STENCIL_OES.&quot;
+
+    Add a new section between sections 3.7.8 and 3.7.9:
+
+    &quot;3.7.8-1/2 Depth/Stencil Textures
+
+    If the currently bound texture's base internal format is DEPTH_COMPONENT or
+    DEPTH_STENCIL_OES, then the output of the texture unit is as described
+    below. Otherwise, the texture unit operates in the normal manner.
+
+    Let &lt;D_t&gt; be the depth texture value, provided by the shader's texture lookup
+    function. Then the effective texture value is computed as follows:
+            &lt;Tau&gt; = &lt;D_t&gt;
+
+    If the texture image has a base internal format of DEPTH_STENCIL_OES, then
+    the stencil index texture component is ignored.  The texture value &lt;Tau&gt; does
+    not include a stencil index component, but includes only the depth
+    component.
+
+    The resulting &lt;Tau&gt; is assigned to &lt;R_t&gt;. In some implementations, &lt;Tau&gt; is
+    also assigned to &lt;G_t&gt;, &lt;B_t&gt;, or &lt;A_t&gt;. Thus in table 3.12, textures with
+    depth component data behave as if their base internal format is RGBA, with
+    values in &lt;G_t&gt;, &lt;B_t&gt;, and &lt;A_t&gt; being implementation dependent.&quot;
+
+    Add the following to section 3.7.11 &quot;Mipmap Generation&quot;:
+
+    &quot;If the level zero array contains depth or depth-stencil data, the
+     error INVALID_OPERATION is generated.&quot;
+
+    Insert a new paragraph after the first paragraph of the &quot;Texture Access&quot;
+    subsection of section 3.8.2 on page 87, which says:
+
+    &quot;Texture lookups involving textures with depth component data generate
+    a texture source color by using depth data directly, as described in
+    section 3.7.8-1/2.  The stencil texture internal component is ignored
+    if the base internal format is DEPTH_STENCIL_OES.&quot;
+
+Additions to Chapter 4 of the OpenGL ES 2.0 specification (Per-Fragment
+Operations and the Framebuffer)
+
+    In section 4.4.5 &quot;Framebuffer Completeness&quot;, replace the the 3rd
+    paragraph with the following text:
+
+     &quot;* An internal format is color-renderable if it is one of the formats
+        from table 4.5 noted as color-renderable or if it is unsized format
+        RGBA or RGB. No other formats, including compressed internal formats,
+        are color-renderable.
+
+      * An internal format is depth-renderable if it is one of the sized
+        internal formats from table 4.5 noted as depth-renderable, if it
+        is the unsized format DEPTH_COMPONENT or if it is the internal 
+        format value of DEPTH24_STENCIL8_OES. No other formats are 
+        depth-renderable.
+
+      * An internal format is stencil-renderable if it is one of the sized 
+        internal formats from table 4.5 noted as stencil-renderable or if it
+        is DEPTH24_STENCIL8_OES. No other formats are stencil-renderable.&quot;
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special
+Functions)
+
+    None.
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    None.
+
+Interactions with OES_packed_depth_stencil
+
+    If OES_packed_depth_stencil is not supported, mentions of
+    DEPTH_STENCIL_OES and UNSIGNED_INT_24_8_OES as a format/type combinations
+    for TexImage2D and TexSubImage2D are omitted. Mentions of
+    the internal format DEPTH24_STENCIL8_OES are also omitted.
+
+Interactions with EXT_texture_storage
+
+    If EXT_texture_storage is supported the following internalformat
+    to format/type mappings are used:
+
+        &lt;internalformat&gt;       &lt;format&gt;           &lt;type&gt;
+        ----------------       --------           ------
+        DEPTH_COMPONENT16      DEPTH_COMPONENT    UNSIGNED_SHORT
+        DEPTH_COMPONENT32_OES  DEPTH_COMPONENT    UNSIGNED_INT
+        DEPTH24_STENCIL8_OES   DEPTH_STENCIL_OES  UNSIGNED_INT
+
+    Textures with the above &lt;internalformats&gt; only support one level of
+    image data. Specifying a value other than one for the &lt;levels&gt; parameter
+    to TexStorage2DEXT will result in an INVALID_OPERATION error.
+
+    If EXT_texture_storage is not supported, ignore any references
+    to TexStorage2DEXT. 
+
+Errors
+
+    The error INVALID_OPERATION is generated by TexImage2D if &lt;format&gt; and 
+    &lt;internalformat&gt; are DEPTH_COMPONENT and &lt;type&gt; is not UNSIGNED_SHORT,
+    or UNSIGNED_INT.
+
+    The error INVALID_OPERATION is generated by TexSubImage2D if &lt;format&gt; is 
+    DEPTH_COMPONENT and &lt;type&gt; is not UNSIGNED_SHORT, or UNSIGNED_INT.
+
+    The error INVALID_OPERATION is generated by TexImage2D if &lt;format&gt; and
+    &lt;internalformat&gt; are not DEPTH_COMPONENT and &lt;type&gt; is UNSIGNED_SHORT,
+    or UNSIGNED_INT.
+
+    The error INVALID_OPERATION is generated by TexSubImage2D if &lt;format&gt; is
+    not DEPTH_COMPONENT and &lt;type&gt; is UNSIGNED_SHORT, or UNSIGNED_INT.
+
+    The error INVALID_OPERATION is generated by TexImage2D if &lt;format&gt; and
+    &lt;internalformat&gt; are DEPTH_STENCIL_OES and &lt;type&gt; is not
+    UNSIGNED_INT_24_8_OES. 
+
+    The error INVALID_OPERATION is generated by TexSubImage2D if &lt;format&gt;
+    is DEPTH_STENCIL_OES and &lt;type&gt; is not UNSIGNED_INT_24_8_OES. 
+
+    The error INVALID_OPERATION is generated by TexImage2D if &lt;format&gt; and
+    &lt;internalformat&gt; is not DEPTH_STENCIL_OES and &lt;type&gt; is 
+    UNSIGNED_INT_24_8_OES.
+
+    The error INVALID_OPERATION is generated by TexSubImage2D if &lt;format&gt;
+    is not DEPTH_STENCIL_OES and &lt;type&gt; is UNSIGNED_INT_24_8_OES.
+
+    The error INVALID_OPERATION is generated in the following situations:
+    - TexImage2D is called with &lt;format&gt; and &lt;internalformat&gt; of
+      DEPTH_COMPONENT or DEPTH_STENCIL_OES and
+       - &lt;target&gt; is not TEXTURE_2D,
+       - &lt;data&gt; is not NULL, or
+       - &lt;level&gt; is not zero.
+    - TexSubImage2D is called with &lt;format&gt; of DEPTH_COMPONENT or 
+      DEPTH_STENCIL_OES.
+    - TexStorage2DEXT is called with &lt;internalformat&gt; of DEPTH_COMPONENT16,
+      DEPTH_COMPONENT32_OES, or DEPTH24_STENCIL8_OES, and 
+       - &lt;target&gt; is not TEXTURE_2D, or
+       - &lt;levels&gt; is not one.
+    - CopyTexImage2D is called with an &lt;internalformat&gt; that has a base
+      internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES.
+    - CopyTexSubImage2D is called with a target texture that has a base
+      internal format of DEPTH_COMPONENT or DEPTH_STENCIL_OES.
+    - GenerateMipmap is called on a texture that has a base internal format
+      of DEPTH_COMPONENT or DEPTH_STENCIL_OES.
+    
+New State
+
+    None.
+
+Issues
+
+    1) What are the differences between this extension and OES_depth_texture
+       and OES_packed_depth_stencil?
+    
+       RESOLVED: This extension:
+         - does not support loading pre-baked depth stencil data via 
+           TexImage2D or TexSubImage2D.
+         - allows variability in the y-, z-, and w-components of the sample
+           results from depth textures.
+         - only supports one level textures.
+         - explicitly lists the errors for unsupported functionality.
+           Since these were not clearly specified in the OES_depth_texture
+           extension there may be differences in error values between 
+           implementations of OES_depth_texture and ANGLE_depth_texture.
+       This specification was also rebased to apply against the OpenGL ES 2.0
+       specification instead of the OpenGL specification, making it more 
+       obvious what all the functionality changes are.
+
+    2) Why does TexSubImage2D accept the new format/type combinations even
+       though it does not actually support loading data?
+
+       RESOLVED: This was done to be more consistent with the OES_depth_texture
+       extension and to make it easier to add support for loading texture
+       data if it is possible to support in the future.
+
+    3) Why are only 1-level depth textures supported? 
+
+       RESOLVED: The only use for multiple levels of depth textures would
+       be for fitlered texturing. However since it is not possible to
+       render to non-zero-level texture levels in OpenGL ES 2.0, and since
+       this extension forbids loading existing data and GenerateMipmap on 
+       depth textures, it is impossible to initialize or specify contents
+       for non-zero levels of depth textures.
+
+Revision History

+    02/25/2013  swoods  revise to allow texture lookup to guarantee depth values
+                        only in red channel of sample result.
+    06/04/2012  dgkoch  fix errors, disallow multi-level depth textures.
+    05/30/2012  dgkoch  minor updates and add issues.
+    05/23/2012  dgkoch  intial revision based on OES_depth_texture and 
+                        OES_packed_depth_stencil and rebased against the ES 2.0 spec
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_framebuffer_blittxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_blit.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_blit.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_blit.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,437 @@
</span><ins>+Name
+
+    ANGLE_framebuffer_blit
+
+Name Strings
+
+    GL_ANGLE_framebuffer_blit
+
+Contributors
+
+    Contributors to EXT_framebuffer_blit
+    Daniel Koch, TransGaming Inc.
+    Shannon Woods, TransGaming Inc.
+    Kenneth Russell, Google Inc.
+    Vangelis Kokkevis, Google Inc.
+
+Contact
+
+    Daniel Koch, TransGaming Inc. (daniel 'at' transgaming 'dot' com)
+
+Status
+
+    Implemented in ANGLE ES2
+
+Version
+
+    Last Modified Date: Sept 22, 2012
+    Author Revision: 4
+
+Number
+
+    OpenGL ES Extension #83
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+
+    The extension is written against the OpenGL ES 2.0 specification.
+
+    OES_texture_3D affects the definition of this extension.
+
+Overview
+
+    This extension modifies framebuffer objects by splitting the
+    framebuffer object binding point into separate DRAW and READ
+    bindings.  This allows copying directly from one framebuffer to
+    another.  In addition, a new high performance blit function is
+    added to facilitate these blits and perform some data conversion
+    where allowed.
+
+IP Status
+
+    No known IP claims.
+
+New Procedures and Functions
+
+    void BlitFramebufferANGLE(int srcX0, int srcY0, int srcX1, int srcY1,
+                              int dstX0, int dstY0, int dstX1, int dstY1,
+                              bitfield mask, enum filter);
+
+New Tokens
+
+    Accepted by the &lt;target&gt; parameter of BindFramebuffer,
+    CheckFramebufferStatus, FramebufferTexture2D, FramebufferTexture3DOES,
+    FramebufferRenderbuffer, and
+    GetFramebufferAttachmentParameteriv:
+
+    // (reusing the tokens from EXT_framebuffer_blit)
+    READ_FRAMEBUFFER_ANGLE                0x8CA8
+    DRAW_FRAMEBUFFER_ANGLE                0x8CA9
+
+    Accepted by the &lt;pname&gt; parameters of GetIntegerv and GetFloatv:
+
+    // (reusing the tokens from EXT_framebuffer_blit)
+    DRAW_FRAMEBUFFER_BINDING_ANGLE        0x8CA6 // alias FRAMEBUFFER_BINDING
+    READ_FRAMEBUFFER_BINDING_ANGLE        0x8CAA
+
+
+Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+    Change the last paragraph of section 3.7.2 (Alternate Texture Image
+    Specification Commands) to:
+
+    &quot;Calling CopyTexSubImage3DOES, CopyTexImage2D or CopyTexSubImage2D will
+    result in an INVALID_FRAMEBUFFER_OPERATION error if the object bound
+    to READ_FRAMEBUFFER_BINDING_ANGLE is not &quot;framebuffer complete&quot;
+    (section 4.4.4.2).&quot;
+
+Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+    Change the first word of Chapter 4 from &quot;The&quot; to &quot;A&quot;.
+
+    Append to the introduction of Chapter 4:
+
+    &quot;Conceptually, the GL has two active framebuffers; the draw
+    framebuffer is the destination for rendering operations, and the
+    read framebuffer is the source for readback operations.  The same
+    framebuffer may be used for both drawing and reading.  Section
+    4.4.1 describes the mechanism for controlling framebuffer usage.&quot;
+
+    Modify the first sentence of the last paragraph of section 4.1.1 as follows:
+
+    &quot;While an application-created framebuffer object is bound to
+    DRAW_FRAMEBUFFER_ANGLE, the pixel ownership test always passes.&quot;
+
+    Add to 4.3.1 (Reading Pixels), right before the subsection titled
+    &quot;Obtaining Pixels from the Framebuffer&quot;:
+
+    &quot;Calling ReadPixels generates INVALID_FRAMEBUFFER_OPERATION if
+    the object bound to READ_FRAMEBUFFER_BINDING_ANGLE is not &quot;framebuffer
+    complete&quot; (section 4.4.4.2). GetIntegerv generates an INVALID_OPERATION
+    error if the object bound to READ_FRAMEBUFFER_BINDING_ANGLE is not
+    framebuffer complete, or if the GL is using a framebuffer object 
+    (i.e. READ_FRAMEBUFFER_BINDING_ANGLE is non-zero) and there is no color
+    attachment.&quot;
+
+    Insert a new section 4.3.2 titled &quot;Copying Pixels&quot; and renumber the
+    subsequent sections.  Add the following text:
+
+    &quot;BlitFramebufferANGLE transfers a rectangle of pixel values from one
+    region of the read framebuffer to another in the draw framebuffer.
+
+    BlitFramebufferANGLE(int srcX0, int srcY0, int srcX1, int srcY1,
+                         int dstX0, int dstY0, int dstX1, int dstY1,
+                         bitfield mask, enum filter);
+
+    &lt;mask&gt; is the bitwise OR of a number of values indicating which
+    buffers are to be copied. The values are COLOR_BUFFER_BIT,
+    DEPTH_BUFFER_BIT, and STENCIL_BUFFER_BIT, which are described in
+    section 4.2.3.  The pixels corresponding to these buffers are
+    copied from the source rectangle, bound by the locations (srcX0,
+    srcY0) and (srcX1, srcY1), to the destination rectangle, bound by
+    the locations (dstX0, dstY0) and (dstX1, dstY1).  The lower bounds
+    of the rectangle are inclusive, while the upper bounds are
+    exclusive.
+
+    The actual region taken from the read framebuffer is limited to the
+    intersection of the source buffers being transferred, which may include
+    the color buffer, the depth buffer, and/or the stencil buffer depending on
+    &lt;mask&gt;. The actual region written to the draw framebuffer is limited to the
+    intersection of the destination buffers being written, which may include
+    the color buffer, the depth buffer, and/or the stencil buffer
+    depending on &lt;mask&gt;. Whether or not the source or destination regions are
+    altered due to these limits, the offset applied to pixels being transferred
+    is performed as though no such limits were present.
+
+    Stretching and scaling during a copy are not supported. If the source
+    and destination rectangle dimensions do not match, no copy is
+    performed and an INVALID_OPERATION error is generated.
+    Because stretching is not supported, &lt;filter&gt; must be NEAREST and
+    no filtering is applied. 
+
+    Flipping during a copy is not supported. If either the source or 
+    destination rectangle specifies a negative dimension, the error 
+    INVALID_OPERATION is generated. If both the source and 
+    destination rectangles specify a negative dimension for the same 
+    direction, no reversal is required and the operation is supported.
+
+    If the source and destination buffers are identical, and the
+    source and destination rectangles overlap, the result of the blit
+    operation is undefined.
+
+    The pixel copy bypasses the fragment pipeline.  The only fragment
+    operations which affect the blit are the pixel ownership test and
+    the scissor test.
+
+    If a buffer is specified in &lt;mask&gt; and does not exist in both the
+    read and draw framebuffers, the corresponding bit is silently
+    ignored.
+
+    Calling BlitFramebufferANGLE will result in an
+    INVALID_FRAMEBUFFER_OPERATION error if the objects bound to
+    DRAW_FRAMEBUFFER_BINDING_ANGLE and READ_FRAMEBUFFER_BINDING_ANGLE are
+    not &quot;framebuffer complete&quot; (section 4.4.4.2).&quot;
+
+    Calling BlitFramebufferANGLE will result in an INVALID_OPERATION
+    error if &lt;mask&gt; includes COLOR_BUFFER_BIT and the source and 
+    destination color formats to not match.
+
+    Calling BlitFramebufferANGLE will result in an INVALID_OPERATION
+    error if &lt;mask&gt; includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT
+    and the source and destination depth and stencil buffer formats do
+    not match.
+
+    If &lt;mask&gt; includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, only 
+    complete buffers can be copied.  If the source rectangle does not 
+    specify the complete source buffer or the destination rectangle 
+    (after factoring the scissor region, if applicable) does not specify 
+    the complete destination buffer, an INVALID_OPERATION
+    error is generated.
+
+    Modify the beginning of section 4.4.1 as follows:
+
+    &quot;The default framebuffer for rendering and readback operations is
+    provided by the windowing system.  In addition, named framebuffer
+    objects can be created and operated upon.  The namespace for
+    framebuffer objects is the unsigned integers, with zero reserved
+    by the GL for the default framebuffer.
+
+    A framebuffer object is created by binding an unused name to
+    DRAW_FRAMEBUFFER_ANGLE or READ_FRAMEBUFFER_ANGLE.  The binding is
+    effected by calling
+
+        void BindFramebuffer(enum target, uint framebuffer);
+
+    with &lt;target&gt; set to the desired framebuffer target and
+    &lt;framebuffer&gt; set to the unused name.  The resulting framebuffer
+    object is a new state vector, comprising one set of the state values
+    listed in table 6.23 for each attachment point of the
+    framebuffer, set to the same initial values.  There is one
+    color attachment point, plus one each
+    for the depth and stencil attachment points.
+
+    BindFramebuffer may also be used to bind an existing
+    framebuffer object to DRAW_FRAMEBUFFER_ANGLE or
+    READ_FRAMEBUFFER_ANGLE.  If the bind is successful no change is made
+    to the state of the bound framebuffer object, and any previous
+    binding to &lt;target&gt; is broken.
+
+    If a framebuffer object is bound to DRAW_FRAMEBUFFER_ANGLE or
+    READ_FRAMEBUFFER_ANGLE, it becomes the target for rendering or
+    readback operations, respectively, until it is deleted or another
+    framebuffer is bound to the corresponding bind point.  Calling
+    BindFramebuffer with &lt;target&gt; set to FRAMEBUFFER binds the
+    framebuffer to both DRAW_FRAMEBUFFER_ANGLE and READ_FRAMEBUFFER_ANGLE.
+
+    While a framebuffer object is bound, GL operations on the target
+    to which it is bound affect the images attached to the bound
+    framebuffer object, and queries of the target to which it is bound
+    return state from the bound object.  Queries of the values
+    specified in table 6.20 (Implementation Dependent Pixel Depths)
+    and table 6.yy (Framebuffer Dependent Values) are
+    derived from the framebuffer object bound to DRAW_FRAMEBUFFER_ANGLE.
+
+    The initial state of DRAW_FRAMEBUFFER_ANGLE and READ_FRAMEBUFFER_ANGLE
+    refers to the default framebuffer provided by the windowing
+    system.  In order that access to the default framebuffer is not
+    lost, it is treated as a framebuffer object with the name of 0.
+    The default framebuffer is therefore rendered to and read from
+    while 0 is bound to the corresponding targets.  On some
+    implementations, the properties of the default framebuffer can
+    change over time (e.g., in response to windowing system events
+    such as attaching the context to a new windowing system drawable.)&quot;
+
+    Change the description of DeleteFramebuffers as follows:
+
+    &quot;&lt;framebuffers&gt; contains &lt;n&gt; names of framebuffer objects to be
+    deleted.  After a framebuffer object is deleted, it has no
+    attachments, and its name is again unused.  If a framebuffer that
+    is currently bound to one or more of the targets
+    DRAW_FRAMEBUFFER_ANGLE or READ_FRAMEBUFFER_ANGLE is deleted, it is as
+    though BindFramebuffer had been executed with the corresponding
+    &lt;target&gt; and &lt;framebuffer&gt; zero.  Unused names in &lt;framebuffers&gt;
+    are silently ignored, as is the value zero.&quot;
+
+
+    In section 4.4.3 (Renderbuffer Objects), modify the first two sentences
+    of the description of FramebufferRenderbuffer as follows:
+
+    &quot;&lt;target&gt; must be DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE, or
+    FRAMEBUFFER.  If &lt;target&gt; is FRAMEBUFFER, it behaves as
+    though DRAW_FRAMEBUFFER_ANGLE was specified.  The INVALID_OPERATION 
+    error is generated if the value of the corresponding binding is zero.&quot;
+
+    In section 4.4.3 (Renderbuffer Objects), modify the first two sentences
+    of the description of FramebufferTexture2D as follows:
+
+    &quot;&lt;target&gt; must be DRAW_FRAMEBUFFER_ANGLE,
+    READ_FRAMEBUFFER_ANGLE, or FRAMEBUFFER.  If &lt;target&gt; is
+    FRAMEBUFFER, it behaves as though DRAW_FRAMEBUFFER_ANGLE was
+    specified.  The INVALID_OPERATION error is generated if the value of the
+    corresponding binding is zero.&quot;
+
+    In section 4.4.5 (Framebuffer Completeness), modify the first sentence 
+    of the description of CheckFramebufferStatus as follows:
+
+    &quot;If &lt;target&gt; is not DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE or
+    FRAMEBUFFER, the error INVALID_ENUM is generated.  If &lt;target&gt; is
+    FRAMEBUFFER, it behaves as though DRAW_FRAMEBUFFER_ANGLE was
+    specified.&quot;
+
+    Modify the first sentence of the subsection titled &quot;Effects of Framebuffer
+    Completeness on Framebuffer Operations&quot; to be:
+
+    &quot;Attempting to render to or read from a framebuffer which is not
+    framebuffer complete will generate an
+    INVALID_FRAMEBUFFER_OPERATION error.&quot;
+    
+
+
+Additions to Chapter 6 of the OpenGL 1.5 Specification (State and State
+Requests)
+
+    In section 6.1.3, modify the first sentence of the description of
+    GetFramebufferAttachmentParameteriv as follows:
+
+    &quot;&lt;target&gt; must be DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE or
+    FRAMEBUFFER.  If &lt;target&gt; is FRAMEBUFFER, it behaves as
+    though DRAW_FRAMEBUFFER_ANGLE was specified.&quot;
+
+    Modify the title of Table 6.23 (Framebuffer State) to be &quot;Framebuffer 
+    (state per attachment point)&quot;. 
+
+
+Dependencies on OES_texture_3D
+
+    On an OpenGL ES implementation, in the absense of OES_texture_3D,
+    omit references to FramebufferTexture3DOES and CopyTexSubImage3DOES.
+
+Errors
+
+    The error INVALID_FRAMEBUFFER_OPERATION is generated if
+    BlitFramebufferANGLE is called while the
+    draw framebuffer is not framebuffer complete.
+
+    The error INVALID_FRAMEBUFFER_OPERATION is generated if
+    BlitFramebufferANGLE, ReadPixels, CopyTex{Sub}Image*, is called while the
+    read framebuffer is not framebuffer complete.
+
+    The error INVALID_OPERATION is generated if GetIntegerv is called
+    while the read framebuffer is not framebuffer complete, or if there
+    is no color attachment present on the read framebuffer object.
+
+    The error INVALID_VALUE is generated by BlitFramebufferANGLE if
+    &lt;mask&gt; has any bits set other than those named by
+    COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT.
+
+    The error INVALID_OPERATION is generated if BlitFramebufferANGLE is
+    called and &lt;mask&gt; includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT
+    and the source and destination depth or stencil buffer formats do
+    not match.
+
+    The error INVALID_OPERATION is generated if BlitFramebufferANGLE is 
+    called and any of the following conditions are true:
+     - the source and destination rectangle dimensions do not match
+       (ie scaling or flipping is required).
+     - &lt;mask&gt; includes COLOR_BUFFER_BIT and the source and destination 
+       buffer formats do not match.
+     - &lt;mask&gt; includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT and the
+       source or destination rectangles do not specify the entire source
+       or destination buffer (after applying any scissor region).
+
+    The error INVALID_ENUM is generated by BlitFramebufferANGLE if
+    &lt;filter&gt; is not NEAREST.
+
+    The error INVALID_ENUM is generated if BindFramebuffer,
+    CheckFramebufferStatus, FramebufferTexture{2D|3DOES},
+    FramebufferRenderbuffer, or
+    GetFramebufferAttachmentParameteriv is called and &lt;target&gt; is
+    not DRAW_FRAMEBUFFER_ANGLE, READ_FRAMEBUFFER_ANGLE or FRAMEBUFFER.
+
+New State
+
+    (Add a new table 6.xx, &quot;Framebuffer (state per framebuffer target binding point)&quot;)
+
+    Get Value                     Type   Get Command   Initial Value    Description               Section
+    ------------------------------  ----   -----------   --------------   -------------------       ------------
+    DRAW_FRAMEBUFFER_BINDING_ANGLE   Z+    GetIntegerv   0                framebuffer object bound  4.4.1
+                                                                          to DRAW_FRAMEBUFFER_ANGLE
+    READ_FRAMEBUFFER_BINDING_ANGLE   Z+    GetIntegerv   0                framebuffer object        4.4.1
+                                                                          to READ_FRAMEBUFFER_ANGLE
+
+    Remove reference to FRAMEBUFFER_BINDING from Table 6.23.
+
+    (Add a new table 6.yy, &quot;Framebuffer Dependent Values&quot;) 
+
+    Get Value                     Type   Get Command   Initial Value    Description               Section
+    ----------------------------  ----   -----------   --------------   -------------------       ------------
+    SAMPLE_BUFFERS                 Z+    GetIntegerv   0                Number of multisample     3.2
+                                                                        buffers
+    SAMPLES                        Z+    GetIntegerv   0                Coverage mask size        3.2
+
+    Remove the references to SAMPLE_BUFFERS and SAMPLES from Table 6.17.
+
+
+Issues
+
+    1) What should we call this extension?
+  
+       Resolved: ANGLE_framebuffer_blit.  
+
+       This extension is a result of a collaboration between Google and 
+       TransGaming for the open-source ANGLE project. Typically one would
+       label a multi-vendor extension as EXT, but EXT_framebuffer_blit 
+       is already the name for this on Desktop GL.  Additionally this
+       isn't truely a multi-vendor extension because there is only one
+       implementation of this.  We'll follow the example of the open-source
+       MESA project which uses the project name for the vendor suffix.
+
+    2) Why is this done as a separate extension instead of just supporting
+       EXT_framebuffer_blit?
+
+       To date, EXT_framebuffer_blit has not had interactions with OpenGL ES
+       specified and, as far as we know, it has not previously been exposed on 
+       an ES 1.1 or ES 2.0 implementation. Because there are enough 
+       differences between Desktop GL and OpenGL ES, and since OpenGL ES 2.0 
+       has already subsumed the EXT_framebuffer_object functionality (with 
+       some changes) it was deemed a worthwhile exercise to fully specify the
+       interactions.  Additionally, some of the choices in exactly which 
+       functionality is supported by BlitFramebufferANGLE is dictated by
+       what is reasonable to support on a implementation which is 
+       layered on Direct3D9.  It is not expected that other implementations 
+       will necessary have the same set of restrictions or requirements. 
+
+    3) How does this extension differ from EXT_framebuffer_blit?
+
+       This extension is designed to be a pure subset of the 
+       EXT_framebuffer_blit functionality as applicable to OpenGL ES 2.0.
+
+       Functionality that is unchanged:
+        - the split DRAW and READ framebuffer attachment points and related sematics.
+        - the token values for the DRAW/READ_FRAMEBUFFER and DRAW/READ_FRAMBUFFER_BINDING
+        - the signature of the BlitFramebuffer entry-point.
+       
+       Additional restrictions imposed by BlitFramebufferANGLE:
+        - no color conversions are supported
+        - no scaling, stretching or flipping are supported
+        - no filtering is supported (a consequence of no stretching)
+        - only whole depth and/or stencil buffers can be copied
+
+Revision History
+
+    Revision 1, 2010/07/06
+      - copied from revision 15 of EXT_framebuffer_object
+      - removed language that was clearly not relevant to ES2
+      - rebased changes against the OpenGL ES 2.0 specification
+      - added ANGLE-specific restrictions
+    Revision 2, 2010/07/15
+      - clarifications of implicit clamping to buffer sizes (from ARB_fbo)
+      - clarify that D/S restricts apply after the scissor is applied
+      - improve some error language
+    Revision 3, 2010/08/06
+      - add additional contributors, update implementation status
+    Revision 4, 2012/09/22
+      - document errors for GetIntegerv.
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_framebuffer_multisampletxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_multisample.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_multisample.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_framebuffer_multisample.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,363 @@
</span><ins>+Name
+
+    ANGLE_framebuffer_multisample
+
+Name Strings
+
+    GL_ANGLE_framebuffer_multisample
+
+Contributors
+
+    Contributors to EXT_framebuffer_multisample
+    Daniel Koch, TransGaming Inc.
+    Shannon Woods, TransGaming Inc.
+    Kenneth Russell, Google Inc.
+    Vangelis Kokkevis, Google Inc.
+
+Contacts
+
+    Daniel Koch, TransGaming Inc. (daniel 'at' transgaming 'dot' com)
+
+Status
+
+    Implemented in ANGLE ES2
+
+Version
+
+    Last Modified Date: Aug 6, 2010 
+    Author Revision: #3
+
+Number
+
+    OpenGL ES Extension #84
+
+Dependencies
+
+    Requires OpenGL ES 2.0.
+
+    Requires GL_ANGLE_framebuffer_blit (or equivalent functionality).
+
+    The extension is written against the OpenGL ES 2.0 specification. 
+
+    OES_texture_3D affects the definition of this extension.
+
+Overview
+
+    This extension extends the framebuffer object framework to
+    enable multisample rendering.
+
+    The new operation RenderbufferStorageMultisampleANGLE() allocates
+    storage for a renderbuffer object that can be used as a multisample
+    buffer.  A multisample render buffer image differs from a
+    single-sample render buffer image in that a multisample image has a
+    number of SAMPLES that is greater than zero.  No method is provided
+    for creating multisample texture images.
+
+    All of the framebuffer-attachable images attached to a framebuffer
+    object must have the same number of SAMPLES or else the framebuffer
+    object is not &quot;framebuffer complete&quot;.  If a framebuffer object with
+    multisample attachments is &quot;framebuffer complete&quot;, then the
+    framebuffer object behaves as if SAMPLE_BUFFERS is one.
+
+    The resolve operation is affected by calling 
+    BlitFramebufferANGLE (provided by the ANGLE_framebuffer_blit
+    extension) where the source is a multisample application-created
+    framebuffer object and the destination is a single-sample
+    framebuffer object (either application-created or window-system
+    provided).
+
+New Procedures and Functions
+
+    void RenderbufferStorageMultisampleANGLE(
+            enum target, sizei samples,
+            enum internalformat,
+            sizei width, sizei height);
+
+New Types
+
+    None.
+
+New Tokens
+
+    Accepted by the &lt;pname&gt; parameter of GetRenderbufferParameteriv:
+
+        RENDERBUFFER_SAMPLES_ANGLE                  0x8CAB
+
+    Returned by CheckFramebufferStatus:
+
+        FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE    0x8D56
+
+    Accepted by the &lt;pname&gt; parameter of GetBooleanv, GetIntegerv,
+    and GetFloatv:
+
+        MAX_SAMPLES_ANGLE                           0x8D57
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL Operation)
+
+Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+    Add to the last paragraph of 3.7.2 (Alternate Texture Image Specification)
+    (as modified by ANGLE_framebuffer_blit) the following:
+
+    &quot;Calling CopyTexSubImage3DOES, CopyTexImage2D or CopyTexSubImage2D will
+    result in INVALID_OPERATION being generated if the object bound to
+    READ_FRAMEBUFFER_BINDING_ANGLE is &quot;framebuffer complete&quot; and the value
+    of SAMPLE_BUFFERS is greater than zero.&quot;
+
+Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+    Add to 4.3.1 (Reading Pixels), right before the subsection titled
+    &quot;Obtaining Pixels from the Framebuffer&quot;:
+
+    &quot;ReadPixels generates INVALID_OPERATION if READ_FRAMEBUFFER_BINDING_ANGLE
+    (section 4.4) is non-zero, the read framebuffer is framebuffer
+    complete, and the value of SAMPLE_BUFFERS for the read framebuffer
+    is greater than zero.&quot;
+
+    In 4.3.2 (Copying Pixels), add to the section describing BlitFramebuffer
+    that was added by ANGLE_framebuffer_blit.
+
+    &quot;If SAMPLE_BUFFERS for the read framebuffer is greater than zero and
+    SAMPLE_BUFFERS for the draw framebuffer is zero, the samples
+    corresponding to each pixel location in the source are converted to
+    a single sample before being written to the destination.
+
+    If SAMPLE_BUFFERS for the draw framebuffer is greater than zero, 
+    no copy is performed and an INVALID_OPERATION error is generated.
+
+    If SAMPLE_BUFFERS for the read framebuffer is greater than zero and
+    &lt;mask&gt; includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, no copy is 
+    performed and an INVALID_OPERATION error is generated.
+
+    If SAMPLE_BUFFERS for the read framebuffer is greater than zero and 
+    the format of the read and draw framebuffers are not identical, no
+    copy is performed and an INVALID_OPERATION error is generated.
+
+    If SAMPLE_BUFFERS for the read framebuffer is greater than zero, the
+    dimensions of the source and destination rectangles provided to 
+    BlitFramebufferANGLE must be identical and must specify the complete 
+    source and destination buffers, otherwise no copy is performed and 
+    an INVALID_OPERATION error is generated.&quot;
+
+    Modification to 4.4.3 (Renderbuffer Objects)
+
+    Add, just above the definition of RenderbufferStorage:
+
+    &quot;The command
+
+        void RenderbufferStorageMultisampleANGLE(
+            enum target, sizei samples,
+            enum internalformat,
+            sizei width, sizei height);
+
+    establishes the data storage, format, dimensions, and number of
+    samples of a renderbuffer object's image.  &lt;target&gt; must be
+    RENDERBUFFER.  &lt;internalformat&gt; must be one of the color-renderable,
+    depth-renderable, or stencil-renderable formats described in table 4.5.
+    &lt;width&gt; and &lt;height&gt; are the dimensions in pixels of the renderbuffer.  If
+    either &lt;width&gt; or &lt;height&gt; is greater than the value of 
+    MAX_RENDERBUFFER_SIZE, or if &lt;samples&gt; is greater than MAX_SAMPLES_ANGLE, 
+    then the error INVALID_VALUE is generated. If OpenGL ES is unable to 
+    create a data store of the requested size, the error OUT_OF_MEMORY 
+    is generated.
+
+    Upon success, RenderbufferStorageMultisampleANGLE deletes any existing
+    data store for the renderbuffer image and the contents of the data
+    store after calling RenderbufferStorageMultisampleANGLE are undefined.
+    RENDERBUFFER_WIDTH is set to &lt;width&gt;, RENDERBUFFER_HEIGHT is
+    set to &lt;height&gt;, and RENDERBUFFER_INTERNAL_FORMAT is set to
+    &lt;internalformat&gt;.
+
+    If &lt;samples&gt; is zero, then RENDERBUFFER_SAMPLES_ANGLE is set to zero.
+    Otherwise &lt;samples&gt; represents a request for a desired minimum
+    number of samples. Since different implementations may support
+    different sample counts for multisampled rendering, the actual
+    number of samples allocated for the renderbuffer image is
+    implementation dependent.  However, the resulting value for
+    RENDERBUFFER_SAMPLES_ANGLE is guaranteed to be greater than or equal
+    to &lt;samples&gt; and no more than the next larger sample count supported
+    by the implementation.
+
+    An OpenGL ES implementation may vary its allocation of internal component
+    resolution based on any RenderbufferStorageMultisampleANGLE parameter (except
+    target), but the allocation and chosen internal format must not be a
+    function of any other state and cannot be changed once they are
+    established. The actual resolution in bits of each component of the 
+    allocated image can be queried with GetRenderbufferParameteriv.&quot;
+
+    Modify the definiton of RenderbufferStorage as follows:
+
+    &quot;The command
+
+        void RenderbufferStorage(enum target, enum internalformat,
+                                    sizei width, sizei height);
+
+     is equivalent to calling RenderbufferStorageMultisampleANGLE with
+     &lt;samples&gt; equal to zero.&quot;
+
+    In section 4.4.5 (Framebuffer Completeness) in the subsection
+    titled &quot;Framebuffer Completeness&quot; add an entry to the bullet list:
+
+    * The value of RENDERBUFFER_SAMPLES_ANGLE is the same for all attached
+      images.
+      { FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE }
+
+    Also add a paragraph to the end of the section after the definition
+    of CheckFramebufferStatus:
+
+    &quot;The values of SAMPLE_BUFFERS and SAMPLES are derived from the
+    attachments of the currently bound framebuffer object.  If the
+    current DRAW_FRAMEBUFFER_BINDING_ANGLE is not &quot;framebuffer complete&quot;,
+    then both SAMPLE_BUFFERS and SAMPLES are undefined.  Otherwise,
+    SAMPLES is equal to the value of RENDERBUFFER_SAMPLES_ANGLE for the
+    attached images (which all must have the same value for
+    RENDERBUFFER_SAMPLES_ANGLE).  Further, SAMPLE_BUFFERS is one if
+    SAMPLES is non-zero.  Otherwise, SAMPLE_BUFFERS is zero.
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
+
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    In section 6.1.3 (Enumeraged Queries), modify the third paragraph 
+    of the description of GetRenderbufferParameteriv as follows:
+
+    &quot;Upon successful return from GetRenderbufferParameteriv, if
+    &lt;pname&gt; is RENDERBUFFER_WIDTH, RENDERBUFFER_HEIGHT,
+    RENDERBUFFER_INTERNAL_FORMAT, or RENDERBUFFER_SAMPLES_ANGLE, then &lt;params&gt; 
+    will contain the width in pixels, height in pixels, internal format, or 
+    number of samples, respectively, of the image of the renderbuffer 
+    currently bound to &lt;target&gt;.&quot;
+
+
+Dependencies on ANGLE_framebuffer_blit    
+
+    ANGLE_framebuffer_blit is required.  Technically, ANGLE_framebuffer_blit
+    would not be required to support multisampled rendering, except for
+    the fact that it provides the only method of doing a multisample
+    resovle from a multisample renderbuffer.
+
+Dependencies on OES_texture_3D
+
+    On an OpenGL ES implementation, in the absense of OES_texture_3D,
+    omit references to CopyTexSubImage3DOES.
+
+Errors
+
+    The error INVALID_OPERATION is generated if ReadPixels or 
+    CopyTex{Sub}Image* is called while READ_FRAMEBUFFER_BINDING_ANGLE
+    is non-zero, the read framebuffer is framebuffer complete, and the
+    value of SAMPLE_BUFFERS for the read framebuffer is greater than
+    zero.
+
+    If both the draw and read framebuffers are framebuffer complete and
+    the draw framebuffer has a value of SAMPLE_BUFFERS that is greater 
+    than zero, then the error INVALID_OPERATION is generated if 
+    BlitFramebufferANGLE is called.
+
+    If both the draw and read framebuffers are framebuffer complete and
+    the read framebuffer has a value of SAMPLE_BUFFERS that is greater
+    than zero, the error INVALID_OPERATION is generated if 
+    BlitFramebufferANGLE is called and any of the following conditions
+    are true:
+     - &lt;mask&gt; includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT.
+     - the source or destination rectangles do not specify the entire
+       source or destination buffer.
+
+    If both the draw and read framebuffers are framebuffer complete and
+    either has a value of SAMPLE_BUFFERS that is greater than zero, then
+    the error INVALID_OPERATION is generated if BlitFramebufferANGLE is
+    called and the formats of the draw and read framebuffers are not
+    identical.
+
+    If either the draw or read framebuffer is framebuffer complete and
+    has a value of SAMPLE_BUFFERS that is greater than zero, then the
+    error INVALID_OPERATION is generated if BlitFramebufferANGLE is called
+    and the specified source and destination dimensions are not
+    identical.
+
+    If RenderbufferStorageMultisampleANGLE is called with &lt;target&gt; not
+    equal to RENDERBUFFER, the error INVALID_ENUM is generated.
+
+    If RenderbufferStorageMultisampleANGLE is called with an 
+    &lt;internalformat&gt; that is not listed as one of the color-, depth- 
+    or stencil-renderable formats in Table 4.5, then the error
+    INVALID_ENUM is generated.
+
+    If RenderbufferStorageMultisampleANGLE is called with &lt;width&gt; or 
+    &lt;height&gt; greater than MAX_RENDERBUFFER_SIZE, then the error 
+    INVALID_VALUE is generated.
+
+    If RenderbufferStorageMultisampleANGLE is called with a value of
+    &lt;samples&gt; that is greater than MAX_SAMPLES_ANGLE or less than zero,
+    then the error INVALID_VALUE is generated.
+
+    The error OUT_OF_MEMORY is generated when
+    RenderbufferStorageMultisampleANGLE cannot create storage of the
+    specified size.
+
+New State
+
+    Add to table 6.22 (Renderbuffer State)
+
+    Get Value                          Type    Get Command                 Initial Value  Description             Section
+    -------------------------------    ------  --------------------------  -------------  --------------------    -------
+    RENDERBUFFER_SAMPLES_ANGLE         Z+      GetRenderbufferParameteriv  0              number of samples       4.4.3
+
+
+    Add to table 6.yy (Framebuffer Dependent Vaues) (added by 
+    ANGLE_framebuffer_blit), the following new framebuffer dependent state.
+
+    Get Value          Type  Get Command     Minimum Value    Description             Section
+    -----------------  ----  -----------     -------------    -------------------     -------
+    MAX_SAMPLES_ANGLE  Z+    GetIntegerv     1                Maximum number of       4.4.3
+                                                              samples supported
+                                                              for multisampling
+                                                            
+
+
+Issues
+    
+    Issues from EXT_framebuffer_multisample have been removed.

+    1) What should we call this extension?
+
+       Resolved: ANGLE_framebuffer_blit.  
+
+       This extension is a result of a collaboration between Google and 
+       TransGaming for the open-source ANGLE project. Typically one would
+       label a multi-vendor extension as EXT, but EXT_framebuffer_mulitsample 
+       is already the name for this on Desktop GL.  Additionally this
+       isn't truely a multi-vendor extension because there is only one
+       implementation of this.  We'll follow the example of the open-source
+       MESA project which uses the project name for the vendor suffix.

+    2) How does this extension differ from EXT_framebuffer_multisample?
+
+       This is designed to be a proper subset of EXT_framebuffer_multisample
+       functionality as applicable to OpenGL ES 2.0.
+
+       Functionality that is unchanged: 
+        - creation of multisample renderbuffers.
+        - whole buffer multi-sample-&gt;single-sample resolve.
+        - no format conversions, stretching or flipping supported on multisample blits.
+
+       Additional restrictions on BlitFramebufferANGLE:
+        - multisample resolve is only supported on color buffers.
+        - no blits to multisample destinations (no single-&gt;multi or multi-multi).
+        - only entire buffers can be resolved.
+         
+Revision History
+
+    Revision 1, 2010/07/08
+      - copied from revision 7 of EXT_framebuffer_multisample
+      - removed language that was not relevant to ES2 
+      - rebase changes against the Open GL ES 2.0 specification
+      - added ANGLE-specific restrictions
+    Revision 2, 2010/07/19
+      - fix missing error code
+    Revision 3, 2010/08/06
+      - add additional contributors, update implementation status
+      - disallow negative samples 
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_instanced_arraystxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_instanced_arrays.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_instanced_arrays.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_instanced_arrays.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,359 @@
</span><ins>+Name
+
+    ANGLE_instanced_arrays
+
+Name Strings
+
+    GL_ANGLE_instanced_arrays
+
+Contributors
+
+    Contributors to ARB_instanced_arrays
+    Nicolas Capens, TransGaming Inc.
+    James Helferty, TransGaming Inc.
+    Kenneth Russell, Google Inc.
+    Vangelis Kokkevis, Google Inc.
+
+Contact
+
+    Daniel Koch, TransGaming Inc. (daniel 'at' transgaming.com)
+
+Status
+
+    Implemented in ANGLE r976.
+
+Version
+
+    Last Modified Date: February 8, 2012
+    Author Revision: 3
+
+Number
+
+    OpenGL ES Extension #109
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+
+    This extension is written against the OpenGL ES 2.0 Specification.
+
+Overview
+
+    A common use case in GL for some applications is to be able to
+    draw the same object, or groups of similar objects that share
+    vertex data, primitive count and type, multiple times.  This 
+    extension provides a means of accelerating such use cases while 
+    restricting the number of API calls, and keeping the amount of 
+    duplicate data to a minimum.
+    
+    This extension introduces an array &quot;divisor&quot; for generic
+    vertex array attributes, which when non-zero specifies that the
+    attribute is &quot;instanced.&quot;  An instanced attribute does not
+    advance per-vertex as usual, but rather after every &lt;divisor&gt;
+    conceptual draw calls.
+    
+    (Attributes which aren't instanced are repeated in their entirety
+    for every conceptual draw call.)
+    
+    By specifying transform data in an instanced attribute or series
+    of instanced attributes, vertex shaders can, in concert with the 
+    instancing draw calls, draw multiple instances of an object with 
+    one draw call.
+
+IP Status
+
+    No known IP claims.
+
+New Tokens
+
+    Accepted by the &lt;pname&gt; parameters of GetVertexAttribfv and 
+    GetVertexAttribiv:
+
+        VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE               0x88FE
+
+New Procedures and Functions
+
+    void DrawArraysInstancedANGLE(enum mode, int first, sizei count,
+            sizei primcount);
+
+    void DrawElementsInstancedANGLE(enum mode, sizei count, enum type,
+            const void *indices, sizei primcount);
+
+    void VertexAttribDivisorANGLE(uint index, uint divisor);
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification
+(OpenGL ES Operation)
+
+    Modify section 2.8 (Vertex Arrays), p. 21
+
+    After description of EnableVertexAttribArray / DisableVertexAttribArray
+    add the following:
+
+    &quot;The command
+
+        void VertexAttribDivisorANGLE(uint index, uint divisor);
+
+    modifies the rate at which generic vertex attributes advance when
+    rendering multiple instances of primitives in a single draw call
+    (see DrawArraysInstancedANGLE and DrawElementsInstancedANGLE below).
+    If &lt;divisor&gt; is zero, the attribute at slot &lt;index&gt; advances once
+    per vertex.  If &lt;divisor&gt; is non-zero, the attribute advances once
+    per &lt;divisor&gt; instances of the primitives being rendered.
+    An attribute is referred to as &quot;instanced&quot; if its &lt;divisor&gt; value is
+    non-zero.&quot;
+
+    Replace the text describing DrawArrays and DrawElements in the
+    &quot;Transferring Array Elements&quot; subsection of 2.8, from the second paragraph
+    through the end of the section with the following:
+
+    &quot;The command
+
+        void DrawArraysOneInstance( enum mode, int first, sizei count, int instance );
+
+    does not exist in the GL, but is used to describe functionality in
+    the rest of this section.  This function constructs a sequence of
+    geometric primitives by transferring elements &lt;first&gt; through &lt;first&gt; +
+    &lt;count&gt; - 1 of each enabled non-instanced array to the GL. &lt;mode&gt;
+    specifies what kind of primitives are constructed, as defined in section
+    2.6.1.
+
+    If an enabled vertex attribute array is instanced (it has a non-zero
+    attribute &lt;divisor&gt; as specified by VertexAttribDivisorANGLE), the element
+    that is transferred to the GL is given by:
+
+        floor( &lt;instance&gt; / &lt;divisor&gt; ).
+
+    If an array corresponding to a generic attribute required by a vertex shader
+    is not enabled, then the corresponding element is taken from the current
+    generic attribute state (see section 2.7).
+
+    If an array corresponding to a generic attribute required by a vertex shader
+    is enabled, the corresponding current generic attribute value is unaffected 
+    by the execution of DrawArraysOneInstance.
+
+    Specifying &lt;first&gt; &lt; 0 results in undefined behavior. Generating the error 
+    INVALID_VALUE is recommended in this case.
+
+    The command
+
+        void DrawArrays( enum mode, int first, sizei count );
+
+    is equivalent to the command sequence
+    
+        DrawArraysOneInstance(mode, first, count, 0);
+
+    The command
+
+        void DrawArraysInstancedANGLE(enum mode, int first, sizei count,
+                sizei primcount);
+
+    behaves identically to DrawArrays except that &lt;primcount&gt;
+    instances of the range of elements are executed, and the
+    &lt;instance&gt; advances for each iteration. Instanced attributes that
+    have &lt;divisor&gt; N, (where N &gt; 0, as specified by
+    VertexAttribDivisorANGLE) advance once every N instances.
+    
+    It has the same effect as: 
+
+        if (mode, count, or primcount is invalid)
+            generate appropriate error
+        else {
+            for (i = 0; i &lt; primcount; i++) {
+                DrawArraysOneInstance(mode, first, count, i);
+            }
+        }
+
+    The command
+
+       void DrawElementsOneInstance( enum mode, sizei count, enum type,
+            void *indices, int instance );
+
+    does not exist in the GL, but is used to describe functionality in
+    the rest of this section.  This command constructs a sequence of
+    geometric primitives by successively transferring the &lt;count&gt; elements
+    whose indices are stored in the currently bound element array buffer
+    (see section 2.9.2) at the offset defined by &lt;indices&gt; to the GL.
+    The &lt;i&gt;-th element transferred by DrawElementsOneInstance will be taken
+    from element &lt;indices&gt;[i] of each enabled non-instanced array.
+    &lt;type&gt; must be one of UNSIGNED_BYTE, UNSIGNED_SHORT, or UNSIGNED_INT, 
+    indicating that the index values are of GL type ubyte, ushort, or uint
+    respectively. &lt;mode&gt; specifies what kind of primitives are constructed,
+    as defined in section 2.6.1.
+
+    If an enabled vertex attribute array is instanced (it has a non-zero
+    attribute &lt;divisor&gt; as specified by VertexAttribDivisorANGLE), the element
+    that is transferred to the GL is given by:
+
+        floor( &lt;instance&gt; / &lt;divisor&gt; );
+
+    If an array corresponding to a generic attribute required by a vertex
+    shader is not enabled, then the corresponding element is taken from the 
+    current generic attribute state (see section 2.7). Otherwise, if an array
+    is enabled, the corresponding current generic attribute value is 
+    unaffected by the execution of DrawElementsOneInstance.
+
+    The command
+
+        void DrawElements( enum mode, sizei count, enum type,
+             const void *indices);
+
+    behaves identically to DrawElementsOneInstance with the &lt;instance&gt; 
+    parameter set to zero; the effect of calling
+
+        DrawElements(mode, count, type, indices);
+
+    is equivalent to the command sequence:
+
+       if (mode, count or type is invalid )
+            generate appropriate error
+        else
+            DrawElementsOneInstance(mode, count, type, indices, 0);
+
+    The command
+
+        void DrawElementsInstancedANGLE(enum mode, sizei count, enum type,
+                const void *indices, sizei primcount);
+
+    behaves identically to DrawElements except that &lt;primcount&gt;
+    instances of the set of elements are executed and the instance
+    advances between each set. Instanced attributes are advanced as they do
+    during the execution of DrawArraysInstancedANGLE. It has the same effect as:
+
+        if (mode, count, primcount, or type is invalid )
+            generate appropriate error
+        else {
+            for (int i = 0; i &lt; primcount; i++) {
+                DrawElementsOneInstance(mode, count, type, indices, i);
+            }
+        }
+
+    If the number of supported generic vertex attributes (the value of 
+    MAX_VERTEX_ATTRIBS) is &lt;n&gt;, then the client state required to implement
+    vertex arrays consists of &lt;n&gt; boolean values, &lt;n&gt; memory pointers, &lt;n&gt;
+    integer stride values, &lt;n&gt; symbolic constants representing array types,
+    &lt;n&gt; integers representing values per element, &lt;n&gt; boolean values 
+    indicating normalization, and &lt;n&gt; integers representing vertex attribute
+    divisors. 
+
+    In the initial state, the boolean values are each false, the memory
+    pointers are each NULL, the strides are each zero, the array types are 
+    each FLOAT, the integers representing values per element are each four,
+    and the divisors are each zero.&quot;
+
+Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+    None
+
+Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+    None
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
+
+    None
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    In section 6.1.8, add VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE to the list of 
+    pnames accepted by GetVertexAttribfv and GetVertexAttribiv.
+
+Additions to the AGL/EGL/GLX/WGL Specifications
+
+    None
+
+Dependencies on OES_element_index_uint
+
+    If OES_element_index_uint is not supported, removed all references
+    to UNSIGNED_INT indices and the associated GL data type uint in 
+    the description of DrawElementsOneInstance.
+
+Errors
+
+    INVALID_VALUE is generated by VertexAttribDivisorANGLE if &lt;index&gt;
+    is greater than or equal to MAX_VERTEX_ATTRIBS.
+
+    INVALID_ENUM is generated by DrawElementsInstancedANGLE if &lt;type&gt; is
+    not one of UNSIGNED_BYTE, UNSIGNED_SHORT or UNSIGNED_INT.
+
+    INVALID_VALUE is generated by DrawArraysInstancedANGLE if &lt;first&gt;,
+    &lt;count&gt;, or &lt;primcount&gt; is less than zero.
+
+    INVALID_ENUM is generated by DrawArraysInstancedANGLE or 
+    DrawElementsInstancedANGLE if &lt;mode&gt; is not one of the modes described in
+    section 2.6.1.
+
+    INVALID_VALUE is generated by DrawElementsInstancedANGLE if &lt;count&gt; or
+    &lt;primcount&gt; is less than zero.
+
+    INVALID_OPERATION is generated by DrawArraysInstancedANGLE or 
+    DrawElementsInstancedANGLE if there is not at least one enabled
+    vertex attribute array that has a &lt;divisor&gt; of zero and is bound to an
+    active generic attribute value in the program used for the draw command.
+
+New State
+
+    Changes to table 6.7, p. 268 (Vertex Array Data)
+
+                                                               Initial
+    Get Value                          Type   Get Command      Value    Description       Sec.  
+    ---------                          -----  -----------      -------  -----------       ----
+    VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE  8*xZ+  GetVertexAttrib  0        Instance Divisor  2.8
+
+Issues
+
+    1) Should vertex attribute zero be instance-able?
+
+       Resolved: Yes. 
+       Discussion: In Direct3D 9 stream 0 must be specified as indexed data
+       and it cannot be instanced. In ANGLE we can work around this by
+       remapping any other stream that does have indexed data (ie a zero
+       attribute divisor) to stream 0 in D3D9. This works because the HLSL
+       vertex shader matches attributes against the stream by using the 
+       shader semantic index.
+
+    2) Can all vertex attributes be instanced simultaneously?
+
+       Resolved: No
+       Discussion: In rare cases it is possible for no attribute to have a 
+       divisor of 0, meaning that all attributes are instanced and none of
+       them are regularly indexed. This in turn means each instance can only
+       have a single position element, and so it only actually renders
+       something when rendering point primitives. This is not a very 
+       meaningful way of using instancing (which is likely why D3D restricts
+       stream 0 to be indexed regularly for position data in the first place).
+       We could implement it by drawing these points one at a time (essentially
+       emulating instancing), but it would not be very efficient and there
+       seems to be little-to-no value in doing so.
+
+       If all of the enabled vertex attribute arrays that are bound to active
+       generic attributes in the program have a non-zero divisor, the draw
+       call should return INVALID_OPERATION.
+
+    3) Direct3D 9 only supports instancing for DrawIndexedPrimitive which
+       corresponds to DrawElementsInstanced.  Should we support 
+       DrawArraysInstanced?
+
+       Resolved: Yes
+       Discussion: This can be supported easily enough by simply manufacturing
+       a linear index buffer of sufficient size and using that to do indexed
+       D3D9 drawing.
+
+    4) How much data is needed in a buffer for an instanced attribute?
+
+       Resolved: Where stride is the value passed to VertexAttribPointer:
+
+       if stride &gt; 0
+         size = stride * ceil(primcount / divisor);
+       else
+         size = elementsize * ceil(primcount / divisor);
+
+Revision History
+
+    #3 February 8, 2012 dgkoch
+       - clarify Issue 3 and the error condition for no indexed attributes
+    #2 January 24, 2012 dgkoch
+       - fix typos, add clarifications, and more errors
+    #1 January 17, 2012 dgkoch
+       - initial GLES2 version from ARB_instanced_arrays
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_pack_reverse_row_ordertxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_pack_reverse_row_order.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_pack_reverse_row_order.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_pack_reverse_row_order.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,168 @@
</span><ins>+Name
+
+    ANGLE_pack_reverse_row_order
+
+Name Strings
+
+    GL_ANGLE_pack_reverse_row_order
+
+Contact
+
+    Daniel Koch, TransGaming (daniel 'at' transgaming.com)
+
+Contributors
+
+    Brian Salomon
+    Daniel Koch
+
+Status
+
+    Implemented in ANGLE ES2
+
+Version
+
+    Last Modified Date: February 22, 2011
+    Author Revision: 22
+
+Number
+
+    OpenGL ES Extension #110
+
+Dependencies
+
+    OpenGL 1.5 or OpenGL ES 1.0 are required.
+
+    Some of the functionality of this extension is not supported
+    when implemented against OpenGL ES.
+
+    EXT_texture_rg interacts with this extension.
+
+    The extension is written against the OpenGL 3.2 Specification
+    (Core Profile).
+
+Overview
+
+    This extension introduces a mechanism to allow reversing the order
+    in which image rows are written into a pack destination. This
+    effectively allows an application to flip the results of a ReadPixels
+    in the y direction operation without having to render upside down.
+
+    The coordinate system of OpenGL is vertically reversed in comparison to a
+    number of other graphics systems such as native windowing APIs. Applications
+    that perform ReadPixels may have to either render to an intermediate color
+    buffer before calling ReadPixels or perform a flip in software after
+    ReadPixels. In some systems the GL can perform the row reversal during
+    ReadPixels without incurring additional cost.
+
+IP Status
+
+    No known IP claims.
+
+New Procedures and Functions
+
+    None
+
+New Types
+
+    None
+
+New Tokens
+
+    Accepted by the &lt;pname&gt; parameter of PixelStore{if}, GetIntegerv(),
+    GetBooleanv(), and GetFloatv():
+
+        PACK_REVERSE_ROW_ORDER_ANGLE    0x93A4
+
+Additions to Chapter 3 of the OpenGL 3.2 Specification (Rasterization)
+
+    In Section 4.3.1 (Reading Pixels) add a row to table 4.7:
+
+        +------------------------------+---------+---------------+-------------+
+        | Parameter Name               | Type    | Initial Value | Valid Range |
+        +------------------------------+---------+---------------+-------------+
+        | PACK_REVERSE_ROW_ORDER_ANGLE | boolean | FALSE         | TRUE/FALSE  |
+        +------------------------------+---------+---------------+-------------+
+
+    In Section 4.3.1 (Reading Pixels) modify the second paragraph of subsection 
+    &quot;Placement in Pixel Pack Buffer or Client Memory&quot; to read:
+
+        When PACK_REVERSE_ROW_ORDER_ANGLE is FALSE groups of elements are placed
+        in memory just as they are taken from memory when transferring pixel
+        rectangles to the GL. That is, the ith group of the jth row
+        (corresponding to the ith pixel in the jth row) is placed in memory just
+        where the ith group of the jth row would be taken from when transferring
+        pixels. See Unpacking under section 3.7.2. The only difference is that
+        the storage mode parameters whose names begin with PACK_ are used
+        instead of those whose names begin with UNPACK_. If the format is RED,
+        GREEN, BLUE, or ALPHA, only the corresponding single element is written.
+        Likewise if the format is RG, RGB, or BGR, only the corresponding two or
+        three elements are written. Otherwise all the elements of each group are
+        written. When PACK_REVERSE_ROW_ORDER_ANGLE is TRUE the order of the rows
+        of elements is reversed before the data is packed. That is, the element
+        corresponding to pixel (x, y + height - 1) becomes the first element
+        packed, followed by (x + 1, y + height - 1), etc. Otherwise, pixel data
+        is packed in the same manner as when PACK_REVERSE_ROW_ORDER_ANGLE is
+        FALSE.
+
+Additions to Chapter 6 of the OpenGL 3.2 Specification (State and State Requests)
+
+    In Section 6.1.4 add the following sentence to the fifth paragraph
+    (beginning with &quot;For three-dimensional and two-dimensional array
+    textures...&quot;):
+        When PACK_REVERSE_ROW_ORDER_ANGLE is TRUE the order of rows within
+        each image are reversed without reordering the images themselves.
+
+Dependencies on OpenGL ES
+
+    If implemented for OpenGL ES, this extension behaves as specified, except:
+
+    -Delete all references to formats RED, GREEN, BLUE, RG, and BGR.
+
+    -The language about image order in Section 6.1.4 does not apply as OpenGL ES
+     does not have GetTexImage.
+
+Dependencies on EXT_texture_rg
+
+    If EXT_texture_rg is present reinsert language about formats RED and RG
+    into the OpenGL ES 2.0 specification.
+
+Errors
+
+    None
+
+New State
+                                                           Initial
+    Get Value                       Type  Get Command      Value    Description                    Sec.
+    ---------                       ----  -----------      -------  -----------                    ----
+    PACK_REVERSE_ROW_ORDER_ANGLE    B     GetIntegerv      FALSE    Pixel pack row order reversal  4.3.1
+
+New Implementation Dependent State
+
+    None
+
+Issues
+
+    None
+
+Sample Code
+
+    /* Allocate space to hold the pixel data */
+    const GLvoid* pixels = malloc(width * height * 4);
+
+    /* Bind the framebuffer object to be read */
+    glBindFramebuffer(GL_READ_FRAMEBUFFER, framebuffer);
+
+    /* Enable row order reversal */
+    glPixelStore(GL_PACK_REVERSE_ROW_ORDER_ANGLE, TRUE);
+
+    /* The pixel data stored in pixels will be in top-down order, ready for
+     * use with a windowing system API that expects this order.
+     */
+    glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+
+Revision History
+
+    Revision 1, 2011/11/22 (Brian Salomon)
+      - First version
+    Revision 2, 2012/02/22 (dgkoch)
+      - prepare for publishing
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_platform_angletxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,127 @@
</span><ins>+Name
+
+    ANGLE_platform_angle
+
+Name Strings
+
+    EGL_ANGLE_platform_angle
+
+Contributors
+
+    Scott Graham, Google
+    Shannon Woods, Google
+    Geoff Lang, Google
+
+Contacts
+
+    Scott Graham, Google (scottmg 'at' google 'dot' com)
+
+Status
+
+    Draft
+
+Version
+
+    Version 3, 2014-10-20
+
+Number
+
+    EGL Extension XXX
+
+Extension Type
+
+    EGL client extension
+
+Dependencies
+
+    Requires EGL_EXT_client_extensions to query its existence without
+    a display.
+
+    Requires EGL_EXT_platform_base.
+
+    This extension is written against the wording of version 9 of the
+    EGL_EXT_platform_base specification.
+
+    ANGLE_platform_angle_d3d affects the definition of this extension.
+    ANGLE_platform_angle_opengl affects the definition of this extension.
+
+Overview
+
+    This extension defines how to create EGL resources from native resources
+    using the functions defined by EGL_EXT_platform_base.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted as the &lt;platform&gt; argument of eglGetPlatformDisplayEXT:
+
+        EGL_PLATFORM_ANGLE_ANGLE                           0x3202
+
+    Accepted as an attribute name in the &lt;attrib_list&gt; argument of
+    eglGetPlatformDisplayEXT:
+
+        EGL_PLATFORM_ANGLE_TYPE_ANGLE                      0x3203
+        EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE         0x3204
+        EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE         0x3205
+
+    Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
+
+        EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE              0x3206
+
+Additions to the EGL Specification
+
+    None.
+
+New Behavior
+
+    To determine if the EGL implementation supports this extension, clients
+    should query the EGL_EXTENSIONS string of EGL_NO_DISPLAY.
+
+    To obtain an EGLDisplay backed by a ANGLE display, call
+    eglGetPlatformDisplayEXT with &lt;platform&gt; set to EGL_PLATFORM_ANGLE_ANGLE.
+
+    The &lt;native_display&gt; parameter is of type EGLNativeDisplayType. If
+    &lt;native_display&gt; is EGL_DEFAULT_DISPLAY a default display is returned.
+    Multiple calls with the same &lt;native_display&gt; will return the same
+    EGLDisplay handle. If &lt;platform&gt; is set to EGL_PLATFORM_ANGLE_ANGLE and
+    the returned display is in an uninitialized state, its attributes are
+    overwritten by those provided in the &lt;attrib_list&gt;, if any.
+
+    If no &lt;attrib_list&gt; is specified, the value of
+    EGL_PLATFORM_ANGLE_TYPE_ANGLE is implicitly set to
+    EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE.
+
+    If no &lt;attrib_list&gt; is specified, the values of
+    EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
+    EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE are implicitly set to
+    EGL_DONT_CARE.
+
+    If EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE is set to EGL_DONT_CARE and
+    EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE is not set to EGL_DONT_CARE,
+    an EGL_BAD_ATTRIBUTE error is generated and EGL_NO_DISPLAY is returned.
+
+    If no display matching the requested &lt;native_display&gt; or of the type
+    requested by the value of EGL_PLATFORM_ANGLE_TYPE_ANGLE is available,
+    EGL_NO_DISPLAY is returned. No error condition is raised in this case.
+
+Issues
+
+    None
+
+Revision History
+
+    Version 1, 2014-02-04 (Scott Graham)
+      - Initial draft
+    Version 2, 2014-06-05 (Geoff Lang)
+      - Rename extension from ANGLE_platform_angle_d3d to ANGLE_platform_angle.
+      - Add sub-extensions for specific platforms.
+    Version 3, 2014-10-20 (Geoff Lang)
+      - Add attributes to request specific feature level and context versions.
+      - Moved descriptions of platforms to child extension specs.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_platform_angle_d3dtxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_d3d.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_d3d.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_d3d.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,140 @@
</span><ins>+Name
+
+    ANGLE_platform_angle_d3d
+
+Name Strings
+
+    EGL_ANGLE_platform_angle_d3d
+
+Contributors
+
+    Shannon Woods, Google
+    Geoff Lang, Google
+
+Contacts
+
+    Geoff Lang, Google (geofflang 'at' chromium 'dot' org)
+
+Status
+
+    Draft
+
+Version
+
+    Version 3, 2014-11-26
+
+Number
+
+    EGL Extension XXX
+
+Extension Type
+
+    EGL client extension
+
+Dependencies
+
+    Requires ANGLE_platform_angle.
+
+Overview
+
+    This extension enables selection of D3D display types.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
+
+        EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE                 0x3207
+        EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE                0x3208
+
+    Accepted as an attribute name in the &lt;attrib_list&gt; argument of
+    eglGetPlatformDisplayEXT:
+
+        EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE               0x3209
+        EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE     0x320F
+
+    Accepted as values for the EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE attribute:
+
+        EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE      0x320A
+        EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE          0x320B
+        EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE     0x320C
+
+Additions to the EGL Specification
+
+    None.
+
+New Behavior
+
+    To request a display that is backed by Direct3D resources, the value of
+    EGL_PLATFORM_ANGLE_TYPE_ANGLE should be:
+      - EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE for a D3D9 display,
+      - EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE for a D3D11 display.
+
+    To request a specific maximum feature level to be used by the D3D11
+    display, EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
+    EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE can be used.  Only feature
+    levels that are capable of supporting all available client APIs will be
+    used unless explicitly requested.
+    EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
+    EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE have no effect when requesting
+    a D3D9 display.
+
+    If no &lt;attrib_list&gt; is specified to eglGetPlatformDisplayEXT, the value of
+    EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE is implicitly set to
+    EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE. Otherwise, the value of
+    EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE should be:
+      - EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE to request a hardware
+        accelerated device.
+      - EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE to request an
+        optimized software rasterizer.
+      - EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE to request a
+        reference rasterizer.
+
+    If EGL_PLATFORM_ANGLE_TYPE_ANGLE is set to
+    EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, the display can automatically respond
+    to trim events from the operating system.  If the attribute
+    EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is unspecified, it is
+    implicitly set to EGL_FALSE.  Otherwise, the value of
+    EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE should be EGL_TRUE or
+    EGL_FALSE.
+
+    If EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE is set to
+    EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE and EGL_PLATFORM_ANGLE_TYPE_ANGLE
+    is not set to EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, an EGL_BAD_ATTRIBUTE
+    error is generated and EGL_NO_DISPLAY is returned.
+
+    If EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is specified when
+    EGL_PLATFORM_ANGLE_TYPE_ANGLE is not EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE
+    or a value other than EGL_TRUE or EGL_FALSE is used, an EGL_BAD_ATTRIBUTE
+    error is generated and EGL_NO_DISPLAY is returned.
+
+Issues
+
+    1) Some multithreaded applications can crash if the display automatically
+       responds to trim events while the application is rendering from another
+       thread.
+
+       RESOLVED: Added an EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE
+       enum to specify if the display should respond to trim events.
+       Applications that do multithreaded rendering should disable automatic
+       trim and handle the trim events on their own.
+
+Revision History
+
+    Version 1, 2014-06-05 (Geoff Lang)
+      - Initial draft
+    Version 2, 2014-10-27 (Geoff Lang)
+      - Separate WARP devices into a new attribute instead of a platform type.
+      - Moved descriptions of platforms and major/minor versions from
+        EGL_ANGLE_platform_angle spec to EGL_ANGLE_platform_angle_d3d.
+    Version 3, 2014-11-26 (Geoff Lang)
+      - Remove the USE_WARP bool and replace it with a DEVICE_TYPE enum.
+    Version 4, 2015-03-11 (Geoff Lang)
+      - Add the ENABLE_AUTOMATIC_TRIM enum.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_platform_angle_opengltxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_opengl.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_opengl.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_platform_angle_opengl.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+Name
+
+    ANGLE_platform_angle_opengl
+
+Name Strings
+
+    EGL_ANGLE_platform_angle_opengl
+
+Contributors
+
+    Shannon Woods, Google
+    Geoff Lang, Google
+
+Contacts
+
+    Geoff Lang, Google (geofflang 'at' chromium 'dot' org)
+
+Status
+
+    Draft
+
+Version
+
+    Version 3, 2014-11-26
+
+Number
+
+    EGL Extension XXX
+
+Extension Type
+
+    EGL client extension
+
+Dependencies
+
+    Requires ANGLE_platform_angle.
+
+Overview
+
+    This extension enables selection of OpenGL display types.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
+
+        EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE               0x320D
+        EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE             0x320E
+
+Additions to the EGL Specification
+
+    None.
+
+New Behavior
+
+    To request a display that translates to OpenGL or OpenGL ES, the value of
+    EGL_PLATFORM_ANGLE_TYPE_ANGLE should be:
+      - EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE for an OpenGL display,
+      - EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE for a native OpenGL ES display.
+
+    To request a specific maximum context version to use for the underlying
+    API, EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
+    EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE can be used.
+
+Issues
+
+    None
+
+Revision History
+
+    Version 1, 2014-06-05 (Geoff Lang)
+      - Initial draft
+    Version 2, 2014-10-27 (Geoff Lang)
+      - Moved descriptions of platforms and major/minor versions from
+        EGL_ANGLE_platform_angle spec to EGL_ANGLE_platform_angle_opengl.
+    Version 3, 2014-11-26 (Geoff Lang)
+      - Updated enum values.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_program_binarytxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_program_binary.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_program_binary.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_program_binary.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+Name
+
+    ANGLE_program_binary
+
+Name Strings
+
+    GL_ANGLE_program_binary
+
+Contributors
+
+    Alastair Patrick, Google Inc.
+    Daniel Koch, TransGaming Inc.
+
+Contact
+
+    Alastair Patrick, Google Inc. (apatrick 'at' google 'dot' com)
+
+Status
+
+    Under development.
+
+Version
+
+    Last Modifed Date: June 6, 2012
+    Revision: #1
+
+Number
+
+    TBD
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+    OES_get_program_binary is required.
+    This extension is written against the OpenGL ES 2.0.25 specification.
+
+Overview
+
+    This extension makes available a program binary format,
+    PROGRAM_BINARY_ANGLE. It enables retrieving and loading of pre-linked
+    ANGLE program objects.
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted by the &lt;binaryFormat&gt; parameter of ProgramBinaryOES:
+
+        PROGRAM_BINARY_ANGLE        0x93A6
+
+Additions to Chapter 2 of the OpenGL-ES 2.0 Specification (OpenGL Operation)
+
+    Add the following paragraph to the end of section 2.15.4, Program Binaries:
+    
+    &quot;PROGRAM_BINARY_ANGLE, returned in the list of PROGRAM_BINARY_FORMATS_OES,
+    is a format that may be loaded into a program object via ProgramBinaryOES.&quot; 
+    
+Additions to Chapter 3 of the OpenGL ES 2.0 specification (Rasterizatoin)
+
+    None.
+
+Additions to Chapter 4 of the OpenGL ES 2.0 specification (Per-Fragment
+Operations and the Framebuffer)
+
+    None.
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special
+Functions)
+
+    None.
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    None.
+
+Errors
+
+    None
+
+New State
+
+    None.
+
+Issues
+
+    None
+
+Revision History

+    06/06/2012  apatrick  intial revision
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_robust_resource_initializationtxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_robust_resource_initialization.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_robust_resource_initialization.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_robust_resource_initialization.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,142 @@
</span><ins>+Name
+
+    ANGLE_robust_resource_initialization.txt
+
+Name Strings
+
+    ANGLE_robust_resource_intialization
+
+Contributors
+
+    Geoff Lang, Google
+    Ken Russell, Google
+
+Contacts
+
+    Shannon Woods, Google (shannonwoods 'at' google.com)
+
+Status
+
+    Draft
+
+Version
+
+    Version 1, January 7, 2015
+
+Number
+
+    OpenGL ES Extension TBD
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+
+    This extension is written against the wording of the OpenGL ES
+    3.1 specification.
+
+    EGL_EXT_create_context_robust_initialization is used to request a
+    context supporting this extension to perform resource initialization.
+
+Overview
+
+    This extension specifies the behavior for initialization of
+    resources such as textures and buffers to default values. This
+    initialization ensures that access will not be provided by the
+    GL to previously allocated data not owned by the application.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted by the &lt;value&gt; parameter of GetBooleanv, GetIntegerv,
+    GetFloatv, GetDoublev, and GetInteger54v:
+
+        CONTEXT_ROBUST_RESOURCE_INITIALIZATION_ANGLE    0x93A7
+
+
+Additions to Chapter 6 of the OpenGL ES 3.1 Specification (Buffer
+Objects)
+
+    Replace the last sentence of the first paragraph of section 6.2
+    &quot;BufferData&quot;:
+
+    If &lt;data&gt; is NULL, and robust resource initialization is enabled,
+    the contents of the buffer object's data store are set to zero.
+    Otherwise, the contents of the buffer object's data store are
+    undefined.
+
+Additions to Chapter 8 of the OpenGL ES 3.1 Specification (Textures and
+Samplers)
+
+    Replace the first two sentances of the final paragraph in section
+    8.5.3 &quot;Texture Image Structure&quot;:
+
+    If the &lt;data&gt; argument of TexImage2D or TexImage3D is NULL, and the
+    pixel unpack buffer object is zero, a two- or three-dimensional
+    texel array is created with the specified &lt;target&gt;, &lt;level&gt;,
+    &lt;internalformat&gt;, &lt;border&gt;, &lt;width&gt;, &lt;height&gt;, and &lt;depth&gt;. If
+    robust resource initialization is enabled, the contents of the image
+    are initialized as though a zero value were provided for each
+    component of each pixel, and processed and transferred to the GL
+    as described above. The components comprising this zero-filled data
+    are determined by &lt;internalformat&gt;. If robust resource
+    initialization is not enabled, the image contents are undefined, and
+    no pixel processing is performed. In either case, no pixel values
+    are accessed in client memory.
+
+    Replace the first sentence of the fifth paragraph in section 8.8
+    &quot;Multisample Textures&quot;:
+
+    Upon success, TexStorage2DMultisample deletes any existing image
+    for target. If robust resource initialization is enabled, the
+    contents of each texel are initialized as though a zero value were
+    written to each channel of each sample; otherwise the contents of
+    texels are undefined.
+
+    Add to the final paragraph of section 8.17 &quot;Immutable-Format Texture
+    Images&quot;:
+
+    If robust resource initialization is enabled, the contents of each
+    texel is initialized as though a zero value were provided for each
+    component of each pixel, and processed and transferred to the GL
+    as for a call to the appropriate TexSubImage* call for &lt;target&gt;.
+    Otherwise, the contents of texels are undefined.
+
+Additions to Chapter 9 of the OpenGL ES 3.1 Specification (Framebuffers
+and Framebuffer Objects)
+
+    Replace the sentence in section 9.2.4 &quot;Renderbuffer Objects&quot;
+    beginning &quot;Upon success, RenderbufferStorageMultisample&quot;:
+
+    Upon success, RenderbufferStorageMultisample deletes any existing
+    data store for the renderbuffer image. If robust resource
+    initialization is enabled, the contents of each pixel in the data
+    store are initialized as though a zero value was written to each
+    channel of each sample; otherwise, the contents of the data store
+    are undefined.
+
+Interactions with EGL_ANGLE_create_context_robust_resource
+
+    If the EGL window-system binding API is used to create a context,
+    the EGL_ANGLE_create_context_robust_initialization extension is
+    supported, and the attribute
+    EGL_CONTEXT_OPENGL_ROBUST_INITIALIZATION_ANGLE is set to
+    EGL_TRUE when eglCreateContext is called, the resulting context
+    will perform robust resource initialization as described above in
+    section &lt;section&gt;, and the
+    CONTEXT_ROBUST_RESOURCE_INITIALIZATION_ANGLE
+    query will return GL_TRUE as described above in section 2.6.1.1.
+
+Issues
+
+    None
+
+Revision History
+
+    Version 1, 2015/01/07 - first draft.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_texture_compression_dxttxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_compression_dxt.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_compression_dxt.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_compression_dxt.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+Name
+
+    ANGLE_texture_compression_dxt
+
+Name Strings
+
+    GL_ANGLE_texture_compression_dxt1
+    GL_ANGLE_texture_compression_dxt3
+    GL_ANGLE_texture_compression_dxt5
+
+Contributors
+
+    Gregg Tavares, Google Inc.
+    Daniel Koch, TransGaming Inc.
+    Al Patrick, Google Inc.
+
+Contacts
+
+    Gregg Tavares, Google Inc. (gman 'at' google 'dot' com)
+
+Status
+
+    Implemented in ANGLE ES2
+
+Version
+
+    Last Modified Date: Sept 22, 2012
+    Author Revision: 2
+
+Number
+
+    OpenGL ES Extension #111
+
+Dependencies
+
+    Requires OpenGL ES 1.0.
+
+    The extension is written against the OpenGL ES 2.0 specification.
+
+Overview
+
+    These extensions are exactly the same as EXT_texture_compression_dxt1
+    except they additionally expose the COMPRESSED_RGBA_S3TC_DXT3_ANGLE and
+    COMPRESSED_RGBA_S3TC_DXT5_ANGLE formats and have a size restrictions
+    such that the size must be a multiple of four (except for mip levels
+    where the dimensions are either 2 or 1).
+
+    See EXT_texture_compression_dxt1 for the full list of changes. Also
+    see EXT_texture_compression_s3tc for a description of the formats.
+
+IP Status
+
+    A license to the S3TC Intellectual Property may be necessary for 
+    implementation of this extension.  You should consult with your 
+    Attorney to determine the need for a license.
+
+New Procedures and Functions
+
+    None.
+
+New Types
+
+    None.
+
+New Tokens
+
+    Accepted by the &lt;internalformat&gt; parameter of CompressedTexImage2D
+    and the &lt;format&gt; parameter of CompressedTexSubImage2D:
+
+    COMPRESSED_RGB_S3TC_DXT1_ANGLE                    0x83F0
+    COMPRESSED_RGBA_S3TC_DXT1_ANGLE                   0x83F1
+    COMPRESSED_RGBA_S3TC_DXT3_ANGLE                   0x83F2
+    COMPRESSED_RGBA_S3TC_DXT5_ANGLE                   0x83F3
+
+Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+    Add the following to Section 3.7.3 (Compressed Texture Images)
+    (at the end of the description of the CompressedTexImage2D command):
+
+    Compressed Internal Format        Base Internal Format
+    ==========================        ====================
+    COMPRESSED_RGB_S3TC_DXT1_ANGLE    RGB
+    COMPRESSED_RGBA_S3TC_DXT1_ANGLE   RGBA
+    COMPRESSED_RGBA_S3TC_DXT3_ANGLE   RGBA
+    COMPRESSED_RGBA_S3TC_DXT5_ANGLE   RGBA
+
+    Table 3.x: Specific Compressed Internal Formats
+
+    If &lt;internalformat&gt; is one of the S3TC formats listed in Table 3.x,
+    the compressed texture is stored in the appropriate S3TC compressed
+    texture format (see Appendix). The GL and the S3TC texture compression
+    algorithm support only 2D images without borders.
+
+    CompressedTexImage2D will produce the INVALID_OPERATION error when
+    &lt;internalformat&gt; is one of the values from Table 3.x under the following
+    conditions: 
+
+      * &lt;border&gt; is non-zero.
+      * &lt;width&gt; is not one, two, or a multiple of four.
+      * &lt;height&gt; is not one, two, or a multiple of four.
+
+    Add the following to Section 3.7.3 (Compressed Texture Images)
+    (at the end of the description of the CompressedTexSubImage2D command):
+
+    If the internal format of the texture image being modified is listed
+    in Table 3.x, the texture is stored in the appropriate S3TC compressed
+    texture format (see Appendix). Since DXT/S3TC images are easily edited
+    along 4x4 texel boundaries, the limitations of CompressedTexSubImage2D
+    are relaxed. CompressedTexSubImage2D will result in an INVALID_OPERATION
+    error only if one of the following conditions occurs:
+
+      * &lt;width&gt; is not a multiple of four or equal to TEXTURE_WIDTH.
+      * &lt;height&gt; is not a multipls of four or equal to TEXTURE_HEIGHT.
+      * &lt;xoffset&gt; or &lt;yoffset&gt; is not a multiple of four.
+      * &lt;format&gt; does not match the internal format of the texture image
+        being modified.
+
+    The following restrictions at the end of section 3.7.3 do not apply
+    to S3TC DXT texture formats, since subimage modification is straightforward
+    as long as the subimage is properly aligned.
+
+Errors
+
+    INVALID_OPERATION is generated by CompressedTexImage2D if &lt;internalformat&gt;
+    is one of the compressed internal formats from Table 3.x and any of the 
+    following apply:
+      - &lt;border&gt; is not equal to zero.
+      - &lt;width&gt; is not one, two, or a multiple of four. 
+      - &lt;height&gt; is not one, two, or a multiple of four. 
+
+    INVALID_OPERATION is generated by TexImage2D and CopyTexImage2D if
+    &lt;internalformat&gt; is one of the compressed internal formats from
+    Table 3.x.
+
+    INVALID_OPERATION is generated by TexSubImage2D and CopyTexSubImage2D
+    if the internal format of the texture currently bound to &lt;target&gt; is
+    one of the compressed internal formats from Table 3.x.
+
+    INVALID_OPERATION is generated by CompressedTexSubImage2D if &lt;format&gt;
+    is one of the compressed interal formats from Table 3.x and any of the
+    following apply:
+      - &lt;width&gt; is not a multiple of four or equal to TEXTURE_WIDTH;
+      - &lt;height&gt; is not a multiple of four or equal to TEXTURE_HEIGHT;
+      - &lt;xoffset&gt; or &lt;yoffset&gt; is not a multiple of four;
+      - &lt;format&gt; does not match the internal format of the texture image
+      being modified.
+
+New State
+
+    None.
+
+Appendix: 
+
+    The format for the S3TC Compressed Texture Images Formats is documented
+    in the appendix of EXT_texture_compression_s3tc.
+
+Revision History
+
+    Revision 1, 2010/08/06 - gman
+      - Initial revision
+    Revision 2, 2012/09/22 - dgkoch
+      - Added DXT1 formats and documented multiple of 4 restriction.
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_texture_usagetxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_usage.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_usage.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_texture_usage.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,202 @@
</span><ins>+Name
+
+    ANGLE_texture_usage
+
+Name Strings
+
+    GL_ANGLE_texture_usage
+
+Contributors
+
+    Nicolas Capens, TransGaming
+    Daniel Koch, TransGaming
+
+Contact
+
+    Daniel Koch, TransGaming (daniel 'at' transgaming.com)
+
+Status
+
+    Complete
+
+Version
+
+    Last Modified Date:  November 10, 2011
+    Version:             2
+
+Number
+
+    OpenGL ES Extension #112 
+
+Dependencies
+
+    This extension is written against the OpenGL ES 2.0 Specification.
+
+Overview
+
+    In some implementations it is advantageous to know the expected
+    usage of a texture before the backing storage for it is allocated.  
+    This can help to inform the implementation's choice of format
+    and type of memory used for the allocation. If the usage is not
+    known in advance, the implementation essentially has to make a 
+    guess as to how it will be used.  If it is later proven wrong,
+    it may need to perform costly re-allocations and/or reformatting 
+    of the texture data, resulting in reduced performance.
+
+    This extension adds a texture usage flag that is specified via
+    the TEXTURE_USAGE_ANGLE TexParameter.  This can be used to 
+    indicate that the application knows that this texture will be 
+    used for rendering.
+
+IP Status
+
+    No known IP claims.
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted as a value for &lt;pname&gt; for the TexParameter{if} and 
+    TexParameter{if}v commands and for the &lt;value&gt; parameter of
+    GetTexParameter{if}v: 
+
+        TEXTURE_USAGE_ANGLE                     0x93A2
+
+    Accepted as a value to &lt;param&gt; for the TexParameter{if} and 
+    to &lt;params&gt; for the TexParameter{if}v commands with a &lt;pname&gt; of 
+    TEXTURE_USAGE_ANGLE; returned as possible values for &lt;data&gt; when 
+    GetTexParameter{if}v is queried with a &lt;value&gt; of TEXTURE_USAGE_ANGLE:
+
+        NONE                                    0x0000
+        FRAMEBUFFER_ATTACHMENT_ANGLE            0x93A3
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
+
+    None
+
+Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+    Add a new row to Table 3.10 (Texture parameters and their values):
+
+    Name                | Type | Legal Values 
+    ------------------------------------------------------------
+    TEXTURE_USAGE_ANGLE | enum | NONE, FRAMEBUFFER_ATTACHMENT_ANGLE
+
+    Add a new section 3.7.x (Texture Usage) before section 3.7.12 and 
+    renumber the subsequent sections: 
+
+    &quot;3.7.x Texture Usage
+
+    Texture usage can be specified via the TEXTURE_USAGE_ANGLE value
+    for the &lt;pname&gt; argument to TexParameter{if}[v]. In order to take effect,
+    the texture usage must be specified before the texture contents are
+    defined either via TexImage2D or TexStorage2DEXT.
+
+    The usage values can impact the layout and type of memory used for the 
+    texture data. Specifying incorrect usage values may result in reduced
+    functionality and/or significantly degraded performance.
+
+    Possible values for &lt;params&gt; when &lt;pname&gt; is TEXTURE_USAGE_ANGLE are:
+
+    NONE - the default. No particular usage has been specified and it is
+        up to the implementation to determine the usage of the texture.
+        Leaving the usage unspecified means that the implementation may 
+        have to reallocate the texture data as the texture is used in 
+        various ways.
+
+    FRAMEBUFFER_ATTACHMENT_ANGLE - this texture will be attached to a 
+        framebuffer object and used as a desination for rendering or blits.&quot;
+
+    Modify section 3.7.12 (Texture State) and place the last 3 sentences
+    with the following:
+
+    &quot;Next, there are the three sets of texture properties; each consists of
+    the selected minification and magnification filters, the wrap modes for
+    &lt;s&gt; and &lt;t&gt;, and the usage flags. In the initial state, the value assigned
+    to TEXTURE_MIN_FILTER is NEAREST_MIPMAP_LINEAR, and the value for 
+    TEXTURE_MAG_FILTER is LINEAR. &lt;s&gt; and &lt;t&gt; wrap modes are both set to
+    REPEAT. The initial value for TEXTURE_USAGE_ANGLE is NONE.&quot;
+
+
+Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+    None
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special
+Functions):
+
+    None
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and
+State Requests)
+
+    None
+
+Dependencies on EXT_texture_storage
+
+    If EXT_texture_storage is not supported, omit any references to 
+    TexStorage2DEXT.
+
+Errors
+
+    If TexParameter{if} or TexParamter{if}v is called with a &lt;pname&gt;
+    of TEXTURE_USAGE_ANGLE and the value of &lt;param&gt; or &lt;params&gt; is not
+    NONE or FRAMEBUFFER_ATTACHMENT_ANGLE the error INVALID_VALUE is
+    generated.
+
+Usage Example
+
+    /* create and bind texture */
+    glGenTextures(1, &amp;texture);
+    glActiveTexture(GL_TEXTURE0);
+    glBindTexture(GL_TEXTURE_2D, texture);
+
+    /* specify texture parameters */
+    glTexParameteri(GL_TEXTURE_2D, GL_*, ...);  /* as before */
+    
+    /* specify that we'll be rendering to the texture */
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+
+    glTexStorage2DEXT(GL_TEXTURE_2D, levels, ...); // Allocation
+    for(int level = 0; level &lt; levels; ++level)
+        glTexSubImage2D(GL_TEXTURE_2D, level, ...); // Initialisation
+
+Issues
+
+    1. Should there be a dynamic usage value?
+   
+       DISCUSSION: We could accept a dynamic flag to indicate that a texture will
+       be updated frequently. We could map this to D3D9 dynamic textures. This would
+       allow us to avoid creating temporary surfaces when updating the texture.
+       However renderable textures cannot be dynamic in D3D9, which eliminates the 
+       primary use case for this.  Furthermore, the memory usage of dynamic textures
+       typically increases threefold when you lock it.
+
+    2. Should the texture usage be an enum or a bitfield?
+
+       UNRESOLVED.  Using a bitfield would allow combination of values to be specified.
+       On the other hand, if combinations are really required, additional &lt;pnames&gt;
+       could be added as necessary.  Querying a bitfield via the GetTexParameter command
+       feels a bit odd.
+
+    3. What should happen if TEXTURE_USAGE_ANGLE is set/changed after the texture
+       contents have been specified?
+
+       RESOLVED: It will have no effect. However, if the texture is redefined (for 
+       example by TexImage2D) the new allocation will use the updated usage.
+       GetTexParameter is used to query the value of the TEXTURE_USAGE_ANGLE
+       state that was last set by TexParameter for the currently bound texture, or
+       the default value if it has never been set. There is no way to determine the 
+       usage that was in effect at the time the texture was defined.
+
+Revision History
+
+    Rev.    Date      Author     Changes
+    ----  ----------- ---------  ----------------------------------------
+      1   10 Nov 2011 dgkoch     Initial revision
+      2   10 Nov 2011 dgkoch     Add overview
+   
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_timer_querytxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_timer_query.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_timer_query.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_timer_query.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,591 @@
</span><ins>+Name
+
+    ANGLE_timer_query
+
+Name Strings
+
+    GL_ANGLE_timer_query
+
+Contributors
+
+    Contributors to ARB_occlusion_query
+    Contributors to EXT_timer_query
+    Contributors to ARB_timer_query
+    Ben Vanik, Google Inc.
+    Daniel Koch, TransGaming Inc.
+
+Contact
+
+    Ben Vanik, Google Inc. (benvanik 'at' google 'dot' com)
+
+Status
+
+    Draft
+
+Version
+
+    Last Modified Date: Apr 28, 2011
+    Author Revision: 1
+
+Number
+
+    OpenGL ES Extension #??
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+
+    The extension is written against the OpenGL ES 2.0 specification.
+
+Overview
+
+    Applications can benefit from accurate timing information in a number of
+    different ways.  During application development, timing information can
+    help identify application or driver bottlenecks.  At run time,
+    applications can use timing information to dynamically adjust the amount
+    of detail in a scene to achieve constant frame rates.  OpenGL
+    implementations have historically provided little to no useful timing
+    information.  Applications can get some idea of timing by reading timers
+    on the CPU, but these timers are not synchronized with the graphics
+    rendering pipeline.  Reading a CPU timer does not guarantee the completion
+    of a potentially large amount of graphics work accumulated before the
+    timer is read, and will thus produce wildly inaccurate results.
+    glFinish() can be used to determine when previous rendering commands have
+    been completed, but will idle the graphics pipeline and adversely affect
+    application performance.
+
+    This extension provides a query mechanism that can be used to determine
+    the amount of time it takes to fully complete a set of GL commands, and
+    without stalling the rendering pipeline.  It uses the query object
+    mechanisms first introduced in the occlusion query extension, which allow
+    time intervals to be polled asynchronously by the application.
+
+IP Status
+
+    No known IP claims.
+
+New Procedures and Functions
+
+    void GenQueriesANGLE(sizei n, uint *ids);
+    void DeleteQueriesANGLE(sizei n, const uint *ids);
+    boolean IsQueryANGLE(uint id);
+    void BeginQueryANGLE(enum target, uint id);
+    void EndQueryANGLE(enum target);
+    void QueryCounterANGLE(uint id, enum target);
+    void GetQueryivANGLE(enum target, enum pname, int *params);
+    void GetQueryObjectivANGLE(uint id, enum pname, int *params);
+    void GetQueryObjectuivANGLE(uint id, enum pname, uint *params);
+    void GetQueryObjecti64vANGLE(uint id, enum pname, int64 *params);
+    void GetQueryObjectui64vANGLE(uint id, enum pname, uint64 *params);
+
+New Tokens
+
+    Accepted by the &lt;pname&gt; parameter of GetQueryivANGLE:
+
+        QUERY_COUNTER_BITS_ANGLE                       0x8864
+        CURRENT_QUERY_ANGLE                            0x8865
+
+    Accepted by the &lt;pname&gt; parameter of GetQueryObjectivANGLE,
+    GetQueryObjectuivANGLE, GetQueryObjecti64vANGLE, and
+    GetQueryObjectui64vANGLE:
+
+        QUERY_RESULT_ANGLE                             0x8866
+        QUERY_RESULT_AVAILABLE_ANGLE                   0x8867
+        
+    Accepted by the &lt;target&gt; parameter of BeginQueryANGLE, EndQueryANGLE, and
+    GetQueryivANGLE:
+
+        TIME_ELAPSED_ANGLE                             0x88BF
+
+    Accepted by the &lt;target&gt; parameter of GetQueryivANGLE and
+    QueryCounterANGLE:
+
+        TIMESTAMP_ANGLE                                0x8E28
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
+
+    (Modify table 2.1, Correspondence of command suffix letters to GL argument)
+    Add two new types:
+    
+    Letter Corresponding GL Type
+    ------ ---------------------
+    i64    int64ANGLE
+    ui64   uint64ANGLE
+
+    (Modify table 2.2, GL data types) Add two new types:
+    
+    GL Type       Minimum Bit Width   Description
+    -------       -----------------   -----------------------------
+    int64ANGLE    64                  Signed 2's complement integer
+    uint64ANGLE   64                  Unsigned binary integer
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
+
+    Add a new section 5.3 &quot;Timer Queries&quot;:
+
+    &quot;5.3  Timer Queries
+
+    Timer queries use query objects to track the amount of time needed to
+    fully complete a set of GL commands, or to determine the current time
+    of the GL.
+    
+    Timer queries are associated with query objects.  The command
+
+      void GenQueriesANGLE(sizei n, uint *ids);
+
+    returns &lt;n&gt; previously unused query object names in &lt;ids&gt;.  These
+    names are marked as used, but no object is associated with them until
+    the first time they are used by BeginQueryANGLE.  Query objects contain
+    one piece of state, an integer result value.  This result value is
+    initialized to zero when the object is created.  Any positive integer
+    except for zero (which is reserved for the GL) is a valid query
+    object name.
+
+    Query objects are deleted by calling
+
+      void DeleteQueriesANGLE(sizei n, const uint *ids);
+
+    &lt;ids&gt; contains &lt;n&gt; names of query objects to be deleted.  After a
+    query object is deleted, its name is again unused.  Unused names in
+    &lt;ids&gt; are silently ignored.
+    If an active query object is deleted its name immediately becomes unused,
+    but the underlying object is not deleted until it is no longer active.
+
+    A timer query can be started and finished by calling
+
+      void BeginQueryANGLE(enum target, uint id);
+      void EndQueryANGLE(enum target);
+
+    where &lt;target&gt; is TIME_ELAPSED_ANGLE.  If BeginQueryANGLE is called
+    with an unused &lt;id&gt;, that name is marked as used and associated with
+    a new query object.
+    
+    If BeginQueryANGLE is called with an &lt;id&gt; of zero, if the active query
+    object name for &lt;target&gt; is non-zero, if &lt;id&gt; is the name of an existing
+    query object whose type does not match &lt;target&gt;, or if &lt;id&gt; is the active
+    query object name for any query type, the error INVALID_OPERATION is
+    generated.  If EndQueryANGLE is called while no query with the same target
+    is in progress, an INVALID_OPERATION error is generated.
+
+    When BeginQueryANGLE and EndQueryANGLE are called with a &lt;target&gt; of
+    TIME_ELAPSED_ANGLE, the GL prepares to start and stop the timer used for
+    timer queries.  The timer is started or stopped when the effects from all
+    previous commands on the GL client and server state and the framebuffer
+    have been fully realized.  The BeginQueryANGLE and EndQueryANGLE commands
+    may return before the timer is actually started or stopped.  When the timer
+    query timer is finally stopped, the elapsed time (in nanoseconds) is
+    written to the corresponding query object as the query result value, and
+    the query result for that object is marked as available.
+
+    If the elapsed time overflows the number of bits, &lt;n&gt;, available to hold
+    elapsed time, its value becomes undefined.  It is recommended, but not
+    required, that implementations handle this overflow case by saturating at
+    2^n - 1.
+
+    The necessary state is a single bit indicating whether an timer
+    query is active, the identifier of the currently active timer
+    query, and a counter keeping track of the time that has passed.
+
+    When the command
+
+         void QueryCounterANGLE(uint id, enum target);
+
+    is called with &lt;target&gt; TIMESTAMP_ANGLE, the GL records the current time
+    into the corresponding query object. The time is recorded after all
+    previous commands on the GL client and server state and the framebuffer
+    have been fully realized. When the time is recorded, the query result for
+    that object is marked available. QueryCounterANGLE timer queries can be
+    used within a BeginQueryANGLE / EndQueryANGLE block where the &lt;target&gt; is
+    TIME_ELAPSED_ANGLE and it does not affect the result of that query object.
+    The error INVALID_OPERATION is generated if the &lt;id&gt; is already in use
+    within a BeginQueryANGLE/EndQueryANGLE block.&quot;
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    Add a new section 6.1.9 &quot;Timer Queries&quot;:
+
+    &quot;The command
+
+      boolean IsQueryANGLE(uint id);
+
+    returns TRUE if &lt;id&gt; is the name of a query object.  If &lt;id&gt; is zero,
+    or if &lt;id&gt; is a non-zero value that is not the name of a query
+    object, IsQueryANGLE returns FALSE.
+
+    Information about a query target can be queried with the command
+
+      void GetQueryivANGLE(enum target, enum pname, int *params);
+
+    &lt;target&gt; identifies the query target and can be TIME_ELAPSED_ANGLE or
+    TIMESTAMP_ANGLE for timer queries.
+
+    If &lt;pname&gt; is CURRENT_QUERY_ANGLE, the name of the currently active query
+    for &lt;target&gt;, or zero if no query is active, will be placed in &lt;params&gt;.
+
+    If &lt;pname&gt; is QUERY_COUNTER_BITS_ANGLE, the implementation-dependent number
+    of bits used to hold the query result for &lt;target&gt; will be placed in
+    &lt;params&gt;.  The number of query counter bits may be zero, in which case
+    the counter contains no useful information.
+
+    For timer queries (TIME_ELAPSED_ANGLE and TIMESTAMP_ANGLE), if the number
+    of bits is non-zero, the minimum number of bits allowed is 30 which
+    will allow at least 1 second of timing.
+
+    The state of a query object can be queried with the commands
+
+      void GetQueryObjectivANGLE(uint id, enum pname, int *params);
+      void GetQueryObjectuivANGLE(uint id, enum pname, uint *params);
+      void GetQueryObjecti64vANGLE(uint id, enum pname, int64 *params);
+      void GetQueryObjectui64vANGLE(uint id, enum pname, uint64 *params);
+
+    If &lt;id&gt; is not the name of a query object, or if the query object
+    named by &lt;id&gt; is currently active, then an INVALID_OPERATION error is
+    generated.
+
+    If &lt;pname&gt; is QUERY_RESULT_ANGLE, then the query object's result
+    value is returned as a single integer in &lt;params&gt;. If the value is so
+    large in magnitude that it cannot be represented with the requested type,
+    then the nearest value representable using the requested type is
+    returned. If the number of query counter bits for target is zero, then
+    the result is returned as a single integer with the value zero.
+    
+    There may be an indeterminate delay before the above query returns. If
+    &lt;pname&gt; is QUERY_RESULT_AVAILABLE_ANGLE, FALSE is returned if such a delay
+    would be required; otherwise TRUE is returned. It must always be true
+    that if any query object returns a result available of TRUE, all queries
+    of the same type issued prior to that query must also return TRUE.
+
+    Querying the state for a given timer query forces that timer query to
+    complete within a finite amount of time.
+
+    If multiple queries are issued on the same target and id prior to 
+    calling GetQueryObject[u]i[64]vANGLE, the result returned will always be
+    from the last query issued.  The results from any queries before the
+    last one will be lost if the results are not retrieved before starting
+    a new query on the same &lt;target&gt; and &lt;id&gt;.&quot;
+
+Errors
+
+    The error INVALID_VALUE is generated if GenQueriesANGLE is called where
+    &lt;n&gt; is negative.
+
+    The error INVALID_VALUE is generated if DeleteQueriesANGLE is called
+    where &lt;n&gt; is negative.
+
+    The error INVALID_OPERATION is generated if BeginQueryANGLE is called
+    when a query of the given &lt;target&gt; is already active.
+
+    The error INVALID_OPERATION is generated if EndQueryANGLE is called
+    when a query of the given &lt;target&gt; is not active.
+
+    The error INVALID_OPERATION is generated if BeginQueryANGLE is called
+    where &lt;id&gt; is zero.
+
+    The error INVALID_OPERATION is generated if BeginQueryANGLE is called
+    where &lt;id&gt; is the name of a query currently in progress.
+    
+    The error INVALID_OPERATION is generated if BeginQueryANGLE is called
+    where &lt;id&gt; is the name of an existing query object whose type does not
+    match &lt;target&gt;.
+
+    The error INVALID_ENUM is generated if BeginQueryANGLE or EndQueryANGLE
+    is called where &lt;target&gt; is not TIME_ELAPSED_ANGLE.
+
+    The error INVALID_ENUM is generated if GetQueryivANGLE is called where
+    &lt;target&gt; is not TIME_ELAPSED_ANGLE or TIMESTAMP_ANGLE.
+
+    The error INVALID_ENUM is generated if GetQueryivANGLE is called where
+    &lt;pname&gt; is not QUERY_COUNTER_BITS_ANGLE or CURRENT_QUERY_ANGLE.
+
+    The error INVALID_ENUM is generated if QueryCounterANGLE is called where
+    &lt;target&gt; is not TIMESTAMP_ANGLE.
+
+    The error INVALID_OPERATION is generated if QueryCounterANGLE is called
+    on a query object that is already in use inside a
+    BeginQueryANGLE/EndQueryANGLE.
+
+    The error INVALID_OPERATION is generated if GetQueryObjectivANGLE,
+    GetQueryObjectuivANGLE, GetQueryObjecti64vANGLE, or
+    GetQueryObjectui64vANGLE is called where &lt;id&gt; is not the name of a query
+    object.
+
+    The error INVALID_OPERATION is generated if GetQueryObjectivANGLE,
+    GetQueryObjectuivANGLE, GetQueryObjecti64vANGLE, or
+    GetQueryObjectui64vANGLE is called where &lt;id&gt; is the name of a currently
+    active query object.
+
+    The error INVALID_ENUM is generated if GetQueryObjectivANGLE,
+    GetQueryObjectuivANGLE, GetQueryObjecti64vANGLE, or
+    GetQueryObjectui64vANGLE is called where &lt;pname&gt; is not
+    QUERY_RESULT_ANGLE or QUERY_RESULT_AVAILABLE_ANGLE.
+
+New State
+
+    (Add a new table 6.xx, &quot;Query Operations&quot;)
+    
+    Get Value                      Type    Get Command              Initial Value   Description              Sec
+    ---------                      ----    -----------              -------------   -----------              ------
+    -                              B       -                        FALSE           query active             5.3
+    CURRENT_QUERY_ANGLE            Z+      GetQueryivANGLE          0               active query ID          5.3
+    QUERY_RESULT_ANGLE             Z+      GetQueryObjectuivANGLE,  0               samples-passed count     5.3
+                                           GetQueryObjectui64vANGLE
+    QUERY_RESULT_AVAILABLE_ANGLE   B       GetQueryObjectivANGLE    FALSE           query result available   5.3
+
+New Implementation Dependent State
+
+    (Add the following entry to table 6.18):
+
+    Get Value                      Type    Get Command      Minimum Value      Description           Sec
+    --------------------------     ----    -----------      -------------      ----------------      ------
+    QUERY_COUNTER_BITS_ANGLE       Z+      GetQueryivANGLE  see 6.1.9          Number of bits in     6.1.9
+                                                                               query counter
+
+Examples
+
+    (1) Here is some rough sample code that demonstrates the intended usage
+        of this extension.
+
+        GLint queries[N];
+        GLint available = 0;
+        // timer queries can contain more than 32 bits of data, so always
+        // query them using the 64 bit types to avoid overflow
+        GLuint64ANGLE timeElapsed = 0;
+
+        // Create a query object.
+        glGenQueriesANGLE(N, queries);
+
+        // Start query 1
+        glBeginQueryANGLE(GL_TIME_ELAPSED_ANGLE, queries[0]);
+
+        // Draw object 1
+        ....
+
+        // End query 1
+        glEndQueryANGLE(GL_TIME_ELAPSED_ANGLE);
+
+        ...
+
+        // Start query N
+        glBeginQueryANGLE(GL_TIME_ELAPSED_ANGLE, queries[N-1]);
+
+        // Draw object N
+        ....
+
+        // End query N
+        glEndQueryANGLE(GL_TIME_ELAPSED_ANGLE);
+
+        // Wait for all results to become available
+        while (!available) {
+            glGetQueryObjectivANGLE(queries[N-1], GL_QUERY_RESULT_AVAILABLE_ANGLE, &amp;available);
+        }
+
+        for (i = 0; i &lt; N; i++) {
+            // See how much time the rendering of object i took in nanoseconds.
+            glGetQueryObjectui64vANGLE(queries[i], GL_QUERY_RESULT_ANGLE, &amp;timeElapsed);
+
+            // Do something useful with the time.  Note that care should be
+            // taken to use all significant bits of the result, not just the
+            // least significant 32 bits.
+            AdjustObjectLODBasedOnDrawTime(i, timeElapsed);
+        }
+
+        This example is sub-optimal in that it stalls at the end of every
+        frame to wait for query results.  Ideally, the collection of results
+        would be delayed one frame to minimize the amount of time spent
+        waiting for the GPU to finish rendering.
+        
+    (2) This example is basically the same as the example above but uses
+        QueryCounter instead.
+    
+        GLint queries[N+1];
+        GLint available = 0;
+        // timer queries can contain more than 32 bits of data, so always
+        // query them using the 64 bit types to avoid overflow
+        GLuint64ANGLE timeStart, timeEnd, timeElapsed = 0;
+
+        // Create a query object.
+        glGenQueriesANGLE(N+1, queries);
+
+        // Query current timestamp 1
+        glQueryCounterANGLE(queries[0], GL_TIMESTAMP_ANGLE);
+
+        // Draw object 1
+        ....
+
+        // Query current timestamp N
+        glQueryCounterANGLE(queries[N-1], GL_TIMESTAMP_ANGLE);
+
+        // Draw object N
+        ....
+
+        // Query current timestamp N+1
+        glQueryCounterANGLE(queries[N], GL_TIMESTAMP_ANGLE);
+
+        // Wait for all results to become available
+        while (!available) {
+            glGetQueryObjectivANGLE(queries[N], GL_QUERY_RESULT_AVAILABLE_ANGLE, &amp;available);
+        }
+
+        for (i = 0; i &lt; N; i++) {
+            // See how much time the rendering of object i took in nanoseconds.
+            glGetQueryObjectui64vANGLE(queries[i], GL_QUERY_RESULT_ANGLE, &amp;timeStart);
+            glGetQueryObjectui64vANGLE(queries[i+1], GL_QUERY_RESULT_ANGLE, &amp;timeEnd);
+            timeElapsed = timeEnd - timeStart;
+
+            // Do something useful with the time.  Note that care should be
+            // taken to use all significant bits of the result, not just the
+            // least significant 32 bits.
+            AdjustObjectLODBasedOnDrawTime(i, timeElapsed);
+        }
+
+Issues from EXT_timer_query
+
+    (1) What time interval is being measured?
+
+    RESOLVED:  The timer starts when all commands prior to BeginQuery() have
+    been fully executed.  At that point, everything that should be drawn by
+    those commands has been written to the framebuffer.  The timer stops
+    when all commands prior to EndQuery() have been fully executed.
+
+    (2) What unit of time will time intervals be returned in?
+
+    RESOLVED:  Nanoseconds (10^-9 seconds).  This unit of measurement allows
+    for reasonably accurate timing of even small blocks of rendering
+    commands.  The granularity of the timer is implementation-dependent.  A
+    32-bit query counter can express intervals of up to approximately 4
+    seconds.
+
+    (3) What should be the minimum number of counter bits for timer queries?
+
+    RESOLVED:  30 bits, which will allow timing sections that take up to 1
+    second to render.
+
+    (4) How are counter results of more than 32 bits returned?
+
+    RESOLVED:  Via two new datatypes, int64ANGLE and uint64ANGLE, and their
+    corresponding GetQueryObject entry points.  These types hold integer
+    values and have a minimum bit width of 64.
+
+    (5) Should the extension measure total time elapsed between the full
+        completion of the BeginQuery and EndQuery commands, or just time
+        spent in the graphics library?
+
+    RESOLVED:  This extension will measure the total time elapsed between
+    the full completion of these commands.  Future extensions may implement
+    a query to determine time elapsed at different stages of the graphics
+    pipeline.
+
+    (6) If multiple query types are supported, can multiple query types be
+        active simultaneously?
+
+    RESOLVED:  Yes; an application may perform a timer query and another
+    type of query simultaneously.  An application can not perform multiple
+    timer queries or multiple queries of other types simultaneously.  An
+    application also can not use the same query object for another query
+    and a timer query simultaneously.
+
+    (7) Do query objects have a query type permanently associated with them?
+
+    RESOLVED:  No.  A single query object can be used to perform different
+    types of queries, but not at the same time.
+
+    Having a fixed type for each query object simplifies some aspects of the
+    implementation -- not having to deal with queries with different result
+    sizes, for example.  It would also mean that BeginQuery() with a query
+    object of the &quot;wrong&quot; type would result in an INVALID_OPERATION error.
+
+    UPDATE: This resolution was relevant for EXT_timer_query and OpenGL 2.0.
+    Since EXT_transform_feedback has since been incorporated into the core,
+    the resolution is that BeginQuery will generate error INVALID_OPERATION
+    if &lt;id&gt; represents a query object of a different type.
+
+    (8) How predictable/repeatable are the results returned by the timer
+        query?
+
+    RESOLVED:  In general, the amount of time needed to render the same
+    primitives should be fairly constant.  But there may be many other
+    system issues (e.g., context switching on the CPU and GPU, virtual
+    memory page faults, memory cache behavior on the CPU and GPU) that can
+    cause times to vary wildly.
+
+    Note that modern GPUs are generally highly pipelined, and may be
+    processing different primitives in different pipeline stages
+    simultaneously.  In this extension, the timers start and stop when the
+    BeginQuery/EndQuery commands reach the bottom of the rendering pipeline.
+    What that means is that by the time the timer starts, the GL driver on
+    the CPU may have started work on GL commands issued after BeginQuery,
+    and the higher pipeline stages (e.g., vertex transformation) may have
+    started as well.
+
+   (9) What should the new 64 bit integer type be called?
+
+    RESOLVED: The new types will be called GLint64ANGLE/GLuint64ANGLE.  The new
+    command suffixes will be i64 and ui64.  These names clearly convey the
+    minimum size of the types.  These types are similar to the C99 standard
+    type int_least64_t, but we use names similar to the C99 optional type
+    int64_t for simplicity.
+
+Issues from ARB_timer_query
+
+   (10) What about tile-based implementations? The effects of a command are
+        not complete until the frame is completely rendered. Timing recorded
+        before the frame is complete may not be what developers expect. Also
+        the amount of time needed to render the same primitives is not
+        consistent, which conflicts with issue (8) above. The time depends on
+        how early or late in the scene it is placed.
+
+    RESOLVED: The current language supports tile-based rendering okay as it
+    is written. Developers are warned that using timers on tile-based
+    implementation may not produce results they expect since rendering is not
+    done in a linear order. Timing results are calculated when the frame is
+    completed and may depend on how early or late in the scene it is placed.
+    
+   (11) Can the GL implementation use different clocks to implement the
+        TIME_ELAPSED and TIMESTAMP queries?
+
+   RESOLVED: Yes, the implemenation can use different internal clocks to
+   implement TIME_ELAPSED and TIMESTAMP. If different clocks are
+   used it is possible there is a slight discrepancy when comparing queries
+   made from TIME_ELAPSED and TIMESTAMP; they may have slight
+   differences when both are used to measure the same sequence. However, this
+   is unlikely to affect real applications since comparing the two queries is
+   not expected to be useful.
+
+Issues
+
+    (12) What should we call this extension?
+
+    RESOLVED: ANGLE_timer_query
+
+    (13) Why is this done as a separate extension instead of just supporting
+         ARB_timer_query?
+
+    ARB_timer_query is written against OpenGL 3.2, which includes a lot of
+    the required support for dealing with query objects. None of these
+    functions or tokens exist in OpenGL ES, and as such have to be added in
+    this specification.
+
+    (14) How does this extension differ from ARB_timer_query?
+
+    This extension contains most ARB_timer_query behavior unchanged as well
+    as a subset of the query support required to use it from the core
+    OpenGL 3.2 spec. It omits the glGetInteger(TIMESTAMP) functionality used to
+    query the current time on the GPU, but the behavior for all remaining
+    functionality taken from ARB_timer_query is the same.
+    
+    (15) Are query objects shareable between multiple contexts?
+
+    RESOLVED: No.  Query objects are lightweight and we normally share 
+    large data across contexts.  Also, being able to share query objects
+    across contexts is not particularly useful.  In order to do the async 
+    query across contexts, a query on one context would have to be finished 
+    before the other context could query it. 
+
+Revision History
+
+    Revision 1, 2011/04/28
+      - copied from revision 9 of ARB_timer_query and revision 7 of
+        ARB_occlusion_query
+      - removed language that was clearly not relevant to ES2
+      - rebased changes against the OpenGL ES 2.0 specification
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsANGLE_translated_shader_sourcetxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_translated_shader_source.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_translated_shader_source.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/ANGLE_translated_shader_source.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,118 @@
</span><ins>+Name
+
+    ANGLE_translated_shader_source
+
+Name Strings
+
+    GL_ANGLE_translated_shader_source
+
+Contributors
+
+    Daniel Koch, TransGaming Inc.
+    Gregg Tavares, Google Inc.
+    Kenneth Russell, Google Inc.
+    Zhenyao Mo, Google Inc.
+
+Contact
+
+    Zhenyao Mo, Google Inc. (zmo 'at' google 'dot' com)
+
+Status
+
+    Implemented in ANGLE ES2
+
+Version
+
+    Last Modified Date: October 5, 2011
+    Author Revision: 2
+
+Number
+
+    OpenGL ES Extension #113
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+
+    The extension is written against the OpenGL ES 2.0 specification.
+
+Overview
+
+    WebGL uses the GLSL ES 2.0 spec on all platforms, and translates these
+    shaders to the host platform's native language (HLSL, GLSL, and even GLSL
+    ES). For debugging purposes, it is useful to be able to examine the shader
+    after translation.
+
+    This extension addes a new function to query the translated shader source,
+    and adds a new enum for GetShaderiv's &lt;pname&gt; parameter to query the
+    translated shader source length. 
+
+IP Status
+
+    No known IP claims.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    void GetTranslatedShaderSourceANGLE(uint shader, sizei bufsize,
+                                        sizei* length, char* source);
+
+New Tokens
+
+    Accepted by the &lt;pname&gt; parameter of GetShaderiv:
+
+    TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE              0x93A0
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    Append in the end of the fourth paragraph of section 6.1.8 (Shader and
+    Program Queries):
+
+    &quot; If &lt;pname&gt; is TRANSLATED_SHADER_LENGTH_ANGLE, the length of the translated
+    source string, including a null terminator, is returned. If no source has
+    been defined, CompileShader has not been called, or the translation has
+    failed for &lt;shader&gt;, zero is returned.&quot;
+
+    Append after the last paragraph of section 6.1.8 (Shader and Program
+    Queries):
+
+    &quot;The command
+
+      void GetTranslatedShaderSourceANGLE( uint shader, sizei bufSize,
+         sizei *length, char *source );
+
+    returns in &lt;source&gt; the string making up the translated source code for
+    the shader object &lt;shader&gt;. The string &lt;source&gt; will be null terminated.
+    The actual number of characters written into &lt;source&gt;, excluding the null
+    terminator, is returned in &lt;length&gt;. If &lt;length&gt; is NULL, no length is
+    returned. The maximum number of characters that may be written into 
+    &lt;source&gt;, including the null terminator, is specified by &lt;bufSize&gt;. The
+    string &lt;source&gt; is the translated string of a concatenation of the strings
+    passed to the GL using ShaderSource. The length of this translated string
+    is given by TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, which can be queried
+    with GetShaderiv.
+
+    If no source has been defined, CompileShader has not been called, or the
+    translation has failed for &lt;shader&gt;, zero is returned for &lt;length&gt;, and
+    an empty string is returned for &lt;source&gt;.
+
+    If the value of SHADER_COMPILER is not TRUE, then the error INVALID_-
+    OPERATION is generated.&quot;
+
+Issues
+
+    1) What enum value should be used for TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE?
+
+      RESOLVED: The first draft used a temporary enum value. This been replaced
+      with a enum allocated from the ANGLE range of GL enums. 
+
+Revision History
+
+    Revision 1, 2011/09/29, zmo
+      - first draft
+    Revision 2, 2011/10/05, dgkoch
+      - assigned enum
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_d3d_share_handle_client_buffertxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_d3d_share_handle_client_buffer.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_d3d_share_handle_client_buffer.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_d3d_share_handle_client_buffer.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+Name
+
+    ANGLE_d3d_share_handle_client_buffer
+
+Name Strings
+
+    EGL_ANGLE_d3d_share_handle_client_buffer
+
+Contributors
+
+    John Bauman
+    Alastair Patrick
+    Daniel Koch
+
+Contacts
+
+    John Bauman, Google Inc. (jbauman 'at' chromium.org)
+
+Status
+
+    Complete
+    Implemented (ANGLE r650)
+
+Version
+
+    Version 3, May 12, 2011
+
+Number
+
+    EGL Extension #??
+
+Dependencies
+
+    Requires the EGL_ANGLE_surface_d3d_texture_2d_share_handle extension.
+
+    This extension is written against the wording of the EGL 1.4
+    Specification.
+
+Overview
+
+    This extension allows creating EGL surfaces from handles to textures
+    shared from the Direct3D API or from
+    EGL_ANGLE_surface_texture_2d_share_handle.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted in the &lt;buftype&gt; parameter of eglCreatePbufferFromClientBuffer:
+
+        EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE            0x3200
+
+Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
+
+    Replace the last sentence of paragraph 1 of Section 3.5.3 with the
+    following text.
+    &quot;Currently, the only client API resources which may be bound in this
+    fashion are OpenVG VGImage objects and Direct3D share handles.&quot;
+
+    Replace the last sentence of paragraph 2 (&quot;To bind a client API...&quot;) of
+    Section 3.5.3 with the following text.
+    &quot;When &lt;buftype&gt; is EGL_OPENVG_IMAGE, the width and height of the pbuffer
+    are determined by the width and height of &lt;buffer&gt;. When &lt;buftype&gt; is
+    EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, the width and height are specified
+    using EGL_WIDTH and EGL_HEIGHT, or else they default to zero. The width
+    and height must match the dimensions of the texture which the share handle 
+    was created from or else an EGL_BAD_ALLOC error is generated.&quot;
+
+    Replace the third paragraph of Section 3.5.3 with the following text.
+    &quot;&lt;buftype&gt; specifies the type of buffer to be bound. The only allowed values
+    of &lt;buftype&gt; are EGL_OPENVG_IMAGE and
+    EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE&quot;.
+
+    Append the following text to the fourth paragraph of Section 3.5.3.
+    &quot;When &lt;buftype&gt; is EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE, &lt;buffer&gt; must be
+    a valid D3D share handle, cast into the type EGLClientBuffer. The handle
+    may be obtained from the Direct3D9Ex CreateTexture function, from DXGI's
+    GetSharedHandle method on an ID3D10Texture2D, or from the
+    EGL_ANGLE_surface_d3d_texture_2d_share_handle extension.&quot;
+
+Issues
+
+Revision History
+
+    Version 3, 2011/05/12
+      - publish
+
+    Version 2, 2011/05/03
+      - specify EGL_D3D_TEXTURE_2D_SHARE_HANDLE
+      - specify error if dimensions don't match
+
+    Version 1, 2011/04/12 - first draft.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_device_d3dtxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_device_d3d.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_device_d3d.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_device_d3d.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+Name
+
+    ANGLE_device_d3d
+
+Name Strings
+
+    EGL_ANGLE_device_d3d
+
+Contributors
+
+    Jamie Madill  (jmadill 'at' google.com)
+
+Contact
+
+    Jamie Madill  (jmadill 'at' google.com)
+
+Status
+
+    Draft
+
+Version
+
+    Version 1, Mar 25, 2015
+
+Number
+
+    EGL Extension #XXX
+
+Extension Type
+
+    EGL device extension
+
+Dependencies
+
+    This extension is written against the language of EGL 1.5 as
+    modified by EGL_EXT_device_query.
+
+    EGL_EXT_device_query is required.
+
+Overview
+
+    ANGLE has the ability to run GPU commands on a native D3D device.
+    This extension defines a mapping from an EGL device to a D3D
+    device, after it's queried from an EGL display.
+
+IP Status
+
+    No known claims.
+
+New Types
+
+    None.
+
+New Procedures and Functions
+
+    None.
+
+New Tokens
+
+    Accepted as a queried &lt;attribute&gt; in eglQueryDeviceAttribEXT:
+
+        EGL_D3D9_DEVICE_ANGLE              0x33A0
+        EGL_D3D11_DEVICE_ANGLE             0x33A1
+
+Add a new section 2.1.3 (D3D Devices) after 2.1.2 (Devices)
+
+    Somewhat analogous to an EGL device, a D3D device establishes a
+    namespace for D3D operations. In the D3D APIs, such devices are
+    represented by pointers. For more details, see the D3D
+    documentation.
+
+Changes to section 3.2 (Devices)
+
+    Replace the paragraph immediately following the prototype for
+    eglQueryDeviceAttribEXT:
+
+    &lt;attribute&gt; may be either EGL_D3D9_DEVICE_ANGLE or EGL_D3D11_DEVICE_ANGLE.
+    On success, EGL_TRUE is returned, and a valid D3D9 or D3D11 device pointer
+    corresponding to the EGL device is returned in &lt;value&gt;. This handle
+    is compatible with D3D API functions. If the EGL device is not currently
+    associated with a D3D9 device and &lt;attribute&gt; is EGL_D3D9_DEVICE_ANGLE,
+    or if the EGL device is not currently associated with a D3D11 device and
+    &lt;attribute&gt; is EGL_D3D11_DEVICE_ANGLE, EGL_BAD_ATTRIBUTE is returned,
+    and &lt;value&gt; is left unchanged.
+
+Issues
+
+    None
+
+Revision History
+
+    Version 1, Mar 25, 2015 (Jamie Madill)
+        - Initial Draft
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_direct3d_displaytxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_direct3d_display.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_direct3d_display.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_direct3d_display.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+Name
+
+    ANGLE_direct3d_display
+
+Name Strings
+
+    EGL_ANGLE_direct3d_display
+
+Contributors
+
+    Nicolas Capens
+    Shannon Woods
+
+Contacts
+
+    Shannon Woods, Google Inc. (shannonwoods 'at' chromium.org)
+
+Status
+
+    In progress
+
+Version
+
+    Version 1, May 15, 2013
+
+Number
+
+    EGL Extension #??
+
+Dependencies
+
+    This extension is written against the wording of the EGL 1.4
+    Specification. 
+
+Overview
+
+    This extension allows for specifying the behavior of the renderer backing the display.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE         (EGLNativeDisplayType)-2
+    EGL_D3D11_ONLY_DISPLAY_ANGLE              (EGLNativeDisplayType)-3
+
+Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
+
+    Add before the last sentence of the first paragraph of section 3.2,
+    &quot;Initialization&quot;:
+
+    &quot;If &lt;display_id&gt; is EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE, the display returned
+    will be backed by a Direct3D 11 renderer if one is available, or by a
+    Direct3D 9 renderer otherwise. If &lt;display_id&gt; is EGL_D3D11_ONLY_DISPLAY_ANGLE,
+    the display returned will be backed by a Direct3D 11 renderer if one is
+    available, or will return NULL otherwise.&quot;
+
+Issues
+
+Revision History
+
+    Version 1, 2013/05/15 - First draft.
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_query_surface_pointertxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_query_surface_pointer.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_query_surface_pointer.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_query_surface_pointer.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+Name
+
+    ANGLE_query_surface_pointer
+
+Name Strings
+
+    EGL_ANGLE_query_surface_pointer
+
+Contributors
+
+    Vladimir Vukicevic
+    Daniel Koch
+
+Contacts
+
+    Vladimir Vukicevic (vladimir 'at' pobox.com)
+
+Status
+
+    Complete
+    Implemented (ANGLE r558)
+
+Version
+
+    Version 3, February 11, 2011
+
+Number
+
+    EGL Extension #28
+
+Dependencies
+
+    This extension is written against the wording of the EGL 1.4
+    Specification. 
+
+Overview
+
+    This extension allows querying pointer-sized surface attributes,
+    thus avoiding problems with coercing 64-bit pointers into a 32-bit
+    integer.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    EGLBoolean eglQuerySurfacePointerANGLE(
+                        EGLDisplay dpy,
+                        EGLSurface surface,
+                        EGLint attribute,
+                        void **value);
+
+New Tokens
+
+    None
+
+Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
+
+    Add to the end of the paragraph starting with &quot;To query an
+    attribute associated with an EGLSurface&quot; in section 3.5.6,
+    &quot;Surface Attributes&quot;:
+
+    &quot;If the attribute type in table 3.5 is 'pointer', then
+    eglQuerySurface returns EGL_FALSE and an EGL_BAD_PARAMETER error
+    is generated.  To query pointer attributes, call:
+
+         EGLBoolean eglQuerySurfacePointerANGLE(
+                             EGLDisplay dpy,
+                             EGLSurface surface,
+                             EGLint attribute,
+                             void **value);
+
+     eglQuerySurfacePointerANGLE behaves identically to eglQuerySurface,
+     except that only attributes of type 'pointer' can be queried.
+     If an attribute queried via eglQuerySurfacePointerANGLE is not
+     of type 'pointer', then eglQuerySurfacePointer returns EGL_FALSE
+     and an EGL_BAD_PARAMETER error is generated.&quot;
+
+Issues
+
+Revision History
+
+    Version 3, 2011/02/11 - publish
+
+    Version 2, 2010/12/21 - fix typos.
+
+    Version 1, 2010/12/07 - first draft.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_robust_resource_initializationtxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_robust_resource_initialization.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_robust_resource_initialization.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_robust_resource_initialization.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+Name
+
+    EGL_ANGLE_robust_resource_initialization.txt
+
+Name Strings
+
+    EGL_ANGLE_robust_resource_intialization
+
+Contributors
+
+    Geoff Lang, Google
+    Ken Russell, Google
+
+Contacts
+
+    Shannon Woods, Google (shannonwoods 'at' google.com)
+
+Status
+
+    Draft
+
+Version
+
+    Version 1, January 7, 2015
+
+Number
+
+    EGL Extension TBD
+
+Dependencies
+
+    This extension is written against the wording of the EGL 1.5
+    specification.
+
+    An OpenGL ES implementation supporting ANGLE_robust_resource_initialization
+    or an implementation supporting equivalent functionality is required.
+
+Overview
+
+    This extension allows creating an OpenGL ES context supporting
+    robust resource initialization.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted as an attribute name in the &lt;*attrib_list&gt; argument to
+    eglCreateContext:
+
+        EGL_CONTEXT_OPENGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE    0x320F
+
+Additions to the EGL 1.5 Specification
+
+    Add a new section entitled &quot;OpenGL ES Robust Resource Initialization&quot;
+    to section 3.7.1:
+
+    &quot;If the attribute EGL_CONTEXT_OPENGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE
+    is set to EGL_TRUE, a context supporting &lt;robust resource initialization&gt;
+    will be created. OpenGL ES contexts must support the
+    ANGLE_robust_resource_initialization extension, or equivalent core API
+    functionality.
+    This attribute is supported only for OpenGL ES contexts. If the
+    implementation does not support robust resource initialization,
+    context creation will fail.
+    The default value of EGL_CONTEXT_OPENGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE
+    is EGL_FALSE.&quot;
+
+Issues
+
+    None
+
+Revision History
+
+    Version 1, 2015/01/07 - first draft.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_software_displaytxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_software_display.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_software_display.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_software_display.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+Name
+
+    ANGLE_software_display
+
+Name Strings
+
+    EGL_ANGLE_software_display
+
+Contributors
+
+    John Bauman
+    Daniel Koch
+
+Contacts
+
+    John Bauman, Google Inc. (jbauman 'at' chromium.org)
+
+Status
+
+    In progress
+
+Version
+
+    Version 2, October 19, 2011
+
+Number
+
+    EGL Extension #??
+
+Dependencies
+
+    This extension is written against the wording of the EGL 1.4
+    Specification. 
+
+Overview
+
+    This extension allows for receiving a device that uses software rendering.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    EGL_SOFTWARE_DISPLAY_ANGLE         (EGLNativeDisplayType)-1
+
+Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
+
+    Add before the last sentence of the first paragraph of section 3.2,
+    &quot;Initialization&quot;:
+
+    &quot;If &lt;display_id&gt; is EGL_SOFTWARE_DISPLAY_ANGLE, a display that will render
+    everything in software will be returned.&quot;
+
+Issues
+
+Revision History
+
+    Version 1, 2011/07/12 - first draft.
+    Version 2, 2011/10/18 - add token definition
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_surface_d3d_texture_2d_share_handletxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_surface_d3d_texture_2d_share_handle.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+Name
+
+    ANGLE_surface_d3d_texture_2d_share_handle
+
+Name Strings
+
+    EGL_ANGLE_surface_d3d_texture_2d_share_handle
+
+Contributors
+
+    Vladimir Vukicevic
+    Daniel Koch
+
+Contacts
+
+    Vladimir Vukicevic (vladimir 'at' pobox.com)
+
+Status
+
+    Complete
+    Implemented (ANGLE r558)
+
+Version
+
+    Version 2, December 21, 2010
+
+Number
+
+    EGL Extension #29
+
+Dependencies
+
+    Requires the EGL_ANGLE_query_surface_pointer extension.
+
+    This extension is written against the wording of the EGL 1.4
+    Specification.
+
+Overview
+
+    Some EGL implementations generate EGLSurface handles that are
+    backed by Direct3D 2D textures.  For such surfaces, a D3D share
+    handle can be generated, allowing access to the same surface
+    from the Direct3D API.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted in the &lt;attribute&gt; parameter of eglQuerySurfacePointerANGLE:
+
+        EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE            0x3200
+
+Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
+
+    Add to table 3.5, &quot;Queryable surface attributes and types&quot;:
+
+        Attribute                              Type      Description
+        ---------                              ----      -----------
+        EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE  pointer   Direct3D share handle
+
+    Add before the last paragraph in section 3.5, &quot;Surface attributes&quot;:
+
+   &quot;Querying EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE returns a Direct3D
+    share handle, or NULL if a share handle for the surface is not
+    available.  The share handle must be queried using
+    eglQuerySurfaceAttribPointerANGLE.  Before using a Direct3D surface
+    created with this share handle, ensure that all rendering
+    to the EGLSurface with EGL client APIs has completed.
+
+    The Direct3D share handle may be passed as the pSharedHandle
+    parameter of the Direct3D9Ex CreateTexture function, or via the
+    Direct3D10 OpenSharedResource function.  If used with Direct3D 9,
+    the level argument to CreateTexture must be 1, and the dimensions
+    must match the dimensions of the EGL surface.  If used with
+    Direct3D 10, OpenSharedResource should be called with the
+    ID3D10Texture2D uuid to obtain an ID3D10Texture2D object.
+
+Issues
+
+Revision History
+
+    Version 3, 2011/02/11 - publish
+
+    Version 2, 2010/12/21
+      - renamed token to EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE (adding &quot;2D&quot;)
+      - renamed extension to ANGLE_surface_d3d_texture_2d_share_handle
+      - added language about supported usage of the shared handle from D3D
+
+    Version 1, 2010/12/07 - first draft.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_ANGLE_window_fixed_sizetxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_window_fixed_size.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_window_fixed_size.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_ANGLE_window_fixed_size.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,136 @@
</span><ins>+Name
+
+    ANGLE_window_fixed_size
+
+Name Strings
+
+    EGL_ANGLE_window_fixed_size
+
+Contributors
+
+    John Bauman
+    Shannon Woods
+
+Contacts
+
+    John Bauman, Google Inc. (jbauman 'at' google.com)
+
+Status
+
+    Complete
+
+Version
+
+    Version 4, February 24, 2014
+
+Number
+
+    EGL Extension #??
+
+Dependencies
+
+    This extension is written against the wording of the EGL 1.4
+    Specification.
+
+Overview
+
+    This extension allows creating a window surface with a fixed size that is
+    specified when it is created.
+
+New Types
+
+    None
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted by the &lt;attribute&gt; parameter of eglQuerySurface and by the
+    &lt;attrib_list&gt; parameter of eglCreateWindowSurface:
+
+    EGL_FIXED_SIZE_ANGLE        0x3201
+
+Additions to Chapter 3 of the EGL 1.4 Specification:
+
+    Modify the third paragraph of Section 3.5.1 (Creating On-Screen Rendering Surfaces)
+
+    &quot;&lt;attrib_list&gt; specifies a list of attributes for the window. The list has
+    the same structure as described for eglChooseConfig.  Attributes that can
+    be specified in &lt;attrib_list&gt; include EGL_RENDER_BUFFER,
+    EGL_VG_COLORSPACE, EGL_VG_ALPHA_FORMAT, EGL_FIXED_SIZE_ANGLE, EGL_WIDTH,
+    and EGL_HEIGHT.&quot;
+
+    Add before the last paragraph of Section 3.5.1
+
+    &quot;EGL_FIXED_SIZE_ANGLE specifies whether the surface must be resized by the
+    implementation when the native window is resized.  The default value is
+    EGL_FALSE.  Its value can be EGL_TRUE, in which case the size must be
+    specified when the window is created, or EGL_FALSE, in which case the size
+    is taken from the native window. Its default value is EGL_FALSE.
+
+    If the value of EGL_FIXED_SIZE_ANGLE is EGL_TRUE, the window surface's
+    size in pixels is specified by the EGL_WIDTH and EGL_HEIGHT attributes,
+    and will not change throughout the lifetime of the surface. If its value
+    is EGL_FALSE, then the values of EGL_WIDTH and EGL_HEIGHT are ignored and
+    the window surface must be resized by the implementation subsequent to the
+    native window being resized, and prior to copying its contents to the
+    native window (e.g. in eglSwapBuffers, as described in section 3.9.1.1).
+    The default values for EGL_WIDTH and EGL_HEIGHT are zero. If the value
+    specified for either of EGL_WIDTH or EGL_HEIGHT is less than zero then an
+    EGL_BAD_PARAMETER error is generated.&quot;
+
+    Add the following entry to Table 3.5
+    (Queryable surface attributes and types)
+
+    Attribute            Type    Description
+    -------------------- ------- ---------------------------------------------
+    EGL_FIXED_SIZE_ANGLE boolean Surface will not be resized with a native
+                                 window
+
+    Replace the last paragraph on page 37 in Section 3.5.6 (Surface Attributes)
+
+    &quot;Querying EGL_WIDTH and EGL_HEIGHT returns respectively the width and
+    height, in pixels, of the surface. For a pixmap surface or window surface
+    with EGL_FIXED_SIZE_ANGLE set to EGL_FALSE, these values are initially
+    equal to the width and height of the native window or pixmap with respect
+    to which the surface was created. If the native window is resized and the
+    corresponding window surface is not fixed size, the corresponding window
+    surface will eventually be resized by the implementation to match (as
+    discussed in section 3.9.1). If there is a discrepancy because EGL has not
+    yet resized the window surface, the size returned by eglQuerySurface will
+    always be that of the EGL surface, not the corresponding native window.&quot;
+
+    Add the following paragraph to Section 3.5.6 (Surface Attributes)
+
+    &quot;Querying EGL_FIXED_SIZE_ANGLE returns EGL_FALSE if the surface will be
+    resized to match a native window, and EGL_TRUE if the surface cannot be
+    resized.&quot;
+
+    Alter the beginning of the first paragraph of Section 3.9.1.1 (Native
+    Window Resizing)
+
+    &quot;If &lt;surface&gt; does not have EGL_FIXED_SIZE_ANGLE set and the native window
+    corresponding to &lt;surface&gt; has been resized prior to the swap, &lt;surface&gt;
+    must be resized to match.&quot;
+
+Issues
+
+    1. Should there be a way to resize a window surface that had its size
+    specified initially.
+
+    RESOLVED: No. Surfaces that have their sizes specified initially must have
+    EGL_FIXED_SIZE_ANGLE set and can never be resized.
+
+Revision History
+
+    Version 4, 2014/02/24 - formatting changes.
+
+    Version 3, 2014/02/12 - ignore EGL_WIDTH and EGL_HEIGHT if
+    EGL_FIXED_SIZE_ANGLE is EGL_FALSE
+
+    Version 2, 2014/02/07 - rename to EGL_ANGLE_window_fixed_size, and add an
+    EGL_FIXED_SIZE_ANGLE token.
+
+    Version 1, 2014/02/05 - first draft.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_EXT_create_context_robustnesstxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_create_context_robustness.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_create_context_robustness.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_create_context_robustness.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,169 @@
</span><ins>+Name
+
+    EXT_create_context_robustness
+
+Name Strings
+
+    EGL_EXT_create_context_robustness
+
+Contributors
+
+    Daniel Koch, TransGaming
+    Contributors to EGL_KHR_create_context
+
+Contact
+
+    Greg Roth (groth 'at' nvidia.com)
+
+Status
+
+    Complete.
+
+Version
+
+    Version 3, 2011/10/31
+
+Number
+
+    EGL Extension #37
+
+Dependencies
+
+    Requires EGL 1.4
+
+    Written against the EGL 1.4 specification.
+
+    An OpenGL implementation supporting GL_ARB_robustness, an OpenGL ES
+    implementation supporting GL_EXT_robustness, or an implementation
+    supporting equivalent functionality is required.
+
+Overview
+
+    This extension allows creating an OpenGL or OpenGL ES context
+    supporting robust buffer access behavior and a specified graphics
+    reset notification behavior.
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    Accepted as an attribute name in the &lt;*attrib_list&gt; argument to
+    eglCreateContext:
+
+        EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT    0x30BF
+        EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT  0x3138
+
+    Accepted as an attribute value for EGL_CONTEXT_RESET_NOTIFICATION_-
+    STRATEGY_EXT in the &lt;*attrib_list&gt; argument to eglCreateContext:
+
+        EGL_NO_RESET_NOTIFICATION_EXT           0x31BE
+        EGL_LOSE_CONTEXT_ON_RESET_EXT           0x31BF
+
+Additions to the EGL 1.4 Specification
+
+    Replace section 3.7.1 &quot;Creating Rendering Contexts&quot; from the
+    fifth paragraph through the seventh paragraph:
+
+    &lt;attrib_list&gt; specifies a list of attributes for the context. The
+    list has the same structure as described for eglChooseConfig. If an
+    attribute is not specified in &lt;attrib_list&gt;, then the default value
+    specified below is used instead. &lt;attrib_list&gt; may be NULL or empty
+    (first attribute is EGL_NONE), in which case attributes assume their
+    default values as described below. Most attributes are only meaningful
+    for specific client APIs, and will generate an EGL_BAD_ATTRIBUTE
+    error when specified to create for another client API context.
+
+    Context Versions
+    ----------------
+
+    EGL_CONTEXT_CLIENT_VERSION determines which version of an OpenGL ES
+    context to create. This attribute may only be specified when creating
+    an OpenGL ES context (e.g. when the current rendering API is
+    EGL_OPENGL_ES_API). An attribute value of 1 specifies creation of an
+    OpenGL ES 1.x context.  An attribute value of 2 specifies creation of an
+    Open GL ES 2.x context. The default value for EGL_CONTEXT_CLIENT_VERSION
+    is 1.
+
+    Context Robust Access
+    -------------
+
+    EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT indicates whether &lt;robust buffer
+    access&gt; should be enabled for the OpenGL ES context. Robust buffer
+    access is defined in the GL_EXT_robustness extension specification,
+    and the resulting context must support GL_EXT_robustness and robust
+    buffer access as described therein. The default value of
+    EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT is EGL_FALSE.
+
+    Context Reset Notification
+    --------------------------
+
+    The attribute name EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_-
+    EXT specifies the &lt;reset notification behavior&gt; of the rendering
+    context. This attribute is only meaningful for OpenGL ES contexts,
+    and specifying it for other types of contexts will generate an
+    EGL_BAD_ATTRIBUTE error.
+
+    Reset notification behavior is defined in the GL_EXT_robustness
+    extension for OpenGL ES, and the resulting context must support
+    GL_EXT_robustness and the specified reset strategy. The attribute
+    value may be either EGL_NO_RESET_NOTIFICATION_EXT or EGL_LOSE_-
+    CONTEXT_ON_RESET_EXT, which respectively result in disabling
+    delivery of reset notifications or the loss of all context state
+    upon reset notification as described by the GL_EXT_robustness. The
+    default value for EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT
+    is EGL_NO_RESET_NOTIFICATION_EXT.
+    
+    Add to the eglCreateContext context creation errors:
+
+    * If &lt;config&gt; does not support a client API context compatible
+      with the requested context flags and context reset notification
+      behavior (for client API types where these attributes are
+      supported), then an EGL_BAD_CONFIG error is generated.
+
+    * If the reset notification behavior of &lt;share_context&gt; and the
+      newly created context are different then an EGL_BAD_MATCH error is
+      generated.
+
+
+Errors
+
+    EGL_BAD_CONFIG is generated if EGL_CONTEXT_OPENGL_ROBUST_ACCESS_-
+    EXT is set to EGL_TRUE and no GL context supporting the GL_EXT_-
+    robustness extension and robust access as described therein can be
+    created.
+
+    EGL_BAD_CONFIG is generated if no GL context supporting the
+    GL_EXT_robustness extension and the specified reset notification
+    behavior (the value of attribute EGL_CONTEXT_RESET_NOTIFICATION_-
+    STRATEGY_EXT) can be created.
+
+    BAD_MATCH is generated if the reset notification behavior of
+    &lt;share_context&gt; does not match the reset notification behavior of
+    the context being created.
+
+New State
+
+    None
+
+Conformance Tests
+
+    TBD
+
+Sample Code
+
+    TBD
+
+Issues
+
+    None
+
+Revision History
+
+    Rev.    Date       Author     Changes
+    ----  ------------ ---------  ----------------------------------------
+      3   31 Oct  2011 groth      Reverted to attribute for robust access. Now it's a
+                                  companion to rather than subset of KHR_create_context
+      2   11 Oct  2011 groth      Merged ANGLE and NV extensions.
+      1   15 July 2011 groth      Initial version
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEGL_EXT_device_querytxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_device_query.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_device_query.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EGL_EXT_device_query.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,188 @@
</span><ins>+Name
+
+    EXT_device_query
+
+Name Strings
+
+    EGL_EXT_device_query
+
+Contributors
+
+    James Jones, NVIDIA  (jajones 'at' nvidia.com)
+    Jamie Madill, Google  (jmadill 'at' google.com)
+
+Contacts
+
+    Jamie Madill, Google  (jmadill 'at' google.com)
+
+Status
+
+    Draft
+
+Version
+
+    Version 1 - Mar 25rd, 2015
+
+Number
+
+    EGL Extension #XXX
+
+Extension Type
+
+    EGL client extension
+
+Dependencies
+
+    Written against the wording of EGL 1.5.
+
+    Requires EGL 1.5 or an earlier verison of EGL with the
+    EGL_EXT_client_extensions extension.
+
+Overview
+
+    Increasingly, EGL and its client APIs are being used in place of
+    &quot;native&quot; rendering APIs to implement the basic graphics
+    functionality of native windowing systems.  This creates demand
+    for a method to access native GPU or device objects directly
+    rather than calling EGL or GL entry points.
+
+    This extension defines the method for an application to query
+    native device objects from an EGL Display.
+
+New Types
+
+    This is the type of a handle that represents an EGLDeviceEXT
+    object.
+
+        typedef void* EGLDeviceEXT;
+
+    If EGL 1.5 is not supported, the following type is added, as
+    defined in the EGL 1.5 specification:
+
+        typedef intptr_t EGLAttrib;
+
+New Functions
+
+    EGLBoolean eglQueryDeviceAttribEXT(EGLDeviceEXT device,
+                                       EGLint attribute,
+                                       EGLAttrib *value);
+
+    const char *eglQueryDeviceStringEXT(EGLDeviceEXT device,
+                                        EGLint name);
+
+    EGLBoolean eglQueryDisplayAttribEXT(EGLDisplay dpy,
+                                        EGLint attribute,
+                                        EGLAttrib *value);
+
+New Tokens
+
+    Functions with a return type of EGLDeviceEXT will return this
+    value on failure:
+
+        EGL_NO_DEVICE_EXT                      ((EGLDeviceEXT)0)
+
+    This error value will be generated by functions that take an
+    EGLDeviceEXT object as a parameter:
+
+        EGL_BAD_DEVICE_EXT                     0x322B
+
+    Accepted by the &lt;attribute&gt; parameter of
+    eglQueryDisplayAttribEXT:
+
+        EGL_DEVICE_EXT                         0x322C
+
+Add a new section &quot;2.1.2 Devices&quot; after &quot;2.1.1 Scalar Types&quot;
+
+    All EGL operations occur on an EGLDeviceEXT.  However, devices
+    themselves expose no functionality.  They are simple abstract
+    objects that exist only for the sake of enumeration and
+    defining a namespace.
+
+Modify the last sentence of section &quot;2.1.3&quot; Displays&quot; to read:
+
+    Besides devices, objects are always specified by the combination
+    of an EGLDisplay parameter with a parameter representing the
+    handle of the object.
+
+Add a new extension type to the list in section &quot;2.8 Extensions&quot;
+
+    Device Extensions
+        A *device extension* adds functionality to an individual
+        EGLDeviceEXT.  Different instances of EGLDeviceEXT may support
+        different sets of device extensions
+
+Add a new error to section &quot;3.1 Errors&quot;
+
+    EGL_BAD_DEVICE_EXT
+        An EGLDeviceEXT argument does not refer to a valid
+        EGLDeviceEXT.  Any command taking an EGLDeviceEXT parameter
+        may generate this error.
+
+Add a section &quot;3.2 Devices&quot; after &quot;3.1 Errors&quot;
+
+    To query the properties of a device, use:
+
+        EGLBoolean eglQueryDeviceAttribEXT(EGLDeviceEXT device,
+                                           EGLint attribute,
+                                           EGLAttrib *value);
+
+    On success, EGL_TRUE is returned and the requested attribute value
+    is returned in &lt;value&gt;.  Currently there are no valid values of
+    &lt;attribute&gt; defined.
+
+    On failure, EGL_FALSE is returned.  An EGL_BAD_ATTRIBUTE error is
+    generated if &lt;attribute&gt; is not a valid attribute.  An
+    EGL_BAD_DEVICE_EXT error is generated if &lt;device&gt; is not a valid
+    EGLDeviceEXT.
+
+        const char *eglQueryDeviceStringEXT(EGLDeviceEXT device,
+                                            EGLint name);
+
+    returns a pointer to a static, zero-terminated string describing
+    some aspect of the specified EGLDeviceEXT.  &lt;name&gt; must be
+    EGL_EXTENSIONS.
+
+    The EGL_EXTENSIONS string describes which device extensions are
+    supported by &lt;device&gt;.  The string is of the same format specified
+    for display and client extension strings in section 3.4. Note that
+    device extensions are properties of the device, and are distinct
+    from other extension strings.
+
+    On failure, NULL is returned.  An EGL_BAD_DEVICE_EXT error is
+    generated if &lt;device&gt; is not a valid EGLDeviceEXT.  An
+    EGL_BAD_PARAMETER error is generated if &lt;name&gt; is not one of the
+    values described above.
+
+Add a section &quot;3.4 Display Attributes&quot; after &quot;3.3 EGL Versioning&quot;
+
+    To query attributes of an initialized display, use:
+
+        EGLBoolean eglQueryDisplayAttribEXT(EGLDisplay dpy,
+                                            EGLint name,
+                                            EGLAttrib *value);
+
+    On success, EGL_TRUE is returned.  If &lt;name&gt; is EGL_DEVICE_EXT,
+    the EGLDeviceEXT associated with &lt;dpy&gt; is returned in &lt;value&gt;.
+    All displays have an associated EGLDeviceEXT, regardless of how
+    they were created.  A successful query of EGL_DEVICE_EXT will
+    never return EGL_NO_DEVICE_EXT.
+
+    On failure, EGL_FALSE is returned.  An EGL_NOT_INITIALIZED error
+    is generated if EGL is not initialized for &lt;dpy&gt;.  An
+    EGL_BAD_ATTRIBUTE error is generated if &lt;name&gt; is not a valid
+    value.
+
+    Because the EGLDeviceEXT is a property of &lt;dpy&gt;, any use of an
+    associated EGLDeviceEXT after &lt;dpy&gt; has been terminated gives
+    undefined results. Querying an EGL_DEVICE_EXT from &lt;dpy&gt; after a
+    call to eglTerminate() (and subsequent re-initialization) may
+    return a different value.
+
+Issues
+
+    None.
+
+Revision History:
+
+    #1  (Mar 25rd, 2015) Jamie Madill
+        - Initial Draft based on EGL_EXT_device_base
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEXT_blend_minmaxtxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EXT_blend_minmax.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EXT_blend_minmax.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EXT_blend_minmax.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,164 @@
</span><ins>+Name
+
+    EXT_blend_minmax
+
+Name Strings
+
+    GL_EXT_blend_minmax
+
+Version
+
+    Last Modified Date: September 17, 2009
+    Version:            1.5
+
+Number
+
+    OpenGL Extension #37
+    OpenGL ES Extension #65
+
+Dependencies
+
+    There is an interaction with OpenGL ES.
+
+Overview
+
+    Blending capability is extended by respecifying the entire blend
+    equation.  While this document defines only two new equations, the
+    BlendEquationEXT procedure that it defines will be used by subsequent
+    extensions to define additional blending equations.
+
+    The two new equations defined by this extension produce the minimum
+    (or maximum) color components of the source and destination colors.
+    Taking the maximum is useful for applications such as maximum projection
+    in medical imaging.
+
+Issues
+
+    *   I've prefixed the ADD token with FUNC, to indicate that the blend
+        equation includes the parameters specified by BlendFunc.  (The min
+        and max equations don't.)  Is this necessary?  Is it too ugly?
+        Is there a better way to accomplish the same thing?
+    
+New Procedures and Functions
+
+    void BlendEquationEXT(enum mode);
+
+New Tokens
+
+    Accepted by the &lt;mode&gt; parameter of BlendEquationEXT:
+
+        FUNC_ADD_EXT                     0x8006
+        MIN_EXT                          0x8007
+        MAX_EXT                          0x8008
+
+    Accepted by the &lt;pname&gt; parameter of GetBooleanv, GetIntegerv,
+    GetFloatv, and GetDoublev:
+
+        BLEND_EQUATION_EXT               0x8009
+
+Additions to Chapter 2 of the GL Specification (OpenGL Operation)
+
+    None
+
+Additions to Chapter 3 of the GL Specification (Rasterization)
+
+    None
+
+Additions to Chapter 4 of the GL Specification (Per-Fragment Operations
+and the Framebuffer)
+
+    The GL Specification defines a single blending equation.  This
+    extension introduces a blend equation mode that is specified by calling
+    BlendEquationEXT with one of three enumerated values.  The default
+    value FUNC_ADD_EXT specifies that the blending equation defined in
+    the GL Specification be used.  This equation is
+
+        C' = (Cs * S) + (Cd * D)
+
+             /  1.0     C' &gt; 1.0
+        C = (
+             \   C'     C' &lt;= 1.0
+
+    where Cs and Cd are the source and destination colors, and S and D are
+    as specified by BlendFunc.
+
+    If BlendEquationEXT is called with &lt;mode&gt; set to MIN_EXT, the
+    blending equation becomes
+
+        C = min (Cs, Cd)
+
+    Finally, if BlendEquationEXT is called with &lt;mode&gt; set to MAX_EXT, the
+    blending equation becomes
+
+        C = max (Cs, Cd)
+
+    In all cases the blending equation is evaluated separately for each
+    color component.
+
+Additions to Chapter 5 of the GL Specification (Special Functions)
+
+    None
+
+Additions to Chapter 6 of the GL Specification (State and State Requests)
+
+    None
+
+Additions to the GLX Specification
+
+    None
+
+GLX Protocol
+
+    A new GL rendering command is added. The following command is sent to the 
+    server as part of a glXRender request:
+
+        BlendEquationEXT
+            2           8               rendering command length
+            2           4097            rendering command opcode
+            4           ENUM            mode
+
+Dependencies on OpenGL ES
+
+    If the GL is OpenGL ES, only the new MIN_EXT and MAX_EXT blend equations
+    are introduced by this extension.  BlendEquationOES, FUNC_ADD_OES, and
+    BLEND_EQUATION_OES are introduced by the OES_blend_subtract extension,
+    which is required for this extension to operate.  Alternatively,
+    OpenGL ES 2.0 is required, which introduces BlendEquation, FUNC_ADD, and
+    BLEND_EQUATION without the suffixes.
+
+    MIN_EXT and MAX_EXT should be added to Table 4.blendeq described in the
+    OES_blend_subtract extension specification, and Table 4.1 of the OpenGL
+    ES 2.0 specification.
+
+    Mentions of GetDoublev, Begin/End, and GLX in this extension specification
+    can be ignored for OpenGL ES.  Also, BlendEquationEXT and FUNC_ADD_EXT
+    instead have the OES suffix courtesy of OES_blend_subtract, or no suffix
+    courtesy of core OpenGL ES 2.0.
+
+Errors
+
+    INVALID_ENUM is generated by BlendEquationEXT if its single parameter
+    is not FUNC_ADD_EXT, MIN_EXT, or MAX_EXT.
+
+    INVALID_OPERATION is generated if BlendEquationEXT is executed between
+    the execution of Begin and the corresponding execution to End.
+
+New State
+
+    Get Value           Get Command     Type    Initial Value   Attribute
+    ---------           -----------     ----    -------------   ---------
+    BLEND_EQUATION_EXT  GetIntegerv     Z3      FUNC_ADD_EXT    color-buffer
+
+New Implementation Dependent State
+
+    None
+
+Revision History
+
+    Version 1.5, September 17, 2009 (Jon Leech) -
+        Merge into OpenGL Registry version of the extension and assign
+        OpenGL ES extension number.
+    Version 1.4, May 19, 2009 (Benj Lipchak) -
+        Adapted for OpenGL ES.
+    Version 1.3, May 31, 1995 -
+        Last SGI revision.
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEXT_color_buffer_floattxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EXT_color_buffer_float.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EXT_color_buffer_float.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EXT_color_buffer_float.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,230 @@
</span><ins>+Name
+
+    EXT_color_buffer_float
+
+Name Strings
+
+    GL_EXT_color_buffer_float
+
+Contributors
+
+    OpenGL ES Working Group members
+
+Contact
+
+    Mark Callow, HI Corp. (callow.mark 'at' artspark.co.jp)
+
+Notice
+
+    ©2012 The Khronos Group Inc.
+
+Status
+
+    Complete
+
+IP Status
+
+    Graphics Properties Holdings (GPH, formerly SGI) owns US Patent
+    #6,650,327, issued November 18, 2003. GPH believes this patent
+    contains necessary IP for graphics systems implementing floating
+    point (FP) rasterization and FP framebuffer capabilities.
+
+    GPH will not grant Khronos royalty-free use of this IP for use
+    in OpenGL ES, but will discuss licensing on RAND terms, on an
+    individual basis with companies wishing to use this IP in the
+    context of conformant OpenGL ES implementations. GPH does not
+    plan to make any special exemption for open source
+    implementations.
+
+    See
+    https://www.khronos.org/files/ip-disclosures/opengl/SGI%20IP%20Disclosure%20Mar05_clean.pdf
+    for the full disclosure.
+
+Version
+
+    Date: January 11th, 2013
+    Revision: 5
+
+Number
+
+    OpenGL ES Extension #137
+
+Dependencies
+
+    Requires OpenGL ES 3.0.
+
+    Written based on the wording of the OpenGL ES 3.0.1 Specification
+    (January 10th, 2013).
+
+Overview
+
+    This extension allows a variety of floating point formats to be
+    rendered to via framebuffer objects.
+
+New Procedures and Functions
+
+    None
+
+New Tokens
+
+    None
+
+Additions to Chapter 3 of the OpenGL ES 3.0 Specification
+(Rasterization)
+
+    3.8.3 Texture Image Specification, unnumbered subsection &quot;Required
+    Texture Formats&quot;, p. 126
+
+    Change the first two bullet items to the following:
+
+    - Texture and renderbuffer color formats (see section 4.4.2).
+      - RGBA32F, RGBA32I, RGBA32UI, RGBA16F, RGBA16I, RGBA16UI,
+        RGBA8, RGBA8I, RGBA8UI, SRGB8_ALPHA8, RGB10_A2, RGB10_-
+        A2UI, RGBA4, and RGB5_A1.
+      - RGB8 and RGB565.
+      - R11F G11F B10F.
+      - RG32F, RG32I, RG32UI, RG16F, RG16I, RG16UI, RG8, RG8I, and
+        RG8UI.
+      - R32F, R32I, R32UI, R16F, R16I, R16UI, R8, R8I, and R8UI.
+
+    - Texture-only color formats:
+      - RGBA8_SNORM.
+      - RGB32F, RGB32I, and RGB32UI.
+      - RGB16F, RGB16I, and RGB16UI.
+      - RGB8_SNORM, RGB8I, RGB8UI, and SRGB8.
+      - RGB9_E5.
+      - RG8_SNORM.
+      - R8_SNORM.
+
+    Table 3.12, p. 128 &amp; 129
+
+    Convert the dash under 'Color-renderable' to a 'check' for the
+    following internal formats: R16F, RG16F, RGBA16F, R32F, RG32F,
+    RGBA32F and R11F_G11F_B10F.
+    
+Additions to Chapter 4 of the OpenGL ES 3.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+    (changed lines marked with *; added lines marked with +)
+
+    Chapter 4 Introduction, p. 167
+
+    Paragraph 5, sentence 3, p 168, insert &quot;floating point&quot; as shown:
+        &quot;R, G, B, and A components may be represented as unsigned
+ *      normalized fixed-point, floating point or signed or unsigned
+        integer values; ...&quot;    ^^^^^^^^^^^^^^
+
+    4.1.7 Blending, p. 174
+
+    Modify paragraphs 3 &amp; 4:
+    
+ *      &quot;If the color buffer is fixed-point, the components of the
+    source and destination values and blend factors are clamped
+ *  to [0; 1] prior to evaluating the blend equation. If the color
+ +  buffer is floating-point, no clamping occurs. The resulting four
+ +  values are sent to the next operation.
+    
+        Blending applies only if the color buffer has a fixed-point or
+ *  or floating-point format. If the color buffer has an integer
+ *  format, proceed to the next operation.  Furthermore, an
+ +  INVALID_OPERATION error is generated by DrawArrays and the other
+ +  drawing commands defined in section 2.8.3 if blending is enabled
+ +  (see below) and any draw buffer has a 32-bit floating-point
+ +  format.&quot;
+
+    4.2.3 Clearing the Buffers, p. 183
+
+    Modify second paragraph, inserting &quot;floating point&quot;:
+
+    &quot;   void ClearColor(float r, float g, float b, float a);
+
+ *  sets the clear value for fixed- and floating-point color buffers.
+    ...&quot;                            ^^^^^^^^^^^^^^^^^^
+
+    4.3.1 Reading Pixels, p. 186
+
+    In paragraph 4, beginning &quot;Only two combinations of format
+    and type are accepted ...&quot;, after the sentence ending &quot;... type
+    UNSIGNED_BYTE is accepted.&quot; insert the following sentence:
+        &quot;For floating-point rendering surfaces, the combination
+        format RGBA and type FLOAT is accepted.&quot;
+
+    4.3.1 unnumbered subsection &quot;Obtaining Pixels from the Framebuffer&quot;,
+    p. 188
+
+    Modify penultimate paragraph, p189, &quot;If format is an integer ...&quot;
+
+    &quot;If format is an integer format and the color buffer is not an
+    integer format; if the color buffer is an integer format and
+ *  format is not an integer format; if format is an integer format
+ *  and type is FLOAT, HALF_FLOAT, or UNSIGNED_INT_10F_11F_11F_REV;
+ +  or if the color buffer is a floating-point format and type is
+ +  not FLOAT, HALF FLOAT, or UNSIGNED_INT_10F_11F_11F_REV, the error
+    INVALID_OPERATION occurs.&quot;
+
+    4.3.1 unnumbered subsection &quot;Conversion of RGBA values&quot;, p.190
+
+    Sole paragraph, sentence 3, insert &quot;or floating point&quot; as shown:
+ *      &quot;For an integer or floating point color buffer, the elements
+        are unmodified.&quot;^^^^^^^^^^^^^^^^^
+
+    4.3.2 Copying Pixels, p192
+
+    Modify first error condition, at bottom of p193, &quot;The read buffer
+    contains ...&quot; to encompass floating-point buffers.
+
+ *  &quot;- The read buffer contains fixed-point or floating-point values
+ *     and any draw buffer contains neither fixed-point nor
+ *     floating-point values.&quot;
+
+    4.4.2 Attaching Images to Framebuffer Objects, p. 197, unnumbered
+    subsection &quot;Required Renderbuffer Formats&quot;, p. 200
+
+    In the last paragraph beginning &quot;Implementations must support
+    creation ...&quot;, modify the final phrase to
+
+ *   &quot;with the exception of signed and unsigned integer, RGBA16F,
+ +   R32F, RG32F and RGBA32F formats.
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
+
+    None
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    6.1.15 Internal Format Queries, p. 237
+
+    P. 238, paragraph 8 after &quot;Since multisampling is not supported
+    for signed and unsigned integer internal formats, the value of
+    NUM_SAMPLE_COUNTS will be zero for such formats.&quot;, insert new
+    one-sentence paragraph:
+
+        &quot;If &lt;internalformat&gt; is RGBA16F, R32F, RG32F, or RGBA32F, the
+        value of NUM_SAMPLE_COUNTS may be zero, or else the maximum
+        value in SAMPLES may be less than the value of MAX_SAMPLES.&quot;
+
+New Implementation Dependent State
+
+    None
+
+Issues
+
+Revision History
+
+    Rev.  Date     Author     Changes
+    ----  -------- ---------  -----------------------------------------
+      1   10/16/12 markc      Initial version
+      2   10/18/12 markc      Referenced preliminary version of OpenGL
+                              ES 3.0.1 specification and updated page
+                              numbers.
+      3   11/21/12 markc      Corrected IP status.
+      4   01/09/13 markc      Changed date of referenced OpenGL ES
+                              3.0.1 specification. Made minor language
+                              simplification.
+      5   01/11/13 markc      Changed date to release version of
+                              OpenGL ES 3.0.1 specification.
+                              Clarified change to &quot;Required
+                              renderbuffer formats&quot; section.
+
+# vim:ai:ts=4:sts=4:sw=4:expandtab:textwidth=70
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEXT_draw_bufferstxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EXT_draw_buffers.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EXT_draw_buffers.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EXT_draw_buffers.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,542 @@
</span><ins>+Name
+
+    EXT_draw_buffers
+
+Name Strings
+
+    GL_EXT_draw_buffers
+
+Contributors
+
+    Contributors to GL_NV_draw_buffers
+    Contributors to GL_NV_fbo_color_attachments
+    Contributors to the OpenGL ES 2.0 specification
+    Contributors to the OpenGLSL ES 1.0.17 specification
+    Contributors to the OpenGL ES 3.0 specification
+    Nicolas Capens, TransGaming Inc.
+    Daniel Koch, TransGaming Inc.
+    Alastair Patrick, Google Inc.
+    Kenneth Russell, Google Inc.
+    Greg Roth, NVIDIA Corporation
+    Ben Bowman, Imagination Technologies
+    Members of the WebGL and OpenGL ES working groups
+
+Contact
+
+    Daniel Koch (daniel 'at' transgaming.com)
+
+Status
+
+    Draft Complete 
+
+Version
+
+    Last Modified Date: January 30, 2013
+    Revision: #7
+
+Number
+
+    TBD
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+
+    The extension is written against the OpenGL ES 2.0 specification.
+
+    ANGLE_framebuffer_blit affects the definition of this extension.
+    APPLE_framebuffer_multisample affects the definitin of this extension.
+
+Overview
+
+    This extension increases the number of available framebuffer object
+    color attachment points, extends OpenGL ES 2.0 to allow multiple output
+    colors, and provides a mechanism for directing those outputs to
+    multiple color buffers.
+
+    This extension is similar to the combination of the GL_NV_draw_buffers
+    and GL_NV_fbo_color_attachments extensions, but imposes certain
+    restrictions informed by the OpenGL ES 3.0 API.
+
+New Procedures and Functions
+
+      void DrawBuffersEXT(sizei n, const enum *bufs);
+
+New Tokens
+
+    Accepted by the &lt;pname&gt; parameter of GetIntegerv:
+
+        MAX_COLOR_ATTACHMENTS_EXT             0x8CDF
+
+    Accepted by the &lt;pname&gt; parameters of GetIntegerv and GetFloatv:
+
+        MAX_DRAW_BUFFERS_EXT                  0x8824
+        DRAW_BUFFER0_EXT                      0x8825
+        DRAW_BUFFER1_EXT                      0x8826
+        DRAW_BUFFER2_EXT                      0x8827
+        DRAW_BUFFER3_EXT                      0x8828
+        DRAW_BUFFER4_EXT                      0x8829
+        DRAW_BUFFER5_EXT                      0x882A
+        DRAW_BUFFER6_EXT                      0x882B
+        DRAW_BUFFER7_EXT                      0x882C
+        DRAW_BUFFER8_EXT                      0x882D
+        DRAW_BUFFER9_EXT                      0x882E
+        DRAW_BUFFER10_EXT                     0x882F
+        DRAW_BUFFER11_EXT                     0x8830
+        DRAW_BUFFER12_EXT                     0x8831
+        DRAW_BUFFER13_EXT                     0x8832
+        DRAW_BUFFER14_EXT                     0x8833
+        DRAW_BUFFER15_EXT                     0x8834
+
+    Accepted by the &lt;attachment&gt; parameter of FramebufferRenderbuffer,
+    FramebufferTexture2D and GetFramebufferAttachmentParameteriv, and by
+    the &lt;bufs&gt; parameter of DrawBuffersEXT:
+
+        COLOR_ATTACHMENT0_EXT                      0x8CE0
+        COLOR_ATTACHMENT1_EXT                      0x8CE1
+        COLOR_ATTACHMENT2_EXT                      0x8CE2
+        COLOR_ATTACHMENT3_EXT                      0x8CE3
+        COLOR_ATTACHMENT4_EXT                      0x8CE4
+        COLOR_ATTACHMENT5_EXT                      0x8CE5
+        COLOR_ATTACHMENT6_EXT                      0x8CE6
+        COLOR_ATTACHMENT7_EXT                      0x8CE7
+        COLOR_ATTACHMENT8_EXT                      0x8CE8
+        COLOR_ATTACHMENT9_EXT                      0x8CE9
+        COLOR_ATTACHMENT10_EXT                     0x8CEA
+        COLOR_ATTACHMENT11_EXT                     0x8CEB
+        COLOR_ATTACHMENT12_EXT                     0x8CEC
+        COLOR_ATTACHMENT13_EXT                     0x8CED
+        COLOR_ATTACHMENT14_EXT                     0x8CEE
+        COLOR_ATTACHMENT15_EXT                     0x8CEF
+
+    The COLOR_ATTACHMENT0_EXT constant is equal to the
+    COLOR_ATTACHMENT0 constant.
+
+    Each COLOR_ATTACHMENT&lt;i&gt;_EXT adheres to COLOR_ATTACHMENT&lt;i&gt;_EXT
+    = COLOR_ATTACHMENT0_EXT + &lt;i&gt;.
+
+Changes to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+    Section 3.2, (Multisampling). Replace the second paragraph:
+
+    An additional buffer, called the multisample buffer, is added to the
+    window system-provided framebuffer. Pixel sample values, including
+    color, depth, and stencil values, are stored in this buffer. Samples
+    contain separate color values for each fragment color. When the
+    window system-provided framebuffer includes a multisample buffer, it
+    does not include depth or stencil buffers, even if the multisample
+    buffer does not store depth or stencil values. Color buffers do
+    coexist with the multisample buffer, however.
+
+    Section 3.8.2, (Shader Execution) Replace subsection &quot;Shader
+    Outputs&quot;:
+
+    The OpenGL ES Shading Language specification describes the values
+    that may be output by a fragment shader. These are gl_FragColor and
+    gl_FragData[n].  The final fragment color values or the final
+    fragment data values written by a fragment shader are clamped to the
+    range [0, 1] and then converted to fixed-point as described in
+    section 2.1.2 for framebuffer color components.
+
+    Writing to gl_FragColor specifies the fragment color (color number
+    zero) that will be used by subsequent stages of the pipeline.
+    Writing to gl_FragData[n] specifies the value of fragment color
+    number n. Any colors, or color components, associated with a
+    fragment that are not written by the fragment shader are undefined.
+    A fragment shader may not statically assign values to both
+    gl_FragColor and gl_FragData. In this case, a compile or link error
+    will result. A shader statically assigns a value to a variable if,
+    after preprocessing, it contains a statement that would write to the
+    variable, whether or not run-time flow of control will cause that
+    statement to be executed.
+
+Changes to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Frame Buffer)
+
+    Modify the overview of Chapter 4 and replace the sentences
+    of the fifth paragraph which read: 
+
+    &quot;The name of the color buffer of an application-created framebuffer
+    object is COLOR_ATTACHMENT0. The names of the depth and stencil buffers
+    are DEPTH_ATTACHMENT and STENCIL_ATTACHMENT.&quot; 
+
+    With the following:
+
+    &quot;A framebuffer object has an array of color buffer attachment points,
+    numbered zero through &lt;n&gt;, a depth buffer attachment point, and a
+    stencil buffer attachment point.&quot; 
+
+    Insert Table 4.3 to Section 4.2.1 (and renumber subsequent tables):
+
+    Symbolic Constant                       Meaning
+    -----------------                       ---------------------
+    NONE                                    No buffer
+
+    COLOR_ATTACHMENT&lt;i&gt;_EXT (see caption)   Output fragment color to image 
+                                            attached at color attachment
+                                            point i
+
+    Table 4.3: Arguments to DrawBuffersEXT when the context is bound to a
+    framebuffer object, and the buffers they indicate. &lt;i&gt; in
+    COLOR_ATTACHMENT&lt;i&gt;_EXT may range from zero to the value of
+    MAX_COLOR_ATTACHMENTS_EXT minus one.
+
+    Replace Section 4.2.1, &quot;Selecting a Buffer for Writing&quot; with the following:
+
+    &quot;By default, color values are written into the front buffer for
+    single buffered surfaces or into the back buffer for back buffered
+    surfaces as determined when making the context current. To control
+    the color buffer into which each of the fragment color values is
+    written, DrawBuffersEXT is used.
+
+    The command
+
+      void DrawBuffersEXT(sizei n, const enum *bufs);
+
+    defines the draw buffers to which all fragment colors are written.
+    &lt;n&gt; specifies the number of buffers in &lt;bufs&gt;. &lt;bufs&gt; is a pointer
+    to an array of symbolic constants specifying the buffer to which
+    each fragment color is written.
+
+    Each buffer listed in &lt;bufs&gt; must be BACK, NONE, or one of the
+    values from table 4.3. Further, acceptable values for the constants
+    in &lt;bufs&gt; depend on whether the GL is using the default framebuffer
+    (i.e., DRAW_FRAMEBUFFER_BINDING is zero), or a framebuffer object
+    (i.e., DRAW_FRAMEBUFFER_BINDING is non-zero). For more information
+    about framebuffer objects, see section 4.4.
+
+    If the GL is bound to the default framebuffer, then &lt;n&gt; must be 1
+    and the constant must be BACK or NONE. When draw buffer zero is
+    BACK, color values are written into the sole buffer for single-
+    buffered contexts, or into the back buffer for double-buffered
+    contexts. If DrawBuffersEXT is supplied with a constant other than
+    BACK and NONE, the error INVALID_OPERATION is generated.
+
+    If the GL is bound to a draw framebuffer object, then each of the
+    constants must be one of the values listed in table 4.3.
+
+    In both cases, the draw buffers being defined correspond in order to
+    the respective fragment colors. The draw buffer for fragment
+    colors beyond &lt;n&gt; is set to NONE.
+
+    The maximum number of draw buffers is implementation-dependent. The
+    number of draw buffers supported can be queried by calling
+    GetIntegerv with the symbolic constant MAX_DRAW_BUFFERS_EXT. An
+    INVALID_VALUE error is generated if &lt;n&gt; is greater than
+    MAX_DRAW_BUFFERS_EXT.
+
+    If the GL is bound to a draw framebuffer object, the &lt;i&gt;th buffer listed
+    in &lt;bufs&gt; must be COLOR_ATTACHMENT&lt;i&gt;_EXT or NONE. Specifying a
+    buffer out of order, BACK, or COLOR_ATTACHMENT&lt;m&gt;_EXT where &lt;m&gt; is
+    greater than or equal to the value of MAX_COLOR_ATTACHMENTS_EXT,
+    will generate the error INVALID_OPERATION.
+
+    If a fragment shader writes to &quot;gl_FragColor&quot;, DrawBuffersEXT 
+    specifies the set of draw buffers into which the color 
+    written to &quot;gl_FragColor&quot; is written. If a fragment shader writes to
+    &quot;gl_FragData&quot;, DrawBuffersEXT specifies a set of draw buffers
+    into which each of the multiple output colors defined by these
+    variables are separately written. If a fragment shader writes to
+    neither &quot;gl_FragColor&quot; nor &quot;gl_FragData&quot; the values of the
+    fragment colors following shader execution are undefined, and may
+    differ for each fragment color.
+
+    Indicating a buffer or buffers using DrawBuffersEXT causes
+    subsequent pixel color value writes to affect the indicated
+    buffers. If the GL is bound to a draw framebuffer object and a draw
+    buffer selects an attachment that has no image attached, then that
+    fragment color is not written.
+
+    Specifying NONE as the draw buffer for a fragment color will inhibit
+    that fragment color from being written.
+
+    The state required to handle color buffer selection for each
+    framebuffer is an integer for each supported fragment color. For the
+    default framebuffer, in the initial state the draw buffer for
+    fragment color zero is BACK if there is a default framebuffer
+    associated with the context, otherwise NONE. For framebuffer
+    objects, in the initial state the draw buffer for fragment color
+    zero is COLOR_ATTACHMENT0_EXT.
+
+    For both the default framebuffer and framebuffer objects, the
+    initial state of draw buffers for fragment colors other than zero is
+    NONE.
+
+    The value of the draw buffer selected for fragment color &lt;i&gt; can be
+    queried by calling GetIntegerv with the symbolic constant
+    DRAW_BUFFER&lt;i&gt;_EXT.&quot;
+
+    Modify Section 4.2.3 (Clearing the Buffers) and replace the first
+    two paragraphs with the following:
+
+    &quot;The GL provides a means for setting portions of every pixel in a
+    particular buffer to the same value.  The argument to
+    
+        void Clear(bitfield buf);
+
+    is the bitwise OR of a number of values indicating which buffers are
+    to be cleared. The values are COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT, and
+    STENCIL_BUFFER_BIT, indicating the buffers currently enabled for color
+    writing, the depth buffer, and the stencil buffer (see below), 
+    respectively. The value to which each buffer is cleared depends on
+    the setting of the clear value for that buffer.  If the mask is not a
+    bitwise OR of the specified values, then the error INVALID_VALUE is
+    generated.
+
+        void ClearColor(clampf r, clampf, g, clampf b, clampf a);
+   
+    sets the clear value for fixed-point color buffers.  Each of the
+    specified components is clamped to [0, 1] and converted to fixed-point
+    as described in section 2.1.2 for framebuffer color components.&quot;
+
+    Replace the second paragraph of Section 4.4.1 (Binding and Managing
+    Framebuffer Objects) with the following:
+
+    &quot;The namespace for framebuffer objects is the unsigned integers, with
+    zero reserved by OpenGL ES to refer to the default framebuffer. A
+    framebuffer object is created by binding an unused name to the
+    target FRAMEBUFFER, DRAW_FRAMEBUFFER, or READ_FRAMEBUFFER. The binding
+    is effected by calling
+
+        void BindFramebuffer(enum target, uint framebuffer);
+
+    with &lt;target&gt; set the desired framebuffer target and &lt;framebuffer&gt; set 
+    to the unused name. The resulting framebuffer object is a new state 
+    vector. There is a number of color attachment points, plus one each
+    for the depth and stencil attachment points. The number of color attachment
+    points is equal to the value of MAX_COLOR_ATTACHMENTS_EXT.&quot;
+
+    Replace the third item in the bulleted list in Section 4.4.1 (Binding
+    and Managing Framebuffer Objects) with the following:
+
+    &quot; * The only color buffer bitplanes are the ones defined by the
+    framebuffer attachments points named COLOR_ATTACHMENT0_EXT through
+    COLOR_ATTACHMENT&lt;n&gt;_EXT.&quot;
+
+    Modify Section 4.4.3 (Renderbuffer Objects) in the 
+    &quot;Attaching Renderbuffer Images to a Framebuffer&quot; subsection as follows:
+
+    Insert the following table:
+
+    Name of attachment
+    ---------------------------------------
+    COLOR_ATTACHMENT&lt;i&gt;_EXT (see caption)
+    DEPTH_ATTACHMENT
+    STENCIL_ATTACHMENT
+
+    Table 4.x: Framebuffer attachment points. &lt;i&gt; in COLOR_ATTACHMENT&lt;i&gt;_EXT
+    may range from zero to the value of MAX_COLOR_ATTACHMENTS_EXT minus 1.
+
+    Modify the third sentence of the paragraph following the definition of
+    FramebufferRenderbuffer to be as follows:
+
+    &quot;&lt;attachment&gt; should be set to one of the attachment points of the 
+    framebuffer listed in Table 4.x.&quot; 
+
+    Modify Section 4.4.3 (Renderbuffer Objects) in the &quot;Attaching Texture
+    Images to a Framebuffer&quot; subsection as follows:
+
+    Modify the last sentence of the paragraph following the definition of
+    FramebufferTexture2D to be as follows:
+
+    &quot;&lt;attachment&gt; must be one of the attachment points of the framebuffer
+    listed in Table 4.x.&quot;
+
+    Modify Section 4.4.5 (Framebuffer Completeness) and replace the 3rd
+    item in the bulleted list in the &quot;Framebuffer Attachment Completeness&quot;
+    subsection with the following:
+
+    &quot; * If &lt;attachment&gt; is COLOR_ATTACHMENT&lt;i&gt;_EXT, then &lt;image&gt; must
+    have a color-renderable internal format.&quot;
+
+Changes to Chapter 6 of the OpenGL ES 2.0 Specification (State and
+State Requests)
+
+    In section 6.1.3 (Enumerated Queries) modify the third sentence in
+    the definition of GetFramebufferAttachmentParameteriv to be as follows:
+
+    &quot;&lt;attachment&gt; must be one of the attachment points of the framebuffer
+    listed in Table 4.x.&quot;
+
+Changes to Chapter 3 of the OpenGL ES Shading Language 1.0.17 Specification (Basics)
+
+    Add a new section:
+
+    3.4.1 GL_EXT_draw_buffers Extension
+
+    To use the GL_EXT_draw_buffers extension in a shader it
+    must be enabled using the #extension directive.
+
+    The shading language preprocessor #define
+    GL_EXT_draw_buffers will be defined to 1, if the
+    GL_EXT_draw_buffers extension is supported.
+
+Dependencies on ANGLE_framebuffer_blit and APPLE_framebuffer_multisample:
+
+    If neither ANGLE_framebuffer_blit nor APPLE_framebuffer_multisample are
+    supported, then all references to &quot;draw framebuffers&quot; should be replaced
+    with references to &quot;framebuffers&quot;. References to DRAW_FRAMEBUFFER_BINDING
+    should be replaced with references to FRAMEBUFFER_BINDING. References to
+    DRAW_FRAMEBUFFER and READ_FRAMEBUFFER should be removed.
+
+    If ANGLE_framebuffer_blit is supported, DRAW_FRAMEBUFFER_BINDING, DRAW_FRAMEBUFFER
+    and READ_FRAMEBUFFER all refer to corresponding _ANGLE suffixed names
+    (they have the same token values).
+
+    If APPLE_framebuffer_multisample is supported, DRAW_FRAMEBUFFER_BINDING,
+    DRAW_FRAMEBUFFER and READ_FRAMEBUFFER all refer to the corresponding _APPLE
+    suffixed names (they have the same token values).
+
+Errors
+
+    The INVALID_OPERATION error is generated if DrawBuffersEXT is called
+    when the default framebuffer is bound and any of the following conditions
+    hold: 
+     - &lt;n&gt; is greater than 1 and less than MAX_DRAW_BUFFERS_EXT,
+     - &lt;bufs&gt; contains a value other than BACK or NONE.
+
+    The INVALID_OPERATION error is generated if DrawBuffersEXT is called
+    when bound to a draw framebuffer object and any of the following
+    conditions hold:
+     - the &lt;i&gt;th value in &lt;bufs&gt; is not COLOR_ATTACHMENT&lt;i&gt;_EXT or NONE.
+
+    The INVALID_VALUE error is generated if DrawBuffersEXT is called
+    with a value of &lt;n&gt; which is greater than MAX_DRAW_BUFFERS_EXT.
+
+    The INVALID_ENUM error is generated by FramebufferRenderbuffer if
+    the &lt;attachment&gt; parameter is not one of the values listed in Table 4.x.
+
+    The INVALID_ENUM error is generated by FramebufferTexture2D if
+    the &lt;attachment&gt; parameter is not one of the values listed in Table 4.x.
+
+    The INVALID_ENUM error is generated by GetFramebufferAttachmentParameteriv
+    if the &lt;attachment&gt; parameter is not one of the values listed in Table 4.x.
+
+New State
+
+    Add Table 6.X Framebuffer (State per framebuffer object):
+
+    State               Type Get Command  Initial Value Description 
+    ------------------  ---- ------------ ------------- -----------
+    DRAW_BUFFER&lt;i&gt;_EXT  Z10* GetIntegerv  see 4.2.1     Draw buffer selected 
+                                                          for fragment color i
+
+    Add to Table 6.18 (Implementation Dependent Values)
+
+    Get value                 Type Get Cmnd    Minimum Value Description             Sec.
+    --------------------      ---- ----------- ------------- -----------             -----
+    MAX_DRAW_BUFFERS_EXT      Z+   GetIntegerv 1             Maximum number of       4.2.1
+                                                             active draw buffers
+    MAX_COLOR_ATTACHMENTS_EXT Z+   GetIntegerv 1             Number of framebuffer   4.4.1
+                                                             color attachment points
+Issues
+
+    See ARB_draw_buffers for relevant issues.
+
+  1) What are the differences between this extension and NV_draw_buffers
+    + NV_fbo_color_attachments?
+
+    RESOLVED. This extension:
+     - adds interactions with blit_framebuffer and the separate 
+       draw/read binding points
+     - The draw buffer and color attachment limits are global instead
+       of per-fbo (see Issue 2)
+     - can be used to with default framebuffer to set NONE/BACK (see Issue 4)
+     - retains the ordering restrictions on color attachments that are 
+       imposed by ES 3.0.
+
+   2) Should the MAX_DRAW_BUFFERS_EXT and MAX_COLOR_ATTACHMENTS_EXT limits
+    be per-framebuffer values or implementation dependent constants?
+
+    DISCUSSION: In ARB_draw_buffers this was per-context (see Issue 2).
+    EXT_framebuffer_object (and subsequently ARB_framebuffer_object, and GL 3.0
+    through GL 4.2) made these queries framebuffer-dependent. 
+    However in GL 4.3 and GLES 3.0, these limits were changed from 
+    framebuffer-dependent state to implementation-dependent state after
+    much discussion (Bug 7990).
+
+    NV_draw_buffers has MAX_DRAW_BUFFERS listed as per-framebuffer state,
+    but NV_fbo_color_attachments has MAX_COLOR_ATTACHMENTS as an 
+    implementation-dependent constant.
+
+    This is relevant because some implementations are not able to support 
+    multisampling in conjuction with multiple color attachments.  If the
+    query is per-framebuffer, they can report a maximum of one attachment
+    when there are multisampled attachments, but a higher limit when only
+    single-sampled attachments are present.
+
+    RESOLVED. Make this global context state as this is most consistent 
+    with GLES 3.0 and updated GL drivers. In an implementation cannot
+    support multisampling in conjunction with multiple color attachments,
+    perhaps such an implementation could report FBO incomplete in this 
+    situation, but this is less than desirable.
+
+   3) Should we support broadcast from gl_FragColor to all gl_FragData[x]
+    or should it be synonymous with gl_FragData[0]?
+
+    DISCUSSION: With NV_draw_buffers, writing to gl_FragColor writes to all
+    the enabled draw buffers (ie broadcast). In OpenGL ES 3.0 when using 
+    ESSL 1.0, gl_FragColor is equivalent to writing a single output to 
+    gl_FragData[0] and multiple outputs are not possible. When using ESSL 3.0,
+    only user-defined out variables may be used.
+
+    If broadcast is supported, some implementations may have to replace
+    writes to gl_FragColor with replicated writes to all possible gl_FragData
+    locations when this extension is enabled.
+
+    RESOLVED: Writes to gl_FragColor are broadcast to all enabled color
+    buffers. ES 3.0 using ESSL 1.0 doesn't support broadcast because
+    ESSL 1.0 was not extended to have multiple color outputs (but that is
+    what this extension adds). ESSL 3.0 doesn't support the broadcast because
+    it doesn't have the gl_FragColor variable at all, and only has user-
+    defined out variables. This extension extends ESSL 1.0 to have multiple
+    color outputs. Broadcasting from gl_FragColor to all enabled color 
+    buffers is the most consistent with existing draw buffer extensions to
+    date (both NV_draw_buffers and desktop GL).
+    
+   4) Should we allow DrawBuffersEXT to be called when the default FBO is
+    bound?
+
+    DISCUSSION: NV_draw_buffers specifies that DrawBuffersNV errors with 
+    INVALID_OPERATION when the default FBO is bound. OpenGL ES 3.0 allows
+    DrawBuffers to toggle between BACK and NONE on the default FBO.
+
+    An implementation that does not natively support disabling the drawbuffer
+    on the default FBO could emulate this by disabling color writes.
+
+    RESOLVED: Allow DrawBuffersEXT to be called for the default FBO. This
+    is more forward looking and is compatible with ES 3.0.
+
+   5) What are the requirements on the color attachment sizes and formats?
+    
+    RESOLVED: ES 2.0 requires that all color buffers attached to application-
+    created framebuffer objects must have the same number of bitplanes
+    (Chapter 4 overview p91). ES 2.0 also requires that all attached images
+    have the same width and height (Section 4.4.5 Framebuffer Completeness).
+    This extension does not lift those requirements, and failing to meet
+    them will result in an incomplete FBO.
+
+   6) Does this have any interactions with glClear?
+
+    RESOLVED: Yes. When multiple color buffers are enabled for writing,
+    glClear clears all of the color buffers.  Added language clarifying
+    that glClear and glClearColor may affect multiple color buffers.
+
+Revision History
+
+    01/30/2013  dgkoch  add issue 6 and clear interactions
+                        renamed to EXT_draw_buffers based on feedback
+                        changed resolution of issue 3.
+    01/23/2013  dgkoch  add resolutions to issues 2-4.
+                        add issue 5.
+                        Add Table 4.x and update various explicit
+                        references to COLOR_ATTACHMENT0.
+                        Add errors.
+    11/13/2012  dgkoch  add revision history
+                        add text from updated ES 3.0 spec
+                        add issues for discussion
+    10/16/2012  kbr     update name string
+    10/16/2012  kbr     remove restrition requiring draw buffer 0 to be non-NULL
+    10/12/2012  kbr     remove references to GetDoublev and ReadBuffer
+    10/11/2012  kbr     initial draft extension
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEXT_robustnesstxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EXT_robustness.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EXT_robustness.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EXT_robustness.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,365 @@
</span><ins>+Name
+
+    EXT_robustness
+
+Name Strings
+
+    GL_EXT_robustness
+
+Contributors
+
+    Daniel Koch, TransGaming
+    Nicolas Capens, TransGaming
+    Contributors to ARB_robustness
+
+Contact
+
+    Greg Roth, NVIDIA (groth 'at' nvidia.com)
+
+Status
+
+    Complete.
+
+Version
+
+    Version 3, 2011/10/31
+
+Number
+
+    OpenGL ES Extension #107
+
+Dependencies
+
+    This extension is written against the OpenGL ES 2.0 Specification
+    but can apply to OpenGL ES 1.1 and up.
+
+    EGL_EXT_create_context_robustness is used to determine if a context
+    implementing this extension supports robust buffer access, and if it
+    supports reset notification. 
+
+Overview
+
+    Several recent trends in how OpenGL integrates into modern computer
+    systems have created new requirements for robustness and security
+    for OpenGL rendering contexts.
+    
+    Additionally GPU architectures now support hardware fault detection;
+    for example, video memory supporting ECC (error correcting codes)
+    and error detection.  OpenGL contexts should be capable of recovering
+    from hardware faults such as uncorrectable memory errors.  Along with
+    recovery from such hardware faults, the recovery mechanism can
+    also allow recovery from video memory access exceptions and system
+    software failures.  System software failures can be due to device
+    changes or driver failures.
+
+    OpenGL queries that that return (write) some number of bytes to a
+    buffer indicated by a pointer parameter introduce risk of buffer
+    overflows that might be exploitable by malware. To address this,
+    queries with return value sizes that are not expressed directly by
+    the parameters to the query itself are given additional API
+    functions with an additional parameter that specifies the number of
+    bytes in the buffer and never writing bytes beyond that limit. This
+    is particularly useful for multi-threaded usage of OpenGL contexts
+    in a &quot;share group&quot; where one context can change objects in ways that
+    can cause buffer overflows for another context's OpenGL queries.
+
+    The original ARB_vertex_buffer_object extension includes an issue
+    that explicitly states program termination is allowed when
+    out-of-bounds vertex buffer object fetches occur. Modern graphics
+    hardware is capable well-defined behavior in the case of out-of-
+    bounds vertex buffer object fetches. Older hardware may require
+    extra checks to enforce well-defined (and termination free)
+    behavior, but this expense is warranted when processing potentially
+    untrusted content.
+
+    The intent of this extension is to address some specific robustness
+    goals:
+
+    *   For all existing OpenGL queries, provide additional &quot;safe&quot; APIs 
+        that limit data written to user pointers to a buffer size in 
+        bytes that is an explicit additional parameter of the query.
+
+    *   Provide a mechanism for an OpenGL application to learn about
+        graphics resets that affect the context.  When a graphics reset
+        occurs, the OpenGL context becomes unusable and the application
+        must create a new context to continue operation. Detecting a
+        graphics reset happens through an inexpensive query.
+
+    *   Provide an enable to guarantee that out-of-bounds buffer object
+        accesses by the GPU will have deterministic behavior and preclude
+        application instability or termination due to an incorrect buffer
+        access.  Such accesses include vertex buffer fetches of
+        attributes and indices, and indexed reads of uniforms or
+        parameters from buffers.
+
+New Procedures and Functions
+
+        enum GetGraphicsResetStatusEXT();
+
+        void ReadnPixelsEXT(int x, int y, sizei width, sizei height,
+                            enum format, enum type, sizei bufSize,
+                            void *data);
+
+        void GetnUniformfvEXT(uint program, int location, sizei bufSize,
+                              float *params);
+        void GetnUniformivEXT(uint program, int location, sizei bufSize,
+                              int *params);
+
+New Tokens
+
+    Returned by GetGraphicsResetStatusEXT:
+
+        NO_ERROR                                        0x0000
+        GUILTY_CONTEXT_RESET_EXT                        0x8253
+        INNOCENT_CONTEXT_RESET_EXT                      0x8254
+        UNKNOWN_CONTEXT_RESET_EXT                       0x8255
+
+    Accepted by the &lt;value&gt; parameter of GetBooleanv, GetIntegerv,
+    and GetFloatv:
+
+        CONTEXT_ROBUST_ACCESS_EXT                       0x90F3
+        RESET_NOTIFICATION_STRATEGY_EXT                 0x8256
+
+    Returned by GetIntegerv and related simple queries when &lt;value&gt; is
+    RESET_NOTIFICATION_STRATEGY_EXT :
+
+        LOSE_CONTEXT_ON_RESET_EXT                       0x8252
+        NO_RESET_NOTIFICATION_EXT                       0x8261
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
+
+Add a new subsection after 2.5 &quot;GL Errors&quot; and renumber subsequent
+sections accordingly.
+
+    2.6 &quot;Graphics Reset Recovery&quot;
+
+    Certain events can result in a reset of the GL context. Such a reset
+    causes all context state to be lost. Recovery from such events
+    requires recreation of all objects in the affected context. The
+    current status of the graphics reset state is returned by
+
+        enum GetGraphicsResetStatusEXT();
+
+    The symbolic constant returned indicates if the GL context has been
+    in a reset state at any point since the last call to
+    GetGraphicsResetStatusEXT. NO_ERROR indicates that the GL context
+    has not been in a reset state since the last call.
+    GUILTY_CONTEXT_RESET_EXT indicates that a reset has been detected
+    that is attributable to the current GL context.
+    INNOCENT_CONTEXT_RESET_EXT indicates a reset has been detected that
+    is not attributable to the current GL context.
+    UNKNOWN_CONTEXT_RESET_EXT indicates a detected graphics reset whose
+    cause is unknown.
+
+    If a reset status other than NO_ERROR is returned and subsequent
+    calls return NO_ERROR, the context reset was encountered and
+    completed. If a reset status is repeatedly returned, the context may
+    be in the process of resetting.
+
+    Reset notification behavior is determined at context creation time,
+    and may be queried by calling GetIntegerv with the symbolic constant
+    RESET_NOTIFICATION_STRATEGY_EXT.
+
+    If the reset notification behavior is NO_RESET_NOTIFICATION_EXT,
+    then the implementation will never deliver notification of reset
+    events, and GetGraphicsResetStatusEXT will always return
+    NO_ERROR[fn1].
+       [fn1: In this case it is recommended that implementations should
+        not allow loss of context state no matter what events occur.
+        However, this is only a recommendation, and cannot be relied
+        upon by applications.]
+
+    If the behavior is LOSE_CONTEXT_ON_RESET_EXT, a graphics reset will
+    result in the loss of all context state, requiring the recreation of
+    all associated objects. In this case GetGraphicsResetStatusEXT may
+    return any of the values described above.
+
+    If a graphics reset notification occurs in a context, a notification
+    must also occur in all other contexts which share objects with that
+    context[fn2].
+       [fn2: The values returned by GetGraphicsResetStatusEXT in the
+        different contexts may differ.]
+
+    Add to Section 2.8 &quot;Vertex Arrays&quot; before subsection &quot;Transferring
+    Array Elements&quot;
+
+    Robust buffer access is enabled by creating a context with robust
+    access enabled through the window system binding APIs. When enabled,
+    indices within the vertex array that lie outside the arrays defined
+    for enabled attributes result in undefined values for the
+    corresponding attributes, but cannot result in application failure.
+    Robust buffer access behavior may be queried by calling GetIntegerv
+    with the symbolic constant CONTEXT_ROBUST_ACCESS_EXT.
+
+Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Frame Buffer)
+
+    Modify section 4.3.1 &quot;Reading Pixels&quot;
+
+    Pixels are read using
+
+        void ReadPixels(int x, int y, sizei width, sizei height,
+                        enum format, enum type, void *data);
+        void ReadnPixelsEXT(int x, int y, sizei width, sizei height,
+                           enum format, enum type, sizei bufSize,
+                           void *data);
+
+    Add to the description of ReadPixels:
+
+    ReadnPixelsEXT behaves identically to ReadPixels except that it does
+    not write more than &lt;bufSize&gt; bytes into &lt;data&gt;. If the buffer size
+    required to fill all the requested data is greater than &lt;bufSize&gt; an
+    INVALID_OPERATION error is generated and &lt;data&gt; is not altered.
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special
+Functions):
+
+    None
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and
+State Requests)
+
+    Modify Section 6.1.8 &quot;Shader and Program Queries&quot;
+
+    The commands
+
+        void GetUniformfv(uint program, int location, float *params);
+        void GetnUniformfvEXT(uint program, int location, sizei bufSize,
+                              float *params);
+        void GetUniformiv(uint program, int location, int *params);
+        void GetnUniformivEXT(uint program, int location, sizei bufSize,
+                              int *params);
+
+    return the value or values of the uniform at location &lt;location&gt;
+    for program object &lt;program&gt; in the array &lt;params&gt;. Calling
+    GetnUniformfvEXT or GetnUniformivEXT ensures that no more than
+    &lt;bufSize&gt; bytes are written into &lt;params&gt;. If the buffer size
+    required to fill all the requested data is greater than &lt;bufSize&gt; an
+    INVALID_OPERATION error is generated and &lt;params&gt; is not altered.
+    ...
+
+Additions to The OpenGL ES Shading Language Specification, Version 1.
+
+    Append to the third paragraph of section 4.1.9 &quot;Arrays&quot;
+
+    If robust buffer access is enabled via the OpenGL ES API, such
+    indexing must not result in abnormal program termination. The
+    results are still undefined, but implementations are encouraged to
+    produce zero values for such accesses.
+
+Interactions with EGL_EXT_create_context_robustness
+
+    If the EGL window-system binding API is used to create a context,
+    the EGL_EXT_create_context_robustness extension is supported, and
+    the attribute EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT is set to
+    EGL_TRUE when eglCreateContext is called, the resulting context will
+    perform robust buffer access as described above in section 2.8, and
+    the CONTEXT_ROBUST_ACCESS_EXT query will return GL_TRUE as described
+    above in section 6.1.5.
+
+    If the EGL window-system binding API is used to create a context and
+    the EGL_EXT_create_context_robustness extension is supported, then
+    the value of attribute EGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_EXT
+    determines the reset notification behavior and the value of
+    RESET_NOTIFICATION_STRATEGY_EXT, as described in section 2.6.
+
+Errors
+
+    ReadnPixelsEXT, GetnUniformfvEXT, and GetnUniformivEXT share all the
+    errors of their unsized buffer query counterparts with the addition
+    that INVALID_OPERATION is generated if the buffer size required to
+    fill all the requested data is greater than &lt;bufSize&gt;.
+
+New Implementation Dependent State
+
+    Get Value                       Type  Get Command     Minimum Value    Description                  Sec.  Attribute
+    ---------                       ----  -----------     -------------    ---------------------------  ----- ---------
+    CONTEXT_ROBUST_ACCESS_EXT       B     GetIntegerv     -                Robust access enabled        6.1.5 -
+    RESET_NOTIFICATION_STRATEGY_EXT Z_2   GetIntegerv     See sec. 2.6     Reset notification behavior  2.6   -
+
+Issues
+
+
+    1.  What should this extension be called?
+
+        RESOLVED: EXT_robustness
+
+        Since this is intended to be a version of ARB_robustness for
+        OpenGL ES, it should be named accordingly.
+
+    2.  How does this extension differ from Desktop GL's ARB_robustness?
+
+        RESOLVED: Because EGL_EXT_create_context_robustness uses a
+        separate attribute to enable robust buffer access, a
+        corresponding query is added here.
+
+    3.  Should we provide a context creation mechanism to enable this extension?
+
+        RESOLVED. Yes.
+
+        Currently, EGL_EXT_create_context_robustness provides this
+        mechanism via two unique attributes. These attributes differ
+        from those specified by KHR_create_context to allow for
+        differences in what functionality those attributes define.
+        
+    4. What can cause a graphics reset?
+
+       Either user or implementor errors may result in a graphics reset.
+       If the application attempts to perform a rendering that takes too long
+       whether due to an infinite loop in a shader or even just a rendering
+       operation that takes too long on the given hardware. Implementation
+       errors may produce badly formed hardware commands. Memory access errors
+       may result from user or implementor mistakes. On some systems, power
+       management events such as system sleep, screen saver activation, or
+       pre-emption may also context resets to occur. Any of these events may
+       result in a graphics reset event that will be detectable by the
+       mechanism described in this extension.
+
+    5. How should the application react to a reset context event?
+
+       RESOLVED: For this extension, the application is expected to query
+       the reset status until NO_ERROR is returned. If a reset is encountered,
+       at least one *RESET* status will be returned. Once NO_ERROR is again
+       encountered, the application can safely destroy the old context and
+       create a new one.
+
+       After a reset event, apps should not use a context for any purpose
+       other than determining its reset status, and then destroying it. If a
+       context receives a reset event, all other contexts in its share group
+       will also receive reset events, and should be destroyed and
+       recreated.
+
+       Apps should be cautious in interpreting the GUILTY and INNOCENT reset
+       statuses. These are guidelines to the immediate cause of a reset, but
+       not guarantees of the ultimate cause.
+
+    6. If a graphics reset occurs in a shared context, what happens in
+       shared contexts?
+
+       RESOLVED: A reset in one context will result in a reset in all other
+       contexts in its share group. 
+
+    7. How can an application query for robust buffer access support,
+       since this is now determined at context creation time?
+
+       RESOLVED. The application can query the value of ROBUST_ACCESS_EXT
+       using GetIntegerv. If true, this functionality is enabled.
+
+    8. How is the reset notification behavior controlled?
+
+       RESOLVED: Reset notification behavior is determined at context
+       creation time using EGL/GLX/WGL/etc. mechanisms. In order that shared
+       objects be handled predictably, a context cannot share with
+       another context unless both have the same reset notification
+       behavior.
+
+
+Revision History
+
+    Rev.    Date       Author     Changes
+    ----  ------------ ---------  ----------------------------------------
+      3   31 Oct  2011 groth      Reverted to attribute for robust access. Now it's a
+                                  companion to rather than subset of KHR_create_context
+      2   11 Oct  2011 groth      Merged ANGLE and NV extensions.
+                                  Convert to using flag to indicate robust access.
+      1   15 July 2011 groth      Initial version
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEXT_shader_framebuffer_fetchtxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EXT_shader_framebuffer_fetch.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EXT_shader_framebuffer_fetch.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EXT_shader_framebuffer_fetch.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,263 @@
</span><ins>+Name
+
+    EXT_shader_framebuffer_fetch
+
+Name Strings
+
+    GL_EXT_shader_framebuffer_fetch
+
+Contact
+
+    Benj Lipchak, Apple (lipchak 'at' apple.com)
+
+Status
+
+    Complete
+
+Version
+
+    Last Modified Date: May 28, 2013
+    Author Revision: 4
+
+Number
+
+    OpenGL ES Extension #122
+
+Dependencies
+
+    OpenGL ES 2.0 is required.
+    
+    This specification is written against the OpenGL ES 2.0.24 specification.
+    This extension is written against the OpenGL ES Shading Language 1.0.17
+    specification.
+    
+    OpenGL ES 3.0 affects the definition of this extension.
+
+Overview
+
+    Conventional OpenGL blending provides a configurable series of operations
+    that can be used to combine the output values from a fragment shader with
+    the values already in the framebuffer. While these operations are
+    suitable for basic image compositing, other compositing operations or
+    operations that treat fragment output as something other than a color
+    (normals, for instance) may not be expressible without multiple passes or
+    render-to-texture operations.
+
+    This extension provides a mechanism whereby a fragment shader may read
+    existing framebuffer data as input. This can be used to implement
+    compositing operations that would have been inconvenient or impossible with
+    fixed-function blending. It can also be used to apply a function to the
+    framebuffer color, by writing a shader which uses the existing framebuffer
+    color as its only input.
+
+Issues
+
+    1. How is framebuffer data treated during multisample rendering?
+    
+    RESOLVED: Reading the value of gl_LastFragData produces a different
+    result for each sample. This implies that all or part of the shader be run
+    once for each sample. Input values to the shader from existing variables
+    in GLSL ES remain identical across samples.
+    
+    2. How does the use of gl_LastFragData interact with fragment discard?
+    
+    RESOLVED: Hardware may not necessarily support discarding on sample
+    granularity. Therefore, three options were considered for this
+    functionality:
+    
+        A) Allow discard based on variables calculated using the framebuffer
+           color when multisample rasterization is disabled, but disallow
+           discard in this manner when multisample rasterization is enabled.
+        
+        B) Restrict usage of the framebuffer color until it is known whether
+           or not the pixel will be discarded.
+            
+        C) Allow undefined results for fragment shaders that discard on a
+           per-sample basis on hardware that doesn't support it.
+    
+    This extension has chosen option C. Restricting orthogonality of fragment
+    shaders between single-sample and multisample rendering is undesirable, as
+    is restricting usage of the framebuffer color, which can generally only be
+    done with detailed flow-control analysis.
+    
+    3. What is the precision of gl_LastFragData in practice?
+    
+    RESOLVED: Three options were considered for this functionality:
+    
+        A) gl_LastFragData is always mediump.
+        
+        B) gl_LastFragData takes the precision most closely matching the
+           actual storage format of the framebuffer.
+        
+        C) Allow redeclaration of gl_LastFragData in order to change its
+           precision.
+    
+    This extension has chosen option C. A fixed precision per option A
+    increases the likelihood of redundant conversion operations in the shader,
+    and option B does not provide for clear behavior with regard to the
+    precision of intermediate results from calculations using the
+    framebuffer color.
+
+    4. How does this extension iteract with conventional blending?
+    
+    RESOLVED: There is no interaction.  The two remain orthogonal.  The rest
+    of the pipeline continues as usual after the fragment shader stage.
+    
+
+    5. How does this extension work in ES 3.0?
+
+    RESOLVED: Differently than in ES 2.0.
+
+    The built-in fragment outputs of ES 2.0 are replaced in #version 300 es
+    shaders by user-declared outputs, to accomodate integer and MRT 
+    framebuffers.  Three options were considered:
+
+        A) Add built-ins similar to gl_LastFragData.
+        
+        B) Add a layout to mark user-declared fragment outputs as having
+        defined content on entry to fragment shader.
+            
+        C) Allow marking user-declared fragment outputs as &quot;inout&quot;.
+
+    This extension has chosen option C.  Adding built-ins per option A is
+    unwieldy for MRT framebuffers with mixed attachment types and precisions.  
+    Options B and C are semantically identical, but C requires fewer 
+    modifications to the specification and to user shaders.  Note that the 
+    inout qualifier is not allowed for re-declaring existing fragment outputs 
+    such as gl_FragDepth.
+
+New Procedures and Functions
+
+    None
+    
+New Tokens
+
+    Accepted by the &lt;pname&gt; parameter of GetBooleanv, GetIntegerv, GetFloatv,
+    and GetDoublev:
+    
+        FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT            0x8A52
+
+New Builtin Variables
+
+    mediump vec4 gl_LastFragData[gl_MaxDrawBuffers]
+    
+Changes to the OpenGL ES 2.0.24 Specification, Chapter 3
+
+    Remove the last sentence of Paragraph 2 of Section 3.8.1, page 84 (&quot;These
+    built-in varying variables include [...]&quot; and add:
+    
+    These built-in varying variables include the fragment's position, eye z
+    coordinate, and front-facing flag, as well as the last data or color value
+    written to the framebuffer. When the value of SAMPLE_BUFFERS is 1 and the 
+    current framebuffer color is accessed in the fragment shader, the fragment
+    shader will be invoked separately for each covered sample and a separate 
+    value for the previous framebuffer color will be provided for each sample.&quot;
+    
+    Add a new subsection to section 3.8.2, page 87 (&quot;Shader Execution&quot;):
+    
+    &quot;Discard
+    
+    Fragment shaders may conditionally abandon operations using the discard
+    keyword. However, the ability of hardware to support abandoning operations
+    on a single sample when the shader is invoked once for each covered sample
+    is implementation-dependent. This capability can be determined by calling
+    GetBooleanv with the symbolic constant 
+    FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT. If FALSE is returned, results from
+    shaders which discard based on per-sample logic are undefined.&quot;
+
+Changes to the OpenGL ES 2.0.24 Specification, Chapter 4
+
+    Replace first element of Figure 4.1, page 90 (&quot;Fragment + Associated Data&quot;):
+    
+    &quot;Fragment (or sample) + Associated Data&quot;
+
+New Implementation Dependent State
+
+    Add to table 6.19 (Implementation Dependent Values (cont.)):
+
+    Get Value                             Type  Get Command  Minimum Value  Description        Section
+    ---------                             ----  -----------  -------------  --------------     -------
+    FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT  B     GetBooleanv  -              Samples may be     3.8.2
+                                                                            discarded 
+                                                                            individually 
+
+Changes to the OpenGL ES Shading Language 1.0.17 Specification, Chapter 3
+
+    Remove Paragraph 2 of section 3.8, page 17, Identifiers (&quot;Identifiers
+    starting with &quot;gl_&quot; are reserved [...]&quot;) and add:
+
+    &quot;Identifiers starting with &quot;gl_&quot; are reserved for use by OpenGL ES, and
+    may not be declared in a shader as either a variable or a function.
+    However, as noted in the specification, certain predeclared &quot;gl_&quot; names
+    are allowed to be redeclared in a shader for the specific purpose of
+    changing their precision qualifier.&quot;
+    
+Changes to the OpenGL ES Shading Language 1.0.17 Specification, Chapter 7
+
+    Add after the last sentence of Paragraph 2 of Section 7.2, page 60,
+    Fragment Shader Special Variables (&quot;These variables may be written to
+    more [...]&quot;):
+    
+    &quot;... To access the existing framebuffer values (e.g., to implement a
+    complex blend operation inside the shader), fragment shaders should use
+    the read-only input array gl_LastFragData.  gl_LastFragData returns the
+    value written by the most recent fragment at the same position.
+    
+    Access to gl_LastFragData is optional, and must be enabled by 
+    
+    #extension GL_EXT_shader_framebuffer_fetch : &lt;behavior&gt;
+    
+    Where &lt;behavior&gt; is as specified in section 3.3.
+    
+    By default, gl_LastFragData is declared with the mediump precision
+    qualifier. This can be changed by redeclaring the corresponding variables
+    with the desired precision qualifier.
+    
+    Redeclarations are done as follows
+    
+    // Redeclaration that changes nothing is allowed
+    mediump vec4 gl_LastFragData[gl_MaxDrawBuffers]; 
+    
+    // All the following are allowed redeclaration that change behavior
+    lowp vec4 gl_LastFragData[gl_MaxDrawBuffers];
+    highp vec4 gl_LastFragData[gl_MaxDrawBuffers];
+    
+    Redeclarations must not otherwise alter the declared type or array size of
+    gl_LastFragData.&quot;
+    
+Changes to the OpenGL ES Shading Language 3.00.3 Specification, Chapter 4
+
+    Modify Paragraph 2 of section 4.3.6:
+    &quot;Except in the fragment stage, there is not an inout storage qualifier at
+    global scope for declaring a single variable name as both input and output
+    [...]&quot;
+
+    Modify Paragraph 5 of section 4.3.6:
+    &quot;Fragment outputs output per-fragment data and are declared using the out
+    or inout storage qualifier. It is an error to use centroid out or centroid
+    inout in a fragment shader [...]&quot; and append new paragraph:
+
+    &quot;Upon entry to the fragment shader, fragment outputs declared as inout will
+    contain the value written by the most recent fragment at the same position.
+    This behavior, and the ability to use the inout qualifier at global scope 
+    in a fragment shader, is optional and must be enabled by
+
+    #extension GL_EXT_shader_framebuffer_fetch : &lt;behavior&gt;
+    
+    Where &lt;behavior&gt; is as specified in section 3.4.&quot;
+
+Interactions with OES_standard_derivatives
+
+    Results from shaders which use the built-in derivative functions dFdx,
+    dFdy, and fwidth on variables calculated using the current framebuffer 
+    color are undefined.
+
+Revision History
+
+    Version 4, 2013/05/28 - Added ES3 interaction as requested in Bug 10236
+    Version 3, 2012/09/24 - Remove obsolete issue 3 about derivatives
+    Version 2, 2012/06/21 - Fix MULTISAMPLE enabled -&gt; SAMPLE_BUFFERS = 1,
+                            recast from APPLE to multivendor EXT, clarify that
+                            gl_LastFragData reflects value written by previous
+                            pixel at same coordinates.
+    Version 1, 2012/06/01 - Conversion from ARB_sync to APPLE_sync for ES.
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEXT_texture_rgtxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_rg.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_rg.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_rg.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+Name
+
+    EXT_texture_rg
+
+Name Strings
+    
+    GL_EXT_texture_rg
+
+Contributors
+
+    Contributors to ARB_texture_rg, on which this extension is based
+    Kyle Haughey
+    Richard Schreyer
+
+Contact
+
+    Benj Lipchak, Apple (lipchak 'at' apple.com)
+
+Status 
+    
+    Complete
+
+Version
+    
+    Date: July 22, 2011
+    Revision: 3
+
+Number
+
+    OpenGL ES Extension #103
+
+Dependencies
+
+    Requires OpenGL ES 2.0.
+
+    Written based on the wording of the OpenGL ES 2.0.25 Full Specification
+    (November 2, 2010).
+
+    OES_texture_float affects the definition of this extension.
+
+    OES_texture_half_float affects the definition of this extension.
+
+    APPLE_framebuffer_multisample affects the definition of this extension.
+
+Overview
+
+    Historically one- and two-component textures have been specified in OpenGL
+    ES using the luminance or luminance-alpha (L/LA) formats. With the advent
+    of programmable shaders and render-to-texture capabilities these legacy
+    formats carry some historical artifacts which are no longer useful.
+
+    For example, when sampling from such textures, the luminance values are
+    replicated across the color components. This is no longer necessary with
+    programmable shaders.
+    
+    It is also desirable to be able to render to one- and two-component format
+    textures using capabilities such as framebuffer objects (FBO), but
+    rendering to L/LA formats is under-specified (specifically how to map
+    R/G/B/A values to L/A texture channels).
+
+    This extension adds new base internal formats for one-component RED and
+    two-component RG (red green) textures as well as sized RED and RG internal
+    formats for renderbuffers. The RED and RG texture formats can be used for
+    both texturing and rendering into with framebuffer objects.
+
+New Procedures and Functions
+    
+    None
+
+New Tokens
+
+    Accepted by the &lt;internalformat&gt; parameter of TexImage2D and CopyTexImage2D,
+    and the &lt;format&gt; parameter of TexImage2D, TexSubImage2D, and ReadPixels:
+
+        RED_EXT                 0x1903
+        RG_EXT                  0x8227
+
+    Accepted by the &lt;internalformat&gt; parameter of RenderbufferStorage and
+    RenderbufferStorageMultisampleAPPLE:
+
+        R8_EXT                  0x8229
+        RG8_EXT                 0x822B
+
+Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
+
+    None
+
+Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
+
+    (Add the following to Table 3.3: &quot;TexImage2D and ReadPixels formats&quot;)
+
+    Format Name     Element Meaning and Order      Target Buffer
+    -----------     -------------------------      -------------
+    RED_EXT         R                              Color
+    RG_EXT          R, G                           Color
+
+    (Add the following to Table 3.4: &quot;Valid pixel format and type combinations&quot;)
+    (as modified by OES_texture_float and OES_texture_half_float)
+
+    Format          Type                           Bytes per Pixel
+    -----------     -------------------------      ---------------
+    RED_EXT         FLOAT                          4
+    RED_EXT         HALF_FLOAT_OES                 2
+    RED_EXT         UNSIGNED_BYTE                  1
+    RG_EXT          FLOAT                          8
+    RG_EXT          HALF_FLOAT_OES                 4
+    RG_EXT          UNSIGNED_BYTE                  2
+
+    (Add the following to Table 3.8: &quot;Conversion from RGBA and depth pixel
+    components to internal texture&quot;)
+
+    Base Internal Format     RGBA       Internal Components
+    --------------------     ------     -------------------
+    RED_EXT                  R          R
+    RG_EXT                   R,G        R,G
+
+    (Modify Table 3.9: &quot;CopyTexImage internal format/color buffer combinations&quot;)
+
+                            Texture Format
+    Color Buffer      A  L  LA  R  RG  RGB  RGBA
+    ------------      -  -  --  -  --  ---  ----
+    A                 X
+    R                    X      X
+    RG                   X      X  X
+    RGB                  X      X  X   X
+    RGBA              X  X  X   X  X   X    X
+
+    (Add the following to Table 3.12: &quot;Correspondence of filtered texture
+    components to texture source color components&quot;)
+
+    Texture Base        Texture source color
+    Internal Format     C_s             A_s
+    ---------------     -------------   ------
+    RED_EXT             (R_t, 0, 0)     1
+    RG_EXT              (R_t, G_t, 0)   1
+
+Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
+Operations and the Framebuffer)
+
+    In section 4.3.1 &quot;Reading Pixels&quot;, subsection &quot;Obtaining Pixels from the
+    Framebuffer&quot;, modify the last sentence to read:
+
+    &quot;If the framebuffer does not support G, B, or A values then the G, B, and A
+    values that are obtained are 0.0, 0.0, and 1.0 respectively.&quot;
+
+    In section 4.4.5 &quot;Framebuffer Completeness&quot;, modify the last sentence of
+    the second paragraph to read:
+
+    &quot;Color-renderable formats contain red, and possibly green, blue, and alpha
+    components; depth-renderable formats contain depth components; and
+    stencil-renderable formats contain stencil components.&quot;
+
+    (Add the following to Table 4.5: &quot;Renderbuffer image formats, showing their
+    renderable type (color-, depth-, or stencil-renderable) and the number of
+    bits each format contains for color (R, G, B, A), depth (D), and stencil
+    (S) components&quot;)
+
+    Sized Internal  Renderable Type   R bits G bits B bits A bits D bits S bits
+    Format
+    --------------  ----------------  ------ ------ ------ ------ ------ ------
+    R8_EXT        color-renderable  8
+    RG8_EXT       color-renderable  8      8
+
+Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
+
+    None
+
+Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
+Requests)
+
+    None
+
+Dependencies on OES_texture_float
+
+    If OES_texture_float is not supported, then omit the rows of
+    Table 3.4 that have Type FLOAT.
+
+Dependencies on OES_texture_half_float
+
+    If OES_texture_half_float is not supported, then omit the rows of 
+    Table 3.4 that have Type HALF_FLOAT_OES.
+
+Dependencies on APPLE_framebuffer_multisample
+
+    If APPLE_framebuffer_multisample is not supported, then all references to
+    RenderbufferStorageMultisampleAPPLE should be ignored.
+
+Revision History
+    
+    #1 February 22, 2011, khaughey
+        - initial version adapted from ARB_texture_rg.
+    #2 June 16, 2011, benj
+        - add interaction with APPLE_framebuffer_multisample
+    #3 July 22, 2011, benj
+        - rename from APPLE to EXT
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEextensionsEXT_texture_storagetxt"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_storage.txt (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_storage.txt                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/extensions/EXT_texture_storage.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1090 @@
</span><ins>+Name
+
+    EXT_texture_storage
+
+Name Strings
+
+    GL_EXT_texture_storage
+
+Contact
+
+    Bruce Merry (bmerry 'at' gmail.com)
+    Ian Romanick, Intel (ian.d.romanick 'at' intel.com)
+
+Contributors
+
+    Jeremy Sandmel, Apple
+    Bruce Merry, ARM
+    Tom Olson, ARM
+    Benji Bowman, Imagination Technologies
+    Ian Romanick, Intel
+    Jeff Bolz, NVIDIA
+    Pat Brown, NVIDIA
+    Maurice Ribble, Qualcomm
+    Lingjun Chen, Qualcomm
+    Daniel Koch, Transgaming Inc
+
+Status
+
+    Complete. 
+
+Version
+
+    Last Modified Date: November 11, 2011
+    Author Revision: 24
+
+Number
+
+    OpenGL ES Extension #108
+
+Dependencies
+
+    OpenGL ES 1.0, OpenGL ES 2.0 or OpenGL 1.2 is required.
+
+    OES_texture_npot, OES_texture_cube_map, OES_texture_3D,
+    OES_depth_texture, OES_packed_depth_stencil,
+    OES_compressed_paletted_texture, OES_texture_float, OES_texture_half_float
+    EXT_texture_type_2_10_10_10_REV, EXT_texture_format_BGRA8888,
+    EXT_texture3D, OES_texture_npot, APPLE_texture_2D_limited_npot,
+    ARB_texture_cube_map, ARB_texture_cube_map_array,
+    ARB_texture_rectangle, SGIS_generate_mipmap,
+    EXT_direct_state_access, OES_EGL_image, WGL_ARB_render_texture,
+    GLX_EXT_texture_from_pixmap, and core specifications that
+    incorporate these extensions affect the definition of this
+    extension.
+
+    This extension is written against the OpenGL 3.2 Core Profile
+    specification.
+
+Overview
+
+    The texture image specification commands in OpenGL allow each level
+    to be separately specified with different sizes, formats, types and
+    so on, and only imposes consistency checks at draw time. This adds
+    overhead for implementations.
+
+    This extension provides a mechanism for specifying the entire
+    structure of a texture in a single call, allowing certain
+    consistency checks and memory allocations to be done up front. Once
+    specified, the format and dimensions of the image array become
+    immutable, to simplify completeness checks in the implementation.
+
+    When using this extension, it is no longer possible to supply texture
+    data using TexImage*. Instead, data can be uploaded using TexSubImage*,
+    or produced by other means (such as render-to-texture, mipmap generation,
+    or rendering to a sibling EGLImage).
+
+    This extension has complicated interactions with other extensions.
+    The goal of most of these interactions is to ensure that a texture
+    is always mipmap complete (and cube complete for cubemap textures).
+
+IP Status
+
+    No known IP claims
+
+New Procedures and Functions
+
+    void TexStorage1DEXT(enum target, sizei levels,
+                         enum internalformat,
+                         sizei width);
+
+    void TexStorage2DEXT(enum target, sizei levels,
+                         enum internalformat,
+                         sizei width, sizei height);
+
+    void TexStorage3DEXT(enum target, sizei levels,
+                         enum internalformat,
+                         sizei width, sizei height, sizei depth);
+
+    void TextureStorage1DEXT(uint texture, enum target, sizei levels,
+                         enum internalformat,
+                         sizei width);
+
+    void TextureStorage2DEXT(uint texture, enum target, sizei levels,
+                         enum internalformat,
+                         sizei width, sizei height);
+
+    void TextureStorage3DEXT(uint texture, enum target, sizei levels,
+                         enum internalformat,
+                         sizei width, sizei height, sizei depth);
+
+New Types
+
+    None
+
+New Tokens
+
+    Accepted by the &lt;value&gt; parameter of GetTexParameter{if}v:
+
+        TEXTURE_IMMUTABLE_FORMAT_EXT   0x912F
+
+    Accepted by the &lt;internalformat&gt; parameter of TexStorage* when
+    implemented on OpenGL ES:
+
+        ALPHA8_EXT                     0x803C  /* reuse tokens from EXT_texture */
+        LUMINANCE8_EXT                 0x8040
+        LUMINANCE8_ALPHA8_EXT          0x8045
+
+      (if OES_texture_float is supported)
+        RGBA32F_EXT                    0x8814  /* reuse tokens from ARB_texture_float */
+        RGB32F_EXT                     0x8815
+        ALPHA32F_EXT                   0x8816
+        LUMINANCE32F_EXT               0x8818
+        LUMINANCE_ALPHA32F_EXT         0x8819
+
+      (if OES_texture_half_float is supported)
+        RGBA16F_EXT                    0x881A  /* reuse tokens from ARB_texture_float */
+        RGB16F_EXT                     0x881B
+        ALPHA16F_EXT                   0x881C
+        LUMINANCE16F_EXT               0x881E
+        LUMINANCE_ALPHA16F_EXT         0x881F
+
+      (if EXT_texture_type_2_10_10_10_REV is supported)
+        RGB10_A2_EXT                   0x8059  /* reuse tokens from EXT_texture */
+        RGB10_EXT                      0x8052
+
+      (if EXT_texture_format_BGRA8888 is supported)
+        BGRA8_EXT                      0x93A1
+
+
+Additions to Chapter 2 of the OpenGL 3.2 Core Profile Specification
+(OpenGL Operation)
+
+    None
+
+Additions to Chapter 3 of the OpenGL 3.2 Core Profile Specification
+(Rasterization)
+
+    After section 3.8.1 (Texture Image Specification) add a new
+    subsection called &quot;Immutable-format texture images&quot;:
+
+    &quot;An alterative set of commands is provided for specifying the
+    properties of all levels of a texture at once. Once a texture is
+    specified with such a command, the format and dimensions of all
+    levels becomes immutable, unless it is a proxy texture (since
+    otherwise it would no longer be possible to use the proxy). The
+    contents of the images and the parameters can still be modified.
+    Such a texture is referred to as an &quot;immutable-format&quot; texture. The
+    immutability status of a texture can be determined by calling
+    GetTexParameter with &lt;pname&gt; TEXTURE_IMMUTABLE_FORMAT_EXT.
+
+    Each of the commands below is described by pseudo-code which
+    indicates the effect on the dimensions and format of the texture.
+    For all of the commands, the following apply in addition to the
+    pseudo-code:
+
+    - If the default texture object is bound to &lt;target&gt;, an
+      INVALID_OPERATION error is generated.
+    - If executing the pseudo-code would lead to an error, the error is
+      generated and the command will have no effect.
+    - Any existing levels that are not replaced are reset to their
+      initial state.
+    - If &lt;width&gt;, &lt;height&gt;, &lt;depth&gt; or &lt;levels&gt; is less than 1, the
+      error INVALID_VALUE is generated.
+    - Since no pixel data are provided, the &lt;format&gt; and &lt;type&gt; values
+      used in the pseudo-code are irrelevant; they can be considered to
+      be any values that are legal to use with &lt;internalformat&gt;.
+    - If the command is successful, TEXTURE_IMMUTABLE_FORMAT_EXT becomes
+      TRUE.
+    - If &lt;internalformat&gt; is a specific compressed texture format, then
+      references to TexImage* should be replaced by CompressedTexImage*,
+      with &lt;format&gt;, &lt;type&gt; and &lt;data&gt; replaced by any valid &lt;imageSize&gt; and
+      &lt;data&gt;. If there is no &lt;imageSize&gt; for which this command would have
+      been valid, an INVALID_OPERATION error is generated [fn: This
+      condition is not required for OpenGL, but is necessary for OpenGL
+      ES which does not support on-the-fly compression.]
+    - If &lt;internalformat&gt; is one of the internal formats listed in table
+      3.11, an INVALID_ENUM error is generated. [fn: The corresponding table
+      in OpenGL ES 2.0 is table 3.8.]
+
+    The command
+
+        void TexStorage1DEXT(enum target, sizei levels,
+                             enum internalformat,
+                             sizei width);
+
+    specifies all the levels of a one-dimensional texture (or proxy) at
+    the same time. It is described by the pseudo-code below:
+
+        for (i = 0; i &lt; levels; i++)
+        {
+            TexImage1D(target, i, internalformat, width, 0,
+                       format, type, NULL);
+            width = max(1, floor(width / 2));
+        }
+
+    If &lt;target&gt; is not TEXTURE_1D or PROXY_TEXTURE_1D then INVALID_ENUM
+    is generated. If &lt;levels&gt; is greater than floor(log_2(width)) + 1
+    then INVALID_OPERATION is generated.
+
+    The command
+
+        void TexStorage2DEXT(enum target, sizei levels,
+                             enum internalformat,
+                             sizei width, sizei height);
+
+    specifies all the levels of a two-dimensional, cube-map,
+    one-dimension array or rectangle texture (or proxy) at the same
+    time. The pseudo-code depends on the &lt;target&gt;:
+
+    [PROXY_]TEXTURE_2D, [PROXY_]TEXTURE_RECTANGLE or
+    PROXY_TEXTURE_CUBE_MAP:
+
+        for (i = 0; i &lt; levels; i++)
+        {
+            TexImage2D(target, i, internalformat, width, height, 0,
+                       format, type, NULL);
+            width = max(1, floor(width / 2));
+            height = max(1, floor(height / 2));
+        }
+
+    TEXTURE_CUBE_MAP:
+
+        for (i = 0; i &lt; levels; i++)
+        {
+            for face in (+X, -X, +Y, -Y, +Z, -Z)
+            {
+                TexImage2D(face, i, internalformat, width, height, 0,
+                           format, type, NULL);
+            }
+            width = max(1, floor(width / 2));
+            height = max(1, floor(height / 2));
+        }
+
+    [PROXY_]TEXTURE_1D_ARRAY:
+
+        for (i = 0; i &lt; levels; i++)
+        {
+            TexImage2D(target, i, internalformat, width, height, 0,
+                       format, type, NULL);
+            width = max(1, floor(width / 2));
+        }
+
+    If &lt;target&gt; is not one of those listed above, the error INVALID_ENUM
+    is generated.
+
+    The error INVALID_OPERATION is generated if any of the following
+    conditions hold:
+    - &lt;target&gt; is [PROXY_]TEXTURE_1D_ARRAY and &lt;levels&gt; is greater than
+      floor(log_2(width)) + 1
+    - &lt;target&gt; is not [PROXY_]TEXTURE_1D_ARRAY and &lt;levels&gt; is greater
+    than floor(log_2(max(width, height))) + 1
+
+    The command
+
+        void TexStorage3DEXT(enum target, sizei levels, enum internalformat,
+                             sizei width, sizei height, sizei depth);
+
+    specifies all the levels of a three-dimensional, two-dimensional
+    array texture, or cube-map array texture (or proxy). The pseudo-code
+    depends on &lt;target&gt;:
+
+    [PROXY_]TEXTURE_3D:
+
+        for (i = 0; i &lt; levels; i++)
+        {
+            TexImage3D(target, i, internalformat, width, height, depth, 0,
+                       format, type, NULL);
+            width = max(1, floor(width / 2));
+            height = max(1, floor(height / 2));
+            depth = max(1, floor(depth / 2));
+        }
+
+    [PROXY_]TEXTURE_2D_ARRAY, [PROXY_]TEXTURE_CUBE_MAP_ARRAY_ARB:
+
+        for (i = 0; i &lt; levels; i++)
+        {
+            TexImage3D(target, i, internalformat, width, height, depth, 0,
+                       format, type, NULL);
+            width = max(1, floor(width / 2));
+            height = max(1, floor(height / 2));
+        }
+
+    If &lt;target&gt; is not one of those listed above, the error INVALID_ENUM
+    is generated.
+
+    The error INVALID_OPERATION is generated if any of the following
+    conditions hold:
+    - &lt;target&gt; is [PROXY_]TEXTURE_3D and &lt;levels&gt; is greater than
+      floor(log_2(max(width, height, depth))) + 1
+    - &lt;target&gt; is [PROXY_]TEXTURE_2D_ARRAY or
+      [PROXY_]TEXTURE_CUBE_MAP_ARRAY_EXT and &lt;levels&gt; is greater than
+      floor(log_2(max(width, height))) + 1
+
+    After a successful call to any TexStorage* command with a non-proxy
+    target, the value of TEXTURE_IMMUTABLE_FORMAT_EXT for this texture
+    object is set to TRUE, and no further changes to the dimensions or
+    format of the texture object may be made. Other commands may only
+    alter the texel values and texture parameters. Using any of the
+    following commands with the same texture will result in the error
+    INVALID_OPERATION being generated, even if it does not affect the
+    dimensions or format:
+
+        - TexImage*
+        - CompressedTexImage*
+        - CopyTexImage*
+        - TexStorage*
+
+    The TextureStorage* commands operate identically to the
+    corresponding command where &quot;Texture&quot; is substituted for &quot;Tex&quot;
+    except, rather than updating the current bound texture for the
+    texture unit indicated by the current active texture state and the
+    target parameter, these &quot;Texture&quot; commands update the texture object
+    named by the initial texture parameter. The error INVALID_VALUE
+    is generated if &lt;texture&gt; is zero.
+    &quot;
+
+    In section 3.8.6 (Texture Parameters), after the sentence
+
+    &quot;In the remainder of section 3.8, denote by lod_min, lod_max,
+    level_base, and level_max the values of the texture parameters
+    TEXTURE_MIN_LOD, TEXTURE_MAX_LOD, TEXTURE_BASE_LEVEL, and
+    TEXTURE_MAX_LEVEL respectively.&quot;
+
+    add
+
+    &quot;However, if TEXTURE_IMMUTABLE_FORMAT_EXT is
+    TRUE, then level_base is clamped to the range [0, &lt;levels&gt; - 1] and
+    level_max is then clamped to the range [level_base, &lt;levels&gt; - 1],
+    where &lt;levels&gt; is the parameter passed the call to TexStorage* for
+    the texture object.
+
+    In section 3.8.9 (Rendering feedback loops) replace all references
+    to TEXTURE_BASE_LEVEL by level_base.
+
+    In section 3.8.9 (Mipmapping), replace the paragraph starting &quot;Each
+    array in a mipmap is defined...&quot; by
+
+    &quot;Each array in a mipmap is defined using TexImage3D, TexImage2D,
+    CopyTexImage2D, TexImage1D, CopyTexImage1D, or by functions that are
+    defined in terms of these functions. Level-of-detail numbers proceed
+    from level_base for the original texel array through the maximum
+    level p, with each unit increase indicating an array of half the
+    dimensions of the previous one (rounded down to the next integer if
+    fractional) as already described. For immutable-format textures,
+    p is one less than the &lt;levels&gt; parameter passed to TexStorage*;
+    otherwise p = floor(log_2(maxsize)) + level_base.  All arrays from
+    level_base through q = min(p, level_max) must be defined, as
+    discussed in section 3.8.12.&quot;
+
+    In section 3.8.12 (Texture Completeness), modify the last sentence
+    to avoid refering to level_base and level_max:
+
+    &quot;An implementation may allow a texture image array of level 1 or
+    greater to be created only if a mipmap complete set of image arrays
+    consistent with the requested array can be supported where the
+    values of TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL are 0 and 1000
+    respectively.&quot;
+
+    Modify section 3.8.13 (Texture State and Proxy State) to add the new
+    state:
+
+    &quot;Each set consists of ..., and a boolean flag indicating whether the
+    format and dimensions of the texture are immutable.&quot;
+
+    Add
+    &quot;The initial value of TEXTURE_IMMUTABLE_FORMAT_EXT is FALSE.&quot;
+
+Additions to Chapter 4 of the OpenGL 3.2 Core Profile Specification
+(Per-Fragment Operations and the Frame Buffer)
+
+    None
+
+Additions to Chapter 5 of the OpenGL 3.2 Compatibility Profile Specification
+(Special Functions)
+
+    In section 5.4.1 (Commands Not Usable in Display Lists), add
+    TexStorage* to the list of commands that cannot be used.
+
+Additions to Chapter 6 of the OpenGL 3.2 Core Profile Specification
+(State and State Requests)
+
+    Replace the following statement in 6.1.3 (Enumerated Queries):
+
+    &quot;&lt;value&gt; must be one of the symbolic values in table 3.10.&quot;
+
+    with
+
+    &quot;&lt;value&gt; must be TEXTURE_IMMUTABLE_FORMAT_EXT or one of the symbolic
+    values in table 3.22.&quot;
+
+Additions to the AGL/EGL/GLX/WGL Specifications
+
+    None
+
+Additions to OES_compressed_ETC1_RGB8_texture
+
+    Add the following to the additions to Chapter 3:
+
+    &quot;Since ETC1 images are easily edited along 4x4 texel boundaries, the
+    limitations on CompressedTexSubImage2D are relaxed.
+    CompressedTexSubImage2D will result in an INVALID_OPERATION error
+    only if one of the following conditions occurs:
+
+        * &lt;width&gt; is not a multiple of four, and &lt;width&gt; plus &lt;xoffset&gt; is not
+          equal to the texture width;
+
+        * &lt;height&gt; is not a multiple of four, and &lt;height&gt; plus &lt;yoffset&gt; is
+          not equal to the texture height; or
+
+        * &lt;xoffset&gt; or &lt;yoffset&gt; is not a multiple of four.
+
+    Remove CompressedTexSubImage2D from this error:
+
+    &quot;INVALID_OPERATION is generated by CompressedTexSubImage2D,
+    TexSubImage2D, or CopyTexSubImage2D if the texture image &lt;level&gt;
+    bound to &lt;target&gt; has internal format ETC1_RGB8_OES.&quot;
+
+    Add the following error:
+
+    &quot;INVALID_OPERATION is generated by CompressedTexSubImage2D
+    if the region to be modified is not aligned to block boundaries
+    (refer to the extension text for details).&quot;
+
+Additions to AMD_compressed_ATC_texture and AMD_compressed_3DC_texture:
+
+    Apply the same changes as for OES_compressed_ETC1_RGB8_texture
+    above, substituting the appropriate internal format tokens from
+    these extensions.
+
+Dependencies on EXT_direct_state_access
+
+    If EXT_direct_state_access is not present, references to
+    TextureStorage* should be ignored.
+
+Dependencies on OpenGL ES
+
+    On OpenGL ES without extensions introducing TEXTURE_MAX_LEVEL,
+    mipmapped textures specified with TexStorage are required to have a
+    full set of mipmaps. If TEXTURE_MAX_LEVEL is not supported, this
+    extension is modified as follows:
+
+    - Where an upper bound is placed on &lt;levels&gt; in this extension (i.e.
+      the maximum number of mipmap levels for a texture of the given
+      target and dimensions), an INVALID_OPERATION error is generated if
+      &lt;levels&gt; is neither 1 nor this upper bound.
+    - q (the effective maximum number of levels) is redefined to clamp
+      to the number of levels present in immutable-format textures.
+
+    OpenGL ES does not accept sized internal formats (e.g., RGBA8) and
+    instead derives an internal format from the &lt;format&gt; and &lt;type&gt;
+    parameters of TexImage2D. Since TexStorage* does not specify texel
+    data, the API doesn't include &lt;format&gt; and &lt;type&gt; parameters.
+    On an OpenGL ES implementation, the values in the &lt;internalformat&gt;
+    column in the tables below are accepted as &lt;internalformat&gt;
+    parameters, and base internal formats are not accepted. The
+    TexImage* calls in the TexStorage* pseudocode are modified so that
+    the &lt;internalformat&gt;, &lt;format&gt; and &lt;type&gt; parameters are
+    taken from the &lt;format&gt;, &lt;format&gt; and &lt;type&gt; columns (respectively)
+    in the tables below, according to the &lt;internalformat&gt;
+    specified in the TexStorage* command.
+
+        &lt;internalformat&gt;       &lt;format&gt;           &lt;type&gt;
+        ----------------       --------           ------
+        RGB565                 RGB                UNSIGNED_SHORT_5_6_5
+        RGBA4                  RGBA               UNSIGNED_SHORT_4_4_4_4
+        RGB5_A1                RGBA               UNSIGNED_SHORT_5_5_5_1
+        RGB8_OES               RGB                UNSIGNED_BYTE
+        RGBA8_OES              RGBA               UNSIGNED_BYTE
+        LUMINANCE8_ALPHA8_EXT  LUMINANCE_ALPHA    UNSIGNED_BYTE
+        LUMINANCE8_EXT         LUMINANCE          UNSIGNED_BYTE
+        ALPHA8_EXT             ALPHA              UNSIGNED_BYTE
+
+    If OES_depth_texture is supported:
+
+        &lt;internalformat&gt;       &lt;format&gt;           &lt;type&gt;
+        ----------------       --------           ------
+        DEPTH_COMPONENT16_OES  DEPTH_COMPONENT    UNSIGNED_SHORT
+        DEPTH_COMPONENT32_OES  DEPTH_COMPONENT    UNSIGNED_INT
+
+    If OES_packed_depth_stencil is supported:
+
+        &lt;internalformat&gt;       &lt;format&gt;           &lt;type&gt;
+        ----------------       --------           ------
+        DEPTH24_STENCIL8_OES   DEPTH_STENCIL_OES  UNSIGNED_INT
+
+    If OES_texture_float is supported:
+
+        &lt;internalformat&gt;       &lt;format&gt;           &lt;type&gt;
+        ----------------       --------           ------
+        RGBA32F_EXT            RGBA               FLOAT
+        RGB32F_EXT             RGB                FLOAT
+        LUMINANCE_ALPHA32F_EXT LUMINANCE_ALPHA    FLOAT
+        LUMINANCE32F_EXT       LUMINANCE          FLOAT 
+        ALPHA32F_EXT           ALPHA              FLOAT
+
+    If OES_texture_half_float is supported:
+
+        &lt;internalformat&gt;       &lt;format&gt;           &lt;type&gt;
+        ----------------       --------           ------
+        RGBA16F_EXT            RGBA               HALF_FLOAT_OES
+        RGB16F_EXT             RGB                HALF_FLOAT_OES
+        LUMINANCE_ALPHA16F_EXT LUMINANCE_ALPHA    HALF_FLOAT_OES
+        LUMINANCE16F_EXT       LUMINANCE          HALF_FLOAT_OES 
+        ALPHA16F_EXT           ALPHA              HALF_FLOAT_OES
+
+    If EXT_texture_type_2_10_10_10_REV is supported:
+
+        &lt;internalformat&gt;    &lt;format&gt;   &lt;type&gt;
+        ----------------    --------   ------
+        RGB10_A2_EXT        RGBA       UNSIGNED_INT_2_10_10_10_REV_EXT
+        RGB10_EXT           RGB        UNSIGNED_INT_2_10_10_10_REV_EXT
+
+    If EXT_texture_format_BGRA8888 is supported:
+
+        &lt;internalformat&gt;    &lt;format&gt;   &lt;type&gt;
+        ----------------    --------   ------
+        BGRA8_EXT           BGRA_EXT   UNSIGNED_BYTE
+
+
+Dependencies on texture targets
+
+    If a particular texture target is not supported by the
+    implementation, passing it as a &lt;target&gt; to TexStorage* will
+    generate an INVALID_ENUM error. If as a result, any of the commands
+    defined in this extension would no longer have any valid &lt;target&gt;,
+    all references to the command should be ignored.
+
+    In particular, note that OpenGL ES 1.x/2.0 do not have proxy textures,
+    1D textures, or 3D textures, and thus only the TexStorage2DEXT
+    entry point is required. If OES_texture_3D is supported, the
+    TexStorage3DEXT entry point is also required.
+
+Dependencies on OES_texture_npot
+
+    If OpenGL ES 2.0 or APPLE_texture_2D_limited_npot is present but
+    OES_texture_npot is not present, then INVALID_OPERATION is
+    generated by TexStorage* and TexStorage3DEXT if &lt;levels&gt; is
+    not one and &lt;width&gt;, &lt;height&gt; or &lt;depth&gt; is not a power of
+    two.
+
+Dependencies on WGL_ARB_render_texture, GLX_EXT_texture_from_pixmap, EGL
+1.4 and GL_OES_EGL_image
+
+    The commands eglBindTexImage, wglBindTexImageARB, glXBindTexImageEXT or
+    EGLImageTargetTexture2DOES are not permitted on an immutable-format
+    texture.
+    They will generate the following errors:
+      - EGLImageTargetTexture2DOES: INVALID_OPERATION
+      - eglBindTexImage: EGL_BAD_MATCH
+      - wglBindTexImage: ERROR_INVALID_OPERATION
+      - glXBindTexImageEXT: BadMatch
+
+Dependencies on OES_compressed_paletted_texture
+
+    The compressed texture formats exposed by
+    OES_compressed_paletted_texture are not supported by TexStorage*.
+    Passing one of these tokens to TexStorage* will generate an
+    INVALID_ENUM error.
+
+Errors
+
+    Note that dependencies above modify the errors.
+
+    If TexStorage* is called with a &lt;width&gt;, &lt;height&gt;, &lt;depth&gt; or
+    &lt;levels&gt; parameter that is less than one, then the error
+    INVALID_VALUE is generated.
+
+    If the &lt;target&gt; parameter to TexStorage1DEXT is not
+    [PROXY_]TEXTURE_1D, then the error INVALID_ENUM is generated.
+
+    If the &lt;target&gt; parameter to TexStorage2DEXT is not
+    [PROXY_]TEXTURE_2D, [PROXY_]TEXTURE_CUBE_MAP,
+    [PROXY_]TEXTURE_RECTANGLE or [PROXY_]TEXTURE_1D_ARRAY, then the
+    error INVALID_ENUM is generated.
+
+    If the &lt;target&gt; parameter to TexStorage3DEXT is not
+    [PROXY_]TEXTURE_3D, [PROXY_]TEXTURE_2D_ARRAY or
+    [PROXY_]TEXTURE_CUBE_MAP_ARRAY then the error INVALID_ENUM is
+    generated.
+
+    If the &lt;levels&gt; parameter to TexStorage* is greater than the
+    &lt;target&gt;-specific value listed below then the error
+    INVALID_OPERATION is generated:
+        [PROXY_]TEXTURE_{1D,1D_ARRAY}:
+            floor(log_2(width)) + 1
+        [PROXY_]TEXTURE_{2D,2D_ARRAY,CUBE_MAP,CUBE_MAP_ARRAY}:
+            floor(log_2(max(width, height))) + 1
+        [PROXY_]TEXTURE_3D:
+            floor(log_2(max(width, height, depth))) + 1
+        [PROXY_]TEXTURE_RECTANGLE:
+            1
+
+    If the default texture object is bound to the &lt;target&gt; passed to
+    TexStorage*, then the error INVALID_OPERATION is generated.
+
+    If the &lt;target&gt; parameter to TextureStorage* does not match the
+    dimensionality of &lt;texture&gt;, then the error INVALID_OPERATION is
+    generated.
+
+    If the &lt;texture&gt; parameter to TextureStorage* is zero, then the
+    INVALID_VALUE is generated.
+
+    If any pseudo-code listed in this extension would generate an error,
+    then that error is generated.
+
+    Calling any of the following functions on a texture for which
+    TEXTURE_IMMUTABLE_FORMAT_EXT is TRUE will generate an
+    INVALID_OPERATION error:
+        - TexImage*
+        - CompressedTexImage*
+        - CopyTexImage*
+
+New State
+
+    Additions to Table 6.8 Textures (state per texture object)
+
+                                                               Initial
+        Get Value                      Type   Get Command      Value    Description                Sec.
+        ---------                      ----   -----------      -------  -----------                ----
+        TEXTURE_IMMUTABLE_FORMAT_EXT   B      GetTexParameter  FALSE    Size and format immutable  2.6
+
+New Implementation Dependent State
+
+    None
+
+Issues
+
+    1. What should this extension be called?
+
+    RESOLVED: EXT_texture_storage is chosen for consistency with the
+    glRenderbufferStorage entry point.
+
+    2. Should TexStorage* accept a border parameter?
+
+    RESOLVED: no.
+
+    DISCUSSION: Currently it does not, since borders are a deprecated
+    feature which is not supported by all hardware. Users of the
+    compatibility profile can continue to use the existing texture
+    specification functions, but there is an argument that users of
+    compatibility profile may also want to use this extension.
+
+    3. What is the correct error when &lt;levels&gt; specifies a partial
+    mipmap pyramid for OpenGL ES?
+
+    RESOLVED: INVALID_OPERATION, since it is an interaction between
+    parameters rather than a single value being invalid. It also makes
+    sense to relax this condition for desktop GL where it makes sense to
+    use a truncated pyramid with TEXTURE_MAX_LEVEL.
+
+    4. Should use of these entry-points make the metadata (format and
+    dimensions) immutable?
+
+    RESOLVED: Yes.
+
+    DISCUSSION: The benefits of knowing metadata can't change will
+    probably outweigh the extra cost of checking the
+    TEXTURE_IMMUTABLE_FORMAT_EXT flag on each texture specification
+    call.
+
+    5. Should it be legal to completely replace the texture using a new call
+    to TexStorage*?
+
+    RESOLVED. It will not be allowed.
+
+    DISCUSSION: This is useful to invalidate all levels of a texture.
+    Allowing the metadata to be changed here seems easier than trying to
+    define a portable definition of what it means to change the metadata
+    (e.g. what if you used an unsized internal format the first time and
+    the corresponding sized internal format the second time, or vice
+    versa)?
+
+    However, while this is largely similar to deleting the old texture
+    object and replacing it with a new one, it does lose some of the
+    advantages of immutability. Specifically, because doing so does not
+    reset bindings, it doesn't allow a migration path to an API that
+    validates the texture format at bind time.
+
+    6. Should it be legal to use TexImage* after TexStorage* if it doesn't
+    affect the metadata?
+
+    RESOLVED: No.
+
+    DISCUSSION: A potential use case is to allow a single level of a
+    texture to be invalidated using a NULL pointer. However, as noted
+    above it is non-trivial to determine what constitutes a change.
+
+    7. How does this extension interact with APPLE_texture_2D_limited_npot?
+
+    RESOLVED. APPLE_texture_2D_limited_npot is equivalent to the NPOT
+    support in OpenGL ES 2.0.
+
+    8. Should this extension be written to work with desktop OpenGL?
+
+    RESOLVED: Yes.
+
+    DISCUSSION: There has been been interest and it will future-proof it
+    against further additions to OpenGL ES.
+
+    9. Which texture targets should be supported?
+
+    RESOLVED. All targets except multisample and buffer textures are
+    supported.
+
+    Initially all targets except TEXTURE_BUFFER were supported. It was
+    noted that the entrypoints for multisample targets added no useful
+    functionality, since multisample textures have no completeness
+    checks beyond being non-empty.
+
+    Rectangle textures have completeness checks to prevent filtering of
+    integer textures. However, since we decided to only force mipmap
+    completeness, this becomes less useful.
+
+    10. Should this extension support proxy textures?
+
+    RESOLVED: Yes.
+
+    DISCUSSION: It should be orthogonal.
+
+    11. Are the &lt;format&gt; and &lt;type&gt; parameters necessary?
+
+    RESOLVED. No, they will be removed.
+
+    DISCUSSION: For OpenGL ES the type parameter was necessary to
+    determine the precision of the texture, but this can be solved by
+    having these functions accept sized internal formats (which are
+    already accepted by renderbuffers).
+
+    12. Should it be legal to make the default texture (id 0)
+    immutable-format?
+
+    RESOLVED: No.
+
+    DISCUSSION: This would make it impossible to restore the context to
+    it's default state, which is deemed undesirable. There is no good
+    reason not to use named texture objects.
+
+    13. Should we try to guarantee that textures made through this path
+    will always be complete?
+
+    RESOLVED: It should be guaranteed that the texture will be mipmap
+    complete.
+
+    DISCUSSION: Future separation between images and samplers will still
+    allow users to create combinations that are invalid, but
+    constraining the simple cases will make these APIs easier to use for
+    beginners.
+
+    14. Should these functions use a EXT_direct_state_access approach to
+    specifying the texture objects?
+
+    UNRESOLVED.
+
+    DISCUSSION: as a standalone extension, no DSA-like functions will be
+    added. However, interactions with EXT_direct_state_access and
+    ARB_direct_state_access need to be resolved.
+
+    15. Should these functions accept generic compressed formats?
+
+    RESOLVED: Yes. Note that the spec language will need to be modified
+    to allow this for ES, since the pseudocode is written in terms of
+    TexImage2D, which does not allow compressed texture formats in ES.
+    See also issues 23 and 27.
+
+    16. How should completeness be forced when TEXTURE_MAX_LEVEL is not
+    present?
+
+    RESOLVED. The maximum level q will be redefined to clamp to the
+    highest level available.
+
+    DISCUSSION: A single-level texture can be made complete either by
+    making it mipmap complete (by setting TEXTURE_MAX_LEVEL to 0) or by
+    turning off mipmapping (by choose an appropriate minification
+    filter).
+
+    Some options:
+
+    A: Specify that TexStorage* changes the default minification filter
+    for OpenGL ES. This makes it awkward to add TEXTURE_MAX_LEVEL
+    support to OpenGL ES later, since switching to match GL would break
+    compatibility. The two mechanisms also do not give identical
+    results, since the magnification threshold depends on the
+    minification filter.
+
+    B: Specify that the texture behaves as though TEXTURE_MAX_LEVEL were
+    zero. To specify this properly probably requires fairly intrusive
+    changes to the OpenGL ES full specification to add back all the
+    language relating to the max level. It also does not solve the
+    similar problem of what to do with NPOT textures; and it may have
+    hardware impacts due to the change in the min/mag crossover.
+
+    C: Specify that TexStorage* changes the default minification filter
+    for all implementations when a single-level texture is specified.
+    This may be slightly counter-intuitive to desktop GL users, but will
+    give consistent behaviour across variants of GL and avoids changing
+    the functional behaviour of this extension based on the presence or
+    absence of some other feature.
+
+    Currently B is specified. This has potential hardware implications
+    for OpenGL ES because of the effect of the minification filter on
+    the min/mag crossover. However, C has potential hardware implications
+    for OpenGL due to the separation of texture and sampler state.
+
+    17. How should completeness be forced when only ES2-style NPOT is
+    available?
+
+    RESOLVED. It is not worth trying to do this, in light of issue 13.
+
+    Previous revisions of this extension overrode the minification
+    filter and wrap modes, but that is no longer the case. Since
+    OES_texture_npot removes the caveats on NPOT textures anyway, it
+    might not be worth trying to &quot;fix&quot; this.
+
+    18. For OpenGL ES, how do the new sized internal formats interact
+    with OES_required_internal_format?
+
+    RESOLVED.
+
+    If OES_required_internal_format is not present, then the
+    &lt;internalformat&gt; parameter is intended merely to indicate what the
+    corresponding &lt;format&gt; and &lt;type&gt; would have been, had TexImage*
+    been used instead. If OES_required_internal_format is present, then
+    it is intended that the &lt;internalformat&gt; will be interpreted as if
+    it had been passed directly to TexImage*.
+
+    19. Should there be some hinting mechanism to indicate whether data
+    is coming immediately or later?
+
+    RESOLVED. No parameter is needed. An extension can be added to provide
+    a TexParameter value which is latched at TexStorage time.
+
+    DISCUSSION: Some members felt that this would be useful so that they
+    could defer allocation when suitable, particularly if higher-
+    resolution images will be streamed in later; or to choose a memory
+    type or layout appropriate to the usage. However, implementation
+    experience with BufferData is that developers frequently provide
+    wrong values and implementations have to guess anyway.
+
+    One option suggested was the &lt;usage&gt; parameter currently passed to
+    BufferData. Another option was to set it with TexParameter.
+
+    20. How should this extension interact with
+    EGLImageTargetTexture2DOES, eglBindTexImage, glXBindTexImage and
+    wglBindTexImage?
+
+    RESOLVED. These functions will not be permitted after glTexStorage*.
+
+    Several options are possible:
+
+    A) Disallow these functions.
+    B) Allow them, but have them reset the TEXTURE_IMMUTABLE_FORMAT_EXT
+       flag.
+    C) Allow them unconditionally.
+
+    C would violate the design principle that the dimensions and format
+    of the mipmap array are immutable. B does not so much modify the
+    dimension and formats as replace them with an entirely different
+    set.
+
+    21. Should there be a single function for specifying 1D, 2D and 3D
+    targets?
+
+    RESOLVED. No, we will stick with existing precedent.
+
+    22. Is it possible to use GenerateMipmap with an incomplete mipmap
+    pyramid?
+
+    RESOLVED. Yes, because the effective max level is limited to the
+    levels that were specified, and so GenerateMipmap does not generate
+    any new levels.
+
+    However, to make automatic mipmap generation work, it is necessary
+    to redefine p rather than q, since automatic mipmap generation
+    ignores the max level.
+
+    23. How should this extension interact with
+    OES_compressed_paletted_texture?
+
+    RESOLVED. Paletted textures will not be permitted, and will
+    generate INVALID_ENUM.
+
+    DISCUSSION: OES_compressed_paletted_texture supplies all the mipmaps
+    in a single function call, with the palette specified once. That's
+    incompatible with the upload model in this extension.
+
+    24. How can ETC1 textures be used with this extension?
+
+    RESOLVED. Add language in this extension to allow subregion uploads
+    for ETC1.
+
+    DISCUSSION: GL_OES_compressed_ETC1_RGB8_texture doesn't allow
+    CompressedTexSubImage*, so it would be impossible to use this
+    extension with ETC1. This is seen as an oversight in the ETC1
+    extension. While it cannot be fixed in that extension (since it is
+    already shipping), this extension can add that capability.
+
+    25. Should any other compressed formats be similarly modified?
+
+    RESOLVED. Yes, AMD_compressed_ATC_texture and
+    AMD_compressed_3DC_texture can be modified similarly to ETC1
+    (Maurice Ribble indicated that both formats use 4x4 blocks). Desktop
+    OpenGL requires that whole-image replacement is supported for any
+    compressed texture format, and the OpenGL ES extensions
+    EXT_texture_compression_dxt1 and IMG_texture_compression_pvrtc
+    already allow whole-image replacement, so it is not necessary to
+    modify them to be used with this extension.
+
+    26. Should these commands be permitted in display lists?
+
+    RESOLVED. No.
+
+    DISCUSSION: Display lists are most useful for repeating commands,
+    and TexStorage* commands cannot be repeated because the first call
+    makes the format immutable.
+
+    27. Should these commands accept unsized internal formats?
+
+    RESOLVED: No, for both OpenGL and OpenGL ES.
+
+    DISCUSSION: normally the &lt;type&gt; parameter to TexImage* can serve as
+    a hint to select a sized format (and in OpenGL ES, this is the only
+    mechanism available); since TexStorage* does not have a &lt;type&gt;
+    parameter, the implementation has no information on which to base a
+    decision.
+
+Revision History
+
+    Revision 24, 2011/11/11 (dgkoch)
+      - Mark complete. Clarify ES clarifications.
+
+    Revision 23, 2011/11/10 (dgkoch)
+      - Add GLES clarifcations and interactions with more GLES extensions
+
+    Revision 22, 2011/11/10 (bmerry)
+      - Update my contact details
+
+    Revision 21, 2011/07/25 (bmerry)
+      - Remove dangling references to MultiTexStorage in Errors section
+
+    Revision 20, 2011/07/21 (bmerry)
+      - Remove dangling reference to &lt;samples&gt; in Errors section
+
+    Revision 19, 2011/05/02 (Jon Leech)
+      - Assign enum value
+
+    Revision 18, 2011/01/24 (bmerry)
+      - Disallow unsized internal formats (oversight in revision 17).
+
+    Revision 17, 2011/01/24 (bmerry)
+      - Added and resolved issue 26.
+      - Split issue 27 out from issue 15.
+      - Disallow TexStorage* in display lists.
+      - Use the term &quot;immutable-format&quot; consistently (bug 7281).
+
+    Revision 16, 2010/11/23 (bmerry)
+      - Disallowed TexStorage on an immutable-format texture
+        (resolves issue 5).
+      - Deleted MultiTexStorage* commands (other DSA functions still
+        unresolved).
+      - Some minor wording changes suggested by Pat Brown (bug 7002).
+
+    Revision 15, 2010/11/09 (bmerry)
+      - Reopened issue 5.
+      - Reopened issue 14, pending stabilisation of
+        ARB_direct_state_access.
+      - Marked issue 9 resolved, pending any objections.
+      - Fix references to no object being bound (was meant to refer to
+        the default object).
+      - Adding missing pseudocode for TEXTURE_1D_ARRAY.
+      - Corrected TEXTURE_2D_ARRAY -&gt; TEXTURE_1D_ARRAY in error checks.
+      - Changed &quot;levels... are removed&quot; to &quot;levels... are reset to their
+        init state&quot;, since desktop GL has per-level state apart from the
+        texels.
+      - Miscellaneous wording fixes.
+
+    Revision 14, 2010/09/25 (bmerry)
+      - Add issues 24-25 and alterations to
+        OES_compressed_ETC1_RGB8_texture, AMD_compressed_ATC_texture and
+        AMD_compressed_3DC_texture.
+
+    Revision 13, 2010/09/19 (bmerry)
+      - Two typo fixes from Daniel Koch
+
+    Revision 12, 2010/09/18 (bmerry)
+      - Changed resolution to issue 20
+      - Added and resolved issue 23
+      - Added explanation of how to upload data (in overview)
+      - Added spec language to implement resolution to issue 15
+
+    Revision 11, 2010/07/21 (bmerry)
+      - Resolved issue 16
+      - Reopen issue 20
+      - Fix some typos
+
+    Revision 10, 2010/07/15 (bmerry)
+      - Update some issues to match core text
+      - Resolved issue 17
+
+    Revision 9, 2010/05/24 (bmerry)
+      - Marked issue 2 as resolved
+      - Resolved issue 19 (as no change)
+      - Resolved issue 20
+      - Add issues 21-22
+      - Add in spec language to forbid use on default textures
+      - Redefine level_base, level_max to be clamped forms of
+        TEXTURE_BASE_LEVEL/TEXTURE_MAX_LEVEL when using immutable
+        textures
+      - Redefine p to also be clamped to the provided levels for
+        immutable textures, to support automatic mipmap generation
+      - Removed multisample functions
+      - Removed language stating that texture parameters were reset to
+        defaults
+
+    Revision 8, 2010/05/18 (bmerry)
+      - Added issue about EGLimage
+      - Marked issue 14 as resolved
+
+    Revision 7, 2010/05/04 (bmerry)
+      - Removed some lingering &lt;format&gt;, &lt;type&gt; parameters to the new
+        functions that should have been removed in revision 4
+      - Trivial typo fixes
+
+    Revision 6, 2010/02/18 (bmerry)
+      - Resolved issues 5, 6 and 18
+      - Added MultiTexStorage* functions for DSA interaction
+      - Added error for texture-target mismatch in DSA
+      - Allowed TexStorage* to be called again
+
+    Revision 5, 2010/01/25 (bmerry)
+      - Added to contributors list
+      - Require OpenGL 1.2, to simplify interactions with
+        TEXTURE_BASE_LEVEL/TEXTURE_MAX_LEVEL and CLAMP_TO_EDGE
+      - Change default wrap modes to always be CLAMP_TO_EDGE
+      - Change default filters to always be NEAREST
+      - Moved language about generating new levels into an interaction,
+        since it can only happen on OpenGL ES
+      - Added interaction with EXT_direct_state_access
+      - Added extra &lt;internalformats&gt; for GL ES when OES_depth_texture,
+        OES_packed_depth_stencil and EXT_texture_type_2_10_10_10_REV are
+        present.
+      - Minor non-functional wording fixes and typos
+      - Resolved issue 16
+      - Added issues 17-19
+
+    Revision 4, 2010/01/13 (bmerry)
+      - Changed suffix from ARM to EXT
+      - Added list of contributors
+      - Added language to force the texture to always be complete
+      - Removed &lt;format&gt; and &lt;type&gt; arguments
+      - Added issues 14-16
+      - Reopened issue 2
+      - Reformatted issues to separate resolution and discussion
+      - Resolved issues 1, 9 and 11-13
+      - Fixed the max number of levels in a cube map array
+
+    Revision 3, 2009/12/17 (bmerry)
+      - Added missing vendor suffix to TEXTURE_IMMUTABLE_FORMAT_ARM
+      - Rewritten to against desktop OpenGL
+      - Added prototypes for 1D and multisample storage functions
+      - Added issues 8-13
+
+    Revision 2, 2009/08/20 (bmerry)
+      - Resolved issue 2 (no border parameter)
+      - Resolved issue 4 (metadata becomes immutable)
+      - Added interaction with OES_texture_cube_map
+      - Added error if width != height in a cube map
+      - Added issues 5-7
+
+    Revision 1, 2009/05/06 (bmerry)
+      - First draft
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEgenerate_winrt_projectspy"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/generate_winrt_projects.py (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/generate_winrt_projects.py                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/generate_winrt_projects.py        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+# Copyright (c) 2013-2014 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 script generates visual studio projects that can be used on WinRT
+
+import os
+import sys
+
+script_dir = os.path.join(os.path.dirname(__file__), 'build')
+angle_dir = os.path.normpath(os.path.join(script_dir, os.pardir))
+gyp_dir = os.path.join(angle_dir, 'third_party', 'gyp')
+
+gyp_generators = &quot;msvs&quot;
+msvs_version = &quot;2013e&quot;
+
+def generateProjects(generation_dir, build_winphone):
+    gyp_cmd = os.path.join(gyp_dir, 'gyp')
+    gyp_cmd += ' --ignore-environment'
+    gyp_cmd += ' --depth=.'
+    gyp_cmd += ' --include=' + os.path.join(script_dir, 'common.gypi')
+    gyp_cmd += ' --generator-output=' + generation_dir
+    gyp_cmd += ' --format=' + gyp_generators
+    gyp_cmd += ' -G msvs_version=' + msvs_version
+    gyp_cmd += ' -D angle_use_commit_id=0'
+    gyp_cmd += ' -D angle_build_winrt=1'
+    gyp_cmd += ' -D angle_build_winphone=' + ('1' if build_winphone else '0')
+    gyp_cmd += ' -D angle_enable_d3d9=0'
+    gyp_cmd += ' -D angle_enable_gl=0'
+    gyp_cmd += ' -D angle_standalone=1'
+    gyp_cmd += ' ' + os.path.join(script_dir, 'angle.gyp')
+
+    print 'Generating projects to ' + generation_dir + ' from gyp files...'
+    print gyp_cmd
+    sys.stdout.flush()
+    os.system(gyp_cmd)
+
+if __name__ == '__main__':
+    # Generate Windows 8.1 projects
+    generateProjects(&quot;winrt/8.1/windows&quot;, False);
+    generateProjects(&quot;winrt/8.1/windowsphone&quot;, True);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeEGLeglh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/EGL/egl.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/EGL/egl.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/include/EGL/egl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,11 +1,12 @@
</span><del>-/* -*- mode: c; tab-width: 8; -*- */
-/* vi: set sw=4 ts=8: */
-/* Reference version of egl.h for EGL 1.4.
- * $Revision: 9356 $ on $Date: 2009-10-21 05:52:25 -0400 (Wed, 21 Oct 2009) $
- */
</del><ins>+#ifndef __egl_h_
+#define __egl_h_ 1
</ins><span class="cx"> 
</span><ins>+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
</ins><span class="cx"> /*
</span><del>-** Copyright (c) 2007-2009 The Khronos Group Inc.
</del><ins>+** Copyright (c) 2013-2014 The Khronos Group Inc.
</ins><span class="cx"> **
</span><span class="cx"> ** Permission is hereby granted, free of charge, to any person obtaining a
</span><span class="cx"> ** copy of this software and/or associated documentation files (the
</span><span class="lines">@@ -26,310 +27,277 @@
</span><span class="cx"> ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
</span><span class="cx"> ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
</span><span class="cx"> */
</span><ins>+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 29318 $ on $Date: 2015-01-02 03:16:10 -0800 (Fri, 02 Jan 2015) $
+*/
</ins><span class="cx"> 
</span><del>-#ifndef __egl_h_
-#define __egl_h_
-
-/* All platform-dependent types and macro boilerplate (such as EGLAPI
- * and EGLAPIENTRY) should go in eglplatform.h.
- */
</del><span class="cx"> #include &lt;EGL/eglplatform.h&gt;
</span><span class="cx"> 
</span><del>-#ifdef __cplusplus
-extern &quot;C&quot; {
-#endif
</del><ins>+/* Generated on date 20150102 */
</ins><span class="cx"> 
</span><del>-/* EGL Types */
-/* EGLint is defined in eglplatform.h */
</del><ins>+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
</ins><span class="cx"> typedef unsigned int EGLBoolean;
</span><del>-typedef unsigned int EGLenum;
-typedef void *EGLConfig;
-typedef void *EGLContext;
</del><span class="cx"> typedef void *EGLDisplay;
</span><ins>+#include &lt;KHR/khrplatform.h&gt;
+#include &lt;EGL/eglplatform.h&gt;
+typedef void *EGLConfig;
</ins><span class="cx"> typedef void *EGLSurface;
</span><del>-typedef void *EGLClientBuffer;
</del><ins>+typedef void *EGLContext;
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+#define EGL_ALPHA_SIZE                    0x3021
+#define EGL_BAD_ACCESS                    0x3002
+#define EGL_BAD_ALLOC                     0x3003
+#define EGL_BAD_ATTRIBUTE                 0x3004
+#define EGL_BAD_CONFIG                    0x3005
+#define EGL_BAD_CONTEXT                   0x3006
+#define EGL_BAD_CURRENT_SURFACE           0x3007
+#define EGL_BAD_DISPLAY                   0x3008
+#define EGL_BAD_MATCH                     0x3009
+#define EGL_BAD_NATIVE_PIXMAP             0x300A
+#define EGL_BAD_NATIVE_WINDOW             0x300B
+#define EGL_BAD_PARAMETER                 0x300C
+#define EGL_BAD_SURFACE                   0x300D
+#define EGL_BLUE_SIZE                     0x3022
+#define EGL_BUFFER_SIZE                   0x3020
+#define EGL_CONFIG_CAVEAT                 0x3027
+#define EGL_CONFIG_ID                     0x3028
+#define EGL_CORE_NATIVE_ENGINE            0x305B
+#define EGL_DEPTH_SIZE                    0x3025
+#define EGL_DONT_CARE                     ((EGLint)-1)
+#define EGL_DRAW                          0x3059
+#define EGL_EXTENSIONS                    0x3055
+#define EGL_FALSE                         0
+#define EGL_GREEN_SIZE                    0x3023
+#define EGL_HEIGHT                        0x3056
+#define EGL_LARGEST_PBUFFER               0x3058
+#define EGL_LEVEL                         0x3029
+#define EGL_MAX_PBUFFER_HEIGHT            0x302A
+#define EGL_MAX_PBUFFER_PIXELS            0x302B
+#define EGL_MAX_PBUFFER_WIDTH             0x302C
+#define EGL_NATIVE_RENDERABLE             0x302D
+#define EGL_NATIVE_VISUAL_ID              0x302E
+#define EGL_NATIVE_VISUAL_TYPE            0x302F
+#define EGL_NONE                          0x3038
+#define EGL_NON_CONFORMANT_CONFIG         0x3051
+#define EGL_NOT_INITIALIZED               0x3001
+#define EGL_NO_CONTEXT                    ((EGLContext)0)
+#define EGL_NO_DISPLAY                    ((EGLDisplay)0)
+#define EGL_NO_SURFACE                    ((EGLSurface)0)
+#define EGL_PBUFFER_BIT                   0x0001
+#define EGL_PIXMAP_BIT                    0x0002
+#define EGL_READ                          0x305A
+#define EGL_RED_SIZE                      0x3024
+#define EGL_SAMPLES                       0x3031
+#define EGL_SAMPLE_BUFFERS                0x3032
+#define EGL_SLOW_CONFIG                   0x3050
+#define EGL_STENCIL_SIZE                  0x3026
+#define EGL_SUCCESS                       0x3000
+#define EGL_SURFACE_TYPE                  0x3033
+#define EGL_TRANSPARENT_BLUE_VALUE        0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE       0x3036
+#define EGL_TRANSPARENT_RED_VALUE         0x3037
+#define EGL_TRANSPARENT_RGB               0x3052
+#define EGL_TRANSPARENT_TYPE              0x3034
+#define EGL_TRUE                          1
+#define EGL_VENDOR                        0x3053
+#define EGL_VERSION                       0x3054
+#define EGL_WIDTH                         0x3057
+#define EGL_WINDOW_BIT                    0x0004
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
+EGLAPI EGLint EGLAPIENTRY eglGetError (void);
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
+#endif /* EGL_VERSION_1_0 */
</ins><span class="cx"> 
</span><del>-/* EGL Versioning */
-#define EGL_VERSION_1_0                        1
-#define EGL_VERSION_1_1                        1
-#define EGL_VERSION_1_2                        1
-#define EGL_VERSION_1_3                        1
-#define EGL_VERSION_1_4                        1
</del><ins>+#ifndef EGL_VERSION_1_1
+#define EGL_VERSION_1_1 1
+#define EGL_BACK_BUFFER                   0x3084
+#define EGL_BIND_TO_TEXTURE_RGB           0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA          0x303A
+#define EGL_CONTEXT_LOST                  0x300E
+#define EGL_MIN_SWAP_INTERVAL             0x303B
+#define EGL_MAX_SWAP_INTERVAL             0x303C
+#define EGL_MIPMAP_TEXTURE                0x3082
+#define EGL_MIPMAP_LEVEL                  0x3083
+#define EGL_NO_TEXTURE                    0x305C
+#define EGL_TEXTURE_2D                    0x305F
+#define EGL_TEXTURE_FORMAT                0x3080
+#define EGL_TEXTURE_RGB                   0x305D
+#define EGL_TEXTURE_RGBA                  0x305E
+#define EGL_TEXTURE_TARGET                0x3081
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
+#endif /* EGL_VERSION_1_1 */
</ins><span class="cx"> 
</span><del>-/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
- * enums are assigned unique values starting at 0x3000.
- */
</del><ins>+#ifndef EGL_VERSION_1_2
+#define EGL_VERSION_1_2 1
+typedef unsigned int EGLenum;
+typedef void *EGLClientBuffer;
+#define EGL_ALPHA_FORMAT                  0x3088
+#define EGL_ALPHA_FORMAT_NONPRE           0x308B
+#define EGL_ALPHA_FORMAT_PRE              0x308C
+#define EGL_ALPHA_MASK_SIZE               0x303E
+#define EGL_BUFFER_PRESERVED              0x3094
+#define EGL_BUFFER_DESTROYED              0x3095
+#define EGL_CLIENT_APIS                   0x308D
+#define EGL_COLORSPACE                    0x3087
+#define EGL_COLORSPACE_sRGB               0x3089
+#define EGL_COLORSPACE_LINEAR             0x308A
+#define EGL_COLOR_BUFFER_TYPE             0x303F
+#define EGL_CONTEXT_CLIENT_TYPE           0x3097
+#define EGL_DISPLAY_SCALING               10000
+#define EGL_HORIZONTAL_RESOLUTION         0x3090
+#define EGL_LUMINANCE_BUFFER              0x308F
+#define EGL_LUMINANCE_SIZE                0x303D
+#define EGL_OPENGL_ES_BIT                 0x0001
+#define EGL_OPENVG_BIT                    0x0002
+#define EGL_OPENGL_ES_API                 0x30A0
+#define EGL_OPENVG_API                    0x30A1
+#define EGL_OPENVG_IMAGE                  0x3096
+#define EGL_PIXEL_ASPECT_RATIO            0x3092
+#define EGL_RENDERABLE_TYPE               0x3040
+#define EGL_RENDER_BUFFER                 0x3086
+#define EGL_RGB_BUFFER                    0x308E
+#define EGL_SINGLE_BUFFER                 0x3085
+#define EGL_SWAP_BEHAVIOR                 0x3093
+#define EGL_UNKNOWN                       ((EGLint)-1)
+#define EGL_VERTICAL_RESOLUTION           0x3091
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
+#endif /* EGL_VERSION_1_2 */
</ins><span class="cx"> 
</span><del>-/* EGL aliases */
-#define EGL_FALSE                        0
-#define EGL_TRUE                        1
</del><ins>+#ifndef EGL_VERSION_1_3
+#define EGL_VERSION_1_3 1
+#define EGL_CONFORMANT                    0x3042
+#define EGL_CONTEXT_CLIENT_VERSION        0x3098
+#define EGL_MATCH_NATIVE_PIXMAP           0x3041
+#define EGL_OPENGL_ES2_BIT                0x0004
+#define EGL_VG_ALPHA_FORMAT               0x3088
+#define EGL_VG_ALPHA_FORMAT_NONPRE        0x308B
+#define EGL_VG_ALPHA_FORMAT_PRE           0x308C
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT       0x0040
+#define EGL_VG_COLORSPACE                 0x3087
+#define EGL_VG_COLORSPACE_sRGB            0x3089
+#define EGL_VG_COLORSPACE_LINEAR          0x308A
+#define EGL_VG_COLORSPACE_LINEAR_BIT      0x0020
+#endif /* EGL_VERSION_1_3 */
</ins><span class="cx"> 
</span><del>-/* Out-of-band handle values */
-#define EGL_DEFAULT_DISPLAY                ((EGLNativeDisplayType)0)
-#define EGL_NO_CONTEXT                        ((EGLContext)0)
-#define EGL_NO_DISPLAY                        ((EGLDisplay)0)
-#define EGL_NO_SURFACE                        ((EGLSurface)0)
</del><ins>+#ifndef EGL_VERSION_1_4
+#define EGL_VERSION_1_4 1
+#define EGL_DEFAULT_DISPLAY               ((EGLNativeDisplayType)0)
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT   0x0200
+#define EGL_MULTISAMPLE_RESOLVE           0x3099
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT   0x309A
+#define EGL_MULTISAMPLE_RESOLVE_BOX       0x309B
+#define EGL_OPENGL_API                    0x30A2
+#define EGL_OPENGL_BIT                    0x0008
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT   0x0400
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
+#endif /* EGL_VERSION_1_4 */
</ins><span class="cx"> 
</span><del>-/* Out-of-band attribute value */
-#define EGL_DONT_CARE                        ((EGLint)-1)
</del><ins>+#ifndef EGL_VERSION_1_5
+#define EGL_VERSION_1_5 1
+typedef void *EGLSync;
+typedef intptr_t EGLAttrib;
+typedef khronos_utime_nanoseconds_t EGLTime;
+typedef void *EGLImage;
+#define EGL_CONTEXT_MAJOR_VERSION         0x3098
+#define EGL_CONTEXT_MINOR_VERSION         0x30FB
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK   0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
+#define EGL_NO_RESET_NOTIFICATION         0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET         0x31BF
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define EGL_CONTEXT_OPENGL_DEBUG          0x31B0
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS  0x31B2
+#define EGL_OPENGL_ES3_BIT                0x00000040
+#define EGL_CL_EVENT_HANDLE               0x309C
+#define EGL_SYNC_CL_EVENT                 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE        0x30FF
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE  0x30F0
+#define EGL_SYNC_TYPE                     0x30F7
+#define EGL_SYNC_STATUS                   0x30F1
+#define EGL_SYNC_CONDITION                0x30F8
+#define EGL_SIGNALED                      0x30F2
+#define EGL_UNSIGNALED                    0x30F3
+#define EGL_SYNC_FLUSH_COMMANDS_BIT       0x0001
+#define EGL_FOREVER                       0xFFFFFFFFFFFFFFFFull
+#define EGL_TIMEOUT_EXPIRED               0x30F5
+#define EGL_CONDITION_SATISFIED           0x30F6
+#define EGL_NO_SYNC                       ((EGLSync)0)
+#define EGL_SYNC_FENCE                    0x30F9
+#define EGL_GL_COLORSPACE                 0x309D
+#define EGL_GL_COLORSPACE_SRGB            0x3089
+#define EGL_GL_COLORSPACE_LINEAR          0x308A
+#define EGL_GL_RENDERBUFFER               0x30B9
+#define EGL_GL_TEXTURE_2D                 0x30B1
+#define EGL_GL_TEXTURE_LEVEL              0x30BC
+#define EGL_GL_TEXTURE_3D                 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET            0x30BD
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
+#define EGL_IMAGE_PRESERVED               0x30D2
+#define EGL_NO_IMAGE                      ((EGLImage)0)
+EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
+#endif /* EGL_VERSION_1_5 */
</ins><span class="cx"> 
</span><del>-/* Errors / GetError return values */
-#define EGL_SUCCESS                        0x3000
-#define EGL_NOT_INITIALIZED                0x3001
-#define EGL_BAD_ACCESS                        0x3002
-#define EGL_BAD_ALLOC                        0x3003
-#define EGL_BAD_ATTRIBUTE                0x3004
-#define EGL_BAD_CONFIG                        0x3005
-#define EGL_BAD_CONTEXT                        0x3006
-#define EGL_BAD_CURRENT_SURFACE                0x3007
-#define EGL_BAD_DISPLAY                        0x3008
-#define EGL_BAD_MATCH                        0x3009
-#define EGL_BAD_NATIVE_PIXMAP                0x300A
-#define EGL_BAD_NATIVE_WINDOW                0x300B
-#define EGL_BAD_PARAMETER                0x300C
-#define EGL_BAD_SURFACE                        0x300D
-#define EGL_CONTEXT_LOST                0x300E        /* EGL 1.1 - IMG_power_management */
-
-/* Reserved 0x300F-0x301F for additional errors */
-
-/* Config attributes */
-#define EGL_BUFFER_SIZE                        0x3020
-#define EGL_ALPHA_SIZE                        0x3021
-#define EGL_BLUE_SIZE                        0x3022
-#define EGL_GREEN_SIZE                        0x3023
-#define EGL_RED_SIZE                        0x3024
-#define EGL_DEPTH_SIZE                        0x3025
-#define EGL_STENCIL_SIZE                0x3026
-#define EGL_CONFIG_CAVEAT                0x3027
-#define EGL_CONFIG_ID                        0x3028
-#define EGL_LEVEL                        0x3029
-#define EGL_MAX_PBUFFER_HEIGHT                0x302A
-#define EGL_MAX_PBUFFER_PIXELS                0x302B
-#define EGL_MAX_PBUFFER_WIDTH                0x302C
-#define EGL_NATIVE_RENDERABLE                0x302D
-#define EGL_NATIVE_VISUAL_ID                0x302E
-#define EGL_NATIVE_VISUAL_TYPE                0x302F
-#define EGL_SAMPLES                        0x3031
-#define EGL_SAMPLE_BUFFERS                0x3032
-#define EGL_SURFACE_TYPE                0x3033
-#define EGL_TRANSPARENT_TYPE                0x3034
-#define EGL_TRANSPARENT_BLUE_VALUE        0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE        0x3036
-#define EGL_TRANSPARENT_RED_VALUE        0x3037
-#define EGL_NONE                        0x3038        /* Attrib list terminator */
-#define EGL_BIND_TO_TEXTURE_RGB                0x3039
-#define EGL_BIND_TO_TEXTURE_RGBA        0x303A
-#define EGL_MIN_SWAP_INTERVAL                0x303B
-#define EGL_MAX_SWAP_INTERVAL                0x303C
-#define EGL_LUMINANCE_SIZE                0x303D
-#define EGL_ALPHA_MASK_SIZE                0x303E
-#define EGL_COLOR_BUFFER_TYPE                0x303F
-#define EGL_RENDERABLE_TYPE                0x3040
-#define EGL_MATCH_NATIVE_PIXMAP                0x3041        /* Pseudo-attribute (not queryable) */
-#define EGL_CONFORMANT                        0x3042
-
-/* Reserved 0x3041-0x304F for additional config attributes */
-
-/* Config attribute values */
-#define EGL_SLOW_CONFIG                        0x3050        /* EGL_CONFIG_CAVEAT value */
-#define EGL_NON_CONFORMANT_CONFIG        0x3051        /* EGL_CONFIG_CAVEAT value */
-#define EGL_TRANSPARENT_RGB                0x3052        /* EGL_TRANSPARENT_TYPE value */
-#define EGL_RGB_BUFFER                        0x308E        /* EGL_COLOR_BUFFER_TYPE value */
-#define EGL_LUMINANCE_BUFFER                0x308F        /* EGL_COLOR_BUFFER_TYPE value */
-
-/* More config attribute values, for EGL_TEXTURE_FORMAT */
-#define EGL_NO_TEXTURE                        0x305C
-#define EGL_TEXTURE_RGB                        0x305D
-#define EGL_TEXTURE_RGBA                0x305E
-#define EGL_TEXTURE_2D                        0x305F
-
-/* Config attribute mask bits */
-#define EGL_PBUFFER_BIT                        0x0001        /* EGL_SURFACE_TYPE mask bits */
-#define EGL_PIXMAP_BIT                        0x0002        /* EGL_SURFACE_TYPE mask bits */
-#define EGL_WINDOW_BIT                        0x0004        /* EGL_SURFACE_TYPE mask bits */
-#define EGL_VG_COLORSPACE_LINEAR_BIT        0x0020        /* EGL_SURFACE_TYPE mask bits */
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT        0x0040        /* EGL_SURFACE_TYPE mask bits */
-#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200        /* EGL_SURFACE_TYPE mask bits */
-#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400        /* EGL_SURFACE_TYPE mask bits */
-
-#define EGL_OPENGL_ES_BIT                0x0001        /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENVG_BIT                        0x0002        /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENGL_ES2_BIT                0x0004        /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENGL_BIT                        0x0008        /* EGL_RENDERABLE_TYPE mask bits */
-
-/* QueryString targets */
-#define EGL_VENDOR                        0x3053
-#define EGL_VERSION                        0x3054
-#define EGL_EXTENSIONS                        0x3055
-#define EGL_CLIENT_APIS                        0x308D
-
-/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
-#define EGL_HEIGHT                        0x3056
-#define EGL_WIDTH                        0x3057
-#define EGL_LARGEST_PBUFFER                0x3058
-#define EGL_TEXTURE_FORMAT                0x3080
-#define EGL_TEXTURE_TARGET                0x3081
-#define EGL_MIPMAP_TEXTURE                0x3082
-#define EGL_MIPMAP_LEVEL                0x3083
-#define EGL_RENDER_BUFFER                0x3086
-#define EGL_VG_COLORSPACE                0x3087
-#define EGL_VG_ALPHA_FORMAT                0x3088
-#define EGL_HORIZONTAL_RESOLUTION        0x3090
-#define EGL_VERTICAL_RESOLUTION                0x3091
-#define EGL_PIXEL_ASPECT_RATIO                0x3092
-#define EGL_SWAP_BEHAVIOR                0x3093
-#define EGL_MULTISAMPLE_RESOLVE                0x3099
-
-/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
-#define EGL_BACK_BUFFER                        0x3084
-#define EGL_SINGLE_BUFFER                0x3085
-
-/* OpenVG color spaces */
-#define EGL_VG_COLORSPACE_sRGB                0x3089        /* EGL_VG_COLORSPACE value */
-#define EGL_VG_COLORSPACE_LINEAR        0x308A        /* EGL_VG_COLORSPACE value */
-
-/* OpenVG alpha formats */
-#define EGL_VG_ALPHA_FORMAT_NONPRE        0x308B        /* EGL_ALPHA_FORMAT value */
-#define EGL_VG_ALPHA_FORMAT_PRE                0x308C        /* EGL_ALPHA_FORMAT value */
-
-/* Constant scale factor by which fractional display resolutions &amp;
- * aspect ratio are scaled when queried as integer values.
- */
-#define EGL_DISPLAY_SCALING                10000
-
-/* Unknown display resolution/aspect ratio */
-#define EGL_UNKNOWN                        ((EGLint)-1)
-
-/* Back buffer swap behaviors */
-#define EGL_BUFFER_PRESERVED                0x3094        /* EGL_SWAP_BEHAVIOR value */
-#define EGL_BUFFER_DESTROYED                0x3095        /* EGL_SWAP_BEHAVIOR value */
-
-/* CreatePbufferFromClientBuffer buffer types */
-#define EGL_OPENVG_IMAGE                0x3096
-
-/* QueryContext targets */
-#define EGL_CONTEXT_CLIENT_TYPE                0x3097
-
-/* CreateContext attributes */
-#define EGL_CONTEXT_CLIENT_VERSION        0x3098
-
-/* Multisample resolution behaviors */
-#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A        /* EGL_MULTISAMPLE_RESOLVE value */
-#define EGL_MULTISAMPLE_RESOLVE_BOX        0x309B        /* EGL_MULTISAMPLE_RESOLVE value */
-
-/* BindAPI/QueryAPI targets */
-#define EGL_OPENGL_ES_API                0x30A0
-#define EGL_OPENVG_API                        0x30A1
-#define EGL_OPENGL_API                        0x30A2
-
-/* GetCurrentSurface targets */
-#define EGL_DRAW                        0x3059
-#define EGL_READ                        0x305A
-
-/* WaitNative engines */
-#define EGL_CORE_NATIVE_ENGINE                0x305B
-
-/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
-#define EGL_COLORSPACE                        EGL_VG_COLORSPACE
-#define EGL_ALPHA_FORMAT                EGL_VG_ALPHA_FORMAT
-#define EGL_COLORSPACE_sRGB                EGL_VG_COLORSPACE_sRGB
-#define EGL_COLORSPACE_LINEAR                EGL_VG_COLORSPACE_LINEAR
-#define EGL_ALPHA_FORMAT_NONPRE                EGL_VG_ALPHA_FORMAT_NONPRE
-#define EGL_ALPHA_FORMAT_PRE                EGL_VG_ALPHA_FORMAT_PRE
-
-/* EGL extensions must request enum blocks from the Khronos
- * API Registrar, who maintains the enumerant registry. Submit
- * a bug in Khronos Bugzilla against task &quot;Registry&quot;.
- */
-
-
-
-/* EGL Functions */
-
-#if defined(_MSC_VER) &amp;&amp; !defined(ANGLE_WEBKIT_WIN)
-#include &lt;EGL/eglsoftlinking.h&gt;
-#else
-
-EGLAPI EGLint EGLAPIENTRY eglGetError(void);
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
-
-EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
-                         EGLint config_size, EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
-                           EGLConfig *configs, EGLint config_size,
-                           EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
-                              EGLint attribute, EGLint *value);
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
-                                  EGLNativeWindowType win,
-                                  const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
-                                   const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
-                                  EGLNativePixmapType pixmap,
-                                  const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
-                           EGLint attribute, EGLint *value);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
-              EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
-              EGLConfig config, const EGLint *attrib_list);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
-                            EGLint attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
-
-
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
-                            EGLContext share_context,
-                            const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
-                          EGLSurface read, EGLContext ctx);
-
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
-                           EGLint attribute, EGLint *value);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
-                          EGLNativePixmapType target);
-
-/* This is a generic function pointer type, whose name indicates it must
- * be cast to the proper type *and calling convention* before use.
- */
-typedef void (*__eglMustCastToProperFunctionPointerType)(void);
-
-/* Now, define eglGetProcAddress using the generic function ptr. type */
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
-       eglGetProcAddress(const char *procname);
-
-#endif
-
</del><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#endif /* __egl_h_ */
</del><ins>+#endif
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeEGLeglexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/include/EGL/eglext.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,12 +1,12 @@
</span><span class="cx"> #ifndef __eglext_h_
</span><del>-#define __eglext_h_
</del><ins>+#define __eglext_h_ 1
</ins><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> extern &quot;C&quot; {
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> /*
</span><del>-** Copyright (c) 2007-2013 The Khronos Group Inc.
</del><ins>+** Copyright (c) 2013-2014 The Khronos Group Inc.
</ins><span class="cx"> **
</span><span class="cx"> ** Permission is hereby granted, free of charge, to any person obtaining a
</span><span class="cx"> ** copy of this software and/or associated documentation files (the
</span><span class="lines">@@ -27,555 +27,748 @@
</span><span class="cx"> ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
</span><span class="cx"> ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
</span><span class="cx"> */
</span><ins>+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 27018 $ on $Date: 2014-06-10 08:06:12 -0700 (Tue, 10 Jun 2014) $
+*/
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;EGL/eglplatform.h&gt;
</span><span class="cx"> 
</span><del>-/*************************************************************/
</del><ins>+#define EGL_EGLEXT_VERSION 20140610
</ins><span class="cx"> 
</span><del>-/* Header file version number */
-/* Current version at http://www.khronos.org/registry/egl/ */
-/* $Revision: 20690 $ on $Date: 2013-02-22 20:15:05 -0500 (Fri, 22 Feb 2013) $ */
-#define EGL_EGLEXT_VERSION 15
</del><ins>+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: egl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_config_attribs
-#define EGL_KHR_config_attribs 1
-#define EGL_CONFORMANT_KHR                        0x3042        /* EGLConfig attribute */
-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR        0x0020        /* EGL_SURFACE_TYPE bitfield */
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR                0x0040        /* EGL_SURFACE_TYPE bitfield */
-#endif
</del><ins>+#ifndef EGL_KHR_cl_event
+#define EGL_KHR_cl_event 1
+#define EGL_CL_EVENT_HANDLE_KHR           0x309C
+#define EGL_SYNC_CL_EVENT_KHR             0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE_KHR    0x30FF
+#endif /* EGL_KHR_cl_event */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_lock_surface
-#define EGL_KHR_lock_surface 1
-#define EGL_READ_SURFACE_BIT_KHR                0x0001        /* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_WRITE_SURFACE_BIT_KHR                0x0002        /* EGL_LOCK_USAGE_HINT_KHR bitfield */
-#define EGL_LOCK_SURFACE_BIT_KHR                0x0080        /* EGL_SURFACE_TYPE bitfield */
-#define EGL_OPTIMAL_FORMAT_BIT_KHR                0x0100        /* EGL_SURFACE_TYPE bitfield */
-#define EGL_MATCH_FORMAT_KHR                        0x3043        /* EGLConfig attribute */
-#define EGL_FORMAT_RGB_565_EXACT_KHR                0x30C0        /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGB_565_KHR                        0x30C1        /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_EXACT_KHR                0x30C2        /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_FORMAT_RGBA_8888_KHR                0x30C3        /* EGL_MATCH_FORMAT_KHR value */
-#define EGL_MAP_PRESERVE_PIXELS_KHR                0x30C4        /* eglLockSurfaceKHR attribute */
-#define EGL_LOCK_USAGE_HINT_KHR                        0x30C5        /* eglLockSurfaceKHR attribute */
-#define EGL_BITMAP_POINTER_KHR                        0x30C6        /* eglQuerySurface attribute */
-#define EGL_BITMAP_PITCH_KHR                        0x30C7        /* eglQuerySurface attribute */
-#define EGL_BITMAP_ORIGIN_KHR                        0x30C8        /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR                0x30C9        /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR        0x30CA        /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR        0x30CB        /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR        0x30CC        /* eglQuerySurface attribute */
-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR        0x30CD        /* eglQuerySurface attribute */
-#define EGL_LOWER_LEFT_KHR                        0x30CE        /* EGL_BITMAP_ORIGIN_KHR value */
-#define EGL_UPPER_LEFT_KHR                        0x30CF        /* EGL_BITMAP_ORIGIN_KHR value */
</del><ins>+#ifndef EGL_KHR_cl_event2
+#define EGL_KHR_cl_event2 1
+typedef void *EGLSyncKHR;
+typedef intptr_t EGLAttribKHR;
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
</del><ins>+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_KHR_cl_event2 */
</ins><span class="cx"> 
</span><ins>+#ifndef EGL_KHR_client_get_all_proc_addresses
+#define EGL_KHR_client_get_all_proc_addresses 1
+#endif /* EGL_KHR_client_get_all_proc_addresses */
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR                0x3042
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR  0x0020
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR   0x0040
+#endif /* EGL_KHR_config_attribs */
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR     0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR     0x30FB
+#define EGL_CONTEXT_FLAGS_KHR             0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR     0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR     0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR  0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR            0x00000040
+#endif /* EGL_KHR_create_context */
+
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR            0x30F8
+#define EGL_SYNC_FENCE_KHR                0x30F9
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_fence_sync */
+
+#ifndef EGL_KHR_get_all_proc_addresses
+#define EGL_KHR_get_all_proc_addresses 1
+#endif /* EGL_KHR_get_all_proc_addresses */
+
+#ifndef EGL_KHR_gl_colorspace
+#define EGL_KHR_gl_colorspace 1
+#define EGL_GL_COLORSPACE_KHR             0x309D
+#define EGL_GL_COLORSPACE_SRGB_KHR        0x3089
+#define EGL_GL_COLORSPACE_LINEAR_KHR      0x308A
+#endif /* EGL_KHR_gl_colorspace */
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR           0x30B9
+#endif /* EGL_KHR_gl_renderbuffer_image */
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR             0x30B1
+#define EGL_GL_TEXTURE_LEVEL_KHR          0x30BC
+#endif /* EGL_KHR_gl_texture_2D_image */
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR             0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET_KHR        0x30BD
+#endif /* EGL_KHR_gl_texture_3D_image */
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#endif /* EGL_KHR_gl_texture_cubemap_image */
+
</ins><span class="cx"> #ifndef EGL_KHR_image
</span><span class="cx"> #define EGL_KHR_image 1
</span><del>-#define EGL_NATIVE_PIXMAP_KHR                        0x30B0        /* eglCreateImageKHR target */
</del><span class="cx"> typedef void *EGLImageKHR;
</span><del>-#define EGL_NO_IMAGE_KHR                        ((EGLImageKHR)0)
</del><ins>+#define EGL_NATIVE_PIXMAP_KHR             0x30B0
+#define EGL_NO_IMAGE_KHR                  ((EGLImageKHR)0)
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><span class="cx"> EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
</span><span class="cx"> EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
</span><del>-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
</del><span class="cx"> #endif
</span><ins>+#endif /* EGL_KHR_image */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_vg_parent_image
-#define EGL_KHR_vg_parent_image 1
-#define EGL_VG_PARENT_IMAGE_KHR                        0x30BA        /* eglCreateImageKHR target */
-#endif
</del><ins>+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+#define EGL_IMAGE_PRESERVED_KHR           0x30D2
+#endif /* EGL_KHR_image_base */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_gl_texture_2D_image
-#define EGL_KHR_gl_texture_2D_image 1
-#define EGL_GL_TEXTURE_2D_KHR                        0x30B1        /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_LEVEL_KHR                0x30BC        /* eglCreateImageKHR attribute */
-#endif
</del><ins>+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+#endif /* EGL_KHR_image_pixmap */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_gl_texture_cubemap_image
-#define EGL_KHR_gl_texture_cubemap_image 1
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR        0x30B3        /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR        0x30B4        /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR        0x30B5        /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR        0x30B6        /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR        0x30B7        /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR        0x30B8        /* eglCreateImageKHR target */
</del><ins>+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR          0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR         0x0002
+#define EGL_LOCK_SURFACE_BIT_KHR          0x0080
+#define EGL_OPTIMAL_FORMAT_BIT_KHR        0x0100
+#define EGL_MATCH_FORMAT_KHR              0x3043
+#define EGL_FORMAT_RGB_565_EXACT_KHR      0x30C0
+#define EGL_FORMAT_RGB_565_KHR            0x30C1
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR    0x30C2
+#define EGL_FORMAT_RGBA_8888_KHR          0x30C3
+#define EGL_MAP_PRESERVE_PIXELS_KHR       0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR           0x30C5
+#define EGL_BITMAP_POINTER_KHR            0x30C6
+#define EGL_BITMAP_PITCH_KHR              0x30C7
+#define EGL_BITMAP_ORIGIN_KHR             0x30C8
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR   0x30C9
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR  0x30CB
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
+#define EGL_LOWER_LEFT_KHR                0x30CE
+#define EGL_UPPER_LEFT_KHR                0x30CF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_KHR_lock_surface */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_gl_texture_3D_image
-#define EGL_KHR_gl_texture_3D_image 1
-#define EGL_GL_TEXTURE_3D_KHR                        0x30B2        /* eglCreateImageKHR target */
-#define EGL_GL_TEXTURE_ZOFFSET_KHR                0x30BD        /* eglCreateImageKHR attribute */
-#endif
</del><ins>+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR         0x3110
+#endif /* EGL_KHR_lock_surface2 */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_gl_renderbuffer_image
-#define EGL_KHR_gl_renderbuffer_image 1
-#define EGL_GL_RENDERBUFFER_KHR                        0x30B9        /* eglCreateImageKHR target */
</del><ins>+#ifndef EGL_KHR_lock_surface3
+#define EGL_KHR_lock_surface3 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_KHR_lock_surface3 */
</ins><span class="cx"> 
</span><del>-#if KHRONOS_SUPPORT_INT64   /* EGLTimeKHR requires 64-bit uint support */
</del><ins>+#ifndef EGL_KHR_platform_android
+#define EGL_KHR_platform_android 1
+#define EGL_PLATFORM_ANDROID_KHR          0x3141
+#endif /* EGL_KHR_platform_android */
+
+#ifndef EGL_KHR_platform_gbm
+#define EGL_KHR_platform_gbm 1
+#define EGL_PLATFORM_GBM_KHR              0x31D7
+#endif /* EGL_KHR_platform_gbm */
+
+#ifndef EGL_KHR_platform_wayland
+#define EGL_KHR_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_KHR          0x31D8
+#endif /* EGL_KHR_platform_wayland */
+
+#ifndef EGL_KHR_platform_x11
+#define EGL_KHR_platform_x11 1
+#define EGL_PLATFORM_X11_KHR              0x31D5
+#define EGL_PLATFORM_X11_SCREEN_KHR       0x31D6
+#endif /* EGL_KHR_platform_x11 */
+
</ins><span class="cx"> #ifndef EGL_KHR_reusable_sync
</span><span class="cx"> #define EGL_KHR_reusable_sync 1
</span><del>-
-typedef void* EGLSyncKHR;
</del><span class="cx"> typedef khronos_utime_nanoseconds_t EGLTimeKHR;
</span><del>-
-#define EGL_SYNC_STATUS_KHR                        0x30F1
-#define EGL_SIGNALED_KHR                        0x30F2
-#define EGL_UNSIGNALED_KHR                        0x30F3
-#define EGL_TIMEOUT_EXPIRED_KHR                        0x30F5
-#define EGL_CONDITION_SATISFIED_KHR                0x30F6
-#define EGL_SYNC_TYPE_KHR                        0x30F7
-#define EGL_SYNC_REUSABLE_KHR                        0x30FA
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR                0x0001        /* eglClientWaitSyncKHR &lt;flags&gt; bitfield */
-#define EGL_FOREVER_KHR                                0xFFFFFFFFFFFFFFFFull
-#define EGL_NO_SYNC_KHR                                ((EGLSyncKHR)0)
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
</del><ins>+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_STATUS_KHR               0x30F1
+#define EGL_SIGNALED_KHR                  0x30F2
+#define EGL_UNSIGNALED_KHR                0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR           0x30F5
+#define EGL_CONDITION_SATISFIED_KHR       0x30F6
+#define EGL_SYNC_TYPE_KHR                 0x30F7
+#define EGL_SYNC_REUSABLE_KHR             0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR   0x0001
+#define EGL_FOREVER_KHR                   0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR                   ((EGLSyncKHR)0)
</ins><span class="cx"> typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
</span><span class="cx"> typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
</span><span class="cx"> typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
</span><span class="cx"> typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
</span><span class="cx"> typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
</span><ins>+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
</ins><span class="cx"> #endif
</span><del>-#endif
</del><ins>+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_reusable_sync */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_image_base
-#define EGL_KHR_image_base 1
-/* Most interfaces defined by EGL_KHR_image_pixmap above */
-#define EGL_IMAGE_PRESERVED_KHR                        0x30D2        /* eglCreateImageKHR attribute */
</del><ins>+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void *EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_NO_STREAM_KHR                 ((EGLStreamKHR)0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR     0x3210
+#define EGL_PRODUCER_FRAME_KHR            0x3212
+#define EGL_CONSUMER_FRAME_KHR            0x3213
+#define EGL_STREAM_STATE_KHR              0x3214
+#define EGL_STREAM_STATE_CREATED_KHR      0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR   0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR        0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR                0x321B
+#define EGL_BAD_STATE_KHR                 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
</ins><span class="cx"> #endif
</span><ins>+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_image_pixmap
-#define EGL_KHR_image_pixmap 1
-/* Interfaces defined by EGL_KHR_image above */
</del><ins>+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#ifdef EGL_KHR_stream
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_consumer_gltexture */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_IMG_context_priority
-#define EGL_IMG_context_priority 1
-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG                0x3100
-#define EGL_CONTEXT_PRIORITY_HIGH_IMG                0x3101
-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG                0x3102
-#define EGL_CONTEXT_PRIORITY_LOW_IMG                0x3103
</del><ins>+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#ifdef EGL_KHR_stream
+#define EGL_NO_FILE_DESCRIPTOR_KHR        ((EGLNativeFileDescriptorKHR)(-1))
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_cross_process_fd */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_lock_surface2
-#define EGL_KHR_lock_surface2 1
-#define EGL_BITMAP_PIXEL_SIZE_KHR                0x3110
</del><ins>+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_FIFO_LENGTH_KHR        0x31FC
+#define EGL_STREAM_TIME_NOW_KHR           0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR      0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR      0x31FF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_fifo */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_NV_coverage_sample
-#define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV                        0x30E0
-#define EGL_COVERAGE_SAMPLES_NV                        0x30E1
-#endif
</del><ins>+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#ifdef EGL_KHR_stream
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_aldatalocator */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_NV_depth_nonlinear
-#define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV                        0x30E2
-#define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV                0x30E3
-#endif
-
-#if KHRONOS_SUPPORT_INT64   /* EGLTimeNV requires 64-bit uint support */
-#ifndef EGL_NV_sync
-#define EGL_NV_sync 1
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV        0x30E6
-#define EGL_SYNC_STATUS_NV                        0x30E7
-#define EGL_SIGNALED_NV                                0x30E8
-#define EGL_UNSIGNALED_NV                        0x30E9
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV                0x0001
-#define EGL_FOREVER_NV                                0xFFFFFFFFFFFFFFFFull
-#define EGL_ALREADY_SIGNALED_NV                        0x30EA
-#define EGL_TIMEOUT_EXPIRED_NV                        0x30EB
-#define EGL_CONDITION_SATISFIED_NV                0x30EC
-#define EGL_SYNC_TYPE_NV                        0x30ED
-#define EGL_SYNC_CONDITION_NV                        0x30EE
-#define EGL_SYNC_FENCE_NV                        0x30EF
-#define EGL_NO_SYNC_NV                                ((EGLSyncNV)0)
-typedef void* EGLSyncNV;
-typedef khronos_utime_nanoseconds_t EGLTimeNV;
</del><ins>+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_BIT_KHR                0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
-EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
</del><ins>+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
</ins><span class="cx"> #endif
</span><del>-#endif
</del><ins>+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_eglsurface */
</ins><span class="cx"> 
</span><del>-#if KHRONOS_SUPPORT_INT64   /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
-#ifndef EGL_KHR_fence_sync
-#define EGL_KHR_fence_sync 1
-/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR        0x30F0
-#define EGL_SYNC_CONDITION_KHR                        0x30F8
-#define EGL_SYNC_FENCE_KHR                        0x30F9
-#endif
-#endif
</del><ins>+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+#endif /* EGL_KHR_surfaceless_context */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_HI_clientpixmap
-#define EGL_HI_clientpixmap 1
</del><ins>+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR           0x30BA
+#endif /* EGL_KHR_vg_parent_image */
</ins><span class="cx"> 
</span><del>-/* Surface Attribute */
-#define EGL_CLIENT_PIXMAP_POINTER_HI                0x8F74
-/*
- * Structure representing a client pixmap
- * (pixmap's data is in client-space memory).
- */
-struct EGLClientPixmapHI
-{
-        void*                pData;
-        EGLint                iWidth;
-        EGLint                iHeight;
-        EGLint                iStride;
-};
</del><ins>+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
-#endif        /* EGL_HI_clientpixmap */
</del><ins>+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+#endif /* EGL_KHR_wait_sync */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_HI_colorformats
-#define EGL_HI_colorformats 1
-/* Config Attribute */
-#define EGL_COLOR_FORMAT_HI                        0x8F70
-/* Color Formats */
-#define EGL_COLOR_RGB_HI                        0x8F71
-#define EGL_COLOR_RGBA_HI                        0x8F72
-#define EGL_COLOR_ARGB_HI                        0x8F73
-#endif /* EGL_HI_colorformats */
-
-#ifndef EGL_MESA_drm_image
-#define EGL_MESA_drm_image 1
-#define EGL_DRM_BUFFER_FORMAT_MESA                0x31D0            /* CreateDRMImageMESA attribute */
-#define EGL_DRM_BUFFER_USE_MESA                        0x31D1            /* CreateDRMImageMESA attribute */
-#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA        0x31D2            /* EGL_IMAGE_FORMAT_MESA attribute value */
-#define EGL_DRM_BUFFER_MESA                        0x31D3            /* eglCreateImageKHR target */
-#define EGL_DRM_BUFFER_STRIDE_MESA                0x31D4
-#define EGL_DRM_BUFFER_USE_SCANOUT_MESA                0x00000001  /* EGL_DRM_BUFFER_USE_MESA bits */
-#define EGL_DRM_BUFFER_USE_SHARE_MESA                0x00000002  /* EGL_DRM_BUFFER_USE_MESA bits */
</del><ins>+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
</del><ins>+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_ANDROID_blob_cache */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_NV_post_sub_buffer
-#define EGL_NV_post_sub_buffer 1
-#define EGL_POST_SUB_BUFFER_SUPPORTED_NV        0x30BE
</del><ins>+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID    0x3147
+#endif /* EGL_ANDROID_framebuffer_target */
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID         0x3140
+#endif /* EGL_ANDROID_image_native_buffer */
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID     0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID  0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID    -1
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
</del><ins>+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_ANDROID_native_fence_sync */
</ins><span class="cx"> 
</span><ins>+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID            0x3142
+#endif /* EGL_ANDROID_recordable */
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
+
+#ifndef EGL_ANGLE_window_fixed_size
+#define EGL_ANGLE_window_fixed_size 1
+#define EGL_FIXED_SIZE_ANGLE        0x3201
+#endif /* EGL_ANGLE_window_fixed_size */
+
</ins><span class="cx"> #ifndef EGL_ANGLE_query_surface_pointer
</span><span class="cx"> #define EGL_ANGLE_query_surface_pointer 1
</span><ins>+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
</del><ins>+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
</ins><span class="cx"> #endif
</span><del>-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#endif
</del><ins>+#endif /* EGL_ANGLE_query_surface_pointer */
</ins><span class="cx"> 
</span><span class="cx"> #ifndef EGL_ANGLE_software_display
</span><span class="cx"> #define EGL_ANGLE_software_display 1
</span><span class="cx"> #define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
</span><del>-#endif
</del><ins>+#endif /* EGL_ANGLE_software_display */
</ins><span class="cx"> 
</span><span class="cx"> #ifndef EGL_ANGLE_direct3d_display
</span><span class="cx"> #define EGL_ANGLE_direct3d_display 1
</span><span class="cx"> #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2)
</span><span class="cx"> #define EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3)
</span><del>-#endif
</del><ins>+#endif /* EGL_ANGLE_direct3d_display */
</ins><span class="cx"> 
</span><span class="cx"> #ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
</span><span class="cx"> #define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
</span><del>-#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE        0x3200
-#endif
</del><ins>+#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_NV_coverage_sample_resolve
-#define EGL_NV_coverage_sample_resolve 1
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NV                0x3131
-#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV        0x3132
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV        0x3133
-#endif
</del><ins>+#ifndef EGL_ANGLE_platform_angle
+#define EGL_ANGLE_platform_angle 1
+#define EGL_PLATFORM_ANGLE_ANGLE          0x3202
+#define EGL_PLATFORM_ANGLE_TYPE_ANGLE     0x3203
+#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
+#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
+#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
+#endif /* EGL_ANGLE_platform_angle */
</ins><span class="cx"> 
</span><del>-#if KHRONOS_SUPPORT_INT64   /* EGLuint64NV requires 64-bit uint support */
-#ifndef EGL_NV_system_time
-#define EGL_NV_system_time 1
-typedef khronos_utime_nanoseconds_t EGLuint64NV;
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
-#endif
-#endif
</del><ins>+#ifndef EGL_ANGLE_platform_angle_d3d
+#define EGL_ANGLE_platform_angle_d3d 1
+#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
+#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE 0x320B
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE 0x320C
+#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
+#endif /* EGL_ANGLE_platform_angle_d3d */
</ins><span class="cx"> 
</span><del>-#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
-#ifndef EGL_KHR_stream
-#define EGL_KHR_stream 1
-typedef void* EGLStreamKHR;
-typedef khronos_uint64_t EGLuint64KHR;
-#define EGL_NO_STREAM_KHR                        ((EGLStreamKHR)0)
-#define EGL_CONSUMER_LATENCY_USEC_KHR                0x3210
-#define EGL_PRODUCER_FRAME_KHR                        0x3212
-#define EGL_CONSUMER_FRAME_KHR                        0x3213
-#define EGL_STREAM_STATE_KHR                        0x3214
-#define EGL_STREAM_STATE_CREATED_KHR                0x3215
-#define EGL_STREAM_STATE_CONNECTING_KHR                0x3216
-#define EGL_STREAM_STATE_EMPTY_KHR                0x3217
-#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR    0x3218
-#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR    0x3219
-#define EGL_STREAM_STATE_DISCONNECTED_KHR        0x321A
-#define EGL_BAD_STREAM_KHR                        0x321B
-#define EGL_BAD_STATE_KHR                        0x321C
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#endif
-#endif
</del><ins>+#ifndef EGL_ANGLE_platform_angle_opengl
+#define EGL_ANGLE_platform_angle_opengl 1
+#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
+#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
+#endif /* EGL_ANGLE_platform_angle_opengl */
</ins><span class="cx"> 
</span><del>-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_consumer_gltexture
-#define EGL_KHR_stream_consumer_gltexture 1
-#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR        0x321E
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-#endif
-#endif
</del><ins>+#ifndef EGL_ANGLE_device_d3d
+#define EGL_ANGLE_device_d3d 1
+#define EGL_D3D9_DEVICE_ANGLE             0x33A0
+#define EGL_D3D11_DEVICE_ANGLE            0x33A1
+#endif /* EGL_ANGLE_device_d3d */
</ins><span class="cx"> 
</span><del>-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_producer_eglsurface
-#define EGL_KHR_stream_producer_eglsurface 1
-#define EGL_STREAM_BIT_KHR                        0x0800
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#endif
-#endif
</del><ins>+#ifndef EGL_ARM_pixmap_multisample_discard
+#define EGL_ARM_pixmap_multisample_discard 1
+#define EGL_DISCARD_SAMPLES_ARM           0x3286
+#endif /* EGL_ARM_pixmap_multisample_discard */
</ins><span class="cx"> 
</span><del>-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_producer_aldatalocator
-#define EGL_KHR_stream_producer_aldatalocator 1
-#endif
-#endif
</del><ins>+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT                0x313D
+#endif /* EGL_EXT_buffer_age */
</ins><span class="cx"> 
</span><del>-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_fifo
-#define EGL_KHR_stream_fifo 1
-/* reuse EGLTimeKHR */
-#define EGL_STREAM_FIFO_LENGTH_KHR                0x31FC
-#define EGL_STREAM_TIME_NOW_KHR                        0x31FD
-#define EGL_STREAM_TIME_CONSUMER_KHR                0x31FE
-#define EGL_STREAM_TIME_PRODUCER_KHR                0x31FF
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#endif
-#endif
</del><ins>+#ifndef EGL_EXT_client_extensions
+#define EGL_EXT_client_extensions 1
+#endif /* EGL_EXT_client_extensions */
</ins><span class="cx"> 
</span><span class="cx"> #ifndef EGL_EXT_create_context_robustness
</span><span class="cx"> #define EGL_EXT_create_context_robustness 1
</span><del>-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT        0x30BF
</del><ins>+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
</ins><span class="cx"> #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
</span><del>-#define EGL_NO_RESET_NOTIFICATION_EXT                0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_EXT                0x31BF
-#endif
</del><ins>+#define EGL_NO_RESET_NOTIFICATION_EXT     0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT     0x31BF
+#endif /* EGL_EXT_create_context_robustness */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
-#define EGL_ANGLE_d3d_share_handle_client_buffer 1
-/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
</del><ins>+#ifndef EGL_EXT_device_base
+#define EGL_EXT_device_base 1
+typedef void *EGLDeviceEXT;
+#define EGL_NO_DEVICE_EXT                 ((EGLDeviceEXT)(0))
+#define EGL_BAD_DEVICE_EXT                0x322B
+#define EGL_DEVICE_EXT                    0x322C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_EXT_device_base */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_ANGLE_window_fixed_size
-#define EGL_ANGLE_window_fixed_size 1
-#define EGL_FIXED_SIZE_ANGLE        0x3201
-#endif
</del><ins>+#ifndef EGL_EXT_device_query
+#define EGL_EXT_device_query 1
+#endif /* EGL_EXT_device_query */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_create_context
-#define EGL_KHR_create_context 1
-#define EGL_CONTEXT_MAJOR_VERSION_KHR                            EGL_CONTEXT_CLIENT_VERSION
-#define EGL_CONTEXT_MINOR_VERSION_KHR                            0x30FB
-#define EGL_CONTEXT_FLAGS_KHR                                    0x30FC
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR                    0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR  0x31BD
-#define EGL_NO_RESET_NOTIFICATION_KHR                            0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_KHR                            0x31BF
-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR                    0x00000001
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR            0x00000002
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR            0x00000004
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR                    0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR    0x00000002
-#define EGL_OPENGL_ES3_BIT_KHR                                    0x00000040
-#endif
</del><ins>+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT             0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT          0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT         0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT     0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT      0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT         0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT     0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT      0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT         0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT     0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT      0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT      0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT         0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT                0x327F
+#define EGL_ITU_REC709_EXT                0x3280
+#define EGL_ITU_REC2020_EXT               0x3281
+#define EGL_YUV_FULL_RANGE_EXT            0x3282
+#define EGL_YUV_NARROW_RANGE_EXT          0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT       0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT     0x3285
+#endif /* EGL_EXT_image_dma_buf_import */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_surfaceless_context
-#define EGL_KHR_surfaceless_context 1
-/* No tokens/entry points, just relaxes an error condition */
</del><ins>+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT      0x3134
+#endif /* EGL_EXT_multiview_window */
+
+#ifndef EGL_EXT_platform_base
+#define EGL_EXT_platform_base 1
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_EXT_platform_base */
</ins><span class="cx"> 
</span><del>-#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
-#ifndef EGL_KHR_stream_cross_process_fd
-#define EGL_KHR_stream_cross_process_fd 1
-typedef int EGLNativeFileDescriptorKHR;
-#define EGL_NO_FILE_DESCRIPTOR_KHR                ((EGLNativeFileDescriptorKHR)(-1))
</del><ins>+#ifndef EGL_EXT_platform_device
+#define EGL_EXT_platform_device 1
+#define EGL_PLATFORM_DEVICE_EXT           0x313F
+#endif /* EGL_EXT_platform_device */
+
+#ifndef EGL_EXT_platform_wayland
+#define EGL_EXT_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_EXT          0x31D8
+#endif /* EGL_EXT_platform_wayland */
+
+#ifndef EGL_EXT_platform_x11
+#define EGL_EXT_platform_x11 1
+#define EGL_PLATFORM_X11_EXT              0x31D5
+#define EGL_PLATFORM_X11_SCREEN_EXT       0x31D6
+#endif /* EGL_EXT_platform_x11 */
+
+#ifndef EGL_EXT_protected_surface
+#define EGL_EXT_protected_surface 1
+#define EGL_PROTECTED_CONTENT_EXT         0x32C0
+#endif /* EGL_EXT_protected_surface */
+
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
</del><ins>+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
</ins><span class="cx"> #endif
</span><del>-#endif
</del><ins>+#endif /* EGL_EXT_swap_buffers_with_damage */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_EXT_multiview_window
-#define EGL_EXT_multiview_window 1
-#define EGL_MULTIVIEW_VIEW_COUNT_EXT                0x3134
</del><ins>+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+struct EGLClientPixmapHI {
+    void  *pData;
+    EGLint iWidth;
+    EGLint iHeight;
+    EGLint iStride;
+};
+#define EGL_CLIENT_PIXMAP_POINTER_HI      0x8F74
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_HI_clientpixmap */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_KHR_wait_sync
-#define EGL_KHR_wait_sync 1
</del><ins>+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+#define EGL_COLOR_FORMAT_HI               0x8F70
+#define EGL_COLOR_RGB_HI                  0x8F71
+#define EGL_COLOR_RGBA_HI                 0x8F72
+#define EGL_COLOR_ARGB_HI                 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG    0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG     0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG   0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG      0x3103
+#endif /* EGL_IMG_context_priority */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA        0x31D0
+#define EGL_DRM_BUFFER_USE_MESA           0x31D1
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
+#define EGL_DRM_BUFFER_MESA               0x31D3
+#define EGL_DRM_BUFFER_STRIDE_MESA        0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA   0x00000001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA     0x00000002
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
</del><ins>+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_MESA_drm_image */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_NV_post_convert_rounding
-#define EGL_NV_post_convert_rounding 1
-/* No tokens or entry points, just relaxes behavior of SwapBuffers */
</del><ins>+#ifndef EGL_MESA_platform_gbm
+#define EGL_MESA_platform_gbm 1
+#define EGL_PLATFORM_GBM_MESA             0x31D7
+#endif /* EGL_MESA_platform_gbm */
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_NOK_swap_region */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_NV_native_query
-#define EGL_NV_native_query 1
</del><ins>+#ifndef EGL_NOK_swap_region2
+#define EGL_NOK_swap_region2 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV( EGLDisplay dpy, EGLNativeDisplayType* display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV( EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV( EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC)(EGLDisplay dpy, EGLNativeDisplayType *display_id);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
</del><ins>+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_NOK_swap_region2 */
</ins><span class="cx"> 
</span><ins>+#ifndef EGL_NOK_texture_from_pixmap
+#define EGL_NOK_texture_from_pixmap 1
+#define EGL_Y_INVERTED_NOK                0x307F
+#endif /* EGL_NOK_texture_from_pixmap */
+
</ins><span class="cx"> #ifndef EGL_NV_3dvision_surface
</span><span class="cx"> #define EGL_NV_3dvision_surface 1
</span><del>-#define EGL_AUTO_STEREO_NV                        0x3136
-#endif
</del><ins>+#define EGL_AUTO_STEREO_NV                0x3136
+#endif /* EGL_NV_3dvision_surface */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_ANDROID_framebuffer_target
-#define EGL_ANDROID_framebuffer_target 1
-#define EGL_FRAMEBUFFER_TARGET_ANDROID                0x3147
-#endif
</del><ins>+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV           0x30E0
+#define EGL_COVERAGE_SAMPLES_NV           0x30E1
+#endif /* EGL_NV_coverage_sample */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_ANDROID_blob_cache
-#define EGL_ANDROID_blob_cache 1
-typedef khronos_ssize_t EGLsizeiANDROID;
-typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
-typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
</del><ins>+#ifndef EGL_NV_coverage_sample_resolve
+#define EGL_NV_coverage_sample_resolve 1
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NV    0x3131
+#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+#endif /* EGL_NV_coverage_sample_resolve */
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV             0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV        0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV   0x30E3
+#endif /* EGL_NV_depth_nonlinear */
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
</del><ins>+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_NV_native_query */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_ANDROID_image_native_buffer
-#define EGL_ANDROID_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_ANDROID                0x3140
-#endif
</del><ins>+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+#endif /* EGL_NV_post_convert_rounding */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_ANDROID_native_fence_sync
-#define EGL_ANDROID_native_fence_sync 1
-#define EGL_SYNC_NATIVE_FENCE_ANDROID                0x3144
-#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID        0x3145
-#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID        0x3146
-#define EGL_NO_NATIVE_FENCE_FD_ANDROID                -1
</del><ins>+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV  0x30BE
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
</ins><span class="cx"> #ifdef EGL_EGLEXT_PROTOTYPES
</span><del>-EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR);
</del><ins>+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_NV_post_sub_buffer */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_ANDROID_recordable
-#define EGL_ANDROID_recordable 1
-#define EGL_RECORDABLE_ANDROID                        0x3142
</del><ins>+#ifndef EGL_NV_stream_sync
+#define EGL_NV_stream_sync 1
+#define EGL_SYNC_NEW_FRAME_NV             0x321F
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
</ins><span class="cx"> #endif
</span><ins>+#endif /* EGL_NV_stream_sync */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_EXT_buffer_age
-#define EGL_EXT_buffer_age 1
-#define EGL_BUFFER_AGE_EXT                        0x313D
</del><ins>+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+typedef void *EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV                0x30E7
+#define EGL_SIGNALED_NV                   0x30E8
+#define EGL_UNSIGNALED_NV                 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV    0x0001
+#define EGL_FOREVER_NV                    0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV           0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV            0x30EB
+#define EGL_CONDITION_SATISFIED_NV        0x30EC
+#define EGL_SYNC_TYPE_NV                  0x30ED
+#define EGL_SYNC_CONDITION_NV             0x30EE
+#define EGL_SYNC_FENCE_NV                 0x30EF
+#define EGL_NO_SYNC_NV                    ((EGLSyncNV)0)
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
</ins><span class="cx"> #endif
</span><ins>+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_sync */
</ins><span class="cx"> 
</span><del>-#ifndef EGL_EXT_image_dma_buf_import
-#define EGL_EXT_image_dma_buf_import 1
-#define EGL_LINUX_DMA_BUF_EXT                        0x3270
-#define EGL_LINUX_DRM_FOURCC_EXT                0x3271
-#define EGL_DMA_BUF_PLANE0_FD_EXT                0x3272
-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT                0x3273
-#define EGL_DMA_BUF_PLANE0_PITCH_EXT                0x3274
-#define EGL_DMA_BUF_PLANE1_FD_EXT                0x3275
-#define EGL_DMA_BUF_PLANE1_OFFSET_EXT                0x3276
-#define EGL_DMA_BUF_PLANE1_PITCH_EXT                0x3277
-#define EGL_DMA_BUF_PLANE2_FD_EXT                0x3278
-#define EGL_DMA_BUF_PLANE2_OFFSET_EXT                0x3279
-#define EGL_DMA_BUF_PLANE2_PITCH_EXT                0x327A
-#define EGL_YUV_COLOR_SPACE_HINT_EXT                0x327B
-#define EGL_SAMPLE_RANGE_HINT_EXT                0x327C
-#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
-#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
-#define EGL_ITU_REC601_EXT                        0x327F
-#define EGL_ITU_REC709_EXT                        0x3280
-#define EGL_ITU_REC2020_EXT                        0x3281
-#define EGL_YUV_FULL_RANGE_EXT                        0x3282
-#define EGL_YUV_NARROW_RANGE_EXT                0x3283
-#define EGL_YUV_CHROMA_SITING_0_EXT                0x3284
-#define EGL_YUV_CHROMA_SITING_0_5_EXT                0x3285
</del><ins>+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
</ins><span class="cx"> #endif
</span><ins>+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_system_time */
</ins><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#endif /* __eglext_h_ */
</del><ins>+#endif
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeEGLeglplatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/include/EGL/eglplatform.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> #define __eglplatform_h_
</span><span class="cx"> 
</span><span class="cx"> /*
</span><del>-** Copyright (c) 2007-2009 The Khronos Group Inc.
</del><ins>+** Copyright (c) 2007-2013 The Khronos Group Inc.
</ins><span class="cx"> **
</span><span class="cx"> ** Permission is hereby granted, free of charge, to any person obtaining a
</span><span class="cx"> ** copy of this software and/or associated documentation files (the
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> */
</span><span class="cx"> 
</span><span class="cx"> /* Platform-specific types and definitions for egl.h
</span><del>- * $Revision: 12306 $ on $Date: 2010-08-25 12:51:28 -0400 (Wed, 25 Aug 2010) $
</del><ins>+ * $Revision: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
</ins><span class="cx">  *
</span><span class="cx">  * Adopters may modify khrplatform.h and this file to suit their platform.
</span><span class="cx">  * You are encouraged to submit all modifications to the Khronos group so that
</span><span class="lines">@@ -75,7 +75,13 @@
</span><span class="cx"> 
</span><span class="cx"> typedef HDC     EGLNativeDisplayType;
</span><span class="cx"> typedef HBITMAP EGLNativePixmapType;
</span><ins>+
+#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) /* Windows Desktop */
</ins><span class="cx"> typedef HWND    EGLNativeWindowType;
</span><ins>+#else /* Windows Store */
+#include &lt;inspectable.h&gt;
+typedef IInspectable* EGLNativeWindowType;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> #elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
</span><span class="cx"> 
</span><span class="lines">@@ -83,6 +89,16 @@
</span><span class="cx"> typedef void *EGLNativeWindowType;
</span><span class="cx"> typedef void *EGLNativePixmapType;
</span><span class="cx"> 
</span><ins>+#elif defined(__ANDROID__) || defined(ANDROID)
+
+#include &lt;android/native_window.h&gt;
+
+struct egl_native_pixmap_t;
+
+typedef struct ANativeWindow*           EGLNativeWindowType;
+typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
+typedef void*                           EGLNativeDisplayType;
+
</ins><span class="cx"> #elif defined(__unix__)
</span><span class="cx"> 
</span><span class="cx"> /* X11 (tentative)  */
</span><span class="lines">@@ -93,6 +109,14 @@
</span><span class="cx"> typedef Pixmap   EGLNativePixmapType;
</span><span class="cx"> typedef Window   EGLNativeWindowType;
</span><span class="cx"> 
</span><ins>+#elif defined(__GNUC__) &amp;&amp; ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
+
+// TODO(jmadill): native implementation for OSX
+
+typedef void *EGLNativeDisplayType;
+typedef void *EGLNativePixmapType;
+typedef void *EGLNativeWindowType;
+
</ins><span class="cx"> #else
</span><span class="cx"> #error &quot;Platform not recognized&quot;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLSLANGShaderLangh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderLang.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -3,8 +3,8 @@
</span><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><del>-#ifndef _COMPILER_INTERFACE_INCLUDED_
-#define _COMPILER_INTERFACE_INCLUDED_
</del><ins>+#ifndef GLSLANG_SHADERLANG_H_
+#define GLSLANG_SHADERLANG_H_
</ins><span class="cx"> 
</span><span class="cx"> #if defined(COMPONENT_BUILD) &amp;&amp; !defined(ANGLE_TRANSLATOR_STATIC)
</span><span class="cx"> #if defined(_WIN32) || defined(_WIN64)
</span><span class="lines">@@ -23,37 +23,40 @@
</span><span class="cx"> #define COMPILER_EXPORT
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#include &quot;khrplatform.h&quot;
</del><span class="cx"> #include &lt;stddef.h&gt;
</span><span class="cx"> 
</span><ins>+#include &quot;khrplatform.h&quot;
+
+#include &lt;map&gt;
+#include &lt;string&gt;
+#include &lt;vector&gt;
+
</ins><span class="cx"> //
</span><span class="cx"> // This is the platform independent interface between an OGL driver
</span><span class="cx"> // and the shading language compiler.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifdef __cplusplus
-extern &quot;C&quot; {
-#endif
</del><ins>+namespace sh
+{
+// GLenum alias
+typedef unsigned int GLenum;
+}
</ins><span class="cx"> 
</span><ins>+// Must be included after GLenum proxy typedef
+// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
+#include &quot;ShaderVars.h&quot;
+
</ins><span class="cx"> // Version number for shader translation API.
</span><span class="cx"> // It is incremented every time the API changes.
</span><del>-#define ANGLE_SH_VERSION 123
</del><ins>+#define ANGLE_SH_VERSION 135
</ins><span class="cx"> 
</span><del>-//
-// The names of the following enums have been derived by replacing GL prefix
-// with SH. For example, SH_INFO_LOG_LENGTH is equivalent to GL_INFO_LOG_LENGTH.
-// The enum values are also equal to the values of their GL counterpart. This
-// is done to make it easier for applications to use the shader library.
-//
</del><span class="cx"> typedef enum {
</span><del>-  SH_FRAGMENT_SHADER = 0x8B30,
-  SH_VERTEX_SHADER   = 0x8B31
-} ShShaderType;
-
-typedef enum {
</del><span class="cx">   SH_GLES2_SPEC = 0x8B40,
</span><span class="cx">   SH_WEBGL_SPEC = 0x8B41,
</span><span class="cx"> 
</span><ins>+  SH_GLES3_SPEC = 0x8B86,
+  SH_WEBGL2_SPEC = 0x8B87,
+
</ins><span class="cx">   // The CSS Shaders spec is a subset of the WebGL spec.
</span><span class="cx">   //
</span><span class="cx">   // In both CSS vertex and fragment shaders, ANGLE:
</span><span class="lines">@@ -78,87 +81,24 @@
</span><span class="cx"> } ShShaderSpec;
</span><span class="cx"> 
</span><span class="cx"> typedef enum {
</span><del>-  SH_ESSL_OUTPUT   = 0x8B45,
-  SH_GLSL_OUTPUT   = 0x8B46,
-  SH_HLSL_OUTPUT   = 0x8B47,
-  SH_HLSL9_OUTPUT  = 0x8B47,
-  SH_HLSL11_OUTPUT = 0x8B48
</del><ins>+  SH_ESSL_OUTPUT               = 0x8B45,
+  // SH_GLSL_OUTPUT is deprecated. This is to not break the build.
+  SH_GLSL_OUTPUT               = 0x8B46,
+  SH_GLSL_COMPATIBILITY_OUTPUT = 0x8B46,
+  // SH_GLSL_CORE_OUTPUT is deprecated.
+  SH_GLSL_CORE_OUTPUT          = 0x8B47,
+  //Note: GL introduced core profiles in 1.5. However, for compatiblity with Chromium, we treat SH_GLSL_CORE_OUTPUT as GLSL_130_OUTPUT.
+  //TODO: Remove SH_GLSL_CORE_OUTPUT
+  SH_GLSL_130_OUTPUT           = 0x8B47,
+  SH_GLSL_410_CORE_OUTPUT      = 0x8B84,
+  SH_GLSL_420_CORE_OUTPUT      = 0x8B85,
+
+  // HLSL output only supported in some configurations.
+  SH_HLSL_OUTPUT   = 0x8B48,
+  SH_HLSL9_OUTPUT  = 0x8B48,
+  SH_HLSL11_OUTPUT = 0x8B49
</ins><span class="cx"> } ShShaderOutput;
</span><span class="cx"> 
</span><del>-typedef enum {
-  SH_NONE           = 0,
-  SH_INT            = 0x1404,
-  SH_UNSIGNED_INT   = 0x1405,
-  SH_FLOAT          = 0x1406,
-  SH_FLOAT_VEC2     = 0x8B50,
-  SH_FLOAT_VEC3     = 0x8B51,
-  SH_FLOAT_VEC4     = 0x8B52,
-  SH_INT_VEC2       = 0x8B53,
-  SH_INT_VEC3       = 0x8B54,
-  SH_INT_VEC4       = 0x8B55,
-  SH_UNSIGNED_INT_VEC2 = 0x8DC6,
-  SH_UNSIGNED_INT_VEC3 = 0x8DC7,
-  SH_UNSIGNED_INT_VEC4 = 0x8DC8,
-  SH_BOOL           = 0x8B56,
-  SH_BOOL_VEC2      = 0x8B57,
-  SH_BOOL_VEC3      = 0x8B58,
-  SH_BOOL_VEC4      = 0x8B59,
-  SH_FLOAT_MAT2     = 0x8B5A,
-  SH_FLOAT_MAT3     = 0x8B5B,
-  SH_FLOAT_MAT4     = 0x8B5C,
-  SH_FLOAT_MAT2x3   = 0x8B65,
-  SH_FLOAT_MAT2x4   = 0x8B66,
-  SH_FLOAT_MAT3x2   = 0x8B67,
-  SH_FLOAT_MAT3x4   = 0x8B68,
-  SH_FLOAT_MAT4x2   = 0x8B69,
-  SH_FLOAT_MAT4x3   = 0x8B6A,
-  SH_SAMPLER_2D     = 0x8B5E,
-  SH_SAMPLER_3D     = 0x8B5F,
-  SH_SAMPLER_CUBE   = 0x8B60,
-  SH_SAMPLER_2D_RECT_ARB = 0x8B63,
-  SH_SAMPLER_EXTERNAL_OES = 0x8D66,
-  SH_SAMPLER_2D_ARRAY   = 0x8DC1,
-  SH_INT_SAMPLER_2D     = 0x8DCA,
-  SH_INT_SAMPLER_3D     = 0x8DCB,
-  SH_INT_SAMPLER_CUBE   = 0x8DCC,
-  SH_INT_SAMPLER_2D_ARRAY = 0x8DCF,
-  SH_UNSIGNED_INT_SAMPLER_2D     = 0x8DD2,
-  SH_UNSIGNED_INT_SAMPLER_3D     = 0x8DD3,
-  SH_UNSIGNED_INT_SAMPLER_CUBE   = 0x8DD4,
-  SH_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7,
-  SH_SAMPLER_2D_SHADOW       = 0x8B62,
-  SH_SAMPLER_CUBE_SHADOW     = 0x8DC5,
-  SH_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4
-} ShDataType;
-
-typedef enum {
-  SH_PRECISION_HIGHP     = 0x5001,
-  SH_PRECISION_MEDIUMP   = 0x5002,
-  SH_PRECISION_LOWP      = 0x5003,
-  SH_PRECISION_UNDEFINED = 0
-} ShPrecisionType;
-
-typedef enum {
-  SH_INFO_LOG_LENGTH                = 0x8B84,
-  SH_OBJECT_CODE_LENGTH             = 0x8B88,  // GL_SHADER_SOURCE_LENGTH
-  SH_ACTIVE_UNIFORMS                = 0x8B86,
-  SH_ACTIVE_UNIFORM_MAX_LENGTH      = 0x8B87,
-  SH_ACTIVE_ATTRIBUTES              = 0x8B89,
-  SH_ACTIVE_ATTRIBUTE_MAX_LENGTH    = 0x8B8A,
-  SH_VARYINGS                       = 0x8BBB,
-  SH_VARYING_MAX_LENGTH             = 0x8BBC,
-  SH_MAPPED_NAME_MAX_LENGTH         = 0x6000,
-  SH_NAME_MAX_LENGTH                = 0x6001,
-  SH_HASHED_NAME_MAX_LENGTH         = 0x6002,
-  SH_HASHED_NAMES_COUNT             = 0x6003,
-  SH_ACTIVE_UNIFORMS_ARRAY          = 0x6004,
-  SH_SHADER_VERSION                 = 0x6005,
-  SH_ACTIVE_INTERFACE_BLOCKS_ARRAY  = 0x6006,
-  SH_ACTIVE_OUTPUT_VARIABLES_ARRAY  = 0x6007,
-  SH_ACTIVE_ATTRIBUTES_ARRAY        = 0x6008,
-  SH_ACTIVE_VARYINGS_ARRAY          = 0x6009,
-} ShShaderInfo;
-
</del><span class="cx"> // Compile options.
</span><span class="cx"> typedef enum {
</span><span class="cx">   SH_VALIDATE                = 0,
</span><span class="lines">@@ -178,7 +118,7 @@
</span><span class="cx">   // This is needed only as a workaround for certain OpenGL driver bugs.
</span><span class="cx">   SH_EMULATE_BUILT_IN_FUNCTIONS = 0x0100,
</span><span class="cx"> 
</span><del>-  // This is an experimental flag to enforce restrictions that aim to prevent 
</del><ins>+  // This is an experimental flag to enforce restrictions that aim to prevent
</ins><span class="cx">   // timing attacks.
</span><span class="cx">   // It generates compilation errors for shaders that could expose sensitive
</span><span class="cx">   // texture information via the timing channel.
</span><span class="lines">@@ -191,7 +131,7 @@
</span><span class="cx">   // This flag only has an effect if all of the following are true:
</span><span class="cx">   // - The shader spec is SH_WEBGL_SPEC.
</span><span class="cx">   // - The compile options contain the SH_TIMING_RESTRICTIONS flag.
</span><del>-  // - The shader type is SH_FRAGMENT_SHADER.
</del><ins>+  // - The shader type is GL_FRAGMENT_SHADER.
</ins><span class="cx">   SH_DEPENDENCY_GRAPH = 0x0400,
</span><span class="cx"> 
</span><span class="cx">   // Enforce the GLSL 1.017 Appendix A section 7 packing restrictions.
</span><span class="lines">@@ -234,6 +174,20 @@
</span><span class="cx">   // It is intended as a workaround for drivers which incorrectly optimize
</span><span class="cx">   // out such varyings and cause a link failure.
</span><span class="cx">   SH_INIT_VARYINGS_WITHOUT_STATIC_USE = 0x20000,
</span><ins>+
+  // This flag scalarizes vec/ivec/bvec/mat constructor args.
+  // It is intended as a workaround for Linux/Mac driver bugs.
+  SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS = 0x40000,
+
+  // This flag overwrites a struct name with a unique prefix.
+  // It is intended as a workaround for drivers that do not handle
+  // struct scopes correctly, including all Mac drivers and Linux AMD.
+  SH_REGENERATE_STRUCT_NAMES = 0x80000,
+
+  // This flag makes the compiler not prune unused function early in the
+  // compilation process. Pruning coupled with SH_LIMIT_CALL_STACK_DEPTH
+  // helps avoid bad shaders causing stack overflows.
+  SH_DONT_PRUNE_UNUSED_FUNCTIONS = 0x100000,
</ins><span class="cx"> } ShCompileOptions;
</span><span class="cx"> 
</span><span class="cx"> // Defines alternate strategies for implementing array index clamping.
</span><span class="lines">@@ -248,14 +202,14 @@
</span><span class="cx"> //
</span><span class="cx"> // Driver must call this first, once, before doing any other
</span><span class="cx"> // compiler operations.
</span><del>-// If the function succeeds, the return value is nonzero, else zero.
</del><ins>+// If the function succeeds, the return value is true, else false.
</ins><span class="cx"> //
</span><del>-COMPILER_EXPORT int ShInitialize();
</del><ins>+COMPILER_EXPORT bool ShInitialize();
</ins><span class="cx"> //
</span><span class="cx"> // Driver should call this at shutdown.
</span><del>-// If the function succeeds, the return value is nonzero, else zero.
</del><ins>+// If the function succeeds, the return value is true, else false.
</ins><span class="cx"> //
</span><del>-COMPILER_EXPORT int ShFinalize();
</del><ins>+COMPILER_EXPORT bool ShFinalize();
</ins><span class="cx"> 
</span><span class="cx"> // The 64 bits hash function. The first parameter is the input string; the
</span><span class="cx"> // second parameter is the string length.
</span><span class="lines">@@ -285,7 +239,17 @@
</span><span class="cx">     int EXT_draw_buffers;
</span><span class="cx">     int EXT_frag_depth;
</span><span class="cx">     int EXT_shader_texture_lod;
</span><ins>+    int WEBGL_debug_shader_precision;
+    int EXT_shader_framebuffer_fetch;
+    int NV_shader_framebuffer_fetch;
+    int ARM_shader_framebuffer_fetch;
</ins><span class="cx"> 
</span><ins>+    // Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives
+    // with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate
+    // EXT_draw_buffers by using it in combination with GLES3.0 glDrawBuffers
+    // function. This applies to Tegra K1 devices.
+    int NV_draw_buffers;
+
</ins><span class="cx">     // Set to 1 if highp precision is supported in the fragment language.
</span><span class="cx">     // Default is 0.
</span><span class="cx">     int FragmentPrecisionHigh;
</span><span class="lines">@@ -314,40 +278,51 @@
</span><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Initialize built-in resources with minimum expected values.
</span><ins>+// Parameters:
+// resources: The object to initialize. Will be comparable with memcmp.
</ins><span class="cx"> //
</span><del>-COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources* resources);
</del><ins>+COMPILER_EXPORT void ShInitBuiltInResources(ShBuiltInResources *resources);
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // ShHandle held by but opaque to the driver.  It is allocated,
</span><del>-// managed, and de-allocated by the compiler. It's contents 
</del><ins>+// managed, and de-allocated by the compiler. Its contents
</ins><span class="cx"> // are defined by and used by the compiler.
</span><span class="cx"> //
</span><span class="cx"> // If handle creation fails, 0 will be returned.
</span><span class="cx"> //
</span><del>-typedef void* ShHandle;
</del><ins>+typedef void *ShHandle;
</ins><span class="cx"> 
</span><span class="cx"> //
</span><ins>+// Returns the a concatenated list of the items in ShBuiltInResources as a
+// null-terminated string.
+// This function must be updated whenever ShBuiltInResources is changed.
+// Parameters:
+// handle: Specifies the handle of the compiler to be used.
+COMPILER_EXPORT const std::string &amp;ShGetBuiltInResourcesString(const ShHandle handle);
+
+//
</ins><span class="cx"> // Driver calls these to create and destroy compiler objects.
</span><span class="cx"> //
</span><span class="cx"> // Returns the handle of constructed compiler, null if the requested compiler is
</span><span class="cx"> // not supported.
</span><span class="cx"> // Parameters:
</span><del>-// type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
</del><ins>+// type: Specifies the type of shader - GL_FRAGMENT_SHADER or GL_VERTEX_SHADER.
</ins><span class="cx"> // spec: Specifies the language spec the compiler must conform to -
</span><span class="cx"> //       SH_GLES2_SPEC or SH_WEBGL_SPEC.
</span><span class="cx"> // output: Specifies the output code type - SH_ESSL_OUTPUT, SH_GLSL_OUTPUT,
</span><del>-//         SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT.
</del><ins>+//         SH_HLSL9_OUTPUT or SH_HLSL11_OUTPUT. Note: HLSL output is only
+//         supported in some configurations.
</ins><span class="cx"> // resources: Specifies the built-in resources.
</span><span class="cx"> COMPILER_EXPORT ShHandle ShConstructCompiler(
</span><del>-    ShShaderType type,
</del><ins>+    sh::GLenum type,
</ins><span class="cx">     ShShaderSpec spec,
</span><span class="cx">     ShShaderOutput output,
</span><del>-    const ShBuiltInResources* resources);
</del><ins>+    const ShBuiltInResources *resources);
</ins><span class="cx"> COMPILER_EXPORT void ShDestruct(ShHandle handle);
</span><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Compiles the given shader source.
</span><del>-// If the function succeeds, the return value is nonzero, else zero.
</del><ins>+// If the function succeeds, the return value is true, else false.
</ins><span class="cx"> // Parameters:
</span><span class="cx"> // handle: Specifies the handle of compiler to be used.
</span><span class="cx"> // shaderStrings: Specifies an array of pointers to null-terminated strings
</span><span class="lines">@@ -369,156 +344,89 @@
</span><span class="cx"> // SH_VARIABLES: Extracts attributes, uniforms, and varyings.
</span><span class="cx"> //               Can be queried by calling ShGetVariableInfo().
</span><span class="cx"> //
</span><del>-COMPILER_EXPORT int ShCompile(
</del><ins>+COMPILER_EXPORT bool ShCompile(
</ins><span class="cx">     const ShHandle handle,
</span><del>-    const char* const shaderStrings[],
</del><ins>+    const char * const shaderStrings[],
</ins><span class="cx">     size_t numStrings,
</span><del>-    int compileOptions
-    );
</del><ins>+    int compileOptions);
</ins><span class="cx"> 
</span><del>-// Returns a parameter from a compiled shader.
-// Parameters:
-// handle: Specifies the compiler
-// pname: Specifies the parameter to query.
-// The following parameters are defined:
-// SH_INFO_LOG_LENGTH: the number of characters in the information log
-//                     including the null termination character.
-// SH_OBJECT_CODE_LENGTH: the number of characters in the object code
-//                        including the null termination character.
-// SH_ACTIVE_ATTRIBUTES: the number of active attribute variables.
-// SH_ACTIVE_ATTRIBUTE_MAX_LENGTH: the length of the longest active attribute
-//                                 variable name including the null
-//                                 termination character.
-// SH_ACTIVE_UNIFORMS: the number of active uniform variables.
-// SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform
-//                               variable name including the null
-//                               termination character.
-// SH_VARYINGS: the number of varying variables.
-// SH_VARYING_MAX_LENGTH: the length of the longest varying variable name
-//                        including the null termination character.
-// SH_MAPPED_NAME_MAX_LENGTH: the length of the mapped variable name including
-//                            the null termination character.
-// SH_NAME_MAX_LENGTH: the max length of a user-defined name including the
-//                     null termination character.
-// SH_HASHED_NAME_MAX_LENGTH: the max length of a hashed name including the
-//                            null termination character.
-// SH_HASHED_NAMES_COUNT: the number of hashed names from the latest compile.
-// SH_SHADER_VERSION: the version of the shader language
-//
-// params: Requested parameter
-COMPILER_EXPORT void ShGetInfo(const ShHandle handle,
-                               ShShaderInfo pname,
-                               size_t* params);
</del><ins>+// Return the version of the shader language.
+COMPILER_EXPORT int ShGetShaderVersion(const ShHandle handle);
</ins><span class="cx"> 
</span><del>-// Returns nul-terminated information log for a compiled shader.
</del><ins>+// Return the currently set language output type.
+COMPILER_EXPORT ShShaderOutput ShGetShaderOutputType(
+    const ShHandle handle);
+
+// Returns null-terminated information log for a compiled shader.
</ins><span class="cx"> // Parameters:
</span><span class="cx"> // handle: Specifies the compiler
</span><del>-// infoLog: Specifies an array of characters that is used to return
-//          the information log. It is assumed that infoLog has enough memory
-//          to accomodate the information log. The size of the buffer required
-//          to store the returned information log can be obtained by calling
-//          ShGetInfo with SH_INFO_LOG_LENGTH.
-COMPILER_EXPORT void ShGetInfoLog(const ShHandle handle, char* infoLog);
</del><ins>+COMPILER_EXPORT const std::string &amp;ShGetInfoLog(const ShHandle handle);
</ins><span class="cx"> 
</span><span class="cx"> // Returns null-terminated object code for a compiled shader.
</span><span class="cx"> // Parameters:
</span><span class="cx"> // handle: Specifies the compiler
</span><del>-// objCode: Specifies an array of characters that is used to return
-//          the object code. It is assumed that objCode has enough memory to
-//          accomodate the object code. The size of the buffer required to
-//          store the returned object code can be obtained by calling
-//          ShGetInfo with SH_OBJECT_CODE_LENGTH.
-COMPILER_EXPORT void ShGetObjectCode(const ShHandle handle, char* objCode);
</del><ins>+COMPILER_EXPORT const std::string &amp;ShGetObjectCode(const ShHandle handle);
</ins><span class="cx"> 
</span><del>-// Returns information about a shader variable.
</del><ins>+// Returns a (original_name, hash) map containing all the user defined
+// names in the shader, including variable names, function names, struct
+// names, and struct field names.
</ins><span class="cx"> // Parameters:
</span><span class="cx"> // handle: Specifies the compiler
</span><del>-// variableType: Specifies the variable type; options include
-//               SH_ACTIVE_ATTRIBUTES, SH_ACTIVE_UNIFORMS, SH_VARYINGS.
-// index: Specifies the index of the variable to be queried.
-// length: Returns the number of characters actually written in the string
-//         indicated by name (excluding the null terminator) if a value other
-//         than NULL is passed.
-// size: Returns the size of the variable.
-// type: Returns the data type of the variable.
-// precision: Returns the precision of the variable.
-// staticUse: Returns 1 if the variable is accessed in a statement after
-//            pre-processing, whether or not run-time flow of control will
-//            cause that statement to be executed.
-//            Returns 0 otherwise.
-// name: Returns a null terminated string containing the name of the
-//       variable. It is assumed that name has enough memory to accormodate
-//       the variable name. The size of the buffer required to store the
-//       variable name can be obtained by calling ShGetInfo with
-//       SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_ACTIVE_UNIFORM_MAX_LENGTH,
-//       SH_VARYING_MAX_LENGTH.
-// mappedName: Returns a null terminated string containing the mapped name of
-//             the variable, It is assumed that mappedName has enough memory
-//             (SH_MAPPED_NAME_MAX_LENGTH), or NULL if don't care about the
-//             mapped name. If the name is not mapped, then name and mappedName
-//             are the same.
-COMPILER_EXPORT void ShGetVariableInfo(const ShHandle handle,
-                                       ShShaderInfo variableType,
-                                       int index,
-                                       size_t* length,
-                                       int* size,
-                                       ShDataType* type,
-                                       ShPrecisionType* precision,
-                                       int* staticUse,
-                                       char* name,
-                                       char* mappedName);
</del><ins>+COMPILER_EXPORT const std::map&lt;std::string, std::string&gt; *ShGetNameHashingMap(
+    const ShHandle handle);
</ins><span class="cx"> 
</span><del>-// Returns information about a name hashing entry from the latest compile.
</del><ins>+// Shader variable inspection.
+// Returns a pointer to a list of variables of the designated type.
+// (See ShaderVars.h for type definitions, included above)
+// Returns NULL on failure.
</ins><span class="cx"> // Parameters:
</span><span class="cx"> // handle: Specifies the compiler
</span><del>-// 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);
</del><ins>+COMPILER_EXPORT const std::vector&lt;sh::Uniform&gt; *ShGetUniforms(const ShHandle handle);
+COMPILER_EXPORT const std::vector&lt;sh::Varying&gt; *ShGetVaryings(const ShHandle handle);
+COMPILER_EXPORT const std::vector&lt;sh::Attribute&gt; *ShGetAttributes(const ShHandle handle);
+COMPILER_EXPORT const std::vector&lt;sh::Attribute&gt; *ShGetOutputVariables(const ShHandle handle);
+COMPILER_EXPORT const std::vector&lt;sh::InterfaceBlock&gt; *ShGetInterfaceBlocks(const ShHandle handle);
</ins><span class="cx"> 
</span><del>-// Returns a parameter from a compiled shader.
-// Parameters:
-// handle: Specifies the compiler
-// pname: Specifies the parameter to query.
-// The following parameters are defined:
-// SH_ACTIVE_UNIFORMS_ARRAY: an STL vector of active uniforms. Valid only for
-//                           HLSL output.
-// params: Requested parameter
-COMPILER_EXPORT void ShGetInfoPointer(const ShHandle handle,
-                                      ShShaderInfo pname,
-                                      void** params);
-
</del><span class="cx"> typedef struct
</span><span class="cx"> {
</span><del>-    ShDataType type;
</del><ins>+    sh::GLenum type;
</ins><span class="cx">     int size;
</span><span class="cx"> } ShVariableInfo;
</span><span class="cx"> 
</span><del>-// Returns 1 if the passed in variables pack in maxVectors following
</del><ins>+// Returns true if the passed in variables pack in maxVectors following
</ins><span class="cx"> // the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
</span><del>-// Returns 0 otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS
</del><ins>+// Returns false otherwise. Also look at the SH_ENFORCE_PACKING_RESTRICTIONS
</ins><span class="cx"> // flag above.
</span><span class="cx"> // Parameters:
</span><span class="cx"> // maxVectors: the available rows of registers.
</span><span class="cx"> // varInfoArray: an array of variable info (types and sizes).
</span><span class="cx"> // varInfoArraySize: the size of the variable array.
</span><del>-COMPILER_EXPORT int ShCheckVariablesWithinPackingLimits(
</del><ins>+COMPILER_EXPORT bool ShCheckVariablesWithinPackingLimits(
</ins><span class="cx">     int maxVectors,
</span><del>-    ShVariableInfo* varInfoArray,
</del><ins>+    ShVariableInfo *varInfoArray,
</ins><span class="cx">     size_t varInfoArraySize);
</span><span class="cx"> 
</span><del>-#ifdef __cplusplus
-}
-#endif
</del><ins>+// Gives the compiler-assigned register for an interface block.
+// The method writes the value to the output variable &quot;indexOut&quot;.
+// Returns true if it found a valid interface block, false otherwise.
+// Parameters:
+// handle: Specifies the compiler
+// interfaceBlockName: Specifies the interface block
+// indexOut: output variable that stores the assigned register
+COMPILER_EXPORT bool ShGetInterfaceBlockRegister(const ShHandle handle,
+                                                 const std::string &amp;interfaceBlockName,
+                                                 unsigned int *indexOut);
</ins><span class="cx"> 
</span><del>-#endif // _COMPILER_INTERFACE_INCLUDED_
</del><ins>+// Gives the compiler-assigned register for uniforms in the default
+// interface block.
+// The method writes the value to the output variable &quot;indexOut&quot;.
+// Returns true if it found a valid default uniform, false otherwise.
+// Parameters:
+// handle: Specifies the compiler
+// interfaceBlockName: Specifies the uniform
+// indexOut: output variable that stores the assigned register
+COMPILER_EXPORT bool ShGetUniformRegister(const ShHandle handle,
+                                          const std::string &amp;uniformName,
+                                          unsigned int *indexOut);
+
+#endif // GLSLANG_SHADERLANG_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeGLSLANGShaderVarsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderVars.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderVars.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/GLSLANG/ShaderVars.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,190 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+// ShaderVars.h:
+//  Types to represent GL variables (varyings, uniforms, etc)
+//
+
+#ifndef GLSLANG_SHADERVARS_H_
+#define GLSLANG_SHADERVARS_H_
+
+#include &lt;string&gt;
+#include &lt;vector&gt;
+#include &lt;algorithm&gt;
+
+// Assume ShaderLang.h is included before ShaderVars.h, for sh::GLenum
+// Note: make sure to increment ANGLE_SH_VERSION when changing ShaderVars.h
+
+namespace sh
+{
+
+// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec
+enum InterpolationType
+{
+    INTERPOLATION_SMOOTH,
+    INTERPOLATION_CENTROID,
+    INTERPOLATION_FLAT
+};
+
+// Validate link &amp; SSO consistency of interpolation qualifiers
+COMPILER_EXPORT bool InterpolationTypesMatch(InterpolationType a, InterpolationType b);
+
+// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec
+enum BlockLayoutType
+{
+    BLOCKLAYOUT_STANDARD,
+    BLOCKLAYOUT_PACKED,
+    BLOCKLAYOUT_SHARED
+};
+
+// Base class for all variables defined in shaders, including Varyings, Uniforms, etc
+// Note: we must override the copy constructor and assignment operator so we can
+// work around excessive GCC binary bloating:
+// See https://code.google.com/p/angleproject/issues/detail?id=697
+struct COMPILER_EXPORT ShaderVariable
+{
+    ShaderVariable();
+    ShaderVariable(GLenum typeIn, unsigned int arraySizeIn);
+    ~ShaderVariable();
+    ShaderVariable(const ShaderVariable &amp;other);
+    ShaderVariable &amp;operator=(const ShaderVariable &amp;other);
+
+    bool isArray() const { return arraySize &gt; 0; }
+    unsigned int elementCount() const { return std::max(1u, arraySize); }
+    bool isStruct() const { return !fields.empty(); }
+
+    // All of the shader's variables are described using nested data
+    // structures. This is needed in order to disambiguate similar looking
+    // types, such as two structs containing the same fields, but in
+    // different orders. &quot;findInfoByMappedName&quot; provides an easy query for
+    // users to dive into the data structure and fetch the unique variable
+    // instance corresponding to a dereferencing chain of the top-level
+    // variable.
+    // Given a mapped name like 'a[0].b.c[0]', return the ShaderVariable
+    // that defines 'c' in |leafVar|, and the original name 'A[0].B.C[0]'
+    // in |originalName|, based on the assumption that |this| defines 'a'.
+    // If no match is found, return false.
+    bool findInfoByMappedName(const std::string &amp;mappedFullName,
+                              const ShaderVariable **leafVar,
+                              std::string* originalFullName) const;
+
+    bool isBuiltIn() const { return name.compare(0, 3, &quot;gl_&quot;) == 0; }
+
+    GLenum type;
+    GLenum precision;
+    std::string name;
+    std::string mappedName;
+    unsigned int arraySize;
+    bool staticUse;
+    std::vector&lt;ShaderVariable&gt; fields;
+    std::string structName;
+
+  protected:
+    bool isSameVariableAtLinkTime(const ShaderVariable &amp;other,
+                                  bool matchPrecision) const;
+
+    bool operator==(const ShaderVariable &amp;other) const;
+    bool operator!=(const ShaderVariable &amp;other) const
+    {
+        return !operator==(other);
+    }
+};
+
+struct COMPILER_EXPORT Uniform : public ShaderVariable
+{
+    Uniform();
+    ~Uniform();
+    Uniform(const Uniform &amp;other);
+    Uniform &amp;operator=(const Uniform &amp;other);
+    bool operator==(const Uniform &amp;other) const;
+    bool operator!=(const Uniform &amp;other) const
+    {
+        return !operator==(other);
+    }
+
+    // Decide whether two uniforms are the same at shader link time,
+    // assuming one from vertex shader and the other from fragment shader.
+    // See GLSL ES Spec 3.00.3, sec 4.3.5.
+    bool isSameUniformAtLinkTime(const Uniform &amp;other) const;
+};
+
+struct COMPILER_EXPORT Attribute : public ShaderVariable
+{
+    Attribute();
+    ~Attribute();
+    Attribute(const Attribute &amp;other);
+    Attribute &amp;operator=(const Attribute &amp;other);
+    bool operator==(const Attribute &amp;other) const;
+    bool operator!=(const Attribute &amp;other) const
+    {
+        return !operator==(other);
+    }
+
+    int location;
+};
+
+struct COMPILER_EXPORT InterfaceBlockField : public ShaderVariable
+{
+    InterfaceBlockField();
+    ~InterfaceBlockField();
+    InterfaceBlockField(const InterfaceBlockField &amp;other);
+    InterfaceBlockField &amp;operator=(const InterfaceBlockField &amp;other);
+    bool operator==(const InterfaceBlockField &amp;other) const;
+    bool operator!=(const InterfaceBlockField &amp;other) const
+    {
+        return !operator==(other);
+    }
+
+    // Decide whether two InterfaceBlock fields are the same at shader
+    // link time, assuming one from vertex shader and the other from
+    // fragment shader.
+    // See GLSL ES Spec 3.00.3, sec 4.3.7.
+    bool isSameInterfaceBlockFieldAtLinkTime(
+        const InterfaceBlockField &amp;other) const;
+
+    bool isRowMajorLayout;
+};
+
+struct COMPILER_EXPORT Varying : public ShaderVariable
+{
+    Varying();
+    ~Varying();
+    Varying(const Varying &amp;otherg);
+    Varying &amp;operator=(const Varying &amp;other);
+    bool operator==(const Varying &amp;other) const;
+    bool operator!=(const Varying &amp;other) const
+    {
+        return !operator==(other);
+    }
+
+    // Decide whether two varyings are the same at shader link time,
+    // assuming one from vertex shader and the other from fragment shader.
+    // See GLSL ES Spec 3.00.3, sec 4.3.9.
+    bool isSameVaryingAtLinkTime(const Varying &amp;other) const;
+
+    InterpolationType interpolation;
+    bool isInvariant;
+};
+
+struct COMPILER_EXPORT InterfaceBlock
+{
+    InterfaceBlock();
+    ~InterfaceBlock();
+    InterfaceBlock(const InterfaceBlock &amp;other);
+    InterfaceBlock &amp;operator=(const InterfaceBlock &amp;other);
+
+    std::string name;
+    std::string mappedName;
+    std::string instanceName;
+    unsigned int arraySize;
+    BlockLayoutType layout;
+    bool isRowMajorLayout;
+    bool staticUse;
+    std::vector&lt;InterfaceBlockField&gt; fields;
+};
+
+}
+
+#endif // GLSLANG_SHADERVARS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeangle_glh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/angle_gl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/angle_gl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/angle_gl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// angle_gl.h:
+//   Includes all necessary GL headers and definitions for ANGLE.
+//
+
+#ifndef ANGLEGL_H_
+#define ANGLEGL_H_
+
+#include &quot;GLES2/gl2.h&quot;
+#include &quot;GLES2/gl2ext.h&quot;
+#include &quot;GLES3/gl3.h&quot;
+#include &quot;GLES3/gl3ext.h&quot;
+
+// The following enum is used in ANGLE, but is from desktop GL
+#ifndef GL_SAMPLER_2D_RECT_ARB
+#define GL_SAMPLER_2D_RECT_ARB 0x8B63
+#endif
+
+#endif // ANGLEGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeangle_windowsstoreh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/angle_windowsstore.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/angle_windowsstore.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/angle_windowsstore.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// angle_windowsstore.h:
+
+#ifndef ANGLE_WINDOWSSTORE_H_
+#define ANGLE_WINDOWSSTORE_H_
+
+// The following properties can be set on the CoreApplication to support additional
+// ANGLE configuration options.
+//
+// The Visual Studio sample templates provided with this version of ANGLE have examples
+// of how to set these property values.
+
+//
+// Property: EGLNativeWindowTypeProperty
+// Type: IInspectable
+// Description: Set this property to specify the window type to use for creating a surface.
+//              If this property is missing, surface creation will fail.
+//
+const wchar_t EGLNativeWindowTypeProperty[] = L&quot;EGLNativeWindowTypeProperty&quot;;
+
+//
+// Property: EGLRenderSurfaceSizeProperty
+// Type: Size
+// Description: Set this property to specify a preferred size in pixels of the render surface.
+//              The render surface size width and height must be greater than 0.
+//              If this property is set, then the render surface size is fixed.
+//              If this property is missing, a default behavior will be provided.
+//              The default behavior uses the window size if a CoreWindow is specified or
+//              the size of the SwapChainPanel control if one is specified.
+//
+const wchar_t EGLRenderSurfaceSizeProperty[] = L&quot;EGLRenderSurfaceSizeProperty&quot;;
+
+#endif // ANGLE_WINDOWSSTORE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeexporth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/export.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/export.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/export.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// export.h : Defines ANGLE_EXPORT, a macro for exporting functions from the DLL
+
+#ifndef LIBGLESV2_EXPORT_H_
+#define LIBGLESV2_EXPORT_H_
+
+#if defined(_WIN32)
+#   if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION)
+#       define ANGLE_EXPORT __declspec(dllexport)
+#   else
+#       define ANGLE_EXPORT __declspec(dllimport)
+#   endif
+#elif defined(__GNUC__)
+#   if defined(LIBGLESV2_IMPLEMENTATION) || defined(LIBANGLE_IMPLEMENTATION)
+#       define ANGLE_EXPORT __attribute__((visibility (&quot;default&quot;)))
+#   else
+#       define ANGLE_EXPORT
+#   endif
+#else
+#   define ANGLE_EXPORT
+#endif
+
+#endif // LIBGLESV2_EXPORT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEincludeplatformPlatformh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/include/platform/Platform.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/include/platform/Platform.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/include/platform/Platform.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,133 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+
+// Platform.h: The public interface ANGLE exposes to the API layer, for
+//   doing platform-specific tasks like gathering data, or for tracing.
+
+#ifndef ANGLE_PLATFORM_H
+#define ANGLE_PLATFORM_H
+
+#include &lt;stdint.h&gt;
+
+#include &quot;../export.h&quot;
+
+namespace angle
+{
+
+class Platform
+{
+  public:
+
+    // System --------------------------------------------------------------
+
+    // Wall clock time in seconds since the epoch.
+    // TODO(jmadill): investigate using an ANGLE internal time library
+    virtual double currentTime() { return 0; }
+
+    // Monotonically increasing time in seconds from an arbitrary fixed point in the past.
+    // This function is expected to return at least millisecond-precision values. For this reason,
+    // it is recommended that the fixed point be no further in the past than the epoch.
+    virtual double monotonicallyIncreasingTime() { return 0; }
+
+    // Tracing --------
+
+    // Get a pointer to the enabled state of the given trace category. The
+    // embedder can dynamically change the enabled state as trace event
+    // recording is started and stopped by the application. Only long-lived
+    // literal strings should be given as the category name. The implementation
+    // expects the returned pointer to be held permanently in a local static. If
+    // the unsigned char is non-zero, tracing is enabled. If tracing is enabled,
+    // addTraceEvent is expected to be called by the trace event macros.
+    virtual const unsigned char *getTraceCategoryEnabledFlag(const char *categoryName) { return 0; }
+
+    typedef uint64_t TraceEventHandle;
+
+    // Add a trace event to the platform tracing system. Depending on the actual
+    // enabled state, this event may be recorded or dropped.
+    // - phase specifies the type of event:
+    //   - BEGIN ('B'): Marks the beginning of a scoped event.
+    //   - END ('E'): Marks the end of a scoped event.
+    //   - COMPLETE ('X'): Marks the beginning of a scoped event, but doesn't
+    //     need a matching END event. Instead, at the end of the scope,
+    //     updateTraceEventDuration() must be called with the TraceEventHandle
+    //     returned from addTraceEvent().
+    //   - INSTANT ('I'): Standalone, instantaneous event.
+    //   - START ('S'): Marks the beginning of an asynchronous event (the end
+    //     event can occur in a different scope or thread). The id parameter is
+    //     used to match START/FINISH pairs.
+    //   - FINISH ('F'): Marks the end of an asynchronous event.
+    //   - COUNTER ('C'): Used to trace integer quantities that change over
+    //     time. The argument values are expected to be of type int.
+    //   - METADATA ('M'): Reserved for internal use.
+    // - categoryEnabled is the pointer returned by getTraceCategoryEnabledFlag.
+    // - name is the name of the event. Also used to match BEGIN/END and
+    //   START/FINISH pairs.
+    // - id optionally allows events of the same name to be distinguished from
+    //   each other. For example, to trace the consutruction and destruction of
+    //   objects, specify the pointer as the id parameter.
+    // - timestamp should be a time value returned from monotonicallyIncreasingTime.
+    // - numArgs specifies the number of elements in argNames, argTypes, and
+    //   argValues.
+    // - argNames is the array of argument names. Use long-lived literal strings
+    //   or specify the COPY flag.
+    // - argTypes is the array of argument types:
+    //   - BOOL (1): bool
+    //   - UINT (2): unsigned long long
+    //   - INT (3): long long
+    //   - DOUBLE (4): double
+    //   - POINTER (5): void*
+    //   - STRING (6): char* (long-lived null-terminated char* string)
+    //   - COPY_STRING (7): char* (temporary null-terminated char* string)
+    //   - CONVERTABLE (8): WebConvertableToTraceFormat
+    // - argValues is the array of argument values. Each value is the unsigned
+    //   long long member of a union of all supported types.
+    // - flags can be 0 or one or more of the following, ORed together:
+    //   - COPY (0x1): treat all strings (name, argNames and argValues of type
+    //     string) as temporary so that they will be copied by addTraceEvent.
+    //   - HAS_ID (0x2): use the id argument to uniquely identify the event for
+    //     matching with other events of the same name.
+    //   - MANGLE_ID (0x4): specify this flag if the id parameter is the value
+    //     of a pointer.
+    virtual TraceEventHandle addTraceEvent(char phase,
+                                           const unsigned char *categoryEnabledFlag,
+                                           const char *name,
+                                           unsigned long long id,
+                                           double timestamp,
+                                           int numArgs,
+                                           const char **argNames,
+                                           const unsigned char *argTypes,
+                                           const unsigned long long *argValues,
+                                           unsigned char flags)
+    {
+        return 0;
+    }
+
+    // Set the duration field of a COMPLETE trace event.
+    virtual void updateTraceEventDuration(const unsigned char *categoryEnabledFlag, const char *name, TraceEventHandle eventHandle) { }
+
+    // Callbacks for reporting histogram data.
+    // CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do.
+    virtual void histogramCustomCounts(const char *name, int sample, int min, int max, int bucketCount) { }
+    // Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample value.
+    virtual void histogramEnumeration(const char *name, int sample, int boundaryValue) { }
+    // Unlike enumeration histograms, sparse histograms only allocate memory for non-empty buckets.
+    virtual void histogramSparse(const char *name, int sample) { }
+
+  protected:
+    virtual ~Platform() { }
+};
+
+}
+
+typedef void(*ANGLEPlatformInitializeFunc)(angle::Platform*);
+ANGLE_EXPORT void ANGLEPlatformInitialize(angle::Platform*);
+
+typedef void (*ANGLEPlatformShutdownFunc)();
+ANGLE_EXPORT void ANGLEPlatformShutdown();
+
+typedef angle::Platform *(*ANGLEPlatformCurrentFunc)();
+ANGLE_EXPORT angle::Platform *ANGLEPlatformCurrent();
+
+#endif // ANGLE_PLATFORM_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcanglegyp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/angle.gyp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/angle.gyp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/angle.gyp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,254 @@
</span><ins>+# 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.
+
+{
+    'variables':
+    {
+        'angle_code': 1,
+        'angle_post_build_script%': 0,
+        'angle_gen_path': '&lt;(SHARED_INTERMEDIATE_DIR)/angle',
+        'angle_id_script_base': 'commit_id.py',
+        'angle_id_script': '&lt;(angle_gen_path)/&lt;(angle_id_script_base)',
+        'angle_id_header_base': 'commit.h',
+        'angle_id_header': '&lt;(angle_gen_path)/id/&lt;(angle_id_header_base)',
+        'angle_use_commit_id%': '&lt;!(python &lt;(angle_id_script_base) check ..)',
+        'angle_enable_d3d9%': 0,
+        'angle_enable_d3d11%': 0,
+        'angle_enable_gl%': 0,
+        'angle_enable_hlsl%': 0,
+        'conditions':
+        [
+            ['OS==&quot;win&quot;',
+            {
+                'angle_enable_gl%': 1,
+                'angle_enable_d3d9%': 1,
+                'angle_enable_d3d11%': 1,
+                'angle_enable_hlsl%': 1,
+            }],
+        ],
+    },
+    'includes':
+    [
+        'compiler.gypi',
+        'libGLESv2.gypi',
+        'libEGL.gypi'
+    ],
+
+    'targets':
+    [
+        {
+            'target_name': 'angle_common',
+            'type': 'static_library',
+            'includes': [ '../build/common_defines.gypi', ],
+            'sources':
+            [
+                '&lt;@(libangle_common_sources)',
+            ],
+            'include_dirs':
+            [
+                '.',
+                '../include',
+            ],
+            'direct_dependent_settings':
+            {
+                'include_dirs':
+                [
+                    '&lt;(angle_path)/src',
+                    '&lt;(angle_path)/include',
+                ],
+            },
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+            ],
+        },
+
+        {
+            'target_name': 'copy_scripts',
+            'type': 'none',
+            'includes': [ '../build/common_defines.gypi', ],
+            'hard_dependency': 1,
+            'copies':
+            [
+                {
+                    'destination': '&lt;(angle_gen_path)',
+                    'files': [ 'copy_compiler_dll.bat', '&lt;(angle_id_script_base)' ],
+                },
+            ],
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                    'type' : 'shared_library',
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+            ],
+        },
+    ],
+    'conditions':
+    [
+        ['angle_use_commit_id!=0',
+        {
+            'targets':
+            [
+                {
+                    'target_name': 'commit_id',
+                    'type': 'none',
+                    'includes': [ '../build/common_defines.gypi', ],
+                    'dependencies': [ 'copy_scripts', ],
+                    'hard_dependency': 1,
+                    'actions':
+                    [
+                        {
+                            'action_name': 'Generate ANGLE Commit ID Header',
+                            'message': 'Generating ANGLE Commit ID',
+                            # reference the git index as an input, so we rebuild on changes to the index
+                            'inputs': [ '&lt;(angle_id_script)', '&lt;(angle_path)/.git/index' ],
+                            'outputs': [ '&lt;(angle_id_header)' ],
+                            'msvs_cygwin_shell': 0,
+                            'action':
+                            [
+                                'python', '&lt;(angle_id_script)', 'gen', '&lt;(angle_path)', '&lt;(angle_id_header)'
+                            ],
+                        },
+                    ],
+                    'all_dependent_settings':
+                    {
+                        'include_dirs':
+                        [
+                            '&lt;(angle_gen_path)',
+                        ],
+                    },
+                    'conditions':
+                    [
+                        ['angle_build_winrt==1',
+                        {
+                            'msvs_enable_winrt' : '1',
+                            'type' : 'shared_library',
+                        }],
+                        ['angle_build_winphone==1',
+                        {
+                            'msvs_enable_winphone' : '1',
+                        }],
+                    ],
+                }
+            ]
+        },
+        { # angle_use_commit_id==0
+            'targets':
+            [
+                {
+                    'target_name': 'commit_id',
+                    'type': 'none',
+                    'hard_dependency': 1,
+                    'includes': [ '../build/common_defines.gypi', ],
+                    'copies':
+                    [
+                        {
+                            'destination': '&lt;(angle_gen_path)/id',
+                            'files': [ '&lt;(angle_id_header_base)' ]
+                        }
+                    ],
+                    'all_dependent_settings':
+                    {
+                        'include_dirs':
+                        [
+                            '&lt;(angle_gen_path)',
+                        ],
+                    },
+                    'conditions':
+                    [
+                        ['angle_build_winrt==1',
+                        {
+                            'msvs_enable_winrt' : '1',
+                            'type' : 'shared_library',
+                        }],
+                        ['angle_build_winphone==1',
+                        {
+                            'msvs_enable_winphone' : '1',
+                        }],
+                    ],
+                }
+            ]
+        }],
+        ['OS==&quot;win&quot;',
+        {
+            'targets':
+            [
+                {
+                    'target_name': 'copy_compiler_dll',
+                    'type': 'none',
+                    'dependencies': [ 'copy_scripts', ],
+                    'includes': [ '../build/common_defines.gypi', ],
+                    'conditions':
+                    [
+                        ['angle_build_winrt==0',
+                        {
+                            'actions':
+                            [
+                                {
+                                    'action_name': 'copy_dll',
+                                    'message': 'Copying D3D Compiler DLL...',
+                                    'msvs_cygwin_shell': 0,
+                                    'inputs': [ 'copy_compiler_dll.bat' ],
+                                    'outputs': [ '&lt;(PRODUCT_DIR)/d3dcompiler_47.dll' ],
+                                    'action':
+                                    [
+                                        &quot;&lt;(angle_gen_path)/copy_compiler_dll.bat&quot;,
+                                        &quot;$(PlatformName)&quot;,
+                                        &quot;&lt;(windows_sdk_path)&quot;,
+                                        &quot;&lt;(PRODUCT_DIR)&quot;
+                                    ],
+                                },
+                            ], #actions
+                        }],
+                        ['angle_build_winrt==1',
+                        {
+                            'msvs_enable_winrt' : '1',
+                            'type' : 'shared_library',
+                        }],
+                        ['angle_build_winphone==1',
+                        {
+                            'msvs_enable_winphone' : '1',
+                        }],
+                    ]
+                },
+            ], # targets
+        }],
+        ['angle_post_build_script!=0 and OS==&quot;win&quot;',
+        {
+            'targets':
+            [
+                {
+                    'target_name': 'post_build',
+                    'type': 'none',
+                    'includes': [ '../build/common_defines.gypi', ],
+                    'dependencies': [ 'libGLESv2', 'libEGL' ],
+                    'actions':
+                    [
+                        {
+                            'action_name': 'ANGLE Post-Build Script',
+                            'message': 'Running &lt;(angle_post_build_script)...',
+                            'msvs_cygwin_shell': 0,
+                            'inputs': [ '&lt;(angle_post_build_script)', '&lt;!@([&quot;python&quot;, &quot;&lt;(angle_post_build_script)&quot;, &quot;inputs&quot;, &quot;&lt;(angle_path)&quot;, &quot;&lt;(CONFIGURATION_NAME)&quot;, &quot;$(PlatformName)&quot;, &quot;&lt;(PRODUCT_DIR)&quot;])' ],
+                            'outputs': [ '&lt;!@(python &lt;(angle_post_build_script) outputs &quot;&lt;(angle_path)&quot; &quot;&lt;(CONFIGURATION_NAME)&quot; &quot;$(PlatformName)&quot; &quot;&lt;(PRODUCT_DIR)&quot;)' ],
+                            'action': ['python', '&lt;(angle_post_build_script)', 'run', '&lt;(angle_path)', '&lt;(CONFIGURATION_NAME)', '$(PlatformName)', '&lt;(PRODUCT_DIR)'],
+                        },
+                    ], #actions
+                },
+            ], # targets
+        }],
+    ] # conditions
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommith"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/commit.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/commit.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/commit.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><del>-#define ANGLE_COMMIT_HASH &quot;e7a453a5bd76&quot;
</del><ins>+//
+// Copyright (c) 2014 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.
+//
+// commit.h:
+//   This is a default commit hash header, when git is not available.
+//
+
+#define ANGLE_COMMIT_HASH &quot;unknown hash&quot;
</ins><span class="cx"> #define ANGLE_COMMIT_HASH_SIZE 12
</span><del>-#define ANGLE_COMMIT_DATE &quot;2014-04-28 20:07:02 +0000&quot;
</del><ins>+#define ANGLE_COMMIT_DATE &quot;unknown date&quot;
+
+#define ANGLE_DISABLE_PROGRAM_BINARY_LOAD
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommit_idpy"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/commit_id.py (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/commit_id.py                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/commit_id.py        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+import subprocess as sp
+import sys
+import os
+
+# Usage: commit_id.py check &lt;angle_dir&gt; (checks if git is present)
+# Usage: commit_id.py gen &lt;angle_dir&gt; &lt;file_to_write&gt; (generates commit id)
+
+def grab_output(command, cwd):
+    return sp.Popen(command, stdout=sp.PIPE, shell=True, cwd=cwd).communicate()[0].strip()
+
+operation = sys.argv[1]
+cwd = sys.argv[2]
+
+if operation == 'check':
+    index_path = os.path.join(cwd, '.git', 'index')
+    if os.path.exists(index_path):
+        print(&quot;1&quot;)
+    else:
+        print(&quot;0&quot;)
+    sys.exit(0)
+
+output_file = sys.argv[3]
+commit_id_size = 12
+
+try:
+    commit_id = grab_output('git rev-parse --short=%d HEAD' % commit_id_size, cwd)
+    commit_date = grab_output('git show -s --format=%ci HEAD', cwd)
+except:
+    commit_id = 'invalid-hash'
+    commit_date = 'invalid-date'
+
+hfile = open(output_file, 'w')
+
+hfile.write('#define ANGLE_COMMIT_HASH &quot;%s&quot;\n'    % commit_id)
+hfile.write('#define ANGLE_COMMIT_HASH_SIZE %d\n' % commit_id_size)
+hfile.write('#define ANGLE_COMMIT_DATE &quot;%s&quot;\n'    % commit_date)
+
+hfile.close()
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonMemoryBuffercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;common/MemoryBuffer.h&quot;
+
+#include &lt;algorithm&gt;
+#include &lt;cstdlib&gt;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+MemoryBuffer::MemoryBuffer()
+    : mSize(0),
+      mData(NULL)
+{
+}
+
+MemoryBuffer::~MemoryBuffer()
+{
+    free(mData);
+    mData = NULL;
+}
+
+bool MemoryBuffer::resize(size_t size)
+{
+    if (size == 0)
+    {
+        free(mData);
+        mData = NULL;
+        mSize = 0;
+        return true;
+    }
+
+    if (size == mSize)
+    {
+        return true;
+    }
+
+    // Only reallocate if the size has changed.
+    uint8_t *newMemory = reinterpret_cast&lt;uint8_t*&gt;(malloc(sizeof(uint8_t) * size));
+    if (newMemory == NULL)
+    {
+        return false;
+    }
+
+    if (mData)
+    {
+        // Copy the intersection of the old data and the new data
+        std::copy(mData, mData + std::min(mSize, size), newMemory);
+        free(mData);
+    }
+
+    mData = newMemory;
+    mSize = size;
+
+    return true;
+}
+
+size_t MemoryBuffer::size() const
+{
+    return mSize;
+}
+
+const uint8_t *MemoryBuffer::data() const
+{
+    return mData;
+}
+
+uint8_t *MemoryBuffer::data()
+{
+    ASSERT(mData);
+    return mData;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonMemoryBufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/MemoryBuffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+//
+// Copyright (c) 2014 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 COMMON_MEMORYBUFFER_H_
+#define COMMON_MEMORYBUFFER_H_
+
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;cstddef&gt;
+#include &lt;stdint.h&gt;
+
+namespace rx
+{
+
+class MemoryBuffer : angle::NonCopyable
+{
+  public:
+    MemoryBuffer();
+    ~MemoryBuffer();
+
+    bool resize(size_t size);
+    size_t size() const;
+    bool empty() const { return mSize == 0; }
+
+    const uint8_t *data() const;
+    uint8_t *data();
+
+  private:
+    size_t mSize;
+    uint8_t *mData;
+};
+
+}
+
+#endif // COMMON_MEMORYBUFFER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonOptionalh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/Optional.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/Optional.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/Optional.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+// Optional.h:
+//   Represents a type that may be invalid, similar to std::optional.
+//
+
+#ifndef COMMON_OPTIONAL_H_
+#define COMMON_OPTIONAL_H_
+
+template &lt;class T&gt;
+struct Optional
+{
+    Optional()
+        : mValid(false),
+          mValue(T())
+    {}
+
+    explicit Optional(const T &amp;valueIn)
+        : mValid(true),
+          mValue(valueIn)
+    {}
+
+    Optional(const Optional &amp;other)
+        : mValid(other.mValid),
+          mValue(other.mValue)
+    {}
+
+    Optional &amp;operator=(const Optional &amp;other)
+    {
+        this-&gt;mValid = other.mValid;
+        this-&gt;mValue = other.mValue;
+        return *this;
+    }
+
+    Optional &amp;operator=(const T &amp;value)
+    {
+        mValue = value;
+        mValid = true;
+        return *this;
+    }
+
+    void reset()
+    {
+        mValid = false;
+    }
+
+    static Optional None()
+    {
+        return Optional();
+    }
+
+    bool valid() const { return mValid; }
+    const T &amp;value() const { return mValue; }
+
+    bool operator==(const Optional &amp;other) const
+    {
+        return ((mValid == other.mValid) &amp;&amp; (!mValid || (mValue == other.mValue)));
+    }
+
+    bool operator!=(const Optional &amp;other) const
+    {
+        return !(*this == other);
+    }
+
+  private:
+    bool mValid;
+    T mValue;
+};
+
+#endif // COMMON_OPTIONAL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonOptional_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/Optional_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/Optional_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/Optional_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+// Unit tests for ANGLE's Optional helper class.
+//
+
+#include &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+
+#include &quot;common/Optional.h&quot;
+
+namespace
+{
+
+TEST(OptionalTest, BasicInvalid)
+{
+    Optional&lt;int&gt; testInvalid;
+    ASSERT_FALSE(testInvalid.valid());
+    ASSERT_EQ(Optional&lt;int&gt;::None(), testInvalid);
+}
+
+TEST(OptionalTest, BasicValid)
+{
+    Optional&lt;int&gt; testValid(3);
+    ASSERT_TRUE(testValid.valid());
+    ASSERT_EQ(3, testValid.value());
+    ASSERT_NE(Optional&lt;int&gt;::None(), testValid);
+}
+
+TEST(OptionalTest, Copies)
+{
+    Optional&lt;int&gt; testValid(3);
+    Optional&lt;int&gt; testInvalid;
+
+    Optional&lt;int&gt; testCopy = testInvalid;
+    ASSERT_FALSE(testCopy.valid());
+    ASSERT_EQ(testInvalid, testCopy);
+
+    testCopy = testValid;
+    ASSERT_TRUE(testCopy.valid());
+    ASSERT_EQ(3, testCopy.value());
+    ASSERT_EQ(testValid, testCopy);
+}
+
+} // namespace
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonRefCountObjectcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,47 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RefCountObject.cpp: Defines the gl::RefCountObject base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-// (Concretely, textures, buffers and renderbuffers.)
-
-#include &quot;RefCountObject.h&quot;
-
-RefCountObject::RefCountObject(GLuint id)
-{
-    mId = id;
-    mRefCount = 0;
-}
-
-RefCountObject::~RefCountObject()
-{
-    ASSERT(mRefCount == 0);
-}
-
-void RefCountObject::addRef() const
-{
-    mRefCount++;
-}
-
-void RefCountObject::release() const
-{
-    ASSERT(mRefCount &gt; 0);
-
-    if (--mRefCount == 0)
-    {
-        delete this;
-    }
-}
-
-void RefCountObjectBindingPointer::set(RefCountObject *newObject)
-{
-    // addRef first in case newObject == mObject and this is the last reference to it.
-    if (newObject != NULL) newObject-&gt;addRef();
-    if (mObject != NULL) mObject-&gt;release();
-
-    mObject = newObject;
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonRefCountObjecth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/RefCountObject.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,124 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// RefCountObject.h: Defines the gl::RefCountObject base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-// (Concretely, textures, buffers and renderbuffers.)
-
-#ifndef COMMON_REFCOUNTOBJECT_H_
-#define COMMON_REFCOUNTOBJECT_H_
-
-#include &lt;cstddef&gt;
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &quot;common/debug.h&quot;
-
-class RefCountObject
-{
-  public:
-    explicit RefCountObject(GLuint id);
-    virtual ~RefCountObject();
-
-    virtual void addRef() const;
-    virtual void release() const;
-
-    GLuint id() const { return mId; }
-    
-  private:
-    GLuint mId;
-
-    mutable std::size_t mRefCount;
-};
-
-class RefCountObjectBindingPointer
-{
-  protected:
-    RefCountObjectBindingPointer() : mObject(NULL) { }
-    ~RefCountObjectBindingPointer() { ASSERT(mObject == NULL); } // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up.
-
-    void set(RefCountObject *newObject);
-    RefCountObject *get() const { return mObject; }
-
-  public:
-    GLuint id() const { return (mObject != NULL) ? mObject-&gt;id() : 0; }
-    bool operator!() const { return (get() == NULL); }
-
-  private:
-    RefCountObject *mObject;
-};
-
-template &lt;class ObjectType&gt;
-class BindingPointer : public RefCountObjectBindingPointer
-{
-  public:
-    void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
-    ObjectType *get() const { return static_cast&lt;ObjectType*&gt;(RefCountObjectBindingPointer::get()); }
-    ObjectType *operator-&gt;() const { return get(); }
-};
-
-template &lt;class ObjectType&gt;
-class FramebufferTextureBindingPointer : public RefCountObjectBindingPointer
-{
-public:
-    FramebufferTextureBindingPointer() : mType(GL_NONE), mMipLevel(0), mLayer(0) { }
-
-    void set(ObjectType *newObject, GLenum type, GLint mipLevel, GLint layer)
-    {
-        RefCountObjectBindingPointer::set(newObject);
-        mType = type;
-        mMipLevel = mipLevel;
-        mLayer = layer;
-    }
-
-    ObjectType *get() const { return static_cast&lt;ObjectType*&gt;(RefCountObjectBindingPointer::get()); }
-    ObjectType *operator-&gt;() const { return get(); }
-
-    GLenum type() const { return mType; }
-    GLint mipLevel() const { return mMipLevel; }
-    GLint layer() const { return mLayer; }
-
-private:
-    GLenum mType;
-    GLint mMipLevel;
-    GLint mLayer;
-};
-
-template &lt;class ObjectType&gt;
-class OffsetBindingPointer : public RefCountObjectBindingPointer
-{
-  public:
-    OffsetBindingPointer() : mOffset(0), mSize(0) { }
-
-    void set(ObjectType *newObject)
-    {
-        RefCountObjectBindingPointer::set(newObject);
-        mOffset = 0;
-        mSize = 0;
-    }
-
-    void set(ObjectType *newObject, GLintptr offset, GLsizeiptr size)
-    {
-        RefCountObjectBindingPointer::set(newObject);
-        mOffset = offset;
-        mSize = size;
-    }
-
-    GLintptr getOffset() const { return mOffset; }
-    GLsizeiptr getSize() const { return mSize; }
-
-    ObjectType *get() const { return static_cast&lt;ObjectType*&gt;(RefCountObjectBindingPointer::get()); }
-    ObjectType *operator-&gt;() const { return get(); }
-
-  private:
-    GLintptr mOffset;
-    GLsizeiptr mSize;
-};
-
-#endif   // COMMON_REFCOUNTOBJECT_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonangleutilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/angleutils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/angleutils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/angleutils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;common/angleutils.h&quot;
+#include &quot;common/debug.h&quot;
+
+#include &lt;stdio.h&gt;
+#include &lt;vector&gt;
+
+size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector&lt;char&gt;&amp; outBuffer)
+{
+    // Attempt to just print to the current buffer
+    int len = vsnprintf(&amp;(outBuffer.front()), outBuffer.size(), fmt, vararg);
+    if (len &lt; 0 || static_cast&lt;size_t&gt;(len) &gt;= outBuffer.size())
+    {
+        // Buffer was not large enough, calculate the required size and resize the buffer
+        len = vsnprintf(NULL, 0, fmt, vararg);
+        outBuffer.resize(len + 1);
+
+        // Print again
+        len = vsnprintf(&amp;(outBuffer.front()), outBuffer.size(), fmt, vararg);
+    }
+    ASSERT(len &gt;= 0);
+    return static_cast&lt;size_t&gt;(len);
+}
+
+std::string FormatString(const char *fmt, va_list vararg)
+{
+    static std::vector&lt;char&gt; buffer(512);
+
+    size_t len = FormatStringIntoVector(fmt, vararg, buffer);
+    return std::string(&amp;buffer[0], len);
+}
+
+std::string FormatString(const char *fmt, ...)
+{
+    va_list vararg;
+    va_start(vararg, fmt);
+    std::string result = FormatString(fmt, vararg);
+    va_end(vararg);
+    return result;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonangleutilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/angleutils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="lines">@@ -9,17 +9,35 @@
</span><span class="cx"> #ifndef COMMON_ANGLEUTILS_H_
</span><span class="cx"> #define COMMON_ANGLEUTILS_H_
</span><span class="cx"> 
</span><del>-#include &lt;stddef.h&gt;
</del><ins>+#include &quot;common/platform.h&quot;
</ins><span class="cx"> 
</span><del>-// A macro to disallow the copy constructor and operator= functions
-// This must be used in the private: declarations for a class
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
-  TypeName(const TypeName&amp;);               \
-  void operator=(const TypeName&amp;)
</del><ins>+#include &lt;climits&gt;
+#include &lt;cstdarg&gt;
+#include &lt;cstddef&gt;
+#include &lt;string&gt;
+#include &lt;set&gt;
+#include &lt;sstream&gt;
+#include &lt;vector&gt;
</ins><span class="cx"> 
</span><del>-template &lt;typename T, unsigned int N&gt;
-inline unsigned int ArraySize(T(&amp;)[N])
</del><ins>+// A helper class to disallow copy and assignment operators
+namespace angle
</ins><span class="cx"> {
</span><ins>+
+class NonCopyable
+{
+  public:
+    NonCopyable() = default;
+    ~NonCopyable() = default;
+  protected:
+    NonCopyable(const NonCopyable&amp;) = delete;
+    void operator=(const NonCopyable&amp;) = delete;
+};
+
+}
+
+template &lt;typename T, size_t N&gt;
+inline size_t ArraySize(T(&amp;)[N])
+{
</ins><span class="cx">     return N;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -50,6 +68,16 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;typename T&gt;
</span><ins>+void SafeDeleteContainer(T&amp; resource)
+{
+    for (typename T::iterator i = resource.begin(); i != resource.end(); i++)
+    {
+        SafeDelete(*i);
+    }
+    resource.clear();
+}
+
+template &lt;typename T&gt;
</ins><span class="cx"> void SafeDeleteArray(T*&amp; resource)
</span><span class="cx"> {
</span><span class="cx">     delete[] resource;
</span><span class="lines">@@ -78,17 +106,66 @@
</span><span class="cx">     memset(obj, 0, sizeof(T));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if defined(_MSC_VER)
</del><ins>+template &lt;typename T&gt;
+inline bool IsMaskFlagSet(T mask, T flag)
+{
+    // Handles multibit flags as well
+    return (mask &amp; flag) == flag;
+}
+
+inline const char* MakeStaticString(const std::string &amp;str)
+{
+    static std::set&lt;std::string&gt; strings;
+    std::set&lt;std::string&gt;::iterator it = strings.find(str);
+    if (it != strings.end())
+    {
+        return it-&gt;c_str();
+    }
+
+    return strings.insert(str).first-&gt;c_str();
+}
+
+inline std::string ArrayString(unsigned int i)
+{
+    // We assume UINT_MAX and GL_INVALID_INDEX are equal
+    // See DynamicHLSL.cpp
+    if (i == UINT_MAX)
+    {
+        return &quot;&quot;;
+    }
+
+    std::stringstream strstr;
+
+    strstr &lt;&lt; &quot;[&quot;;
+    strstr &lt;&lt; i;
+    strstr &lt;&lt; &quot;]&quot;;
+
+    return strstr.str();
+}
+
+inline std::string Str(int i)
+{
+    std::stringstream strstr;
+    strstr &lt;&lt; i;
+    return strstr.str();
+}
+
+size_t FormatStringIntoVector(const char *fmt, va_list vararg, std::vector&lt;char&gt;&amp; buffer);
+
+std::string FormatString(const char *fmt, va_list vararg);
+std::string FormatString(const char *fmt, ...);
+
+// snprintf is not defined with MSVC prior to to msvc14
+#if defined(_MSC_VER) &amp;&amp; _MSC_VER &lt; 1900
</ins><span class="cx"> #define snprintf _snprintf
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#define VENDOR_ID_AMD 0x1002
-#define VENDOR_ID_INTEL 0x8086
-#define VENDOR_ID_NVIDIA 0x10DE
-
</del><span class="cx"> #define GL_BGRA4_ANGLEX 0x6ABC
</span><span class="cx"> #define GL_BGR5_A1_ANGLEX 0x6ABD
</span><span class="cx"> #define GL_INT_64_ANGLEX 0x6ABE
</span><span class="cx"> #define GL_STRUCT_ANGLEX 0x6ABF
</span><span class="cx"> 
</span><ins>+// Hidden enum for the NULL D3D device type.
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
+
</ins><span class="cx"> #endif // COMMON_ANGLEUTILS_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonblocklayoutcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,305 +0,0 @@
</span><del>-//
-// Copyright (c) 2013-2014 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.
-//
-// blocklayout.cpp:
-//   Implementation for block layout classes and methods.
-//
-
-#include &quot;common/blocklayout.h&quot;
-#include &quot;common/shadervars.h&quot;
-#include &quot;common/mathutil.h&quot;
-#include &quot;common/utilities.h&quot;
-
-namespace gl
-{
-
-BlockLayoutEncoder::BlockLayoutEncoder(std::vector&lt;BlockMemberInfo&gt; *blockInfoOut)
-    : mCurrentOffset(0),
-      mBlockInfoOut(blockInfoOut)
-{
-}
-
-void BlockLayoutEncoder::encodeInterfaceBlockFields(const std::vector&lt;InterfaceBlockField&gt; &amp;fields)
-{
-    for (unsigned int fieldIndex = 0; fieldIndex &lt; fields.size(); fieldIndex++)
-    {
-        const InterfaceBlockField &amp;variable = fields[fieldIndex];
-
-        if (variable.fields.size() &gt; 0)
-        {
-            const unsigned int elementCount = std::max(1u, variable.arraySize);
-
-            for (unsigned int elementIndex = 0; elementIndex &lt; elementCount; elementIndex++)
-            {
-                enterAggregateType();
-                encodeInterfaceBlockFields(variable.fields);
-                exitAggregateType();
-            }
-        }
-        else
-        {
-            encodeInterfaceBlockField(variable);
-        }
-    }
-}
-
-void BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &amp;field)
-{
-    int arrayStride;
-    int matrixStride;
-
-    ASSERT(field.fields.empty());
-    getBlockLayoutInfo(field.type, field.arraySize, field.isRowMajorMatrix, &amp;arrayStride, &amp;matrixStride);
-
-    const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, field.isRowMajorMatrix);
-
-    if (mBlockInfoOut)
-    {
-        mBlockInfoOut-&gt;push_back(memberInfo);
-    }
-
-    advanceOffset(field.type, field.arraySize, field.isRowMajorMatrix, arrayStride, matrixStride);
-}
-
-void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
-{
-    int arrayStride;
-    int matrixStride;
-
-    getBlockLayoutInfo(type, arraySize, isRowMajorMatrix, &amp;arrayStride, &amp;matrixStride);
-
-    const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
-
-    if (mBlockInfoOut)
-    {
-        mBlockInfoOut-&gt;push_back(memberInfo);
-    }
-
-    advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);
-}
-
-void BlockLayoutEncoder::nextRegister()
-{
-    mCurrentOffset = rx::roundUp&lt;size_t&gt;(mCurrentOffset, ComponentsPerRegister);
-}
-
-Std140BlockEncoder::Std140BlockEncoder(std::vector&lt;BlockMemberInfo&gt; *blockInfoOut)
-    : BlockLayoutEncoder(blockInfoOut)
-{
-}
-
-void Std140BlockEncoder::enterAggregateType()
-{
-    nextRegister();
-}
-
-void Std140BlockEncoder::exitAggregateType()
-{
-    nextRegister();
-}
-
-void Std140BlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
-{
-    // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
-    ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == BytesPerComponent);
-
-    size_t baseAlignment = 0;
-    int matrixStride = 0;
-    int arrayStride = 0;
-
-    if (gl::IsMatrixType(type))
-    {
-        baseAlignment = ComponentsPerRegister;
-        matrixStride = ComponentsPerRegister;
-
-        if (arraySize &gt; 0)
-        {
-            const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
-            arrayStride = ComponentsPerRegister * numRegisters;
-        }
-    }
-    else if (arraySize &gt; 0)
-    {
-        baseAlignment = ComponentsPerRegister;
-        arrayStride = ComponentsPerRegister;
-    }
-    else
-    {
-        const int numComponents = gl::UniformComponentCount(type);
-        baseAlignment = (numComponents == 3 ? 4u : static_cast&lt;size_t&gt;(numComponents));
-    }
-
-    mCurrentOffset = rx::roundUp(mCurrentOffset, baseAlignment);
-
-    *matrixStrideOut = matrixStride;
-    *arrayStrideOut = arrayStride;
-}
-
-void Std140BlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
-{
-    if (arraySize &gt; 0)
-    {
-        mCurrentOffset += arrayStride * arraySize;
-    }
-    else if (gl::IsMatrixType(type))
-    {
-        ASSERT(matrixStride == ComponentsPerRegister);
-        const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
-        mCurrentOffset += ComponentsPerRegister * numRegisters;
-    }
-    else
-    {
-        mCurrentOffset += gl::UniformComponentCount(type);
-    }
-}
-
-HLSLBlockEncoder::HLSLBlockEncoder(std::vector&lt;BlockMemberInfo&gt; *blockInfoOut)
-    : BlockLayoutEncoder(blockInfoOut)
-{
-}
-
-void HLSLBlockEncoder::enterAggregateType()
-{
-    nextRegister();
-}
-
-void HLSLBlockEncoder::exitAggregateType()
-{
-}
-
-void HLSLBlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
-{
-    // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
-    ASSERT(gl::UniformComponentSize(gl::UniformComponentType(type)) == BytesPerComponent);
-
-    int matrixStride = 0;
-    int arrayStride = 0;
-
-    if (gl::IsMatrixType(type))
-    {
-        nextRegister();
-        matrixStride = ComponentsPerRegister;
-
-        if (arraySize &gt; 0)
-        {
-            const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
-            arrayStride = ComponentsPerRegister * numRegisters;
-        }
-    }
-    else if (arraySize &gt; 0)
-    {
-        nextRegister();
-        arrayStride = ComponentsPerRegister;
-    }
-    else
-    {
-        int numComponents = gl::UniformComponentCount(type);
-        if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) &gt; ComponentsPerRegister)
-        {
-            nextRegister();
-        }
-    }
-
-    *matrixStrideOut = matrixStride;
-    *arrayStrideOut = arrayStride;
-}
-
-void HLSLBlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
-{
-    if (arraySize &gt; 0)
-    {
-        mCurrentOffset += arrayStride * (arraySize - 1);
-    }
-
-    if (gl::IsMatrixType(type))
-    {
-        ASSERT(matrixStride == ComponentsPerRegister);
-        const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
-        const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
-        mCurrentOffset += ComponentsPerRegister * (numRegisters - 1);
-        mCurrentOffset += numComponents;
-    }
-    else
-    {
-        mCurrentOffset += gl::UniformComponentCount(type);
-    }
-}
-
-void HLSLVariableGetRegisterInfo(unsigned int baseRegisterIndex, gl::Uniform *variable, HLSLBlockEncoder *encoder, const std::vector&lt;gl::BlockMemberInfo&gt; &amp;blockInfo)
-{
-    // because this method computes offsets (element indexes) instead of any total sizes,
-    // we can ignore the array size of the variable
-
-    if (variable-&gt;isStruct())
-    {
-        encoder-&gt;enterAggregateType();
-
-        for (size_t fieldIndex = 0; fieldIndex &lt; variable-&gt;fields.size(); fieldIndex++)
-        {
-            HLSLVariableGetRegisterInfo(baseRegisterIndex, &amp;variable-&gt;fields[fieldIndex], encoder, blockInfo);
-        }
-
-        encoder-&gt;exitAggregateType();
-    }
-    else
-    {
-        encoder-&gt;encodeType(variable-&gt;type, variable-&gt;arraySize, false);
-
-        const size_t registerBytes = (encoder-&gt;BytesPerComponent * encoder-&gt;ComponentsPerRegister);
-        variable-&gt;registerIndex = baseRegisterIndex + (blockInfo.back().offset / registerBytes);
-        variable-&gt;elementIndex = (blockInfo.back().offset % registerBytes) / sizeof(float);
-    }
-}
-
-void HLSLVariableGetRegisterInfo(unsigned int baseRegisterIndex, gl::Uniform *variable)
-{
-    std::vector&lt;BlockMemberInfo&gt; blockInfo;
-    HLSLBlockEncoder encoder(&amp;blockInfo);
-    HLSLVariableGetRegisterInfo(baseRegisterIndex, variable, &amp;encoder, blockInfo);
-}
-
-template &lt;class ShaderVarType&gt;
-void HLSLVariableRegisterCount(const ShaderVarType &amp;variable, HLSLBlockEncoder *encoder)
-{
-    if (variable.isStruct())
-    {
-        for (size_t arrayElement = 0; arrayElement &lt; variable.elementCount(); arrayElement++)
-        {
-            encoder-&gt;enterAggregateType();
-
-            for (size_t fieldIndex = 0; fieldIndex &lt; variable.fields.size(); fieldIndex++)
-            {
-                HLSLVariableRegisterCount(variable.fields[fieldIndex], encoder);
-            }
-
-            encoder-&gt;exitAggregateType();
-        }
-    }
-    else
-    {
-        // We operate only on varyings and uniforms, which do not have matrix layout qualifiers
-        encoder-&gt;encodeType(variable.type, variable.arraySize, false);
-    }
-}
-
-unsigned int HLSLVariableRegisterCount(const Varying &amp;variable)
-{
-    HLSLBlockEncoder encoder(NULL);
-    HLSLVariableRegisterCount(variable, &amp;encoder);
-
-    const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
-    return static_cast&lt;unsigned int&gt;(rx::roundUp&lt;size_t&gt;(encoder.getBlockSize(), registerBytes) / registerBytes);
-}
-
-unsigned int HLSLVariableRegisterCount(const Uniform &amp;variable)
-{
-    HLSLBlockEncoder encoder(NULL);
-    HLSLVariableRegisterCount(variable, &amp;encoder);
-
-    const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
-    return static_cast&lt;unsigned int&gt;(rx::roundUp&lt;size_t&gt;(encoder.getBlockSize(), registerBytes) / registerBytes);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonblocklayouth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/blocklayout.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,97 +0,0 @@
</span><del>-//
-// Copyright (c) 2013-2014 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.
-//
-// blocklayout.h:
-//   Methods and classes related to uniform layout and packing in GLSL and HLSL.
-//
-
-#ifndef COMMON_BLOCKLAYOUT_H_
-#define COMMON_BLOCKLAYOUT_H_
-
-#include &lt;vector&gt;
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-#include &lt;cstddef&gt;
-
-namespace gl
-{
-
-struct ShaderVariable;
-struct InterfaceBlockField;
-struct BlockMemberInfo;
-struct Uniform;
-struct Varying;
-
-class BlockLayoutEncoder
-{
-  public:
-    BlockLayoutEncoder(std::vector&lt;BlockMemberInfo&gt; *blockInfoOut);
-
-    void encodeInterfaceBlockFields(const std::vector&lt;InterfaceBlockField&gt; &amp;fields);
-    void encodeInterfaceBlockField(const InterfaceBlockField &amp;field);
-    void encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
-    size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
-
-    static const size_t BytesPerComponent = 4u;
-    static const unsigned int ComponentsPerRegister = 4u;
-
-  protected:
-    size_t mCurrentOffset;
-
-    void nextRegister();
-
-    virtual void enterAggregateType() = 0;
-    virtual void exitAggregateType() = 0;
-    virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut) = 0;
-    virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride) = 0;
-
-  private:
-    std::vector&lt;BlockMemberInfo&gt; *mBlockInfoOut;
-};
-
-// Block layout according to the std140 block layout
-// See &quot;Standard Uniform Block Layout&quot; in Section 2.11.6 of the OpenGL ES 3.0 specification
-
-class Std140BlockEncoder : public BlockLayoutEncoder
-{
-  public:
-    Std140BlockEncoder(std::vector&lt;BlockMemberInfo&gt; *blockInfoOut);
-
-  protected:
-    virtual void enterAggregateType();
-    virtual void exitAggregateType();
-    virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
-    virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
-};
-
-// Block layout packed according to the default D3D11 register packing rules
-// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb509632(v=vs.85).aspx
-
-class HLSLBlockEncoder : public BlockLayoutEncoder
-{
-  public:
-    HLSLBlockEncoder(std::vector&lt;BlockMemberInfo&gt; *blockInfoOut);
-
-    virtual void enterAggregateType();
-    virtual void exitAggregateType();
-
-  protected:
-    virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
-    virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
-};
-
-// This method assigns values to the variable's &quot;registerIndex&quot; and &quot;elementIndex&quot; fields.
-// &quot;elementIndex&quot; is only used for structures.
-void HLSLVariableGetRegisterInfo(unsigned int baseRegisterIndex, Uniform *variable);
-
-// This method returns the number of used registers for a ShaderVariable. It is dependent on the HLSLBlockEncoder
-// class to count the number of used registers in a struct (which are individually packed according to the same rules).
-unsigned int HLSLVariableRegisterCount(const Varying &amp;variable);
-unsigned int HLSLVariableRegisterCount(const Uniform &amp;variable);
-
-}
-
-#endif // COMMON_BLOCKLAYOUT_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommondebugcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/debug.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -7,123 +7,142 @@
</span><span class="cx"> // debug.cpp: Debugging utilities.
</span><span class="cx"> 
</span><span class="cx"> #include &quot;common/debug.h&quot;
</span><ins>+#include &quot;common/platform.h&quot;
+#include &quot;common/angleutils.h&quot;
+
</ins><span class="cx"> #include &lt;stdarg.h&gt;
</span><span class="cx"> #include &lt;vector&gt;
</span><span class="cx"> #include &lt;fstream&gt;
</span><span class="cx"> #include &lt;cstdio&gt;
</span><span class="cx"> 
</span><del>-#if defined(ANGLE_ENABLE_PERF)
-#include &lt;d3d9.h&gt;
-#endif
-
</del><span class="cx"> namespace gl
</span><span class="cx"> {
</span><del>-#if defined(ANGLE_ENABLE_PERF)
-typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
-#else
-typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*);
-#endif
</del><span class="cx"> 
</span><del>-static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
</del><ins>+namespace
</ins><span class="cx"> {
</span><del>-#if defined(ANGLE_ENABLE_PERF) || defined(ANGLE_ENABLE_TRACE)
-    static std::vector&lt;char&gt; asciiMessageBuffer(512);
</del><ins>+enum DebugTraceOutputType
+{
+   DebugTraceOutputTypeNone,
+   DebugTraceOutputTypeSetMarker,
+   DebugTraceOutputTypeBeginEvent
+};
</ins><span class="cx"> 
</span><del>-    // Attempt to just print to the current buffer
-    int len = vsnprintf(&amp;asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
-    if (len &lt; 0 || static_cast&lt;size_t&gt;(len) &gt;= asciiMessageBuffer.size())
</del><ins>+DebugAnnotator *g_debugAnnotator = nullptr;
+
+void output(bool traceInDebugOnly, MessageType messageType, DebugTraceOutputType outputType,
+            const char *format, va_list vararg)
+{
+    if (DebugAnnotationsActive())
</ins><span class="cx">     {
</span><del>-        // Buffer was not large enough, calculate the required size and resize the buffer
-        len = vsnprintf(NULL, 0, format, vararg);
-        asciiMessageBuffer.resize(len + 1);
</del><ins>+        static std::vector&lt;char&gt; buffer(512);
+        size_t len = FormatStringIntoVector(format, vararg, buffer);
+        std::wstring formattedWideMessage(buffer.begin(), buffer.begin() + len);
</ins><span class="cx"> 
</span><del>-        // Print again
-        vsnprintf(&amp;asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg);
</del><ins>+        ASSERT(g_debugAnnotator != nullptr);
+        switch (outputType)
+        {
+          case DebugTraceOutputTypeNone:
+            break;
+          case DebugTraceOutputTypeBeginEvent:
+            g_debugAnnotator-&gt;beginEvent(formattedWideMessage);
+            break;
+          case DebugTraceOutputTypeSetMarker:
+            g_debugAnnotator-&gt;setMarker(formattedWideMessage);
+            break;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // NULL terminate the buffer to be safe
-    asciiMessageBuffer[len] = '\0';
-#endif
</del><ins>+    std::string formattedMessage;
+    UNUSED_TRACE_VARIABLE(formattedMessage);
</ins><span class="cx"> 
</span><del>-#if defined(ANGLE_ENABLE_PERF)
-    if (perfActive())
</del><ins>+#if !defined(NDEBUG) &amp;&amp; defined(_MSC_VER)
+    if (messageType == MESSAGE_ERR)
</ins><span class="cx">     {
</span><del>-        // The perf function only accepts wide strings, widen the ascii message
-        static std::wstring wideMessage;
-        if (wideMessage.capacity() &lt; asciiMessageBuffer.size())
</del><ins>+        if (formattedMessage.empty())
</ins><span class="cx">         {
</span><del>-            wideMessage.reserve(asciiMessageBuffer.size());
</del><ins>+            formattedMessage = FormatString(format, vararg);
</ins><span class="cx">         }
</span><del>-
-        wideMessage.assign(asciiMessageBuffer.begin(), asciiMessageBuffer.begin() + len);
-
-        perfFunc(0, wideMessage.c_str());
</del><ins>+        OutputDebugStringA(formattedMessage.c_str());
</ins><span class="cx">     }
</span><del>-#endif // ANGLE_ENABLE_PERF
</del><ins>+#endif
</ins><span class="cx"> 
</span><del>-#if defined(ANGLE_ENABLE_TRACE)
</del><ins>+#if defined(ANGLE_ENABLE_DEBUG_TRACE)
</ins><span class="cx"> #if defined(NDEBUG)
</span><del>-    if (traceFileDebugOnly)
</del><ins>+    if (traceInDebugOnly)
</ins><span class="cx">     {
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif // NDEBUG
</span><ins>+    if (formattedMessage.empty())
+    {
+        formattedMessage = FormatString(format, vararg);
+    }
</ins><span class="cx"> 
</span><span class="cx">     static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
</span><span class="cx">     if (file)
</span><span class="cx">     {
</span><del>-        file.write(&amp;asciiMessageBuffer[0], len);
</del><ins>+        file.write(formattedMessage.c_str(), formattedMessage.length());
</ins><span class="cx">         file.flush();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#endif // ANGLE_ENABLE_TRACE
</del><ins>+#if defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
+    OutputDebugStringA(formattedMessage.c_str());
+#endif // ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER
+
+#endif // ANGLE_ENABLE_DEBUG_TRACE
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void trace(bool traceFileDebugOnly, const char *format, ...)
</del><ins>+} // namespace
+
+bool DebugAnnotationsActive()
</ins><span class="cx"> {
</span><del>-    va_list vararg;
-    va_start(vararg, format);
-#if defined(ANGLE_ENABLE_PERF)
-    output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
</del><ins>+#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
+    return g_debugAnnotator != nullptr &amp;&amp; g_debugAnnotator-&gt;getStatus();
</ins><span class="cx"> #else
</span><del>-    output(traceFileDebugOnly, NULL, format, vararg);
</del><ins>+    return false;
</ins><span class="cx"> #endif
</span><del>-    va_end(vararg);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool perfActive()
</del><ins>+void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator)
</ins><span class="cx"> {
</span><del>-#if defined(ANGLE_ENABLE_PERF)
-    static bool active = D3DPERF_GetStatus() != 0;
-    return active;
-#else
-    return false;
-#endif
</del><ins>+    UninitializeDebugAnnotations();
+    g_debugAnnotator = debugAnnotator;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UninitializeDebugAnnotations()
+{
+    // Pointer is not managed.
+    g_debugAnnotator = nullptr;
+}
+
+void trace(bool traceInDebugOnly, MessageType messageType, const char *format, ...)
+{
+    va_list vararg;
+    va_start(vararg, format);
+    output(traceInDebugOnly, messageType, DebugTraceOutputTypeSetMarker, format, vararg);
+    va_end(vararg);
+}
+
</ins><span class="cx"> ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
</span><span class="cx"> {
</span><del>-#if defined(ANGLE_ENABLE_PERF)
-#if !defined(ANGLE_ENABLE_TRACE)
-    if (!perfActive())
</del><ins>+#if !defined(ANGLE_ENABLE_DEBUG_TRACE)
+    if (!DebugAnnotationsActive())
</ins><span class="cx">     {
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-#endif // !ANGLE_ENABLE_TRACE
</del><ins>+#endif // !ANGLE_ENABLE_DEBUG_TRACE
</ins><span class="cx">     va_list vararg;
</span><span class="cx">     va_start(vararg, format);
</span><del>-    output(true, reinterpret_cast&lt;PerfOutputFunction&gt;(D3DPERF_BeginEvent), format, vararg);
</del><ins>+    output(true, MESSAGE_EVENT, DebugTraceOutputTypeBeginEvent, format, vararg);
</ins><span class="cx">     va_end(vararg);
</span><del>-#endif // ANGLE_ENABLE_PERF
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScopedPerfEventHelper::~ScopedPerfEventHelper()
</span><span class="cx"> {
</span><del>-#if defined(ANGLE_ENABLE_PERF)
-    if (perfActive())
</del><ins>+    if (DebugAnnotationsActive())
</ins><span class="cx">     {
</span><del>-        D3DPERF_EndEvent();
</del><ins>+        g_debugAnnotator-&gt;endEvent();
</ins><span class="cx">     }
</span><del>-#endif
</del><span class="cx"> }
</span><ins>+
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommondebugh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/debug.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/debug.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/debug.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -9,8 +9,9 @@
</span><span class="cx"> #ifndef COMMON_DEBUG_H_
</span><span class="cx"> #define COMMON_DEBUG_H_
</span><span class="cx"> 
</span><ins>+#include &lt;assert.h&gt;
</ins><span class="cx"> #include &lt;stdio.h&gt;
</span><del>-#include &lt;assert.h&gt;
</del><ins>+#include &lt;string&gt;
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;common/angleutils.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -20,49 +21,73 @@
</span><span class="cx"> 
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><del>-    // Outputs text to the debugging log
-    void trace(bool traceFileDebugOnly, const char *format, ...);
</del><span class="cx"> 
</span><del>-    // Returns whether D3DPERF is active.
-    bool perfActive();
</del><ins>+enum MessageType
+{
+    MESSAGE_TRACE,
+    MESSAGE_FIXME,
+    MESSAGE_ERR,
+    MESSAGE_EVENT,
+};
</ins><span class="cx"> 
</span><del>-    // Pairs a D3D begin event with an end event.
-    class ScopedPerfEventHelper
-    {
-      public:
-        ScopedPerfEventHelper(const char* format, ...);
-        ~ScopedPerfEventHelper();
</del><ins>+// Outputs text to the debugging log, or the debugging window
+void trace(bool traceInDebugOnly, MessageType messageType, const char *format, ...);
</ins><span class="cx"> 
</span><del>-      private:
-        DISALLOW_COPY_AND_ASSIGN(ScopedPerfEventHelper);
-    };
</del><ins>+// Pairs a D3D begin event with an end event.
+class ScopedPerfEventHelper : angle::NonCopyable
+{
+  public:
+    ScopedPerfEventHelper(const char* format, ...);
+    ~ScopedPerfEventHelper();
+};
+
+// Wraps the D3D9/D3D11 debug annotation functions.
+class DebugAnnotator : angle::NonCopyable
+{
+  public:
+    DebugAnnotator() { };
+    virtual ~DebugAnnotator() { };
+    virtual void beginEvent(const std::wstring &amp;eventName) = 0;
+    virtual void endEvent() = 0;
+    virtual void setMarker(const std::wstring &amp;markerName) = 0;
+    virtual bool getStatus() = 0;
+};
+
+void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator);
+void UninitializeDebugAnnotations();
+bool DebugAnnotationsActive();
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if defined(ANGLE_ENABLE_DEBUG_TRACE) || defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
+#define ANGLE_TRACE_ENABLED
+#endif
+
</ins><span class="cx"> // A macro to output a trace of a function call and its arguments to the debugging log
</span><del>-#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
-#define TRACE(message, ...) gl::trace(true, &quot;trace: %s(%d): &quot; message &quot;\n&quot;, __FUNCTION__, __LINE__, ##__VA_ARGS__)
</del><ins>+#if defined(ANGLE_TRACE_ENABLED)
+#define TRACE(message, ...) gl::trace(true, gl::MESSAGE_TRACE, &quot;trace: %s(%d): &quot; message &quot;\n&quot;, __FUNCTION__, __LINE__, ##__VA_ARGS__)
</ins><span class="cx"> #else
</span><span class="cx"> #define TRACE(message, ...) (void(0))
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> // A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
</span><del>-#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
-#define FIXME(message, ...) gl::trace(false, &quot;fixme: %s(%d): &quot; message &quot;\n&quot;, __FUNCTION__, __LINE__, ##__VA_ARGS__)
</del><ins>+#if defined(ANGLE_TRACE_ENABLED)
+#define FIXME(message, ...) gl::trace(false, gl::MESSAGE_FIXME, &quot;fixme: %s(%d): &quot; message &quot;\n&quot;, __FUNCTION__, __LINE__, ##__VA_ARGS__)
</ins><span class="cx"> #else
</span><span class="cx"> #define FIXME(message, ...) (void(0))
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> // A macro to output a function call and its arguments to the debugging log, in case of error.
</span><del>-#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
-#define ERR(message, ...) gl::trace(false, &quot;err: %s(%d): &quot; message &quot;\n&quot;, __FUNCTION__, __LINE__, ##__VA_ARGS__)
</del><ins>+#if defined(ANGLE_TRACE_ENABLED)
+#define ERR(message, ...) gl::trace(false, gl::MESSAGE_ERR, &quot;err: %s(%d): &quot; message &quot;\n&quot;, __FUNCTION__, __LINE__, ##__VA_ARGS__)
</ins><span class="cx"> #else
</span><span class="cx"> #define ERR(message, ...) (void(0))
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> // A macro to log a performance event around a scope.
</span><del>-#if defined(ANGLE_ENABLE_TRACE) || defined(ANGLE_ENABLE_PERF)
</del><ins>+#if defined(ANGLE_TRACE_ENABLED)
</ins><span class="cx"> #if defined(_MSC_VER)
</span><del>-#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(__FUNCTION__ message &quot;\n&quot;, __VA_ARGS__);
</del><ins>+#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__(&quot;%s&quot; message &quot;\n&quot;, __FUNCTION__, __VA_ARGS__);
</ins><span class="cx"> #else
</span><span class="cx"> #define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper(message &quot;\n&quot;, ##__VA_ARGS__);
</span><span class="cx"> #endif // _MSC_VER
</span><span class="lines">@@ -70,6 +95,10 @@
</span><span class="cx"> #define EVENT(message, ...) (void(0))
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if defined(ANGLE_TRACE_ENABLED)
+#undef ANGLE_TRACE_ENABLED
+#endif
+
</ins><span class="cx"> // A macro asserting a condition and outputting failures to the debug log
</span><span class="cx"> #if !defined(NDEBUG)
</span><span class="cx"> #define ASSERT(expression) do { \
</span><span class="lines">@@ -77,12 +106,24 @@
</span><span class="cx">         ERR(&quot;\t! Assert failed in %s(%d): &quot;#expression&quot;\n&quot;, __FUNCTION__, __LINE__); \
</span><span class="cx">         assert(expression); \
</span><span class="cx">     } while(0)
</span><ins>+#define UNUSED_ASSERTION_VARIABLE(variable)
</ins><span class="cx"> #else
</span><span class="cx"> #define ASSERT(expression) (void(0))
</span><ins>+#define UNUSED_ASSERTION_VARIABLE(variable) ((void)variable)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#ifndef ANGLE_ENABLE_DEBUG_TRACE
+#define UNUSED_TRACE_VARIABLE(variable) ((void)variable)
+#else
+#define UNUSED_TRACE_VARIABLE(variable)
+#endif
+
</ins><span class="cx"> // A macro to indicate unimplemented functionality
</span><span class="cx"> 
</span><ins>+#if defined (ANGLE_TEST_CONFIG)
+#define NOASSERT_UNIMPLEMENTED 1
+#endif
+
</ins><span class="cx"> // Define NOASSERT_UNIMPLEMENTED to non zero to skip the assert fail in the unimplemented checks
</span><span class="cx"> // This will allow us to test with some automated test suites (eg dEQP) without crashing
</span><span class="cx"> #ifndef NOASSERT_UNIMPLEMENTED
</span><span class="lines">@@ -108,21 +149,4 @@
</span><span class="cx">     #define UNREACHABLE() ERR(&quot;\t! Unreachable reached: %s(%d)\n&quot;, __FUNCTION__, __LINE__)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-// A macro that determines whether an object has a given runtime type.
-#if !defined(NDEBUG) &amp;&amp; (!defined(_MSC_VER) || defined(_CPPRTTI)) &amp;&amp; (!defined(__GNUC__) || __GNUC__ &lt; 4 || (__GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ &lt; 3) || defined(__GXX_RTTI))
-#define HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast&lt;type &gt;(obj) != NULL)
-#else
-#define HAS_DYNAMIC_TYPE(type, obj) true
-#endif
-
-// A macro functioning as a compile-time assert to validate constant conditions
-#if defined(_MSC_VER) &amp;&amp; _MSC_VER &gt;= 1600
-#define META_ASSERT_MSG(condition, msg) static_assert(condition, msg)
-#else
-#define META_ASSERT_CONCAT(a, b) a ## b
-#define META_ASSERT_CONCAT2(a, b) META_ASSERT_CONCAT(a, b)
-#define META_ASSERT_MSG(condition, msg) typedef int META_ASSERT_CONCAT2(COMPILE_TIME_ASSERT_, __LINE__)[static_cast&lt;bool&gt;(condition)?1:-1]
-#endif
-#define META_ASSERT(condition) META_ASSERT_MSG(condition, &quot;compile time assertion failed.&quot;)
-
</del><span class="cx"> #endif   // COMMON_DEBUG_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonevent_tracercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,46 +4,53 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;common/event_tracer.h&quot;
</span><span class="cx"> 
</span><del>-namespace gl
-{
</del><ins>+#include &quot;common/debug.h&quot;
</ins><span class="cx"> 
</span><del>-GetCategoryEnabledFlagFunc g_getCategoryEnabledFlag;
-AddTraceEventFunc g_addTraceEvent;
-
-}  // namespace gl
-
-extern &quot;C&quot; {
-
-void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag,
-                                          AddTraceEventFunc addTraceEvent)
</del><ins>+namespace angle
</ins><span class="cx"> {
</span><del>-    gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag;
-    gl::g_addTraceEvent = addTraceEvent;
-}
</del><span class="cx"> 
</span><del>-}  // extern &quot;C&quot;
-
-namespace gl
</del><ins>+const unsigned char *GetTraceCategoryEnabledFlag(const char *name)
</ins><span class="cx"> {
</span><ins>+    angle::Platform *platform = ANGLEPlatformCurrent();
+    ASSERT(platform);
</ins><span class="cx"> 
</span><del>-const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name)
-{
-    if (g_getCategoryEnabledFlag)
</del><ins>+    const unsigned char *categoryEnabledFlag = platform-&gt;getTraceCategoryEnabledFlag(name);
+    if (categoryEnabledFlag != nullptr)
</ins><span class="cx">     {
</span><del>-        return g_getCategoryEnabledFlag(name);
</del><ins>+        return categoryEnabledFlag;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     static unsigned char disabled = 0;
</span><span class="cx">     return &amp;disabled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
-                        int numArgs, const char** argNames, const unsigned char* argTypes,
-                        const unsigned long long* argValues, unsigned char flags)
</del><ins>+Platform::TraceEventHandle AddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
+                                         int numArgs, const char** argNames, const unsigned char* argTypes,
+                                         const unsigned long long* argValues, unsigned char flags)
</ins><span class="cx"> {
</span><del>-    if (g_addTraceEvent)
</del><ins>+    angle::Platform *platform = ANGLEPlatformCurrent();
+    ASSERT(platform);
+
+    double timestamp = platform-&gt;monotonicallyIncreasingTime();
+
+    if (timestamp != 0)
</ins><span class="cx">     {
</span><del>-        g_addTraceEvent(phase, categoryGroupEnabled, name, id, numArgs, argNames, argTypes, argValues, flags);
</del><ins>+        angle::Platform::TraceEventHandle handle =
+            platform-&gt;addTraceEvent(phase,
+                                    categoryGroupEnabled,
+                                    name,
+                                    id,
+                                    timestamp,
+                                    numArgs,
+                                    argNames,
+                                    argTypes,
+                                    argValues,
+                                    flags);
+        ASSERT(handle != 0);
+        return handle;
</ins><span class="cx">     }
</span><ins>+
+    return static_cast&lt;Platform::TraceEventHandle&gt;(0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-}  // namespace gl
</del><ins>+}  // namespace angle
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonevent_tracerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/event_tracer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -5,37 +5,18 @@
</span><span class="cx"> #ifndef COMMON_EVENT_TRACER_H_
</span><span class="cx"> #define COMMON_EVENT_TRACER_H_
</span><span class="cx"> 
</span><del>-#if !defined(TRACE_ENTRY)
-#if defined(_WIN32)
-#define TRACE_ENTRY __stdcall
-#else
-#define TRACE_ENTRY
-#endif // // _WIN32
-#endif //TRACE_ENTRY
</del><ins>+#include &quot;common/platform.h&quot;
+#include &quot;platform/Platform.h&quot;
</ins><span class="cx"> 
</span><del>-extern &quot;C&quot; {
-
-typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
-typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroupEnabled, const char* name,
-                                  unsigned long long id, int numArgs, const char** argNames,
-                                  const unsigned char* argTypes, const unsigned long long* argValues,
-                                  unsigned char flags);
-
-// extern &quot;C&quot; so that it has a reasonable name for GetProcAddress.
-void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag,
-                                          AddTraceEventFunc add_trace_event_func);
-
-}
-
-namespace gl
</del><ins>+namespace angle
</ins><span class="cx"> {
</span><span class="cx"> 
</span><del>-const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name);
</del><ins>+const unsigned char *GetTraceCategoryEnabledFlag(const char* name);
+Platform::TraceEventHandle AddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name,
+                                         unsigned long long id, int numArgs, const char** argNames,
+                                         const unsigned char* argTypes, const unsigned long long* argValues,
+                                         unsigned char flags);
</ins><span class="cx"> 
</span><del>-void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
-                        int numArgs, const char** argNames, const unsigned char* argTypes,
-                        const unsigned long long* argValues, unsigned char flags);
-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif  // COMMON_EVENT_TRACER_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonmathutilcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/mathutil.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx"> // mathutil.cpp: Math and bit manipulation functions.
</span><span class="cx"> 
</span><span class="cx"> #include &quot;common/mathutil.h&quot;
</span><ins>+
</ins><span class="cx"> #include &lt;algorithm&gt;
</span><span class="cx"> #include &lt;math.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -42,13 +43,13 @@
</span><span class="cx"> 
</span><span class="cx">     const float max_c = std::max&lt;float&gt;(std::max&lt;float&gt;(red_c, green_c), blue_c);
</span><span class="cx">     const float exp_p = std::max&lt;float&gt;(-g_sharedexp_bias - 1, floor(log(max_c))) + 1 + g_sharedexp_bias;
</span><del>-    const int max_s = floor((max_c / (pow(2.0f, exp_p - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
-    const int exp_s = (max_s &lt; pow(2.0f, g_sharedexp_mantissabits)) ? exp_p : exp_p + 1;
</del><ins>+    const int max_s = static_cast&lt;int&gt;(floor((max_c / (pow(2.0f, exp_p - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
+    const int exp_s = static_cast&lt;int&gt;((max_s &lt; pow(2.0f, g_sharedexp_mantissabits)) ? exp_p : exp_p + 1);
</ins><span class="cx"> 
</span><span class="cx">     RGB9E5Data output;
</span><del>-    output.R = floor((red_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
-    output.G = floor((green_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
-    output.B = floor((blue_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f);
</del><ins>+    output.R = static_cast&lt;unsigned int&gt;(floor((red_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
+    output.G = static_cast&lt;unsigned int&gt;(floor((green_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
+    output.B = static_cast&lt;unsigned int&gt;(floor((blue_c / (pow(2.0f, exp_s - g_sharedexp_bias - g_sharedexp_mantissabits))) + 0.5f));
</ins><span class="cx">     output.E = exp_s;
</span><span class="cx"> 
</span><span class="cx">     return *reinterpret_cast&lt;unsigned int*&gt;(&amp;output);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonmathutilh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/mathutil.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/mathutil.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/mathutil.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,18 +6,16 @@
</span><span class="cx"> 
</span><span class="cx"> // mathutil.h: Math and bit manipulation functions.
</span><span class="cx"> 
</span><del>-#ifndef LIBGLESV2_MATHUTIL_H_
-#define LIBGLESV2_MATHUTIL_H_
</del><ins>+#ifndef COMMON_MATHUTIL_H_
+#define COMMON_MATHUTIL_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;common/debug.h&quot;
</span><ins>+#include &quot;common/platform.h&quot;
</ins><span class="cx"> 
</span><del>-#if defined(_WIN32)
-#include &lt;intrin.h&gt;
-#endif
-
</del><span class="cx"> #include &lt;limits&gt;
</span><span class="cx"> #include &lt;algorithm&gt;
</span><span class="cx"> #include &lt;string.h&gt;
</span><ins>+#include &lt;stdlib.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="lines">@@ -112,7 +110,7 @@
</span><span class="cx"> 
</span><span class="cx"> inline bool supportsSSE2()
</span><span class="cx"> {
</span><del>-#if defined(_WIN32)
</del><ins>+#if defined(ANGLE_PLATFORM_WINDOWS) &amp;&amp; !defined(_M_ARM)
</ins><span class="cx">     static bool checked = false;
</span><span class="cx">     static bool supports = false;
</span><span class="cx"> 
</span><span class="lines">@@ -157,7 +155,7 @@
</span><span class="cx"> 
</span><span class="cx">     if(abs &gt; 0x47FFEFFF)   // Infinity
</span><span class="cx">     {
</span><del>-        return sign | 0x7FFF;
</del><ins>+        return static_cast&lt;unsigned short&gt;(sign | 0x7FFF);
</ins><span class="cx">     }
</span><span class="cx">     else if(abs &lt; 0x38800000)   // Denormal
</span><span class="cx">     {
</span><span class="lines">@@ -173,11 +171,11 @@
</span><span class="cx">             abs = 0;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return sign | (abs + 0x00000FFF + ((abs &gt;&gt; 13) &amp; 1)) &gt;&gt; 13;
</del><ins>+        return static_cast&lt;unsigned short&gt;(sign | (abs + 0x00000FFF + ((abs &gt;&gt; 13) &amp; 1)) &gt;&gt; 13);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><del>-        return sign | (abs + 0xC8000000 + 0x00000FFF + ((abs &gt;&gt; 13) &amp; 1)) &gt;&gt; 13;
</del><ins>+        return static_cast&lt;unsigned short&gt;(sign | (abs + 0xC8000000 + 0x00000FFF + ((abs &gt;&gt; 13) &amp; 1)) &gt;&gt; 13);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -356,7 +354,7 @@
</span><span class="cx">         }
</span><span class="cx">         else // The value is zero
</span><span class="cx">         {
</span><del>-            exponent = -112;
</del><ins>+            exponent = static_cast&lt;unsigned short&gt;(-112);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return bitCast&lt;float&gt;(((exponent + 112) &lt;&lt; 23) | (mantissa &lt;&lt; 17));
</span><span class="lines">@@ -395,7 +393,7 @@
</span><span class="cx">         }
</span><span class="cx">         else // The value is zero
</span><span class="cx">         {
</span><del>-            exponent = -112;
</del><ins>+            exponent = static_cast&lt;unsigned short&gt;(-112);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         return bitCast&lt;float&gt;(((exponent + 112) &lt;&lt; 23) | (mantissa &lt;&lt; 18));
</span><span class="lines">@@ -405,7 +403,7 @@
</span><span class="cx"> template &lt;typename T&gt;
</span><span class="cx"> inline float normalizedToFloat(T input)
</span><span class="cx"> {
</span><del>-    META_ASSERT(std::numeric_limits&lt;T&gt;::is_integer);
</del><ins>+    static_assert(std::numeric_limits&lt;T&gt;::is_integer, &quot;T must be an integer.&quot;);
</ins><span class="cx"> 
</span><span class="cx">     const float inverseMax = 1.0f / std::numeric_limits&lt;T&gt;::max();
</span><span class="cx">     return input * inverseMax;
</span><span class="lines">@@ -414,8 +412,8 @@
</span><span class="cx"> template &lt;unsigned int inputBitCount, typename T&gt;
</span><span class="cx"> inline float normalizedToFloat(T input)
</span><span class="cx"> {
</span><del>-    META_ASSERT(std::numeric_limits&lt;T&gt;::is_integer);
-    META_ASSERT(inputBitCount &lt; (sizeof(T) * 8));
</del><ins>+    static_assert(std::numeric_limits&lt;T&gt;::is_integer, &quot;T must be an integer.&quot;);
+    static_assert(inputBitCount &lt; (sizeof(T) * 8), &quot;T must have more bits than inputBitCount.&quot;);
</ins><span class="cx"> 
</span><span class="cx">     const float inverseMax = 1.0f / ((1 &lt;&lt; inputBitCount) - 1);
</span><span class="cx">     return input * inverseMax;
</span><span class="lines">@@ -424,20 +422,21 @@
</span><span class="cx"> template &lt;typename T&gt;
</span><span class="cx"> inline T floatToNormalized(float input)
</span><span class="cx"> {
</span><del>-    return std::numeric_limits&lt;T&gt;::max() * input + 0.5f;
</del><ins>+    return static_cast&lt;T&gt;(std::numeric_limits&lt;T&gt;::max() * input + 0.5f);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;unsigned int outputBitCount, typename T&gt;
</span><span class="cx"> inline T floatToNormalized(float input)
</span><span class="cx"> {
</span><del>-    META_ASSERT(outputBitCount &lt; (sizeof(T) * 8));
-    return ((1 &lt;&lt; outputBitCount) - 1) * input + 0.5f;
</del><ins>+    static_assert(outputBitCount &lt; (sizeof(T) * 8), &quot;T must have more bits than outputBitCount.&quot;);
+    return static_cast&lt;T&gt;(((1 &lt;&lt; outputBitCount) - 1) * input + 0.5f);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;unsigned int inputBitCount, unsigned int inputBitStart, typename T&gt;
</span><span class="cx"> inline T getShiftedData(T input)
</span><span class="cx"> {
</span><del>-    META_ASSERT(inputBitCount + inputBitStart &lt;= (sizeof(T) * 8));
</del><ins>+    static_assert(inputBitCount + inputBitStart &lt;= (sizeof(T) * 8),
+                  &quot;T must have at least as many bits as inputBitCount + inputBitStart.&quot;);
</ins><span class="cx">     const T mask = (1 &lt;&lt; inputBitCount) - 1;
</span><span class="cx">     return (input &gt;&gt; inputBitStart) &amp; mask;
</span><span class="cx"> }
</span><span class="lines">@@ -445,7 +444,8 @@
</span><span class="cx"> template &lt;unsigned int inputBitCount, unsigned int inputBitStart, typename T&gt;
</span><span class="cx"> inline T shiftData(T input)
</span><span class="cx"> {
</span><del>-    META_ASSERT(inputBitCount + inputBitStart &lt;= (sizeof(T) * 8));
</del><ins>+    static_assert(inputBitCount + inputBitStart &lt;= (sizeof(T) * 8),
+                  &quot;T must have at least as many bits as inputBitCount + inputBitStart.&quot;);
</ins><span class="cx">     const T mask = (1 &lt;&lt; inputBitCount) - 1;
</span><span class="cx">     return (input &amp; mask) &lt;&lt; inputBitStart;
</span><span class="cx"> }
</span><span class="lines">@@ -493,12 +493,12 @@
</span><span class="cx"> 
</span><span class="cx"> inline unsigned int averageFloat11(unsigned int a, unsigned int b)
</span><span class="cx"> {
</span><del>-    return float32ToFloat11((float11ToFloat32(a) + float11ToFloat32(b)) * 0.5f);
</del><ins>+    return float32ToFloat11((float11ToFloat32(static_cast&lt;unsigned short&gt;(a)) + float11ToFloat32(static_cast&lt;unsigned short&gt;(b))) * 0.5f);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline unsigned int averageFloat10(unsigned int a, unsigned int b)
</span><span class="cx"> {
</span><del>-    return float32ToFloat10((float10ToFloat32(a) + float10ToFloat32(b)) * 0.5f);
</del><ins>+    return float32ToFloat10((float10ToFloat32(static_cast&lt;unsigned short&gt;(a)) + float10ToFloat32(static_cast&lt;unsigned short&gt;(b))) * 0.5f);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="lines">@@ -506,35 +506,81 @@
</span><span class="cx"> namespace rx
</span><span class="cx"> {
</span><span class="cx"> 
</span><ins>+// Represents intervals of the type [a, b)
+template &lt;typename T&gt;
</ins><span class="cx"> struct Range
</span><span class="cx"> {
</span><span class="cx">     Range() {}
</span><del>-    Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo &lt;= hi); }
</del><ins>+    Range(T lo, T hi) : start(lo), end(hi) { ASSERT(lo &lt;= hi); }
</ins><span class="cx"> 
</span><del>-    int start;
-    int end;
</del><ins>+    T start;
+    T end;
+
+    T length() const { return end - start; }
+
+    bool intersects(Range&lt;T&gt; other)
+    {
+        if (start &lt;= other.start)
+        {
+            return other.start &lt; end;
+        }
+        else
+        {
+            return start &lt; other.end;
+        }
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+typedef Range&lt;int&gt; RangeI;
+typedef Range&lt;unsigned int&gt; RangeUI;
+
</ins><span class="cx"> template &lt;typename T&gt;
</span><span class="cx"> T roundUp(const T value, const T alignment)
</span><span class="cx"> {
</span><span class="cx">     return value + alignment - 1 - (value - 1) % alignment;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
+{
+    unsigned int divided = value / divisor;
+    return (divided + ((value % divisor == 0) ? 0 : 1));
+}
+
</ins><span class="cx"> template &lt;class T&gt;
</span><span class="cx"> inline bool IsUnsignedAdditionSafe(T lhs, T rhs)
</span><span class="cx"> {
</span><del>-    META_ASSERT(!std::numeric_limits&lt;T&gt;::is_signed);
</del><ins>+    static_assert(!std::numeric_limits&lt;T&gt;::is_signed, &quot;T must be unsigned.&quot;);
</ins><span class="cx">     return (rhs &lt;= std::numeric_limits&lt;T&gt;::max() - lhs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template &lt;class T&gt;
</span><span class="cx"> inline bool IsUnsignedMultiplicationSafe(T lhs, T rhs)
</span><span class="cx"> {
</span><del>-    META_ASSERT(!std::numeric_limits&lt;T&gt;::is_signed);
</del><ins>+    static_assert(!std::numeric_limits&lt;T&gt;::is_signed, &quot;T must be unsigned.&quot;);
</ins><span class="cx">     return (lhs == T(0) || rhs == T(0) || (rhs &lt;= std::numeric_limits&lt;T&gt;::max() / lhs));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template &lt;class SmallIntT, class BigIntT&gt;
+inline bool IsIntegerCastSafe(BigIntT bigValue)
+{
+    return (static_cast&lt;BigIntT&gt;(static_cast&lt;SmallIntT&gt;(bigValue)) == bigValue);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif   // LIBGLESV2_MATHUTIL_H_
</del><ins>+#if defined(_MSC_VER)
+
+#define ANGLE_ROTL(x,y) _rotl(x,y)
+
+#else
+
+inline uint32_t RotL(uint32_t x, int8_t r)
+{
+    return (x &lt;&lt; r) | (x &gt;&gt; (32 - r));
+}
+
+#define ANGLE_ROTL(x,y) RotL(x,y)
+
+#endif // namespace rx
+
+}
+
+#endif   // COMMON_MATHUTIL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonplatformh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/platform.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/platform.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/platform.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// platform.h: Operating system specific includes and defines.
+
+#ifndef COMMON_PLATFORM_H_
+#define COMMON_PLATFORM_H_
+
+#if defined(_WIN32) || defined(_WIN64)
+#   define ANGLE_PLATFORM_WINDOWS 1
+#elif defined(__APPLE__)
+#   define ANGLE_PLATFORM_APPLE 1
+#   define ANGLE_PLATFORM_POSIX 1
+#elif defined(ANDROID)
+#   define ANGLE_PLATFORM_ANDROID 1
+#   define ANGLE_PLATFORM_POSIX 1
+#elif defined(__linux__) || defined(EMSCRIPTEN)
+#   define ANGLE_PLATFORM_LINUX 1
+#   define ANGLE_PLATFORM_POSIX 1
+#elif defined(__FreeBSD__) || \
+      defined(__OpenBSD__) || \
+      defined(__NetBSD__) || \
+      defined(__DragonFly__) || \
+      defined(__sun) || \
+      defined(__GLIBC__) || \
+      defined(__GNU__) || \
+      defined(__QNX__)
+#   define ANGLE_PLATFORM_POSIX 1
+#else
+#   error Unsupported platform.
+#endif
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+#   ifndef STRICT
+#       define STRICT 1
+#   endif
+#   ifndef WIN32_LEAN_AND_MEAN
+#       define WIN32_LEAN_AND_MEAN 1
+#   endif
+#   ifndef NOMINMAX
+#       define NOMINMAX 1
+#   endif
+
+#   include &lt;windows.h&gt;
+#   include &lt;intrin.h&gt;
+
+#   if defined(WINAPI_FAMILY) &amp;&amp; (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#       define ANGLE_ENABLE_WINDOWS_STORE 1
+#   endif
+
+#   if defined(ANGLE_ENABLE_D3D9)
+#       include &lt;d3d9.h&gt;
+#       include &lt;d3dcompiler.h&gt;
+#   endif
+
+#   if defined(ANGLE_ENABLE_D3D11)
+#       include &lt;d3d10_1.h&gt;
+#       include &lt;d3d11.h&gt;
+#       include &lt;d3d11_1.h&gt;
+#       include &lt;dxgi.h&gt;
+#       include &lt;dxgi1_2.h&gt;
+#       include &lt;d3dcompiler.h&gt;
+#   endif
+
+#   if defined(ANGLE_ENABLE_WINDOWS_STORE)
+#       include &lt;dxgi1_3.h&gt;
+#       if defined(_DEBUG)
+#           include &lt;DXProgrammableCapture.h&gt;
+#           include &lt;dxgidebug.h&gt;
+#       endif
+#   endif
+
+#   undef near
+#   undef far
+#endif
+
+#if !defined(_M_ARM) &amp;&amp; !defined(ANGLE_PLATFORM_ANDROID)
+#   define ANGLE_USE_SSE
+#endif
+
+#endif // COMMON_PLATFORM_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonshadervarscpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/common/shadervars.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/shadervars.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/shadervars.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,81 +0,0 @@
</span><del>-//
-// Copyright (c) 2013-2014 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.
-//
-// shadervars.cpp:
-//   Implementation for GL shader variable member functions.
-//
-
-#include &quot;common/shadervars.h&quot;
-
-namespace gl
-{
-
-ShaderVariable::ShaderVariable(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn)
-    : type(typeIn),
-      precision(precisionIn),
-      name(nameIn),
-      arraySize(arraySizeIn)
-{
-}
-
-Uniform::Uniform(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, unsigned int registerIndexIn, unsigned int elementIndexIn)
-    : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
-      registerIndex(registerIndexIn),
-      elementIndex(elementIndexIn)
-{
-}
-
-Attribute::Attribute()
-    : ShaderVariable(GL_NONE, GL_NONE, &quot;&quot;, 0),
-      location(-1)
-{
-}
-
-Attribute::Attribute(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, int locationIn)
-    : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
-      location(locationIn)
-{
-}
-
-InterfaceBlockField::InterfaceBlockField(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, bool isRowMajorMatrix)
-    : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
-      isRowMajorMatrix(isRowMajorMatrix)
-{
-}
-
-Varying::Varying(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, InterpolationType interpolationIn)
-    : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn),
-      interpolation(interpolationIn),
-      registerIndex(GL_INVALID_INDEX),
-      elementIndex(GL_INVALID_INDEX)
-{
-}
-
-void Varying::resetRegisterAssignment()
-{
-    registerIndex = GL_INVALID_INDEX;
-    elementIndex = GL_INVALID_INDEX;
-}
-
-BlockMemberInfo::BlockMemberInfo(long offset, long arrayStride, long matrixStride, bool isRowMajorMatrix)
-    : offset(offset),
-      arrayStride(arrayStride),
-      matrixStride(matrixStride),
-      isRowMajorMatrix(isRowMajorMatrix)
-{
-}
-
-const BlockMemberInfo BlockMemberInfo::defaultBlockInfo(-1, -1, -1, false);
-
-InterfaceBlock::InterfaceBlock(const char *name, unsigned int arraySize, unsigned int registerIndex)
-    : name(name),
-      arraySize(arraySize),
-      layout(BLOCKLAYOUT_SHARED),
-      registerIndex(registerIndex),
-      isRowMajorLayout(false)
-{
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonshadervarsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/common/shadervars.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/shadervars.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/shadervars.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,127 +0,0 @@
</span><del>-//
-// Copyright (c) 2013-2014 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.
-//
-// shadervars.h:
-//  Types to represent GL variables (varyings, uniforms, etc)
-//
-
-#ifndef COMMON_SHADERVARIABLE_H_
-#define COMMON_SHADERVARIABLE_H_
-
-#include &lt;string&gt;
-#include &lt;vector&gt;
-#include &lt;algorithm&gt;
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-namespace gl
-{
-
-enum InterpolationType
-{
-    INTERPOLATION_SMOOTH,
-    INTERPOLATION_CENTROID,
-    INTERPOLATION_FLAT
-};
-
-struct ShaderVariable
-{
-    GLenum type;
-    GLenum precision;
-    std::string name;
-    unsigned int arraySize;
-
-    ShaderVariable(GLenum type, GLenum precision, const char *name, unsigned int arraySize);
-    bool isArray() const { return arraySize &gt; 0; }
-    unsigned int elementCount() const { return std::max(1u, arraySize); }
-};
-
-struct Uniform : public ShaderVariable
-{
-    unsigned long registerIndex;
-    unsigned long elementIndex;     // For struct varyings
-    std::vector&lt;Uniform&gt; fields;
-
-    Uniform(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn,
-            unsigned int registerIndexIn, unsigned int elementIndexIn);
-
-    bool isStruct() const { return !fields.empty(); }
-};
-
-struct Attribute : public ShaderVariable
-{
-    int location;
-
-    Attribute();
-    Attribute(GLenum type, GLenum precision, const char *name, unsigned int arraySize, int location);
-};
-
-struct InterfaceBlockField : public ShaderVariable
-{
-    bool isRowMajorMatrix;
-    std::vector&lt;InterfaceBlockField&gt; fields;
-
-    InterfaceBlockField(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, bool isRowMajorMatrix);
-
-    bool isStruct() const { return !fields.empty(); }
-};
-
-struct Varying : public ShaderVariable
-{
-    InterpolationType interpolation;
-    std::vector&lt;Varying&gt; fields;
-    unsigned int registerIndex;    // Assigned during link
-    unsigned int elementIndex;     // First register element for varyings, assigned during link
-    std::string structName;
-
-    Varying(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, InterpolationType interpolationIn);
-
-    bool isStruct() const { return !fields.empty(); }
-    bool registerAssigned() const { return registerIndex != GL_INVALID_INDEX; }
-
-    void resetRegisterAssignment();
-};
-
-struct BlockMemberInfo
-{
-    BlockMemberInfo(long offset, long arrayStride, long matrixStride, bool isRowMajorMatrix);
-
-    long offset;
-    long arrayStride;
-    long matrixStride;
-    bool isRowMajorMatrix;
-
-    static const BlockMemberInfo defaultBlockInfo;
-};
-
-typedef std::vector&lt;BlockMemberInfo&gt; BlockMemberInfoArray;
-
-enum BlockLayoutType
-{
-    BLOCKLAYOUT_STANDARD,
-    BLOCKLAYOUT_PACKED,
-    BLOCKLAYOUT_SHARED
-};
-
-struct InterfaceBlock
-{
-    InterfaceBlock(const char *name, unsigned int arraySize, unsigned int registerIndex);
-
-    std::string name;
-    unsigned int arraySize;
-    size_t dataSize;
-    BlockLayoutType layout;
-    bool isRowMajorLayout;
-    std::vector&lt;InterfaceBlockField&gt; fields;
-    std::vector&lt;BlockMemberInfo&gt; blockInfo;
-
-    unsigned int registerIndex;
-};
-
-}
-
-#endif // COMMON_SHADERVARIABLE_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommontlscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/tls.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/tls.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/tls.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// tls.cpp: Simple cross-platform interface for thread local storage.
+
+#include &quot;common/tls.h&quot;
+
+#include &lt;assert.h&gt;
+
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+#include &lt;vector&gt;
+#include &lt;set&gt;
+#include &lt;map&gt;
+#include &lt;mutex&gt;
+
+#include &lt;wrl/client.h&gt;
+#include &lt;wrl/async.h&gt;
+#include &lt;Windows.System.Threading.h&gt;
+
+using namespace std;
+using namespace Windows::Foundation;
+using namespace ABI::Windows::System::Threading;
+
+// Thread local storage for Windows Store support
+typedef vector&lt;void*&gt; ThreadLocalData;
+
+static __declspec(thread) ThreadLocalData* currentThreadData = nullptr;
+static set&lt;ThreadLocalData*&gt; allThreadData;
+static DWORD nextTlsIndex = 0;
+static vector&lt;DWORD&gt; freeTlsIndices;
+
+#endif
+
+TLSIndex CreateTLSIndex()
+{
+    TLSIndex index;
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+    if (!freeTlsIndices.empty())
+    {
+        DWORD result = freeTlsIndices.back();
+        freeTlsIndices.pop_back();
+        index = result;
+    }
+    else
+    {
+        index = nextTlsIndex++;
+    }
+#else
+    index = TlsAlloc();
+#endif
+
+#elif defined(ANGLE_PLATFORM_POSIX)
+    // Create global pool key
+    if ((pthread_key_create(&amp;index, NULL)) != 0)
+    {
+        index = TLS_INVALID_INDEX;
+    }
+#endif
+
+    assert(index != TLS_INVALID_INDEX &amp;&amp; &quot;CreateTLSIndex(): Unable to allocate Thread Local Storage&quot;);
+    return index;
+}
+
+bool DestroyTLSIndex(TLSIndex index)
+{
+    assert(index != TLS_INVALID_INDEX &amp;&amp; &quot;DestroyTLSIndex(): Invalid TLS Index&quot;);
+    if (index == TLS_INVALID_INDEX)
+    {
+        return false;
+    }
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+    assert(index &lt; nextTlsIndex);
+    assert(find(freeTlsIndices.begin(), freeTlsIndices.end(), index) == freeTlsIndices.end());
+
+    freeTlsIndices.push_back(index);
+    for (auto threadData : allThreadData)
+    {
+        if (threadData-&gt;size() &gt; index)
+        {
+            threadData-&gt;at(index) = nullptr;
+        }
+    }
+    return true;
+#else
+    return (TlsFree(index) == TRUE);
+#endif
+#elif defined(ANGLE_PLATFORM_POSIX)
+    return (pthread_key_delete(index) == 0);
+#endif
+}
+
+bool SetTLSValue(TLSIndex index, void *value)
+{
+    assert(index != TLS_INVALID_INDEX &amp;&amp; &quot;SetTLSValue(): Invalid TLS Index&quot;);
+    if (index == TLS_INVALID_INDEX)
+    {
+        return false;
+    }
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+    ThreadLocalData* threadData = currentThreadData;
+    if (!threadData)
+    {
+        threadData = new ThreadLocalData(index + 1, nullptr);
+        allThreadData.insert(threadData);
+        currentThreadData = threadData;
+    }
+    else if (threadData-&gt;size() &lt;= index)
+    {
+        threadData-&gt;resize(index + 1, nullptr);
+    }
+
+    threadData-&gt;at(index) = value;
+    return true;
+#else
+    return (TlsSetValue(index, value) == TRUE);
+#endif
+#elif defined(ANGLE_PLATFORM_POSIX)
+    return (pthread_setspecific(index, value) == 0);
+#endif
+}
+
+void *GetTLSValue(TLSIndex index)
+{
+    assert(index != TLS_INVALID_INDEX &amp;&amp; &quot;GetTLSValue(): Invalid TLS Index&quot;);
+    if (index == TLS_INVALID_INDEX)
+    {
+        return NULL;
+    }
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+#ifdef ANGLE_ENABLE_WINDOWS_STORE
+    ThreadLocalData* threadData = currentThreadData;
+    if (threadData &amp;&amp; threadData-&gt;size() &gt; index)
+    {
+        return threadData-&gt;at(index);
+    }
+    else
+    {
+        return nullptr;
+    }
+#else
+    return TlsGetValue(index);
+#endif
+#elif defined(ANGLE_PLATFORM_POSIX)
+    return pthread_getspecific(index);
+#endif
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommontlsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/tls.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/tls.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/tls.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// tls.h: Simple cross-platform interface for thread local storage.
+
+#ifndef COMMON_TLS_H_
+#define COMMON_TLS_H_
+
+#include &quot;common/platform.h&quot;
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+
+// TLS does not exist for Windows Store and needs to be emulated
+#   ifdef ANGLE_ENABLE_WINDOWS_STORE
+#       ifndef TLS_OUT_OF_INDEXES
+#           define TLS_OUT_OF_INDEXES static_cast&lt;DWORD&gt;(0xFFFFFFFF)
+#       endif
+#       ifndef CREATE_SUSPENDED
+#           define CREATE_SUSPENDED 0x00000004
+#       endif
+#   endif
+    typedef DWORD TLSIndex;
+#   define TLS_INVALID_INDEX (TLS_OUT_OF_INDEXES)
+#elif defined(ANGLE_PLATFORM_POSIX)
+#   include &lt;pthread.h&gt;
+#   include &lt;semaphore.h&gt;
+#   include &lt;errno.h&gt;
+    typedef pthread_key_t TLSIndex;
+#   define TLS_INVALID_INDEX (static_cast&lt;TLSIndex&gt;(-1))
+#else
+#   error Unsupported platform.
+#endif
+
+// TODO(kbr): for POSIX platforms this will have to be changed to take
+// in a destructor function pointer, to allow the thread-local storage
+// to be properly deallocated upon thread exit.
+TLSIndex CreateTLSIndex();
+bool DestroyTLSIndex(TLSIndex index);
+
+bool SetTLSValue(TLSIndex index, void *value);
+void *GetTLSValue(TLSIndex index);
+
+#endif // COMMON_TLS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonutilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/utilities.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/utilities.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/utilities.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -8,77 +8,26 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;common/utilities.h&quot;
</span><span class="cx"> #include &quot;common/mathutil.h&quot;
</span><ins>+#include &quot;common/platform.h&quot;
</ins><span class="cx"> 
</span><del>-#if defined(_WIN32)
-#include &lt;windows.h&gt;
</del><ins>+#include &lt;set&gt;
+
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+#  include &lt;wrl.h&gt;
+#  include &lt;wrl/wrappers/corewrappers.h&gt;
+#  include &lt;windows.applicationmodel.core.h&gt;
+#  include &lt;windows.graphics.display.h&gt;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#include &lt;set&gt;
-
</del><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx"> 
</span><del>-int UniformComponentCount(GLenum type)
</del><ins>+int VariableComponentCount(GLenum type)
</ins><span class="cx"> {
</span><del>-    switch (type)
-    {
-      case GL_BOOL:
-      case GL_FLOAT:
-      case GL_INT:
-      case GL_SAMPLER_2D:
-      case GL_SAMPLER_3D:
-      case GL_SAMPLER_CUBE:
-      case GL_SAMPLER_2D_ARRAY:
-      case GL_INT_SAMPLER_2D:
-      case GL_INT_SAMPLER_3D:
-      case GL_INT_SAMPLER_CUBE:
-      case GL_INT_SAMPLER_2D_ARRAY:
-      case GL_UNSIGNED_INT_SAMPLER_2D:
-      case GL_UNSIGNED_INT_SAMPLER_3D:
-      case GL_UNSIGNED_INT_SAMPLER_CUBE:
-      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
-      case GL_SAMPLER_2D_SHADOW:
-      case GL_SAMPLER_CUBE_SHADOW:
-      case GL_SAMPLER_2D_ARRAY_SHADOW:
-      case GL_UNSIGNED_INT:
-        return 1;
-      case GL_BOOL_VEC2:
-      case GL_FLOAT_VEC2:
-      case GL_INT_VEC2:
-      case GL_UNSIGNED_INT_VEC2:
-        return 2;
-      case GL_INT_VEC3:
-      case GL_FLOAT_VEC3:
-      case GL_BOOL_VEC3:
-      case GL_UNSIGNED_INT_VEC3:
-        return 3;
-      case GL_BOOL_VEC4:
-      case GL_FLOAT_VEC4:
-      case GL_INT_VEC4:
-      case GL_UNSIGNED_INT_VEC4:
-      case GL_FLOAT_MAT2:
-        return 4;
-      case GL_FLOAT_MAT2x3:
-      case GL_FLOAT_MAT3x2:
-        return 6;
-      case GL_FLOAT_MAT2x4:
-      case GL_FLOAT_MAT4x2:
-        return 8;
-      case GL_FLOAT_MAT3:
-        return 9;
-      case GL_FLOAT_MAT3x4:
-      case GL_FLOAT_MAT4x3:
-        return 12;
-      case GL_FLOAT_MAT4:
-        return 16;
-      default:
-        UNREACHABLE();
-    }
-
-    return 0;
</del><ins>+    return VariableRowCount(type) * VariableColumnCount(type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLenum UniformComponentType(GLenum type)
</del><ins>+GLenum VariableComponentType(GLenum type)
</ins><span class="cx"> {
</span><span class="cx">     switch(type)
</span><span class="cx">     {
</span><span class="lines">@@ -133,7 +82,7 @@
</span><span class="cx">     return GL_NONE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-size_t UniformComponentSize(GLenum type)
</del><ins>+size_t VariableComponentSize(GLenum type)
</ins><span class="cx"> {
</span><span class="cx">     switch(type)
</span><span class="cx">     {
</span><span class="lines">@@ -147,18 +96,18 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-size_t UniformInternalSize(GLenum type)
</del><ins>+size_t VariableInternalSize(GLenum type)
</ins><span class="cx"> {
</span><span class="cx">     // Expanded to 4-element vectors
</span><del>-    return UniformComponentSize(UniformComponentType(type)) * VariableRowCount(type) * 4;
</del><ins>+    return VariableComponentSize(VariableComponentType(type)) * VariableRowCount(type) * 4;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-size_t UniformExternalSize(GLenum type)
</del><ins>+size_t VariableExternalSize(GLenum type)
</ins><span class="cx"> {
</span><del>-    return UniformComponentSize(UniformComponentType(type)) * UniformComponentCount(type);
</del><ins>+    return VariableComponentSize(VariableComponentType(type)) * VariableComponentCount(type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLenum UniformBoolVectorType(GLenum type)
</del><ins>+GLenum VariableBoolVectorType(GLenum type)
</ins><span class="cx"> {
</span><span class="cx">     switch (type)
</span><span class="cx">     {
</span><span class="lines">@@ -212,6 +161,8 @@
</span><span class="cx">       case GL_SAMPLER_3D:
</span><span class="cx">       case GL_SAMPLER_CUBE:
</span><span class="cx">       case GL_SAMPLER_2D_ARRAY:
</span><ins>+      case GL_SAMPLER_EXTERNAL_OES:
+      case GL_SAMPLER_2D_RECT_ARB:
</ins><span class="cx">       case GL_INT_SAMPLER_2D:
</span><span class="cx">       case GL_INT_SAMPLER_3D:
</span><span class="cx">       case GL_INT_SAMPLER_CUBE:
</span><span class="lines">@@ -262,6 +213,8 @@
</span><span class="cx">       case GL_INT_SAMPLER_3D:
</span><span class="cx">       case GL_INT_SAMPLER_CUBE:
</span><span class="cx">       case GL_INT_SAMPLER_2D_ARRAY:
</span><ins>+      case GL_SAMPLER_EXTERNAL_OES:
+      case GL_SAMPLER_2D_RECT_ARB:
</ins><span class="cx">       case GL_UNSIGNED_INT_SAMPLER_2D:
</span><span class="cx">       case GL_UNSIGNED_INT_SAMPLER_3D:
</span><span class="cx">       case GL_UNSIGNED_INT_SAMPLER_CUBE:
</span><span class="lines">@@ -301,7 +254,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool IsSampler(GLenum type)
</del><ins>+bool IsSamplerType(GLenum type)
</ins><span class="cx"> {
</span><span class="cx">     switch (type)
</span><span class="cx">     {
</span><span class="lines">@@ -365,7 +318,7 @@
</span><span class="cx">     return isRowMajorMatrix ? VariableColumnCount(type) : VariableRowCount(type);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int AttributeRegisterCount(GLenum type)
</del><ins>+int VariableRegisterCount(GLenum type)
</ins><span class="cx"> {
</span><span class="cx">     return IsMatrixType(type) ? VariableColumnCount(type) : 1;
</span><span class="cx"> }
</span><span class="lines">@@ -390,29 +343,29 @@
</span><span class="cx">     return -1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool IsCubemapTextureTarget(GLenum target)
</del><ins>+static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1, &quot;Unexpected GL cube map enum value.&quot;);
+static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2, &quot;Unexpected GL cube map enum value.&quot;);
+static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 3, &quot;Unexpected GL cube map enum value.&quot;);
+static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4, &quot;Unexpected GL cube map enum value.&quot;);
+static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5, &quot;Unexpected GL cube map enum value.&quot;);
+
+bool IsCubeMapTextureTarget(GLenum target)
</ins><span class="cx"> {
</span><del>-    return (target &gt;= GL_TEXTURE_CUBE_MAP_POSITIVE_X &amp;&amp; target &lt;= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
</del><ins>+    return (target &gt;= FirstCubeMapTextureTarget &amp;&amp; target &lt;= LastCubeMapTextureTarget);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool IsInternalTextureTarget(GLenum target, GLuint clientVersion)
</del><ins>+size_t CubeMapTextureTargetToLayerIndex(GLenum target)
</ins><span class="cx"> {
</span><del>-    if (clientVersion == 2)
-    {
-        return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
-    }
-    else if (clientVersion == 3)
-    {
-        return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target) ||
-               target == GL_TEXTURE_3D || target == GL_TEXTURE_2D_ARRAY;
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
</del><ins>+    ASSERT(IsCubeMapTextureTarget(target));
+    return target - static_cast&lt;size_t&gt;(FirstCubeMapTextureTarget);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+GLenum LayerIndexToCubeMapTextureTarget(size_t index)
+{
+    ASSERT(index &lt;= (LastCubeMapTextureTarget - FirstCubeMapTextureTarget));
+    return FirstCubeMapTextureTarget + static_cast&lt;GLenum&gt;(index);
+}
+
</ins><span class="cx"> bool IsTriangleMode(GLenum drawMode)
</span><span class="cx"> {
</span><span class="cx">     switch (drawMode)
</span><span class="lines">@@ -432,11 +385,120 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// [OpenGL ES SL 3.00.4] Section 11 p. 120
+// Vertex Outs/Fragment Ins packing priorities
+int VariableSortOrder(GLenum type)
+{
+    switch (type)
+    {
+      // 1. Arrays of mat4 and mat4
+      // Non-square matrices of type matCxR consume the same space as a square
+      // matrix of type matN where N is the greater of C and R
+      case GL_FLOAT_MAT4:
+      case GL_FLOAT_MAT2x4:
+      case GL_FLOAT_MAT3x4:
+      case GL_FLOAT_MAT4x2:
+      case GL_FLOAT_MAT4x3:
+        return 0;
+
+      // 2. Arrays of mat2 and mat2 (since they occupy full rows)
+      case GL_FLOAT_MAT2:
+        return 1;
+
+      // 3. Arrays of vec4 and vec4
+      case GL_FLOAT_VEC4:
+      case GL_INT_VEC4:
+      case GL_BOOL_VEC4:
+      case GL_UNSIGNED_INT_VEC4:
+        return 2;
+
+      // 4. Arrays of mat3 and mat3
+      case GL_FLOAT_MAT3:
+      case GL_FLOAT_MAT2x3:
+      case GL_FLOAT_MAT3x2:
+        return 3;
+
+      // 5. Arrays of vec3 and vec3
+      case GL_FLOAT_VEC3:
+      case GL_INT_VEC3:
+      case GL_BOOL_VEC3:
+      case GL_UNSIGNED_INT_VEC3:
+        return 4;
+
+      // 6. Arrays of vec2 and vec2
+      case GL_FLOAT_VEC2:
+      case GL_INT_VEC2:
+      case GL_BOOL_VEC2:
+      case GL_UNSIGNED_INT_VEC2:
+        return 5;
+
+      // 7. Single component types
+      case GL_FLOAT:
+      case GL_INT:
+      case GL_BOOL:
+      case GL_UNSIGNED_INT:
+      case GL_SAMPLER_2D:
+      case GL_SAMPLER_CUBE:
+      case GL_SAMPLER_EXTERNAL_OES:
+      case GL_SAMPLER_2D_RECT_ARB:
+      case GL_SAMPLER_2D_ARRAY:
+      case GL_SAMPLER_3D:
+      case GL_INT_SAMPLER_2D:
+      case GL_INT_SAMPLER_3D:
+      case GL_INT_SAMPLER_CUBE:
+      case GL_INT_SAMPLER_2D_ARRAY:
+      case GL_UNSIGNED_INT_SAMPLER_2D:
+      case GL_UNSIGNED_INT_SAMPLER_3D:
+      case GL_UNSIGNED_INT_SAMPLER_CUBE:
+      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+      case GL_SAMPLER_2D_SHADOW:
+      case GL_SAMPLER_2D_ARRAY_SHADOW:
+      case GL_SAMPLER_CUBE_SHADOW:
+        return 6;
+
+      default:
+        UNREACHABLE();
+        return 0;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+std::string ParseUniformName(const std::string &amp;name, size_t *outSubscript)
+{
+    // Strip any trailing array operator and retrieve the subscript
+    size_t open = name.find_last_of('[');
+    size_t close = name.find_last_of(']');
+    bool hasIndex = (open != std::string::npos) &amp;&amp; (close == name.length() - 1);
+    if (!hasIndex)
+    {
+        if (outSubscript)
+        {
+            *outSubscript = GL_INVALID_INDEX;
+        }
+        return name;
+    }
+
+    if (outSubscript)
+    {
+        int index = atoi(name.substr(open + 1).c_str());
+        if (index &gt;= 0)
+        {
+            *outSubscript = index;
+        }
+        else
+        {
+            *outSubscript = GL_INVALID_INDEX;
+        }
+    }
+
+    return name.substr(0, open);
+}
+
+}
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
</ins><span class="cx"> std::string getTempPath()
</span><span class="cx"> {
</span><del>-#if defined (_WIN32)
</del><ins>+#ifdef ANGLE_PLATFORM_WINDOWS
</ins><span class="cx">     char path[MAX_PATH];
</span><span class="cx">     DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path);
</span><span class="cx">     if (pathLen == 0)
</span><span class="lines">@@ -471,3 +533,41 @@
</span><span class="cx">     fwrite(content, sizeof(char), size, file);
</span><span class="cx">     fclose(file);
</span><span class="cx"> }
</span><ins>+#endif // !ANGLE_ENABLE_WINDOWS_STORE
+
+#if defined (ANGLE_PLATFORM_WINDOWS)
+
+// Causes the thread to relinquish the remainder of its time slice to any
+// other thread that is ready to run.If there are no other threads ready
+// to run, the function returns immediately, and the thread continues execution.
+void ScheduleYield()
+{
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+    // This implementation of Sleep exists because it is not available prior to Update 4.
+    static HANDLE singletonEvent = nullptr;
+    HANDLE sleepEvent = singletonEvent;
+    if (!sleepEvent)
+    {
+        sleepEvent = CreateEventEx(nullptr, nullptr, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS);
+
+        if (!sleepEvent)
+            return;
+
+        HANDLE previousEvent = InterlockedCompareExchangePointerRelease(&amp;singletonEvent, sleepEvent, nullptr);
+
+        if (previousEvent)
+        {
+            // Back out if multiple threads try to demand create at the same time.
+            CloseHandle(sleepEvent);
+            sleepEvent = previousEvent;
+        }
+    }
+
+    // Emulate sleep by waiting with timeout on an event that is never signalled.
+    WaitForSingleObjectEx(sleepEvent, 0, false);
+#else
+    Sleep(0);
+#endif
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonutilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/utilities.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/utilities.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/utilities.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,43 +6,44 @@
</span><span class="cx"> 
</span><span class="cx"> // utilities.h: Conversion functions and other utility routines.
</span><span class="cx"> 
</span><del>-#ifndef LIBGLESV2_UTILITIES_H
-#define LIBGLESV2_UTILITIES_H
</del><ins>+#ifndef COMMON_UTILITIES_H_
+#define COMMON_UTILITIES_H_
</ins><span class="cx"> 
</span><del>-#ifndef GL_APICALL
-#define GL_APICALL
-#endif
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES3/gl3ext.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-#include &lt;GLES2/gl2ext.h&gt;
-
</del><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> #include &lt;string&gt;
</span><span class="cx"> #include &lt;math.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace gl
</span><span class="cx"> {
</span><span class="cx"> 
</span><del>-int UniformComponentCount(GLenum type);
-GLenum UniformComponentType(GLenum type);
-size_t UniformComponentSize(GLenum type);
-size_t UniformInternalSize(GLenum type);
-size_t UniformExternalSize(GLenum type);
-GLenum UniformBoolVectorType(GLenum type);
</del><ins>+int VariableComponentCount(GLenum type);
+GLenum VariableComponentType(GLenum type);
+size_t VariableComponentSize(GLenum type);
+size_t VariableInternalSize(GLenum type);
+size_t VariableExternalSize(GLenum type);
+GLenum VariableBoolVectorType(GLenum type);
</ins><span class="cx"> int VariableRowCount(GLenum type);
</span><span class="cx"> int VariableColumnCount(GLenum type);
</span><del>-bool IsSampler(GLenum type);
</del><ins>+bool IsSamplerType(GLenum type);
</ins><span class="cx"> bool IsMatrixType(GLenum type);
</span><span class="cx"> GLenum TransposeMatrixType(GLenum type);
</span><del>-int AttributeRegisterCount(GLenum type);
</del><ins>+int VariableRegisterCount(GLenum type);
</ins><span class="cx"> int MatrixRegisterCount(GLenum type, bool isRowMajorMatrix);
</span><span class="cx"> int MatrixComponentCount(GLenum type, bool isRowMajorMatrix);
</span><ins>+int VariableSortOrder(GLenum type);
</ins><span class="cx"> 
</span><span class="cx"> int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
</span><span class="cx"> 
</span><del>-bool IsCubemapTextureTarget(GLenum target);
-bool IsInternalTextureTarget(GLenum target, GLuint clientVersion);
</del><ins>+static const GLenum FirstCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+static const GLenum LastCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
+bool IsCubeMapTextureTarget(GLenum target);
+size_t CubeMapTextureTargetToLayerIndex(GLenum target);
+GLenum LayerIndexToCubeMapTextureTarget(size_t index);
</ins><span class="cx"> 
</span><ins>+// Parse the base uniform name and array index.  Returns the base name of the uniform. outSubscript is
+// set to GL_INVALID_INDEX if the provided name is not an array or the array index is invalid.
+std::string ParseUniformName(const std::string &amp;name, size_t *outSubscript);
+
</ins><span class="cx"> bool IsTriangleMode(GLenum drawMode);
</span><span class="cx"> 
</span><span class="cx"> // [OpenGL ES 3.0.2] Section 2.3.1 page 14
</span><span class="lines">@@ -53,7 +54,13 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
</ins><span class="cx"> std::string getTempPath();
</span><span class="cx"> void writeFile(const char* path, const void* data, size_t size);
</span><ins>+#endif
</ins><span class="cx"> 
</span><del>-#endif  // LIBGLESV2_UTILITIES_H
</del><ins>+#if defined (ANGLE_PLATFORM_WINDOWS)
+void ScheduleYield();
+#endif
+
+#endif  // COMMON_UTILITIES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonutilities_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/common/utilities_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/utilities_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/common/utilities_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+//
+// Copyright (c) 2015 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_unittest.cpp: Unit tests for ANGLE's GL utility functions
+
+#include &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+namespace
+{
+
+TEST(ParseUniformName, ArrayIndex)
+{
+    size_t index;
+    EXPECT_EQ(&quot;foo&quot;, gl::ParseUniformName(&quot;foo[123]&quot;, &amp;index));
+    EXPECT_EQ(123u, index);
+
+    EXPECT_EQ(&quot;bar&quot;, gl::ParseUniformName(&quot;bar[0]&quot;, &amp;index));
+    EXPECT_EQ(0u, index);
+}
+
+TEST(ParseUniformName, NegativeArrayIndex)
+{
+    size_t index;
+    EXPECT_EQ(&quot;foo&quot;, gl::ParseUniformName(&quot;foo[-1]&quot;, &amp;index));
+    EXPECT_EQ(GL_INVALID_INDEX, index);
+}
+
+TEST(ParseUniformName, NoArrayIndex)
+{
+    size_t index;
+    EXPECT_EQ(&quot;foo&quot;, gl::ParseUniformName(&quot;foo&quot;, &amp;index));
+    EXPECT_EQ(GL_INVALID_INDEX, index);
+}
+
+TEST(ParseUniformName, NULLArrayIndex)
+{
+    EXPECT_EQ(&quot;foo&quot;, gl::ParseUniformName(&quot;foo[10]&quot;, nullptr));
+}
+
+TEST(ParseUniformName, TrailingWhitespace)
+{
+    size_t index;
+    EXPECT_EQ(&quot;foo &quot;, gl::ParseUniformName(&quot;foo &quot;, &amp;index));
+    EXPECT_EQ(GL_INVALID_INDEX, index);
+
+    EXPECT_EQ(&quot;foo[10] &quot;, gl::ParseUniformName(&quot;foo[10] &quot;, &amp;index));
+    EXPECT_EQ(GL_INVALID_INDEX, index);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccommonversionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/common/version.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/common/version.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/common/version.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,7 +1,16 @@
</span><ins>+//
+// Copyright (c) 2014 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 COMMON_VERSION_H_
+#define COMMON_VERSION_H_
+
</ins><span class="cx"> #include &quot;commit.h&quot;
</span><span class="cx"> 
</span><del>-#define ANGLE_MAJOR_VERSION 1
-#define ANGLE_MINOR_VERSION 3
</del><ins>+#define ANGLE_MAJOR_VERSION 2
+#define ANGLE_MINOR_VERSION 1
</ins><span class="cx"> 
</span><span class="cx"> #define ANGLE_STRINGIFY(x)       #x
</span><span class="cx"> #define ANGLE_MACRO_STRINGIFY(x) ANGLE_STRINGIFY(x)
</span><span class="lines">@@ -10,3 +19,5 @@
</span><span class="cx">     ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) &quot;.&quot; \
</span><span class="cx">     ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) &quot;.&quot; \
</span><span class="cx">     ANGLE_COMMIT_HASH
</span><ins>+
+#endif // COMMON_VERSION_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessor64bittokenizersafetypatch"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/64bit-tokenizer-safety.patch (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/64bit-tokenizer-safety.patch        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/64bit-tokenizer-safety.patch        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx"> @@ -179,6 +180,11 @@ typedef void* yyscan_t;
</span><span class="cx">  typedef struct yy_buffer_state *YY_BUFFER_STATE;
</span><span class="cx">  #endif
</span><del>- 
</del><ins>+
</ins><span class="cx"> +#ifndef YY_TYPEDEF_YY_SIZE_T
</span><span class="cx"> +#define YY_TYPEDEF_YY_SIZE_T
</span><span class="cx"> +typedef size_t yy_size_t;
</span><span class="lines">@@ -20,36 +20,6 @@
</span><span class="cx">  #define EOB_ACT_CONTINUE_SCAN 0
</span><span class="cx">  #define EOB_ACT_END_OF_FILE 1
</span><span class="cx">  #define EOB_ACT_LAST_MATCH 2
</span><del>-@@ -201,11 +207,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;

- #define unput(c) yyunput( c, yyg-&gt;yytext_ptr , yyscanner )

--#ifndef YY_TYPEDEF_YY_SIZE_T
--#define YY_TYPEDEF_YY_SIZE_T
--typedef size_t yy_size_t;
--#endif
--
- #ifndef YY_STRUCT_YY_BUFFER_STATE
- #define YY_STRUCT_YY_BUFFER_STATE
- struct yy_buffer_state
-@@ -223,7 +224,7 @@ struct yy_buffer_state
-         /* Number of characters read into yy_ch_buf, not including EOB
-          * characters.
-          */
--        int yy_n_chars;
-+        yy_size_t yy_n_chars;

-         /* Whether we &quot;own&quot; the buffer - i.e., we know we created it,
-          * and can realloc() it to grow it, and should free() it to
-@@ -302,7 +303,7 @@ static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );

- YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
- YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
--YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
-+YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );

- void *ppalloc (yy_size_t ,yyscan_t yyscanner );
- void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner );
</del><span class="cx"> @@ -353,7 +354,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
</span><span class="cx">   */
</span><span class="cx">  #define YY_DO_BEFORE_ACTION \
</span><span class="lines">@@ -59,101 +29,3 @@
</span><span class="cx">          yyg-&gt;yy_hold_char = *yy_cp; \
</span><span class="cx">          *yy_cp = '\0'; \
</span><span class="cx">          yyg-&gt;yy_c_buf_p = yy_cp;
</span><del>-@@ -579,8 +580,8 @@ struct yyguts_t
-     size_t yy_buffer_stack_max; /**&lt; capacity of stack. */
-     YY_BUFFER_STATE * yy_buffer_stack; /**&lt; Stack as an array. */
-     char yy_hold_char;
--    int yy_n_chars;
--    int yyleng_r;
-+    yy_size_t yy_n_chars;
-+    yy_size_t yyleng_r;
-     char *yy_c_buf_p;
-     int yy_init;
-     int yy_start;
-@@ -637,7 +638,7 @@ FILE *ppget_out (yyscan_t yyscanner );

- void ppset_out  (FILE * out_str ,yyscan_t yyscanner );

--int ppget_leng (yyscan_t yyscanner );
-+yy_size_t ppget_leng (yyscan_t yyscanner );

- char *ppget_text (yyscan_t yyscanner );

-@@ -704,7 +705,7 @@ static int input (yyscan_t yyscanner );
-         if ( YY_CURRENT_BUFFER_LVALUE-&gt;yy_is_interactive ) \
-                 { \
-                 int c = '*'; \
--                int n; \
-+                yy_size_t n; \
-                 for ( n = 0; n &lt; max_size &amp;&amp; \
-                              (c = getc( yyin )) != EOF &amp;&amp; c != '\n'; ++n ) \
-                         buf[n] = (char) c; \
-@@ -1338,7 +1339,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-         else
-                 {
--                        int num_to_read =
-+                        yy_size_t num_to_read =
-                         YY_CURRENT_BUFFER_LVALUE-&gt;yy_buf_size - number_to_move - 1;

-                 while ( num_to_read &lt;= 0 )
-@@ -1352,7 +1353,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-                         if ( b-&gt;yy_is_our_buffer )
-                                 {
--                                int new_size = b-&gt;yy_buf_size * 2;
-+                                yy_size_t new_size = b-&gt;yy_buf_size * 2;

-                                 if ( new_size &lt;= 0 )
-                                         b-&gt;yy_buf_size += b-&gt;yy_buf_size / 8;
-@@ -1383,7 +1384,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-                 /* Read in more data. */
-                 YY_INPUT( (&amp;YY_CURRENT_BUFFER_LVALUE-&gt;yy_ch_buf[number_to_move]),
--                        yyg-&gt;yy_n_chars, (size_t) num_to_read );
-+                        yyg-&gt;yy_n_chars, num_to_read );

-                 YY_CURRENT_BUFFER_LVALUE-&gt;yy_n_chars = yyg-&gt;yy_n_chars;
-                 }
-@@ -1508,7 +1509,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-                 else
-                         { /* need more input */
--                        int offset = yyg-&gt;yy_c_buf_p - yyg-&gt;yytext_ptr;
-+                        yy_size_t offset = yyg-&gt;yy_c_buf_p - yyg-&gt;yytext_ptr;
-                         ++yyg-&gt;yy_c_buf_p;

-                         switch ( yy_get_next_buffer( yyscanner ) )
-@@ -1788,7 +1789,7 @@ void pppop_buffer_state (yyscan_t yyscanner)
-  */
- static void ppensure_buffer_stack (yyscan_t yyscanner)
- {
--        int num_to_alloc;
-+        yy_size_t num_to_alloc;
-     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;

-         if (!yyg-&gt;yy_buffer_stack) {
-@@ -1886,12 +1887,11 @@ YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner)
-  * @param yyscanner The scanner object.
-  * @return the newly allocated buffer state object.
-  */
--YY_BUFFER_STATE pp_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
-+YY_BUFFER_STATE pp_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
- {
-         YY_BUFFER_STATE b;
-         char *buf;
--        yy_size_t n;
--        int i;
-+        yy_size_t n, i;
-     
-         /* Get memory for full buffer, including space for trailing EOB's. */
-         n = _yybytes_len + 2;
-@@ -2001,7 +2001,7 @@ FILE *ppget_out  (yyscan_t yyscanner)
- /** Get the length of the current token.
-  * @param yyscanner The scanner object.
-  */
--int ppget_leng  (yyscan_t yyscanner)
-+yy_size_t ppget_leng  (yyscan_t yyscanner)
- {
-     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-     return yyleng;
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorDiagnosticsBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -16,8 +16,8 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Diagnostics::report(ID id,
</span><del>-                         const SourceLocation&amp; loc,
-                         const std::string&amp; text)
</del><ins>+                         const SourceLocation &amp;loc,
+                         const std::string &amp;text)
</ins><span class="cx"> {
</span><span class="cx">     // TODO(alokp): Keep a count of errors and warnings.
</span><span class="cx">     print(id, loc, text);
</span><span class="lines">@@ -41,86 +41,92 @@
</span><span class="cx">     {
</span><span class="cx">       // Errors begin.
</span><span class="cx">       case PP_INTERNAL_ERROR:
</span><del>-          return &quot;internal error&quot;;
</del><ins>+        return &quot;internal error&quot;;
</ins><span class="cx">       case PP_OUT_OF_MEMORY:
</span><del>-          return &quot;out of memory&quot;;
</del><ins>+        return &quot;out of memory&quot;;
</ins><span class="cx">       case PP_INVALID_CHARACTER:
</span><del>-          return &quot;invalid character&quot;;
</del><ins>+        return &quot;invalid character&quot;;
</ins><span class="cx">       case PP_INVALID_NUMBER:
</span><del>-          return &quot;invalid number&quot;;
</del><ins>+        return &quot;invalid number&quot;;
</ins><span class="cx">       case PP_INTEGER_OVERFLOW:
</span><del>-          return &quot;integer overflow&quot;;
</del><ins>+        return &quot;integer overflow&quot;;
</ins><span class="cx">       case PP_FLOAT_OVERFLOW:
</span><del>-          return &quot;float overflow&quot;;
</del><ins>+        return &quot;float overflow&quot;;
</ins><span class="cx">       case PP_TOKEN_TOO_LONG:
</span><del>-          return &quot;token too long&quot;;
</del><ins>+        return &quot;token too long&quot;;
</ins><span class="cx">       case PP_INVALID_EXPRESSION:
</span><del>-          return &quot;invalid expression&quot;;
</del><ins>+        return &quot;invalid expression&quot;;
</ins><span class="cx">       case PP_DIVISION_BY_ZERO:
</span><del>-          return &quot;division by zero&quot;;
</del><ins>+        return &quot;division by zero&quot;;
</ins><span class="cx">       case PP_EOF_IN_COMMENT:
</span><del>-          return &quot;unexpected end of file found in comment&quot;;
</del><ins>+        return &quot;unexpected end of file found in comment&quot;;
</ins><span class="cx">       case PP_UNEXPECTED_TOKEN:
</span><del>-          return &quot;unexpected token&quot;;
</del><ins>+        return &quot;unexpected token&quot;;
</ins><span class="cx">       case PP_DIRECTIVE_INVALID_NAME:
</span><del>-          return &quot;invalid directive name&quot;;
</del><ins>+        return &quot;invalid directive name&quot;;
</ins><span class="cx">       case PP_MACRO_NAME_RESERVED:
</span><del>-          return &quot;macro name is reserved&quot;;
</del><ins>+        return &quot;macro name is reserved&quot;;
</ins><span class="cx">       case PP_MACRO_REDEFINED:
</span><del>-          return &quot;macro redefined&quot;;
</del><ins>+        return &quot;macro redefined&quot;;
</ins><span class="cx">       case PP_MACRO_PREDEFINED_REDEFINED:
</span><del>-          return &quot;predefined macro redefined&quot;;
</del><ins>+        return &quot;predefined macro redefined&quot;;
</ins><span class="cx">       case PP_MACRO_PREDEFINED_UNDEFINED:
</span><del>-          return &quot;predefined macro undefined&quot;;
</del><ins>+        return &quot;predefined macro undefined&quot;;
</ins><span class="cx">       case PP_MACRO_UNTERMINATED_INVOCATION:
</span><del>-          return &quot;unterminated macro invocation&quot;;
</del><ins>+        return &quot;unterminated macro invocation&quot;;
</ins><span class="cx">       case PP_MACRO_TOO_FEW_ARGS:
</span><del>-          return &quot;Not enough arguments for macro&quot;;
</del><ins>+        return &quot;Not enough arguments for macro&quot;;
</ins><span class="cx">       case PP_MACRO_TOO_MANY_ARGS:
</span><del>-          return &quot;Too many arguments for macro&quot;;
</del><ins>+        return &quot;Too many arguments for macro&quot;;
+      case PP_MACRO_DUPLICATE_PARAMETER_NAMES:
+        return &quot;duplicate macro parameter name&quot;;
</ins><span class="cx">       case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
</span><del>-          return &quot;unexpected #endif found without a matching #if&quot;;
</del><ins>+        return &quot;unexpected #endif found without a matching #if&quot;;
</ins><span class="cx">       case PP_CONDITIONAL_ELSE_WITHOUT_IF:
</span><del>-          return &quot;unexpected #else found without a matching #if&quot;;
</del><ins>+        return &quot;unexpected #else found without a matching #if&quot;;
</ins><span class="cx">       case PP_CONDITIONAL_ELSE_AFTER_ELSE:
</span><del>-          return &quot;unexpected #else found after another #else&quot;;
</del><ins>+        return &quot;unexpected #else found after another #else&quot;;
</ins><span class="cx">       case PP_CONDITIONAL_ELIF_WITHOUT_IF:
</span><del>-          return &quot;unexpected #elif found without a matching #if&quot;;
</del><ins>+        return &quot;unexpected #elif found without a matching #if&quot;;
</ins><span class="cx">       case PP_CONDITIONAL_ELIF_AFTER_ELSE:
</span><del>-          return &quot;unexpected #elif found after #else&quot;;
</del><ins>+        return &quot;unexpected #elif found after #else&quot;;
</ins><span class="cx">       case PP_CONDITIONAL_UNTERMINATED:
</span><del>-          return &quot;unexpected end of file found in conditional block&quot;;
</del><ins>+        return &quot;unexpected end of file found in conditional block&quot;;
</ins><span class="cx">       case PP_INVALID_EXTENSION_NAME:
</span><del>-          return &quot;invalid extension name&quot;;
</del><ins>+        return &quot;invalid extension name&quot;;
</ins><span class="cx">       case PP_INVALID_EXTENSION_BEHAVIOR:
</span><del>-          return &quot;invalid extension behavior&quot;;
</del><ins>+        return &quot;invalid extension behavior&quot;;
</ins><span class="cx">       case PP_INVALID_EXTENSION_DIRECTIVE:
</span><del>-          return &quot;invalid extension directive&quot;;
</del><ins>+        return &quot;invalid extension directive&quot;;
</ins><span class="cx">       case PP_INVALID_VERSION_NUMBER:
</span><del>-          return &quot;invalid version number&quot;;
</del><ins>+        return &quot;invalid version number&quot;;
</ins><span class="cx">       case PP_INVALID_VERSION_DIRECTIVE:
</span><del>-          return &quot;invalid version directive&quot;;
</del><ins>+        return &quot;invalid version directive&quot;;
</ins><span class="cx">       case PP_VERSION_NOT_FIRST_STATEMENT:
</span><span class="cx">         return &quot;#version directive must occur before anything else, &quot;
</span><span class="cx">                &quot;except for comments and white space&quot;;
</span><span class="cx">       case PP_INVALID_LINE_NUMBER:
</span><del>-          return &quot;invalid line number&quot;;
</del><ins>+        return &quot;invalid line number&quot;;
</ins><span class="cx">       case PP_INVALID_FILE_NUMBER:
</span><del>-          return &quot;invalid file number&quot;;
</del><ins>+        return &quot;invalid file number&quot;;
</ins><span class="cx">       case PP_INVALID_LINE_DIRECTIVE:
</span><del>-          return &quot;invalid line directive&quot;;
</del><ins>+        return &quot;invalid line directive&quot;;
+      case PP_INVALID_PRAGMA:
+        return &quot;invalid pragma&quot;;
+      case PP_INVALID_PRAGMA_VALUE:
+        return &quot;invalid pragma value, must be 'on' or 'off'&quot;;
</ins><span class="cx">       // Errors end.
</span><span class="cx">       // Warnings begin.
</span><span class="cx">       case PP_EOF_IN_DIRECTIVE:
</span><del>-          return &quot;unexpected end of file found in directive&quot;;
</del><ins>+        return &quot;unexpected end of file found in directive&quot;;
</ins><span class="cx">       case PP_CONDITIONAL_UNEXPECTED_TOKEN:
</span><del>-          return &quot;unexpected token after conditional expression&quot;;
</del><ins>+        return &quot;unexpected token after conditional expression&quot;;
</ins><span class="cx">       case PP_UNRECOGNIZED_PRAGMA:
</span><del>-          return &quot;unrecognized pragma&quot;;
</del><ins>+        return &quot;unrecognized pragma&quot;;
</ins><span class="cx">       // Warnings end.
</span><span class="cx">       default:
</span><del>-          assert(false);
-          return &quot;&quot;;
</del><ins>+        assert(false);
+        return &quot;&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorDiagnosticsBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DiagnosticsBase.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PREPROCESSOR_DIAGNOSTICS_H_
-#define COMPILER_PREPROCESSOR_DIAGNOSTICS_H_
</del><ins>+#ifndef COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
+#define COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;string&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -46,12 +46,14 @@
</span><span class="cx">         PP_MACRO_UNTERMINATED_INVOCATION,
</span><span class="cx">         PP_MACRO_TOO_FEW_ARGS,
</span><span class="cx">         PP_MACRO_TOO_MANY_ARGS,
</span><ins>+        PP_MACRO_DUPLICATE_PARAMETER_NAMES,
</ins><span class="cx">         PP_CONDITIONAL_ENDIF_WITHOUT_IF,
</span><span class="cx">         PP_CONDITIONAL_ELSE_WITHOUT_IF,
</span><span class="cx">         PP_CONDITIONAL_ELSE_AFTER_ELSE,
</span><span class="cx">         PP_CONDITIONAL_ELIF_WITHOUT_IF,
</span><span class="cx">         PP_CONDITIONAL_ELIF_AFTER_ELSE,
</span><span class="cx">         PP_CONDITIONAL_UNTERMINATED,
</span><ins>+        PP_CONDITIONAL_UNEXPECTED_TOKEN,
</ins><span class="cx">         PP_INVALID_EXTENSION_NAME,
</span><span class="cx">         PP_INVALID_EXTENSION_BEHAVIOR,
</span><span class="cx">         PP_INVALID_EXTENSION_DIRECTIVE,
</span><span class="lines">@@ -61,27 +63,29 @@
</span><span class="cx">         PP_INVALID_LINE_NUMBER,
</span><span class="cx">         PP_INVALID_FILE_NUMBER,
</span><span class="cx">         PP_INVALID_LINE_DIRECTIVE,
</span><ins>+        PP_INVALID_PRAGMA,
+        PP_INVALID_PRAGMA_VALUE,
</ins><span class="cx">         PP_ERROR_END,
</span><span class="cx"> 
</span><span class="cx">         PP_WARNING_BEGIN,
</span><span class="cx">         PP_EOF_IN_DIRECTIVE,
</span><del>-        PP_CONDITIONAL_UNEXPECTED_TOKEN,
</del><span class="cx">         PP_UNRECOGNIZED_PRAGMA,
</span><span class="cx">         PP_WARNING_END
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     virtual ~Diagnostics();
</span><span class="cx"> 
</span><del>-    void report(ID id, const SourceLocation&amp; loc, const std::string&amp; text);
</del><ins>+    void report(ID id, const SourceLocation &amp;loc, const std::string &amp;text);
</ins><span class="cx"> 
</span><span class="cx">   protected:
</span><span class="cx">     Severity severity(ID id);
</span><span class="cx">     std::string message(ID id);
</span><span class="cx"> 
</span><span class="cx">     virtual void print(ID id,
</span><del>-                       const SourceLocation&amp; loc,
-                       const std::string&amp; text) = 0;
</del><ins>+                       const SourceLocation &amp;loc,
+                       const std::string &amp;text) = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><del>-#endif  // COMPILER_PREPROCESSOR_DIAGNOSTICS_H_
</del><ins>+
+#endif  // COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveHandlerBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveHandlerBase.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PREPROCESSOR_DIRECTIVE_HANDLER_H_
-#define COMPILER_PREPROCESSOR_DIRECTIVE_HANDLER_H_
</del><ins>+#ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
+#define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;string&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -23,21 +23,23 @@
</span><span class="cx">   public:
</span><span class="cx">     virtual ~DirectiveHandler();
</span><span class="cx"> 
</span><del>-    virtual void handleError(const SourceLocation&amp; loc,
-                             const std::string&amp; msg) = 0;
</del><ins>+    virtual void handleError(const SourceLocation &amp;loc,
+                             const std::string &amp;msg) = 0;
</ins><span class="cx"> 
</span><span class="cx">     // Handle pragma of form: #pragma name[(value)]
</span><del>-    virtual void handlePragma(const SourceLocation&amp; loc,
-                              const std::string&amp; name,
-                              const std::string&amp; value) = 0;
</del><ins>+    virtual void handlePragma(const SourceLocation &amp;loc,
+                              const std::string &amp;name,
+                              const std::string &amp;value,
+                              bool stdgl) = 0;
</ins><span class="cx"> 
</span><del>-    virtual void handleExtension(const SourceLocation&amp; loc,
-                                 const std::string&amp; name,
-                                 const std::string&amp; behavior) = 0;
</del><ins>+    virtual void handleExtension(const SourceLocation &amp;loc,
+                                 const std::string &amp;name,
+                                 const std::string &amp;behavior) = 0;
</ins><span class="cx"> 
</span><del>-    virtual void handleVersion(const SourceLocation&amp; loc,
</del><ins>+    virtual void handleVersion(const SourceLocation &amp;loc,
</ins><span class="cx">                                int version) = 0;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><del>-#endif  // COMPILER_PREPROCESSOR_DIRECTIVE_HANDLER_H_
</del><ins>+
+#endif  // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DirectiveParser.h&quot;
</span><span class="cx"> 
</span><ins>+#include &lt;algorithm&gt;
</ins><span class="cx"> #include &lt;cassert&gt;
</span><span class="cx"> #include &lt;cstdlib&gt;
</span><span class="cx"> #include &lt;sstream&gt;
</span><span class="lines">@@ -35,58 +36,57 @@
</span><span class="cx">     DIRECTIVE_VERSION,
</span><span class="cx">     DIRECTIVE_LINE
</span><span class="cx"> };
</span><del>-}  // namespace
</del><span class="cx"> 
</span><del>-static DirectiveType getDirective(const pp::Token* token)
</del><ins>+DirectiveType getDirective(const pp::Token *token)
</ins><span class="cx"> {
</span><del>-    static const std::string kDirectiveDefine(&quot;define&quot;);
-    static const std::string kDirectiveUndef(&quot;undef&quot;);
-    static const std::string kDirectiveIf(&quot;if&quot;);
-    static const std::string kDirectiveIfdef(&quot;ifdef&quot;);
-    static const std::string kDirectiveIfndef(&quot;ifndef&quot;);
-    static const std::string kDirectiveElse(&quot;else&quot;);
-    static const std::string kDirectiveElif(&quot;elif&quot;);
-    static const std::string kDirectiveEndif(&quot;endif&quot;);
-    static const std::string kDirectiveError(&quot;error&quot;);
-    static const std::string kDirectivePragma(&quot;pragma&quot;);
-    static const std::string kDirectiveExtension(&quot;extension&quot;);
-    static const std::string kDirectiveVersion(&quot;version&quot;);
-    static const std::string kDirectiveLine(&quot;line&quot;);
</del><ins>+    const char kDirectiveDefine[] = &quot;define&quot;;
+    const char kDirectiveUndef[] = &quot;undef&quot;;
+    const char kDirectiveIf[] = &quot;if&quot;;
+    const char kDirectiveIfdef[] = &quot;ifdef&quot;;
+    const char kDirectiveIfndef[] = &quot;ifndef&quot;;
+    const char kDirectiveElse[] = &quot;else&quot;;
+    const char kDirectiveElif[] = &quot;elif&quot;;
+    const char kDirectiveEndif[] = &quot;endif&quot;;
+    const char kDirectiveError[] = &quot;error&quot;;
+    const char kDirectivePragma[] = &quot;pragma&quot;;
+    const char kDirectiveExtension[] = &quot;extension&quot;;
+    const char kDirectiveVersion[] = &quot;version&quot;;
+    const char kDirectiveLine[] = &quot;line&quot;;
</ins><span class="cx"> 
</span><span class="cx">     if (token-&gt;type != pp::Token::IDENTIFIER)
</span><span class="cx">         return DIRECTIVE_NONE;
</span><span class="cx"> 
</span><span class="cx">     if (token-&gt;text == kDirectiveDefine)
</span><span class="cx">         return DIRECTIVE_DEFINE;
</span><del>-    else if (token-&gt;text == kDirectiveUndef)
</del><ins>+    if (token-&gt;text == kDirectiveUndef)
</ins><span class="cx">         return DIRECTIVE_UNDEF;
</span><del>-    else if (token-&gt;text == kDirectiveIf)
</del><ins>+    if (token-&gt;text == kDirectiveIf)
</ins><span class="cx">         return DIRECTIVE_IF;
</span><del>-    else if (token-&gt;text == kDirectiveIfdef)
</del><ins>+    if (token-&gt;text == kDirectiveIfdef)
</ins><span class="cx">         return DIRECTIVE_IFDEF;
</span><del>-    else if (token-&gt;text == kDirectiveIfndef)
</del><ins>+    if (token-&gt;text == kDirectiveIfndef)
</ins><span class="cx">         return DIRECTIVE_IFNDEF;
</span><del>-    else if (token-&gt;text == kDirectiveElse)
</del><ins>+    if (token-&gt;text == kDirectiveElse)
</ins><span class="cx">         return DIRECTIVE_ELSE;
</span><del>-    else if (token-&gt;text == kDirectiveElif)
</del><ins>+    if (token-&gt;text == kDirectiveElif)
</ins><span class="cx">         return DIRECTIVE_ELIF;
</span><del>-    else if (token-&gt;text == kDirectiveEndif)
</del><ins>+    if (token-&gt;text == kDirectiveEndif)
</ins><span class="cx">         return DIRECTIVE_ENDIF;
</span><del>-    else if (token-&gt;text == kDirectiveError)
</del><ins>+    if (token-&gt;text == kDirectiveError)
</ins><span class="cx">         return DIRECTIVE_ERROR;
</span><del>-    else if (token-&gt;text == kDirectivePragma)
</del><ins>+    if (token-&gt;text == kDirectivePragma)
</ins><span class="cx">         return DIRECTIVE_PRAGMA;
</span><del>-    else if (token-&gt;text == kDirectiveExtension)
</del><ins>+    if (token-&gt;text == kDirectiveExtension)
</ins><span class="cx">         return DIRECTIVE_EXTENSION;
</span><del>-    else if (token-&gt;text == kDirectiveVersion)
</del><ins>+    if (token-&gt;text == kDirectiveVersion)
</ins><span class="cx">         return DIRECTIVE_VERSION;
</span><del>-    else if (token-&gt;text == kDirectiveLine)
</del><ins>+    if (token-&gt;text == kDirectiveLine)
</ins><span class="cx">         return DIRECTIVE_LINE;
</span><span class="cx"> 
</span><span class="cx">     return DIRECTIVE_NONE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isConditionalDirective(DirectiveType directive)
</del><ins>+bool isConditionalDirective(DirectiveType directive)
</ins><span class="cx"> {
</span><span class="cx">     switch (directive)
</span><span class="cx">     {
</span><span class="lines">@@ -103,12 +103,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Returns true if the token represents End Of Directive.
</span><del>-static bool isEOD(const pp::Token* token)
</del><ins>+bool isEOD(const pp::Token *token)
</ins><span class="cx"> {
</span><span class="cx">     return (token-&gt;type == '\n') || (token-&gt;type == pp::Token::LAST);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void skipUntilEOD(pp::Lexer* lexer, pp::Token* token)
</del><ins>+void skipUntilEOD(pp::Lexer *lexer, pp::Token *token)
</ins><span class="cx"> {
</span><span class="cx">     while(!isEOD(token))
</span><span class="cx">     {
</span><span class="lines">@@ -116,7 +116,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isMacroNameReserved(const std::string&amp; name)
</del><ins>+bool isMacroNameReserved(const std::string &amp;name)
</ins><span class="cx"> {
</span><span class="cx">     // Names prefixed with &quot;GL_&quot; are reserved.
</span><span class="cx">     if (name.substr(0, 3) == &quot;GL_&quot;)
</span><span class="lines">@@ -129,32 +129,34 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isMacroPredefined(const std::string&amp; name,
-                              const pp::MacroSet&amp; macroSet)
</del><ins>+bool isMacroPredefined(const std::string &amp;name,
+                       const pp::MacroSet &amp;macroSet)
</ins><span class="cx"> {
</span><span class="cx">     pp::MacroSet::const_iterator iter = macroSet.find(name);
</span><span class="cx">     return iter != macroSet.end() ? iter-&gt;second.predefined : false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}  // namespace anonymous
+
</ins><span class="cx"> namespace pp
</span><span class="cx"> {
</span><span class="cx"> 
</span><span class="cx"> class DefinedParser : public Lexer
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    DefinedParser(Lexer* lexer,
-                  const MacroSet* macroSet,
-                  Diagnostics* diagnostics) :
-        mLexer(lexer),
-        mMacroSet(macroSet),
-        mDiagnostics(diagnostics)
</del><ins>+    DefinedParser(Lexer *lexer,
+                  const MacroSet *macroSet,
+                  Diagnostics *diagnostics)
+        : mLexer(lexer),
+          mMacroSet(macroSet),
+          mDiagnostics(diagnostics)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   protected:
</span><del>-    virtual void lex(Token* token)
</del><ins>+    virtual void lex(Token *token)
</ins><span class="cx">     {
</span><del>-        static const std::string kDefined(&quot;defined&quot;);
</del><ins>+        const char kDefined[] = &quot;defined&quot;;
</ins><span class="cx"> 
</span><span class="cx">         mLexer-&gt;lex(token);
</span><span class="cx">         if (token-&gt;type != Token::IDENTIFIER)
</span><span class="lines">@@ -199,24 +201,24 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   private:
</span><del>-    Lexer* mLexer;
-    const MacroSet* mMacroSet;
-    Diagnostics* mDiagnostics;
</del><ins>+    Lexer *mLexer;
+    const MacroSet *mMacroSet;
+    Diagnostics *mDiagnostics;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-DirectiveParser::DirectiveParser(Tokenizer* tokenizer,
-                                 MacroSet* macroSet,
-                                 Diagnostics* diagnostics,
-                                 DirectiveHandler* directiveHandler) :
-    mPastFirstStatement(false),
-    mTokenizer(tokenizer),
-    mMacroSet(macroSet),
-    mDiagnostics(diagnostics),
-    mDirectiveHandler(directiveHandler)
</del><ins>+DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
+                                 MacroSet *macroSet,
+                                 Diagnostics *diagnostics,
+                                 DirectiveHandler *directiveHandler)
+    : mPastFirstStatement(false),
+      mTokenizer(tokenizer),
+      mMacroSet(macroSet),
+      mDiagnostics(diagnostics),
+      mDirectiveHandler(directiveHandler)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::lex(Token* token)
</del><ins>+void DirectiveParser::lex(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     do
</span><span class="cx">     {
</span><span class="lines">@@ -232,19 +234,20 @@
</span><span class="cx">         {
</span><span class="cx">             if (!mConditionalStack.empty())
</span><span class="cx">             {
</span><del>-                const ConditionalBlock&amp; block = mConditionalStack.back();
</del><ins>+                const ConditionalBlock &amp;block = mConditionalStack.back();
</ins><span class="cx">                 mDiagnostics-&gt;report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
</span><span class="cx">                                      block.location, block.type);
</span><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-    } while (skipping() || (token-&gt;type == '\n'));
</del><ins>+    }
+    while (skipping() || (token-&gt;type == '\n'));
</ins><span class="cx"> 
</span><span class="cx">     mPastFirstStatement = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseDirective(Token* token)
</del><ins>+void DirectiveParser::parseDirective(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(token-&gt;type == Token::PP_HASH);
</span><span class="cx"> 
</span><span class="lines">@@ -324,7 +327,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseDefine(Token* token)
</del><ins>+void DirectiveParser::parseDefine(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_DEFINE);
</span><span class="cx"> 
</span><span class="lines">@@ -357,14 +360,24 @@
</span><span class="cx">     {
</span><span class="cx">         // Function-like macro. Collect arguments.
</span><span class="cx">         macro.type = Macro::kTypeFunc;
</span><del>-        do {
</del><ins>+        do
+        {
</ins><span class="cx">             mTokenizer-&gt;lex(token);
</span><span class="cx">             if (token-&gt;type != Token::IDENTIFIER)
</span><span class="cx">                 break;
</span><ins>+
+            if (std::find(macro.parameters.begin(), macro.parameters.end(), token-&gt;text) != macro.parameters.end())
+            {
+                mDiagnostics-&gt;report(Diagnostics::PP_MACRO_DUPLICATE_PARAMETER_NAMES,
+                                     token-&gt;location, token-&gt;text);
+                return;
+            }
+
</ins><span class="cx">             macro.parameters.push_back(token-&gt;text);
</span><span class="cx"> 
</span><span class="cx">             mTokenizer-&gt;lex(token);  // Get ','.
</span><del>-        } while (token-&gt;type == ',');
</del><ins>+        }
+        while (token-&gt;type == ',');
</ins><span class="cx"> 
</span><span class="cx">         if (token-&gt;type != ')')
</span><span class="cx">         {
</span><span class="lines">@@ -404,7 +417,7 @@
</span><span class="cx">     mMacroSet-&gt;insert(std::make_pair(macro.name, macro));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseUndef(Token* token)
</del><ins>+void DirectiveParser::parseUndef(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_UNDEF);
</span><span class="cx"> 
</span><span class="lines">@@ -431,27 +444,33 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     mTokenizer-&gt;lex(token);
</span><ins>+    if (!isEOD(token))
+    {
+        mDiagnostics-&gt;report(Diagnostics::PP_UNEXPECTED_TOKEN,
+                             token-&gt;location, token-&gt;text);
+        skipUntilEOD(mTokenizer, token);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseIf(Token* token)
</del><ins>+void DirectiveParser::parseIf(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_IF);
</span><span class="cx">     parseConditionalIf(token);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseIfdef(Token* token)
</del><ins>+void DirectiveParser::parseIfdef(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_IFDEF);
</span><span class="cx">     parseConditionalIf(token);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseIfndef(Token* token)
</del><ins>+void DirectiveParser::parseIfndef(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_IFNDEF);
</span><span class="cx">     parseConditionalIf(token);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseElse(Token* token)
</del><ins>+void DirectiveParser::parseElse(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_ELSE);
</span><span class="cx"> 
</span><span class="lines">@@ -463,7 +482,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConditionalBlock&amp; block = mConditionalStack.back();
</del><ins>+    ConditionalBlock &amp;block = mConditionalStack.back();
</ins><span class="cx">     if (block.skipBlock)
</span><span class="cx">     {
</span><span class="cx">         // No diagnostics. Just skip the whole line.
</span><span class="lines">@@ -482,7 +501,7 @@
</span><span class="cx">     block.skipGroup = block.foundValidGroup;
</span><span class="cx">     block.foundValidGroup = true;
</span><span class="cx"> 
</span><del>-    // Warn if there are extra tokens after #else.
</del><ins>+    // Check if there are extra tokens after #else.
</ins><span class="cx">     mTokenizer-&gt;lex(token);
</span><span class="cx">     if (!isEOD(token))
</span><span class="cx">     {
</span><span class="lines">@@ -492,7 +511,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseElif(Token* token)
</del><ins>+void DirectiveParser::parseElif(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_ELIF);
</span><span class="cx"> 
</span><span class="lines">@@ -504,7 +523,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConditionalBlock&amp; block = mConditionalStack.back();
</del><ins>+    ConditionalBlock &amp;block = mConditionalStack.back();
</ins><span class="cx">     if (block.skipBlock)
</span><span class="cx">     {
</span><span class="cx">         // No diagnostics. Just skip the whole line.
</span><span class="lines">@@ -532,7 +551,7 @@
</span><span class="cx">     block.foundValidGroup = expression != 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseEndif(Token* token)
</del><ins>+void DirectiveParser::parseEndif(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_ENDIF);
</span><span class="cx"> 
</span><span class="lines">@@ -546,7 +565,7 @@
</span><span class="cx"> 
</span><span class="cx">     mConditionalStack.pop_back();
</span><span class="cx"> 
</span><del>-    // Warn if there are tokens after #endif.
</del><ins>+    // Check if there are tokens after #endif.
</ins><span class="cx">     mTokenizer-&gt;lex(token);
</span><span class="cx">     if (!isEOD(token))
</span><span class="cx">     {
</span><span class="lines">@@ -556,7 +575,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseError(Token* token)
</del><ins>+void DirectiveParser::parseError(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_ERROR);
</span><span class="cx"> 
</span><span class="lines">@@ -571,7 +590,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Parses pragma of form: #pragma name[(value)].
</span><del>-void DirectiveParser::parsePragma(Token* token)
</del><ins>+void DirectiveParser::parsePragma(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_PRAGMA);
</span><span class="cx"> 
</span><span class="lines">@@ -588,6 +607,11 @@
</span><span class="cx">     int state = PRAGMA_NAME;
</span><span class="cx"> 
</span><span class="cx">     mTokenizer-&gt;lex(token);
</span><ins>+    bool stdgl = token-&gt;text == &quot;STDGL&quot;;
+    if (stdgl)
+    {
+        mTokenizer-&gt;lex(token);
+    }
</ins><span class="cx">     while ((token-&gt;type != '\n') &amp;&amp; (token-&gt;type != Token::LAST))
</span><span class="cx">     {
</span><span class="cx">         switch(state++)
</span><span class="lines">@@ -601,7 +625,8 @@
</span><span class="cx">             break;
</span><span class="cx">           case PRAGMA_VALUE:
</span><span class="cx">             value = token-&gt;text;
</span><del>-            valid = valid &amp;&amp; (token-&gt;type == Token::IDENTIFIER);
</del><ins>+            // Pragma value validation is handled in DirectiveHandler::handlePragma
+            // because the proper pragma value is dependent on the pragma name.
</ins><span class="cx">             break;
</span><span class="cx">           case RIGHT_PAREN:
</span><span class="cx">             valid = valid &amp;&amp; (token-&gt;type == ')');
</span><span class="lines">@@ -618,16 +643,16 @@
</span><span class="cx">                       (state == RIGHT_PAREN + 1));  // With value.
</span><span class="cx">     if (!valid)
</span><span class="cx">     {
</span><del>-        mDiagnostics-&gt;report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
</del><ins>+        mDiagnostics-&gt;report(Diagnostics::PP_INVALID_PRAGMA,
</ins><span class="cx">                              token-&gt;location, name);
</span><span class="cx">     }
</span><span class="cx">     else if (state &gt; PRAGMA_NAME)  // Do not notify for empty pragma.
</span><span class="cx">     {
</span><del>-        mDirectiveHandler-&gt;handlePragma(token-&gt;location, name, value);
</del><ins>+        mDirectiveHandler-&gt;handlePragma(token-&gt;location, name, value, stdgl);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseExtension(Token* token)
</del><ins>+void DirectiveParser::parseExtension(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_EXTENSION);
</span><span class="cx"> 
</span><span class="lines">@@ -694,7 +719,7 @@
</span><span class="cx">         mDirectiveHandler-&gt;handleExtension(token-&gt;location, name, behavior);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseVersion(Token* token)
</del><ins>+void DirectiveParser::parseVersion(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_VERSION);
</span><span class="cx"> 
</span><span class="lines">@@ -772,7 +797,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseLine(Token* token)
</del><ins>+void DirectiveParser::parseLine(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert(getDirective(token) == DIRECTIVE_LINE);
</span><span class="cx"> 
</span><span class="lines">@@ -841,19 +866,21 @@
</span><span class="cx">     if (valid)
</span><span class="cx">     {
</span><span class="cx">         mTokenizer-&gt;setLineNumber(line);
</span><del>-        if (state == FILE_NUMBER + 1) mTokenizer-&gt;setFileNumber(file);
</del><ins>+        if (state == FILE_NUMBER + 1)
+            mTokenizer-&gt;setFileNumber(file);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool DirectiveParser::skipping() const
</span><span class="cx"> {
</span><del>-    if (mConditionalStack.empty()) return false;
</del><ins>+    if (mConditionalStack.empty())
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     const ConditionalBlock&amp; block = mConditionalStack.back();
</span><span class="cx">     return block.skipBlock || block.skipGroup;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DirectiveParser::parseConditionalIf(Token* token)
</del><ins>+void DirectiveParser::parseConditionalIf(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     ConditionalBlock block;
</span><span class="cx">     block.type = token-&gt;text;
</span><span class="lines">@@ -894,7 +921,7 @@
</span><span class="cx">     mConditionalStack.push_back(block);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int DirectiveParser::parseExpressionIf(Token* token)
</del><ins>+int DirectiveParser::parseExpressionIf(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert((getDirective(token) == DIRECTIVE_IF) ||
</span><span class="cx">            (getDirective(token) == DIRECTIVE_ELIF));
</span><span class="lines">@@ -907,7 +934,7 @@
</span><span class="cx">     macroExpander.lex(token);
</span><span class="cx">     expressionParser.parse(token, &amp;expression);
</span><span class="cx"> 
</span><del>-    // Warn if there are tokens after #if expression.
</del><ins>+    // Check if there are tokens after #if expression.
</ins><span class="cx">     if (!isEOD(token))
</span><span class="cx">     {
</span><span class="cx">         mDiagnostics-&gt;report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
</span><span class="lines">@@ -918,7 +945,7 @@
</span><span class="cx">     return expression;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int DirectiveParser::parseExpressionIfdef(Token* token)
</del><ins>+int DirectiveParser::parseExpressionIfdef(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     assert((getDirective(token) == DIRECTIVE_IFDEF) ||
</span><span class="cx">            (getDirective(token) == DIRECTIVE_IFNDEF));
</span><span class="lines">@@ -935,7 +962,7 @@
</span><span class="cx">     MacroSet::const_iterator iter = mMacroSet-&gt;find(token-&gt;text);
</span><span class="cx">     int expression = iter != mMacroSet-&gt;end() ? 1 : 0;
</span><span class="cx"> 
</span><del>-    // Warn if there are tokens after #ifdef expression.
</del><ins>+    // Check if there are tokens after #ifdef expression.
</ins><span class="cx">     mTokenizer-&gt;lex(token);
</span><span class="cx">     if (!isEOD(token))
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorDirectiveParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/DirectiveParser.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_
-#define COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_
</del><ins>+#ifndef COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
+#define COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;Lexer.h&quot;
</span><span class="cx"> #include &quot;Macro.h&quot;
</span><span class="lines">@@ -22,35 +22,35 @@
</span><span class="cx"> class DirectiveParser : public Lexer
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    DirectiveParser(Tokenizer* tokenizer,
-                    MacroSet* macroSet,
-                    Diagnostics* diagnostics,
-                    DirectiveHandler* directiveHandler);
</del><ins>+    DirectiveParser(Tokenizer *tokenizer,
+                    MacroSet *macroSet,
+                    Diagnostics *diagnostics,
+                    DirectiveHandler *directiveHandler);
</ins><span class="cx"> 
</span><del>-    virtual void lex(Token* token);
</del><ins>+    virtual void lex(Token *token);
</ins><span class="cx"> 
</span><span class="cx">   private:
</span><span class="cx">     PP_DISALLOW_COPY_AND_ASSIGN(DirectiveParser);
</span><span class="cx"> 
</span><del>-    void parseDirective(Token* token);
-    void parseDefine(Token* token);
-    void parseUndef(Token* token);
-    void parseIf(Token* token);
-    void parseIfdef(Token* token);
-    void parseIfndef(Token* token);
-    void parseElse(Token* token);
-    void parseElif(Token* token);
-    void parseEndif(Token* token);
-    void parseError(Token* token);
-    void parsePragma(Token* token);
-    void parseExtension(Token* token);
-    void parseVersion(Token* token);
-    void parseLine(Token* token);
</del><ins>+    void parseDirective(Token *token);
+    void parseDefine(Token *token);
+    void parseUndef(Token *token);
+    void parseIf(Token *token);
+    void parseIfdef(Token *token);
+    void parseIfndef(Token *token);
+    void parseElse(Token *token);
+    void parseElif(Token *token);
+    void parseEndif(Token *token);
+    void parseError(Token *token);
+    void parsePragma(Token *token);
+    void parseExtension(Token *token);
+    void parseVersion(Token *token);
+    void parseLine(Token *token);
</ins><span class="cx"> 
</span><span class="cx">     bool skipping() const;
</span><del>-    void parseConditionalIf(Token* token);
-    int parseExpressionIf(Token* token);
-    int parseExpressionIfdef(Token* token);
</del><ins>+    void parseConditionalIf(Token *token);
+    int parseExpressionIf(Token *token);
+    int parseExpressionIfdef(Token *token);
</ins><span class="cx"> 
</span><span class="cx">     struct ConditionalBlock
</span><span class="cx">     {
</span><span class="lines">@@ -61,22 +61,22 @@
</span><span class="cx">         bool foundValidGroup;
</span><span class="cx">         bool foundElseGroup;
</span><span class="cx"> 
</span><del>-        ConditionalBlock() :
-            skipBlock(false),
-            skipGroup(false),
-            foundValidGroup(false),
-            foundElseGroup(false)
</del><ins>+        ConditionalBlock()
+            : skipBlock(false),
+              skipGroup(false),
+              foundValidGroup(false),
+              foundElseGroup(false)
</ins><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx">     };
</span><span class="cx">     bool mPastFirstStatement;
</span><span class="cx">     std::vector&lt;ConditionalBlock&gt; mConditionalStack;
</span><del>-    Tokenizer* mTokenizer;
-    MacroSet* mMacroSet;
-    Diagnostics* mDiagnostics;
-    DirectiveHandler* mDirectiveHandler;
</del><ins>+    Tokenizer *mTokenizer;
+    MacroSet *mMacroSet;
+    Diagnostics *mDiagnostics;
+    DirectiveHandler *mDirectiveHandler;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><del>-#endif  // COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_
</del><span class="cx"> 
</span><ins>+#endif  // COMPILER_PREPROCESSOR_DIRECTIVEPARSER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,21 +1,21 @@
</span><del>-/* A Bison parser, made by GNU Bison 2.7.1.  */
</del><ins>+/* A Bison parser, made by GNU Bison 3.0.4.  */
</ins><span class="cx"> 
</span><del>-/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */
</del><ins>+/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */ 
</ins><span class="cx"> 
</span><span class="cx"> /* Bison implementation for Yacc-like parsers in C
</span><del>-   
-      Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-   
</del><ins>+
+   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
</ins><span class="cx">    This program is free software: you can redistribute it and/or modify
</span><span class="cx">    it under the terms of the GNU General Public License as published by
</span><span class="cx">    the Free Software Foundation, either version 3 of the License, or
</span><span class="cx">    (at your option) any later version.
</span><del>-   
</del><ins>+
</ins><span class="cx">    This program is distributed in the hope that it will be useful,
</span><span class="cx">    but WITHOUT ANY WARRANTY; without even the implied warranty of
</span><span class="cx">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
</span><span class="cx">    GNU General Public License for more details.
</span><del>-   
</del><ins>+
</ins><span class="cx">    You should have received a copy of the GNU General Public License
</span><span class="cx">    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.  */
</span><span class="cx"> 
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">    special exception, which will cause the skeleton and the resulting
</span><span class="cx">    Bison output files to be licensed under the GNU General Public
</span><span class="cx">    License without this special exception.
</span><del>-   
</del><ins>+
</ins><span class="cx">    This special exception was added by the Free Software Foundation in
</span><span class="cx">    version 2.2 of Bison.  */
</span><span class="cx"> 
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> #define YYBISON 1
</span><span class="cx"> 
</span><span class="cx"> /* Bison version.  */
</span><del>-#define YYBISON_VERSION &quot;2.7.1&quot;
</del><ins>+#define YYBISON_VERSION &quot;3.0.4&quot;
</ins><span class="cx"> 
</span><span class="cx"> /* Skeleton name.  */
</span><span class="cx"> #define YYSKELETON_NAME &quot;yacc.c&quot;
</span><span class="lines">@@ -65,11 +65,10 @@
</span><span class="cx"> #define yyparse         ppparse
</span><span class="cx"> #define yylex           pplex
</span><span class="cx"> #define yyerror         pperror
</span><del>-#define yylval          pplval
-#define yychar          ppchar
</del><span class="cx"> #define yydebug         ppdebug
</span><span class="cx"> #define yynerrs         ppnerrs
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> /* Copy the first part of user declarations.  */
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +88,7 @@
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wuninitialized&quot;
</span><span class="cx"> #endif
</span><span class="cx"> #elif defined(_MSC_VER)
</span><del>-#pragma warning(disable: 4065 4701)
</del><ins>+#pragma warning(disable: 4065 4244 4701 4702)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ExpressionParser.h&quot;
</span><span class="lines">@@ -134,11 +133,11 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-# ifndef YY_NULL
</del><ins>+# ifndef YY_NULLPTR
</ins><span class="cx"> #  if defined __cplusplus &amp;&amp; 201103L &lt;= __cplusplus
</span><del>-#   define YY_NULL nullptr
</del><ins>+#   define YY_NULLPTR nullptr
</ins><span class="cx"> #  else
</span><del>-#   define YY_NULL 0
</del><ins>+#   define YY_NULLPTR 0
</ins><span class="cx"> #  endif
</span><span class="cx"> # endif
</span><span class="cx"> 
</span><span class="lines">@@ -151,7 +150,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-/* Enabling traces.  */
</del><ins>+/* Debug traces.  */
</ins><span class="cx"> #ifndef YYDEBUG
</span><span class="cx"> # define YYDEBUG 0
</span><span class="cx"> #endif
</span><span class="lines">@@ -159,47 +158,34 @@
</span><span class="cx"> extern int ppdebug;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-/* Tokens.  */
</del><ins>+/* Token type.  */
</ins><span class="cx"> #ifndef YYTOKENTYPE
</span><span class="cx"> # define YYTOKENTYPE
</span><del>-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     TOK_CONST_INT = 258,
-     TOK_OP_OR = 259,
-     TOK_OP_AND = 260,
-     TOK_OP_NE = 261,
-     TOK_OP_EQ = 262,
-     TOK_OP_GE = 263,
-     TOK_OP_LE = 264,
-     TOK_OP_RIGHT = 265,
-     TOK_OP_LEFT = 266,
-     TOK_UNARY = 267
-   };
</del><ins>+  enum yytokentype
+  {
+    TOK_CONST_INT = 258,
+    TOK_OP_OR = 259,
+    TOK_OP_AND = 260,
+    TOK_OP_EQ = 261,
+    TOK_OP_NE = 262,
+    TOK_OP_LE = 263,
+    TOK_OP_GE = 264,
+    TOK_OP_LEFT = 265,
+    TOK_OP_RIGHT = 266,
+    TOK_UNARY = 267
+  };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-
</del><ins>+/* Value type.  */
</ins><span class="cx"> #if ! defined YYSTYPE &amp;&amp; ! defined YYSTYPE_IS_DECLARED
</span><span class="cx"> typedef int YYSTYPE;
</span><span class="cx"> # define YYSTYPE_IS_TRIVIAL 1
</span><del>-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
</del><span class="cx"> # define YYSTYPE_IS_DECLARED 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int ppparse (void *YYPARSE_PARAM);
-#else
-int ppparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
</del><ins>+
</ins><span class="cx"> int ppparse (Context *context);
</span><del>-#else
-int ppparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
</del><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -219,11 +205,8 @@
</span><span class="cx"> 
</span><span class="cx"> #ifdef YYTYPE_INT8
</span><span class="cx"> typedef YYTYPE_INT8 yytype_int8;
</span><del>-#elif (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
</del><span class="cx"> #else
</span><del>-typedef short int yytype_int8;
</del><ins>+typedef signed char yytype_int8;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #ifdef YYTYPE_UINT16
</span><span class="lines">@@ -243,8 +226,7 @@
</span><span class="cx"> #  define YYSIZE_T __SIZE_TYPE__
</span><span class="cx"> # elif defined size_t
</span><span class="cx"> #  define YYSIZE_T size_t
</span><del>-# elif ! defined YYSIZE_T &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+# elif ! defined YYSIZE_T
</ins><span class="cx"> #  include &lt;stddef.h&gt; /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #  define YYSIZE_T size_t
</span><span class="cx"> # else
</span><span class="lines">@@ -266,14 +248,33 @@
</span><span class="cx"> # endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if (! defined __GNUC__ || __GNUC__ &lt; 2 \
-      || (__GNUC__ == 2 &amp;&amp; __GNUC_MINOR__ &lt; 5))
-#  define __attribute__(Spec) /* empty */
</del><ins>+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__                                               \
+      &amp;&amp; (2 &lt; __GNUC__ || (__GNUC__ == 2 &amp;&amp; 96 &lt;= __GNUC_MINOR__)))  \
+     || defined __SUNPRO_C &amp;&amp; 0x5110 &lt;= __SUNPRO_C
+#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+#  define YY_ATTRIBUTE(Spec) /* empty */
</ins><span class="cx"> # endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+     &amp;&amp; (!defined __STDC_VERSION__ || __STDC_VERSION__ &lt; 201112)
+# if defined _MSC_VER &amp;&amp; 1200 &lt;= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
</ins><span class="cx"> /* Suppress unused-variable warnings by &quot;using&quot; E.  */
</span><span class="cx"> #if ! defined lint || defined __GNUC__
</span><span class="cx"> # define YYUSE(E) ((void) (E))
</span><span class="lines">@@ -281,25 +282,26 @@
</span><span class="cx"> # define YYUSE(E) /* empty */
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-
-/* Identity function, used to suppress warnings about constant conditions.  */
-#ifndef lint
-# define YYID(N) (N)
</del><ins>+#if defined __GNUC__ &amp;&amp; 407 &lt;= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma (&quot;GCC diagnostic push&quot;) \
+    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wuninitialized\&quot;&quot;)\
+    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wmaybe-uninitialized\&quot;&quot;)
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma (&quot;GCC diagnostic pop&quot;)
</ins><span class="cx"> #else
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
-    int yyi;
</del><ins>+# define YY_INITIAL_VALUE(Value) Value
</ins><span class="cx"> #endif
</span><del>-{
-  return yyi;
-}
</del><ins>+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
</ins><span class="cx"> #endif
</span><ins>+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> #if ! defined yyoverflow || YYERROR_VERBOSE
</span><span class="cx"> 
</span><span class="cx"> /* The parser invokes alloca or malloc; define the necessary symbols.  */
</span><span class="lines">@@ -317,8 +319,7 @@
</span><span class="cx"> #    define alloca _alloca
</span><span class="cx"> #   else
</span><span class="cx"> #    define YYSTACK_ALLOC alloca
</span><del>-#    if ! defined _ALLOCA_H &amp;&amp; ! defined EXIT_SUCCESS &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+#    if ! defined _ALLOCA_H &amp;&amp; ! defined EXIT_SUCCESS
</ins><span class="cx"> #     include &lt;stdlib.h&gt; /* INFRINGES ON USER NAME SPACE */
</span><span class="cx">       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
</span><span class="cx"> #     ifndef EXIT_SUCCESS
</span><span class="lines">@@ -330,8 +331,8 @@
</span><span class="cx"> # endif
</span><span class="cx"> 
</span><span class="cx"> # ifdef YYSTACK_ALLOC
</span><del>-   /* Pacify GCC's `empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
</del><ins>+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
</ins><span class="cx"> #  ifndef YYSTACK_ALLOC_MAXIMUM
</span><span class="cx">     /* The OS might guarantee only one guard page at the bottom of the stack,
</span><span class="cx">        and a page size can be as small as 4096 bytes.  So we cannot safely
</span><span class="lines">@@ -347,7 +348,7 @@
</span><span class="cx"> #  endif
</span><span class="cx"> #  if (defined __cplusplus &amp;&amp; ! defined EXIT_SUCCESS \
</span><span class="cx">        &amp;&amp; ! ((defined YYMALLOC || defined malloc) \
</span><del>-             &amp;&amp; (defined YYFREE || defined free)))
</del><ins>+             &amp;&amp; (defined YYFREE || defined free)))
</ins><span class="cx"> #   include &lt;stdlib.h&gt; /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #   ifndef EXIT_SUCCESS
</span><span class="cx"> #    define EXIT_SUCCESS 0
</span><span class="lines">@@ -355,15 +356,13 @@
</span><span class="cx"> #  endif
</span><span class="cx"> #  ifndef YYMALLOC
</span><span class="cx"> #   define YYMALLOC malloc
</span><del>-#   if ! defined malloc &amp;&amp; ! defined EXIT_SUCCESS &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+#   if ! defined malloc &amp;&amp; ! defined EXIT_SUCCESS
</ins><span class="cx"> void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #   endif
</span><span class="cx"> #  endif
</span><span class="cx"> #  ifndef YYFREE
</span><span class="cx"> #   define YYFREE free
</span><del>-#   if ! defined free &amp;&amp; ! defined EXIT_SUCCESS &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+#   if ! defined free &amp;&amp; ! defined EXIT_SUCCESS
</ins><span class="cx"> void free (void *); /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #   endif
</span><span class="cx"> #  endif
</span><span class="lines">@@ -373,7 +372,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if (! defined yyoverflow \
</span><span class="cx">      &amp;&amp; (! defined __cplusplus \
</span><del>-         || (defined YYSTYPE_IS_TRIVIAL &amp;&amp; YYSTYPE_IS_TRIVIAL)))
</del><ins>+         || (defined YYSTYPE_IS_TRIVIAL &amp;&amp; YYSTYPE_IS_TRIVIAL)))
</ins><span class="cx"> 
</span><span class="cx"> /* A type that is properly aligned for any stack member.  */
</span><span class="cx"> union yyalloc
</span><span class="lines">@@ -398,16 +397,16 @@
</span><span class="cx">    elements in the stack, and YYPTR gives the new location of the
</span><span class="cx">    stack.  Advance YYPTR to a properly aligned location for the next
</span><span class="cx">    stack.  */
</span><del>-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                                \
-    do                                                                        \
-      {                                                                        \
-        YYSIZE_T yynewbytes;                                                \
-        YYCOPY (&amp;yyptr-&gt;Stack_alloc, Stack, yysize);                        \
-        Stack = &amp;yyptr-&gt;Stack_alloc;                                        \
-        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / sizeof (*yyptr);                                \
-      }                                                                        \
-    while (YYID (0))
</del><ins>+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&amp;yyptr-&gt;Stack_alloc, Stack, yysize);                    \
+        Stack = &amp;yyptr-&gt;Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (0)
</ins><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -426,7 +425,7 @@
</span><span class="cx">           for (yyi = 0; yyi &lt; (Count); yyi++)   \
</span><span class="cx">             (Dst)[yyi] = (Src)[yyi];            \
</span><span class="cx">         }                                       \
</span><del>-      while (YYID (0))
</del><ins>+      while (0)
</ins><span class="cx"> #  endif
</span><span class="cx"> # endif
</span><span class="cx"> #endif /* !YYCOPY_NEEDED */
</span><span class="lines">@@ -442,17 +441,19 @@
</span><span class="cx"> #define YYNNTS  3
</span><span class="cx"> /* YYNRULES -- Number of rules.  */
</span><span class="cx"> #define YYNRULES  26
</span><del>-/* YYNRULES -- Number of states.  */
</del><ins>+/* YYNSTATES -- Number of states.  */
</ins><span class="cx"> #define YYNSTATES  52
</span><span class="cx"> 
</span><del>-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
</del><ins>+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+   by yylex, with out-of-bounds checking.  */
</ins><span class="cx"> #define YYUNDEFTOK  2
</span><span class="cx"> #define YYMAXUTOK   267
</span><span class="cx"> 
</span><del>-#define YYTRANSLATE(YYX)                                                \
</del><ins>+#define YYTRANSLATE(YYX)                                                \
</ins><span class="cx">   ((unsigned int) (YYX) &lt;= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
</span><span class="cx"> 
</span><del>-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
</del><ins>+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, without out-of-bounds checking.  */
</ins><span class="cx"> static const yytype_uint8 yytranslate[] =
</span><span class="cx"> {
</span><span class="cx">        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
</span><span class="lines">@@ -485,31 +486,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #if YYDEBUG
</span><del>-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const yytype_uint8 yyprhs[] =
-{
-       0,     0,     3,     5,     7,    11,    15,    19,    23,    27,
-      31,    35,    39,    43,    47,    51,    55,    59,    63,    67,
-      71,    75,    79,    82,    85,    88,    91
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int8 yyrhs[] =
-{
-      28,     0,    -1,    29,    -1,     3,    -1,    29,     4,    29,
-      -1,    29,     5,    29,    -1,    29,     6,    29,    -1,    29,
-       7,    29,    -1,    29,     8,    29,    -1,    29,     9,    29,
-      -1,    29,    10,    29,    -1,    29,    13,    29,    -1,    29,
-      14,    29,    -1,    29,    12,    29,    -1,    29,    11,    29,
-      -1,    29,    15,    29,    -1,    29,    16,    29,    -1,    29,
-      18,    29,    -1,    29,    17,    29,    -1,    29,    21,    29,
-      -1,    29,    20,    29,    -1,    29,    19,    29,    -1,    23,
-      29,    -1,    24,    29,    -1,    18,    29,    -1,    17,    29,
-      -1,    25,    29,    26,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
</del><ins>+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
</ins><span class="cx"> static const yytype_uint8 yyrline[] =
</span><span class="cx"> {
</span><span class="cx">        0,    97,    97,   104,   105,   108,   111,   114,   117,   120,
</span><span class="lines">@@ -524,16 +501,16 @@
</span><span class="cx"> static const char *const yytname[] =
</span><span class="cx"> {
</span><span class="cx">   &quot;$end&quot;, &quot;error&quot;, &quot;$undefined&quot;, &quot;TOK_CONST_INT&quot;, &quot;TOK_OP_OR&quot;,
</span><del>-  &quot;TOK_OP_AND&quot;, &quot;'|'&quot;, &quot;'^'&quot;, &quot;'&amp;'&quot;, &quot;TOK_OP_NE&quot;, &quot;TOK_OP_EQ&quot;, &quot;'&lt;'&quot;,
-  &quot;'&gt;'&quot;, &quot;TOK_OP_GE&quot;, &quot;TOK_OP_LE&quot;, &quot;TOK_OP_RIGHT&quot;, &quot;TOK_OP_LEFT&quot;, &quot;'+'&quot;,
</del><ins>+  &quot;TOK_OP_AND&quot;, &quot;'|'&quot;, &quot;'^'&quot;, &quot;'&amp;'&quot;, &quot;TOK_OP_EQ&quot;, &quot;TOK_OP_NE&quot;, &quot;'&lt;'&quot;,
+  &quot;'&gt;'&quot;, &quot;TOK_OP_LE&quot;, &quot;TOK_OP_GE&quot;, &quot;TOK_OP_LEFT&quot;, &quot;TOK_OP_RIGHT&quot;, &quot;'+'&quot;,
</ins><span class="cx">   &quot;'-'&quot;, &quot;'*'&quot;, &quot;'/'&quot;, &quot;'%'&quot;, &quot;TOK_UNARY&quot;, &quot;'!'&quot;, &quot;'~'&quot;, &quot;'('&quot;, &quot;')'&quot;,
</span><del>-  &quot;$accept&quot;, &quot;input&quot;, &quot;expression&quot;, YY_NULL
</del><ins>+  &quot;$accept&quot;, &quot;input&quot;, &quot;expression&quot;, YY_NULLPTR
</ins><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> # ifdef YYPRINT
</span><del>-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
</del><ins>+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
</ins><span class="cx"> static const yytype_uint16 yytoknum[] =
</span><span class="cx"> {
</span><span class="cx">        0,   256,   257,   258,   259,   260,   124,    94,    38,   261,
</span><span class="lines">@@ -542,44 +519,18 @@
</span><span class="cx"> };
</span><span class="cx"> # endif
</span><span class="cx"> 
</span><del>-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    27,    28,    29,    29,    29,    29,    29,    29,    29,
-      29,    29,    29,    29,    29,    29,    29,    29,    29,    29,
-      29,    29,    29,    29,    29,    29,    29
-};
</del><ins>+#define YYPACT_NINF -11
</ins><span class="cx"> 
</span><del>-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     1,     1,     3,     3,     3,     3,     3,     3,
-       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
-       3,     3,     2,     2,     2,     2,     3
-};
</del><ins>+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-11)))
</ins><span class="cx"> 
</span><del>-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       0,     3,     0,     0,     0,     0,     0,     0,     2,    25,
-      24,    22,    23,     0,     1,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    26,     4,     5,     6,     7,     8,     9,
-      10,    14,    13,    11,    12,    15,    16,    18,    17,    21,
-      20,    19
-};
</del><ins>+#define YYTABLE_NINF -1
</ins><span class="cx"> 
</span><del>-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int8 yydefgoto[] =
-{
-      -1,     7,     8
-};
</del><ins>+#define yytable_value_is_error(Yytable_value) \
+  0
</ins><span class="cx"> 
</span><del>-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -11
</del><ins>+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
</ins><span class="cx"> static const yytype_int16 yypact[] =
</span><span class="cx"> {
</span><span class="cx">       46,   -11,    46,    46,    46,    46,    46,    12,    68,   -11,
</span><span class="lines">@@ -590,16 +541,34 @@
</span><span class="cx">      -11,   -11
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYPGOTO[NTERM-NUM].  */
</del><ins>+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
+static const yytype_uint8 yydefact[] =
+{
+       0,     3,     0,     0,     0,     0,     0,     0,     2,    25,
+      24,    22,    23,     0,     1,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    26,     4,     5,     6,     7,     8,    10,
+       9,    14,    13,    12,    11,    16,    15,    18,    17,    21,
+      20,    19
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
</ins><span class="cx"> static const yytype_int8 yypgoto[] =
</span><span class="cx"> {
</span><span class="cx">      -11,   -11,    -2
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -1
</del><ins>+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     7,     8
+};
+
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
</ins><span class="cx"> static const yytype_uint8 yytable[] =
</span><span class="cx"> {
</span><span class="cx">        9,    10,    11,    12,    13,    26,    27,    28,    29,    30,
</span><span class="lines">@@ -622,12 +591,6 @@
</span><span class="cx">       27,    28,    29,    30,    31,    32
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-11)))
-
-#define yytable_value_is_error(Yytable_value) \
-  YYID (0)
-
</del><span class="cx"> static const yytype_int8 yycheck[] =
</span><span class="cx"> {
</span><span class="cx">        2,     3,     4,     5,     6,    15,    16,    17,    18,    19,
</span><span class="lines">@@ -650,8 +613,8 @@
</span><span class="cx">       16,    17,    18,    19,    20,    21
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
</del><ins>+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
</ins><span class="cx"> static const yytype_uint8 yystos[] =
</span><span class="cx"> {
</span><span class="cx">        0,     3,    17,    18,    23,    24,    25,    28,    29,    29,
</span><span class="lines">@@ -662,31 +625,33 @@
</span><span class="cx">       29,    29
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#define yyerrok                (yyerrstatus = 0)
-#define yyclearin        (yychar = YYEMPTY)
-#define YYEMPTY                (-2)
-#define YYEOF                0
</del><ins>+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    27,    28,    29,    29,    29,    29,    29,    29,    29,
+      29,    29,    29,    29,    29,    29,    29,    29,    29,    29,
+      29,    29,    29,    29,    29,    29,    29
+};
</ins><span class="cx"> 
</span><del>-#define YYACCEPT        goto yyacceptlab
-#define YYABORT                goto yyabortlab
-#define YYERROR                goto yyerrorlab
</del><ins>+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     1,     1,     3,     3,     3,     3,     3,     3,
+       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
+       3,     3,     2,     2,     2,     2,     3
+};
</ins><span class="cx"> 
</span><span class="cx"> 
</span><del>-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
</del><ins>+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
</ins><span class="cx"> 
</span><del>-#define YYFAIL                goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
</del><ins>+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> #define YYRECOVERING()  (!!yyerrstatus)
</span><span class="cx"> 
</span><span class="cx"> #define YYBACKUP(Token, Value)                                  \
</span><span class="lines">@@ -702,28 +667,16 @@
</span><span class="cx">   else                                                          \
</span><span class="cx">     {                                                           \
</span><span class="cx">       yyerror (context, YY_(&quot;syntax error: cannot back up&quot;)); \
</span><del>-      YYERROR;                                                        \
-    }                                                                \
-while (YYID (0))
</del><ins>+      YYERROR;                                                  \
+    }                                                           \
+while (0)
</ins><span class="cx"> 
</span><span class="cx"> /* Error token number */
</span><del>-#define YYTERROR        1
-#define YYERRCODE        256
</del><ins>+#define YYTERROR        1
+#define YYERRCODE       256
</ins><span class="cx"> 
</span><span class="cx"> 
</span><del>-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
</del><span class="cx"> 
</span><del>-
-/* YYLEX -- calling `yylex' with the right arguments.  */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&amp;yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&amp;yylval, context)
-#endif
-
</del><span class="cx"> /* Enable debugging if requested.  */
</span><span class="cx"> #if YYDEBUG
</span><span class="cx"> 
</span><span class="lines">@@ -732,52 +685,45 @@
</span><span class="cx"> #  define YYFPRINTF fprintf
</span><span class="cx"> # endif
</span><span class="cx"> 
</span><del>-# define YYDPRINTF(Args)                        \
-do {                                                \
-  if (yydebug)                                        \
-    YYFPRINTF Args;                                \
-} while (YYID (0))
</del><ins>+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
</ins><span class="cx"> 
</span><del>-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                          \
-do {                                                                          \
-  if (yydebug)                                                                  \
-    {                                                                          \
-      YYFPRINTF (stderr, &quot;%s &quot;, Title);                                          \
-      yy_symbol_print (stderr,                                                  \
-                  Type, Value, context); \
-      YYFPRINTF (stderr, &quot;\n&quot;);                                                  \
-    }                                                                          \
-} while (YYID (0))
</del><ins>+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
</ins><span class="cx"> 
</span><span class="cx"> 
</span><del>-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
</del><ins>+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, &quot;%s &quot;, Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value, context); \
+      YYFPRINTF (stderr, &quot;\n&quot;);                                           \
+    }                                                                     \
+} while (0)
</ins><span class="cx"> 
</span><del>-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT.  |
+`----------------------------------------*/
+
</ins><span class="cx"> static void
</span><span class="cx"> yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Context *context)
</span><del>-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, context)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    Context *context;
-#endif
</del><span class="cx"> {
</span><span class="cx">   FILE *yyo = yyoutput;
</span><span class="cx">   YYUSE (yyo);
</span><ins>+  YYUSE (context);
</ins><span class="cx">   if (!yyvaluep)
</span><span class="cx">     return;
</span><del>-  YYUSE (context);
</del><span class="cx"> # ifdef YYPRINT
</span><span class="cx">   if (yytype &lt; YYNTOKENS)
</span><span class="cx">     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
</span><del>-# else
-  YYUSE (yyoutput);
</del><span class="cx"> # endif
</span><span class="cx">   YYUSE (yytype);
</span><span class="cx"> }
</span><span class="lines">@@ -787,23 +733,11 @@
</span><span class="cx"> | Print this symbol on YYOUTPUT.  |
</span><span class="cx"> `--------------------------------*/
</span><span class="cx"> 
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><span class="cx"> yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Context *context)
</span><del>-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, context)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    Context *context;
-#endif
</del><span class="cx"> {
</span><del>-  if (yytype &lt; YYNTOKENS)
-    YYFPRINTF (yyoutput, &quot;token %s (&quot;, yytname[yytype]);
-  else
-    YYFPRINTF (yyoutput, &quot;nterm %s (&quot;, yytname[yytype]);
</del><ins>+  YYFPRINTF (yyoutput, &quot;%s %s (&quot;,
+             yytype &lt; YYNTOKENS ? &quot;token&quot; : &quot;nterm&quot;, yytname[yytype]);
</ins><span class="cx"> 
</span><span class="cx">   yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
</span><span class="cx">   YYFPRINTF (yyoutput, &quot;)&quot;);
</span><span class="lines">@@ -814,16 +748,8 @@
</span><span class="cx"> | TOP (included).                                                   |
</span><span class="cx"> `------------------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><span class="cx"> yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
</span><del>-#else
-static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
-#endif
</del><span class="cx"> {
</span><span class="cx">   YYFPRINTF (stderr, &quot;Stack now&quot;);
</span><span class="cx">   for (; yybottom &lt;= yytop; yybottom++)
</span><span class="lines">@@ -834,50 +760,42 @@
</span><span class="cx">   YYFPRINTF (stderr, &quot;\n&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-# define YY_STACK_PRINT(Bottom, Top)                                \
-do {                                                                \
-  if (yydebug)                                                        \
-    yy_stack_print ((Bottom), (Top));                                \
-} while (YYID (0))
</del><ins>+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> /*------------------------------------------------.
</span><span class="cx"> | Report that the YYRULE is going to be reduced.  |
</span><span class="cx"> `------------------------------------------------*/
</span><span class="cx"> 
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><del>-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, Context *context)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule, context)
-    YYSTYPE *yyvsp;
-    int yyrule;
-    Context *context;
-#endif
</del><ins>+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, Context *context)
</ins><span class="cx"> {
</span><ins>+  unsigned long int yylno = yyrline[yyrule];
</ins><span class="cx">   int yynrhs = yyr2[yyrule];
</span><span class="cx">   int yyi;
</span><del>-  unsigned long int yylno = yyrline[yyrule];
</del><span class="cx">   YYFPRINTF (stderr, &quot;Reducing stack by rule %d (line %lu):\n&quot;,
</span><del>-             yyrule - 1, yylno);
</del><ins>+             yyrule - 1, yylno);
</ins><span class="cx">   /* The symbols being reduced.  */
</span><span class="cx">   for (yyi = 0; yyi &lt; yynrhs; yyi++)
</span><span class="cx">     {
</span><span class="cx">       YYFPRINTF (stderr, &quot;   $%d = &quot;, yyi + 1);
</span><del>-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-                       &amp;(yyvsp[(yyi + 1) - (yynrhs)])
-                                              , context);
</del><ins>+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &amp;(yyvsp[(yyi + 1) - (yynrhs)])
+                                              , context);
</ins><span class="cx">       YYFPRINTF (stderr, &quot;\n&quot;);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-# define YY_REDUCE_PRINT(Rule)                \
-do {                                        \
-  if (yydebug)                                \
-    yy_reduce_print (yyvsp, Rule, context); \
-} while (YYID (0))
</del><ins>+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule, context); \
+} while (0)
</ins><span class="cx"> 
</span><span class="cx"> /* Nonzero means print parse trace.  It is left uninitialized so that
</span><span class="cx">    multiple parsers can coexist.  */
</span><span class="lines">@@ -891,7 +809,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> /* YYINITDEPTH -- initial size of the parser's stacks.  */
</span><del>-#ifndef        YYINITDEPTH
</del><ins>+#ifndef YYINITDEPTH
</ins><span class="cx"> # define YYINITDEPTH 200
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -914,15 +832,8 @@
</span><span class="cx"> #   define yystrlen strlen
</span><span class="cx"> #  else
</span><span class="cx"> /* Return the length of YYSTR.  */
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static YYSIZE_T
</span><span class="cx"> yystrlen (const char *yystr)
</span><del>-#else
-static YYSIZE_T
-yystrlen (yystr)
-    const char *yystr;
-#endif
</del><span class="cx"> {
</span><span class="cx">   YYSIZE_T yylen;
</span><span class="cx">   for (yylen = 0; yystr[yylen]; yylen++)
</span><span class="lines">@@ -938,16 +849,8 @@
</span><span class="cx"> #  else
</span><span class="cx"> /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
</span><span class="cx">    YYDEST.  */
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static char *
</span><span class="cx"> yystpcpy (char *yydest, const char *yysrc)
</span><del>-#else
-static char *
-yystpcpy (yydest, yysrc)
-    char *yydest;
-    const char *yysrc;
-#endif
</del><span class="cx"> {
</span><span class="cx">   char *yyd = yydest;
</span><span class="cx">   const char *yys = yysrc;
</span><span class="lines">@@ -977,27 +880,27 @@
</span><span class="cx">       char const *yyp = yystr;
</span><span class="cx"> 
</span><span class="cx">       for (;;)
</span><del>-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
</del><ins>+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
</ins><span class="cx"> 
</span><del>-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            /* Fall through.  */
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
</del><ins>+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            /* Fall through.  */
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
</ins><span class="cx"> 
</span><del>-          case '&quot;':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
</del><ins>+          case '&quot;':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
</ins><span class="cx">     do_not_strip_quotes: ;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1020,11 +923,11 @@
</span><span class="cx"> yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
</span><span class="cx">                 yytype_int16 *yyssp, int yytoken)
</span><span class="cx"> {
</span><del>-  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
</del><ins>+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
</ins><span class="cx">   YYSIZE_T yysize = yysize0;
</span><span class="cx">   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
</span><span class="cx">   /* Internationalized format string. */
</span><del>-  const char *yyformat = YY_NULL;
</del><ins>+  const char *yyformat = YY_NULLPTR;
</ins><span class="cx">   /* Arguments of yyformat. */
</span><span class="cx">   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
</span><span class="cx">   /* Number of reported tokens (one for the &quot;unexpected&quot;, one per
</span><span class="lines">@@ -1032,10 +935,6 @@
</span><span class="cx">   int yycount = 0;
</span><span class="cx"> 
</span><span class="cx">   /* There are many possibilities here to consider:
</span><del>-     - Assume YYFAIL is not used.  It's too flawed to consider.  See
-       &lt;http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html&gt;
-       for details.  YYERROR is fine as it does not invoke this
-       function.
</del><span class="cx">      - If this state is a consistent state with a default action, then
</span><span class="cx">        the only way this function was invoked is if the default action
</span><span class="cx">        is an error action.  In that case, don't check for expected
</span><span class="lines">@@ -1085,7 +984,7 @@
</span><span class="cx">                   }
</span><span class="cx">                 yyarg[yycount++] = yytname[yyx];
</span><span class="cx">                 {
</span><del>-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
</del><ins>+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
</ins><span class="cx">                   if (! (yysize &lt;= yysize1
</span><span class="cx">                          &amp;&amp; yysize1 &lt;= YYSTACK_ALLOC_MAXIMUM))
</span><span class="cx">                     return 2;
</span><span class="lines">@@ -1152,28 +1051,18 @@
</span><span class="cx"> | Release the memory associated to this symbol.  |
</span><span class="cx"> `-----------------------------------------------*/
</span><span class="cx"> 
</span><del>-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><span class="cx"> yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, Context *context)
</span><del>-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, context)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-    Context *context;
-#endif
</del><span class="cx"> {
</span><span class="cx">   YYUSE (yyvaluep);
</span><span class="cx">   YYUSE (context);
</span><del>-
</del><span class="cx">   if (!yymsg)
</span><span class="cx">     yymsg = &quot;Deleting&quot;;
</span><span class="cx">   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
</span><span class="cx"> 
</span><ins>+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
</ins><span class="cx">   YYUSE (yytype);
</span><ins>+  YY_IGNORE_MAYBE_UNINITIALIZED_END
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1183,57 +1072,19 @@
</span><span class="cx"> | yyparse.  |
</span><span class="cx"> `----------*/
</span><span class="cx"> 
</span><del>-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> int
</span><del>-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
</del><span class="cx"> yyparse (Context *context)
</span><del>-#else
-int
-yyparse (context)
-    Context *context;
-#endif
-#endif
</del><span class="cx"> {
</span><span class="cx"> /* The lookahead symbol.  */
</span><span class="cx"> int yychar;
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-#if defined __GNUC__ &amp;&amp; 407 &lt;= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma (&quot;GCC diagnostic push&quot;) \
-    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wuninitialized\&quot;&quot;)\
-    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wmaybe-uninitialized\&quot;&quot;)
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
-    _Pragma (&quot;GCC diagnostic pop&quot;)
-#else
</del><ins>+/* The semantic value of the lookahead symbol.  */
</ins><span class="cx"> /* Default value used for initialization, for pacifying older GCCs
</span><span class="cx">    or non-GCC compilers.  */
</span><del>-static YYSTYPE yyval_default;
-# define YY_INITIAL_VALUE(Value) = Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
</del><ins>+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
</ins><span class="cx"> 
</span><del>-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
-
</del><span class="cx">     /* Number of syntax errors so far.  */
</span><span class="cx">     int yynerrs;
</span><span class="cx"> 
</span><span class="lines">@@ -1242,8 +1093,8 @@
</span><span class="cx">     int yyerrstatus;
</span><span class="cx"> 
</span><span class="cx">     /* The stacks and their tools:
</span><del>-       `yyss': related to states.
-       `yyvs': related to semantic values.
</del><ins>+       'yyss': related to states.
+       'yyvs': related to semantic values.
</ins><span class="cx"> 
</span><span class="cx">        Refer to the stacks through separate pointers, to allow yyoverflow
</span><span class="cx">        to reallocate them elsewhere.  */
</span><span class="lines">@@ -1311,23 +1162,23 @@
</span><span class="cx"> 
</span><span class="cx"> #ifdef yyoverflow
</span><span class="cx">       {
</span><del>-        /* Give user a chance to reallocate the stack.  Use copies of
-           these so that the &amp;'s don't force the real ones into
-           memory.  */
-        YYSTYPE *yyvs1 = yyvs;
-        yytype_int16 *yyss1 = yyss;
</del><ins>+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &amp;'s don't force the real ones into
+           memory.  */
+        YYSTYPE *yyvs1 = yyvs;
+        yytype_int16 *yyss1 = yyss;
</ins><span class="cx"> 
</span><del>-        /* Each stack pointer address is followed by the size of the
-           data in use in that stack, in bytes.  This used to be a
-           conditional around just the two extra args, but that might
-           be undefined if yyoverflow is a macro.  */
-        yyoverflow (YY_(&quot;memory exhausted&quot;),
-                    &amp;yyss1, yysize * sizeof (*yyssp),
-                    &amp;yyvs1, yysize * sizeof (*yyvsp),
-                    &amp;yystacksize);
</del><ins>+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_(&quot;memory exhausted&quot;),
+                    &amp;yyss1, yysize * sizeof (*yyssp),
+                    &amp;yyvs1, yysize * sizeof (*yyvsp),
+                    &amp;yystacksize);
</ins><span class="cx"> 
</span><del>-        yyss = yyss1;
-        yyvs = yyvs1;
</del><ins>+        yyss = yyss1;
+        yyvs = yyvs1;
</ins><span class="cx">       }
</span><span class="cx"> #else /* no yyoverflow */
</span><span class="cx"> # ifndef YYSTACK_RELOCATE
</span><span class="lines">@@ -1335,22 +1186,22 @@
</span><span class="cx"> # else
</span><span class="cx">       /* Extend the stack our own way.  */
</span><span class="cx">       if (YYMAXDEPTH &lt;= yystacksize)
</span><del>-        goto yyexhaustedlab;
</del><ins>+        goto yyexhaustedlab;
</ins><span class="cx">       yystacksize *= 2;
</span><span class="cx">       if (YYMAXDEPTH &lt; yystacksize)
</span><del>-        yystacksize = YYMAXDEPTH;
</del><ins>+        yystacksize = YYMAXDEPTH;
</ins><span class="cx"> 
</span><span class="cx">       {
</span><del>-        yytype_int16 *yyss1 = yyss;
-        union yyalloc *yyptr =
-          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-        if (! yyptr)
-          goto yyexhaustedlab;
-        YYSTACK_RELOCATE (yyss_alloc, yyss);
-        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
</del><ins>+        yytype_int16 *yyss1 = yyss;
+        union yyalloc *yyptr =
+          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
</ins><span class="cx"> #  undef YYSTACK_RELOCATE
</span><del>-        if (yyss1 != yyssa)
-          YYSTACK_FREE (yyss1);
</del><ins>+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
</ins><span class="cx">       }
</span><span class="cx"> # endif
</span><span class="cx"> #endif /* no yyoverflow */
</span><span class="lines">@@ -1359,10 +1210,10 @@
</span><span class="cx">       yyvsp = yyvs + yysize - 1;
</span><span class="cx"> 
</span><span class="cx">       YYDPRINTF ((stderr, &quot;Stack size increased to %lu\n&quot;,
</span><del>-                  (unsigned long int) yystacksize));
</del><ins>+                  (unsigned long int) yystacksize));
</ins><span class="cx"> 
</span><span class="cx">       if (yyss + yystacksize - 1 &lt;= yyssp)
</span><del>-        YYABORT;
</del><ins>+        YYABORT;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   YYDPRINTF ((stderr, &quot;Entering state %d\n&quot;, yystate));
</span><span class="lines">@@ -1391,7 +1242,7 @@
</span><span class="cx">   if (yychar == YYEMPTY)
</span><span class="cx">     {
</span><span class="cx">       YYDPRINTF ((stderr, &quot;Reading a token: &quot;));
</span><del>-      yychar = YYLEX;
</del><ins>+      yychar = yylex (&amp;yylval, context);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   if (yychar &lt;= YYEOF)
</span><span class="lines">@@ -1456,7 +1307,7 @@
</span><span class="cx">   yylen = yyr2[yyn];
</span><span class="cx"> 
</span><span class="cx">   /* If YYLEN is nonzero, implement the default value of the action:
</span><del>-     `$$ = $1'.
</del><ins>+     '$$ = $1'.
</ins><span class="cx"> 
</span><span class="cx">      Otherwise, the following line sets YYVAL to garbage.
</span><span class="cx">      This behavior is undocumented and Bison
</span><span class="lines">@@ -1472,190 +1323,214 @@
</span><span class="cx">         case 2:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        *(context-&gt;result) = static_cast&lt;int&gt;((yyvsp[(1) - (1)]));
</del><ins>+        *(context-&gt;result) = static_cast&lt;int&gt;((yyvsp[0]));
</ins><span class="cx">         YYACCEPT;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 4:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) || (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) || (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 5:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &amp;&amp; (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &amp;&amp; (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 6:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) | (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) | (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 7:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) ^ (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) ^ (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 8:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &amp; (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &amp; (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 9:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) != (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) != (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 10:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) == (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) == (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 11:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &gt;= (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &gt;= (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 12:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &lt;= (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &lt;= (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 13:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &gt; (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &gt; (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 14:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &lt; (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &lt; (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 15:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &gt;&gt; (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &gt;&gt; (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 16:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) &lt;&lt; (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) &lt;&lt; (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 17:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) - (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) - (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 18:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) + (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) + (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 19:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(3) - (3)]) == 0) {
</del><ins>+        if ((yyvsp[0]) == 0) {
</ins><span class="cx">             std::ostringstream stream;
</span><del>-            stream &lt;&lt; (yyvsp[(1) - (3)]) &lt;&lt; &quot; % &quot; &lt;&lt; (yyvsp[(3) - (3)]);
</del><ins>+            stream &lt;&lt; (yyvsp[-2]) &lt;&lt; &quot; % &quot; &lt;&lt; (yyvsp[0]);
</ins><span class="cx">             std::string text = stream.str();
</span><span class="cx">             context-&gt;diagnostics-&gt;report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
</span><span class="cx">                                          context-&gt;token-&gt;location,
</span><span class="cx">                                          text.c_str());
</span><span class="cx">             YYABORT;
</span><span class="cx">         } else {
</span><del>-            (yyval) = (yyvsp[(1) - (3)]) % (yyvsp[(3) - (3)]);
</del><ins>+            (yyval) = (yyvsp[-2]) % (yyvsp[0]);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 20:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(3) - (3)]) == 0) {
</del><ins>+        if ((yyvsp[0]) == 0) {
</ins><span class="cx">             std::ostringstream stream;
</span><del>-            stream &lt;&lt; (yyvsp[(1) - (3)]) &lt;&lt; &quot; / &quot; &lt;&lt; (yyvsp[(3) - (3)]);
</del><ins>+            stream &lt;&lt; (yyvsp[-2]) &lt;&lt; &quot; / &quot; &lt;&lt; (yyvsp[0]);
</ins><span class="cx">             std::string text = stream.str();
</span><span class="cx">             context-&gt;diagnostics-&gt;report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
</span><span class="cx">                                          context-&gt;token-&gt;location,
</span><span class="cx">                                          text.c_str());
</span><span class="cx">             YYABORT;
</span><span class="cx">         } else {
</span><del>-            (yyval) = (yyvsp[(1) - (3)]) / (yyvsp[(3) - (3)]);
</del><ins>+            (yyval) = (yyvsp[-2]) / (yyvsp[0]);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 21:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(1) - (3)]) * (yyvsp[(3) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-2]) * (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 22:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = ! (yyvsp[(2) - (2)]);
</del><ins>+        (yyval) = ! (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 23:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = ~ (yyvsp[(2) - (2)]);
</del><ins>+        (yyval) = ~ (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 24:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = - (yyvsp[(2) - (2)]);
</del><ins>+        (yyval) = - (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 25:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = + (yyvsp[(2) - (2)]);
</del><ins>+        (yyval) = + (yyvsp[0]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 26:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval) = (yyvsp[(2) - (3)]);
</del><ins>+        (yyval) = (yyvsp[-1]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -1681,7 +1556,7 @@
</span><span class="cx"> 
</span><span class="cx">   *++yyvsp = yyval;
</span><span class="cx"> 
</span><del>-  /* Now `shift' the result of the reduction.  Determine what state
</del><ins>+  /* Now 'shift' the result of the reduction.  Determine what state
</ins><span class="cx">      that goes to, based on the state we popped back to and the rule
</span><span class="cx">      number reduced by.  */
</span><span class="cx"> 
</span><span class="lines">@@ -1696,9 +1571,9 @@
</span><span class="cx">   goto yynewstate;
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
</del><ins>+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
</ins><span class="cx"> yyerrlab:
</span><span class="cx">   /* Make sure we have latest lookahead translation.  See comments at
</span><span class="cx">      user semantic actions for why this is necessary.  */
</span><span class="lines">@@ -1749,20 +1624,20 @@
</span><span class="cx">   if (yyerrstatus == 3)
</span><span class="cx">     {
</span><span class="cx">       /* If just tried and failed to reuse lookahead token after an
</span><del>-         error, discard it.  */
</del><ins>+         error, discard it.  */
</ins><span class="cx"> 
</span><span class="cx">       if (yychar &lt;= YYEOF)
</span><del>-        {
-          /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
-            YYABORT;
-        }
</del><ins>+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
</ins><span class="cx">       else
</span><del>-        {
-          yydestruct (&quot;Error: discarding&quot;,
-                      yytoken, &amp;yylval, context);
-          yychar = YYEMPTY;
-        }
</del><ins>+        {
+          yydestruct (&quot;Error: discarding&quot;,
+                      yytoken, &amp;yylval, context);
+          yychar = YYEMPTY;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   /* Else will try to reuse lookahead token after shifting the error
</span><span class="lines">@@ -1781,7 +1656,7 @@
</span><span class="cx">   if (/*CONSTCOND*/ 0)
</span><span class="cx">      goto yyerrorlab;
</span><span class="cx"> 
</span><del>-  /* Do not reclaim the symbols of the rule which action triggered
</del><ins>+  /* Do not reclaim the symbols of the rule whose action triggered
</ins><span class="cx">      this YYERROR.  */
</span><span class="cx">   YYPOPSTACK (yylen);
</span><span class="cx">   yylen = 0;
</span><span class="lines">@@ -1794,29 +1669,29 @@
</span><span class="cx"> | yyerrlab1 -- common code for both syntax error and YYERROR.  |
</span><span class="cx"> `-------------------------------------------------------------*/
</span><span class="cx"> yyerrlab1:
</span><del>-  yyerrstatus = 3;        /* Each real token shifted decrements this.  */
</del><ins>+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
</ins><span class="cx"> 
</span><span class="cx">   for (;;)
</span><span class="cx">     {
</span><span class="cx">       yyn = yypact[yystate];
</span><span class="cx">       if (!yypact_value_is_default (yyn))
</span><del>-        {
-          yyn += YYTERROR;
-          if (0 &lt;= yyn &amp;&amp; yyn &lt;= YYLAST &amp;&amp; yycheck[yyn] == YYTERROR)
-            {
-              yyn = yytable[yyn];
-              if (0 &lt; yyn)
-                break;
-            }
-        }
</del><ins>+        {
+          yyn += YYTERROR;
+          if (0 &lt;= yyn &amp;&amp; yyn &lt;= YYLAST &amp;&amp; yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 &lt; yyn)
+                break;
+            }
+        }
</ins><span class="cx"> 
</span><span class="cx">       /* Pop the current state because it cannot handle the error token.  */
</span><span class="cx">       if (yyssp == yyss)
</span><del>-        YYABORT;
</del><ins>+        YYABORT;
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">       yydestruct (&quot;Error: popping&quot;,
</span><del>-                  yystos[yystate], yyvsp, context);
</del><ins>+                  yystos[yystate], yyvsp, context);
</ins><span class="cx">       YYPOPSTACK (1);
</span><span class="cx">       yystate = *yyssp;
</span><span class="cx">       YY_STACK_PRINT (yyss, yyssp);
</span><span class="lines">@@ -1867,14 +1742,14 @@
</span><span class="cx">       yydestruct (&quot;Cleanup: discarding lookahead&quot;,
</span><span class="cx">                   yytoken, &amp;yylval, context);
</span><span class="cx">     }
</span><del>-  /* Do not reclaim the symbols of the rule which action triggered
</del><ins>+  /* Do not reclaim the symbols of the rule whose action triggered
</ins><span class="cx">      this YYABORT or YYACCEPT.  */
</span><span class="cx">   YYPOPSTACK (yylen);
</span><span class="cx">   YY_STACK_PRINT (yyss, yyssp);
</span><span class="cx">   while (yyssp != yyss)
</span><span class="cx">     {
</span><span class="cx">       yydestruct (&quot;Cleanup: popping&quot;,
</span><del>-                  yystos[*yyssp], yyvsp, context);
</del><ins>+                  yystos[*yyssp], yyvsp, context);
</ins><span class="cx">       YYPOPSTACK (1);
</span><span class="cx">     }
</span><span class="cx"> #ifndef yyoverflow
</span><span class="lines">@@ -1885,23 +1760,19 @@
</span><span class="cx">   if (yymsg != yymsgbuf)
</span><span class="cx">     YYSTACK_FREE (yymsg);
</span><span class="cx"> #endif
</span><del>-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
</del><ins>+  return yyresult;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-
-int yylex(YYSTYPE* lvalp, Context* context)
</del><ins>+int yylex(YYSTYPE *lvalp, Context *context)
</ins><span class="cx"> {
</span><span class="cx">     int type = 0;
</span><span class="cx"> 
</span><del>-    pp::Token* token = context-&gt;token;
</del><ins>+    pp::Token *token = context-&gt;token;
</ins><span class="cx">     switch (token-&gt;type)
</span><span class="cx">     {
</span><del>-      case pp::Token::CONST_INT:
-      {
</del><ins>+      case pp::Token::CONST_INT: {
</ins><span class="cx">         unsigned int val = 0;
</span><span class="cx">         if (!token-&gt;uValue(&amp;val))
</span><span class="cx">         {
</span><span class="lines">@@ -1912,39 +1783,59 @@
</span><span class="cx">         type = TOK_CONST_INT;
</span><span class="cx">         break;
</span><span class="cx">       }
</span><del>-      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;
-      case pp::Token::OP_EQ: type = TOK_OP_EQ; break;
-      case pp::Token::OP_GE: type = TOK_OP_GE; break;
-      case pp::Token::OP_LE: type = TOK_OP_LE; break;
-      case pp::Token::OP_RIGHT: type = TOK_OP_RIGHT; break;
-      case pp::Token::OP_LEFT: type = TOK_OP_LEFT; break;
-      case '|': type = '|'; break;
-      case '^': type = '^'; break;
-      case '&amp;': type = '&amp;'; break;
-      case '&gt;': type = '&gt;'; break;
-      case '&lt;': type = '&lt;'; break;
-      case '-': type = '-'; break;
-      case '+': type = '+'; break;
-      case '%': type = '%'; break;
-      case '/': type = '/'; break;
-      case '*': type = '*'; break;
-      case '!': type = '!'; break;
-      case '~': type = '~'; break;
-      case '(': type = '('; break;
-      case ')': type = ')'; break;
</del><ins>+      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;
+      case pp::Token::OP_EQ:
+        type = TOK_OP_EQ;
+        break;
+      case pp::Token::OP_GE:
+        type = TOK_OP_GE;
+        break;
+      case pp::Token::OP_LE:
+        type = TOK_OP_LE;
+        break;
+      case pp::Token::OP_RIGHT:
+        type = TOK_OP_RIGHT;
+        break;
+      case pp::Token::OP_LEFT:
+        type = TOK_OP_LEFT;
+        break;
+      case '|':
+      case '^':
+      case '&amp;':
+      case '&gt;':
+      case '&lt;':
+      case '-':
+      case '+':
+      case '%':
+      case '/':
+      case '*':
+      case '!':
+      case '~':
+      case '(':
+      case ')':
+        type = token-&gt;type;
+        break;
</ins><span class="cx"> 
</span><del>-      default: break;
</del><ins>+      default:
+        break;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Advance to the next token if the current one is valid.
</span><del>-    if (type != 0) context-&gt;lexer-&gt;lex(token);
</del><ins>+    if (type != 0)
+        context-&gt;lexer-&gt;lex(token);
</ins><span class="cx"> 
</span><span class="cx">     return type;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void yyerror(Context* context, const char* reason)
</del><ins>+void yyerror(Context *context, const char *reason)
</ins><span class="cx"> {
</span><span class="cx">     context-&gt;diagnostics-&gt;report(pp::Diagnostics::PP_INVALID_EXPRESSION,
</span><span class="cx">                                  context-&gt;token-&gt;location,
</span><span class="lines">@@ -1953,13 +1844,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace pp {
</span><span class="cx"> 
</span><del>-ExpressionParser::ExpressionParser(Lexer* lexer, Diagnostics* diagnostics) :
-    mLexer(lexer),
-    mDiagnostics(diagnostics)
</del><ins>+ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
+    : mLexer(lexer),
+      mDiagnostics(diagnostics)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ExpressionParser::parse(Token* token, int* result)
</del><ins>+bool ExpressionParser::parse(Token *token, int *result)
</ins><span class="cx"> {
</span><span class="cx">     Context context;
</span><span class="cx">     context.diagnostics = mDiagnostics;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PREPROCESSOR_EXPRESSION_PARSER_H_
-#define COMPILER_PREPROCESSOR_EXPRESSION_PARSER_H_
</del><ins>+#ifndef COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
+#define COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;pp_utils.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -19,16 +19,17 @@
</span><span class="cx"> class ExpressionParser
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    ExpressionParser(Lexer* lexer, Diagnostics* diagnostics);
</del><ins>+    ExpressionParser(Lexer *lexer, Diagnostics *diagnostics);
</ins><span class="cx"> 
</span><del>-    bool parse(Token* token, int* result);
</del><ins>+    bool parse(Token *token, int *result);
</ins><span class="cx"> 
</span><span class="cx">   private:
</span><span class="cx">     PP_DISALLOW_COPY_AND_ASSIGN(ExpressionParser);
</span><span class="cx"> 
</span><del>-    Lexer* mLexer;
-    Diagnostics* mDiagnostics;
</del><ins>+    Lexer *mLexer;
+    Diagnostics *mDiagnostics;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><del>-#endif  // COMPILER_PREPROCESSOR_EXPRESSION_PARSER_H_
</del><ins>+
+#endif  // COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorExpressionParsery"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.y        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wuninitialized&quot;
</span><span class="cx"> #endif
</span><span class="cx"> #elif defined(_MSC_VER)
</span><del>-#pragma warning(disable: 4065 4701)
</del><ins>+#pragma warning(disable: 4065 4244 4701 4702)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ExpressionParser.h&quot;
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> %}
</span><span class="cx"> 
</span><span class="cx"> %pure-parser
</span><del>-%name-prefix=&quot;pp&quot;
</del><ins>+%name-prefix &quot;pp&quot;
</ins><span class="cx"> %parse-param {Context *context}
</span><span class="cx"> %lex-param {Context *context}
</span><span class="cx"> 
</span><span class="lines">@@ -195,15 +195,14 @@
</span><span class="cx"> 
</span><span class="cx"> %%
</span><span class="cx"> 
</span><del>-int yylex(YYSTYPE* lvalp, Context* context)
</del><ins>+int yylex(YYSTYPE *lvalp, Context *context)
</ins><span class="cx"> {
</span><span class="cx">     int type = 0;
</span><span class="cx"> 
</span><del>-    pp::Token* token = context-&gt;token;
</del><ins>+    pp::Token *token = context-&gt;token;
</ins><span class="cx">     switch (token-&gt;type)
</span><span class="cx">     {
</span><del>-      case pp::Token::CONST_INT:
-      {
</del><ins>+      case pp::Token::CONST_INT: {
</ins><span class="cx">         unsigned int val = 0;
</span><span class="cx">         if (!token-&gt;uValue(&amp;val))
</span><span class="cx">         {
</span><span class="lines">@@ -214,39 +213,59 @@
</span><span class="cx">         type = TOK_CONST_INT;
</span><span class="cx">         break;
</span><span class="cx">       }
</span><del>-      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;
-      case pp::Token::OP_EQ: type = TOK_OP_EQ; break;
-      case pp::Token::OP_GE: type = TOK_OP_GE; break;
-      case pp::Token::OP_LE: type = TOK_OP_LE; break;
-      case pp::Token::OP_RIGHT: type = TOK_OP_RIGHT; break;
-      case pp::Token::OP_LEFT: type = TOK_OP_LEFT; break;
-      case '|': type = '|'; break;
-      case '^': type = '^'; break;
-      case '&amp;': type = '&amp;'; break;
-      case '&gt;': type = '&gt;'; break;
-      case '&lt;': type = '&lt;'; break;
-      case '-': type = '-'; break;
-      case '+': type = '+'; break;
-      case '%': type = '%'; break;
-      case '/': type = '/'; break;
-      case '*': type = '*'; break;
-      case '!': type = '!'; break;
-      case '~': type = '~'; break;
-      case '(': type = '('; break;
-      case ')': type = ')'; break;
</del><ins>+      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;
+      case pp::Token::OP_EQ:
+        type = TOK_OP_EQ;
+        break;
+      case pp::Token::OP_GE:
+        type = TOK_OP_GE;
+        break;
+      case pp::Token::OP_LE:
+        type = TOK_OP_LE;
+        break;
+      case pp::Token::OP_RIGHT:
+        type = TOK_OP_RIGHT;
+        break;
+      case pp::Token::OP_LEFT:
+        type = TOK_OP_LEFT;
+        break;
+      case '|':
+      case '^':
+      case '&amp;':
+      case '&gt;':
+      case '&lt;':
+      case '-':
+      case '+':
+      case '%':
+      case '/':
+      case '*':
+      case '!':
+      case '~':
+      case '(':
+      case ')':
+        type = token-&gt;type;
+        break;
</ins><span class="cx"> 
</span><del>-      default: break;
</del><ins>+      default:
+        break;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Advance to the next token if the current one is valid.
</span><del>-    if (type != 0) context-&gt;lexer-&gt;lex(token);
</del><ins>+    if (type != 0)
+        context-&gt;lexer-&gt;lex(token);
</ins><span class="cx"> 
</span><span class="cx">     return type;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void yyerror(Context* context, const char* reason)
</del><ins>+void yyerror(Context *context, const char *reason)
</ins><span class="cx"> {
</span><span class="cx">     context-&gt;diagnostics-&gt;report(pp::Diagnostics::PP_INVALID_EXPRESSION,
</span><span class="cx">                                  context-&gt;token-&gt;location,
</span><span class="lines">@@ -255,13 +274,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace pp {
</span><span class="cx"> 
</span><del>-ExpressionParser::ExpressionParser(Lexer* lexer, Diagnostics* diagnostics) :
-    mLexer(lexer),
-    mDiagnostics(diagnostics)
</del><ins>+ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
+    : mLexer(lexer),
+      mDiagnostics(diagnostics)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool ExpressionParser::parse(Token* token, int* result)
</del><ins>+bool ExpressionParser::parse(Token *token, int *result)
</ins><span class="cx"> {
</span><span class="cx">     Context context;
</span><span class="cx">     context.diagnostics = mDiagnostics;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorInputcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -17,7 +17,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Input::Input(size_t count, const char* const string[], const int length[]) :
</del><ins>+Input::Input(size_t count, const char *const string[], const int length[]) :
</ins><span class="cx">     mCount(count),
</span><span class="cx">     mString(string)
</span><span class="cx"> {
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-size_t Input::read(char* buf, size_t maxSize)
</del><ins>+size_t Input::read(char *buf, size_t maxSize)
</ins><span class="cx"> {
</span><span class="cx">     size_t nRead = 0;
</span><span class="cx">     while ((nRead &lt; maxSize) &amp;&amp; (mReadLoc.sIndex &lt; mCount))
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorInputh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Input.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -18,32 +18,45 @@
</span><span class="cx"> {
</span><span class="cx">   public:
</span><span class="cx">     Input();
</span><del>-    Input(size_t count, const char* const string[], const int length[]);
</del><ins>+    Input(size_t count, const char *const string[], const int length[]);
</ins><span class="cx"> 
</span><del>-    size_t count() const { return mCount; }
-    const char* string(size_t index) const { return mString[index]; }
-    size_t length(size_t index) const { return mLength[index]; }
</del><ins>+    size_t count() const
+    {
+        return mCount;
+    }
+    const char *string(size_t index) const
+    {
+        return mString[index];
+    }
+    size_t length(size_t index) const
+    {
+        return mLength[index];
+    }
</ins><span class="cx"> 
</span><del>-    size_t read(char* buf, size_t maxSize);
</del><ins>+    size_t read(char *buf, size_t maxSize);
</ins><span class="cx"> 
</span><span class="cx">     struct Location
</span><span class="cx">     {
</span><span class="cx">         size_t sIndex;  // String index;
</span><span class="cx">         size_t cIndex;  // Char index.
</span><span class="cx"> 
</span><del>-        Location() : sIndex(0), cIndex(0) { }
</del><ins>+        Location()
+            : sIndex(0),
+              cIndex(0)
+        {
+        }
</ins><span class="cx">     };
</span><del>-    const Location&amp; readLoc() const { return mReadLoc; }
</del><ins>+    const Location &amp;readLoc() const { return mReadLoc; }
</ins><span class="cx"> 
</span><span class="cx">   private:
</span><span class="cx">     // Input.
</span><span class="cx">     size_t mCount;
</span><del>-    const char* const* mString;
</del><ins>+    const char * const *mString;
</ins><span class="cx">     std::vector&lt;size_t&gt; mLength;
</span><span class="cx"> 
</span><span class="cx">     Location mReadLoc;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><ins>+
</ins><span class="cx"> #endif  // COMPILER_PREPROCESSOR_INPUT_H_
</span><del>-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorLexerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Lexer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -17,9 +17,9 @@
</span><span class="cx">   public:
</span><span class="cx">     virtual ~Lexer();
</span><span class="cx"> 
</span><del>-    virtual void lex(Token* token) = 0;
</del><ins>+    virtual void lex(Token *token) = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><ins>+
</ins><span class="cx"> #endif  // COMPILER_PREPROCESSOR_LEXER_H_
</span><del>-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacrocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx"> namespace pp
</span><span class="cx"> {
</span><span class="cx"> 
</span><del>-bool Macro::equals(const Macro&amp; other) const
</del><ins>+bool Macro::equals(const Macro &amp;other) const
</ins><span class="cx"> {
</span><span class="cx">     return (type == other.type) &amp;&amp;
</span><span class="cx">            (name == other.name) &amp;&amp;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacroh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Macro.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -26,8 +26,13 @@
</span><span class="cx">     typedef std::vector&lt;std::string&gt; Parameters;
</span><span class="cx">     typedef std::vector&lt;Token&gt; Replacements;
</span><span class="cx"> 
</span><del>-    Macro() : predefined(false), disabled(false), type(kTypeObj) { }
-    bool equals(const Macro&amp; other) const;
</del><ins>+    Macro()
+        : predefined(false),
+          disabled(false),
+          type(kTypeObj)
+    {
+    }
+    bool equals(const Macro &amp;other) const;
</ins><span class="cx"> 
</span><span class="cx">     bool predefined;
</span><span class="cx">     mutable bool disabled;
</span><span class="lines">@@ -41,4 +46,5 @@
</span><span class="cx"> typedef std::map&lt;std::string, Macro&gt; MacroSet;
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><ins>+
</ins><span class="cx"> #endif  // COMPILER_PREPROCESSOR_MACRO_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacroExpandercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -20,13 +20,13 @@
</span><span class="cx">  public:
</span><span class="cx">     typedef std::vector&lt;Token&gt; TokenVector;
</span><span class="cx"> 
</span><del>-    TokenLexer(TokenVector* tokens)
</del><ins>+    TokenLexer(TokenVector *tokens)
</ins><span class="cx">     {
</span><span class="cx">         tokens-&gt;swap(mTokens);
</span><span class="cx">         mIter = mTokens.begin();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    virtual void lex(Token* token)
</del><ins>+    virtual void lex(Token *token)
</ins><span class="cx">     {
</span><span class="cx">         if (mIter == mTokens.end())
</span><span class="cx">         {
</span><span class="lines">@@ -46,12 +46,12 @@
</span><span class="cx">     TokenVector::const_iterator mIter;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-MacroExpander::MacroExpander(Lexer* lexer,
-                             MacroSet* macroSet,
-                             Diagnostics* diagnostics) :
-    mLexer(lexer),
-    mMacroSet(macroSet),
-    mDiagnostics(diagnostics)
</del><ins>+MacroExpander::MacroExpander(Lexer *lexer,
+                             MacroSet *macroSet,
+                             Diagnostics *diagnostics)
+    : mLexer(lexer),
+      mMacroSet(macroSet),
+      mDiagnostics(diagnostics)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MacroExpander::lex(Token* token)
</del><ins>+void MacroExpander::lex(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     while (true)
</span><span class="cx">     {
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MacroExpander::getToken(Token* token)
</del><ins>+void MacroExpander::getToken(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     if (mReserveToken.get())
</span><span class="cx">     {
</span><span class="lines">@@ -122,11 +122,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MacroExpander::ungetToken(const Token&amp; token)
</del><ins>+void MacroExpander::ungetToken(const Token &amp;token)
</ins><span class="cx"> {
</span><span class="cx">     if (!mContextStack.empty())
</span><span class="cx">     {
</span><del>-        MacroContext* context = mContextStack.back();
</del><ins>+        MacroContext *context = mContextStack.back();
</ins><span class="cx">         context-&gt;unget();
</span><span class="cx">         assert(context-&gt;replacements[context-&gt;index] == token);
</span><span class="cx">     }
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx">     return lparen;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MacroExpander::pushMacro(const Macro&amp; macro, const Token&amp; identifier)
</del><ins>+bool MacroExpander::pushMacro(const Macro &amp;macro, const Token &amp;identifier)
</ins><span class="cx"> {
</span><span class="cx">     assert(!macro.disabled);
</span><span class="cx">     assert(!identifier.expansionDisabled());
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx">     // Macro is disabled for expansion until it is popped off the stack.
</span><span class="cx">     macro.disabled = true;
</span><span class="cx"> 
</span><del>-    MacroContext* context = new MacroContext;
</del><ins>+    MacroContext *context = new MacroContext;
</ins><span class="cx">     context-&gt;macro = &amp;macro;
</span><span class="cx">     context-&gt;replacements.swap(replacements);
</span><span class="cx">     mContextStack.push_back(context);
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx"> {
</span><span class="cx">     assert(!mContextStack.empty());
</span><span class="cx"> 
</span><del>-    MacroContext* context = mContextStack.back();
</del><ins>+    MacroContext *context = mContextStack.back();
</ins><span class="cx">     mContextStack.pop_back();
</span><span class="cx"> 
</span><span class="cx">     assert(context-&gt;empty());
</span><span class="lines">@@ -182,9 +182,9 @@
</span><span class="cx">     delete context;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MacroExpander::expandMacro(const Macro&amp; macro,
-                                const Token&amp; identifier,
-                                std::vector&lt;Token&gt;* replacements)
</del><ins>+bool MacroExpander::expandMacro(const Macro &amp;macro,
+                                const Token &amp;identifier,
+                                std::vector&lt;Token&gt; *replacements)
</ins><span class="cx"> {
</span><span class="cx">     replacements-&gt;clear();
</span><span class="cx">     if (macro.type == Macro::kTypeObj)
</span><span class="lines">@@ -194,8 +194,8 @@
</span><span class="cx"> 
</span><span class="cx">         if (macro.predefined)
</span><span class="cx">         {
</span><del>-            static const std::string kLine = &quot;__LINE__&quot;;
-            static const std::string kFile = &quot;__FILE__&quot;;
</del><ins>+            const char kLine[] = &quot;__LINE__&quot;;
+            const char kFile[] = &quot;__FILE__&quot;;
</ins><span class="cx"> 
</span><span class="cx">             assert(replacements-&gt;size() == 1);
</span><span class="cx">             Token&amp; repl = replacements-&gt;front();
</span><span class="lines">@@ -239,9 +239,9 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MacroExpander::collectMacroArgs(const Macro&amp; macro,
-                                     const Token&amp; identifier,
-                                     std::vector&lt;MacroArg&gt;* args)
</del><ins>+bool MacroExpander::collectMacroArgs(const Macro &amp;macro,
+                                     const Token &amp;identifier,
+                                     std::vector&lt;MacroArg&gt; *args)
</ins><span class="cx"> {
</span><span class="cx">     Token token;
</span><span class="cx">     getToken(&amp;token);
</span><span class="lines">@@ -276,7 +276,8 @@
</span><span class="cx">             // The individual arguments are separated by comma tokens, but
</span><span class="cx">             // the comma tokens between matching inner parentheses do not
</span><span class="cx">             // seperate arguments.
</span><del>-            if (openParens == 1) args-&gt;push_back(MacroArg());
</del><ins>+            if (openParens == 1)
+                args-&gt;push_back(MacroArg());
</ins><span class="cx">             isArg = openParens != 1;
</span><span class="cx">             break;
</span><span class="cx">           default:
</span><span class="lines">@@ -285,14 +286,15 @@
</span><span class="cx">         }
</span><span class="cx">         if (isArg)
</span><span class="cx">         {
</span><del>-            MacroArg&amp; arg = args-&gt;back();
</del><ins>+            MacroArg &amp;arg = args-&gt;back();
</ins><span class="cx">             // Initial whitespace is not part of the argument.
</span><del>-            if (arg.empty()) token.setHasLeadingSpace(false);
</del><ins>+            if (arg.empty())
+                token.setHasLeadingSpace(false);
</ins><span class="cx">             arg.push_back(token);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const Macro::Parameters&amp; params = macro.parameters;
</del><ins>+    const Macro::Parameters &amp;params = macro.parameters;
</ins><span class="cx">     // If there is only one empty argument, it is equivalent to no argument.
</span><span class="cx">     if (params.empty() &amp;&amp; (args-&gt;size() == 1) &amp;&amp; args-&gt;front().empty())
</span><span class="cx">     {
</span><span class="lines">@@ -313,7 +315,7 @@
</span><span class="cx">     // inserted into the macro body.
</span><span class="cx">     for (std::size_t i = 0; i &lt; args-&gt;size(); ++i)
</span><span class="cx">     {
</span><del>-        MacroArg&amp; arg = args-&gt;at(i);
</del><ins>+        MacroArg &amp;arg = args-&gt;at(i);
</ins><span class="cx">         TokenLexer lexer(&amp;arg);
</span><span class="cx">         MacroExpander expander(&amp;lexer, mMacroSet, mDiagnostics);
</span><span class="cx"> 
</span><span class="lines">@@ -328,13 +330,13 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MacroExpander::replaceMacroParams(const Macro&amp; macro,
-                                       const std::vector&lt;MacroArg&gt;&amp; args,
-                                       std::vector&lt;Token&gt;* replacements)
</del><ins>+void MacroExpander::replaceMacroParams(const Macro &amp;macro,
+                                       const std::vector&lt;MacroArg&gt; &amp;args,
+                                       std::vector&lt;Token&gt; *replacements)
</ins><span class="cx"> {
</span><span class="cx">     for (std::size_t i = 0; i &lt; macro.replacements.size(); ++i)
</span><span class="cx">     {
</span><del>-        const Token&amp; repl = macro.replacements[i];
</del><ins>+        const Token &amp;repl = macro.replacements[i];
</ins><span class="cx">         if (repl.type != Token::IDENTIFIER)
</span><span class="cx">         {
</span><span class="cx">             replacements-&gt;push_back(repl);
</span><span class="lines">@@ -353,7 +355,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         std::size_t iArg = std::distance(macro.parameters.begin(), iter);
</span><del>-        const MacroArg&amp; arg = args[iArg];
</del><ins>+        const MacroArg &amp;arg = args[iArg];
</ins><span class="cx">         if (arg.empty())
</span><span class="cx">         {
</span><span class="cx">             continue;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorMacroExpanderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/MacroExpander.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
-#define COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
</del><ins>+#ifndef COMPILER_PREPROCESSOR_MACROEXPANDER_H_
+#define COMPILER_PREPROCESSOR_MACROEXPANDER_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;cassert&gt;
</span><span class="cx"> #include &lt;memory&gt;
</span><span class="lines">@@ -23,53 +23,67 @@
</span><span class="cx"> class MacroExpander : public Lexer
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    MacroExpander(Lexer* lexer, MacroSet* macroSet, Diagnostics* diagnostics);
</del><ins>+    MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics);
</ins><span class="cx">     virtual ~MacroExpander();
</span><span class="cx"> 
</span><del>-    virtual void lex(Token* token);
</del><ins>+    virtual void lex(Token *token);
</ins><span class="cx"> 
</span><span class="cx">   private:
</span><span class="cx">     PP_DISALLOW_COPY_AND_ASSIGN(MacroExpander);
</span><span class="cx"> 
</span><del>-    void getToken(Token* token);
-    void ungetToken(const Token&amp; token);
</del><ins>+    void getToken(Token *token);
+    void ungetToken(const Token &amp;token);
</ins><span class="cx">     bool isNextTokenLeftParen();
</span><span class="cx"> 
</span><del>-    bool pushMacro(const Macro&amp; macro, const Token&amp; identifier);
</del><ins>+    bool pushMacro(const Macro &amp;macro, const Token &amp;identifier);
</ins><span class="cx">     void popMacro();
</span><span class="cx"> 
</span><del>-    bool expandMacro(const Macro&amp; macro,
-                     const Token&amp; identifier,
-                     std::vector&lt;Token&gt;* replacements);
</del><ins>+    bool expandMacro(const Macro &amp;macro,
+                     const Token &amp;identifier,
+                     std::vector&lt;Token&gt; *replacements);
</ins><span class="cx"> 
</span><span class="cx">     typedef std::vector&lt;Token&gt; MacroArg;
</span><del>-    bool collectMacroArgs(const Macro&amp; macro,
-                          const Token&amp; identifier,
-                          std::vector&lt;MacroArg&gt;* args);
-    void replaceMacroParams(const Macro&amp; macro,
-                            const std::vector&lt;MacroArg&gt;&amp; args,
-                            std::vector&lt;Token&gt;* replacements);
</del><ins>+    bool collectMacroArgs(const Macro &amp;macro,
+                          const Token &amp;identifier,
+                          std::vector&lt;MacroArg&gt; *args);
+    void replaceMacroParams(const Macro &amp;macro,
+                            const std::vector&lt;MacroArg&gt; &amp;args,
+                            std::vector&lt;Token&gt; *replacements);
</ins><span class="cx"> 
</span><span class="cx">     struct MacroContext
</span><span class="cx">     {
</span><del>-        const Macro* macro;
</del><ins>+        const Macro *macro;
</ins><span class="cx">         std::size_t index;
</span><span class="cx">         std::vector&lt;Token&gt; replacements;
</span><span class="cx"> 
</span><del>-        MacroContext() : macro(0), index(0) { }
-        bool empty() const { return index == replacements.size(); }
-        const Token&amp; get() { return replacements[index++]; }
-        void unget() { assert(index &gt; 0); --index; }
</del><ins>+        MacroContext()
+            : macro(0),
+              index(0)
+        {
+        }
+        bool empty() const
+        {
+            return index == replacements.size();
+        }
+        const Token &amp;get()
+        {
+            return replacements[index++];
+        }
+        void unget()
+        {
+            assert(index &gt; 0);
+            --index;
+        }
</ins><span class="cx">     };
</span><span class="cx"> 
</span><del>-    Lexer* mLexer;
-    MacroSet* mMacroSet;
-    Diagnostics* mDiagnostics;
</del><ins>+    Lexer *mLexer;
+    MacroSet *mMacroSet;
+    Diagnostics *mDiagnostics;
</ins><span class="cx"> 
</span><span class="cx">     std::auto_ptr&lt;Token&gt; mReserveToken;
</span><del>-    std::vector&lt;MacroContext*&gt; mContextStack;
</del><ins>+    std::vector&lt;MacroContext *&gt; mContextStack;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><del>-#endif  // COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
</del><span class="cx"> 
</span><ins>+#endif  // COMPILER_PREPROCESSOR_MACROEXPANDER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorPreprocessorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -21,24 +21,24 @@
</span><span class="cx"> 
</span><span class="cx"> struct PreprocessorImpl
</span><span class="cx"> {
</span><del>-    Diagnostics* diagnostics;
</del><ins>+    Diagnostics *diagnostics;
</ins><span class="cx">     MacroSet macroSet;
</span><span class="cx">     Tokenizer tokenizer;
</span><span class="cx">     DirectiveParser directiveParser;
</span><span class="cx">     MacroExpander macroExpander;
</span><span class="cx"> 
</span><del>-    PreprocessorImpl(Diagnostics* diag,
-                     DirectiveHandler* directiveHandler) :
-        diagnostics(diag),
-        tokenizer(diag),
-        directiveParser(&amp;tokenizer, &amp;macroSet, diag, directiveHandler),
-        macroExpander(&amp;directiveParser, &amp;macroSet, diag)
</del><ins>+    PreprocessorImpl(Diagnostics *diag,
+                     DirectiveHandler *directiveHandler)
+        : diagnostics(diag),
+          tokenizer(diag),
+          directiveParser(&amp;tokenizer, &amp;macroSet, diag, directiveHandler),
+          macroExpander(&amp;directiveParser, &amp;macroSet, diag)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-Preprocessor::Preprocessor(Diagnostics* diagnostics,
-                           DirectiveHandler* directiveHandler)
</del><ins>+Preprocessor::Preprocessor(Diagnostics *diagnostics,
+                           DirectiveHandler *directiveHandler)
</ins><span class="cx"> {
</span><span class="cx">     mImpl = new PreprocessorImpl(diagnostics, directiveHandler);
</span><span class="cx"> }
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool Preprocessor::init(size_t count,
</span><del>-                        const char* const string[],
</del><ins>+                        const char * const string[],
</ins><span class="cx">                         const int length[])
</span><span class="cx"> {
</span><span class="cx">     static const int kGLSLVersion = 100;
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     return mImpl-&gt;tokenizer.init(count, string, length);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Preprocessor::predefineMacro(const char* name, int value)
</del><ins>+void Preprocessor::predefineMacro(const char *name, int value)
</ins><span class="cx"> {
</span><span class="cx">     std::ostringstream stream;
</span><span class="cx">     stream &lt;&lt; value;
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     mImpl-&gt;macroSet[name] = macro;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Preprocessor::lex(Token* token)
</del><ins>+void Preprocessor::lex(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     bool validToken = false;
</span><span class="cx">     while (!validToken)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorPreprocessorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Preprocessor.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> class Preprocessor
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    Preprocessor(Diagnostics* diagnostics, DirectiveHandler* directiveHandler);
</del><ins>+    Preprocessor(Diagnostics *diagnostics, DirectiveHandler *directiveHandler);
</ins><span class="cx">     ~Preprocessor();
</span><span class="cx"> 
</span><span class="cx">     // count: specifies the number of elements in the string and length arrays.
</span><span class="lines">@@ -34,11 +34,11 @@
</span><span class="cx">     // Each element in the length array may contain the length of the
</span><span class="cx">     // corresponding string or a value less than 0 to indicate that the string
</span><span class="cx">     // is null terminated.
</span><del>-    bool init(size_t count, const char* const string[], const int length[]);
</del><ins>+    bool init(size_t count, const char * const string[], const int length[]);
</ins><span class="cx">     // Adds a pre-defined macro.
</span><del>-    void predefineMacro(const char* name, int value);
</del><ins>+    void predefineMacro(const char *name, int value);
</ins><span class="cx"> 
</span><del>-    void lex(Token* token);
</del><ins>+    void lex(Token *token);
</ins><span class="cx"> 
</span><span class="cx">     // Set maximum preprocessor token size
</span><span class="cx">     void setMaxTokenSize(size_t maxTokenSize);
</span><span class="lines">@@ -46,9 +46,9 @@
</span><span class="cx">   private:
</span><span class="cx">     PP_DISALLOW_COPY_AND_ASSIGN(Preprocessor);
</span><span class="cx"> 
</span><del>-    PreprocessorImpl* mImpl;
</del><ins>+    PreprocessorImpl *mImpl;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><ins>+
</ins><span class="cx"> #endif  // COMPILER_PREPROCESSOR_PREPROCESSOR_H_
</span><del>-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorSourceLocationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/SourceLocation.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/SourceLocation.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/SourceLocation.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,18 +4,26 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
-#define COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
</del><ins>+#ifndef COMPILER_PREPROCESSOR_SOURCELOCATION_H_
+#define COMPILER_PREPROCESSOR_SOURCELOCATION_H_
</ins><span class="cx"> 
</span><span class="cx"> namespace pp
</span><span class="cx"> {
</span><span class="cx"> 
</span><span class="cx"> struct SourceLocation
</span><span class="cx"> {
</span><del>-    SourceLocation() : file(0), line(0) { }
-    SourceLocation(int f, int l) : file(f), line(l) { }
</del><ins>+    SourceLocation()
+        : file(0),
+          line(0)
+    {
+    }
+    SourceLocation(int f, int l)
+        : file(f),
+          line(l)
+    {
+    }
</ins><span class="cx"> 
</span><del>-    bool equals(const SourceLocation&amp; other) const
</del><ins>+    bool equals(const SourceLocation &amp;other) const
</ins><span class="cx">     {
</span><span class="cx">         return (file == other.file) &amp;&amp; (line == other.line);
</span><span class="cx">     }
</span><span class="lines">@@ -24,15 +32,16 @@
</span><span class="cx">     int line;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool operator==(const SourceLocation&amp; lhs, const SourceLocation&amp; rhs)
</del><ins>+inline bool operator==(const SourceLocation &amp;lhs, const SourceLocation &amp;rhs)
</ins><span class="cx"> {
</span><span class="cx">     return lhs.equals(rhs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool operator!=(const SourceLocation&amp; lhs, const SourceLocation&amp; rhs)
</del><ins>+inline bool operator!=(const SourceLocation &amp;lhs, const SourceLocation &amp;rhs)
</ins><span class="cx"> {
</span><span class="cx">     return !lhs.equals(rhs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><del>-#endif  // COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
</del><ins>+
+#endif  // COMPILER_PREPROCESSOR_SOURCELOCATION_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -21,7 +21,7 @@
</span><span class="cx">     text.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Token::equals(const Token&amp; other) const
</del><ins>+bool Token::equals(const Token &amp;other) const
</ins><span class="cx"> {
</span><span class="cx">     return (type == other.type) &amp;&amp;
</span><span class="cx">            (flags == other.flags) &amp;&amp;
</span><span class="lines">@@ -53,25 +53,25 @@
</span><span class="cx">         flags &amp;= ~EXPANSION_DISABLED;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Token::iValue(int* value) const
</del><ins>+bool Token::iValue(int *value) const
</ins><span class="cx"> {
</span><span class="cx">     assert(type == CONST_INT);
</span><span class="cx">     return numeric_lex_int(text, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Token::uValue(unsigned int* value) const
</del><ins>+bool Token::uValue(unsigned int *value) const
</ins><span class="cx"> {
</span><span class="cx">     assert(type == CONST_INT);
</span><span class="cx">     return numeric_lex_int(text, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Token::fValue(float* value) const
</del><ins>+bool Token::fValue(float *value) const
</ins><span class="cx"> {
</span><span class="cx">     assert(type == CONST_FLOAT);
</span><span class="cx">     return numeric_lex_float(text, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::ostream&amp; operator&lt;&lt;(std::ostream&amp; out, const Token&amp; token)
</del><ins>+std::ostream &amp;operator&lt;&lt;(std::ostream &amp;out, const Token &amp;token)
</ins><span class="cx"> {
</span><span class="cx">     if (token.hasLeadingSpace())
</span><span class="cx">         out &lt;&lt; &quot; &quot;;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Token.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -62,27 +62,40 @@
</span><span class="cx">         EXPANSION_DISABLED = 1 &lt;&lt; 2
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    Token() : type(0), flags(0) { }
</del><ins>+    Token()
+        : type(0),
+          flags(0)
+    {
+    }
</ins><span class="cx"> 
</span><span class="cx">     void reset();
</span><del>-    bool equals(const Token&amp; other) const;
</del><ins>+    bool equals(const Token &amp;other) const;
</ins><span class="cx"> 
</span><span class="cx">     // Returns true if this is the first token on line.
</span><span class="cx">     // It disregards any leading whitespace.
</span><del>-    bool atStartOfLine() const { return (flags &amp; AT_START_OF_LINE) != 0; }
</del><ins>+    bool atStartOfLine() const
+    {
+        return (flags &amp; AT_START_OF_LINE) != 0;
+    }
</ins><span class="cx">     void setAtStartOfLine(bool start);
</span><span class="cx"> 
</span><del>-    bool hasLeadingSpace() const { return (flags &amp; HAS_LEADING_SPACE) != 0; }
</del><ins>+    bool hasLeadingSpace() const
+    {
+        return (flags &amp; HAS_LEADING_SPACE) != 0;
+    }
</ins><span class="cx">     void setHasLeadingSpace(bool space);
</span><span class="cx"> 
</span><del>-    bool expansionDisabled() const { return (flags &amp; EXPANSION_DISABLED) != 0; }
</del><ins>+    bool expansionDisabled() const
+    {
+        return (flags &amp; EXPANSION_DISABLED) != 0;
+    }
</ins><span class="cx">     void setExpansionDisabled(bool disable);
</span><span class="cx"> 
</span><span class="cx">     // Converts text into numeric value for CONST_INT and CONST_FLOAT token.
</span><span class="cx">     // Returns false if the parsed value cannot fit into an int or float.
</span><del>-    bool iValue(int* value) const;
-    bool uValue(unsigned int* value) const;
-    bool fValue(float* value) const;
</del><ins>+    bool iValue(int *value) const;
+    bool uValue(unsigned int *value) const;
+    bool fValue(float *value) const;
</ins><span class="cx"> 
</span><span class="cx">     int type;
</span><span class="cx">     unsigned int flags;
</span><span class="lines">@@ -90,17 +103,18 @@
</span><span class="cx">     std::string text;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline bool operator==(const Token&amp; lhs, const Token&amp; rhs)
</del><ins>+inline bool operator==(const Token &amp;lhs, const Token &amp;rhs)
</ins><span class="cx"> {
</span><span class="cx">     return lhs.equals(rhs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool operator!=(const Token&amp; lhs, const Token&amp; rhs)
</del><ins>+inline bool operator!=(const Token &amp;lhs, const Token &amp;rhs)
</ins><span class="cx"> {
</span><span class="cx">     return !lhs.equals(rhs);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-extern std::ostream&amp; operator&lt;&lt;(std::ostream&amp; out, const Token&amp; token);
</del><ins>+extern std::ostream &amp;operator&lt;&lt;(std::ostream &amp;out, const Token &amp;token);
</ins><span class="cx"> 
</span><span class="cx"> }  // namepsace pp
</span><ins>+
</ins><span class="cx"> #endif  // COMPILER_PREPROCESSOR_TOKEN_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,6 +6,11 @@
</span><span class="cx"> //
</span><span class="cx"> 
</span><span class="cx"> // This file is auto-generated by generate_parser.sh. DO NOT EDIT!
</span><ins>+// This file was edited anyways to ignore clang warnings.
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma GCC diagnostic ignored &quot;-Wunneeded-internal-declaration&quot;
+#endif
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -18,7 +23,7 @@
</span><span class="cx"> #define FLEX_SCANNER
</span><span class="cx"> #define YY_FLEX_MAJOR_VERSION 2
</span><span class="cx"> #define YY_FLEX_MINOR_VERSION 5
</span><del>-#define YY_FLEX_SUBMINOR_VERSION 37
</del><ins>+#define YY_FLEX_SUBMINOR_VERSION 39
</ins><span class="cx"> #if YY_FLEX_SUBMINOR_VERSION &gt; 0
</span><span class="cx"> #define FLEX_BETA
</span><span class="cx"> #endif
</span><span class="lines">@@ -196,6 +201,7 @@
</span><span class="cx"> #define EOB_ACT_LAST_MATCH 2
</span><span class="cx"> 
</span><span class="cx">     #define YY_LESS_LINENO(n)
</span><ins>+    #define YY_LINENO_REWIND_TO(ptr)
</ins><span class="cx">     
</span><span class="cx"> /* Return all but the first &quot;n&quot; matched characters back to the input stream. */
</span><span class="cx"> #define yyless(n) \
</span><span class="lines">@@ -539,6 +545,10 @@
</span><span class="cx"> IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
</span><span class="cx"> */
</span><span class="cx"> 
</span><ins>+#if defined(_MSC_VER)
+#pragma warning(disable: 4005)
+#endif
+
</ins><span class="cx"> #include &quot;Tokenizer.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DiagnosticsBase.h&quot;
</span><span class="lines">@@ -547,13 +557,16 @@
</span><span class="cx"> #if defined(__GNUC__)
</span><span class="cx"> // Triggered by the auto-generated yy_fatal_error function.
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wmissing-noreturn&quot;
</span><ins>+#elif defined(_MSC_VER)
+#pragma warning(disable: 4244)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
</del><ins>+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus &gt; 199711L
+#define register
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> typedef std::string YYSTYPE;
</span><span class="cx"> typedef pp::SourceLocation YYLTYPE;
</span><span class="lines">@@ -704,8 +717,6 @@
</span><span class="cx"> static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#define YY_NO_INPUT
-
</del><span class="cx"> #ifndef YY_NO_INPUT
</span><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span><span class="lines">@@ -822,8 +833,6 @@
</span><span class="cx">         register int yy_act;
</span><span class="cx">     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx"> 
</span><del>-    /* Line comment */
-
</del><span class="cx">     yylval = yylval_param;
</span><span class="cx"> 
</span><span class="cx">     yylloc = yylloc_param;
</span><span class="lines">@@ -854,6 +863,10 @@
</span><span class="cx">                 pp_load_buffer_state(yyscanner );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><ins>+        {
+
+    /* Line comment */
+
</ins><span class="cx">         while ( 1 )                /* loops until end-of-file is reached */
</span><span class="cx">                 {
</span><span class="cx">                 yy_cp = yyg-&gt;yy_c_buf_p;
</span><span class="lines">@@ -870,7 +883,7 @@
</span><span class="cx"> yy_match:
</span><span class="cx">                 do
</span><span class="cx">                         {
</span><del>-                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
</del><ins>+                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
</ins><span class="cx">                         if ( yy_accept[yy_current_state] )
</span><span class="cx">                                 {
</span><span class="cx">                                 yyg-&gt;yy_last_accepting_state = yy_current_state;
</span><span class="lines">@@ -911,7 +924,7 @@
</span><span class="cx">         YY_BREAK
</span><span class="cx"> /* Block comment */
</span><span class="cx"> /* Line breaks are just counted - not returned. */
</span><del>-/* The comment is replaced by a single space. */ 
</del><ins>+/* The comment is replaced by a single space. */
</ins><span class="cx"> case 2:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { BEGIN(COMMENT); }
</span><span class="lines">@@ -1315,6 +1328,7 @@
</span><span class="cx">                         &quot;fatal flex scanner internal error--no action found&quot; );
</span><span class="cx">         } /* end of action switch */
</span><span class="cx">                 } /* end of scanning one token */
</span><ins>+        } /* end of user's declarations */
</ins><span class="cx"> } /* end of pplex */
</span><span class="cx"> 
</span><span class="cx"> /* yy_get_next_buffer - try to read in a new buffer
</span><span class="lines">@@ -2322,13 +2336,9 @@
</span><span class="cx"> 
</span><span class="cx"> #define YYTABLES_NAME &quot;yytables&quot;
</span><span class="cx"> 
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
</del><span class="cx"> namespace pp {
</span><span class="cx"> 
</span><del>-Tokenizer::Tokenizer(Diagnostics* diagnostics)
</del><ins>+Tokenizer::Tokenizer(Diagnostics *diagnostics)
</ins><span class="cx">     : mHandle(0),
</span><span class="cx">       mMaxTokenSize(256)
</span><span class="cx"> {
</span><span class="lines">@@ -2340,9 +2350,10 @@
</span><span class="cx">     destroyScanner();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Tokenizer::init(size_t count, const char* const string[], const int length[])
</del><ins>+bool Tokenizer::init(size_t count, const char * const string[], const int length[])
</ins><span class="cx"> {
</span><del>-    if ((count &gt; 0) &amp;&amp; (string == 0)) return false;
</del><ins>+    if ((count &gt; 0) &amp;&amp; (string == 0))
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     mContext.input = Input(count, string, length);
</span><span class="cx">     return initScanner();
</span><span class="lines">@@ -2365,7 +2376,7 @@
</span><span class="cx">     mMaxTokenSize = maxTokenSize;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Tokenizer::lex(Token* token)
</del><ins>+void Tokenizer::lex(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     token-&gt;type = pplex(&amp;token-&gt;text,&amp;token-&gt;location,mHandle);
</span><span class="cx">     if (token-&gt;text.size() &gt; mMaxTokenSize)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -21,7 +21,7 @@
</span><span class="cx">   public:
</span><span class="cx">     struct Context
</span><span class="cx">     {
</span><del>-        Diagnostics* diagnostics;
</del><ins>+        Diagnostics *diagnostics;
</ins><span class="cx"> 
</span><span class="cx">         Input input;
</span><span class="cx">         // The location where yytext points to. Token location should track
</span><span class="lines">@@ -33,27 +33,27 @@
</span><span class="cx">         bool lineStart;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    Tokenizer(Diagnostics* diagnostics);
</del><ins>+    Tokenizer(Diagnostics *diagnostics);
</ins><span class="cx">     ~Tokenizer();
</span><span class="cx"> 
</span><del>-    bool init(size_t count, const char* const string[], const int length[]);
</del><ins>+    bool init(size_t count, const char * const string[], const int length[]);
</ins><span class="cx"> 
</span><span class="cx">     void setFileNumber(int file);
</span><span class="cx">     void setLineNumber(int line);
</span><span class="cx">     void setMaxTokenSize(size_t maxTokenSize);
</span><span class="cx"> 
</span><del>-    virtual void lex(Token* token);
</del><ins>+    virtual void lex(Token *token);
</ins><span class="cx"> 
</span><span class="cx">   private:
</span><span class="cx">     PP_DISALLOW_COPY_AND_ASSIGN(Tokenizer);
</span><span class="cx">     bool initScanner();
</span><span class="cx">     void destroyScanner();
</span><span class="cx"> 
</span><del>-    void* mHandle;  // Scanner handle.
</del><ins>+    void *mHandle;  // Scanner handle.
</ins><span class="cx">     Context mContext;  // Scanner extra.
</span><span class="cx">     size_t mMaxTokenSize; // Maximum token size
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace pp
</span><ins>+
</ins><span class="cx"> #endif  // COMPILER_PREPROCESSOR_TOKENIZER_H_
</span><del>-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorTokenizerl"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/Tokenizer.l        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -23,6 +23,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> %{
</span><ins>+#if defined(_MSC_VER)
+#pragma warning(disable: 4005)
+#endif
+
</ins><span class="cx"> #include &quot;Tokenizer.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DiagnosticsBase.h&quot;
</span><span class="lines">@@ -31,13 +35,16 @@
</span><span class="cx"> #if defined(__GNUC__)
</span><span class="cx"> // Triggered by the auto-generated yy_fatal_error function.
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wmissing-noreturn&quot;
</span><ins>+#elif defined(_MSC_VER)
+#pragma warning(disable: 4244)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
</del><ins>+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus &gt; 199711L
+#define register
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> typedef std::string YYSTYPE;
</span><span class="cx"> typedef pp::SourceLocation YYLTYPE;
</span><span class="lines">@@ -99,7 +106,7 @@
</span><span class="cx"> 
</span><span class="cx">     /* Block comment */
</span><span class="cx">     /* Line breaks are just counted - not returned. */
</span><del>-    /* The comment is replaced by a single space. */ 
</del><ins>+    /* The comment is replaced by a single space. */
</ins><span class="cx"> &quot;/*&quot; { BEGIN(COMMENT); }
</span><span class="cx"> &lt;COMMENT&gt;[^*\r\n]+
</span><span class="cx"> &lt;COMMENT&gt;&quot;*&quot;
</span><span class="lines">@@ -271,13 +278,11 @@
</span><span class="cx"> 
</span><span class="cx"> %%
</span><span class="cx"> 
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
</del><span class="cx"> namespace pp {
</span><span class="cx"> 
</span><del>-Tokenizer::Tokenizer(Diagnostics* diagnostics) : mHandle(0)
</del><ins>+Tokenizer::Tokenizer(Diagnostics *diagnostics)
+    : mHandle(0),
+      mMaxTokenSize(256)
</ins><span class="cx"> {
</span><span class="cx">     mContext.diagnostics = diagnostics;
</span><span class="cx"> }
</span><span class="lines">@@ -287,9 +292,10 @@
</span><span class="cx">     destroyScanner();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool Tokenizer::init(size_t count, const char* const string[], const int length[])
</del><ins>+bool Tokenizer::init(size_t count, const char * const string[], const int length[])
</ins><span class="cx"> {
</span><del>-    if ((count &gt; 0) &amp;&amp; (string == 0)) return false;
</del><ins>+    if ((count &gt; 0) &amp;&amp; (string == 0))
+        return false;
</ins><span class="cx"> 
</span><span class="cx">     mContext.input = Input(count, string, length);
</span><span class="cx">     return initScanner();
</span><span class="lines">@@ -312,7 +318,7 @@
</span><span class="cx">     mMaxTokenSize = maxTokenSize;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Tokenizer::lex(Token* token)
</del><ins>+void Tokenizer::lex(Token *token)
</ins><span class="cx"> {
</span><span class="cx">     token-&gt;type = yylex(&amp;token-&gt;text, &amp;token-&gt;location, mHandle);
</span><span class="cx">     if (token-&gt;text.size() &gt; mMaxTokenSize)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessornumeric_lexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/numeric_lex.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,14 +6,14 @@
</span><span class="cx"> 
</span><span class="cx"> // numeric_lex.h: Functions to extract numeric values from string.
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
-#define COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
</del><ins>+#ifndef COMPILER_PREPROCESSOR_NUMERICLEX_H_
+#define COMPILER_PREPROCESSOR_NUMERICLEX_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;sstream&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace pp {
</span><span class="cx"> 
</span><del>-inline std::ios::fmtflags numeric_base_int(const std::string&amp; str)
</del><ins>+inline std::ios::fmtflags numeric_base_int(const std::string &amp;str)
</ins><span class="cx"> {
</span><span class="cx">     if ((str.size() &gt;= 2) &amp;&amp;
</span><span class="cx">         (str[0] == '0') &amp;&amp;
</span><span class="lines">@@ -21,7 +21,7 @@
</span><span class="cx">     {
</span><span class="cx">         return std::ios::hex;
</span><span class="cx">     }
</span><del>-    else if ((str.size() &gt;= 1) &amp;&amp; (str[0] == '0'))
</del><ins>+    if ((str.size() &gt;= 1) &amp;&amp; (str[0] == '0'))
</ins><span class="cx">     {
</span><span class="cx">         return std::ios::oct;
</span><span class="cx">     }
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> // in which case false is returned.
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename IntType&gt;
</span><del>-bool numeric_lex_int(const std::string&amp; str, IntType* value)
</del><ins>+bool numeric_lex_int(const std::string &amp;str, IntType *value)
</ins><span class="cx"> {
</span><span class="cx">     std::istringstream stream(str);
</span><span class="cx">     // This should not be necessary, but MSVS has a buggy implementation.
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename FloatType&gt;
</span><del>-bool numeric_lex_float(const std::string&amp; str, FloatType* value)
</del><ins>+bool numeric_lex_float(const std::string &amp;str, FloatType *value)
</ins><span class="cx"> {
</span><span class="cx">     std::istringstream stream(str);
</span><span class="cx">     // Force &quot;C&quot; locale so that decimal character is always '.', and
</span><span class="lines">@@ -58,4 +58,5 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace pp.
</span><del>-#endif // COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
</del><ins>+
+#endif // COMPILER_PREPROCESSOR_NUMERICLEX_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilerpreprocessorpp_utilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/pp_utils.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/pp_utils.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/preprocessor/pp_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> // A macro to disallow the copy constructor and operator= functions
</span><span class="cx"> // This must be used in the private: declarations for a class.
</span><span class="cx"> #define PP_DISALLOW_COPY_AND_ASSIGN(TypeName) \
</span><del>-  TypeName(const TypeName&amp;);               \
-  void operator=(const TypeName&amp;)
</del><ins>+  TypeName(const TypeName &amp;);               \
+  void operator=(const TypeName &amp;)
</ins><span class="cx"> 
</span><span class="cx"> #endif // COMPILER_PREPROCESSOR_PPUTILS_H_
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslator64bitlexersafetypatch"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/64bit-lexer-safety.patch        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx"> @@ -191,6 +192,11 @@ typedef void* yyscan_t;
</span><span class="cx">  typedef struct yy_buffer_state *YY_BUFFER_STATE;
</span><span class="cx">  #endif
</span><del>- 
</del><ins>+
</ins><span class="cx"> +#ifndef YY_TYPEDEF_YY_SIZE_T
</span><span class="cx"> +#define YY_TYPEDEF_YY_SIZE_T
</span><span class="cx"> +typedef size_t yy_size_t;
</span><span class="lines">@@ -29,36 +29,6 @@
</span><span class="cx">                  for ( yyl = n; yyl &lt; yyleng; ++yyl )\
</span><span class="cx">                      if ( yytext[yyl] == '\n' )\
</span><span class="cx">                          --yylineno;\
</span><del>-@@ -226,11 +232,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;

- #define unput(c) yyunput( c, yyg-&gt;yytext_ptr , yyscanner )

--#ifndef YY_TYPEDEF_YY_SIZE_T
--#define YY_TYPEDEF_YY_SIZE_T
--typedef size_t yy_size_t;
--#endif
--
- #ifndef YY_STRUCT_YY_BUFFER_STATE
- #define YY_STRUCT_YY_BUFFER_STATE
- struct yy_buffer_state
-@@ -248,7 +249,7 @@ struct yy_buffer_state
-         /* Number of characters read into yy_ch_buf, not including EOB
-          * characters.
-          */
--        int yy_n_chars;
-+        yy_size_t yy_n_chars;

-         /* Whether we &quot;own&quot; the buffer - i.e., we know we created it,
-          * and can realloc() it to grow it, and should free() it to
-@@ -327,7 +328,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );

- YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
- YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
--YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
-+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );

- void *yyalloc (yy_size_t ,yyscan_t yyscanner );
- void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
</del><span class="cx"> @@ -378,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
</span><span class="cx">   */
</span><span class="cx">  #define YY_DO_BEFORE_ACTION \
</span><span class="lines">@@ -68,110 +38,3 @@
</span><span class="cx">          yyg-&gt;yy_hold_char = *yy_cp; \
</span><span class="cx">          *yy_cp = '\0'; \
</span><span class="cx">          yyg-&gt;yy_c_buf_p = yy_cp;
</span><del>-@@ -1035,8 +1036,8 @@ struct yyguts_t
-     size_t yy_buffer_stack_max; /**&lt; capacity of stack. */
-     YY_BUFFER_STATE * yy_buffer_stack; /**&lt; Stack as an array. */
-     char yy_hold_char;
--    int yy_n_chars;
--    int yyleng_r;
-+    yy_size_t yy_n_chars;
-+    yy_size_t yyleng_r;
-     char *yy_c_buf_p;
-     int yy_init;
-     int yy_start;
-@@ -1089,7 +1090,7 @@ FILE *yyget_out (yyscan_t yyscanner );

- void yyset_out  (FILE * out_str ,yyscan_t yyscanner );

--int yyget_leng (yyscan_t yyscanner );
-+yy_size_t yyget_leng (yyscan_t yyscanner );

- char *yyget_text (yyscan_t yyscanner );

-@@ -1158,7 +1159,7 @@ static int input (yyscan_t yyscanner );
-         if ( YY_CURRENT_BUFFER_LVALUE-&gt;yy_is_interactive ) \
-                 { \
-                 int c = '*'; \
--                int n; \
-+                yy_size_t n; \
-                 for ( n = 0; n &lt; max_size &amp;&amp; \
-                              (c = getc( yyin )) != EOF &amp;&amp; c != '\n'; ++n ) \
-                         buf[n] = (char) c; \
-@@ -1317,7 +1318,7 @@ yy_find_action:

-                 if ( yy_act != YY_END_OF_BUFFER &amp;&amp; yy_rule_can_match_eol[yy_act] )
-                         {
--                        int yyl;
-+                        yy_size_t yyl;
-                         for ( yyl = 0; yyl &lt; yyleng; ++yyl )
-                                 if ( yytext[yyl] == '\n' )
-                                            
-@@ -2203,7 +2204,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-         else
-                 {
--                        int num_to_read =
-+                        yy_size_t num_to_read =
-                         YY_CURRENT_BUFFER_LVALUE-&gt;yy_buf_size - number_to_move - 1;

-                 while ( num_to_read &lt;= 0 )
-@@ -2217,7 +2218,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-                         if ( b-&gt;yy_is_our_buffer )
-                                 {
--                                int new_size = b-&gt;yy_buf_size * 2;
-+                                yy_size_t new_size = b-&gt;yy_buf_size * 2;

-                                 if ( new_size &lt;= 0 )
-                                         b-&gt;yy_buf_size += b-&gt;yy_buf_size / 8;
-@@ -2248,7 +2249,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-                 /* Read in more data. */
-                 YY_INPUT( (&amp;YY_CURRENT_BUFFER_LVALUE-&gt;yy_ch_buf[number_to_move]),
--                        yyg-&gt;yy_n_chars, (size_t) num_to_read );
-+                        yyg-&gt;yy_n_chars, num_to_read );

-                 YY_CURRENT_BUFFER_LVALUE-&gt;yy_n_chars = yyg-&gt;yy_n_chars;
-                 }
-@@ -2373,7 +2374,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)

-                 else
-                         { /* need more input */
--                        int offset = yyg-&gt;yy_c_buf_p - yyg-&gt;yytext_ptr;
-+                        yy_size_t offset = yyg-&gt;yy_c_buf_p - yyg-&gt;yytext_ptr;
-                         ++yyg-&gt;yy_c_buf_p;

-                         switch ( yy_get_next_buffer( yyscanner ) )
-@@ -2660,7 +2661,7 @@ void yypop_buffer_state (yyscan_t yyscanner)
-  */
- static void yyensure_buffer_stack (yyscan_t yyscanner)
- {
--        int num_to_alloc;
-+        yy_size_t num_to_alloc;
-     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;

-         if (!yyg-&gt;yy_buffer_stack) {
-@@ -2758,12 +2759,11 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
-  * @param yyscanner The scanner object.
-  * @return the newly allocated buffer state object.
-  */
--YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
-+YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
- {
-         YY_BUFFER_STATE b;
-         char *buf;
--        yy_size_t n;
--        int i;
-+        yy_size_t n, i;
-     
-         /* Get memory for full buffer, including space for trailing EOB's. */
-         n = _yybytes_len + 2;
-@@ -2913,7 +2913,7 @@ FILE *yyget_out  (yyscan_t yyscanner)
- /** Get the length of the current token.
-  * @param yyscanner The scanner object.
-  */
--int yyget_leng  (yyscan_t yyscanner)
-+yy_size_t yyget_leng  (yyscan_t yyscanner)
- {
-     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-     return yyleng;
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorASTMetadataHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,448 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// Analysis of the AST needed for HLSL generation
+
+#include &quot;compiler/translator/ASTMetadataHLSL.h&quot;
+
+#include &quot;compiler/translator/CallDAG.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
+
+namespace
+{
+
+// Class used to traverse the AST of a function definition, checking if the
+// function uses a gradient, and writing the set of control flow using gradients.
+// It assumes that the analysis has already been made for the function's
+// callees.
+class PullGradient : public TIntermTraverser
+{
+  public:
+    PullGradient(MetadataList *metadataList, size_t index, const CallDAG &amp;dag)
+        : TIntermTraverser(true, false, true),
+          mMetadataList(metadataList),
+          mMetadata(&amp;(*metadataList)[index]),
+          mIndex(index),
+          mDag(dag)
+    {
+        ASSERT(index &lt; metadataList-&gt;size());
+    }
+
+    void traverse(TIntermAggregate *node)
+    {
+        node-&gt;traverse(this);
+        ASSERT(mParents.empty());
+    }
+
+    // Called when a gradient operation or a call to a function using a gradient is found.
+    void onGradient()
+    {
+        mMetadata-&gt;mUsesGradient = true;
+        // Mark the latest control flow as using a gradient.
+        if (!mParents.empty())
+        {
+            mMetadata-&gt;mControlFlowsContainingGradient.insert(mParents.back());
+        }
+    }
+
+    void visitControlFlow(Visit visit, TIntermNode *node)
+    {
+        if (visit == PreVisit)
+        {
+            mParents.push_back(node);
+        }
+        else if (visit == PostVisit)
+        {
+            ASSERT(mParents.back() == node);
+            mParents.pop_back();
+            // A control flow's using a gradient means its parents are too.
+            if (mMetadata-&gt;mControlFlowsContainingGradient.count(node)&gt; 0 &amp;&amp; !mParents.empty())
+            {
+                mMetadata-&gt;mControlFlowsContainingGradient.insert(mParents.back());
+            }
+        }
+    }
+
+    bool visitLoop(Visit visit, TIntermLoop *loop) override
+    {
+        visitControlFlow(visit, loop);
+        return true;
+    }
+
+    bool visitSelection(Visit visit, TIntermSelection *selection) override
+    {
+        visitControlFlow(visit, selection);
+        return true;
+    }
+
+    bool visitUnary(Visit visit, TIntermUnary *node) override
+    {
+        if (visit == PreVisit)
+        {
+            switch (node-&gt;getOp())
+            {
+              case EOpDFdx:
+              case EOpDFdy:
+                onGradient();
+              default:
+                break;
+            }
+        }
+
+        return true;
+    }
+
+    bool visitAggregate(Visit visit, TIntermAggregate *node) override
+    {
+        if (visit == PreVisit)
+        {
+            if (node-&gt;getOp() == EOpFunctionCall)
+            {
+                if (node-&gt;isUserDefined())
+                {
+                    size_t calleeIndex = mDag.findIndex(node);
+                    ASSERT(calleeIndex != CallDAG::InvalidIndex &amp;&amp; calleeIndex &lt; mIndex);
+
+                    if ((*mMetadataList)[calleeIndex].mUsesGradient) {
+                        onGradient();
+                    }
+                }
+                else
+                {
+                    TString name = TFunction::unmangleName(node-&gt;getName());
+
+                    if (name == &quot;texture2D&quot; ||
+                        name == &quot;texture2DProj&quot; ||
+                        name == &quot;textureCube&quot;)
+                    {
+                        onGradient();
+                    }
+                }
+            }
+        }
+
+        return true;
+    }
+
+  private:
+    MetadataList *mMetadataList;
+    ASTMetadataHLSL *mMetadata;
+    size_t mIndex;
+    const CallDAG &amp;mDag;
+
+    // Contains a stack of the control flow nodes that are parents of the node being
+    // currently visited. It is used to mark control flows using a gradient.
+    std::vector&lt;TIntermNode*&gt; mParents;
+};
+
+// Traverses the AST of a function definition, assuming it has already been used to
+// traverse the callees of that function; computes the discontinuous loops and the if
+// statements that contain a discontinuous loop in their call graph.
+class PullComputeDiscontinuousLoops : public TIntermTraverser
+{
+  public:
+    PullComputeDiscontinuousLoops(MetadataList *metadataList, size_t index, const CallDAG &amp;dag)
+        : TIntermTraverser(true, false, true),
+          mMetadataList(metadataList),
+          mMetadata(&amp;(*metadataList)[index]),
+          mIndex(index),
+          mDag(dag)
+    {
+    }
+
+    void traverse(TIntermAggregate *node)
+    {
+        node-&gt;traverse(this);
+        ASSERT(mLoopsAndSwitches.empty());
+        ASSERT(mIfs.empty());
+    }
+
+    // Called when a discontinuous loop or a call to a function with a discontinuous loop
+    // in its call graph is found.
+    void onDiscontinuousLoop()
+    {
+        mMetadata-&gt;mHasDiscontinuousLoopInCallGraph = true;
+        // Mark the latest if as using a discontinuous loop.
+        if (!mIfs.empty())
+        {
+            mMetadata-&gt;mIfsContainingDiscontinuousLoop.insert(mIfs.back());
+        }
+    }
+
+    bool visitLoop(Visit visit, TIntermLoop *loop) override
+    {
+        if (visit == PreVisit)
+        {
+            mLoopsAndSwitches.push_back(loop);
+        }
+        else if (visit == PostVisit)
+        {
+            ASSERT(mLoopsAndSwitches.back() == loop);
+            mLoopsAndSwitches.pop_back();
+        }
+
+        return true;
+    }
+
+    bool visitSelection(Visit visit, TIntermSelection *node) override
+    {
+        if (visit == PreVisit)
+        {
+            mIfs.push_back(node);
+        }
+        else if (visit == PostVisit)
+        {
+            ASSERT(mIfs.back() == node);
+            mIfs.pop_back();
+            // An if using a discontinuous loop means its parents ifs are also discontinuous.
+            if (mMetadata-&gt;mIfsContainingDiscontinuousLoop.count(node) &gt; 0 &amp;&amp; !mIfs.empty())
+            {
+                mMetadata-&gt;mIfsContainingDiscontinuousLoop.insert(mIfs.back());
+            }
+        }
+
+        return true;
+    }
+
+    bool visitBranch(Visit visit, TIntermBranch *node) override
+    {
+        if (visit == PreVisit)
+        {
+            switch (node-&gt;getFlowOp())
+            {
+              case EOpBreak:
+                {
+                    ASSERT(!mLoopsAndSwitches.empty());
+                    TIntermLoop *loop = mLoopsAndSwitches.back()-&gt;getAsLoopNode();
+                    if (loop != nullptr)
+                    {
+                        mMetadata-&gt;mDiscontinuousLoops.insert(loop);
+                        onDiscontinuousLoop();
+                    }
+                }
+                break;
+              case EOpContinue:
+                {
+                    ASSERT(!mLoopsAndSwitches.empty());
+                    TIntermLoop *loop = nullptr;
+                    size_t i = mLoopsAndSwitches.size();
+                    while (loop == nullptr &amp;&amp; i &gt; 0)
+                    {
+                        --i;
+                        loop = mLoopsAndSwitches.at(i)-&gt;getAsLoopNode();
+                    }
+                    ASSERT(loop != nullptr);
+                    mMetadata-&gt;mDiscontinuousLoops.insert(loop);
+                    onDiscontinuousLoop();
+                }
+                break;
+              case EOpKill:
+              case EOpReturn:
+                // A return or discard jumps out of all the enclosing loops
+                if (!mLoopsAndSwitches.empty())
+                {
+                    for (TIntermNode* node : mLoopsAndSwitches)
+                    {
+                        TIntermLoop *loop = node-&gt;getAsLoopNode();
+                        if (loop)
+                        {
+                            mMetadata-&gt;mDiscontinuousLoops.insert(loop);
+                        }
+                    }
+                    onDiscontinuousLoop();
+                }
+                break;
+              default:
+                UNREACHABLE();
+            }
+        }
+
+        return true;
+    }
+
+    bool visitAggregate(Visit visit, TIntermAggregate *node) override
+    {
+        if (visit == PreVisit &amp;&amp; node-&gt;getOp() == EOpFunctionCall)
+        {
+            if (node-&gt;isUserDefined())
+            {
+                size_t calleeIndex = mDag.findIndex(node);
+                ASSERT(calleeIndex != CallDAG::InvalidIndex &amp;&amp; calleeIndex &lt; mIndex);
+
+                if ((*mMetadataList)[calleeIndex].mHasDiscontinuousLoopInCallGraph)
+                {
+                    onDiscontinuousLoop();
+                }
+            }
+        }
+
+        return true;
+    }
+
+    bool visitSwitch(Visit visit, TIntermSwitch *node) override
+    {
+        if (visit == PreVisit)
+        {
+            mLoopsAndSwitches.push_back(node);
+        }
+        else if (visit == PostVisit)
+        {
+            ASSERT(mLoopsAndSwitches.back() == node);
+            mLoopsAndSwitches.pop_back();
+        }
+        return true;
+    }
+
+  private:
+    MetadataList *mMetadataList;
+    ASTMetadataHLSL *mMetadata;
+    size_t mIndex;
+    const CallDAG &amp;mDag;
+
+    std::vector&lt;TIntermNode*&gt; mLoopsAndSwitches;
+    std::vector&lt;TIntermSelection*&gt; mIfs;
+};
+
+// Tags all the functions called in a discontinuous loop
+class PushDiscontinuousLoops : public TIntermTraverser
+{
+  public:
+    PushDiscontinuousLoops(MetadataList *metadataList, size_t index, const CallDAG &amp;dag)
+        : TIntermTraverser(true, true, true),
+          mMetadataList(metadataList),
+          mMetadata(&amp;(*metadataList)[index]),
+          mIndex(index),
+          mDag(dag),
+          mNestedDiscont(mMetadata-&gt;mCalledInDiscontinuousLoop ? 1 : 0)
+    {
+    }
+
+    void traverse(TIntermAggregate *node)
+    {
+        node-&gt;traverse(this);
+        ASSERT(mNestedDiscont == (mMetadata-&gt;mCalledInDiscontinuousLoop ? 1 : 0));
+    }
+
+    bool visitLoop(Visit visit, TIntermLoop *loop) override
+    {
+        bool isDiscontinuous = mMetadata-&gt;mDiscontinuousLoops.count(loop) &gt; 0;
+
+        if (visit == PreVisit &amp;&amp; isDiscontinuous)
+        {
+            mNestedDiscont++;
+        }
+        else if (visit == PostVisit &amp;&amp; isDiscontinuous)
+        {
+            mNestedDiscont--;
+        }
+
+        return true;
+    }
+
+    bool visitAggregate(Visit visit, TIntermAggregate *node) override
+    {
+        switch (node-&gt;getOp())
+        {
+          case EOpFunctionCall:
+            if (visit == PreVisit &amp;&amp; node-&gt;isUserDefined() &amp;&amp; mNestedDiscont &gt; 0)
+            {
+                size_t calleeIndex = mDag.findIndex(node);
+                ASSERT(calleeIndex != CallDAG::InvalidIndex &amp;&amp; calleeIndex &lt; mIndex);
+
+                (*mMetadataList)[calleeIndex].mCalledInDiscontinuousLoop = true;
+            }
+            break;
+          default:
+            break;
+        }
+        return true;
+    }
+
+  private:
+    MetadataList *mMetadataList;
+    ASTMetadataHLSL *mMetadata;
+    size_t mIndex;
+    const CallDAG &amp;mDag;
+
+    int mNestedDiscont;
+};
+
+}
+
+bool ASTMetadataHLSL::hasGradientInCallGraph(TIntermSelection *node)
+{
+    return mControlFlowsContainingGradient.count(node) &gt; 0;
+}
+
+bool ASTMetadataHLSL::hasGradientInCallGraph(TIntermLoop *node)
+{
+    return mControlFlowsContainingGradient.count(node) &gt; 0;
+}
+
+bool ASTMetadataHLSL::hasDiscontinuousLoop(TIntermSelection *node)
+{
+    return mIfsContainingDiscontinuousLoop.count(node) &gt; 0;
+}
+
+MetadataList CreateASTMetadataHLSL(TIntermNode *root, const CallDAG &amp;callDag)
+{
+    MetadataList metadataList(callDag.size());
+
+    // Compute all the information related to when gradient operations are used.
+    // We want to know for each function and control flow operation if they have
+    // a gradient operation in their call graph (shortened to &quot;using a gradient&quot;
+    // in the rest of the file).
+    //
+    // This computation is logically split in three steps:
+    //  1 - For each function compute if it uses a gradient in its body, ignoring
+    // calls to other user-defined functions.
+    //  2 - For each function determine if it uses a gradient in its call graph,
+    // using the result of step 1 and the CallDAG to know its callees.
+    //  3 - For each control flow statement of each function, check if it uses a
+    // gradient in the function's body, or if it calls a user-defined function that
+    // uses a gradient.
+    //
+    // We take advantage of the call graph being a DAG and instead compute 1, 2 and 3
+    // for leaves first, then going down the tree. This is correct because 1 doesn't
+    // depend on other functions, and 2 and 3 depend only on callees.
+    for (size_t i = 0; i &lt; callDag.size(); i++)
+    {
+        PullGradient pull(&amp;metadataList, i, callDag);
+        pull.traverse(callDag.getRecordFromIndex(i).node);
+    }
+
+    // Compute which loops are discontinuous and which function are called in
+    // these loops. The same way computing gradient usage is a &quot;pull&quot; process,
+    // computing &quot;bing used in a discont. loop&quot; is a push process. However we also
+    // need to know what ifs have a discontinuous loop inside so we do the same type
+    // of callgraph analysis as for the gradient.
+
+    // First compute which loops are discontinuous (no specific order) and pull
+    // the ifs and functions using a discontinuous loop.
+    for (size_t i = 0; i &lt; callDag.size(); i++)
+    {
+        PullComputeDiscontinuousLoops pull(&amp;metadataList, i, callDag);
+        pull.traverse(callDag.getRecordFromIndex(i).node);
+    }
+
+    // Then push the information to callees, either from the a local discontinuous
+    // loop or from the caller being called in a discontinuous loop already
+    for (size_t i = callDag.size(); i-- &gt; 0;)
+    {
+        PushDiscontinuousLoops push(&amp;metadataList, i, callDag);
+        push.traverse(callDag.getRecordFromIndex(i).node);
+    }
+
+    // We create &quot;Lod0&quot; version of functions with the gradient operations replaced
+    // by non-gradient operations so that the D3D compiler is happier with discont
+    // loops.
+    for (auto &amp;metadata : metadataList)
+    {
+        metadata.mNeedsLod0 = metadata.mCalledInDiscontinuousLoop &amp;&amp; metadata.mUsesGradient;
+    }
+
+    return metadataList;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorASTMetadataHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ASTMetadataHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// Defines analyses of the AST needed for HLSL generation
+
+#ifndef COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
+#define COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
+
+#include &lt;set&gt;
+#include &lt;vector&gt;
+
+class CallDAG;
+class TIntermNode;
+class TIntermSelection;
+class TIntermLoop;
+
+struct ASTMetadataHLSL
+{
+    ASTMetadataHLSL()
+        : mUsesGradient(false),
+          mCalledInDiscontinuousLoop(false),
+          mHasDiscontinuousLoopInCallGraph(false),
+          mNeedsLod0(false)
+    {
+    }
+
+    // Here &quot;something uses a gradient&quot; means here that it either contains a
+    // gradient operation, or a call to a function that uses a gradient.
+    bool hasGradientInCallGraph(TIntermSelection *node);
+    bool hasGradientInCallGraph(TIntermLoop *node);
+    bool hasDiscontinuousLoop(TIntermSelection *node);
+
+    // Does the function use a gradient.
+    bool mUsesGradient;
+
+    // Even if usesGradient is true, some control flow might not use a gradient
+    // so we store the set of all gradient-using control flows.
+    std::set&lt;TIntermNode*&gt; mControlFlowsContainingGradient;
+
+    // Remember information about the discontinuous loops and which functions
+    // are called in such loops.
+    bool mCalledInDiscontinuousLoop;
+    bool mHasDiscontinuousLoopInCallGraph;
+    std::set&lt;TIntermLoop*&gt; mDiscontinuousLoops;
+    std::set&lt;TIntermSelection*&gt; mIfsContainingDiscontinuousLoop;
+
+    // Will we need to generate a Lod0 version of the function.
+    bool mNeedsLod0;
+};
+
+typedef std::vector&lt;ASTMetadataHLSL&gt; MetadataList;
+
+// Return the AST analysis result, in the order defined by the call DAG
+MetadataList CreateASTMetadataHLSL(TIntermNode *root, const CallDAG &amp;callDag);
+
+#endif // COMPILER_TRANSLATOR_ASTMETADATAHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorArrayReturnValueToOutParametercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,185 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The ArrayReturnValueToOutParameter function changes return values of an array type to out parameters in
+// function definitions, prototypes, and call sites.
+
+#include &quot;compiler/translator/ArrayReturnValueToOutParameter.h&quot;
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+namespace
+{
+
+void CopyAggregateChildren(TIntermAggregate *from, TIntermAggregate *to)
+{
+    const TIntermSequence *fromSequence = from-&gt;getSequence();
+    for (size_t ii = 0; ii &lt; fromSequence-&gt;size(); ++ii)
+    {
+        to-&gt;getSequence()-&gt;push_back(fromSequence-&gt;at(ii));
+    }
+}
+
+TIntermSymbol *CreateReturnValueSymbol(const TType &amp;type)
+{
+    TIntermSymbol *node = new TIntermSymbol(0, &quot;angle_return&quot;, type);
+    node-&gt;setInternal(true);
+    return node;
+}
+
+TIntermSymbol *CreateReturnValueOutSymbol(const TType &amp;type)
+{
+    TType outType(type);
+    outType.setQualifier(EvqOut);
+    return CreateReturnValueSymbol(outType);
+}
+
+class ArrayReturnValueToOutParameterTraverser : private TIntermTraverser
+{
+  public:
+    static void apply(TIntermNode *root);
+  private:
+    ArrayReturnValueToOutParameterTraverser();
+
+    bool visitAggregate(Visit visit, TIntermAggregate *node) override;
+    bool visitBranch(Visit visit, TIntermBranch *node) override;
+    bool visitBinary(Visit visit, TIntermBinary *node) override;
+
+    bool mInFunctionWithArrayReturnValue;
+};
+
+void ArrayReturnValueToOutParameterTraverser::apply(TIntermNode *root)
+{
+    ArrayReturnValueToOutParameterTraverser arrayReturnValueToOutParam;
+    root-&gt;traverse(&amp;arrayReturnValueToOutParam);
+    arrayReturnValueToOutParam.updateTree();
+}
+
+ArrayReturnValueToOutParameterTraverser::ArrayReturnValueToOutParameterTraverser()
+    : TIntermTraverser(true, false, true),
+      mInFunctionWithArrayReturnValue(false)
+{
+}
+
+bool ArrayReturnValueToOutParameterTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+    if (visit == PreVisit)
+    {
+        if (node-&gt;isArray())
+        {
+            if (node-&gt;getOp() == EOpFunction)
+            {
+                // Replace the parameters child node of the function definition with another node
+                // that has the out parameter added.
+                // Also set the function to return void.
+
+                TIntermAggregate *params = node-&gt;getSequence()-&gt;front()-&gt;getAsAggregate();
+                ASSERT(params != nullptr &amp;&amp; params-&gt;getOp() == EOpParameters);
+
+                TIntermAggregate *replacementParams = new TIntermAggregate;
+                replacementParams-&gt;setOp(EOpParameters);
+                CopyAggregateChildren(params, replacementParams);
+                replacementParams-&gt;getSequence()-&gt;push_back(CreateReturnValueOutSymbol(node-&gt;getType()));
+                replacementParams-&gt;setLine(params-&gt;getLine());
+
+                mReplacements.push_back(NodeUpdateEntry(node, params, replacementParams, false));
+
+                node-&gt;setType(TType(EbtVoid));
+
+                mInFunctionWithArrayReturnValue = true;
+            }
+            else if (node-&gt;getOp() == EOpPrototype)
+            {
+                // Replace the whole prototype node with another node that has the out parameter added.
+                TIntermAggregate *replacement = new TIntermAggregate;
+                replacement-&gt;setOp(EOpPrototype);
+                CopyAggregateChildren(node, replacement);
+                replacement-&gt;getSequence()-&gt;push_back(CreateReturnValueOutSymbol(node-&gt;getType()));
+                replacement-&gt;setUserDefined();
+                replacement-&gt;setName(node-&gt;getName());
+                replacement-&gt;setFunctionId(node-&gt;getFunctionId());
+                replacement-&gt;setLine(node-&gt;getLine());
+                replacement-&gt;setType(TType(EbtVoid));
+
+                mReplacements.push_back(NodeUpdateEntry(getParentNode(), node, replacement, false));
+            }
+            else if (node-&gt;getOp() == EOpFunctionCall)
+            {
+                // TODO (oetuaho@nvidia.com): Call sites where the returned array is not assigned are not handled yet.
+                // Examples where f() is a function returning an array:
+                // f();
+                // another_function(f());
+                // another_array == f();
+                UNIMPLEMENTED();
+            }
+        }
+    }
+    else if (visit == PostVisit)
+    {
+        if (node-&gt;getOp() == EOpFunction &amp;&amp; node-&gt;isArray())
+        {
+            mInFunctionWithArrayReturnValue = false;
+        }
+    }
+    return true;
+}
+
+bool ArrayReturnValueToOutParameterTraverser::visitBranch(Visit visit, TIntermBranch *node)
+{
+    if (mInFunctionWithArrayReturnValue &amp;&amp; node-&gt;getFlowOp() == EOpReturn)
+    {
+        // Instead of returning a value, assign to the out parameter and then return.
+        TIntermSequence replacements;
+
+        TIntermBinary *replacementAssignment = new TIntermBinary(EOpAssign);
+        TIntermTyped *expression = node-&gt;getExpression();
+        ASSERT(expression != nullptr);
+        replacementAssignment-&gt;setLeft(CreateReturnValueSymbol(expression-&gt;getType()));
+        replacementAssignment-&gt;setRight(node-&gt;getExpression());
+        replacementAssignment-&gt;setType(expression-&gt;getType());
+        replacementAssignment-&gt;setLine(expression-&gt;getLine());
+        replacements.push_back(replacementAssignment);
+
+        TIntermBranch *replacementBranch = new TIntermBranch(EOpReturn, nullptr);
+        replacementBranch-&gt;setLine(node-&gt;getLine());
+        replacements.push_back(replacementBranch);
+
+        mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(getParentNode()-&gt;getAsAggregate(), node, replacements));
+    }
+    return false;
+}
+
+bool ArrayReturnValueToOutParameterTraverser::visitBinary(Visit visit, TIntermBinary *node)
+{
+    if (node-&gt;getOp() == EOpAssign &amp;&amp; node-&gt;getLeft()-&gt;isArray())
+    {
+        TIntermAggregate *rightAgg = node-&gt;getRight()-&gt;getAsAggregate();
+        if (rightAgg != nullptr &amp;&amp; rightAgg-&gt;getOp() == EOpFunctionCall &amp;&amp; rightAgg-&gt;isUserDefined())
+        {
+            TIntermAggregate *replacementCall = new TIntermAggregate(EOpFunctionCall);
+            replacementCall-&gt;setType(TType(EbtVoid));
+            replacementCall-&gt;setUserDefined();
+            replacementCall-&gt;setName(rightAgg-&gt;getName());
+            replacementCall-&gt;setFunctionId(rightAgg-&gt;getFunctionId());
+            replacementCall-&gt;setLine(rightAgg-&gt;getLine());
+            TIntermSequence *replacementParameters = replacementCall-&gt;getSequence();
+            TIntermSequence *originalParameters = rightAgg-&gt;getSequence();
+            for (auto &amp;param : *originalParameters)
+            {
+                replacementParameters-&gt;push_back(param);
+            }
+            replacementParameters-&gt;push_back(node-&gt;getLeft());
+            mReplacements.push_back(NodeUpdateEntry(getParentNode(), node, replacementCall, false));
+        }
+    }
+    return false;
+}
+
+} // namespace
+
+void ArrayReturnValueToOutParameter(TIntermNode *root)
+{
+    ArrayReturnValueToOutParameterTraverser::apply(root);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorArrayReturnValueToOutParameterh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The ArrayReturnValueToOutParameter function changes return values of an array type to out parameters in
+// function definitions, prototypes and call sites.
+
+#ifndef COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_
+#define COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_
+
+class TIntermNode;
+
+void ArrayReturnValueToOutParameter(TIntermNode *root);
+
+#endif  // COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBaseTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BaseTypes.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _BASICTYPES_INCLUDED_
-#define _BASICTYPES_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_BASETYPES_H_
+#define COMPILER_TRANSLATOR_BASETYPES_H_
</ins><span class="cx"> 
</span><del>-#include &lt;assert.h&gt;
</del><ins>+#include &quot;common/debug.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Precision qualifiers
</span><span class="lines">@@ -42,7 +42,15 @@
</span><span class="cx">     EbtInt,
</span><span class="cx">     EbtUInt,
</span><span class="cx">     EbtBool,
</span><del>-    EbtGVec4,              // non type: represents vec4, ivec4 and uvec4
</del><ins>+    EbtGVec4,              // non type: represents vec4, ivec4, and uvec4
+    EbtGenType,            // non type: represents float, vec2, vec3, and vec4
+    EbtGenIType,           // non type: represents int, ivec2, ivec3, and ivec4
+    EbtGenUType,           // non type: represents uint, uvec2, uvec3, and uvec4
+    EbtGenBType,           // non type: represents bool, bvec2, bvec3, and bvec4
+    EbtVec,                // non type: represents vec2, vec3, and vec4
+    EbtIVec,               // non type: represents ivec2, ivec3, and ivec4
+    EbtUVec,               // non type: represents uvec2, uvec3, and uvec4
+    EbtBVec,               // non type: represents bvec2, bvec3, and bvec4
</ins><span class="cx">     EbtGuardSamplerBegin,  // non type: see implementation of IsSampler()
</span><span class="cx">     EbtSampler2D,
</span><span class="cx">     EbtSampler3D,
</span><span class="lines">@@ -62,47 +70,16 @@
</span><span class="cx">     EbtSamplerCubeShadow,
</span><span class="cx">     EbtSampler2DArrayShadow,
</span><span class="cx">     EbtGuardSamplerEnd,    // non type: see implementation of IsSampler()
</span><del>-    EbtGSampler2D,         // non type: represents sampler2D, isampler2D and usampler2D
-    EbtGSampler3D,         // non type: represents sampler3D, isampler3D and usampler3D
-    EbtGSamplerCube,       // non type: represents samplerCube, isamplerCube and usamplerCube
-    EbtGSampler2DArray,    // non type: represents sampler2DArray, isampler2DArray and usampler2DArray
</del><ins>+    EbtGSampler2D,         // non type: represents sampler2D, isampler2D, and usampler2D
+    EbtGSampler3D,         // non type: represents sampler3D, isampler3D, and usampler3D
+    EbtGSamplerCube,       // non type: represents samplerCube, isamplerCube, and usamplerCube
+    EbtGSampler2DArray,    // non type: represents sampler2DArray, isampler2DArray, and usampler2DArray
</ins><span class="cx">     EbtStruct,
</span><span class="cx">     EbtInterfaceBlock,
</span><span class="cx">     EbtAddress,            // should be deprecated??
</span><del>-    EbtInvariant          // used as a type when qualifying a previously declared variable as being invariant
</del><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline const char* getBasicString(TBasicType t)
-{
-    switch (t)
-    {
-      case EbtVoid:                 return &quot;void&quot;;                 break;
-      case EbtFloat:                return &quot;float&quot;;                break;
-      case EbtInt:                  return &quot;int&quot;;                  break;
-      case EbtUInt:                 return &quot;uint&quot;;                 break;
-      case EbtBool:                 return &quot;bool&quot;;                 break;
-      case EbtSampler2D:            return &quot;sampler2D&quot;;            break;
-      case EbtSampler3D:            return &quot;sampler3D&quot;;            break;
-      case EbtSamplerCube:          return &quot;samplerCube&quot;;          break;
-      case EbtSamplerExternalOES:   return &quot;samplerExternalOES&quot;;   break;
-      case EbtSampler2DRect:        return &quot;sampler2DRect&quot;;        break;
-      case EbtSampler2DArray:       return &quot;sampler2DArray&quot;;       break;
-      case EbtISampler2D:           return &quot;isampler2D&quot;;           break;
-      case EbtISampler3D:           return &quot;isampler3D&quot;;           break;
-      case EbtISamplerCube:         return &quot;isamplerCube&quot;;         break;
-      case EbtISampler2DArray:      return &quot;isampler2DArray&quot;;      break;
-      case EbtUSampler2D:           return &quot;usampler2D&quot;;           break;
-      case EbtUSampler3D:           return &quot;usampler3D&quot;;           break;
-      case EbtUSamplerCube:         return &quot;usamplerCube&quot;;         break;
-      case EbtUSampler2DArray:      return &quot;usampler2DArray&quot;;      break;
-      case EbtSampler2DShadow:      return &quot;sampler2DShadow&quot;;      break;
-      case EbtSamplerCubeShadow:    return &quot;samplerCubeShadow&quot;;    break;
-      case EbtSampler2DArrayShadow: return &quot;sampler2DArrayShadow&quot;; break;
-      case EbtStruct:               return &quot;structure&quot;;            break;
-      case EbtInterfaceBlock:       return &quot;interface block&quot;;      break;
-      default:                      return &quot;unknown type&quot;;
-    }
-}
</del><ins>+const char* getBasicString(TBasicType t);
</ins><span class="cx"> 
</span><span class="cx"> inline bool IsSampler(TBasicType type)
</span><span class="cx"> {
</span><span class="lines">@@ -289,6 +266,16 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline bool IsInteger(TBasicType type)
+{
+    return type == EbtInt || type == EbtUInt;
+}
+
+inline bool SupportsPrecision(TBasicType type)
+{
+    return type == EbtFloat || type == EbtInt || type == EbtUInt || IsSampler(type);
+}
+
</ins><span class="cx"> //
</span><span class="cx"> // Qualifiers and built-ins.  These are mainly used to see what can be read
</span><span class="cx"> // or written, and by the machine dependent translator to know which registers
</span><span class="lines">@@ -299,7 +286,6 @@
</span><span class="cx"> {
</span><span class="cx">     EvqTemporary,     // For temporaries (within a function), read/write
</span><span class="cx">     EvqGlobal,        // For globals read/write
</span><del>-    EvqInternal,      // For internal use, not visible to the user
</del><span class="cx">     EvqConst,         // User defined constants and non-output parameters in functions
</span><span class="cx">     EvqAttribute,     // Readonly
</span><span class="cx">     EvqVaryingIn,     // readonly, fragment shaders only
</span><span class="lines">@@ -319,6 +305,9 @@
</span><span class="cx">     EvqInOut,
</span><span class="cx">     EvqConstReadOnly,
</span><span class="cx"> 
</span><ins>+    // built-ins read by vertex shader
+    EvqInstanceID,
+
</ins><span class="cx">     // built-ins written by vertex shader
</span><span class="cx">     EvqPosition,
</span><span class="cx">     EvqPointSize,
</span><span class="lines">@@ -333,6 +322,10 @@
</span><span class="cx">     EvqFragData,
</span><span class="cx">     EvqFragDepth,
</span><span class="cx"> 
</span><ins>+    // built-ins written by the shader_framebuffer_fetch extension(s)
+    EvqLastFragColor,
+    EvqLastFragData,
+
</ins><span class="cx">     // GLSL ES 3.0 vertex output and fragment input
</span><span class="cx">     EvqSmooth,        // Incomplete qualifier, smooth is the default
</span><span class="cx">     EvqFlat,          // Incomplete qualifier
</span><span class="lines">@@ -409,6 +402,7 @@
</span><span class="cx">     case EvqIn:             return &quot;in&quot;;             break;
</span><span class="cx">     case EvqOut:            return &quot;out&quot;;            break;
</span><span class="cx">     case EvqInOut:          return &quot;inout&quot;;          break;
</span><ins>+    case EvqInstanceID:     return &quot;InstanceID&quot;;     break;
</ins><span class="cx">     case EvqPosition:       return &quot;Position&quot;;       break;
</span><span class="cx">     case EvqPointSize:      return &quot;PointSize&quot;;      break;
</span><span class="cx">     case EvqFragCoord:      return &quot;FragCoord&quot;;      break;
</span><span class="lines">@@ -422,7 +416,9 @@
</span><span class="cx">     case EvqSmoothIn:       return &quot;smooth in&quot;;      break;
</span><span class="cx">     case EvqCentroidIn:     return &quot;centroid in&quot;;    break;
</span><span class="cx">     case EvqFlatIn:         return &quot;flat in&quot;;        break;
</span><del>-    default:                return &quot;unknown qualifier&quot;;
</del><ins>+    case EvqLastFragColor:  return &quot;LastFragColor&quot;;  break;
+    case EvqLastFragData:   return &quot;LastFragData&quot;;   break;
+    default: UNREACHABLE(); return &quot;unknown qualifier&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -433,7 +429,7 @@
</span><span class="cx">     case EmpUnspecified:    return &quot;mp_unspecified&quot;;
</span><span class="cx">     case EmpRowMajor:       return &quot;row_major&quot;;
</span><span class="cx">     case EmpColumnMajor:    return &quot;column_major&quot;;
</span><del>-    default:                return &quot;unknown matrix packing&quot;;
</del><ins>+    default: UNREACHABLE(); return &quot;unknown matrix packing&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -445,7 +441,7 @@
</span><span class="cx">     case EbsShared:         return &quot;shared&quot;;
</span><span class="cx">     case EbsPacked:         return &quot;packed&quot;;
</span><span class="cx">     case EbsStd140:         return &quot;std140&quot;;
</span><del>-    default:                return &quot;unknown block storage&quot;;
</del><ins>+    default: UNREACHABLE(); return &quot;unknown block storage&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -459,8 +455,8 @@
</span><span class="cx">     case EvqSmoothIn:       return &quot;smooth&quot;;   break;
</span><span class="cx">     case EvqCentroidIn:     return &quot;centroid&quot;; break;
</span><span class="cx">     case EvqFlatIn:         return &quot;flat&quot;;     break;
</span><del>-    default:                return &quot;unknown interpolation&quot;;
</del><ins>+    default: UNREACHABLE(); return &quot;unknown interpolation&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif // _BASICTYPES_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_BASETYPES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,197 +4,13 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/BuiltInFunctionEmulator.h&quot;
</span><del>-
</del><span class="cx"> #include &quot;compiler/translator/SymbolTable.h&quot;
</span><span class="cx"> 
</span><del>-namespace {
-
-// we use macros here instead of function definitions to work around more GLSL
-// compiler bugs, in particular on NVIDIA hardware on Mac OSX. Macros are
-// problematic because if the argument has side-effects they will be repeatedly
-// evaluated. This is unlikely to show up in real shaders, but is something to
-// consider.
-const char* kFunctionEmulationVertexSource[] = {
-    &quot;#error no emulation for cos(float)&quot;,
-    &quot;#error no emulation for cos(vec2)&quot;,
-    &quot;#error no emulation for cos(vec3)&quot;,
-    &quot;#error no emulation for cos(vec4)&quot;,
-
-    &quot;#define webgl_distance_emu(x, y) ((x) &gt;= (y) ? (x) - (y) : (y) - (x))&quot;,
-    &quot;#error no emulation for distance(vec2, vec2)&quot;,
-    &quot;#error no emulation for distance(vec3, vec3)&quot;,
-    &quot;#error no emulation for distance(vec4, vec4)&quot;,
-
-    &quot;#define webgl_dot_emu(x, y) ((x) * (y))&quot;,
-    &quot;#error no emulation for dot(vec2, vec2)&quot;,
-    &quot;#error no emulation for dot(vec3, vec3)&quot;,
-    &quot;#error no emulation for dot(vec4, vec4)&quot;,
-
-    &quot;#define webgl_length_emu(x) ((x) &gt;= 0.0 ? (x) : -(x))&quot;,
-    &quot;#error no emulation for length(vec2)&quot;,
-    &quot;#error no emulation for length(vec3)&quot;,
-    &quot;#error no emulation for length(vec4)&quot;,
-
-    &quot;#define webgl_normalize_emu(x) ((x) == 0.0 ? 0.0 : ((x) &gt; 0.0 ? 1.0 : -1.0))&quot;,
-    &quot;#error no emulation for normalize(vec2)&quot;,
-    &quot;#error no emulation for normalize(vec3)&quot;,
-    &quot;#error no emulation for normalize(vec4)&quot;,
-
-    &quot;#define webgl_reflect_emu(I, N) ((I) - 2.0 * (N) * (I) * (N))&quot;,
-    &quot;#error no emulation for reflect(vec2, vec2)&quot;,
-    &quot;#error no emulation for reflect(vec3, vec3)&quot;,
-    &quot;#error no emulation for reflect(vec4, vec4)&quot;
-};
-
-const char* kFunctionEmulationFragmentSource[] = {
-    &quot;webgl_emu_precision float webgl_cos_emu(webgl_emu_precision float a) { return cos(a); }&quot;,
-    &quot;webgl_emu_precision vec2 webgl_cos_emu(webgl_emu_precision vec2 a) { return cos(a); }&quot;,
-    &quot;webgl_emu_precision vec3 webgl_cos_emu(webgl_emu_precision vec3 a) { return cos(a); }&quot;,
-    &quot;webgl_emu_precision vec4 webgl_cos_emu(webgl_emu_precision vec4 a) { return cos(a); }&quot;,
-
-    &quot;#define webgl_distance_emu(x, y) ((x) &gt;= (y) ? (x) - (y) : (y) - (x))&quot;,
-    &quot;#error no emulation for distance(vec2, vec2)&quot;,
-    &quot;#error no emulation for distance(vec3, vec3)&quot;,
-    &quot;#error no emulation for distance(vec4, vec4)&quot;,
-
-    &quot;#define webgl_dot_emu(x, y) ((x) * (y))&quot;,
-    &quot;#error no emulation for dot(vec2, vec2)&quot;,
-    &quot;#error no emulation for dot(vec3, vec3)&quot;,
-    &quot;#error no emulation for dot(vec4, vec4)&quot;,
-
-    &quot;#define webgl_length_emu(x) ((x) &gt;= 0.0 ? (x) : -(x))&quot;,
-    &quot;#error no emulation for length(vec2)&quot;,
-    &quot;#error no emulation for length(vec3)&quot;,
-    &quot;#error no emulation for length(vec4)&quot;,
-
-    &quot;#define webgl_normalize_emu(x) ((x) == 0.0 ? 0.0 : ((x) &gt; 0.0 ? 1.0 : -1.0))&quot;,
-    &quot;#error no emulation for normalize(vec2)&quot;,
-    &quot;#error no emulation for normalize(vec3)&quot;,
-    &quot;#error no emulation for normalize(vec4)&quot;,
-
-    &quot;#define webgl_reflect_emu(I, N) ((I) - 2.0 * (N) * (I) * (N))&quot;,
-    &quot;#error no emulation for reflect(vec2, vec2)&quot;,
-    &quot;#error no emulation for reflect(vec3, vec3)&quot;,
-    &quot;#error no emulation for reflect(vec4, vec4)&quot;
-};
-
-const bool kFunctionEmulationVertexMask[] = {
-#if defined(__APPLE__)
-    // Work around ATI driver bugs in Mac.
-    false, // TFunctionCos1
-    false, // TFunctionCos2
-    false, // TFunctionCos3
-    false, // TFunctionCos4
-    true,  // TFunctionDistance1_1
-    false, // TFunctionDistance2_2
-    false, // TFunctionDistance3_3
-    false, // TFunctionDistance4_4
-    true,  // TFunctionDot1_1
-    false, // TFunctionDot2_2
-    false, // TFunctionDot3_3
-    false, // TFunctionDot4_4
-    true,  // TFunctionLength1
-    false, // TFunctionLength2
-    false, // TFunctionLength3
-    false, // TFunctionLength4
-    true,  // TFunctionNormalize1
-    false, // TFunctionNormalize2
-    false, // TFunctionNormalize3
-    false, // TFunctionNormalize4
-    true,  // TFunctionReflect1_1
-    false, // TFunctionReflect2_2
-    false, // TFunctionReflect3_3
-    false, // TFunctionReflect4_4
-#else
-    // Work around D3D driver bug in Win.
-    false, // TFunctionCos1
-    false, // TFunctionCos2
-    false, // TFunctionCos3
-    false, // TFunctionCos4
-    false, // TFunctionDistance1_1
-    false, // TFunctionDistance2_2
-    false, // TFunctionDistance3_3
-    false, // TFunctionDistance4_4
-    false, // TFunctionDot1_1
-    false, // TFunctionDot2_2
-    false, // TFunctionDot3_3
-    false, // TFunctionDot4_4
-    false, // TFunctionLength1
-    false, // TFunctionLength2
-    false, // TFunctionLength3
-    false, // TFunctionLength4
-    false, // TFunctionNormalize1
-    false, // TFunctionNormalize2
-    false, // TFunctionNormalize3
-    false, // TFunctionNormalize4
-    false, // TFunctionReflect1_1
-    false, // TFunctionReflect2_2
-    false, // TFunctionReflect3_3
-    false, // TFunctionReflect4_4
-#endif
-    false  // TFunctionUnknown
-};
-
-const bool kFunctionEmulationFragmentMask[] = {
-#if defined(__APPLE__)
-    // Work around ATI driver bugs in Mac.
-    true,  // TFunctionCos1
-    true,  // TFunctionCos2
-    true,  // TFunctionCos3
-    true,  // TFunctionCos4
-    true,  // TFunctionDistance1_1
-    false, // TFunctionDistance2_2
-    false, // TFunctionDistance3_3
-    false, // TFunctionDistance4_4
-    true,  // TFunctionDot1_1
-    false, // TFunctionDot2_2
-    false, // TFunctionDot3_3
-    false, // TFunctionDot4_4
-    true,  // TFunctionLength1
-    false, // TFunctionLength2
-    false, // TFunctionLength3
-    false, // TFunctionLength4
-    true,  // TFunctionNormalize1
-    false, // TFunctionNormalize2
-    false, // TFunctionNormalize3
-    false, // TFunctionNormalize4
-    true,  // TFunctionReflect1_1
-    false, // TFunctionReflect2_2
-    false, // TFunctionReflect3_3
-    false, // TFunctionReflect4_4
-#else
-    // Work around D3D driver bug in Win.
-    false, // TFunctionCos1
-    false, // TFunctionCos2
-    false, // TFunctionCos3
-    false, // TFunctionCos4
-    false, // TFunctionDistance1_1
-    false, // TFunctionDistance2_2
-    false, // TFunctionDistance3_3
-    false, // TFunctionDistance4_4
-    false, // TFunctionDot1_1
-    false, // TFunctionDot2_2
-    false, // TFunctionDot3_3
-    false, // TFunctionDot4_4
-    false, // TFunctionLength1
-    false, // TFunctionLength2
-    false, // TFunctionLength3
-    false, // TFunctionLength4
-    false, // TFunctionNormalize1
-    false, // TFunctionNormalize2
-    false, // TFunctionNormalize3
-    false, // TFunctionNormalize4
-    false, // TFunctionReflect1_1
-    false, // TFunctionReflect2_2
-    false, // TFunctionReflect3_3
-    false, // TFunctionReflect4_4
-#endif
-    false  // TFunctionUnknown
-};
-
-class BuiltInFunctionEmulationMarker : public TIntermTraverser {
-public:
</del><ins>+class BuiltInFunctionEmulator::BuiltInFunctionEmulationMarker : public TIntermTraverser
+{
+  public:
</ins><span class="cx">     BuiltInFunctionEmulationMarker(BuiltInFunctionEmulator&amp; emulator)
</span><span class="cx">         : mEmulator(emulator)
</span><span class="cx">     {
</span><span class="lines">@@ -238,148 +54,119 @@
</span><span class="cx">                 case EOpFaceForward:
</span><span class="cx">                 case EOpReflect:
</span><span class="cx">                 case EOpRefract:
</span><ins>+                case EOpOuterProduct:
</ins><span class="cx">                 case EOpMul:
</span><span class="cx">                     break;
</span><span class="cx">                 default:
</span><span class="cx">                     return true;
</span><span class="cx">             };
</span><del>-            const TIntermSequence&amp; sequence = node-&gt;getSequence();
-            // Right now we only handle built-in functions with two parameters.
-            if (sequence.size() != 2)
</del><ins>+            const TIntermSequence&amp; sequence = *(node-&gt;getSequence());
+            bool needToEmulate = false;
+            // Right now we only handle built-in functions with two or three parameters.
+            if (sequence.size() == 2)
+            {
+                TIntermTyped* param1 = sequence[0]-&gt;getAsTyped();
+                TIntermTyped* param2 = sequence[1]-&gt;getAsTyped();
+                if (!param1 || !param2)
+                    return true;
+                needToEmulate = mEmulator.SetFunctionCalled(
+                    node-&gt;getOp(), param1-&gt;getType(), param2-&gt;getType());
+            }
+            else if (sequence.size() == 3)
+            {
+                TIntermTyped* param1 = sequence[0]-&gt;getAsTyped();
+                TIntermTyped* param2 = sequence[1]-&gt;getAsTyped();
+                TIntermTyped* param3 = sequence[2]-&gt;getAsTyped();
+                if (!param1 || !param2 || !param3)
+                    return true;
+                needToEmulate = mEmulator.SetFunctionCalled(
+                    node-&gt;getOp(), param1-&gt;getType(), param2-&gt;getType(), param3-&gt;getType());
+            }
+            else
+            {
</ins><span class="cx">                 return true;
</span><del>-            TIntermTyped* param1 = sequence[0]-&gt;getAsTyped();
-            TIntermTyped* param2 = sequence[1]-&gt;getAsTyped();
-            if (!param1 || !param2)
-                return true;
-            bool needToEmulate = mEmulator.SetFunctionCalled(
-                node-&gt;getOp(), param1-&gt;getType(), param2-&gt;getType());
</del><ins>+            }
+
</ins><span class="cx">             if (needToEmulate)
</span><span class="cx">                 node-&gt;setUseEmulatedFunction();
</span><span class="cx">         }
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-private:
</del><ins>+  private:
</ins><span class="cx">     BuiltInFunctionEmulator&amp; mEmulator;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-}  // anonymous namepsace
</del><ins>+BuiltInFunctionEmulator::BuiltInFunctionEmulator()
+{}
</ins><span class="cx"> 
</span><del>-BuiltInFunctionEmulator::BuiltInFunctionEmulator(ShShaderType shaderType)
</del><ins>+void BuiltInFunctionEmulator::addEmulatedFunction(
+    TOperator op, const TType&amp; param,
+    const char* emulatedFunctionDefinition)
</ins><span class="cx"> {
</span><del>-    if (shaderType == SH_FRAGMENT_SHADER) {
-        mFunctionMask = kFunctionEmulationFragmentMask;
-        mFunctionSource = kFunctionEmulationFragmentSource;
-    } else {
-        mFunctionMask = kFunctionEmulationVertexMask;
-        mFunctionSource = kFunctionEmulationVertexSource;
-    }
</del><ins>+    mEmulatedFunctions[FunctionId(op, param)] =
+        std::string(emulatedFunctionDefinition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool BuiltInFunctionEmulator::SetFunctionCalled(
-    TOperator op, const TType&amp; param)
</del><ins>+void BuiltInFunctionEmulator::addEmulatedFunction(
+    TOperator op, const TType&amp; param1, const TType&amp; param2,
+    const char* emulatedFunctionDefinition)
</ins><span class="cx"> {
</span><del>-    TBuiltInFunction function = IdentifyFunction(op, param);
-    return SetFunctionCalled(function);
</del><ins>+    mEmulatedFunctions[FunctionId(op, param1, param2)] =
+        std::string(emulatedFunctionDefinition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool BuiltInFunctionEmulator::SetFunctionCalled(
-    TOperator op, const TType&amp; param1, const TType&amp; param2)
</del><ins>+void BuiltInFunctionEmulator::addEmulatedFunction(
+    TOperator op, const TType&amp; param1, const TType&amp; param2, const TType&amp; param3,
+    const char* emulatedFunctionDefinition)
</ins><span class="cx"> {
</span><del>-    TBuiltInFunction function = IdentifyFunction(op, param1, param2);
-    return SetFunctionCalled(function);
</del><ins>+    mEmulatedFunctions[FunctionId(op, param1, param2, param3)] =
+        std::string(emulatedFunctionDefinition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool BuiltInFunctionEmulator::SetFunctionCalled(
-    BuiltInFunctionEmulator::TBuiltInFunction function) {
-    if (function == TFunctionUnknown || mFunctionMask[function] == false)
-        return false;
-    for (size_t i = 0; i &lt; mFunctions.size(); ++i) {
-        if (mFunctions[i] == function)
-            return true;
-    }
-    mFunctions.push_back(function);
-    return true;
</del><ins>+bool BuiltInFunctionEmulator::IsOutputEmpty() const
+{
+    return (mFunctions.size() == 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void BuiltInFunctionEmulator::OutputEmulatedFunctionDefinition(
-    TInfoSinkBase&amp; out, bool withPrecision) const
</del><ins>+void BuiltInFunctionEmulator::OutputEmulatedFunctions(
+    TInfoSinkBase&amp; out) const
</ins><span class="cx"> {
</span><del>-    if (mFunctions.size() == 0)
-        return;
-    out &lt;&lt; &quot;// BEGIN: Generated code for built-in function emulation\n\n&quot;;
-    if (withPrecision) {
-        out &lt;&lt; &quot;#if defined(GL_FRAGMENT_PRECISION_HIGH)\n&quot;
-            &lt;&lt; &quot;#define webgl_emu_precision highp\n&quot;
-            &lt;&lt; &quot;#else\n&quot;
-            &lt;&lt; &quot;#define webgl_emu_precision mediump\n&quot;
-            &lt;&lt; &quot;#endif\n\n&quot;;
-    } else {
-        out &lt;&lt; &quot;#define webgl_emu_precision\n\n&quot;;
-    }
</del><span class="cx">     for (size_t i = 0; i &lt; mFunctions.size(); ++i) {
</span><del>-        out &lt;&lt; mFunctionSource[mFunctions[i]] &lt;&lt; &quot;\n\n&quot;;
</del><ins>+        out &lt;&lt; mEmulatedFunctions.find(mFunctions[i])-&gt;second &lt;&lt; &quot;\n\n&quot;;
</ins><span class="cx">     }
</span><del>-    out &lt;&lt; &quot;// END: Generated code for built-in function emulation\n\n&quot;;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-BuiltInFunctionEmulator::TBuiltInFunction
-BuiltInFunctionEmulator::IdentifyFunction(
</del><ins>+bool BuiltInFunctionEmulator::SetFunctionCalled(
</ins><span class="cx">     TOperator op, const TType&amp; param)
</span><span class="cx"> {
</span><del>-    if (param.getNominalSize() &gt; 4 || param.getSecondarySize() &gt; 4)
-        return TFunctionUnknown;
-    unsigned int function = TFunctionUnknown;
-    switch (op) {
-        case EOpCos:
-            function = TFunctionCos1;
-            break;
-        case EOpLength:
-            function = TFunctionLength1;
-            break;
-        case EOpNormalize:
-            function = TFunctionNormalize1;
-            break;
-        default:
-            break;
-    }
-    if (function == TFunctionUnknown)
-        return TFunctionUnknown;
-    if (param.isVector())
-        function += param.getNominalSize() - 1;
-    return static_cast&lt;TBuiltInFunction&gt;(function);
</del><ins>+    return SetFunctionCalled(FunctionId(op, param));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-BuiltInFunctionEmulator::TBuiltInFunction
-BuiltInFunctionEmulator::IdentifyFunction(
</del><ins>+bool BuiltInFunctionEmulator::SetFunctionCalled(
</ins><span class="cx">     TOperator op, const TType&amp; param1, const TType&amp; param2)
</span><span class="cx"> {
</span><del>-    // Right now for all the emulated functions with two parameters, the two
-    // parameters have the same type.
-    if (param1.getNominalSize()     != param2.getNominalSize()   ||
-        param1.getSecondarySize()   != param2.getSecondarySize() ||
-        param1.getNominalSize() &gt; 4 || param1.getSecondarySize() &gt; 4)
-        return TFunctionUnknown;
</del><ins>+    return SetFunctionCalled(FunctionId(op, param1, param2));
+}
</ins><span class="cx"> 
</span><del>-    unsigned int function = TFunctionUnknown;
-    switch (op) {
-        case EOpDistance:
-            function = TFunctionDistance1_1;
-            break;
-        case EOpDot:
-            function = TFunctionDot1_1;
-            break;
-        case EOpReflect:
-            function = TFunctionReflect1_1;
-            break;
-        default:
-            break;
</del><ins>+bool BuiltInFunctionEmulator::SetFunctionCalled(
+    TOperator op, const TType&amp; param1, const TType&amp; param2, const TType&amp; param3)
+{
+    return SetFunctionCalled(FunctionId(op, param1, param2, param3));
+}
+
+bool BuiltInFunctionEmulator::SetFunctionCalled(
+    const FunctionId&amp; functionId) {
+    if (mEmulatedFunctions.find(functionId) != mEmulatedFunctions.end())
+    {
+        for (size_t i = 0; i &lt; mFunctions.size(); ++i) {
+            if (mFunctions[i] == functionId)
+                return true;
+        }
+        mFunctions.push_back(functionId);
+        return true;
</ins><span class="cx">     }
</span><del>-    if (function == TFunctionUnknown)
-        return TFunctionUnknown;
-    if (param1.isVector())
-        function += param1.getNominalSize() - 1;
-    return static_cast&lt;TBuiltInFunction&gt;(function);
</del><ins>+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BuiltInFunctionEmulator::MarkBuiltInFunctionsForEmulation(
</span><span class="lines">@@ -387,6 +174,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(root);
</span><span class="cx"> 
</span><ins>+    if (mEmulatedFunctions.empty())
+        return;
+
</ins><span class="cx">     BuiltInFunctionEmulationMarker marker(*this);
</span><span class="cx">     root-&gt;traverse(&amp;marker);
</span><span class="cx"> }
</span><span class="lines">@@ -404,3 +194,52 @@
</span><span class="cx">     return &quot;webgl_&quot; + name.substr(0, name.length() - 1) + &quot;_emu(&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+BuiltInFunctionEmulator::FunctionId::FunctionId
+    (TOperator op, const TType&amp; param)
+    : mOp(op),
+      mParam1(param),
+      mParam2(EbtVoid),
+      mParam3(EbtVoid)
+{
+}
+
+BuiltInFunctionEmulator::FunctionId::FunctionId
+    (TOperator op, const TType&amp; param1, const TType&amp; param2)
+    : mOp(op),
+      mParam1(param1),
+      mParam2(param2),
+      mParam3(EbtVoid)
+{
+}
+
+BuiltInFunctionEmulator::FunctionId::FunctionId
+    (TOperator op, const TType&amp; param1, const TType&amp; param2, const TType&amp; param3)
+    : mOp(op),
+      mParam1(param1),
+      mParam2(param2),
+      mParam3(param3)
+{
+}
+
+bool BuiltInFunctionEmulator::FunctionId::operator==
+    (const BuiltInFunctionEmulator::FunctionId&amp; other) const
+{
+    return (mOp == other.mOp &amp;&amp;
+        mParam1 == other.mParam1 &amp;&amp;
+        mParam2 == other.mParam2 &amp;&amp;
+        mParam3 == other.mParam3);
+}
+
+bool BuiltInFunctionEmulator::FunctionId::operator&lt;
+    (const BuiltInFunctionEmulator::FunctionId&amp; other) const
+{
+    if (mOp != other.mOp)
+        return mOp &lt; other.mOp;
+    if (mParam1 != other.mParam1)
+        return mParam1 &lt; other.mParam1;
+    if (mParam2 != other.mParam2)
+        return mParam2 &lt; other.mParam2;
+    if (mParam3 != other.mParam3)
+       return mParam3 &lt; other.mParam3;
+    return false; // all fields are equal
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,33 +4,23 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
-#define COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_
+#define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // This class decides which built-in functions need to be replaced with the
</span><span class="cx"> // emulated ones.
</span><del>-// It's only a workaround for OpenGL driver bugs, and isn't needed in general.
</del><ins>+// It can be used to work around driver bugs or implement functions that are
+// not natively implemented on a specific platform.
</ins><span class="cx"> //
</span><del>-class BuiltInFunctionEmulator {
-public:
-    BuiltInFunctionEmulator(ShShaderType shaderType);
-    // Records that a function is called by the shader and might needs to be
-    // emulated.  If the function's group is not in mFunctionGroupFilter, this
-    // becomes an no-op.
-    // Returns true if the function call needs to be replaced with an emulated
-    // one.
-    bool SetFunctionCalled(TOperator op, const TType&amp; param);
-    bool SetFunctionCalled(
-        TOperator op, const TType&amp; param1, const TType&amp; param2);
</del><ins>+class BuiltInFunctionEmulator
+{
+  public:
+    BuiltInFunctionEmulator();
</ins><span class="cx"> 
</span><del>-    // Output function emulation definition.  This should be before any other
-    // shader source.
-    void OutputEmulatedFunctionDefinition(TInfoSinkBase&amp; out, bool withPrecision) const;
-
</del><span class="cx">     void MarkBuiltInFunctionsForEmulation(TIntermNode* root);
</span><span class="cx"> 
</span><span class="cx">     void Cleanup();
</span><span class="lines">@@ -38,54 +28,52 @@
</span><span class="cx">     // &quot;name(&quot; becomes &quot;webgl_name_emu(&quot;.
</span><span class="cx">     static TString GetEmulatedFunctionName(const TString&amp; name);
</span><span class="cx"> 
</span><del>-private:
-    //
-    // Built-in functions.
-    //
-    enum TBuiltInFunction {
-        TFunctionCos1 = 0,  // float cos(float);
-        TFunctionCos2,  // vec2 cos(vec2);
-        TFunctionCos3,  // vec3 cos(vec3);
-        TFunctionCos4,  // vec4 cos(vec4);
</del><ins>+    bool IsOutputEmpty() const;
</ins><span class="cx"> 
</span><del>-        TFunctionDistance1_1,  // float distance(float, float);
-        TFunctionDistance2_2,  // vec2 distance(vec2, vec2);
-        TFunctionDistance3_3,  // vec3 distance(vec3, vec3);
-        TFunctionDistance4_4,  // vec4 distance(vec4, vec4);
</del><ins>+    // Output function emulation definition. This should be before any other
+    // shader source.
+    void OutputEmulatedFunctions(TInfoSinkBase&amp; out) const;
</ins><span class="cx"> 
</span><del>-        TFunctionDot1_1,  // float dot(float, float);
-        TFunctionDot2_2,  // vec2 dot(vec2, vec2);
-        TFunctionDot3_3,  // vec3 dot(vec3, vec3);
-        TFunctionDot4_4,  // vec4 dot(vec4, vec4);
</del><ins>+    // Add functions that need to be emulated.
+    void addEmulatedFunction(TOperator op, const TType&amp; param, const char* emulatedFunctionDefinition);
+    void addEmulatedFunction(TOperator op, const TType&amp; param1, const TType&amp; param2, const char* emulatedFunctionDefinition);
+    void addEmulatedFunction(TOperator op, const TType&amp; param1, const TType&amp; param2, const TType&amp; param3, const char* emulatedFunctionDefinition);
</ins><span class="cx"> 
</span><del>-        TFunctionLength1,  // float length(float);
-        TFunctionLength2,  // float length(vec2);
-        TFunctionLength3,  // float length(vec3);
-        TFunctionLength4,  // float length(vec4);
</del><ins>+  private:
+    class BuiltInFunctionEmulationMarker;
</ins><span class="cx"> 
</span><del>-        TFunctionNormalize1,  // float normalize(float);
-        TFunctionNormalize2,  // vec2 normalize(vec2);
-        TFunctionNormalize3,  // vec3 normalize(vec3);
-        TFunctionNormalize4,  // vec4 normalize(vec4);
</del><ins>+    // Records that a function is called by the shader and might need to be
+    // emulated. If the function is not in mEmulatedFunctions, this becomes a
+    // no-op. Returns true if the function call needs to be replaced with an
+    // emulated one.
+    bool SetFunctionCalled(TOperator op, const TType&amp; param);
+    bool SetFunctionCalled(
+        TOperator op, const TType&amp; param1, const TType&amp; param2);
+    bool SetFunctionCalled(
+        TOperator op, const TType&amp; param1, const TType&amp; param2, const TType&amp; param3);
</ins><span class="cx"> 
</span><del>-        TFunctionReflect1_1,  // float reflect(float, float);
-        TFunctionReflect2_2,  // vec2 reflect(vec2, vec2);
-        TFunctionReflect3_3,  // vec3 reflect(vec3, vec3);
-        TFunctionReflect4_4,  // vec4 reflect(vec4, vec4);
</del><ins>+    class FunctionId {
+      public:
+        FunctionId(TOperator op, const TType&amp; param);
+        FunctionId(TOperator op, const TType&amp; param1, const TType&amp; param2);
+        FunctionId(TOperator op, const TType&amp; param1, const TType&amp; param2, const TType&amp; param3);
</ins><span class="cx"> 
</span><del>-        TFunctionUnknown
</del><ins>+        bool operator==(const FunctionId&amp; other) const;
+        bool operator&lt;(const FunctionId&amp; other) const;
+      private:
+        TOperator mOp;
+        TType mParam1;
+        TType mParam2;
+        TType mParam3;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><del>-    TBuiltInFunction IdentifyFunction(TOperator op, const TType&amp; param);
-    TBuiltInFunction IdentifyFunction(
-        TOperator op, const TType&amp; param1, const TType&amp; param2);
</del><ins>+    bool SetFunctionCalled(const FunctionId&amp; functionId);
</ins><span class="cx"> 
</span><del>-    bool SetFunctionCalled(TBuiltInFunction function);
</del><ins>+    // Map from function id to emulated function definition
+    std::map&lt;FunctionId, std::string&gt; mEmulatedFunctions;
</ins><span class="cx"> 
</span><del>-    std::vector&lt;TBuiltInFunction&gt; mFunctions;
-
-    const bool* mFunctionMask;  // a boolean flag for each function.
-    const char** mFunctionSource;
</del><ins>+    // Called function ids
+    std::vector&lt;FunctionId&gt; mFunctions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILIER_BUILT_IN_FUNCTION_EMULATOR_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorGLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+//
+// 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.
+//
+
+#include &quot;angle_gl.h&quot;
+#include &quot;compiler/translator/BuiltInFunctionEmulator.h&quot;
+#include &quot;compiler/translator/BuiltInFunctionEmulatorGLSL.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
+
+void InitBuiltInFunctionEmulatorForGLSL(BuiltInFunctionEmulator *emu, sh::GLenum shaderType)
+{
+    // we use macros here instead of function definitions to work around more GLSL
+    // compiler bugs, in particular on NVIDIA hardware on Mac OSX. Macros are
+    // problematic because if the argument has side-effects they will be repeatedly
+    // evaluated. This is unlikely to show up in real shaders, but is something to
+    // consider.
+
+    TType float1(EbtFloat);
+    TType float2(EbtFloat, 2);
+    TType float3(EbtFloat, 3);
+    TType float4(EbtFloat, 4);
+
+    if (shaderType == GL_FRAGMENT_SHADER)
+    {
+        emu-&gt;addEmulatedFunction(EOpCos, float1, &quot;webgl_emu_precision float webgl_cos_emu(webgl_emu_precision float a) { return cos(a); }&quot;);
+        emu-&gt;addEmulatedFunction(EOpCos, float2, &quot;webgl_emu_precision vec2 webgl_cos_emu(webgl_emu_precision vec2 a) { return cos(a); }&quot;);
+        emu-&gt;addEmulatedFunction(EOpCos, float3, &quot;webgl_emu_precision vec3 webgl_cos_emu(webgl_emu_precision vec3 a) { return cos(a); }&quot;);
+        emu-&gt;addEmulatedFunction(EOpCos, float4, &quot;webgl_emu_precision vec4 webgl_cos_emu(webgl_emu_precision vec4 a) { return cos(a); }&quot;);
+    }
+    emu-&gt;addEmulatedFunction(EOpDistance, float1, float1, &quot;#define webgl_distance_emu(x, y) ((x) &gt;= (y) ? (x) - (y) : (y) - (x))&quot;);
+    emu-&gt;addEmulatedFunction(EOpDot, float1, float1, &quot;#define webgl_dot_emu(x, y) ((x) * (y))&quot;);
+    emu-&gt;addEmulatedFunction(EOpLength, float1, &quot;#define webgl_length_emu(x) ((x) &gt;= 0.0 ? (x) : -(x))&quot;);
+    emu-&gt;addEmulatedFunction(EOpNormalize, float1, &quot;#define webgl_normalize_emu(x) ((x) == 0.0 ? 0.0 : ((x) &gt; 0.0 ? 1.0 : -1.0))&quot;);
+    emu-&gt;addEmulatedFunction(EOpReflect, float1, float1, &quot;#define webgl_reflect_emu(I, N) ((I) - 2.0 * (N) * (I) * (N))&quot;);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorGLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+//
+// 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
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_
+#define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_
+
+#include &quot;GLSLANG/ShaderLang.h&quot;
+
+class BuiltInFunctionEmulator;
+
+//
+// This is only a workaround for OpenGL driver bugs, and isn't needed in general.
+//
+void InitBuiltInFunctionEmulatorForGLSL(BuiltInFunctionEmulator *emu, sh::GLenum shaderType);
+
+#endif  // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORGLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,410 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;angle_gl.h&quot;
+#include &quot;compiler/translator/BuiltInFunctionEmulator.h&quot;
+#include &quot;compiler/translator/BuiltInFunctionEmulatorHLSL.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
+
+void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu)
+{
+    TType float1(EbtFloat);
+    TType float2(EbtFloat, 2);
+    TType float3(EbtFloat, 3);
+    TType float4(EbtFloat, 4);
+
+    emu-&gt;addEmulatedFunction(EOpMod, float1, float1,
+        &quot;float webgl_mod_emu(float x, float y)\n&quot;
+        &quot;{\n&quot;
+        &quot;    return x - y * floor(x / y);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpMod, float2, float2,
+        &quot;float2 webgl_mod_emu(float2 x, float2 y)\n&quot;
+        &quot;{\n&quot;
+        &quot;    return x - y * floor(x / y);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpMod, float2, float1,
+        &quot;float2 webgl_mod_emu(float2 x, float y)\n&quot;
+        &quot;{\n&quot;
+        &quot;    return x - y * floor(x / y);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpMod, float3, float3,
+        &quot;float3 webgl_mod_emu(float3 x, float3 y)\n&quot;
+        &quot;{\n&quot;
+        &quot;    return x - y * floor(x / y);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpMod, float3, float1,
+        &quot;float3 webgl_mod_emu(float3 x, float y)\n&quot;
+        &quot;{\n&quot;
+        &quot;    return x - y * floor(x / y);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpMod, float4, float4,
+        &quot;float4 webgl_mod_emu(float4 x, float4 y)\n&quot;
+        &quot;{\n&quot;
+        &quot;    return x - y * floor(x / y);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpMod, float4, float1,
+        &quot;float4 webgl_mod_emu(float4 x, float y)\n&quot;
+        &quot;{\n&quot;
+        &quot;    return x - y * floor(x / y);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpFaceForward, float1, float1, float1,
+        &quot;float webgl_faceforward_emu(float N, float I, float Nref)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return -N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;    else\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpFaceForward, float2, float2, float2,
+        &quot;float2 webgl_faceforward_emu(float2 N, float2 I, float2 Nref)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return -N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;    else\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpFaceForward, float3, float3, float3,
+        &quot;float3 webgl_faceforward_emu(float3 N, float3 I, float3 Nref)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return -N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;    else\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpFaceForward, float4, float4, float4,
+        &quot;float4 webgl_faceforward_emu(float4 N, float4 I, float4 Nref)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return -N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;    else\n&quot;
+        &quot;    {\n&quot;
+        &quot;        return N;\n&quot;
+        &quot;    }\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpAtan, float1, float1,
+        &quot;float webgl_atan_emu(float y, float x)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(x == 0 &amp;&amp; y == 0) x = 1;\n&quot;   // Avoid producing a NaN
+        &quot;    return atan2(y, x);\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAtan, float2, float2,
+        &quot;float2 webgl_atan_emu(float2 y, float2 x)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(x[0] == 0 &amp;&amp; y[0] == 0) x[0] = 1;\n&quot;
+        &quot;    if(x[1] == 0 &amp;&amp; y[1] == 0) x[1] = 1;\n&quot;
+        &quot;    return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAtan, float3, float3,
+        &quot;float3 webgl_atan_emu(float3 y, float3 x)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(x[0] == 0 &amp;&amp; y[0] == 0) x[0] = 1;\n&quot;
+        &quot;    if(x[1] == 0 &amp;&amp; y[1] == 0) x[1] = 1;\n&quot;
+        &quot;    if(x[2] == 0 &amp;&amp; y[2] == 0) x[2] = 1;\n&quot;
+        &quot;    return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAtan, float4, float4,
+        &quot;float4 webgl_atan_emu(float4 y, float4 x)\n&quot;
+        &quot;{\n&quot;
+        &quot;    if(x[0] == 0 &amp;&amp; y[0] == 0) x[0] = 1;\n&quot;
+        &quot;    if(x[1] == 0 &amp;&amp; y[1] == 0) x[1] = 1;\n&quot;
+        &quot;    if(x[2] == 0 &amp;&amp; y[2] == 0) x[2] = 1;\n&quot;
+        &quot;    if(x[3] == 0 &amp;&amp; y[3] == 0) x[3] = 1;\n&quot;
+        &quot;    return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]), atan2(y[3], x[3]));\n&quot;
+        &quot;}\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpAsinh, float1,
+        &quot;float webgl_asinh_emu(in float x) {\n&quot;
+        &quot;    return log(x + sqrt(pow(x, 2.0) + 1.0));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAsinh, float2,
+        &quot;float2 webgl_asinh_emu(in float2 x) {\n&quot;
+        &quot;    return log(x + sqrt(pow(x, 2.0) + 1.0));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAsinh, float3,
+        &quot;float3 webgl_asinh_emu(in float3 x) {\n&quot;
+        &quot;    return log(x + sqrt(pow(x, 2.0) + 1.0));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAsinh, float4,
+        &quot;float4 webgl_asinh_emu(in float4 x) {\n&quot;
+        &quot;    return log(x + sqrt(pow(x, 2.0) + 1.0));\n&quot;
+        &quot;}\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpAcosh, float1,
+        &quot;float webgl_acosh_emu(in float x) {\n&quot;
+        &quot;    return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAcosh, float2,
+        &quot;float2 webgl_acosh_emu(in float2 x) {\n&quot;
+        &quot;    return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAcosh, float3,
+        &quot;float3 webgl_acosh_emu(in float3 x) {\n&quot;
+        &quot;    return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAcosh, float4,
+        &quot;float4 webgl_acosh_emu(in float4 x) {\n&quot;
+        &quot;    return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n&quot;
+        &quot;}\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpAtanh, float1,
+        &quot;float webgl_atanh_emu(in float x) {\n&quot;
+        &quot;    return 0.5 * log((1.0 + x) / (1.0 - x));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAtanh, float2,
+        &quot;float2 webgl_atanh_emu(in float2 x) {\n&quot;
+        &quot;    return 0.5 * log((1.0 + x) / (1.0 - x));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAtanh, float3,
+        &quot;float3 webgl_atanh_emu(in float3 x) {\n&quot;
+        &quot;    return 0.5 * log((1.0 + x) / (1.0 - x));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpAtanh, float4,
+        &quot;float4 webgl_atanh_emu(in float4 x) {\n&quot;
+        &quot;    return 0.5 * log((1.0 + x) / (1.0 - x));\n&quot;
+        &quot;}\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpRoundEven, float1,
+        &quot;float webgl_roundEven_emu(in float x) {\n&quot;
+        &quot;    return (frac(x) == 0.5 &amp;&amp; trunc(x) % 2.0 == 0.0) ? trunc(x) : round(x);\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpRoundEven, float2,
+        &quot;float2 webgl_roundEven_emu(in float2 x) {\n&quot;
+        &quot;    float2 v;\n&quot;
+        &quot;    v[0] = (frac(x[0]) == 0.5 &amp;&amp; trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);\n&quot;
+        &quot;    v[1] = (frac(x[1]) == 0.5 &amp;&amp; trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);\n&quot;
+        &quot;    return v;\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpRoundEven, float3,
+        &quot;float3 webgl_roundEven_emu(in float3 x) {\n&quot;
+        &quot;    float3 v;\n&quot;
+        &quot;    v[0] = (frac(x[0]) == 0.5 &amp;&amp; trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);\n&quot;
+        &quot;    v[1] = (frac(x[1]) == 0.5 &amp;&amp; trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);\n&quot;
+        &quot;    v[2] = (frac(x[2]) == 0.5 &amp;&amp; trunc(x[2]) % 2.0 == 0.0) ? trunc(x[2]) : round(x[2]);\n&quot;
+        &quot;    return v;\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpRoundEven, float4,
+        &quot;float4 webgl_roundEven_emu(in float4 x) {\n&quot;
+        &quot;    float4 v;\n&quot;
+        &quot;    v[0] = (frac(x[0]) == 0.5 &amp;&amp; trunc(x[0]) % 2.0 == 0.0) ? trunc(x[0]) : round(x[0]);\n&quot;
+        &quot;    v[1] = (frac(x[1]) == 0.5 &amp;&amp; trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);\n&quot;
+        &quot;    v[2] = (frac(x[2]) == 0.5 &amp;&amp; trunc(x[2]) % 2.0 == 0.0) ? trunc(x[2]) : round(x[2]);\n&quot;
+        &quot;    v[3] = (frac(x[3]) == 0.5 &amp;&amp; trunc(x[3]) % 2.0 == 0.0) ? trunc(x[3]) : round(x[3]);\n&quot;
+        &quot;    return v;\n&quot;
+        &quot;}\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpPackSnorm2x16, float2,
+        &quot;int webgl_toSnorm(in float x) {\n&quot;
+        &quot;    return int(round(clamp(x, -1.0, 1.0) * 32767.0));\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;
+        &quot;uint webgl_packSnorm2x16_emu(in float2 v) {\n&quot;
+        &quot;    int x = webgl_toSnorm(v.x);\n&quot;
+        &quot;    int y = webgl_toSnorm(v.y);\n&quot;
+        &quot;    return (asuint(y) &lt;&lt; 16) | (asuint(x) &amp; 0xffffu);\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpPackUnorm2x16, float2,
+        &quot;uint webgl_toUnorm(in float x) {\n&quot;
+        &quot;    return uint(round(clamp(x, 0.0, 1.0) * 65535.0));\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;
+        &quot;uint webgl_packUnorm2x16_emu(in float2 v) {\n&quot;
+        &quot;    uint x = webgl_toUnorm(v.x);\n&quot;
+        &quot;    uint y = webgl_toUnorm(v.y);\n&quot;
+        &quot;    return (y &lt;&lt; 16) | x;\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpPackHalf2x16, float2,
+        &quot;uint webgl_packHalf2x16_emu(in float2 v) {\n&quot;
+        &quot;    uint x = f32tof16(v.x);\n&quot;
+        &quot;    uint y = f32tof16(v.y);\n&quot;
+        &quot;    return (y &lt;&lt; 16) | x;\n&quot;
+        &quot;}\n&quot;);
+
+    TType uint1(EbtUInt);
+
+    emu-&gt;addEmulatedFunction(EOpUnpackSnorm2x16, uint1,
+        &quot;float webgl_fromSnorm(in uint x) {\n&quot;
+        &quot;    int xi = asint(x &amp; 0x7fffu) - asint(x &amp; 0x8000u);\n&quot;
+        &quot;    return clamp(float(xi) / 32767.0, -1.0, 1.0);\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;
+        &quot;float2 webgl_unpackSnorm2x16_emu(in uint u) {\n&quot;
+        &quot;    uint y = (u &gt;&gt; 16);\n&quot;
+        &quot;    uint x = u;\n&quot;
+        &quot;    return float2(webgl_fromSnorm(x), webgl_fromSnorm(y));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpUnpackUnorm2x16, uint1,
+        &quot;float webgl_fromUnorm(in uint x) {\n&quot;
+        &quot;    return float(x) / 65535.0;\n&quot;
+        &quot;}\n&quot;
+        &quot;\n&quot;
+        &quot;float2 webgl_unpackUnorm2x16_emu(in uint u) {\n&quot;
+        &quot;    uint y = (u &gt;&gt; 16);\n&quot;
+        &quot;    uint x = u &amp; 0xffffu;\n&quot;
+        &quot;    return float2(webgl_fromUnorm(x), webgl_fromUnorm(y));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpUnpackHalf2x16, uint1,
+        &quot;float2 webgl_unpackHalf2x16_emu(in uint u) {\n&quot;
+        &quot;    uint y = (u &gt;&gt; 16);\n&quot;
+        &quot;    uint x = u &amp; 0xffffu;\n&quot;
+        &quot;    return float2(f16tof32(x), f16tof32(y));\n&quot;
+        &quot;}\n&quot;);
+
+    // The matrix resulting from outer product needs to be transposed
+    // (matrices are stored as transposed to simplify element access in HLSL).
+    // So the function should return transpose(c * r) where c is a column vector
+    // and r is a row vector. This can be simplified by using the following
+    // formula:
+    //   transpose(c * r) = transpose(r) * transpose(c)
+    // transpose(r) and transpose(c) are in a sense free, since to get the
+    // transpose of r, we simply can build a column matrix out of the original
+    // vector instead of a row matrix.
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float2, float2,
+        &quot;float2x2 webgl_outerProduct_emu(in float2 c, in float2 r) {\n&quot;
+        &quot;    return mul(float2x1(r), float1x2(c));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float3, float3,
+        &quot;float3x3 webgl_outerProduct_emu(in float3 c, in float3 r) {\n&quot;
+        &quot;    return mul(float3x1(r), float1x3(c));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float4, float4,
+        &quot;float4x4 webgl_outerProduct_emu(in float4 c, in float4 r) {\n&quot;
+        &quot;    return mul(float4x1(r), float1x4(c));\n&quot;
+        &quot;}\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float3, float2,
+        &quot;float2x3 webgl_outerProduct_emu(in float3 c, in float2 r) {\n&quot;
+        &quot;    return mul(float2x1(r), float1x3(c));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float2, float3,
+        &quot;float3x2 webgl_outerProduct_emu(in float2 c, in float3 r) {\n&quot;
+        &quot;    return mul(float3x1(r), float1x2(c));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float4, float2,
+        &quot;float2x4 webgl_outerProduct_emu(in float4 c, in float2 r) {\n&quot;
+        &quot;    return mul(float2x1(r), float1x4(c));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float2, float4,
+        &quot;float4x2 webgl_outerProduct_emu(in float2 c, in float4 r) {\n&quot;
+        &quot;    return mul(float4x1(r), float1x2(c));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float4, float3,
+        &quot;float3x4 webgl_outerProduct_emu(in float4 c, in float3 r) {\n&quot;
+        &quot;    return mul(float3x1(r), float1x4(c));\n&quot;
+        &quot;}\n&quot;);
+    emu-&gt;addEmulatedFunction(EOpOuterProduct, float3, float4,
+        &quot;float4x3 webgl_outerProduct_emu(in float3 c, in float4 r) {\n&quot;
+        &quot;    return mul(float4x1(r), float1x3(c));\n&quot;
+        &quot;}\n&quot;);
+
+    TType mat2(EbtFloat, 2, 2);
+    TType mat3(EbtFloat, 3, 3);
+    TType mat4(EbtFloat, 4, 4);
+
+    // Remember here that the parameter matrix is actually the transpose
+    // of the matrix that we're trying to invert, and the resulting matrix
+    // should also be the transpose of the inverse.
+
+    // When accessing the parameter matrix with m[a][b] it can be thought of so
+    // that a is the column and b is the row of the matrix that we're inverting.
+
+    // We calculate the inverse as the adjugate matrix divided by the
+    // determinant of the matrix being inverted. However, as the result needs
+    // to be transposed, we actually use of the transpose of the adjugate matrix
+    // which happens to be the cofactor matrix. That's stored in &quot;cof&quot;.
+
+    // We don't need to care about divide-by-zero since results are undefined
+    // for singular or poorly-conditioned matrices.
+
+    emu-&gt;addEmulatedFunction(EOpInverse, mat2,
+        &quot;float2x2 webgl_inverse_emu(in float2x2 m) {\n&quot;
+        &quot;    float2x2 cof = { m[1][1], -m[0][1], -m[1][0], m[0][0] };\n&quot;
+        &quot;    return cof / determinant(transpose(m));\n&quot;
+        &quot;}\n&quot;);
+
+    // cofAB is the cofactor for column A and row B.
+
+    emu-&gt;addEmulatedFunction(EOpInverse, mat3,
+        &quot;float3x3 webgl_inverse_emu(in float3x3 m) {\n&quot;
+        &quot;    float cof00 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n&quot;
+        &quot;    float cof01 = -(m[1][0] * m[2][2] - m[2][0] * m[1][2]);\n&quot;
+        &quot;    float cof02 = m[1][0] * m[2][1] - m[2][0] * m[1][1];\n&quot;
+        &quot;    float cof10 = -(m[0][1] * m[2][2] - m[2][1] * m[0][2]);\n&quot;
+        &quot;    float cof11 = m[0][0] * m[2][2] - m[2][0] * m[0][2];\n&quot;
+        &quot;    float cof12 = -(m[0][0] * m[2][1] - m[2][0] * m[0][1]);\n&quot;
+        &quot;    float cof20 = m[0][1] * m[1][2] - m[1][1] * m[0][2];\n&quot;
+        &quot;    float cof21 = -(m[0][0] * m[1][2] - m[1][0] * m[0][2]);\n&quot;
+        &quot;    float cof22 = m[0][0] * m[1][1] - m[1][0] * m[0][1];\n&quot;
+        &quot;    float3x3 cof = { cof00, cof10, cof20, cof01, cof11, cof21, cof02, cof12, cof22 };\n&quot;
+        &quot;    return cof / determinant(transpose(m));\n&quot;
+        &quot;}\n&quot;);
+
+    emu-&gt;addEmulatedFunction(EOpInverse, mat4,
+        &quot;float4x4 webgl_inverse_emu(in float4x4 m) {\n&quot;
+        &quot;    float cof00 = m[1][1] * m[2][2] * m[3][3] + m[2][1] * m[3][2] * m[1][3] + m[3][1] * m[1][2] * m[2][3]&quot;
+                       &quot; - m[1][1] * m[3][2] * m[2][3] - m[2][1] * m[1][2] * m[3][3] - m[3][1] * m[2][2] * m[1][3];\n&quot;
+        &quot;    float cof01 = -(m[1][0] * m[2][2] * m[3][3] + m[2][0] * m[3][2] * m[1][3] + m[3][0] * m[1][2] * m[2][3]&quot;
+                       &quot; - m[1][0] * m[3][2] * m[2][3] - m[2][0] * m[1][2] * m[3][3] - m[3][0] * m[2][2] * m[1][3]);\n&quot;
+        &quot;    float cof02 = m[1][0] * m[2][1] * m[3][3] + m[2][0] * m[3][1] * m[1][3] + m[3][0] * m[1][1] * m[2][3]&quot;
+                       &quot; - m[1][0] * m[3][1] * m[2][3] - m[2][0] * m[1][1] * m[3][3] - m[3][0] * m[2][1] * m[1][3];\n&quot;
+        &quot;    float cof03 = -(m[1][0] * m[2][1] * m[3][2] + m[2][0] * m[3][1] * m[1][2] + m[3][0] * m[1][1] * m[2][2]&quot;
+                       &quot; - m[1][0] * m[3][1] * m[2][2] - m[2][0] * m[1][1] * m[3][2] - m[3][0] * m[2][1] * m[1][2]);\n&quot;
+        &quot;    float cof10 = -(m[0][1] * m[2][2] * m[3][3] + m[2][1] * m[3][2] * m[0][3] + m[3][1] * m[0][2] * m[2][3]&quot;
+                       &quot; - m[0][1] * m[3][2] * m[2][3] - m[2][1] * m[0][2] * m[3][3] - m[3][1] * m[2][2] * m[0][3]);\n&quot;
+        &quot;    float cof11 = m[0][0] * m[2][2] * m[3][3] + m[2][0] * m[3][2] * m[0][3] + m[3][0] * m[0][2] * m[2][3]&quot;
+                       &quot; - m[0][0] * m[3][2] * m[2][3] - m[2][0] * m[0][2] * m[3][3] - m[3][0] * m[2][2] * m[0][3];\n&quot;
+        &quot;    float cof12 = -(m[0][0] * m[2][1] * m[3][3] + m[2][0] * m[3][1] * m[0][3] + m[3][0] * m[0][1] * m[2][3]&quot;
+                       &quot; - m[0][0] * m[3][1] * m[2][3] - m[2][0] * m[0][1] * m[3][3] - m[3][0] * m[2][1] * m[0][3]);\n&quot;
+        &quot;    float cof13 = m[0][0] * m[2][1] * m[3][2] + m[2][0] * m[3][1] * m[0][2] + m[3][0] * m[0][1] * m[2][2]&quot;
+                       &quot; - m[0][0] * m[3][1] * m[2][2] - m[2][0] * m[0][1] * m[3][2] - m[3][0] * m[2][1] * m[0][2];\n&quot;
+        &quot;    float cof20 = m[0][1] * m[1][2] * m[3][3] + m[1][1] * m[3][2] * m[0][3] + m[3][1] * m[0][2] * m[1][3]&quot;
+                       &quot; - m[0][1] * m[3][2] * m[1][3] - m[1][1] * m[0][2] * m[3][3] - m[3][1] * m[1][2] * m[0][3];\n&quot;
+        &quot;    float cof21 = -(m[0][0] * m[1][2] * m[3][3] + m[1][0] * m[3][2] * m[0][3] + m[3][0] * m[0][2] * m[1][3]&quot;
+                       &quot; - m[0][0] * m[3][2] * m[1][3] - m[1][0] * m[0][2] * m[3][3] - m[3][0] * m[1][2] * m[0][3]);\n&quot;
+        &quot;    float cof22 = m[0][0] * m[1][1] * m[3][3] + m[1][0] * m[3][1] * m[0][3] + m[3][0] * m[0][1] * m[1][3]&quot;
+                       &quot; - m[0][0] * m[3][1] * m[1][3] - m[1][0] * m[0][1] * m[3][3] - m[3][0] * m[1][1] * m[0][3];\n&quot;
+        &quot;    float cof23 = -(m[0][0] * m[1][1] * m[3][2] + m[1][0] * m[3][1] * m[0][2] + m[3][0] * m[0][1] * m[1][2]&quot;
+                       &quot; - m[0][0] * m[3][1] * m[1][2] - m[1][0] * m[0][1] * m[3][2] - m[3][0] * m[1][1] * m[0][2]);\n&quot;
+        &quot;    float cof30 = -(m[0][1] * m[1][2] * m[2][3] + m[1][1] * m[2][2] * m[0][3] + m[2][1] * m[0][2] * m[1][3]&quot;
+                       &quot; - m[0][1] * m[2][2] * m[1][3] - m[1][1] * m[0][2] * m[2][3] - m[2][1] * m[1][2] * m[0][3]);\n&quot;
+        &quot;    float cof31 = m[0][0] * m[1][2] * m[2][3] + m[1][0] * m[2][2] * m[0][3] + m[2][0] * m[0][2] * m[1][3]&quot;
+                       &quot; - m[0][0] * m[2][2] * m[1][3] - m[1][0] * m[0][2] * m[2][3] - m[2][0] * m[1][2] * m[0][3];\n&quot;
+        &quot;    float cof32 = -(m[0][0] * m[1][1] * m[2][3] + m[1][0] * m[2][1] * m[0][3] + m[2][0] * m[0][1] * m[1][3]&quot;
+                       &quot; - m[0][0] * m[2][1] * m[1][3] - m[1][0] * m[0][1] * m[2][3] - m[2][0] * m[1][1] * m[0][3]);\n&quot;
+        &quot;    float cof33 = m[0][0] * m[1][1] * m[2][2] + m[1][0] * m[2][1] * m[0][2] + m[2][0] * m[0][1] * m[1][2]&quot;
+                       &quot; - m[0][0] * m[2][1] * m[1][2] - m[1][0] * m[0][1] * m[2][2] - m[2][0] * m[1][1] * m[0][2];\n&quot;
+        &quot;    float4x4 cof = { cof00, cof10, cof20, cof30, cof01, cof11, cof21, cof31,&quot;
+                            &quot; cof02, cof12, cof22, cof32, cof03, cof13, cof23, cof33 };\n&quot;
+        &quot;    return cof / determinant(transpose(m));\n&quot;
+        &quot;}\n&quot;);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorBuiltInFunctionEmulatorHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+//
+// Copyright (c) 2014 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_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_
+#define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_
+
+#include &quot;GLSLANG/ShaderLang.h&quot;
+
+class BuiltInFunctionEmulator;
+
+void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu);
+
+#endif  // COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATORHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCallDAGcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,294 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// CallDAG.h: Implements a call graph DAG of functions to be re-used accross
+// analyses, allows to efficiently traverse the functions in topological
+// order.
+
+#include &quot;compiler/translator/CallDAG.h&quot;
+#include &quot;compiler/translator/InfoSink.h&quot;
+
+// The CallDAGCreator does all the processing required to create the CallDAG
+// structure so that the latter contains only the necessary variables.
+class CallDAG::CallDAGCreator : public TIntermTraverser
+{
+  public:
+    CallDAGCreator(TInfoSinkBase *info)
+        : TIntermTraverser(true, false, true),
+          mCurrentFunction(nullptr),
+          mCurrentIndex(0),
+          mCreationInfo(info)
+    {
+    }
+
+    InitResult assignIndices()
+    {
+        int skipped = 0;
+        for (auto &amp;it : mFunctions)
+        {
+            // Skip unimplemented functions
+            if (it.second.node)
+            {
+                InitResult result = assignIndicesInternal(&amp;it.second);
+                if (result != INITDAG_SUCCESS)
+                {
+                    return result;
+                }
+            }
+            else
+            {
+                skipped++;
+            }
+        }
+        ASSERT(mFunctions.size() == mCurrentIndex + skipped);
+        return INITDAG_SUCCESS;
+    }
+
+    void fillDataStructures(std::vector&lt;Record&gt; *records, std::map&lt;int, int&gt; *idToIndex)
+    {
+        ASSERT(records-&gt;empty());
+        ASSERT(idToIndex-&gt;empty());
+
+        records-&gt;resize(mCurrentIndex);
+
+        for (auto &amp;it : mFunctions)
+        {
+            CreatorFunctionData &amp;data = it.second;
+            // Skip unimplemented functions
+            if (!data.node)
+            {
+                continue;
+            }
+            ASSERT(data.index &lt; records-&gt;size());
+            Record &amp;record = (*records)[data.index];
+
+            record.name = data.name.data();
+            record.node = data.node;
+
+            record.callees.reserve(data.callees.size());
+            for (auto &amp;callee : data.callees)
+            {
+                record.callees.push_back(static_cast&lt;int&gt;(callee-&gt;index));
+            }
+
+            (*idToIndex)[data.node-&gt;getFunctionId()] = static_cast&lt;int&gt;(data.index);
+        }
+    }
+
+  private:
+
+    struct CreatorFunctionData
+    {
+        CreatorFunctionData()
+            : node(nullptr),
+              index(0),
+              indexAssigned(false),
+              visiting(false)
+        {
+        }
+
+        std::set&lt;CreatorFunctionData*&gt; callees;
+        TIntermAggregate *node;
+        TString name;
+        size_t index;
+        bool indexAssigned;
+        bool visiting;
+    };
+
+    // Aggregates the AST node for each function as well as the name of the functions called by it
+    bool visitAggregate(Visit visit, TIntermAggregate *node) override
+    {
+        switch (node-&gt;getOp())
+        {
+          case EOpPrototype:
+            if (visit == PreVisit)
+            {
+                // Function declaration, create an empty record.
+                mFunctions[node-&gt;getName()];
+            }
+            break;
+          case EOpFunction:
+            {
+                // Function definition, create the record if need be and remember the node.
+                if (visit == PreVisit)
+                {
+                    auto it = mFunctions.find(node-&gt;getName());
+
+                    if (it == mFunctions.end())
+                    {
+                        mCurrentFunction = &amp;mFunctions[node-&gt;getName()];
+                    }
+                    else
+                    {
+                        mCurrentFunction = &amp;it-&gt;second;
+                    }
+
+                    mCurrentFunction-&gt;node = node;
+                    mCurrentFunction-&gt;name = node-&gt;getName();
+
+                }
+                else if (visit == PostVisit)
+                {
+                    mCurrentFunction = nullptr;
+                }
+                break;
+            }
+          case EOpFunctionCall:
+            {
+                // Function call, add the callees
+                if (visit == PreVisit)
+                {
+                    // Do not handle calls to builtin functions
+                    if (node-&gt;isUserDefined())
+                    {
+                        auto it = mFunctions.find(node-&gt;getName());
+                        ASSERT(it != mFunctions.end());
+
+                        // We might be in a top-level function call to set a global variable
+                        if (mCurrentFunction)
+                        {
+                            mCurrentFunction-&gt;callees.insert(&amp;it-&gt;second);
+                        }
+                    }
+                }
+                break;
+            }
+          default:
+            break;
+        }
+        return true;
+    }
+
+    // Recursively assigns indices to a sub DAG
+    InitResult assignIndicesInternal(CreatorFunctionData *function)
+    {
+        ASSERT(function);
+
+        if (!function-&gt;node)
+        {
+            *mCreationInfo &lt;&lt; &quot;Undefined function: &quot; &lt;&lt; function-&gt;name;
+            return INITDAG_UNDEFINED;
+        }
+
+        if (function-&gt;indexAssigned)
+        {
+            return INITDAG_SUCCESS;
+        }
+
+        if (function-&gt;visiting)
+        {
+            if (mCreationInfo)
+            {
+                *mCreationInfo &lt;&lt; &quot;Recursive function call in the following call chain: &quot; &lt;&lt; function-&gt;name;
+            }
+            return INITDAG_RECURSION;
+        }
+        function-&gt;visiting = true;
+
+        for (auto &amp;callee : function-&gt;callees)
+        {
+            InitResult result = assignIndicesInternal(callee);
+            if (result == INITDAG_RECURSION)
+            {
+                // We know that there is a recursive function call chain in the AST,
+                // print the link of the chain we were processing.
+                if (mCreationInfo)
+                {
+                    *mCreationInfo &lt;&lt; &quot; &lt;- &quot; &lt;&lt; function-&gt;name;
+                }
+                return INITDAG_RECURSION;
+            }
+            else if (result == INITDAG_UNDEFINED)
+            {
+                return INITDAG_UNDEFINED;
+            }
+        }
+
+        function-&gt;index = mCurrentIndex++;
+        function-&gt;indexAssigned = true;
+
+        function-&gt;visiting = false;
+        return INITDAG_SUCCESS;
+    }
+
+    TInfoSinkBase *mCreationInfo;
+
+    std::map&lt;TString, CreatorFunctionData&gt; mFunctions;
+    CreatorFunctionData *mCurrentFunction;
+    size_t mCurrentIndex;
+};
+
+// CallDAG
+
+CallDAG::CallDAG()
+{
+}
+
+CallDAG::~CallDAG()
+{
+}
+
+const size_t CallDAG::InvalidIndex = std::numeric_limits&lt;size_t&gt;::max();
+
+size_t CallDAG::findIndex(const TIntermAggregate *function) const
+{
+    TOperator op = function-&gt;getOp();
+    ASSERT(op == EOpPrototype || op == EOpFunction || op == EOpFunctionCall);
+    UNUSED_ASSERTION_VARIABLE(op);
+
+    auto it = mFunctionIdToIndex.find(function-&gt;getFunctionId());
+
+    if (it == mFunctionIdToIndex.end())
+    {
+        return InvalidIndex;
+    }
+    else
+    {
+        return it-&gt;second;
+    }
+}
+
+const CallDAG::Record &amp;CallDAG::getRecordFromIndex(size_t index) const
+{
+    ASSERT(index != InvalidIndex &amp;&amp; index &lt; mRecords.size());
+    return mRecords[index];
+}
+
+const CallDAG::Record &amp;CallDAG::getRecord(const TIntermAggregate *function) const
+{
+    size_t index = findIndex(function);
+    ASSERT(index != InvalidIndex &amp;&amp; index &lt; mRecords.size());
+    return mRecords[index];
+}
+
+size_t CallDAG::size() const
+{
+    return mRecords.size();
+}
+
+void CallDAG::clear()
+{
+    mRecords.clear();
+    mFunctionIdToIndex.clear();
+}
+
+CallDAG::InitResult CallDAG::init(TIntermNode *root, TInfoSinkBase *info)
+{
+    CallDAGCreator creator(info);
+
+    // Creates the mapping of functions to callees
+    root-&gt;traverse(&amp;creator);
+
+    // Does the topological sort and detects recursions
+    InitResult result = creator.assignIndices();
+    if (result != INITDAG_SUCCESS)
+    {
+        return result;
+    }
+
+    creator.fillDataStructures(&amp;mRecords, &amp;mFunctionIdToIndex);
+    return INITDAG_SUCCESS;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCallDAGh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CallDAG.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// CallDAG.h: Defines a call graph DAG of functions to be re-used accross
+// analyses, allows to efficiently traverse the functions in topological
+// order.
+
+#ifndef COMPILER_TRANSLATOR_CALLDAG_H_
+#define COMPILER_TRANSLATOR_CALLDAG_H_
+
+#include &lt;map&gt;
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+#include &quot;compiler/translator/VariableInfo.h&quot;
+
+
+// The translator needs to analyze the the graph of the function calls
+// to run checks and analyses; since in GLSL recursion is not allowed
+// that graph is a DAG.
+// This class is used to precompute that function call DAG so that it
+// can be reused by multiple analyses.
+//
+// It stores a vector of function records, with one record per function.
+// Records are accessed by index but a mangled function name can be converted
+// to the index of the corresponding record. The records mostly contain the
+// AST node of the function and the indices of the function's callees.
+//
+// In addition, records are in reverse topological order: a function F being
+// called by a function G will have index index(F) &lt; index(G), that way
+// depth-first analysis becomes analysis in the order of indices.
+
+class CallDAG : angle::NonCopyable
+{
+  public:
+    CallDAG();
+    ~CallDAG();
+
+    struct Record
+    {
+        std::string name;
+        TIntermAggregate *node;
+        std::vector&lt;int&gt; callees;
+    };
+
+    enum InitResult
+    {
+        INITDAG_SUCCESS,
+        INITDAG_RECURSION,
+        INITDAG_UNDEFINED,
+    };
+
+    // Returns INITDAG_SUCCESS if it was able to create the DAG, otherwise prints
+    // the initialization error in info, if present.
+    InitResult init(TIntermNode *root, TInfoSinkBase *info);
+
+    // Returns InvalidIndex if the function wasn't found
+    size_t findIndex(const TIntermAggregate *function) const;
+
+    const Record &amp;getRecordFromIndex(size_t index) const;
+    const Record &amp;getRecord(const TIntermAggregate *function) const;
+    size_t size() const;
+    void clear();
+
+    const static size_t InvalidIndex;
+  private:
+    std::vector&lt;Record&gt; mRecords;
+    std::map&lt;int, int&gt; mFunctionIdToIndex;
+
+    class CallDAGCreator;
+};
+
+#endif  // COMPILER_TRANSLATOR_CALLDAG_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCodeGencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CodeGen.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CodeGen.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/CodeGen.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,7 +6,9 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/TranslatorESSL.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/TranslatorGLSL.h&quot;
</span><ins>+#ifdef ANGLE_ENABLE_HLSL
</ins><span class="cx"> #include &quot;compiler/translator/TranslatorHLSL.h&quot;
</span><ins>+#endif // ANGLE_ENABLE_HLSL
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // This function must be provided to create the actual
</span><span class="lines">@@ -14,18 +16,28 @@
</span><span class="cx"> // a subclass of TCompiler.
</span><span class="cx"> //
</span><span class="cx"> TCompiler* ConstructCompiler(
</span><del>-    ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
</del><ins>+    sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
</ins><span class="cx"> {
</span><span class="cx">     switch (output) {
</span><del>-    case SH_ESSL_OUTPUT:
</del><ins>+      case SH_ESSL_OUTPUT:
</ins><span class="cx">         return new TranslatorESSL(type, spec);
</span><del>-    case SH_GLSL_OUTPUT:
-        return new TranslatorGLSL(type, spec);
-    case SH_HLSL9_OUTPUT:
-    case SH_HLSL11_OUTPUT:
</del><ins>+      case SH_GLSL_130_OUTPUT:
+      case SH_GLSL_410_CORE_OUTPUT:
+      case SH_GLSL_420_CORE_OUTPUT:
+      case SH_GLSL_COMPATIBILITY_OUTPUT:
+        return new TranslatorGLSL(type, spec, output);
+      case SH_HLSL9_OUTPUT:
+      case SH_HLSL11_OUTPUT:
+#ifdef ANGLE_ENABLE_HLSL
</ins><span class="cx">         return new TranslatorHLSL(type, spec, output);
</span><del>-    default:
</del><ins>+#else
+        // This compiler is not supported in this
+        // configuration. Return NULL per the ShConstructCompiler API.
</ins><span class="cx">         return NULL;
</span><ins>+#endif // ANGLE_ENABLE_HLSL
+      default:
+        // Unknown format. Return NULL per the ShConstructCompiler API.
+        return NULL;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCommonh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Common.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _COMMON_INCLUDED_
-#define _COMMON_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_COMMON_H_
+#define COMPILER_TRANSLATOR_COMMON_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;map&gt;
</span><span class="cx"> #include &lt;sstream&gt;
</span><span class="lines">@@ -14,9 +14,9 @@
</span><span class="cx"> #include &lt;limits&gt;
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> 
</span><ins>+#include &quot;common/angleutils.h&quot;
+#include &quot;common/debug.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/PoolAlloc.h&quot;
</span><del>-#include &quot;compiler/translator/compilerdebug.h&quot;
-#include &quot;common/angleutils.h&quot;
</del><span class="cx"> 
</span><span class="cx"> struct TSourceLoc {
</span><span class="cx">     int first_file;
</span><span class="lines">@@ -89,4 +89,4 @@
</span><span class="cx">     return buffer;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif // _COMMON_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_COMMON_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,15 +4,17 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/BuiltInFunctionEmulator.h&quot;
-#include &quot;compiler/translator/DetectCallDepth.h&quot;
</del><ins>+#include &quot;compiler/translator/Compiler.h&quot;
+#include &quot;compiler/translator/CallDAG.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/ForLoopUnroll.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/Initialize.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/InitializeParseContext.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/InitializeVariables.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><ins>+#include &quot;compiler/translator/PruneEmptyDeclarations.h&quot;
+#include &quot;compiler/translator/RegenerateStructNames.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/RenameFunction.h&quot;
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
</del><ins>+#include &quot;compiler/translator/ScalarizeVecAndMatConstructorArgs.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/UnfoldShortCircuitAST.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/ValidateLimitations.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/ValidateOutputs.h&quot;
</span><span class="lines">@@ -22,27 +24,39 @@
</span><span class="cx"> #include &quot;compiler/translator/timing/RestrictFragmentShaderTiming.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/timing/RestrictVertexShaderTiming.h&quot;
</span><span class="cx"> #include &quot;third_party/compiler/ArrayBoundsClamper.h&quot;
</span><ins>+#include &quot;angle_gl.h&quot;
+#include &quot;common/utilities.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> bool IsWebGLBasedSpec(ShShaderSpec spec)
</span><span class="cx"> {
</span><del>-     return spec == SH_WEBGL_SPEC || spec == SH_CSS_SHADERS_SPEC;
</del><ins>+    return (spec == SH_WEBGL_SPEC ||
+            spec == SH_CSS_SHADERS_SPEC ||
+            spec == SH_WEBGL2_SPEC);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool IsGLSL130OrNewer(ShShaderOutput output)
+{
+    return (output == SH_GLSL_130_OUTPUT ||
+            output == SH_GLSL_410_CORE_OUTPUT ||
+            output == SH_GLSL_420_CORE_OUTPUT);
+}
+
</ins><span class="cx"> size_t GetGlobalMaxTokenSize(ShShaderSpec spec)
</span><span class="cx"> {
</span><span class="cx">     // WebGL defines a max token legnth of 256, while ES2 leaves max token
</span><span class="cx">     // size undefined. ES3 defines a max size of 1024 characters.
</span><del>-    if (IsWebGLBasedSpec(spec))
</del><ins>+    switch (spec)
</ins><span class="cx">     {
</span><ins>+      case SH_WEBGL_SPEC:
+      case SH_CSS_SHADERS_SPEC:
</ins><span class="cx">         return 256;
</span><del>-    }
-    else
-    {
</del><ins>+      default:
</ins><span class="cx">         return 1024;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace {
</span><ins>+
</ins><span class="cx"> class TScopedPoolAllocator
</span><span class="cx"> {
</span><span class="cx">   public:
</span><span class="lines">@@ -78,6 +92,24 @@
</span><span class="cx">   private:
</span><span class="cx">     TSymbolTable* mTable;
</span><span class="cx"> };
</span><ins>+
+int MapSpecToShaderVersion(ShShaderSpec spec)
+{
+    switch (spec)
+    {
+      case SH_GLES2_SPEC:
+      case SH_WEBGL_SPEC:
+      case SH_CSS_SHADERS_SPEC:
+        return 100;
+      case SH_GLES3_SPEC:
+      case SH_WEBGL2_SPEC:
+        return 300;
+      default:
+        UNREACHABLE();
+        return 0;
+    }
+}
+
</ins><span class="cx"> }  // namespace
</span><span class="cx"> 
</span><span class="cx"> TShHandleBase::TShHandleBase()
</span><span class="lines">@@ -92,16 +124,17 @@
</span><span class="cx">     allocator.popAll();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TCompiler::TCompiler(ShShaderType type, ShShaderSpec spec)
</del><ins>+TCompiler::TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
</ins><span class="cx">     : shaderType(type),
</span><span class="cx">       shaderSpec(spec),
</span><ins>+      outputType(output),
</ins><span class="cx">       maxUniformVectors(0),
</span><del>-      maxVaryingVectors(0),
</del><span class="cx">       maxExpressionComplexity(0),
</span><span class="cx">       maxCallStackDepth(0),
</span><span class="cx">       fragmentPrecisionHigh(false),
</span><span class="cx">       clampingStrategy(SH_CLAMP_WITH_CLAMP_INTRINSIC),
</span><del>-      builtInFunctionEmulator(type)
</del><ins>+      builtInFunctionEmulator(),
+      mSourcePath(NULL)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -112,10 +145,9 @@
</span><span class="cx"> bool TCompiler::Init(const ShBuiltInResources&amp; resources)
</span><span class="cx"> {
</span><span class="cx">     shaderVersion = 100;
</span><del>-    maxUniformVectors = (shaderType == SH_VERTEX_SHADER) ?
</del><ins>+    maxUniformVectors = (shaderType == GL_VERTEX_SHADER) ?
</ins><span class="cx">         resources.MaxVertexUniformVectors :
</span><span class="cx">         resources.MaxFragmentUniformVectors;
</span><del>-    maxVaryingVectors = resources.MaxVaryingVectors;
</del><span class="cx">     maxExpressionComplexity = resources.MaxExpressionComplexity;
</span><span class="cx">     maxCallStackDepth = resources.MaxCallStackDepth;
</span><span class="cx"> 
</span><span class="lines">@@ -135,33 +167,41 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TCompiler::compile(const char* const shaderStrings[],
-                        size_t numStrings,
-                        int compileOptions)
</del><ins>+TIntermNode *TCompiler::compileTreeForTesting(const char* const shaderStrings[],
+    size_t numStrings, int compileOptions)
</ins><span class="cx"> {
</span><del>-    TScopedPoolAllocator scopedAlloc(&amp;allocator);
</del><ins>+    return compileTreeImpl(shaderStrings, numStrings, compileOptions);
+}
+
+TIntermNode *TCompiler::compileTreeImpl(const char* const shaderStrings[],
+    size_t numStrings, int compileOptions)
+{
</ins><span class="cx">     clearResults();
</span><span class="cx"> 
</span><del>-    if (numStrings == 0)
-        return true;
</del><ins>+    ASSERT(numStrings &gt; 0);
+    ASSERT(GetGlobalPoolAllocator());
</ins><span class="cx"> 
</span><ins>+    // Reset the extension behavior for each compilation unit.
+    ResetExtensionBehavior(extensionBehavior);
+
</ins><span class="cx">     // If compiling for WebGL, validate loop and indexing as well.
</span><span class="cx">     if (IsWebGLBasedSpec(shaderSpec))
</span><span class="cx">         compileOptions |= SH_VALIDATE_LOOP_INDEXING;
</span><span class="cx"> 
</span><span class="cx">     // First string is path of source file if flag is set. The actual source follows.
</span><del>-    const char* sourcePath = NULL;
</del><span class="cx">     size_t firstSource = 0;
</span><span class="cx">     if (compileOptions &amp; SH_SOURCE_PATH)
</span><span class="cx">     {
</span><del>-        sourcePath = shaderStrings[0];
</del><ins>+        mSourcePath = shaderStrings[0];
</ins><span class="cx">         ++firstSource;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    bool debugShaderPrecision = getResources().WEBGL_debug_shader_precision == 1;
</ins><span class="cx">     TIntermediate intermediate(infoSink);
</span><span class="cx">     TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
</span><span class="cx">                                shaderType, shaderSpec, compileOptions, true,
</span><del>-                               sourcePath, infoSink);
</del><ins>+                               infoSink, debugShaderPrecision);
+
</ins><span class="cx">     parseContext.fragmentPrecisionHigh = fragmentPrecisionHigh;
</span><span class="cx">     SetGlobalParseContext(&amp;parseContext);
</span><span class="cx"> 
</span><span class="lines">@@ -175,20 +215,53 @@
</span><span class="cx">         (parseContext.treeRoot != NULL);
</span><span class="cx"> 
</span><span class="cx">     shaderVersion = parseContext.getShaderVersion();
</span><ins>+    if (success &amp;&amp; MapSpecToShaderVersion(shaderSpec) &lt; shaderVersion)
+    {
+        infoSink.info.prefix(EPrefixError);
+        infoSink.info &lt;&lt; &quot;unsupported shader version&quot;;
+        success = false;
+    }
</ins><span class="cx"> 
</span><ins>+    TIntermNode *root = NULL;
+
</ins><span class="cx">     if (success)
</span><span class="cx">     {
</span><del>-        TIntermNode* root = parseContext.treeRoot;
</del><ins>+        mPragma = parseContext.pragma();
+        if (mPragma.stdgl.invariantAll)
+        {
+            symbolTable.setGlobalInvariant();
+        }
+
+        root = parseContext.treeRoot;
</ins><span class="cx">         success = intermediate.postProcess(root);
</span><span class="cx"> 
</span><span class="cx">         // Disallow expressions deemed too complex.
</span><span class="cx">         if (success &amp;&amp; (compileOptions &amp; SH_LIMIT_EXPRESSION_COMPLEXITY))
</span><span class="cx">             success = limitExpressionComplexity(root);
</span><span class="cx"> 
</span><ins>+        // Create the function DAG and check there is no recursion
</ins><span class="cx">         if (success)
</span><del>-            success = detectCallDepth(root, infoSink, (compileOptions &amp; SH_LIMIT_CALL_STACK_DEPTH) != 0);
</del><ins>+            success = initCallDag(root);
</ins><span class="cx"> 
</span><del>-        if (success &amp;&amp; shaderVersion == 300 &amp;&amp; shaderType == SH_FRAGMENT_SHADER)
</del><ins>+        if (success &amp;&amp; (compileOptions &amp; SH_LIMIT_CALL_STACK_DEPTH))
+            success = checkCallDepth();
+
+        // Checks which functions are used and if &quot;main&quot; exists
+        if (success)
+        {
+            functionMetadata.clear();
+            functionMetadata.resize(mCallDag.size());
+            success = tagUsedFunctions();
+        }
+
+        if (success &amp;&amp; !(compileOptions &amp; SH_DONT_PRUNE_UNUSED_FUNCTIONS))
+            success = pruneUnusedFunctions(root);
+
+        // Prune empty declarations to work around driver bugs and to keep declaration output simple.
+        if (success)
+            PruneEmptyDeclarations(root);
+
+        if (success &amp;&amp; shaderVersion == 300 &amp;&amp; shaderType == GL_FRAGMENT_SHADER)
</ins><span class="cx">             success = validateOutputs(root);
</span><span class="cx"> 
</span><span class="cx">         if (success &amp;&amp; (compileOptions &amp; SH_VALIDATE_LOOP_INDEXING))
</span><span class="lines">@@ -219,14 +292,17 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Built-in function emulation needs to happen after validateLimitations pass.
</span><del>-        if (success &amp;&amp; (compileOptions &amp; SH_EMULATE_BUILT_IN_FUNCTIONS))
</del><ins>+        if (success)
+        {
+            initBuiltInFunctionEmulator(&amp;builtInFunctionEmulator, compileOptions);
</ins><span class="cx">             builtInFunctionEmulator.MarkBuiltInFunctionsForEmulation(root);
</span><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">         // Clamping uniform array bounds needs to happen after validateLimitations pass.
</span><span class="cx">         if (success &amp;&amp; (compileOptions &amp; SH_CLAMP_INDIRECT_ARRAY_BOUNDS))
</span><span class="cx">             arrayBoundsClamper.MarkIndirectArrayBoundsForClamping(root);
</span><span class="cx"> 
</span><del>-        if (success &amp;&amp; shaderType == SH_VERTEX_SHADER &amp;&amp; (compileOptions &amp; SH_INIT_GL_POSITION))
</del><ins>+        if (success &amp;&amp; shaderType == GL_VERTEX_SHADER &amp;&amp; (compileOptions &amp; SH_INIT_GL_POSITION))
</ins><span class="cx">             initializeGLPosition(root);
</span><span class="cx"> 
</span><span class="cx">         if (success &amp;&amp; (compileOptions &amp; SH_UNFOLD_SHORT_CIRCUIT))
</span><span class="lines">@@ -239,36 +315,69 @@
</span><span class="cx">         if (success &amp;&amp; (compileOptions &amp; SH_VARIABLES))
</span><span class="cx">         {
</span><span class="cx">             collectVariables(root);
</span><del>-            if (compileOptions &amp; SH_ENFORCE_PACKING_RESTRICTIONS) {
</del><ins>+            if (compileOptions &amp; SH_ENFORCE_PACKING_RESTRICTIONS)
+            {
</ins><span class="cx">                 success = enforcePackingRestrictions();
</span><del>-                if (!success) {
</del><ins>+                if (!success)
+                {
</ins><span class="cx">                     infoSink.info.prefix(EPrefixError);
</span><span class="cx">                     infoSink.info &lt;&lt; &quot;too many uniforms&quot;;
</span><del>-                    return false;
</del><span class="cx">                 }
</span><span class="cx">             }
</span><del>-
-            if (success &amp;&amp; shaderType == SH_VERTEX_SHADER &amp;&amp;
</del><ins>+            if (success &amp;&amp; shaderType == GL_VERTEX_SHADER &amp;&amp;
</ins><span class="cx">                 (compileOptions &amp; SH_INIT_VARYINGS_WITHOUT_STATIC_USE))
</span><span class="cx">                 initializeVaryingsWithoutStaticUse(root);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (success &amp;&amp; (compileOptions &amp; SH_INTERMEDIATE_TREE))
-            intermediate.outputTree(root);
</del><ins>+        if (success &amp;&amp; (compileOptions &amp; SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS))
+        {
+            ScalarizeVecAndMatConstructorArgs scalarizer(
+                shaderType, fragmentPrecisionHigh);
+            root-&gt;traverse(&amp;scalarizer);
+        }
</ins><span class="cx"> 
</span><del>-        if (success &amp;&amp; (compileOptions &amp; SH_OBJECT_CODE))
-            translate(root);
</del><ins>+        if (success &amp;&amp; (compileOptions &amp; SH_REGENERATE_STRUCT_NAMES))
+        {
+            RegenerateStructNames gen(symbolTable, shaderVersion);
+            root-&gt;traverse(&amp;gen);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Cleanup memory.
-    intermediate.remove(parseContext.treeRoot);
</del><span class="cx">     SetGlobalParseContext(NULL);
</span><del>-    return success;
</del><ins>+    if (success)
+        return root;
+
+    return NULL;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool TCompiler::compile(const char* const shaderStrings[],
+    size_t numStrings, int compileOptions)
+{
+    if (numStrings == 0)
+        return true;
+
+    TScopedPoolAllocator scopedAlloc(&amp;allocator);
+    TIntermNode *root = compileTreeImpl(shaderStrings, numStrings, compileOptions);
+
+    if (root)
+    {
+        if (compileOptions &amp; SH_INTERMEDIATE_TREE)
+            TIntermediate::outputTree(root, infoSink.info);
+
+        if (compileOptions &amp; SH_OBJECT_CODE)
+            translate(root, compileOptions);
+
+        // The IntermNode tree doesn't need to be deleted here, since the
+        // memory will be freed in a big chunk by the PoolAllocator.
+        return true;
+    }
+    return false;
+}
+
</ins><span class="cx"> bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &amp;resources)
</span><span class="cx"> {
</span><span class="cx">     compileResources = resources;
</span><ins>+    setResourceString();
</ins><span class="cx"> 
</span><span class="cx">     assert(symbolTable.isEmpty());
</span><span class="cx">     symbolTable.push();   // COMMON_BUILTINS
</span><span class="lines">@@ -294,10 +403,10 @@
</span><span class="cx"> 
</span><span class="cx">     switch(shaderType)
</span><span class="cx">     {
</span><del>-      case SH_FRAGMENT_SHADER:
</del><ins>+      case GL_FRAGMENT_SHADER:
</ins><span class="cx">         symbolTable.setDefaultPrecision(integer, EbpMedium);
</span><span class="cx">         break;
</span><del>-      case SH_VERTEX_SHADER:
</del><ins>+      case GL_VERTEX_SHADER:
</ins><span class="cx">         symbolTable.setDefaultPrecision(integer, EbpHigh);
</span><span class="cx">         symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
</span><span class="cx">         break;
</span><span class="lines">@@ -320,6 +429,39 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TCompiler::setResourceString()
+{
+    std::ostringstream strstream;
+    strstream &lt;&lt; &quot;:MaxVertexAttribs:&quot; &lt;&lt; compileResources.MaxVertexAttribs
+              &lt;&lt; &quot;:MaxVertexUniformVectors:&quot; &lt;&lt; compileResources.MaxVertexUniformVectors
+              &lt;&lt; &quot;:MaxVaryingVectors:&quot; &lt;&lt; compileResources.MaxVaryingVectors
+              &lt;&lt; &quot;:MaxVertexTextureImageUnits:&quot; &lt;&lt; compileResources.MaxVertexTextureImageUnits
+              &lt;&lt; &quot;:MaxCombinedTextureImageUnits:&quot; &lt;&lt; compileResources.MaxCombinedTextureImageUnits
+              &lt;&lt; &quot;:MaxTextureImageUnits:&quot; &lt;&lt; compileResources.MaxTextureImageUnits
+              &lt;&lt; &quot;:MaxFragmentUniformVectors:&quot; &lt;&lt; compileResources.MaxFragmentUniformVectors
+              &lt;&lt; &quot;:MaxDrawBuffers:&quot; &lt;&lt; compileResources.MaxDrawBuffers
+              &lt;&lt; &quot;:OES_standard_derivatives:&quot; &lt;&lt; compileResources.OES_standard_derivatives
+              &lt;&lt; &quot;:OES_EGL_image_external:&quot; &lt;&lt; compileResources.OES_EGL_image_external
+              &lt;&lt; &quot;:ARB_texture_rectangle:&quot; &lt;&lt; compileResources.ARB_texture_rectangle
+              &lt;&lt; &quot;:EXT_draw_buffers:&quot; &lt;&lt; compileResources.EXT_draw_buffers
+              &lt;&lt; &quot;:FragmentPrecisionHigh:&quot; &lt;&lt; compileResources.FragmentPrecisionHigh
+              &lt;&lt; &quot;:MaxExpressionComplexity:&quot; &lt;&lt; compileResources.MaxExpressionComplexity
+              &lt;&lt; &quot;:MaxCallStackDepth:&quot; &lt;&lt; compileResources.MaxCallStackDepth
+              &lt;&lt; &quot;:EXT_frag_depth:&quot; &lt;&lt; compileResources.EXT_frag_depth
+              &lt;&lt; &quot;:EXT_shader_texture_lod:&quot; &lt;&lt; compileResources.EXT_shader_texture_lod
+              &lt;&lt; &quot;:EXT_shader_framebuffer_fetch:&quot; &lt;&lt; compileResources.EXT_shader_framebuffer_fetch
+              &lt;&lt; &quot;:NV_shader_framebuffer_fetch:&quot; &lt;&lt; compileResources.NV_shader_framebuffer_fetch
+              &lt;&lt; &quot;:ARM_shader_framebuffer_fetch:&quot; &lt;&lt; compileResources.ARM_shader_framebuffer_fetch
+              &lt;&lt; &quot;:MaxVertexOutputVectors:&quot; &lt;&lt; compileResources.MaxVertexOutputVectors
+              &lt;&lt; &quot;:MaxFragmentInputVectors:&quot; &lt;&lt; compileResources.MaxFragmentInputVectors
+              &lt;&lt; &quot;:MinProgramTexelOffset:&quot; &lt;&lt; compileResources.MinProgramTexelOffset
+              &lt;&lt; &quot;:MaxProgramTexelOffset:&quot; &lt;&lt; compileResources.MaxProgramTexelOffset
+              &lt;&lt; &quot;:NV_draw_buffers:&quot; &lt;&lt; compileResources.NV_draw_buffers
+              &lt;&lt; &quot;:WEBGL_debug_shader_precision:&quot; &lt;&lt; compileResources.WEBGL_debug_shader_precision;
+
+    builtInResourcesString = strstream.str();
+}
+
</ins><span class="cx"> void TCompiler::clearResults()
</span><span class="cx"> {
</span><span class="cx">     arrayBoundsClamper.Cleanup();
</span><span class="lines">@@ -327,41 +469,177 @@
</span><span class="cx">     infoSink.obj.erase();
</span><span class="cx">     infoSink.debug.erase();
</span><span class="cx"> 
</span><del>-    attribs.clear();
</del><ins>+    attributes.clear();
+    outputVariables.clear();
</ins><span class="cx">     uniforms.clear();
</span><ins>+    expandedUniforms.clear();
</ins><span class="cx">     varyings.clear();
</span><ins>+    interfaceBlocks.clear();
</ins><span class="cx"> 
</span><span class="cx">     builtInFunctionEmulator.Cleanup();
</span><span class="cx"> 
</span><span class="cx">     nameMap.clear();
</span><ins>+
+    mSourcePath = NULL;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TCompiler::detectCallDepth(TIntermNode* root, TInfoSink&amp; infoSink, bool limitCallStackDepth)
</del><ins>+bool TCompiler::initCallDag(TIntermNode *root)
</ins><span class="cx"> {
</span><del>-    DetectCallDepth detect(infoSink, limitCallStackDepth, maxCallStackDepth);
-    root-&gt;traverse(&amp;detect);
-    switch (detect.detectCallDepth())
</del><ins>+    mCallDag.clear();
+
+    switch (mCallDag.init(root, &amp;infoSink.info))
</ins><span class="cx">     {
</span><del>-      case DetectCallDepth::kErrorNone:
</del><ins>+      case CallDAG::INITDAG_SUCCESS:
</ins><span class="cx">         return true;
</span><del>-      case DetectCallDepth::kErrorMissingMain:
</del><ins>+      case CallDAG::INITDAG_RECURSION:
</ins><span class="cx">         infoSink.info.prefix(EPrefixError);
</span><del>-        infoSink.info &lt;&lt; &quot;Missing main()&quot;;
-        return false;
-      case DetectCallDepth::kErrorRecursion:
-        infoSink.info.prefix(EPrefixError);
</del><span class="cx">         infoSink.info &lt;&lt; &quot;Function recursion detected&quot;;
</span><span class="cx">         return false;
</span><del>-      case DetectCallDepth::kErrorMaxDepthExceeded:
</del><ins>+      case CallDAG::INITDAG_UNDEFINED:
</ins><span class="cx">         infoSink.info.prefix(EPrefixError);
</span><del>-        infoSink.info &lt;&lt; &quot;Function call stack too deep&quot;;
</del><ins>+        infoSink.info &lt;&lt; &quot;Unimplemented function detected&quot;;
</ins><span class="cx">         return false;
</span><del>-      default:
-        UNREACHABLE();
-        return false;
</del><span class="cx">     }
</span><ins>+
+    UNREACHABLE();
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool TCompiler::checkCallDepth()
+{
+    std::vector&lt;int&gt; depths(mCallDag.size());
+
+    for (size_t i = 0; i &lt; mCallDag.size(); i++)
+    {
+        int depth = 0;
+        auto &amp;record = mCallDag.getRecordFromIndex(i);
+
+        for (auto &amp;calleeIndex : record.callees)
+        {
+            depth = std::max(depth, depths[calleeIndex] + 1);
+        }
+
+        depths[i] = depth;
+
+        if (depth &gt;= maxCallStackDepth)
+        {
+            // Trace back the function chain to have a meaningful info log.
+            infoSink.info.prefix(EPrefixError);
+            infoSink.info &lt;&lt; &quot;Call stack too deep (larger than &quot; &lt;&lt; maxCallStackDepth
+                          &lt;&lt; &quot;) with the following call chain: &quot; &lt;&lt; record.name;
+
+            signed long long currentFunction = i;
+            int currentDepth = depth;
+
+            while (currentFunction != -1)
+            {
+                infoSink.info &lt;&lt; &quot; -&gt; &quot; &lt;&lt; mCallDag.getRecordFromIndex(static_cast&lt;size_t&gt;(currentFunction)).name;
+
+                int nextFunction = -1;
+                for (auto&amp; calleeIndex : mCallDag.getRecordFromIndex(static_cast&lt;size_t&gt;(currentFunction)).callees)
+                {
+                    if (depths[calleeIndex] == currentDepth - 1)
+                    {
+                        currentDepth--;
+                        nextFunction = calleeIndex;
+                    }
+                }
+
+                currentFunction = nextFunction;
+            }
+
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool TCompiler::tagUsedFunctions()
+{
+    // Search from main, starting from the end of the DAG as it usually is the root.
+    for (size_t i = mCallDag.size(); i--;)
+    {
+        if (mCallDag.getRecordFromIndex(i).name == &quot;main(&quot;)
+        {
+            internalTagUsedFunction(i);
+            return true;
+        }
+    }
+
+    infoSink.info.prefix(EPrefixError);
+    infoSink.info &lt;&lt; &quot;Missing main()&quot;;
+    return false;
+}
+
+void TCompiler::internalTagUsedFunction(size_t index)
+{
+    if (functionMetadata[index].used)
+    {
+        return;
+    }
+
+    functionMetadata[index].used = true;
+
+    for (int calleeIndex : mCallDag.getRecordFromIndex(index).callees)
+    {
+        internalTagUsedFunction(calleeIndex);
+    }
+}
+
+// A predicate for the stl that returns if a top-level node is unused
+class TCompiler::UnusedPredicate
+{
+  public:
+    UnusedPredicate(const CallDAG *callDag, const std::vector&lt;FunctionMetadata&gt; *metadatas)
+        : mCallDag(callDag),
+          mMetadatas(metadatas)
+    {
+    }
+
+    bool operator ()(TIntermNode *node)
+    {
+        const TIntermAggregate *asAggregate = node-&gt;getAsAggregate();
+
+        if (asAggregate == nullptr)
+        {
+            return false;
+        }
+
+        if (!(asAggregate-&gt;getOp() == EOpFunction || asAggregate-&gt;getOp() == EOpPrototype))
+        {
+            return false;
+        }
+
+        size_t callDagIndex = mCallDag-&gt;findIndex(asAggregate);
+        if (callDagIndex == CallDAG::InvalidIndex)
+        {
+            // This happens only for unimplemented prototypes which are thus unused
+            ASSERT(asAggregate-&gt;getOp() == EOpPrototype);
+            return true;
+        }
+
+        ASSERT(callDagIndex &lt; mMetadatas-&gt;size());
+        return !(*mMetadatas)[callDagIndex].used;
+    }
+
+  private:
+    const CallDAG *mCallDag;
+    const std::vector&lt;FunctionMetadata&gt; *mMetadatas;
+};
+
+bool TCompiler::pruneUnusedFunctions(TIntermNode *root)
+{
+    TIntermAggregate *rootNode = root-&gt;getAsAggregate();
+    ASSERT(rootNode != nullptr);
+
+    UnusedPredicate isUnused(&amp;mCallDag, &amp;functionMetadata);
+    TIntermSequence *sequence = rootNode-&gt;getSequence();
+    sequence-&gt;erase(std::remove_if(sequence-&gt;begin(), sequence-&gt;end(), isUnused), sequence-&gt;end());
+
+    return true;
+}
+
</ins><span class="cx"> bool TCompiler::validateOutputs(TIntermNode* root)
</span><span class="cx"> {
</span><span class="cx">     ValidateOutputs validateOutputs(infoSink.info, compileResources.MaxDrawBuffers);
</span><span class="lines">@@ -390,7 +668,7 @@
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (shaderType == SH_FRAGMENT_SHADER)
</del><ins>+    if (shaderType == GL_FRAGMENT_SHADER)
</ins><span class="cx">     {
</span><span class="cx">         TDependencyGraph graph(root);
</span><span class="cx"> 
</span><span class="lines">@@ -453,14 +731,23 @@
</span><span class="cx"> 
</span><span class="cx"> void TCompiler::collectVariables(TIntermNode* root)
</span><span class="cx"> {
</span><del>-    CollectVariables collect(attribs, uniforms, varyings, hashFunction);
</del><ins>+    sh::CollectVariables collect(&amp;attributes,
+                                 &amp;outputVariables,
+                                 &amp;uniforms,
+                                 &amp;varyings,
+                                 &amp;interfaceBlocks,
+                                 hashFunction,
+                                 symbolTable);
</ins><span class="cx">     root-&gt;traverse(&amp;collect);
</span><ins>+
+    // This is for enforcePackingRestriction().
+    sh::ExpandUniforms(uniforms, &amp;expandedUniforms);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool TCompiler::enforcePackingRestrictions()
</span><span class="cx"> {
</span><span class="cx">     VariablePacker packer;
</span><del>-    return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, uniforms);
</del><ins>+    return packer.CheckVariablesWithinPackingLimits(maxUniformVectors, expandedUniforms);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TCompiler::initializeGLPosition(TIntermNode* root)
</span><span class="lines">@@ -478,43 +765,16 @@
</span><span class="cx">     InitializeVariables::InitVariableInfoList variables;
</span><span class="cx">     for (size_t ii = 0; ii &lt; varyings.size(); ++ii)
</span><span class="cx">     {
</span><del>-        const TVariableInfo&amp; varying = varyings[ii];
</del><ins>+        const sh::Varying&amp; varying = varyings[ii];
</ins><span class="cx">         if (varying.staticUse)
</span><span class="cx">             continue;
</span><del>-        unsigned char primarySize = 1, secondarySize = 1;
-        switch (varying.type)
-        {
-          case SH_FLOAT:
-            break;
-          case SH_FLOAT_VEC2:
-            primarySize = 2;
-            break;
-          case SH_FLOAT_VEC3:
-            primarySize = 3;
-            break;
-          case SH_FLOAT_VEC4:
-            primarySize = 4;
-            break;
-          case SH_FLOAT_MAT2:
-            primarySize = 2;
-            secondarySize = 2;
-            break;
-          case SH_FLOAT_MAT3:
-            primarySize = 3;
-            secondarySize = 3;
-            break;
-          case SH_FLOAT_MAT4:
-            primarySize = 4;
-            secondarySize = 4;
-            break;
-          default:
-            ASSERT(false);
-        }
-        TType type(EbtFloat, EbpUndefined, EvqVaryingOut, primarySize, secondarySize, varying.isArray);
</del><ins>+        unsigned char primarySize = static_cast&lt;unsigned char&gt;(gl::VariableColumnCount(varying.type));
+        unsigned char secondarySize = static_cast&lt;unsigned char&gt;(gl::VariableRowCount(varying.type));
+        TType type(EbtFloat, EbpUndefined, EvqVaryingOut, primarySize, secondarySize, varying.isArray());
</ins><span class="cx">         TString name = varying.name.c_str();
</span><del>-        if (varying.isArray)
</del><ins>+        if (varying.isArray())
</ins><span class="cx">         {
</span><del>-            type.setArraySize(varying.size);
</del><ins>+            type.setArraySize(varying.arraySize);
</ins><span class="cx">             name = name.substr(0, name.find_first_of('['));
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -530,6 +790,11 @@
</span><span class="cx">     return extensionBehavior;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+const char *TCompiler::getSourcePath() const
+{
+    return mSourcePath;
+}
+
</ins><span class="cx"> const ShBuiltInResources&amp; TCompiler::getResources() const
</span><span class="cx"> {
</span><span class="cx">     return compileResources;
</span><span class="lines">@@ -549,3 +814,10 @@
</span><span class="cx"> {
</span><span class="cx">     return builtInFunctionEmulator;
</span><span class="cx"> }
</span><ins>+
+void TCompiler::writePragma()
+{
+    TInfoSinkBase &amp;sink = infoSink.obj;
+    if (mPragma.stdgl.invariantAll)
+        sink &lt;&lt; &quot;#pragma STDGL invariant(all)\n&quot;;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorCompilerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Compiler.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,239 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef COMPILER_TRANSLATOR_COMPILER_H_
+#define COMPILER_TRANSLATOR_COMPILER_H_
+
+//
+// Machine independent part of the compiler private objects
+// sent as ShHandle to the driver.
+//
+// This should not be included by driver code.
+//
+
+#include &quot;compiler/translator/BuiltInFunctionEmulator.h&quot;
+#include &quot;compiler/translator/CallDAG.h&quot;
+#include &quot;compiler/translator/ExtensionBehavior.h&quot;
+#include &quot;compiler/translator/HashNames.h&quot;
+#include &quot;compiler/translator/InfoSink.h&quot;
+#include &quot;compiler/translator/Pragma.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
+#include &quot;compiler/translator/VariableInfo.h&quot;
+#include &quot;third_party/compiler/ArrayBoundsClamper.h&quot;
+
+class TCompiler;
+class TDependencyGraph;
+#ifdef ANGLE_ENABLE_HLSL
+class TranslatorHLSL;
+#endif // ANGLE_ENABLE_HLSL
+
+//
+// Helper function to identify specs that are based on the WebGL spec,
+// like the CSS Shaders spec.
+//
+bool IsWebGLBasedSpec(ShShaderSpec spec);
+
+//
+// Helper function to check if the shader type is GLSL.
+//
+bool IsGLSL130OrNewer(ShShaderOutput output);
+
+//
+// The base class used to back handles returned to the driver.
+//
+class TShHandleBase {
+public:
+    TShHandleBase();
+    virtual ~TShHandleBase();
+    virtual TCompiler* getAsCompiler() { return 0; }
+#ifdef ANGLE_ENABLE_HLSL
+    virtual TranslatorHLSL* getAsTranslatorHLSL() { return 0; }
+#endif // ANGLE_ENABLE_HLSL
+
+protected:
+    // Memory allocator. Allocates and tracks memory required by the compiler.
+    // Deallocates all memory when compiler is destructed.
+    TPoolAllocator allocator;
+};
+
+//
+// The base class for the machine dependent compiler to derive from
+// for managing object code from the compile.
+//
+class TCompiler : public TShHandleBase
+{
+  public:
+    TCompiler(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
+    virtual ~TCompiler();
+    virtual TCompiler* getAsCompiler() { return this; }
+
+    bool Init(const ShBuiltInResources&amp; resources);
+
+    // compileTreeForTesting should be used only when tests require access to
+    // the AST. Users of this function need to manually manage the global pool
+    // allocator. Returns NULL whenever there are compilation errors.
+    TIntermNode *compileTreeForTesting(const char* const shaderStrings[],
+        size_t numStrings, int compileOptions);
+
+    bool compile(const char* const shaderStrings[],
+        size_t numStrings, int compileOptions);
+
+    // Get results of the last compilation.
+    int getShaderVersion() const { return shaderVersion; }
+    TInfoSink&amp; getInfoSink() { return infoSink; }
+
+    const std::vector&lt;sh::Attribute&gt; &amp;getAttributes() const { return attributes; }
+    const std::vector&lt;sh::Attribute&gt; &amp;getOutputVariables() const { return outputVariables; }
+    const std::vector&lt;sh::Uniform&gt; &amp;getUniforms() const { return uniforms; }
+    const std::vector&lt;sh::Varying&gt; &amp;getVaryings() const { return varyings; }
+    const std::vector&lt;sh::InterfaceBlock&gt; &amp;getInterfaceBlocks() const { return interfaceBlocks; }
+
+    ShHashFunction64 getHashFunction() const { return hashFunction; }
+    NameMap&amp; getNameMap() { return nameMap; }
+    TSymbolTable&amp; getSymbolTable() { return symbolTable; }
+    ShShaderSpec getShaderSpec() const { return shaderSpec; }
+    ShShaderOutput getOutputType() const { return outputType; }
+    const std::string &amp;getBuiltInResourcesString() const { return builtInResourcesString; }
+
+    // Get the resources set by InitBuiltInSymbolTable
+    const ShBuiltInResources&amp; getResources() const;
+
+  protected:
+    sh::GLenum getShaderType() const { return shaderType; }
+    // Initialize symbol-table with built-in symbols.
+    bool InitBuiltInSymbolTable(const ShBuiltInResources&amp; resources);
+    // Compute the string representation of the built-in resources
+    void setResourceString();
+    // Clears the results from the previous compilation.
+    void clearResults();
+    // Return false if the call depth is exceeded.
+    bool checkCallDepth();
+    // Returns true if a program has no conflicting or missing fragment outputs
+    bool validateOutputs(TIntermNode* root);
+    // Rewrites a shader's intermediate tree according to the CSS Shaders spec.
+    void rewriteCSSShader(TIntermNode* root);
+    // Returns true if the given shader does not exceed the minimum
+    // functionality mandated in GLSL 1.0 spec Appendix A.
+    bool validateLimitations(TIntermNode* root);
+    // Collect info for all attribs, uniforms, varyings.
+    void collectVariables(TIntermNode* root);
+    // Add emulated functions to the built-in function emulator.
+    virtual void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) {};
+    // Translate to object code.
+    virtual void translate(TIntermNode *root, int compileOptions) = 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();
+    // Insert statements to initialize varyings without static use in the beginning
+    // of main(). It is to work around a Mac driver where such varyings in a vertex
+    // shader may be optimized out incorrectly at compile time, causing a link failure.
+    // This function should only be applied to vertex shaders.
+    void initializeVaryingsWithoutStaticUse(TIntermNode* root);
+    // Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
+    // It is to work around a Linux driver bug where missing this causes compile failure
+    // while spec says it is allowed.
+    // This function should only be applied to vertex shaders.
+    void initializeGLPosition(TIntermNode* root);
+    // 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.
+    bool enforceVertexShaderTimingRestrictions(TIntermNode* root);
+    // Returns true if the shader does not use sampler dependent values to affect control
+    // flow or in operations whose time can depend on the input values.
+    bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph&amp; graph);
+    // Return true if the maximum expression complexity is below the limit.
+    bool limitExpressionComplexity(TIntermNode* root);
+    // Get built-in extensions with default behavior.
+    const TExtensionBehavior&amp; getExtensionBehavior() const;
+    const char *getSourcePath() const;
+    const TPragma&amp; getPragma() const { return mPragma; }
+    void writePragma();
+
+    const ArrayBoundsClamper&amp; getArrayBoundsClamper() const;
+    ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const;
+    const BuiltInFunctionEmulator&amp; getBuiltInFunctionEmulator() const;
+
+    std::vector&lt;sh::Attribute&gt; attributes;
+    std::vector&lt;sh::Attribute&gt; outputVariables;
+    std::vector&lt;sh::Uniform&gt; uniforms;
+    std::vector&lt;sh::ShaderVariable&gt; expandedUniforms;
+    std::vector&lt;sh::Varying&gt; varyings;
+    std::vector&lt;sh::InterfaceBlock&gt; interfaceBlocks;
+
+  private:
+    // Creates the function call DAG for further analysis, returning false if there is a recursion
+    bool initCallDag(TIntermNode *root);
+    // Return false if &quot;main&quot; doesn't exist
+    bool tagUsedFunctions();
+    void internalTagUsedFunction(size_t index);
+
+    // Removes unused function declarations and prototypes from the AST
+    class UnusedPredicate;
+    bool pruneUnusedFunctions(TIntermNode *root);
+
+    TIntermNode *compileTreeImpl(const char* const shaderStrings[],
+        size_t numStrings, int compileOptions);
+
+    sh::GLenum shaderType;
+    ShShaderSpec shaderSpec;
+    ShShaderOutput outputType;
+
+    struct FunctionMetadata
+    {
+        FunctionMetadata()
+            : used(false)
+        {
+        }
+        bool used;
+    };
+
+    CallDAG mCallDag;
+    std::vector&lt;FunctionMetadata&gt; functionMetadata;
+
+    int maxUniformVectors;
+    int maxExpressionComplexity;
+    int maxCallStackDepth;
+
+    ShBuiltInResources compileResources;
+    std::string builtInResourcesString;
+
+    // Built-in symbol table for the given language, spec, and resources.
+    // It is preserved from compile-to-compile.
+    TSymbolTable symbolTable;
+    // Built-in extensions with default behavior.
+    TExtensionBehavior extensionBehavior;
+    bool fragmentPrecisionHigh;
+
+    ArrayBoundsClamper arrayBoundsClamper;
+    ShArrayIndexClampingStrategy clampingStrategy;
+    BuiltInFunctionEmulator builtInFunctionEmulator;
+
+    // Results of compilation.
+    int shaderVersion;
+    TInfoSink infoSink;  // Output sink.
+    const char *mSourcePath; // Path of source file or NULL
+
+    // name hashing.
+    ShHashFunction64 hashFunction;
+    NameMap nameMap;
+
+    TPragma mPragma;
+};
+
+//
+// This is the interface between the machine independent code
+// and the machine dependent code.
+//
+// The machine dependent code should derive from the classes
+// above. Then Construct*() and Delete*() will create and
+// destroy the machine dependent objects, which contain the
+// above machine independent information.
+//
+TCompiler* ConstructCompiler(
+    sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
+void DeleteCompiler(TCompiler*);
+
+#endif // COMPILER_TRANSLATOR_COMPILER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorConstantUnionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ConstantUnion.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ConstantUnion.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ConstantUnion.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,23 +1,86 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _CONSTANT_UNION_INCLUDED_
-#define _CONSTANT_UNION_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_CONSTANTUNION_H_
+#define COMPILER_TRANSLATOR_CONSTANTUNION_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;assert.h&gt;
</span><span class="cx"> 
</span><del>-class ConstantUnion {
</del><ins>+#include &quot;compiler/translator/BaseTypes.h&quot;
+
+class TConstantUnion {
</ins><span class="cx"> public:
</span><span class="cx">     POOL_ALLOCATOR_NEW_DELETE();
</span><del>-    ConstantUnion()
</del><ins>+    TConstantUnion()
</ins><span class="cx">     {
</span><span class="cx">         iConst = 0;
</span><span class="cx">         type = EbtVoid;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    bool cast(TBasicType newType, const TConstantUnion &amp;constant)
+    {
+        switch (newType)
+        {
+          case EbtFloat:
+            switch (constant.type)
+            {
+              case EbtInt:   setFConst(static_cast&lt;float&gt;(constant.getIConst())); break;
+              case EbtUInt:  setFConst(static_cast&lt;float&gt;(constant.getUConst())); break;
+              case EbtBool:  setFConst(static_cast&lt;float&gt;(constant.getBConst())); break;
+              case EbtFloat: setFConst(static_cast&lt;float&gt;(constant.getFConst())); break;
+              default:       return false;
+            }
+            break;
+          case EbtInt:
+            switch (constant.type)
+            {
+              case EbtInt:   setIConst(static_cast&lt;int&gt;(constant.getIConst())); break;
+              case EbtUInt:  setIConst(static_cast&lt;int&gt;(constant.getUConst())); break;
+              case EbtBool:  setIConst(static_cast&lt;int&gt;(constant.getBConst())); break;
+              case EbtFloat: setIConst(static_cast&lt;int&gt;(constant.getFConst())); break;
+              default:       return false;
+            }
+            break;
+          case EbtUInt:
+            switch (constant.type)
+            {
+              case EbtInt:   setUConst(static_cast&lt;unsigned int&gt;(constant.getIConst())); break;
+              case EbtUInt:  setUConst(static_cast&lt;unsigned int&gt;(constant.getUConst())); break;
+              case EbtBool:  setUConst(static_cast&lt;unsigned int&gt;(constant.getBConst())); break;
+              case EbtFloat: setUConst(static_cast&lt;unsigned int&gt;(constant.getFConst())); break;
+              default:       return false;
+            }
+            break;
+          case EbtBool:
+            switch (constant.type)
+            {
+              case EbtInt:   setBConst(constant.getIConst() != 0);    break;
+              case EbtUInt:  setBConst(constant.getUConst() != 0);    break;
+              case EbtBool:  setBConst(constant.getBConst());         break;
+              case EbtFloat: setBConst(constant.getFConst() != 0.0f); break;
+              default:       return false;
+            }
+            break;
+          case EbtStruct:    // Struct fields don't get cast
+            switch (constant.type)
+            {
+              case EbtInt:   setIConst(constant.getIConst()); break;
+              case EbtUInt:  setUConst(constant.getUConst()); break;
+              case EbtBool:  setBConst(constant.getBConst()); break;
+              case EbtFloat: setFConst(constant.getFConst()); break;
+              default:       return false;
+            }
+            break;
+          default:
+            return false;
+        }
+
+        return true;
+    }
+
</ins><span class="cx">     void setIConst(int i) {iConst = i; type = EbtInt; }
</span><span class="cx">     void setUConst(unsigned int u) { uConst = u; type = EbtUInt; }
</span><span class="cx">     void setFConst(float f) {fConst = f; type = EbtFloat; }
</span><span class="lines">@@ -48,7 +111,7 @@
</span><span class="cx">         return b == bConst;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool operator==(const ConstantUnion&amp; constant) const
</del><ins>+    bool operator==(const TConstantUnion&amp; constant) const
</ins><span class="cx">     {
</span><span class="cx">         if (constant.type != type)
</span><span class="cx">             return false;
</span><span class="lines">@@ -87,12 +150,12 @@
</span><span class="cx">         return !operator==(b);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool operator!=(const ConstantUnion&amp; constant) const
</del><ins>+    bool operator!=(const TConstantUnion&amp; constant) const
</ins><span class="cx">     {
</span><span class="cx">         return !operator==(constant);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool operator&gt;(const ConstantUnion&amp; constant) const
</del><ins>+    bool operator&gt;(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="lines">@@ -107,7 +170,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool operator&lt;(const ConstantUnion&amp; constant) const
</del><ins>+    bool operator&lt;(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="lines">@@ -122,9 +185,9 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator+(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator+(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
</span><span class="lines">@@ -136,9 +199,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator-(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator-(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
</span><span class="lines">@@ -150,9 +213,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator*(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator*(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
</span><span class="lines">@@ -164,9 +227,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator%(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator%(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
</span><span class="lines">@@ -177,9 +240,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator&gt;&gt;(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator&gt;&gt;(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt: returnValue.setIConst(iConst &gt;&gt; constant.iConst); break;
</span><span class="lines">@@ -190,10 +253,13 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator&lt;&lt;(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator&lt;&lt;(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
-        assert(type == constant.type);
</del><ins>+        TConstantUnion returnValue;
+        // The signedness of the second parameter might be different, but we
+        // don't care, since the result is undefined if the second parameter is
+        // negative, and aliasing should not be a problem with unions.
+        assert(constant.type == EbtInt || constant.type == EbtUInt);
</ins><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt: returnValue.setIConst(iConst &lt;&lt; constant.iConst); break;
</span><span class="cx">         case EbtUInt: returnValue.setUConst(uConst &lt;&lt; constant.uConst); break;
</span><span class="lines">@@ -203,10 +269,10 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator&amp;(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator&amp;(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
-        assert(type == constant.type);
</del><ins>+        TConstantUnion returnValue;
+        assert(constant.type == EbtInt || constant.type == EbtUInt);
</ins><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt:  returnValue.setIConst(iConst &amp; constant.iConst); break;
</span><span class="cx">         case EbtUInt:  returnValue.setUConst(uConst &amp; constant.uConst); break;
</span><span class="lines">@@ -216,9 +282,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator|(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator|(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt:  returnValue.setIConst(iConst | constant.iConst); break;
</span><span class="lines">@@ -229,9 +295,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator^(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator^(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtInt:  returnValue.setIConst(iConst ^ constant.iConst); break;
</span><span class="lines">@@ -242,9 +308,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator&amp;&amp;(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator&amp;&amp;(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtBool: returnValue.setBConst(bConst &amp;&amp; constant.bConst); break;
</span><span class="lines">@@ -254,9 +320,9 @@
</span><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion operator||(const ConstantUnion&amp; constant) const
</del><ins>+    TConstantUnion operator||(const TConstantUnion&amp; constant) const
</ins><span class="cx">     { 
</span><del>-        ConstantUnion returnValue;
</del><ins>+        TConstantUnion returnValue;
</ins><span class="cx">         assert(type == constant.type);
</span><span class="cx">         switch (type) {
</span><span class="cx">         case EbtBool: returnValue.setBConst(bConst || constant.bConst); break;
</span><span class="lines">@@ -279,4 +345,4 @@
</span><span class="cx">     TBasicType type;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // _CONSTANT_UNION_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_CONSTANTUNION_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDetectCallDepthcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,185 +0,0 @@
</span><del>-//
-// 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.
-//
-
-#include &quot;compiler/translator/DetectCallDepth.h&quot;
-#include &quot;compiler/translator/InfoSink.h&quot;
-
-DetectCallDepth::FunctionNode::FunctionNode(const TString&amp; fname)
-    : name(fname),
-      visit(PreVisit)
-{
-}
-
-const TString&amp; DetectCallDepth::FunctionNode::getName() const
-{
-    return name;
-}
-
-void DetectCallDepth::FunctionNode::addCallee(
-    DetectCallDepth::FunctionNode* callee)
-{
-    for (size_t i = 0; i &lt; callees.size(); ++i) {
-        if (callees[i] == callee)
-            return;
-    }
-    callees.push_back(callee);
-}
-
-int DetectCallDepth::FunctionNode::detectCallDepth(DetectCallDepth* detectCallDepth, int depth)
-{
-    ASSERT(visit == PreVisit);
-    ASSERT(detectCallDepth);
-
-    int maxDepth = depth;
-    visit = InVisit;
-    for (size_t i = 0; i &lt; callees.size(); ++i) {
-        switch (callees[i]-&gt;visit) {
-            case InVisit:
-                // cycle detected, i.e., recursion detected.
-                return kInfiniteCallDepth;
-            case PostVisit:
-                break;
-            case PreVisit: {
-                // Check before we recurse so we don't go too depth
-                if (detectCallDepth-&gt;checkExceedsMaxDepth(depth))
-                    return depth;
-                int callDepth = callees[i]-&gt;detectCallDepth(detectCallDepth, depth + 1);
-                // Check after we recurse so we can exit immediately and provide info.
-                if (detectCallDepth-&gt;checkExceedsMaxDepth(callDepth)) {
-                    detectCallDepth-&gt;getInfoSink().info &lt;&lt; &quot;&lt;-&quot; &lt;&lt; callees[i]-&gt;getName();
-                    return callDepth;
-                }
-                maxDepth = std::max(callDepth, maxDepth);
-                break;
-            }
-            default:
-                UNREACHABLE();
-                break;
-        }
-    }
-    visit = PostVisit;
-    return maxDepth;
-}
-
-void DetectCallDepth::FunctionNode::reset()
-{
-    visit = PreVisit;
-}
-
-DetectCallDepth::DetectCallDepth(TInfoSink&amp; infoSink, bool limitCallStackDepth, int maxCallStackDepth)
-    : TIntermTraverser(true, false, true, false),
-      currentFunction(NULL),
-      infoSink(infoSink),
-      maxDepth(limitCallStackDepth ? maxCallStackDepth : FunctionNode::kInfiniteCallDepth)
-{
-}
-
-DetectCallDepth::~DetectCallDepth()
-{
-    for (size_t i = 0; i &lt; functions.size(); ++i)
-        delete functions[i];
-}
-
-bool DetectCallDepth::visitAggregate(Visit visit, TIntermAggregate* node)
-{
-    switch (node-&gt;getOp())
-    {
-        case EOpPrototype:
-            // Function declaration.
-            // Don't add FunctionNode here because node-&gt;getName() is the
-            // unmangled function name.
-            break;
-        case EOpFunction: {
-            // Function definition.
-            if (visit == PreVisit) {
-                currentFunction = findFunctionByName(node-&gt;getName());
-                if (currentFunction == NULL) {
-                    currentFunction = new FunctionNode(node-&gt;getName());
-                    functions.push_back(currentFunction);
-                }
-            } else if (visit == PostVisit) {
-                currentFunction = NULL;
-            }
-            break;
-        }
-        case EOpFunctionCall: {
-            // Function call.
-            if (visit == PreVisit) {
-                FunctionNode* func = findFunctionByName(node-&gt;getName());
-                if (func == NULL) {
-                    func = new FunctionNode(node-&gt;getName());
-                    functions.push_back(func);
-                }
-                if (currentFunction)
-                    currentFunction-&gt;addCallee(func);
-            }
-            break;
-        }
-        default:
-            break;
-    }
-    return true;
-}
-
-bool DetectCallDepth::checkExceedsMaxDepth(int depth)
-{
-    return depth &gt;= maxDepth;
-}
-
-void DetectCallDepth::resetFunctionNodes()
-{
-    for (size_t i = 0; i &lt; functions.size(); ++i) {
-        functions[i]-&gt;reset();
-    }
-}
-
-DetectCallDepth::ErrorCode DetectCallDepth::detectCallDepthForFunction(FunctionNode* func)
-{
-    currentFunction = NULL;
-    resetFunctionNodes();
-
-    int maxCallDepth = func-&gt;detectCallDepth(this, 1);
-
-    if (maxCallDepth == FunctionNode::kInfiniteCallDepth)
-        return kErrorRecursion;
-
-    if (maxCallDepth &gt;= maxDepth)
-        return kErrorMaxDepthExceeded;
-
-    return kErrorNone;
-}
-
-DetectCallDepth::ErrorCode DetectCallDepth::detectCallDepth()
-{
-    if (maxDepth != FunctionNode::kInfiniteCallDepth) {
-        // Check all functions because the driver may fail on them
-        // TODO: Before detectingRecursion, strip unused functions.
-        for (size_t i = 0; i &lt; functions.size(); ++i) {
-            ErrorCode error = detectCallDepthForFunction(functions[i]);
-            if (error != kErrorNone)
-                return error;
-        }
-    } else {
-        FunctionNode* main = findFunctionByName(&quot;main(&quot;);
-        if (main == NULL)
-            return kErrorMissingMain;
-
-        return detectCallDepthForFunction(main);
-    }
-
-    return kErrorNone;
-}
-
-DetectCallDepth::FunctionNode* DetectCallDepth::findFunctionByName(
-    const TString&amp; name)
-{
-    for (size_t i = 0; i &lt; functions.size(); ++i) {
-        if (functions[i]-&gt;getName() == name)
-            return functions[i];
-    }
-    return NULL;
-}
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDetectCallDepthh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectCallDepth.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-//
-// 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.
-//
-
-#ifndef COMPILER_DETECT_RECURSION_H_
-#define COMPILER_DETECT_RECURSION_H_
-
-#include &lt;limits.h&gt;
-#include &quot;compiler/translator/intermediate.h&quot;
-#include &quot;compiler/translator/VariableInfo.h&quot;
-
-class TInfoSink;
-
-// Traverses intermediate tree to detect function recursion.
-class DetectCallDepth : public TIntermTraverser {
-public:
-    enum ErrorCode {
-        kErrorMissingMain,
-        kErrorRecursion,
-        kErrorMaxDepthExceeded,
-        kErrorNone
-    };
-
-    DetectCallDepth(TInfoSink&amp; infoSync, bool limitCallStackDepth, int maxCallStackDepth);
-    ~DetectCallDepth();
-
-    virtual bool visitAggregate(Visit, TIntermAggregate*);
-
-    bool checkExceedsMaxDepth(int depth);
-
-    ErrorCode detectCallDepth();
-
-private:
-    class FunctionNode {
-    public:
-        static const int kInfiniteCallDepth = INT_MAX;
-
-        FunctionNode(const TString&amp; fname);
-
-        const TString&amp; getName() const;
-
-        // If a function is already in the callee list, this becomes a no-op.
-        void addCallee(FunctionNode* callee);
-
-        // Returns kInifinityCallDepth if recursive function calls are detected.
-        int detectCallDepth(DetectCallDepth* detectCallDepth, int depth);
-
-        // Reset state.
-        void reset();
-
-    private:
-        // mangled function name is unique.
-        TString name;
-
-        // functions that are directly called by this function.
-        TVector&lt;FunctionNode*&gt; callees;
-
-        Visit visit;
-    };
-
-    ErrorCode detectCallDepthForFunction(FunctionNode* func);
-    FunctionNode* findFunctionByName(const TString&amp; name);
-    void resetFunctionNodes();
-
-    TInfoSink&amp; getInfoSink() { return infoSink; }
-
-    TVector&lt;FunctionNode*&gt; functions;
-    FunctionNode* currentFunction;
-    TInfoSink&amp; infoSink;
-    int maxDepth;
-
-    DetectCallDepth(const DetectCallDepth&amp;);
-    void operator=(const DetectCallDepth&amp;);
-};
-
-#endif  // COMPILER_DETECT_RECURSION_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDetectDiscontinuitycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,139 +0,0 @@
</span><del>-//
-// 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.
-//
-// Contains analysis utilities for dealing with HLSL's lack of support for
-// the use of intrinsic functions which (implicitly or explicitly) compute
-// gradients of functions with discontinuities. 
-//
-
-#include &quot;compiler/translator/DetectDiscontinuity.h&quot;
-
-#include &quot;compiler/translator/ParseContext.h&quot;
-
-namespace sh
-{
-bool DetectLoopDiscontinuity::traverse(TIntermNode *node)
-{
-    mLoopDepth = 0;
-    mLoopDiscontinuity = false;
-    node-&gt;traverse(this);
-    return mLoopDiscontinuity;
-}
-
-bool DetectLoopDiscontinuity::visitLoop(Visit visit, TIntermLoop *loop)
-{
-    if (visit == PreVisit)
-    {
-        ++mLoopDepth;
-    }
-    else if (visit == PostVisit)
-    {
-        --mLoopDepth;
-    }
-
-    return true;
-}
-
-bool DetectLoopDiscontinuity::visitBranch(Visit visit, TIntermBranch *node)
-{
-    if (mLoopDiscontinuity)
-    {
-        return false;
-    }
-
-    if (!mLoopDepth)
-    {
-        return true;
-    }
-
-    switch (node-&gt;getFlowOp())
-    {
-      case EOpKill:
-        break;
-      case EOpBreak:
-      case EOpContinue:
-      case EOpReturn:
-        mLoopDiscontinuity = true;
-        break;
-      default: UNREACHABLE();
-    }
-
-    return !mLoopDiscontinuity;
-}
-
-bool DetectLoopDiscontinuity::visitAggregate(Visit visit, TIntermAggregate *node)
-{
-    return !mLoopDiscontinuity;
-}
-
-bool containsLoopDiscontinuity(TIntermNode *node)
-{
-    DetectLoopDiscontinuity detectLoopDiscontinuity;
-    return detectLoopDiscontinuity.traverse(node);
-}
-
-bool DetectGradientOperation::traverse(TIntermNode *node)
-{
-    mGradientOperation = false;
-    node-&gt;traverse(this);
-    return mGradientOperation;
-}
-
-bool DetectGradientOperation::visitUnary(Visit visit, TIntermUnary *node)
-{
-    if (mGradientOperation)
-    {
-        return false;
-    }
-
-    switch (node-&gt;getOp())
-    {
-      case EOpDFdx:
-      case EOpDFdy:
-        mGradientOperation = true;
-      default:
-        break;
-    }
-
-    return !mGradientOperation;
-}
-
-bool DetectGradientOperation::visitAggregate(Visit visit, TIntermAggregate *node)
-{
-    if (mGradientOperation)
-    {
-        return false;
-    }
-
-    if (node-&gt;getOp() == EOpFunctionCall)
-    {
-        if (!node-&gt;isUserDefined())
-        {
-            TString name = TFunction::unmangleName(node-&gt;getName());
-
-            if (name == &quot;texture2D&quot; ||
-                name == &quot;texture2DProj&quot; ||
-                name == &quot;textureCube&quot;)
-            {
-                mGradientOperation = true;
-            }
-        }
-        else
-        {
-            // When a user defined function is called, we have to
-            // conservatively assume it to contain gradient operations
-            mGradientOperation = true;
-        }
-    }
-
-    return !mGradientOperation;
-}
-
-bool containsGradientOperation(TIntermNode *node)
-{
-    DetectGradientOperation detectGradientOperation;
-    return detectGradientOperation.traverse(node);
-}
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDetectDiscontinuityh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DetectDiscontinuity.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,52 +0,0 @@
</span><del>-//
-// 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.
-//
-// Contains analysis utilities for dealing with HLSL's lack of support for
-// the use of intrinsic functions which (implicitly or explicitly) compute
-// gradients of functions with discontinuities. 
-//
-
-#ifndef COMPILER_DETECTDISCONTINUITY_H_
-#define COMPILER_DETECTDISCONTINUITY_H_
-
-#include &quot;compiler/translator/intermediate.h&quot;
-
-namespace sh
-{
-// Checks whether a loop can run for a variable number of iterations
-class DetectLoopDiscontinuity : public TIntermTraverser
-{
-  public:
-    bool traverse(TIntermNode *node);
-
-  protected:
-    bool visitBranch(Visit visit, TIntermBranch *node);
-    bool visitLoop(Visit visit, TIntermLoop *loop);
-    bool visitAggregate(Visit visit, TIntermAggregate *node);
-
-    int mLoopDepth;
-    bool mLoopDiscontinuity;
-};
-
-bool containsLoopDiscontinuity(TIntermNode *node);
-
-// Checks for intrinsic functions which compute gradients
-class DetectGradientOperation : public TIntermTraverser
-{
-  public:
-    bool traverse(TIntermNode *node);
-
-  protected:
-    bool visitUnary(Visit visit, TIntermUnary *node);
-    bool visitAggregate(Visit visit, TIntermAggregate *node);
-
-    bool mGradientOperation;
-};
-
-bool containsGradientOperation(TIntermNode *node);
-
-}
-
-#endif   // COMPILER_DETECTDISCONTINUITY_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDiagnosticscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/Diagnostics.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/compilerdebug.h&quot;
</del><ins>+#include &quot;common/debug.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><span class="cx"> #include &quot;compiler/preprocessor/SourceLocation.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -50,11 +50,6 @@
</span><span class="cx">     sink &lt;&lt; &quot;'&quot; &lt;&lt; token &lt;&lt;  &quot;' : &quot; &lt;&lt; reason &lt;&lt; &quot; &quot; &lt;&lt; extra &lt;&lt; &quot;\n&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TDiagnostics::writeDebug(const std::string&amp; str)
-{
-    mInfoSink.debug &lt;&lt; str;
-}
-
</del><span class="cx"> void TDiagnostics::print(ID id,
</span><span class="cx">                          const pp::SourceLocation&amp; loc,
</span><span class="cx">                          const std::string&amp; text)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDiagnosticsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Diagnostics.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,14 +4,15 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_DIAGNOSTICS_H_
-#define COMPILER_DIAGNOSTICS_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_DIAGNOSTICS_H_
+#define COMPILER_TRANSLATOR_DIAGNOSTICS_H_
</ins><span class="cx"> 
</span><ins>+#include &quot;common/angleutils.h&quot;
</ins><span class="cx"> #include &quot;compiler/preprocessor/DiagnosticsBase.h&quot;
</span><span class="cx"> 
</span><span class="cx"> class TInfoSink;
</span><span class="cx"> 
</span><del>-class TDiagnostics : public pp::Diagnostics
</del><ins>+class TDiagnostics : public pp::Diagnostics, angle::NonCopyable
</ins><span class="cx"> {
</span><span class="cx">   public:
</span><span class="cx">     TDiagnostics(TInfoSink&amp; infoSink);
</span><span class="lines">@@ -28,8 +29,6 @@
</span><span class="cx">                    const std::string&amp; token,
</span><span class="cx">                    const std::string&amp; extra);
</span><span class="cx"> 
</span><del>-    void writeDebug(const std::string&amp; str);
-
</del><span class="cx">   protected:
</span><span class="cx">     virtual void print(ID id,
</span><span class="cx">                        const pp::SourceLocation&amp; loc,
</span><span class="lines">@@ -41,4 +40,4 @@
</span><span class="cx">     int mNumWarnings;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_DIAGNOSTICS_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_DIAGNOSTICS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDirectiveHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -8,15 +8,15 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;sstream&gt;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/compilerdebug.h&quot;
</del><ins>+#include &quot;common/debug.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/Diagnostics.h&quot;
</span><span class="cx"> 
</span><span class="cx"> static TBehavior getBehavior(const std::string&amp; str)
</span><span class="cx"> {
</span><del>-    static const std::string kRequire(&quot;require&quot;);
-    static const std::string kEnable(&quot;enable&quot;);
-    static const std::string kDisable(&quot;disable&quot;);
-    static const std::string kWarn(&quot;warn&quot;);
</del><ins>+    const char kRequire[] = &quot;require&quot;;
+    const char kEnable[] = &quot;enable&quot;;
+    const char kDisable[] = &quot;disable&quot;;
+    const char kWarn[] = &quot;warn&quot;;
</ins><span class="cx"> 
</span><span class="cx">     if (str == kRequire) return EBhRequire;
</span><span class="cx">     else if (str == kEnable) return EBhEnable;
</span><span class="lines">@@ -27,10 +27,12 @@
</span><span class="cx"> 
</span><span class="cx"> TDirectiveHandler::TDirectiveHandler(TExtensionBehavior&amp; extBehavior,
</span><span class="cx">                                      TDiagnostics&amp; diagnostics,
</span><del>-                                     int&amp; shaderVersion)
</del><ins>+                                     int&amp; shaderVersion,
+                                     bool debugShaderPrecisionSupported)
</ins><span class="cx">     : mExtensionBehavior(extBehavior),
</span><span class="cx">       mDiagnostics(diagnostics),
</span><del>-      mShaderVersion(shaderVersion)
</del><ins>+      mShaderVersion(shaderVersion),
+      mDebugShaderPrecisionSupported(debugShaderPrecisionSupported)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -46,50 +48,67 @@
</span><span class="cx"> 
</span><span class="cx"> void TDirectiveHandler::handlePragma(const pp::SourceLocation&amp; loc,
</span><span class="cx">                                      const std::string&amp; name,
</span><del>-                                     const std::string&amp; value)
</del><ins>+                                     const std::string&amp; value,
+                                     bool stdgl)
</ins><span class="cx"> {
</span><del>-    static const std::string kSTDGL(&quot;STDGL&quot;);
-    static const std::string kOptimize(&quot;optimize&quot;);
-    static const std::string kDebug(&quot;debug&quot;);
-    static const std::string kOn(&quot;on&quot;);
-    static const std::string kOff(&quot;off&quot;);
</del><ins>+    if (stdgl)
+    {
+        const char kInvariant[] = &quot;invariant&quot;;
+        const char kAll[] = &quot;all&quot;;
</ins><span class="cx"> 
</span><del>-    bool invalidValue = false;
-    if (name == kSTDGL)
-    {
</del><ins>+        if (name == kInvariant &amp;&amp; value == kAll)
+            mPragma.stdgl.invariantAll = true;
</ins><span class="cx">         // The STDGL pragma is used to reserve pragmas for use by future
</span><del>-        // revisions of GLSL. Ignore it.
</del><ins>+        // revisions of GLSL.  Do not generate an error on unexpected
+        // name and value.
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    else if (name == kOptimize)
-    {
-        if (value == kOn) mPragma.optimize = true;
-        else if (value == kOff) mPragma.optimize = false;
-        else invalidValue = true;
-    }
-    else if (name == kDebug)
-    {
-        if (value == kOn) mPragma.debug = true;
-        else if (value == kOff) mPragma.debug = false;
-        else invalidValue = true;
-    }
</del><span class="cx">     else
</span><span class="cx">     {
</span><del>-        mDiagnostics.report(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
-        return;
</del><ins>+        const char kOptimize[] = &quot;optimize&quot;;
+        const char kDebug[] = &quot;debug&quot;;
+        const char kDebugShaderPrecision[] = &quot;webgl_debug_shader_precision&quot;;
+        const char kOn[] = &quot;on&quot;;
+        const char kOff[] = &quot;off&quot;;
+
+        bool invalidValue = false;
+        if (name == kOptimize)
+        {
+            if (value == kOn) mPragma.optimize = true;
+            else if (value == kOff) mPragma.optimize = false;
+            else invalidValue = true;
+        }
+        else if (name == kDebug)
+        {
+            if (value == kOn) mPragma.debug = true;
+            else if (value == kOff) mPragma.debug = false;
+            else invalidValue = true;
+        }
+        else if (name == kDebugShaderPrecision &amp;&amp; mDebugShaderPrecisionSupported)
+        {
+            if (value == kOn) mPragma.debugShaderPrecision = true;
+            else if (value == kOff) mPragma.debugShaderPrecision = false;
+            else invalidValue = true;
+        }
+        else
+        {
+            mDiagnostics.report(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
+            return;
+        }
+
+        if (invalidValue)
+        {
+            mDiagnostics.report(pp::Diagnostics::PP_INVALID_PRAGMA_VALUE, loc, value);
+            return;
+        }
</ins><span class="cx">     }
</span><del>-
-    if (invalidValue)
-      mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
-                             &quot;invalid pragma value&quot;, value,
-                             &quot;'on' or 'off' expected&quot;);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TDirectiveHandler::handleExtension(const pp::SourceLocation&amp; loc,
</span><span class="cx">                                         const std::string&amp; name,
</span><span class="cx">                                         const std::string&amp; behavior)
</span><span class="cx"> {
</span><del>-    static const std::string kExtAll(&quot;all&quot;);
</del><ins>+    const char kExtAll[] = &quot;all&quot;;
</ins><span class="cx"> 
</span><span class="cx">     TBehavior behaviorVal = getBehavior(behavior);
</span><span class="cx">     if (behaviorVal == EBhUndefined)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorDirectiveHandlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/DirectiveHandler.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,21 +4,23 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_DIRECTIVE_HANDLER_H_
-#define COMPILER_DIRECTIVE_HANDLER_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
+#define COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
</ins><span class="cx"> 
</span><ins>+#include &quot;common/angleutils.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/ExtensionBehavior.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/Pragma.h&quot;
</span><span class="cx"> #include &quot;compiler/preprocessor/DirectiveHandlerBase.h&quot;
</span><span class="cx"> 
</span><span class="cx"> class TDiagnostics;
</span><span class="cx"> 
</span><del>-class TDirectiveHandler : public pp::DirectiveHandler
</del><ins>+class TDirectiveHandler : public pp::DirectiveHandler, angle::NonCopyable
</ins><span class="cx"> {
</span><span class="cx">   public:
</span><span class="cx">     TDirectiveHandler(TExtensionBehavior&amp; extBehavior,
</span><span class="cx">                       TDiagnostics&amp; diagnostics,
</span><del>-                      int&amp; shaderVersion);
</del><ins>+                      int&amp; shaderVersion,
+                      bool debugShaderPrecisionSupported);
</ins><span class="cx">     virtual ~TDirectiveHandler();
</span><span class="cx"> 
</span><span class="cx">     const TPragma&amp; pragma() const { return mPragma; }
</span><span class="lines">@@ -29,7 +31,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void handlePragma(const pp::SourceLocation&amp; loc,
</span><span class="cx">                               const std::string&amp; name,
</span><del>-                              const std::string&amp; value);
</del><ins>+                              const std::string&amp; value,
+                              bool stdgl);
</ins><span class="cx"> 
</span><span class="cx">     virtual void handleExtension(const pp::SourceLocation&amp; loc,
</span><span class="cx">                                  const std::string&amp; name,
</span><span class="lines">@@ -43,6 +46,7 @@
</span><span class="cx">     TExtensionBehavior&amp; mExtensionBehavior;
</span><span class="cx">     TDiagnostics&amp; mDiagnostics;
</span><span class="cx">     int&amp; mShaderVersion;
</span><ins>+    bool mDebugShaderPrecisionSupported;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_DIRECTIVE_HANDLER_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_DIRECTIVEHANDLER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorEmulatePrecisioncpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,528 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;compiler/translator/EmulatePrecision.h&quot;
+
+namespace
+{
+
+static void writeVectorPrecisionEmulationHelpers(
+    TInfoSinkBase&amp; sink, ShShaderOutput outputLanguage, unsigned int size)
+{
+    std::stringstream vecTypeStrStr;
+    if (outputLanguage == SH_ESSL_OUTPUT)
+        vecTypeStrStr &lt;&lt; &quot;highp &quot;;
+    vecTypeStrStr &lt;&lt; &quot;vec&quot; &lt;&lt; size;
+    std::string vecType = vecTypeStrStr.str();
+
+    sink &lt;&lt;
+    vecType &lt;&lt; &quot; angle_frm(in &quot; &lt;&lt; vecType &lt;&lt; &quot; v) {\n&quot;
+    &quot;    v = clamp(v, -65504.0, 65504.0);\n&quot;
+    &quot;    &quot; &lt;&lt; vecType &lt;&lt; &quot; exponent = floor(log2(abs(v) + 1e-30)) - 10.0;\n&quot;
+    &quot;    bvec&quot; &lt;&lt; size &lt;&lt; &quot; isNonZero = greaterThanEqual(exponent, vec&quot; &lt;&lt; size &lt;&lt; &quot;(-25.0));\n&quot;
+    &quot;    v = v * exp2(-exponent);\n&quot;
+    &quot;    v = sign(v) * floor(abs(v));\n&quot;
+    &quot;    return v * exp2(exponent) * vec&quot; &lt;&lt; size &lt;&lt; &quot;(isNonZero);\n&quot;
+    &quot;}\n&quot;;
+
+    sink &lt;&lt;
+    vecType &lt;&lt; &quot; angle_frl(in &quot; &lt;&lt; vecType &lt;&lt; &quot; v) {\n&quot;
+    &quot;    v = clamp(v, -2.0, 2.0);\n&quot;
+    &quot;    v = v * 256.0;\n&quot;
+    &quot;    v = sign(v) * floor(abs(v));\n&quot;
+    &quot;    return v * 0.00390625;\n&quot;
+    &quot;}\n&quot;;
+}
+
+static void writeMatrixPrecisionEmulationHelper(
+    TInfoSinkBase&amp; sink, ShShaderOutput outputLanguage, unsigned int size, const char *functionName)
+{
+    std::stringstream matTypeStrStr;
+    if (outputLanguage == SH_ESSL_OUTPUT)
+        matTypeStrStr &lt;&lt; &quot;highp &quot;;
+    matTypeStrStr &lt;&lt; &quot;mat&quot; &lt;&lt; size;
+    std::string matType = matTypeStrStr.str();
+
+    sink &lt;&lt; matType &lt;&lt; &quot; &quot; &lt;&lt; functionName &lt;&lt; &quot;(in &quot; &lt;&lt; matType &lt;&lt; &quot; m) {\n&quot;
+            &quot;    &quot; &lt;&lt; matType &lt;&lt; &quot; rounded;\n&quot;;
+
+    for (unsigned int i = 0; i &lt; size; ++i)
+    {
+        sink &lt;&lt; &quot;    rounded[&quot; &lt;&lt; i &lt;&lt; &quot;] = &quot; &lt;&lt; functionName &lt;&lt; &quot;(m[&quot; &lt;&lt; i &lt;&lt; &quot;]);\n&quot;;
+    }
+
+    sink &lt;&lt; &quot;    return rounded;\n&quot;
+            &quot;}\n&quot;;
+}
+
+static void writeCommonPrecisionEmulationHelpers(TInfoSinkBase&amp; sink, ShShaderOutput outputLanguage)
+{
+    // Write the angle_frm functions that round floating point numbers to
+    // half precision, and angle_frl functions that round them to minimum lowp
+    // precision.
+
+    // Unoptimized version of angle_frm for single floats:
+    //
+    // int webgl_maxNormalExponent(in int exponentBits) {
+    //     int possibleExponents = int(exp2(float(exponentBits)));
+    //     int exponentBias = possibleExponents / 2 - 1;
+    //     int allExponentBitsOne = possibleExponents - 1;
+    //     return (allExponentBitsOne - 1) - exponentBias;
+    // }
+    //
+    // float angle_frm(in float x) {
+    //     int mantissaBits = 10;
+    //     int exponentBits = 5;
+    //     float possibleMantissas = exp2(float(mantissaBits));
+    //     float mantissaMax = 2.0 - 1.0 / possibleMantissas;
+    //     int maxNE = webgl_maxNormalExponent(exponentBits);
+    //     float max = exp2(float(maxNE)) * mantissaMax;
+    //     if (x &gt; max) {
+    //         return max;
+    //     }
+    //     if (x &lt; -max) {
+    //         return -max;
+    //     }
+    //     float exponent = floor(log2(abs(x)));
+    //     if (abs(x) == 0.0 || exponent &lt; -float(maxNE)) {
+    //         return 0.0 * sign(x)
+    //     }
+    //     x = x * exp2(-(exponent - float(mantissaBits)));
+    //     x = sign(x) * floor(abs(x));
+    //     return x * exp2(exponent - float(mantissaBits));
+    // }
+
+    // All numbers with a magnitude less than 2^-15 are subnormal, and are
+    // flushed to zero.
+
+    // Note the constant numbers below:
+    // a) 65504 is the maximum possible mantissa (1.1111111111 in binary) times
+    //    2^15, the maximum normal exponent.
+    // b) 10.0 is the number of mantissa bits.
+    // c) -25.0 is the minimum normal half-float exponent -15.0 minus the number
+    //    of mantissa bits.
+    // d) + 1e-30 is to make sure the argument of log2() won't be zero. It can
+    //    only affect the result of log2 on x where abs(x) &lt; 1e-22. Since these
+    //    numbers will be flushed to zero either way (2^-15 is the smallest
+    //    normal positive number), this does not introduce any error.
+
+    std::string floatType = &quot;float&quot;;
+    if (outputLanguage == SH_ESSL_OUTPUT)
+        floatType = &quot;highp float&quot;;
+
+    sink &lt;&lt;
+    floatType &lt;&lt; &quot; angle_frm(in &quot; &lt;&lt; floatType &lt;&lt; &quot; x) {\n&quot;
+    &quot;    x = clamp(x, -65504.0, 65504.0);\n&quot;
+    &quot;    &quot; &lt;&lt; floatType &lt;&lt; &quot; exponent = floor(log2(abs(x) + 1e-30)) - 10.0;\n&quot;
+    &quot;    bool isNonZero = (exponent &gt;= -25.0);\n&quot;
+    &quot;    x = x * exp2(-exponent);\n&quot;
+    &quot;    x = sign(x) * floor(abs(x));\n&quot;
+    &quot;    return x * exp2(exponent) * float(isNonZero);\n&quot;
+    &quot;}\n&quot;;
+
+    sink &lt;&lt;
+    floatType &lt;&lt; &quot; angle_frl(in &quot; &lt;&lt; floatType &lt;&lt; &quot; x) {\n&quot;
+    &quot;    x = clamp(x, -2.0, 2.0);\n&quot;
+    &quot;    x = x * 256.0;\n&quot;
+    &quot;    x = sign(x) * floor(abs(x));\n&quot;
+    &quot;    return x * 0.00390625;\n&quot;
+    &quot;}\n&quot;;
+
+    writeVectorPrecisionEmulationHelpers(sink, outputLanguage, 2);
+    writeVectorPrecisionEmulationHelpers(sink, outputLanguage, 3);
+    writeVectorPrecisionEmulationHelpers(sink, outputLanguage, 4);
+    for (unsigned int size = 2; size &lt;= 4; ++size)
+    {
+        writeMatrixPrecisionEmulationHelper(sink, outputLanguage, size, &quot;angle_frm&quot;);
+        writeMatrixPrecisionEmulationHelper(sink, outputLanguage, size, &quot;angle_frl&quot;);
+    }
+}
+
+static void writeCompoundAssignmentPrecisionEmulation(
+    TInfoSinkBase&amp; sink, ShShaderOutput outputLanguage,
+    const char *lType, const char *rType, const char *opStr, const char *opNameStr)
+{
+    std::string lTypeStr = lType;
+    std::string rTypeStr = rType;
+    if (outputLanguage == SH_ESSL_OUTPUT)
+    {
+        std::stringstream lTypeStrStr;
+        lTypeStrStr &lt;&lt; &quot;highp &quot; &lt;&lt; lType;
+        lTypeStr = lTypeStrStr.str();
+        std::stringstream rTypeStrStr;
+        rTypeStrStr &lt;&lt; &quot;highp &quot; &lt;&lt; rType;
+        rTypeStr = rTypeStrStr.str();
+    }
+
+    // Note that y should be passed through angle_frm at the function call site,
+    // but x can't be passed through angle_frm there since it is an inout parameter.
+    // So only pass x and the result through angle_frm here.
+    sink &lt;&lt;
+    lTypeStr &lt;&lt; &quot; angle_compound_&quot; &lt;&lt; opNameStr &lt;&lt; &quot;_frm(inout &quot; &lt;&lt; lTypeStr &lt;&lt; &quot; x, in &quot; &lt;&lt; rTypeStr &lt;&lt; &quot; y) {\n&quot;
+    &quot;    x = angle_frm(angle_frm(x) &quot; &lt;&lt; opStr &lt;&lt; &quot; y);\n&quot;
+    &quot;    return x;\n&quot;
+    &quot;}\n&quot;;
+    sink &lt;&lt;
+    lTypeStr &lt;&lt; &quot; angle_compound_&quot; &lt;&lt; opNameStr &lt;&lt; &quot;_frl(inout &quot; &lt;&lt; lTypeStr &lt;&lt; &quot; x, in &quot; &lt;&lt; rTypeStr &lt;&lt; &quot; y) {\n&quot;
+    &quot;    x = angle_frl(angle_frm(x) &quot; &lt;&lt; opStr &lt;&lt; &quot; y);\n&quot;
+    &quot;    return x;\n&quot;
+    &quot;}\n&quot;;
+}
+
+const char *getFloatTypeStr(const TType&amp; type)
+{
+    switch (type.getNominalSize())
+    {
+      case 1:
+        return &quot;float&quot;;
+      case 2:
+        return type.getSecondarySize() &gt; 1 ? &quot;mat2&quot; : &quot;vec2&quot;;
+      case 3:
+        return type.getSecondarySize() &gt; 1 ? &quot;mat3&quot; : &quot;vec3&quot;;
+      case 4:
+        return type.getSecondarySize() &gt; 1 ? &quot;mat4&quot; : &quot;vec4&quot;;
+      default:
+        UNREACHABLE();
+        return NULL;
+    }
+}
+
+bool canRoundFloat(const TType &amp;type)
+{
+    return type.getBasicType() == EbtFloat &amp;&amp; !type.isNonSquareMatrix() &amp;&amp; !type.isArray() &amp;&amp;
+        (type.getPrecision() == EbpLow || type.getPrecision() == EbpMedium);
+}
+
+TIntermAggregate *createInternalFunctionCallNode(TString name, TIntermNode *child)
+{
+    TIntermAggregate *callNode = new TIntermAggregate();
+    callNode-&gt;setOp(EOpInternalFunctionCall);
+    callNode-&gt;setName(name);
+    callNode-&gt;getSequence()-&gt;push_back(child);
+    return callNode;
+}
+
+TIntermAggregate *createRoundingFunctionCallNode(TIntermTyped *roundedChild)
+{
+    TString roundFunctionName;
+    if (roundedChild-&gt;getPrecision() == EbpMedium)
+        roundFunctionName = &quot;angle_frm&quot;;
+    else
+        roundFunctionName = &quot;angle_frl&quot;;
+    return createInternalFunctionCallNode(roundFunctionName, roundedChild);
+}
+
+TIntermAggregate *createCompoundAssignmentFunctionCallNode(TIntermTyped *left, TIntermTyped *right, const char *opNameStr)
+{
+    std::stringstream strstr;
+    if (left-&gt;getPrecision() == EbpMedium)
+        strstr &lt;&lt; &quot;angle_compound_&quot; &lt;&lt; opNameStr &lt;&lt; &quot;_frm&quot;;
+    else
+        strstr &lt;&lt; &quot;angle_compound_&quot; &lt;&lt; opNameStr &lt;&lt; &quot;_frl&quot;;
+    TString functionName = strstr.str().c_str();
+    TIntermAggregate *callNode = createInternalFunctionCallNode(functionName, left);
+    callNode-&gt;getSequence()-&gt;push_back(right);
+    return callNode;
+}
+
+bool parentUsesResult(TIntermNode* parent, TIntermNode* node)
+{
+    if (!parent)
+    {
+        return false;
+    }
+
+    TIntermAggregate *aggParent = parent-&gt;getAsAggregate();
+    // If the parent's op is EOpSequence, the result is not assigned anywhere,
+    // so rounding it is not needed. In particular, this can avoid a lot of
+    // unnecessary rounding of unused return values of assignment.
+    if (aggParent &amp;&amp; aggParent-&gt;getOp() == EOpSequence)
+    {
+        return false;
+    }
+    if (aggParent &amp;&amp; aggParent-&gt;getOp() == EOpComma &amp;&amp; (aggParent-&gt;getSequence()-&gt;back() != node))
+    {
+        return false;
+    }
+    return true;
+}
+
+}  // namespace anonymous
+
+EmulatePrecision::EmulatePrecision()
+    : TIntermTraverser(true, true, true),
+      mDeclaringVariables(false),
+      mInLValue(false),
+      mInFunctionCallOutParameter(false)
+{}
+
+void EmulatePrecision::visitSymbol(TIntermSymbol *node)
+{
+    if (canRoundFloat(node-&gt;getType()) &amp;&amp;
+        !mDeclaringVariables &amp;&amp; !mInLValue &amp;&amp; !mInFunctionCallOutParameter)
+    {
+        TIntermNode *parent = getParentNode();
+        TIntermNode *replacement = createRoundingFunctionCallNode(node);
+        mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, true));
+    }
+}
+
+
+bool EmulatePrecision::visitBinary(Visit visit, TIntermBinary *node)
+{
+    bool visitChildren = true;
+
+    if (node-&gt;isAssignment())
+    {
+        if (visit == PreVisit)
+            mInLValue = true;
+        else if (visit == InVisit)
+            mInLValue = false;
+    }
+
+    TOperator op = node-&gt;getOp();
+
+    // RHS of initialize is not being declared.
+    if (op == EOpInitialize &amp;&amp; visit == InVisit)
+        mDeclaringVariables = false;
+
+    if ((op == EOpIndexDirectStruct || op == EOpVectorSwizzle) &amp;&amp; visit == InVisit)
+        visitChildren = false;
+
+    if (visit != PreVisit)
+        return visitChildren;
+
+    const TType&amp; type = node-&gt;getType();
+    bool roundFloat = canRoundFloat(type);
+
+    if (roundFloat) {
+        switch (op) {
+          // Math operators that can result in a float may need to apply rounding to the return
+          // value. Note that in the case of assignment, the rounding is applied to its return
+          // value here, not the value being assigned.
+          case EOpAssign:
+          case EOpAdd:
+          case EOpSub:
+          case EOpMul:
+          case EOpDiv:
+          case EOpVectorTimesScalar:
+          case EOpVectorTimesMatrix:
+          case EOpMatrixTimesVector:
+          case EOpMatrixTimesScalar:
+          case EOpMatrixTimesMatrix:
+          {
+            TIntermNode *parent = getParentNode();
+            if (!parentUsesResult(parent, node))
+            {
+                break;
+            }
+            TIntermNode *replacement = createRoundingFunctionCallNode(node);
+            mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, true));
+            break;
+          }
+
+          // Compound assignment cases need to replace the operator with a function call.
+          case EOpAddAssign:
+          {
+            mEmulateCompoundAdd.insert(TypePair(getFloatTypeStr(type), getFloatTypeStr(node-&gt;getRight()-&gt;getType())));
+            TIntermNode *parent = getParentNode();
+            TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(node-&gt;getLeft(), node-&gt;getRight(), &quot;add&quot;);
+            mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, false));
+            break;
+          }
+          case EOpSubAssign:
+          {
+            mEmulateCompoundSub.insert(TypePair(getFloatTypeStr(type), getFloatTypeStr(node-&gt;getRight()-&gt;getType())));
+            TIntermNode *parent = getParentNode();
+            TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(node-&gt;getLeft(), node-&gt;getRight(), &quot;sub&quot;);
+            mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, false));
+            break;
+          }
+          case EOpMulAssign:
+          case EOpVectorTimesMatrixAssign:
+          case EOpVectorTimesScalarAssign:
+          case EOpMatrixTimesScalarAssign:
+          case EOpMatrixTimesMatrixAssign:
+          {
+            mEmulateCompoundMul.insert(TypePair(getFloatTypeStr(type), getFloatTypeStr(node-&gt;getRight()-&gt;getType())));
+            TIntermNode *parent = getParentNode();
+            TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(node-&gt;getLeft(), node-&gt;getRight(), &quot;mul&quot;);
+            mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, false));
+            break;
+          }
+          case EOpDivAssign:
+          {
+            mEmulateCompoundDiv.insert(TypePair(getFloatTypeStr(type), getFloatTypeStr(node-&gt;getRight()-&gt;getType())));
+            TIntermNode *parent = getParentNode();
+            TIntermNode *replacement = createCompoundAssignmentFunctionCallNode(node-&gt;getLeft(), node-&gt;getRight(), &quot;div&quot;);
+            mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, false));
+            break;
+          }
+          default:
+            // The rest of the binary operations should not need precision emulation.
+            break;
+        }
+    }
+    return visitChildren;
+}
+
+bool EmulatePrecision::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+    bool visitChildren = true;
+    switch (node-&gt;getOp())
+    {
+      case EOpSequence:
+      case EOpConstructStruct:
+        // No special handling
+        break;
+      case EOpFunction:
+        if (visit == PreVisit)
+        {
+            const TIntermSequence &amp;sequence = *(node-&gt;getSequence());
+            TIntermSequence::const_iterator seqIter = sequence.begin();
+            TIntermAggregate *params = (*seqIter)-&gt;getAsAggregate();
+            ASSERT(params != NULL);
+            ASSERT(params-&gt;getOp() == EOpParameters);
+            mFunctionMap[node-&gt;getName()] = params-&gt;getSequence();
+        }
+        break;
+      case EOpPrototype:
+        if (visit == PreVisit)
+            mFunctionMap[node-&gt;getName()] = node-&gt;getSequence();
+        visitChildren = false;
+        break;
+      case EOpParameters:
+        visitChildren = false;
+        break;
+      case EOpInvariantDeclaration:
+        visitChildren = false;
+        break;
+      case EOpDeclaration:
+        // Variable declaration.
+        if (visit == PreVisit)
+        {
+            mDeclaringVariables = true;
+        }
+        else if (visit == InVisit)
+        {
+            mDeclaringVariables = true;
+        }
+        else
+        {
+            mDeclaringVariables = false;
+        }
+        break;
+      case EOpFunctionCall:
+      {
+        // Function call.
+        bool inFunctionMap = (mFunctionMap.find(node-&gt;getName()) != mFunctionMap.end());
+        if (visit == PreVisit)
+        {
+            // User-defined function return values are not rounded, this relies on that
+            // calculations producing the value were rounded.
+            TIntermNode *parent = getParentNode();
+            if (canRoundFloat(node-&gt;getType()) &amp;&amp; !inFunctionMap &amp;&amp; parentUsesResult(parent, node))
+            {
+                TIntermNode *replacement = createRoundingFunctionCallNode(node);
+                mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, true));
+            }
+
+            if (inFunctionMap)
+            {
+                mSeqIterStack.push_back(mFunctionMap[node-&gt;getName()]-&gt;begin());
+                if (mSeqIterStack.back() != mFunctionMap[node-&gt;getName()]-&gt;end())
+                {
+                    TQualifier qualifier = (*mSeqIterStack.back())-&gt;getAsTyped()-&gt;getQualifier();
+                    mInFunctionCallOutParameter = (qualifier == EvqOut || qualifier == EvqInOut);
+                }
+            }
+            else
+            {
+                // The function is not user-defined - it is likely built-in texture function.
+                // Assume that those do not have out parameters.
+                mInFunctionCallOutParameter = false;
+            }
+        }
+        else if (visit == InVisit)
+        {
+            if (inFunctionMap)
+            {
+                ++mSeqIterStack.back();
+                TQualifier qualifier = (*mSeqIterStack.back())-&gt;getAsTyped()-&gt;getQualifier();
+                mInFunctionCallOutParameter = (qualifier == EvqOut || qualifier == EvqInOut);
+            }
+        }
+        else
+        {
+            if (inFunctionMap)
+            {
+                mSeqIterStack.pop_back();
+                mInFunctionCallOutParameter = false;
+            }
+        }
+        break;
+      }
+      default:
+        TIntermNode *parent = getParentNode();
+        if (canRoundFloat(node-&gt;getType()) &amp;&amp; visit == PreVisit &amp;&amp; parentUsesResult(parent, node))
+        {
+            TIntermNode *replacement = createRoundingFunctionCallNode(node);
+            mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, true));
+        }
+        break;
+    }
+    return visitChildren;
+}
+
+bool EmulatePrecision::visitUnary(Visit visit, TIntermUnary *node)
+{
+    switch (node-&gt;getOp())
+    {
+      case EOpNegative:
+      case EOpVectorLogicalNot:
+      case EOpLogicalNot:
+        break;
+      case EOpPostIncrement:
+      case EOpPostDecrement:
+      case EOpPreIncrement:
+      case EOpPreDecrement:
+        if (visit == PreVisit)
+            mInLValue = true;
+        else if (visit == PostVisit)
+            mInLValue = false;
+        break;
+      default:
+        if (canRoundFloat(node-&gt;getType()) &amp;&amp; visit == PreVisit)
+        {
+            TIntermNode *parent = getParentNode();
+            TIntermNode *replacement = createRoundingFunctionCallNode(node);
+            mReplacements.push_back(NodeUpdateEntry(parent, node, replacement, true));
+        }
+        break;
+    }
+
+    return true;
+}
+
+void EmulatePrecision::writeEmulationHelpers(TInfoSinkBase&amp; sink, ShShaderOutput outputLanguage)
+{
+    // Other languages not yet supported
+    ASSERT(outputLanguage == SH_GLSL_COMPATIBILITY_OUTPUT ||
+           IsGLSL130OrNewer(outputLanguage) ||
+           outputLanguage == SH_ESSL_OUTPUT);
+    writeCommonPrecisionEmulationHelpers(sink, outputLanguage);
+
+    EmulationSet::const_iterator it;
+    for (it = mEmulateCompoundAdd.begin(); it != mEmulateCompoundAdd.end(); it++)
+        writeCompoundAssignmentPrecisionEmulation(sink, outputLanguage, it-&gt;lType, it-&gt;rType, &quot;+&quot;, &quot;add&quot;);
+    for (it = mEmulateCompoundSub.begin(); it != mEmulateCompoundSub.end(); it++)
+        writeCompoundAssignmentPrecisionEmulation(sink, outputLanguage, it-&gt;lType, it-&gt;rType, &quot;-&quot;, &quot;sub&quot;);
+    for (it = mEmulateCompoundDiv.begin(); it != mEmulateCompoundDiv.end(); it++)
+        writeCompoundAssignmentPrecisionEmulation(sink, outputLanguage, it-&gt;lType, it-&gt;rType, &quot;/&quot;, &quot;div&quot;);
+    for (it = mEmulateCompoundMul.begin(); it != mEmulateCompoundMul.end(); it++)
+        writeCompoundAssignmentPrecisionEmulation(sink, outputLanguage, it-&gt;lType, it-&gt;rType, &quot;*&quot;, &quot;mul&quot;);
+}
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorEmulatePrecisionh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/EmulatePrecision.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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_TRANSLATOR_EMULATE_PRECISION_H_
+#define COMPILER_TRANSLATOR_EMULATE_PRECISION_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;compiler/translator/Compiler.h&quot;
+#include &quot;compiler/translator/InfoSink.h&quot;
+#include &quot;compiler/translator/IntermNode.h&quot;
+#include &quot;GLSLANG/ShaderLang.h&quot;
+
+// This class gathers all compound assignments from the AST and can then write
+// the functions required for their precision emulation. This way there is no
+// need to write a huge number of variations of the emulated compound assignment
+// to every translated shader with emulation enabled.
+
+class EmulatePrecision : public TIntermTraverser
+{
+  public:
+    EmulatePrecision();
+
+    virtual void visitSymbol(TIntermSymbol *node);
+    virtual bool visitBinary(Visit visit, TIntermBinary *node);
+    virtual bool visitUnary(Visit visit, TIntermUnary *node);
+    virtual bool visitAggregate(Visit visit, TIntermAggregate *node);
+
+    void writeEmulationHelpers(TInfoSinkBase&amp; sink, ShShaderOutput outputLanguage);
+
+  private:
+    struct TypePair
+    {
+        TypePair(const char *l, const char *r)
+            : lType(l), rType(r) { }
+
+        const char *lType;
+        const char *rType;
+    };
+
+    struct TypePairComparator
+    {
+        bool operator() (const TypePair&amp; l, const TypePair&amp; r) const
+        {
+            if (l.lType == r.lType)
+                return l.rType &lt; r.rType;
+            return l.lType &lt; r.lType;
+        }
+    };
+
+    typedef std::set&lt;TypePair, TypePairComparator&gt; EmulationSet;
+    EmulationSet mEmulateCompoundAdd;
+    EmulationSet mEmulateCompoundSub;
+    EmulationSet mEmulateCompoundMul;
+    EmulationSet mEmulateCompoundDiv;
+
+    // Stack of function call parameter iterators
+    std::vector&lt;TIntermSequence::const_iterator&gt; mSeqIterStack;
+
+    bool mDeclaringVariables;
+    bool mInLValue;
+    bool mInFunctionCallOutParameter;
+
+    struct TStringComparator
+    {
+        bool operator() (const TString&amp; a, const TString&amp; b) const { return a.compare(b) &lt; 0; }
+    };
+
+    // Map from function names to their parameter sequences
+    std::map&lt;TString, TIntermSequence*, TStringComparator&gt; mFunctionMap;
+};
+
+#endif  // COMPILER_TRANSLATOR_EMULATE_PRECISION_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorExtensionBehaviorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ExtensionBehavior.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ExtensionBehavior.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ExtensionBehavior.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _EXTENSION_BEHAVIOR_INCLUDED_
-#define _EXTENSION_BEHAVIOR_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
+#define COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;map&gt;
</span><span class="cx"> #include &lt;string&gt;
</span><span class="lines">@@ -34,4 +34,4 @@
</span><span class="cx"> // Mapping between extension name and behavior.
</span><span class="cx"> typedef std::map&lt;std::string, TBehavior&gt; TExtensionBehavior;
</span><span class="cx"> 
</span><del>-#endif // _EXTENSION_TABLE_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_EXTENSIONBEHAVIOR_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorFlagStd140Structsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/FlagStd140Structs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_FLAGSTD140STRUCTS_H_
-#define COMPILER_FLAGSTD140STRUCTS_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
+#define COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="lines">@@ -34,4 +34,4 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif // COMPILER_FLAGSTD140STRUCTS_H_
</del><ins>+#endif // COMPILER_TRANSLATOR_FLAGSTD140STRUCTS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorForLoopUnrollcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -43,8 +43,8 @@
</span><span class="cx">         // Check if loop index type is integer.
</span><span class="cx">         // This is called after ValidateLimitations pass, so all the calls
</span><span class="cx">         // should be valid. See ValidateLimitations::validateForLoopInit().
</span><del>-        TIntermSequence&amp; declSeq = node-&gt;getInit()-&gt;getAsAggregate()-&gt;getSequence();
-        TIntermSymbol* symbol = declSeq[0]-&gt;getAsBinaryNode()-&gt;getLeft()-&gt;getAsSymbolNode();
</del><ins>+        TIntermSequence *declSeq = node-&gt;getInit()-&gt;getAsAggregate()-&gt;getSequence();
+        TIntermSymbol *symbol = (*declSeq)[0]-&gt;getAsBinaryNode()-&gt;getLeft()-&gt;getAsSymbolNode();
</ins><span class="cx">         if (symbol-&gt;getBasicType() == EbtInt)
</span><span class="cx">             node-&gt;setUnrollFlag(true);
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorForLoopUnrollh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ForLoopUnroll.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_FORLOOPUNROLL_H_
-#define COMPILER_FORLOOPUNROLL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_FORLOOPUNROLL_H_
+#define COMPILER_TRANSLATOR_FORLOOPUNROLL_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/LoopInfo.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -47,4 +47,4 @@
</span><span class="cx">     bool mVisitSamplerArrayIndexNodeInsideLoop;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // COMPILER_TRANSLATOR_FORLOOPUNROLL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorHashNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/HashNames.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/HashNames.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/HashNames.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,15 +4,15 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_HASH_NAMES_H_
-#define COMPILER_HASH_NAMES_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_HASHNAMES_H_
+#define COMPILER_TRANSLATOR_HASHNAMES_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;map&gt;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #define HASHED_NAME_PREFIX &quot;webgl_&quot;
</span><span class="cx"> 
</span><span class="cx"> typedef std::map&lt;TPersistString, TPersistString&gt; NameMap;
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_HASH_NAMES_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_HASHNAMES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInfoSinkh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InfoSink.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InfoSink.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InfoSink.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _INFOSINK_INCLUDED_
-#define _INFOSINK_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_INFOSINK_H_
+#define COMPILER_TRANSLATOR_INFOSINK_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;math.h&gt;
</span><span class="cx"> #include &lt;stdlib.h&gt;
</span><span class="lines">@@ -113,4 +113,4 @@
</span><span class="cx">     TInfoSinkBase obj;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // _INFOSINK_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_INFOSINK_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -12,316 +12,218 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/Initialize.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> 
</span><del>-void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &amp;resources, TSymbolTable &amp;symbolTable)
</del><ins>+void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &amp;resources, TSymbolTable &amp;symbolTable)
</ins><span class="cx"> {
</span><span class="cx">     TType *float1 = new TType(EbtFloat);
</span><span class="cx">     TType *float2 = new TType(EbtFloat, 2);
</span><span class="cx">     TType *float3 = new TType(EbtFloat, 3);
</span><span class="cx">     TType *float4 = new TType(EbtFloat, 4);
</span><del>-
</del><span class="cx">     TType *int1 = new TType(EbtInt);
</span><span class="cx">     TType *int2 = new TType(EbtInt, 2);
</span><span class="cx">     TType *int3 = new TType(EbtInt, 3);
</span><del>-    TType *int4 = new TType(EbtInt, 4);
</del><ins>+    TType *uint1 = new TType(EbtUInt);
+    TType *bool1 = new TType(EbtBool);
+    TType *genType = new TType(EbtGenType);
+    TType *genIType = new TType(EbtGenIType);
+    TType *genUType = new TType(EbtGenUType);
+    TType *genBType = new TType(EbtGenBType);
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // Angle and Trigonometric Functions.
</span><span class="cx">     //
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;radians&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;radians&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;radians&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;radians&quot;, float4);
</del><ins>+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRadians, genType, &quot;radians&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDegrees, genType, &quot;degrees&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSin, genType, &quot;sin&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCos, genType, &quot;cos&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpTan, genType, &quot;tan&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAsin, genType, &quot;asin&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAcos, genType, &quot;acos&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, &quot;atan&quot;, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, &quot;atan&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSinh, genType, &quot;sinh&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpCosh, genType, &quot;cosh&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTanh, genType, &quot;tanh&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAsinh, genType, &quot;asinh&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAcosh, genType, &quot;acosh&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAtanh, genType, &quot;atanh&quot;, genType);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;degrees&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;degrees&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;degrees&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;degrees&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;sin&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;sin&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;sin&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;sin&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;cos&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;cos&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;cos&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;cos&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;tan&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;tan&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;tan&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;tan&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;asin&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;asin&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;asin&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;asin&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;acos&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;acos&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;acos&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;acos&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;atan&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;atan&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;atan&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;atan&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;atan&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;atan&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;atan&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;atan&quot;, float4);
-
</del><span class="cx">     //
</span><span class="cx">     // Exponential Functions.
</span><span class="cx">     //
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;pow&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;pow&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;pow&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;pow&quot;, float4, float4);
</del><ins>+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpPow, genType, &quot;pow&quot;, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp, genType, &quot;exp&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog, genType, &quot;log&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp2, genType, &quot;exp2&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog2, genType, &quot;log2&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSqrt, genType, &quot;sqrt&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpInverseSqrt, genType, &quot;inversesqrt&quot;, genType);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;exp&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;exp&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;exp&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;exp&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;log&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;log&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;log&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;log&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;exp2&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;exp2&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;exp2&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;exp2&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;log2&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;log2&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;log2&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;log2&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;sqrt&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;sqrt&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;sqrt&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;sqrt&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;inversesqrt&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;inversesqrt&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;inversesqrt&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;inversesqrt&quot;, float4);
-
</del><span class="cx">     //
</span><span class="cx">     // Common Functions.
</span><span class="cx">     //
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;abs&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;abs&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;abs&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;abs&quot;, float4);
</del><ins>+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAbs, genType, &quot;abs&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAbs, genIType, &quot;abs&quot;, genIType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSign, genType, &quot;sign&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSign, genIType, &quot;sign&quot;, genIType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFloor, genType, &quot;floor&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTrunc, genType, &quot;trunc&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRound, genType, &quot;round&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRoundEven, genType, &quot;roundEven&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCeil, genType, &quot;ceil&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFract, genType, &quot;fract&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, &quot;mod&quot;, genType, float1);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, &quot;mod&quot;, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, &quot;min&quot;, genType, float1);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, &quot;min&quot;, genType, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, &quot;min&quot;, genIType, genIType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, &quot;min&quot;, genIType, int1);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, &quot;min&quot;, genUType, genUType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, &quot;min&quot;, genUType, uint1);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, &quot;max&quot;, genType, float1);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, &quot;max&quot;, genType, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, &quot;max&quot;, genIType, genIType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, &quot;max&quot;, genIType, int1);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, &quot;max&quot;, genUType, genUType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, &quot;max&quot;, genUType, uint1);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, &quot;clamp&quot;, genType, float1, float1);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, &quot;clamp&quot;, genType, genType, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, &quot;clamp&quot;, genIType, int1, int1);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, &quot;clamp&quot;, genIType, genIType, genIType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, &quot;clamp&quot;, genUType, uint1, uint1);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, &quot;clamp&quot;, genUType, genUType, genUType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, &quot;mix&quot;, genType, genType, float1);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, &quot;mix&quot;, genType, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, &quot;step&quot;, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, &quot;step&quot;, float1, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, &quot;smoothstep&quot;, genType, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, &quot;smoothstep&quot;, float1, float1, genType);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;sign&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;sign&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;sign&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;sign&quot;, float4);
</del><ins>+    TType *outFloat1 = new TType(EbtFloat);
+    TType *outFloat2 = new TType(EbtFloat, 2);
+    TType *outFloat3 = new TType(EbtFloat, 3);
+    TType *outFloat4 = new TType(EbtFloat, 4);
+    outFloat1-&gt;setQualifier(EvqOut);
+    outFloat2-&gt;setQualifier(EvqOut);
+    outFloat3-&gt;setQualifier(EvqOut);
+    outFloat4-&gt;setQualifier(EvqOut);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;floor&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;floor&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;floor&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;floor&quot;, float4);
</del><ins>+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float1, &quot;modf&quot;, float1, outFloat1);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float2, &quot;modf&quot;, float2, outFloat2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float3, &quot;modf&quot;, float3, outFloat3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float4, &quot;modf&quot;, float4, outFloat4);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;ceil&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;ceil&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;ceil&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;ceil&quot;, float4);
</del><ins>+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsNan, genBType, &quot;isnan&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsInf, genBType, &quot;isinf&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, &quot;floatBitsToInt&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, &quot;floatBitsToUint&quot;, genType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, &quot;intBitsToFloat&quot;, genIType);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUintBitsToFloat, genType, &quot;uintBitsToFloat&quot;, genUType);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;fract&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;fract&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;fract&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;fract&quot;, float4);
</del><ins>+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackSnorm2x16, uint1, &quot;packSnorm2x16&quot;, float2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackUnorm2x16, uint1, &quot;packUnorm2x16&quot;, float2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackHalf2x16, uint1, &quot;packHalf2x16&quot;, float2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackSnorm2x16, float2, &quot;unpackSnorm2x16&quot;, uint1);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackUnorm2x16, float2, &quot;unpackUnorm2x16&quot;, uint1);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackHalf2x16, float2, &quot;unpackHalf2x16&quot;, uint1);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;mod&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;mod&quot;, float2, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;mod&quot;, float3, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;mod&quot;, float4, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;mod&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;mod&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;mod&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;min&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;min&quot;, float2, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;min&quot;, float3, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;min&quot;, float4, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;min&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;min&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;min&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;max&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;max&quot;, float2, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;max&quot;, float3, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;max&quot;, float4, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;max&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;max&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;max&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;clamp&quot;, float1, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;clamp&quot;, float2, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;clamp&quot;, float3, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;clamp&quot;, float4, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;clamp&quot;, float2, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;clamp&quot;, float3, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;clamp&quot;, float4, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;mix&quot;, float1, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;mix&quot;, float2, float2, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;mix&quot;, float3, float3, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;mix&quot;, float4, float4, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;mix&quot;, float2, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;mix&quot;, float3, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;mix&quot;, float4, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;step&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;step&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;step&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;step&quot;, float4, float4);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;step&quot;, float1, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;step&quot;, float1, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;step&quot;, float1, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;smoothstep&quot;, float1, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;smoothstep&quot;, float2, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;smoothstep&quot;, float3, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;smoothstep&quot;, float4, float4, float4);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;smoothstep&quot;, float1, float1, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;smoothstep&quot;, float1, float1, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;smoothstep&quot;, float1, float1, float4);
-
</del><span class="cx">     //
</span><span class="cx">     // Geometric Functions.
</span><span class="cx">     //
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;length&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;length&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;length&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;length&quot;, float4);
</del><ins>+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLength, float1, &quot;length&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDistance, float1, &quot;distance&quot;, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDot, float1, &quot;dot&quot;, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCross, float3, &quot;cross&quot;, float3, float3);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpNormalize, genType, &quot;normalize&quot;, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFaceForward, genType, &quot;faceforward&quot;, genType, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpReflect, genType, &quot;reflect&quot;, genType, genType);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRefract, genType, &quot;refract&quot;, genType, genType, float1);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;distance&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;distance&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;distance&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;distance&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;dot&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;dot&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;dot&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;dot&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;cross&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;normalize&quot;, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;normalize&quot;, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;normalize&quot;, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;normalize&quot;, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;faceforward&quot;, float1, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;faceforward&quot;, float2, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;faceforward&quot;, float3, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;faceforward&quot;, float4, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;reflect&quot;, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;reflect&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;reflect&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;reflect&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float1, &quot;refract&quot;, float1, float1, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float2, &quot;refract&quot;, float2, float2, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float3, &quot;refract&quot;, float3, float3, float1);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, float4, &quot;refract&quot;, float4, float4, float1);
-
</del><span class="cx">     TType *mat2 = new TType(EbtFloat, 2, 2);
</span><span class="cx">     TType *mat3 = new TType(EbtFloat, 3, 3);
</span><span class="cx">     TType *mat4 = new TType(EbtFloat, 4, 4);
</span><ins>+    TType *mat2x3 = new TType(EbtFloat, 2, 3);
+    TType *mat3x2 = new TType(EbtFloat, 3, 2);
+    TType *mat2x4 = new TType(EbtFloat, 2, 4);
+    TType *mat4x2 = new TType(EbtFloat, 4, 2);
+    TType *mat3x4 = new TType(EbtFloat, 3, 4);
+    TType *mat4x3 = new TType(EbtFloat, 4, 3);
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // Matrix Functions.
</span><span class="cx">     //
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, mat2, &quot;matrixCompMult&quot;, mat2, mat2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, mat3, &quot;matrixCompMult&quot;, mat3, mat3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, mat4, &quot;matrixCompMult&quot;, mat4, mat4);
</del><ins>+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat2, &quot;matrixCompMult&quot;, mat2, mat2);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat3, &quot;matrixCompMult&quot;, mat3, mat3);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat4, &quot;matrixCompMult&quot;, mat4, mat4);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x3, &quot;matrixCompMult&quot;, mat2x3, mat2x3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x2, &quot;matrixCompMult&quot;, mat3x2, mat3x2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x4, &quot;matrixCompMult&quot;, mat2x4, mat2x4);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x2, &quot;matrixCompMult&quot;, mat4x2, mat4x2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x4, &quot;matrixCompMult&quot;, mat3x4, mat3x4);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x3, &quot;matrixCompMult&quot;, mat4x3, mat4x3);
</ins><span class="cx"> 
</span><del>-    TType *bool1 = new TType(EbtBool);
-    TType *bool2 = new TType(EbtBool, 2);
-    TType *bool3 = new TType(EbtBool, 3);
-    TType *bool4 = new TType(EbtBool, 4);
</del><ins>+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2, &quot;outerProduct&quot;, float2, float2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3, &quot;outerProduct&quot;, float3, float3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4, &quot;outerProduct&quot;, float4, float4);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x3, &quot;outerProduct&quot;, float3, float2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x2, &quot;outerProduct&quot;, float2, float3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x4, &quot;outerProduct&quot;, float4, float2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x2, &quot;outerProduct&quot;, float2, float4);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x4, &quot;outerProduct&quot;, float4, float3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x3, &quot;outerProduct&quot;, float3, float4);
</ins><span class="cx"> 
</span><del>-    //
-    // Vector relational functions.
-    //
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;lessThan&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;lessThan&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;lessThan&quot;, float4, float4);
</del><ins>+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2, &quot;transpose&quot;, mat2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3, &quot;transpose&quot;, mat3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4, &quot;transpose&quot;, mat4);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x3, &quot;transpose&quot;, mat3x2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x2, &quot;transpose&quot;, mat2x3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x4, &quot;transpose&quot;, mat4x2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x2, &quot;transpose&quot;, mat2x4);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x4, &quot;transpose&quot;, mat4x3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x3, &quot;transpose&quot;, mat3x4);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;lessThan&quot;, int2, int2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;lessThan&quot;, int3, int3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;lessThan&quot;, int4, int4);
</del><ins>+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, &quot;determinant&quot;, mat2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, &quot;determinant&quot;, mat3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, &quot;determinant&quot;, mat4);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;lessThanEqual&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;lessThanEqual&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;lessThanEqual&quot;, float4, float4);
</del><ins>+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat2, &quot;inverse&quot;, mat2);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat3, &quot;inverse&quot;, mat3);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat4, &quot;inverse&quot;, mat4);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;lessThanEqual&quot;, int2, int2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;lessThanEqual&quot;, int3, int3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;lessThanEqual&quot;, int4, int4);
</del><ins>+    TType *vec = new TType(EbtVec);
+    TType *ivec = new TType(EbtIVec);
+    TType *uvec = new TType(EbtUVec);
+    TType *bvec = new TType(EbtBVec);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;greaterThan&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;greaterThan&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;greaterThan&quot;, float4, float4);
</del><ins>+    //
+    // Vector relational functions.
+    //
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, &quot;lessThan&quot;, vec, vec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, &quot;lessThan&quot;, ivec, ivec);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThan, bvec, &quot;lessThan&quot;, uvec, uvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, &quot;lessThanEqual&quot;, vec, vec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, &quot;lessThanEqual&quot;, ivec, ivec);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThanEqual, bvec, &quot;lessThanEqual&quot;, uvec, uvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, &quot;greaterThan&quot;, vec, vec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, &quot;greaterThan&quot;, ivec, ivec);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThan, bvec, &quot;greaterThan&quot;, uvec, uvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, &quot;greaterThanEqual&quot;, vec, vec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, &quot;greaterThanEqual&quot;, ivec, ivec);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThanEqual, bvec, &quot;greaterThanEqual&quot;, uvec, uvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, &quot;equal&quot;, vec, vec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, &quot;equal&quot;, ivec, ivec);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorEqual, bvec, &quot;equal&quot;, uvec, uvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, &quot;equal&quot;, bvec, bvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, &quot;notEqual&quot;, vec, vec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, &quot;notEqual&quot;, ivec, ivec);
+    symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorNotEqual, bvec, &quot;notEqual&quot;, uvec, uvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, &quot;notEqual&quot;, bvec, bvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAny, bool1, &quot;any&quot;, bvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAll, bool1, &quot;all&quot;, bvec);
+    symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorLogicalNot, bvec, &quot;not&quot;, bvec);
</ins><span class="cx"> 
</span><del>-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;greaterThan&quot;, int2, int2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;greaterThan&quot;, int3, int3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;greaterThan&quot;, int4, int4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;greaterThanEqual&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;greaterThanEqual&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;greaterThanEqual&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;greaterThanEqual&quot;, int2, int2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;greaterThanEqual&quot;, int3, int3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;greaterThanEqual&quot;, int4, int4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;equal&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;equal&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;equal&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;equal&quot;, int2, int2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;equal&quot;, int3, int3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;equal&quot;, int4, int4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;equal&quot;, bool2, bool2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;equal&quot;, bool3, bool3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;equal&quot;, bool4, bool4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;notEqual&quot;, float2, float2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;notEqual&quot;, float3, float3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;notEqual&quot;, float4, float4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;notEqual&quot;, int2, int2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;notEqual&quot;, int3, int3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;notEqual&quot;, int4, int4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;notEqual&quot;, bool2, bool2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;notEqual&quot;, bool3, bool3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;notEqual&quot;, bool4, bool4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, &quot;any&quot;, bool2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, &quot;any&quot;, bool3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, &quot;any&quot;, bool4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, &quot;all&quot;, bool2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, &quot;all&quot;, bool3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool1, &quot;all&quot;, bool4);
-
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool2, &quot;not&quot;, bool2);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool3, &quot;not&quot;, bool3);
-    symbolTable.insertBuiltIn(COMMON_BUILTINS, bool4, &quot;not&quot;, bool4);
-
</del><span class="cx">     TType *sampler2D = new TType(EbtSampler2D);
</span><span class="cx">     TType *samplerCube = new TType(EbtSamplerCube);
</span><span class="cx"> 
</span><span class="lines">@@ -356,13 +258,13 @@
</span><span class="cx">         /* The *Grad* variants are new to both vertex and fragment shaders; the fragment
</span><span class="cx">          * shader specific pieces are added separately below.
</span><span class="cx">          */
</span><del>-        symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DGradEXT&quot;, sampler2D, float2, float2, float2);
-        symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DProjGradEXT&quot;, sampler2D, float3, float2, float2);
-        symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DProjGradEXT&quot;, sampler2D, float4, float2, float2);
-        symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;textureCubeGradEXT&quot;, samplerCube, float3, float3, float3);
</del><ins>+        symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;texture2DGradEXT&quot;, sampler2D, float2, float2, float2);
+        symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;texture2DProjGradEXT&quot;, sampler2D, float3, float2, float2);
+        symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;texture2DProjGradEXT&quot;, sampler2D, float4, float2, float2);
+        symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;textureCubeGradEXT&quot;, samplerCube, float3, float3, float3);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (type == SH_FRAGMENT_SHADER)
</del><ins>+    if (type == GL_FRAGMENT_SHADER)
</ins><span class="cx">     {
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2D&quot;, sampler2D, float2, float1);
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DProj&quot;, sampler2D, float3, float1);
</span><span class="lines">@@ -371,32 +273,21 @@
</span><span class="cx"> 
</span><span class="cx">         if (resources.OES_standard_derivatives)
</span><span class="cx">         {
</span><del>-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, &quot;dFdx&quot;, float1);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, &quot;dFdx&quot;, float2);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, &quot;dFdx&quot;, float3);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;dFdx&quot;, float4);
-
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, &quot;dFdy&quot;, float1);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, &quot;dFdy&quot;, float2);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, &quot;dFdy&quot;, float3);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;dFdy&quot;, float4);
-
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float1, &quot;fwidth&quot;, float1);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float2, &quot;fwidth&quot;, float2);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float3, &quot;fwidth&quot;, float3);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;fwidth&quot;, float4);
</del><ins>+            symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdx, &quot;GL_OES_standard_derivatives&quot;, genType, &quot;dFdx&quot;, genType);
+            symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdy, &quot;GL_OES_standard_derivatives&quot;, genType, &quot;dFdy&quot;, genType);
+            symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpFwidth, &quot;GL_OES_standard_derivatives&quot;, genType, &quot;fwidth&quot;, genType);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (resources.EXT_shader_texture_lod)
</span><span class="cx">         {
</span><del>-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DLodEXT&quot;, sampler2D, float2, float1);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DProjLodEXT&quot;, sampler2D, float3, float1);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DProjLodEXT&quot;, sampler2D, float4, float1);
-            symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;textureCubeLodEXT&quot;, samplerCube, float3, float1);
</del><ins>+            symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;texture2DLodEXT&quot;, sampler2D, float2, float1);
+            symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;texture2DProjLodEXT&quot;, sampler2D, float3, float1);
+            symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;texture2DProjLodEXT&quot;, sampler2D, float4, float1);
+            symbolTable.insertBuiltIn(ESSL1_BUILTINS, &quot;GL_EXT_shader_texture_lod&quot;, float4, &quot;textureCubeLodEXT&quot;, samplerCube, float3, float1);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if(type == SH_VERTEX_SHADER)
</del><ins>+    if (type == GL_VERTEX_SHADER)
</ins><span class="cx">     {
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DLod&quot;, sampler2D, float2, float1);
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, &quot;texture2DProjLod&quot;, sampler2D, float3, float1);
</span><span class="lines">@@ -426,7 +317,7 @@
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureLod&quot;, gsamplerCube, float3, float1);
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureLod&quot;, gsampler2DArray, float3, float1);
</span><span class="cx"> 
</span><del>-    if (type == SH_FRAGMENT_SHADER)
</del><ins>+    if (type == GL_FRAGMENT_SHADER)
</ins><span class="cx">     {
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;texture&quot;, gsampler2D, float2, float1);
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;texture&quot;, gsampler3D, float3, float1);
</span><span class="lines">@@ -447,7 +338,7 @@
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;textureProj&quot;, sampler2DShadow, float4);
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;textureLod&quot;, sampler2DShadow, float3, float1);
</span><span class="cx"> 
</span><del>-    if (type == SH_FRAGMENT_SHADER)
</del><ins>+    if (type == GL_FRAGMENT_SHADER)
</ins><span class="cx">     {
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;texture&quot;, sampler2DShadow, float3, float1);
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;texture&quot;, samplerCubeShadow, float4, float1);
</span><span class="lines">@@ -462,22 +353,11 @@
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, &quot;textureSize&quot;, samplerCubeShadow, int1);
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, &quot;textureSize&quot;, sampler2DArrayShadow, int1);
</span><span class="cx"> 
</span><del>-    if(type == SH_FRAGMENT_SHADER)
</del><ins>+    if (type == GL_FRAGMENT_SHADER)
</ins><span class="cx">     {
</span><del>-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;dFdx&quot;, float1);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, &quot;dFdx&quot;, float2);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, &quot;dFdx&quot;, float3);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, &quot;dFdx&quot;, float4);
-            
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;dFdy&quot;, float1);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, &quot;dFdy&quot;, float2);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, &quot;dFdy&quot;, float3);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, &quot;dFdy&quot;, float4);
-
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;fwidth&quot;, float1);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float2, &quot;fwidth&quot;, float2);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float3, &quot;fwidth&quot;, float3);
-        symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, &quot;fwidth&quot;, float4);
</del><ins>+        symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdx, genType, &quot;dFdx&quot;, genType);
+        symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdy, genType, &quot;dFdy&quot;, genType);
+        symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFwidth, genType, &quot;fwidth&quot;, genType);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureOffset&quot;, gsampler2D, float2, int2);
</span><span class="lines">@@ -485,7 +365,7 @@
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;textureOffset&quot;, sampler2DShadow, float3, int2);
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureOffset&quot;, gsampler2DArray, float3, int2);
</span><span class="cx"> 
</span><del>-    if(type == SH_FRAGMENT_SHADER)
</del><ins>+    if (type == GL_FRAGMENT_SHADER)
</ins><span class="cx">     {
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureOffset&quot;, gsampler2D, float2, int2, float1);
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureOffset&quot;, gsampler3D, float3, int3, float1);
</span><span class="lines">@@ -498,7 +378,7 @@
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureProjOffset&quot;, gsampler3D, float4, int3);
</span><span class="cx">     symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, &quot;textureProjOffset&quot;, sampler2DShadow, float4, int2);
</span><span class="cx"> 
</span><del>-    if(type == SH_FRAGMENT_SHADER)
</del><ins>+    if (type == GL_FRAGMENT_SHADER)
</ins><span class="cx">     {
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureProjOffset&quot;, gsampler2D, float3, int2, float1);
</span><span class="cx">         symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, &quot;textureProjOffset&quot;, gsampler2D, float4, int2, float1);
</span><span class="lines">@@ -557,7 +437,7 @@
</span><span class="cx">     // Depth range in window coordinates
</span><span class="cx">     //
</span><span class="cx">     TFieldList *fields = NewPoolTFieldList();
</span><del>-    TSourceLoc zeroSourceLoc = {0};
</del><ins>+    TSourceLoc zeroSourceLoc = {0, 0, 0, 0};
</ins><span class="cx">     TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString(&quot;near&quot;), zeroSourceLoc);
</span><span class="cx">     TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString(&quot;far&quot;), zeroSourceLoc);
</span><span class="cx">     TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString(&quot;diff&quot;), zeroSourceLoc);
</span><span class="lines">@@ -566,10 +446,10 @@
</span><span class="cx">     fields-&gt;push_back(diff);
</span><span class="cx">     TStructure *depthRangeStruct = new TStructure(NewPoolTString(&quot;gl_DepthRangeParameters&quot;), fields);
</span><span class="cx">     TVariable *depthRangeParameters = new TVariable(&amp;depthRangeStruct-&gt;name(), depthRangeStruct, true);
</span><del>-    symbolTable.insert(COMMON_BUILTINS, *depthRangeParameters);
</del><ins>+    symbolTable.insert(COMMON_BUILTINS, depthRangeParameters);
</ins><span class="cx">     TVariable *depthRange = new TVariable(NewPoolTString(&quot;gl_DepthRange&quot;), TType(depthRangeStruct));
</span><span class="cx">     depthRange-&gt;setQualifier(EvqUniform);
</span><del>-    symbolTable.insert(COMMON_BUILTINS, *depthRange);
</del><ins>+    symbolTable.insert(COMMON_BUILTINS, depthRange);
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // Implementation dependent built-in constants.
</span><span class="lines">@@ -594,152 +474,90 @@
</span><span class="cx">     symbolTable.insertConstInt(ESSL3_BUILTINS, &quot;gl_MaxProgramTexelOffset&quot;, resources.MaxProgramTexelOffset);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
</del><ins>+void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
</ins><span class="cx">                       const ShBuiltInResources &amp;resources,
</span><span class="cx">                       TSymbolTable &amp;symbolTable)
</span><span class="cx"> {
</span><span class="cx">     //
</span><del>-    // First, insert some special built-in variables that are not in 
</del><ins>+    // Insert some special built-in variables that are not in
</ins><span class="cx">     // the built-in header files.
</span><span class="cx">     //
</span><del>-    switch(type) {
-    case SH_FRAGMENT_SHADER:
-        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_FragCoord&quot;), TType(EbtFloat, EbpMedium, EvqFragCoord,   4)));
-        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_FrontFacing&quot;), TType(EbtBool,  EbpUndefined, EvqFrontFacing, 1)));
-        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_PointCoord&quot;), TType(EbtFloat, EbpMedium, EvqPointCoord,  2)));
</del><ins>+    switch (type)
+    {
+      case GL_FRAGMENT_SHADER:
+        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString(&quot;gl_FragCoord&quot;),
+            TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
+        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString(&quot;gl_FrontFacing&quot;),
+            TType(EbtBool,  EbpUndefined, EvqFrontFacing, 1)));
+        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString(&quot;gl_PointCoord&quot;),
+            TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
</ins><span class="cx"> 
</span><span class="cx">         //
</span><span class="cx">         // In CSS Shaders, gl_FragColor, gl_FragData, and gl_MaxDrawBuffers are not available.
</span><span class="cx">         // Instead, css_MixColor and css_ColorMatrix are available.
</span><span class="cx">         //
</span><del>-        if (spec != SH_CSS_SHADERS_SPEC) {
-            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_FragColor&quot;), TType(EbtFloat, EbpMedium, EvqFragColor,   4)));
-            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_FragData[gl_MaxDrawBuffers]&quot;), TType(EbtFloat, EbpMedium, EvqFragData,    4)));
-            if (resources.EXT_frag_depth) {
-                symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_FragDepthEXT&quot;), TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
-                symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;gl_FragDepthEXT&quot;, &quot;GL_EXT_frag_depth&quot;);
</del><ins>+        if (spec != SH_CSS_SHADERS_SPEC)
+        {
+            symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString(&quot;gl_FragColor&quot;),
+                TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
+            TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
+            fragData.setArraySize(resources.MaxDrawBuffers);
+            symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString(&quot;gl_FragData&quot;), fragData));
+
+            if (resources.EXT_frag_depth)
+            {
+                symbolTable.insert(ESSL1_BUILTINS, &quot;GL_EXT_frag_depth&quot;, new TVariable(NewPoolTString(&quot;gl_FragDepthEXT&quot;),
+                    TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepth, 1)));
</ins><span class="cx">             }
</span><del>-        } else {
-            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString(&quot;css_MixColor&quot;), TType(EbtFloat, EbpMedium, EvqGlobal,      4)));
-            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString(&quot;css_ColorMatrix&quot;), TType(EbtFloat, EbpMedium, EvqGlobal,      4, 4)));
-        }
</del><span class="cx"> 
</span><del>-        break;
</del><ins>+            if (resources.EXT_shader_framebuffer_fetch || resources.NV_shader_framebuffer_fetch)
+            {
+                TType lastFragData(EbtFloat, EbpMedium, EvqLastFragData, 4, 1, true);
+                lastFragData.setArraySize(resources.MaxDrawBuffers);
</ins><span class="cx"> 
</span><del>-    case SH_VERTEX_SHADER:
-        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_Position&quot;), TType(EbtFloat, EbpHigh, EvqPosition,    4)));
-        symbolTable.insert(COMMON_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_PointSize&quot;), TType(EbtFloat, EbpMedium, EvqPointSize,   1)));
-        break;
-
-    default: assert(false &amp;&amp; &quot;Language not supported&quot;);
-    }
-
-    //
-    // Next, identify which built-ins from the already loaded headers have
-    // a mapping to an operator.  Those that are not identified as such are
-    // expected to be resolved through a library of functions, versus as
-    // operations.
-    //
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;matrixCompMult&quot;,   EOpMul);
-
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;equal&quot;,            EOpVectorEqual);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;notEqual&quot;,         EOpVectorNotEqual);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;lessThan&quot;,         EOpLessThan);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;greaterThan&quot;,      EOpGreaterThan);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;lessThanEqual&quot;,    EOpLessThanEqual);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;greaterThanEqual&quot;, EOpGreaterThanEqual);
-    
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;radians&quot;,      EOpRadians);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;degrees&quot;,      EOpDegrees);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;sin&quot;,          EOpSin);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;cos&quot;,          EOpCos);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;tan&quot;,          EOpTan);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;asin&quot;,         EOpAsin);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;acos&quot;,         EOpAcos);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;atan&quot;,         EOpAtan);
-
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;pow&quot;,          EOpPow);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;exp2&quot;,         EOpExp2);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;log&quot;,          EOpLog);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;exp&quot;,          EOpExp);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;log2&quot;,         EOpLog2);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;sqrt&quot;,         EOpSqrt);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;inversesqrt&quot;,  EOpInverseSqrt);
-
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;abs&quot;,          EOpAbs);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;sign&quot;,         EOpSign);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;floor&quot;,        EOpFloor);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;ceil&quot;,         EOpCeil);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;fract&quot;,        EOpFract);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;mod&quot;,          EOpMod);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;min&quot;,          EOpMin);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;max&quot;,          EOpMax);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;clamp&quot;,        EOpClamp);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;mix&quot;,          EOpMix);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;step&quot;,         EOpStep);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;smoothstep&quot;,   EOpSmoothStep);
-
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;length&quot;,       EOpLength);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;distance&quot;,     EOpDistance);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;dot&quot;,          EOpDot);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;cross&quot;,        EOpCross);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;normalize&quot;,    EOpNormalize);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;faceforward&quot;,  EOpFaceForward);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;reflect&quot;,      EOpReflect);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;refract&quot;,      EOpRefract);
-
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;any&quot;,          EOpAny);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;all&quot;,          EOpAll);
-    symbolTable.relateToOperator(COMMON_BUILTINS, &quot;not&quot;,          EOpVectorLogicalNot);
-
-    // Map language-specific operators.
-    switch(type) {
-    case SH_VERTEX_SHADER:
-        break;
-    case SH_FRAGMENT_SHADER:
-        if (resources.OES_standard_derivatives)
-        {
-            symbolTable.relateToOperator(ESSL1_BUILTINS, &quot;dFdx&quot;,   EOpDFdx);
-            symbolTable.relateToOperator(ESSL1_BUILTINS, &quot;dFdy&quot;,   EOpDFdy);
-            symbolTable.relateToOperator(ESSL1_BUILTINS, &quot;fwidth&quot;, EOpFwidth);
-
-            symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;dFdx&quot;, &quot;GL_OES_standard_derivatives&quot;);
-            symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;dFdy&quot;, &quot;GL_OES_standard_derivatives&quot;);
-            symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;fwidth&quot;, &quot;GL_OES_standard_derivatives&quot;);
</del><ins>+                if (resources.EXT_shader_framebuffer_fetch)
+                {
+                    symbolTable.insert(ESSL1_BUILTINS, &quot;GL_EXT_shader_framebuffer_fetch&quot;,
+                        new TVariable(NewPoolTString(&quot;gl_LastFragData&quot;), lastFragData));
+                }
+                else if (resources.NV_shader_framebuffer_fetch)
+                {
+                    symbolTable.insert(ESSL1_BUILTINS, &quot;GL_NV_shader_framebuffer_fetch&quot;,
+                        new TVariable(NewPoolTString(&quot;gl_LastFragColor&quot;),
+                        TType(EbtFloat, EbpMedium, EvqLastFragColor, 4)));
+                    symbolTable.insert(ESSL1_BUILTINS, &quot;GL_NV_shader_framebuffer_fetch&quot;,
+                        new TVariable(NewPoolTString(&quot;gl_LastFragData&quot;), lastFragData));
+                }
+            }
+            else if (resources.ARM_shader_framebuffer_fetch)
+            {
+                symbolTable.insert(ESSL1_BUILTINS, &quot;GL_ARM_shader_framebuffer_fetch&quot;,
+                    new TVariable(NewPoolTString(&quot;gl_LastFragColorARM&quot;),
+                    TType(EbtFloat, EbpMedium, EvqLastFragColor, 4)));
+            }
</ins><span class="cx">         }
</span><del>-        if (resources.EXT_shader_texture_lod)
</del><ins>+        else
</ins><span class="cx">         {
</span><del>-            symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;texture2DLodEXT&quot;, &quot;GL_EXT_shader_texture_lod&quot;);
-            symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;texture2DProjLodEXT&quot;, &quot;GL_EXT_shader_texture_lod&quot;);
-            symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;textureCubeLodEXT&quot;, &quot;GL_EXT_shader_texture_lod&quot;);
</del><ins>+            symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString(&quot;css_MixColor&quot;),
+                TType(EbtFloat, EbpMedium, EvqGlobal, 4)));
+            symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString(&quot;css_ColorMatrix&quot;),
+                TType(EbtFloat, EbpMedium, EvqGlobal, 4, 4)));
</ins><span class="cx">         }
</span><ins>+
</ins><span class="cx">         break;
</span><del>-    default: break;
-    }
</del><span class="cx"> 
</span><del>-    symbolTable.relateToOperator(ESSL3_BUILTINS, &quot;dFdx&quot;,   EOpDFdx);
-    symbolTable.relateToOperator(ESSL3_BUILTINS, &quot;dFdy&quot;,   EOpDFdy);
-    symbolTable.relateToOperator(ESSL3_BUILTINS, &quot;fwidth&quot;, EOpFwidth);
</del><ins>+      case GL_VERTEX_SHADER:
+        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString(&quot;gl_Position&quot;),
+            TType(EbtFloat, EbpHigh, EvqPosition, 4)));
+        symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString(&quot;gl_PointSize&quot;),
+            TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
+        symbolTable.insert(ESSL3_BUILTINS, new TVariable(NewPoolTString(&quot;gl_InstanceID&quot;),
+            TType(EbtInt, EbpHigh, EvqInstanceID, 1)));
+        break;
</ins><span class="cx"> 
</span><del>-    if (resources.EXT_shader_texture_lod)
-    {
-        symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;texture2DGradEXT&quot;, &quot;GL_EXT_shader_texture_lod&quot;);
-        symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;texture2DProjGradEXT&quot;, &quot;GL_EXT_shader_texture_lod&quot;);
-        symbolTable.relateToExtension(ESSL1_BUILTINS, &quot;textureCubeGradEXT&quot;, &quot;GL_EXT_shader_texture_lod&quot;);
</del><ins>+      default:
+        assert(false &amp;&amp; &quot;Language not supported&quot;);
</ins><span class="cx">     }
</span><del>-
-    // Finally add resource-specific variables.
-    switch(type) {
-    case SH_FRAGMENT_SHADER:
-        if (spec != SH_CSS_SHADERS_SPEC) {
-            // Set up gl_FragData.  The array size.
-            TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
-            fragData.setArraySize(resources.MaxDrawBuffers);
-            symbolTable.insert(ESSL1_BUILTINS, *new TVariable(NewPoolTString(&quot;gl_FragData&quot;), fragData));
-        }
-        break;
-    default: break;
-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InitExtensionBehavior(const ShBuiltInResources&amp; resources,
</span><span class="lines">@@ -757,4 +575,20 @@
</span><span class="cx">         extBehavior[&quot;GL_EXT_frag_depth&quot;] = EBhUndefined;
</span><span class="cx">     if (resources.EXT_shader_texture_lod)
</span><span class="cx">         extBehavior[&quot;GL_EXT_shader_texture_lod&quot;] = EBhUndefined;
</span><ins>+    if (resources.EXT_shader_framebuffer_fetch)
+        extBehavior[&quot;GL_EXT_shader_framebuffer_fetch&quot;] = EBhUndefined;
+    if (resources.NV_shader_framebuffer_fetch)
+        extBehavior[&quot;GL_NV_shader_framebuffer_fetch&quot;] = EBhUndefined;
+    if (resources.ARM_shader_framebuffer_fetch)
+        extBehavior[&quot;GL_ARM_shader_framebuffer_fetch&quot;] = EBhUndefined;
</ins><span class="cx"> }
</span><ins>+
+void ResetExtensionBehavior(TExtensionBehavior &amp;extBehavior)
+{
+    for (auto ext_iter = extBehavior.begin();
+         ext_iter != extBehavior.end();
+         ++ext_iter)
+    {
+        ext_iter-&gt;second = EBhUndefined;
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Initialize.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,20 +4,26 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _INITIALIZE_INCLUDED_
-#define _INITIALIZE_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_INITIALIZE_H_
+#define COMPILER_TRANSLATOR_INITIALIZE_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/Common.h&quot;
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
</del><ins>+#include &quot;compiler/translator/Compiler.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/SymbolTable.h&quot;
</span><span class="cx"> 
</span><del>-void InsertBuiltInFunctions(ShShaderType type, ShShaderSpec spec, const ShBuiltInResources &amp;resources, TSymbolTable &amp;table);
</del><ins>+void InsertBuiltInFunctions(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &amp;resources, TSymbolTable &amp;table);
</ins><span class="cx"> 
</span><del>-void IdentifyBuiltIns(ShShaderType type, ShShaderSpec spec,
</del><ins>+void IdentifyBuiltIns(sh::GLenum type, ShShaderSpec spec,
</ins><span class="cx">                       const ShBuiltInResources&amp; resources,
</span><span class="cx">                       TSymbolTable&amp; symbolTable);
</span><span class="cx"> 
</span><span class="cx"> void InitExtensionBehavior(const ShBuiltInResources&amp; resources,
</span><span class="cx">                            TExtensionBehavior&amp; extensionBehavior);
</span><span class="cx"> 
</span><del>-#endif // _INITIALIZE_INCLUDED_
</del><ins>+// Resets the behavior of the extensions listed in |extensionBehavior| to the
+// undefined state. These extensions will only be those initially supported in
+// the ShBuiltInResources object for this compiler instance. All other
+// extensions will remain unsupported.
+void ResetExtensionBehavior(TExtensionBehavior &amp;extensionBehavior);
+
+#endif // COMPILER_TRANSLATOR_INITIALIZE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeDllcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -5,11 +5,13 @@
</span><span class="cx"> //
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/InitializeDll.h&quot;
</span><del>-
</del><span class="cx"> #include &quot;compiler/translator/InitializeGlobals.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/InitializeParseContext.h&quot;
</span><del>-#include &quot;compiler/translator/osinclude.h&quot;
</del><span class="cx"> 
</span><ins>+#include &quot;common/platform.h&quot;
+
+#include &lt;assert.h&gt;
+
</ins><span class="cx"> bool InitProcess()
</span><span class="cx"> {
</span><span class="cx">     if (!InitializePoolIndex()) {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeDllh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeDll.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -3,11 +3,11 @@
</span><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><del>-#ifndef __INITIALIZEDLL_H
-#define __INITIALIZEDLL_H
</del><ins>+#ifndef COMPILER_TRANSLATOR_INITIALIZEDLL_H_
+#define COMPILER_TRANSLATOR_INITIALIZEDLL_H_
</ins><span class="cx"> 
</span><span class="cx"> bool InitProcess();
</span><span class="cx"> void DetachProcess();
</span><span class="cx"> 
</span><del>-#endif // __INITIALIZEDLL_H
</del><ins>+#endif // COMPILER_TRANSLATOR_INITIALIZEDLL_H_
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeGlobalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeGlobals.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeGlobals.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeGlobals.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef __INITIALIZE_GLOBALS_INCLUDED_
-#define __INITIALIZE_GLOBALS_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
+#define COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
</ins><span class="cx"> 
</span><span class="cx"> bool InitializePoolIndex();
</span><span class="cx"> void FreePoolIndex();
</span><span class="cx"> 
</span><del>-#endif // __INITIALIZE_GLOBALS_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_INITIALIZEGLOBALS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeParseContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,35 +6,37 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/InitializeParseContext.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/osinclude.h&quot;
</del><ins>+#include &quot;common/tls.h&quot;
</ins><span class="cx"> 
</span><del>-OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
</del><ins>+#include &lt;assert.h&gt;
</ins><span class="cx"> 
</span><ins>+TLSIndex GlobalParseContextIndex = TLS_INVALID_INDEX;
+
</ins><span class="cx"> bool InitializeParseContextIndex()
</span><span class="cx"> {
</span><del>-    assert(GlobalParseContextIndex == OS_INVALID_TLS_INDEX);
</del><ins>+    assert(GlobalParseContextIndex == TLS_INVALID_INDEX);
</ins><span class="cx"> 
</span><del>-    GlobalParseContextIndex = OS_AllocTLSIndex();
-    return GlobalParseContextIndex != OS_INVALID_TLS_INDEX;
</del><ins>+    GlobalParseContextIndex = CreateTLSIndex();
+    return GlobalParseContextIndex != TLS_INVALID_INDEX;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FreeParseContextIndex()
</span><span class="cx"> {
</span><del>-    assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
</del><ins>+    assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
</ins><span class="cx"> 
</span><del>-    OS_FreeTLSIndex(GlobalParseContextIndex);
-    GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
</del><ins>+    DestroyTLSIndex(GlobalParseContextIndex);
+    GlobalParseContextIndex = TLS_INVALID_INDEX;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SetGlobalParseContext(TParseContext* context)
</span><span class="cx"> {
</span><del>-    assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
-    OS_SetTLSValue(GlobalParseContextIndex, context);
</del><ins>+    assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
+    SetTLSValue(GlobalParseContextIndex, context);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TParseContext* GetGlobalParseContext()
</span><span class="cx"> {
</span><del>-    assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
-    return static_cast&lt;TParseContext*&gt;(OS_GetTLSValue(GlobalParseContextIndex));
</del><ins>+    assert(GlobalParseContextIndex != TLS_INVALID_INDEX);
+    return static_cast&lt;TParseContext*&gt;(GetTLSValue(GlobalParseContextIndex));
</ins><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeParseContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeParseContext.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef __INITIALIZE_PARSE_CONTEXT_INCLUDED_
-#define __INITIALIZE_PARSE_CONTEXT_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_INITIALIZEPARSECONTEXT_H_
+#define COMPILER_TRANSLATOR_INITIALIZEPARSECONTEXT_H_
</ins><span class="cx"> 
</span><span class="cx"> bool InitializeParseContextIndex();
</span><span class="cx"> void FreeParseContextIndex();
</span><span class="lines">@@ -14,4 +14,4 @@
</span><span class="cx"> extern void SetGlobalParseContext(TParseContext* context);
</span><span class="cx"> extern TParseContext* GetGlobalParseContext();
</span><span class="cx"> 
</span><del>-#endif // __INITIALIZE_PARSE_CONTEXT_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_INITIALIZEPARSECONTEXT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeVariablescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -5,18 +5,19 @@
</span><span class="cx"> //
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/InitializeVariables.h&quot;
</span><del>-#include &quot;compiler/translator/compilerdebug.h&quot;
</del><span class="cx"> 
</span><ins>+#include &quot;common/debug.h&quot;
+
</ins><span class="cx"> namespace
</span><span class="cx"> {
</span><span class="cx"> 
</span><del>-TIntermConstantUnion* constructFloatConstUnionNode(const TType&amp; type)
</del><ins>+TIntermConstantUnion *constructFloatConstUnionNode(const TType &amp;type)
</ins><span class="cx"> {
</span><span class="cx">     TType myType = type;
</span><del>-    unsigned char size = myType.getNominalSize();
</del><ins>+    unsigned char size = static_cast&lt;unsigned char&gt;(myType.getNominalSize());
</ins><span class="cx">     if (myType.isMatrix())
</span><span class="cx">         size *= size;
</span><del>-    ConstantUnion *u = new ConstantUnion[size];
</del><ins>+    TConstantUnion *u = new TConstantUnion[size];
</ins><span class="cx">     for (int ii = 0; ii &lt; size; ++ii)
</span><span class="cx">         u[ii].setFConst(0.0f);
</span><span class="cx"> 
</span><span class="lines">@@ -26,9 +27,9 @@
</span><span class="cx">     return node;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermConstantUnion* constructIndexNode(int index)
</del><ins>+TIntermConstantUnion *constructIndexNode(int index)
</ins><span class="cx"> {
</span><del>-    ConstantUnion *u = new ConstantUnion[1];
</del><ins>+    TConstantUnion *u = new TConstantUnion[1];
</ins><span class="cx">     u[0].setIConst(index);
</span><span class="cx"> 
</span><span class="cx">     TType type(EbtInt, EbpUndefined, EvqConst, 1);
</span><span class="lines">@@ -38,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx"> }  // namespace anonymous
</span><span class="cx"> 
</span><del>-bool InitializeVariables::visitAggregate(Visit visit, TIntermAggregate* node)
</del><ins>+bool InitializeVariables::visitAggregate(Visit visit, TIntermAggregate *node)
</ins><span class="cx"> {
</span><span class="cx">     bool visitChildren = !mCodeInserted;
</span><span class="cx">     switch (node-&gt;getOp())
</span><span class="lines">@@ -51,17 +52,17 @@
</span><span class="cx">         ASSERT(visit == PreVisit);
</span><span class="cx">         if (node-&gt;getName() == &quot;main(&quot;)
</span><span class="cx">         {
</span><del>-            TIntermSequence &amp;sequence = node-&gt;getSequence();
-            ASSERT((sequence.size() == 1) || (sequence.size() == 2));
</del><ins>+            TIntermSequence *sequence = node-&gt;getSequence();
+            ASSERT((sequence-&gt;size() == 1) || (sequence-&gt;size() == 2));
</ins><span class="cx">             TIntermAggregate *body = NULL;
</span><del>-            if (sequence.size() == 1)
</del><ins>+            if (sequence-&gt;size() == 1)
</ins><span class="cx">             {
</span><span class="cx">                 body = new TIntermAggregate(EOpSequence);
</span><del>-                sequence.push_back(body);
</del><ins>+                sequence-&gt;push_back(body);
</ins><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                body = sequence[1]-&gt;getAsAggregate();
</del><ins>+                body = (*sequence)[1]-&gt;getAsAggregate();
</ins><span class="cx">             }
</span><span class="cx">             ASSERT(body);
</span><span class="cx">             insertInitCode(body-&gt;getSequence());
</span><span class="lines">@@ -76,18 +77,18 @@
</span><span class="cx">     return visitChildren;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InitializeVariables::insertInitCode(TIntermSequence&amp; sequence)
</del><ins>+void InitializeVariables::insertInitCode(TIntermSequence *sequence)
</ins><span class="cx"> {
</span><span class="cx">     for (size_t ii = 0; ii &lt; mVariables.size(); ++ii)
</span><span class="cx">     {
</span><del>-        const InitVariableInfo&amp; varInfo = mVariables[ii];
</del><ins>+        const InitVariableInfo &amp;varInfo = mVariables[ii];
</ins><span class="cx"> 
</span><span class="cx">         if (varInfo.type.isArray())
</span><span class="cx">         {
</span><span class="cx">             for (int index = varInfo.type.getArraySize() - 1; index &gt;= 0; --index)
</span><span class="cx">             {
</span><span class="cx">                 TIntermBinary *assign = new TIntermBinary(EOpAssign);
</span><del>-                sequence.insert(sequence.begin(), assign);
</del><ins>+                sequence-&gt;insert(sequence-&gt;begin(), assign);
</ins><span class="cx"> 
</span><span class="cx">                 TIntermBinary *indexDirect = new TIntermBinary(EOpIndexDirect);
</span><span class="cx">                 TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
</span><span class="lines">@@ -104,7 +105,7 @@
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="cx">             TIntermBinary *assign = new TIntermBinary(EOpAssign);
</span><del>-            sequence.insert(sequence.begin(), assign);
</del><ins>+            sequence-&gt;insert(sequence-&gt;begin(), assign);
</ins><span class="cx">             TIntermSymbol *symbol = new TIntermSymbol(0, varInfo.name, varInfo.type);
</span><span class="cx">             assign-&gt;setLeft(symbol);
</span><span class="cx">             TIntermConstantUnion *zeroConst = constructFloatConstUnionNode(varInfo.type);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorInitializeVariablesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/InitializeVariables.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_INITIALIZE_VARIABLES_H_
-#define COMPILER_INITIALIZE_VARIABLES_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_
+#define COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> class InitializeVariables : public TIntermTraverser
</span><span class="cx"> {
</span><span class="lines">@@ -17,7 +17,7 @@
</span><span class="cx">         TString name;
</span><span class="cx">         TType type;
</span><span class="cx"> 
</span><del>-        InitVariableInfo(const TString&amp; _name, const TType&amp; _type)
</del><ins>+        InitVariableInfo(const TString &amp;_name, const TType &amp;_type)
</ins><span class="cx">             : name(_name),
</span><span class="cx">               type(_type)
</span><span class="cx">         {
</span><span class="lines">@@ -25,26 +25,26 @@
</span><span class="cx">     };
</span><span class="cx">     typedef TVector&lt;InitVariableInfo&gt; InitVariableInfoList;
</span><span class="cx"> 
</span><del>-    InitializeVariables(const InitVariableInfoList&amp; vars)
</del><ins>+    InitializeVariables(const InitVariableInfoList &amp;vars)
</ins><span class="cx">         : mCodeInserted(false),
</span><span class="cx">           mVariables(vars)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   protected:
</span><del>-    virtual bool visitBinary(Visit visit, TIntermBinary* node) { return false; }
-    virtual bool visitUnary(Visit visit, TIntermUnary* node) { return false; }
-    virtual bool visitSelection(Visit visit, TIntermSelection* node) { return false; }
-    virtual bool visitLoop(Visit visit, TIntermLoop* node) { return false; }
-    virtual bool visitBranch(Visit visit, TIntermBranch* node) { return false; }
</del><ins>+    virtual bool visitBinary(Visit, TIntermBinary *node) { return false; }
+    virtual bool visitUnary(Visit, TIntermUnary *node) { return false; }
+    virtual bool visitSelection(Visit, TIntermSelection *node) { return false; }
+    virtual bool visitLoop(Visit, TIntermLoop *node) { return false; }
+    virtual bool visitBranch(Visit, TIntermBranch *node) { return false; }
</ins><span class="cx"> 
</span><span class="cx">     virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
</span><span class="cx"> 
</span><span class="cx">   private:
</span><del>-    void insertInitCode(TIntermSequence&amp; sequence);
</del><ins>+    void insertInitCode(TIntermSequence *sequence);
</ins><span class="cx"> 
</span><span class="cx">     InitVariableInfoList mVariables;
</span><span class="cx">     bool mCodeInserted;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_INITIALIZE_VARIABLES_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorIntermNodecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1523 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+//
+// Build the intermediate representation.
+//
+
+#include &lt;float.h&gt;
+#include &lt;limits.h&gt;
+#include &lt;math.h&gt;
+#include &lt;stdlib.h&gt;
+#include &lt;algorithm&gt;
+
+#include &quot;compiler/translator/HashNames.h&quot;
+#include &quot;compiler/translator/IntermNode.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
+
+namespace
+{
+
+const float kPi = 3.14159265358979323846f;
+const float kDegreesToRadiansMultiplier = kPi / 180.0f;
+const float kRadiansToDegreesMultiplier = 180.0f / kPi;
+
+TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
+{
+    return left &gt; right ? left : right;
+}
+
+bool ValidateMultiplication(TOperator op, const TType &amp;left, const TType &amp;right)
+{
+    switch (op)
+    {
+      case EOpMul:
+      case EOpMulAssign:
+        return left.getNominalSize() == right.getNominalSize() &amp;&amp;
+               left.getSecondarySize() == right.getSecondarySize();
+      case EOpVectorTimesScalar:
+      case EOpVectorTimesScalarAssign:
+        return true;
+      case EOpVectorTimesMatrix:
+        return left.getNominalSize() == right.getRows();
+      case EOpVectorTimesMatrixAssign:
+        return left.getNominalSize() == right.getRows() &amp;&amp;
+               left.getNominalSize() == right.getCols();
+      case EOpMatrixTimesVector:
+        return left.getCols() == right.getNominalSize();
+      case EOpMatrixTimesScalar:
+      case EOpMatrixTimesScalarAssign:
+        return true;
+      case EOpMatrixTimesMatrix:
+        return left.getCols() == right.getRows();
+      case EOpMatrixTimesMatrixAssign:
+        return left.getCols() == right.getCols() &amp;&amp;
+               left.getRows() == right.getRows();
+
+      default:
+        UNREACHABLE();
+        return false;
+    }
+}
+
+bool CompareStructure(const TType&amp; leftNodeType,
+                      const TConstantUnion *rightUnionArray,
+                      const TConstantUnion *leftUnionArray);
+
+bool CompareStruct(const TType &amp;leftNodeType,
+                   const TConstantUnion *rightUnionArray,
+                   const TConstantUnion *leftUnionArray)
+{
+    const TFieldList &amp;fields = leftNodeType.getStruct()-&gt;fields();
+
+    size_t structSize = fields.size();
+    size_t index = 0;
+
+    for (size_t j = 0; j &lt; structSize; j++)
+    {
+        size_t size = fields[j]-&gt;type()-&gt;getObjectSize();
+        for (size_t i = 0; i &lt; size; i++)
+        {
+            if (fields[j]-&gt;type()-&gt;getBasicType() == EbtStruct)
+            {
+                if (!CompareStructure(*fields[j]-&gt;type(),
+                                      &amp;rightUnionArray[index],
+                                      &amp;leftUnionArray[index]))
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                if (leftUnionArray[index] != rightUnionArray[index])
+                    return false;
+                index++;
+            }
+        }
+    }
+    return true;
+}
+
+bool CompareStructure(const TType &amp;leftNodeType,
+                      const TConstantUnion *rightUnionArray,
+                      const TConstantUnion *leftUnionArray)
+{
+    if (leftNodeType.isArray())
+    {
+        TType typeWithoutArrayness = leftNodeType;
+        typeWithoutArrayness.clearArrayness();
+
+        size_t arraySize = leftNodeType.getArraySize();
+
+        for (size_t i = 0; i &lt; arraySize; ++i)
+        {
+            size_t offset = typeWithoutArrayness.getObjectSize() * i;
+            if (!CompareStruct(typeWithoutArrayness,
+                               &amp;rightUnionArray[offset],
+                               &amp;leftUnionArray[offset]))
+            {
+                return false;
+            }
+        }
+    }
+    else
+    {
+        return CompareStruct(leftNodeType, rightUnionArray, leftUnionArray);
+    }
+    return true;
+}
+
+}  // namespace anonymous
+
+
+////////////////////////////////////////////////////////////////
+//
+// Member functions of the nodes used for building the tree.
+//
+////////////////////////////////////////////////////////////////
+
+void TIntermTyped::setTypePreservePrecision(const TType &amp;t)
+{
+    TPrecision precision = getPrecision();
+    mType = t;
+    ASSERT(mType.getBasicType() != EbtBool || precision == EbpUndefined);
+    mType.setPrecision(precision);
+}
+
+#define REPLACE_IF_IS(node, type, original, replacement) \
+    if (node == original) { \
+        node = static_cast&lt;type *&gt;(replacement); \
+        return true; \
+    }
+
+bool TIntermLoop::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    REPLACE_IF_IS(mInit, TIntermNode, original, replacement);
+    REPLACE_IF_IS(mCond, TIntermTyped, original, replacement);
+    REPLACE_IF_IS(mExpr, TIntermTyped, original, replacement);
+    REPLACE_IF_IS(mBody, TIntermNode, original, replacement);
+    return false;
+}
+
+bool TIntermBranch::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    REPLACE_IF_IS(mExpression, TIntermTyped, original, replacement);
+    return false;
+}
+
+bool TIntermBinary::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    REPLACE_IF_IS(mLeft, TIntermTyped, original, replacement);
+    REPLACE_IF_IS(mRight, TIntermTyped, original, replacement);
+    return false;
+}
+
+bool TIntermUnary::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    REPLACE_IF_IS(mOperand, TIntermTyped, original, replacement);
+    return false;
+}
+
+bool TIntermAggregate::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    for (size_t ii = 0; ii &lt; mSequence.size(); ++ii)
+    {
+        REPLACE_IF_IS(mSequence[ii], TIntermNode, original, replacement);
+    }
+    return false;
+}
+
+bool TIntermAggregate::replaceChildNodeWithMultiple(TIntermNode *original, TIntermSequence replacements)
+{
+    for (auto it = mSequence.begin(); it &lt; mSequence.end(); ++it)
+    {
+        if (*it == original)
+        {
+            it = mSequence.erase(it);
+            mSequence.insert(it, replacements.begin(), replacements.end());
+            return true;
+        }
+    }
+    return false;
+}
+
+void TIntermAggregate::setPrecisionFromChildren()
+{
+    if (getBasicType() == EbtBool)
+    {
+        mType.setPrecision(EbpUndefined);
+        return;
+    }
+
+    TPrecision precision = EbpUndefined;
+    TIntermSequence::iterator childIter = mSequence.begin();
+    while (childIter != mSequence.end())
+    {
+        TIntermTyped *typed = (*childIter)-&gt;getAsTyped();
+        if (typed)
+            precision = GetHigherPrecision(typed-&gt;getPrecision(), precision);
+        ++childIter;
+    }
+    mType.setPrecision(precision);
+}
+
+void TIntermAggregate::setBuiltInFunctionPrecision()
+{
+    // All built-ins returning bool should be handled as ops, not functions.
+    ASSERT(getBasicType() != EbtBool);
+
+    TPrecision precision = EbpUndefined;
+    TIntermSequence::iterator childIter = mSequence.begin();
+    while (childIter != mSequence.end())
+    {
+        TIntermTyped *typed = (*childIter)-&gt;getAsTyped();
+        // ESSL spec section 8: texture functions get their precision from the sampler.
+        if (typed &amp;&amp; IsSampler(typed-&gt;getBasicType()))
+        {
+            precision = typed-&gt;getPrecision();
+            break;
+        }
+        ++childIter;
+    }
+    // ESSL 3.0 spec section 8: textureSize always gets highp precision.
+    // All other functions that take a sampler are assumed to be texture functions.
+    if (mName.find(&quot;textureSize&quot;) == 0)
+        mType.setPrecision(EbpHigh);
+    else
+        mType.setPrecision(precision);
+}
+
+bool TIntermSelection::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
+    REPLACE_IF_IS(mTrueBlock, TIntermNode, original, replacement);
+    REPLACE_IF_IS(mFalseBlock, TIntermNode, original, replacement);
+    return false;
+}
+
+bool TIntermSwitch::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    REPLACE_IF_IS(mInit, TIntermTyped, original, replacement);
+    REPLACE_IF_IS(mStatementList, TIntermAggregate, original, replacement);
+    return false;
+}
+
+bool TIntermCase::replaceChildNode(
+    TIntermNode *original, TIntermNode *replacement)
+{
+    REPLACE_IF_IS(mCondition, TIntermTyped, original, replacement);
+    return false;
+}
+
+//
+// Say whether or not an operation node changes the value of a variable.
+//
+bool TIntermOperator::isAssignment() const
+{
+    switch (mOp)
+    {
+      case EOpPostIncrement:
+      case EOpPostDecrement:
+      case EOpPreIncrement:
+      case EOpPreDecrement:
+      case EOpAssign:
+      case EOpAddAssign:
+      case EOpSubAssign:
+      case EOpMulAssign:
+      case EOpVectorTimesMatrixAssign:
+      case EOpVectorTimesScalarAssign:
+      case EOpMatrixTimesScalarAssign:
+      case EOpMatrixTimesMatrixAssign:
+      case EOpDivAssign:
+      case EOpIModAssign:
+      case EOpBitShiftLeftAssign:
+      case EOpBitShiftRightAssign:
+      case EOpBitwiseAndAssign:
+      case EOpBitwiseXorAssign:
+      case EOpBitwiseOrAssign:
+        return true;
+      default:
+        return false;
+    }
+}
+
+//
+// returns true if the operator is for one of the constructors
+//
+bool TIntermOperator::isConstructor() const
+{
+    switch (mOp)
+    {
+      case EOpConstructVec2:
+      case EOpConstructVec3:
+      case EOpConstructVec4:
+      case EOpConstructMat2:
+      case EOpConstructMat3:
+      case EOpConstructMat4:
+      case EOpConstructFloat:
+      case EOpConstructIVec2:
+      case EOpConstructIVec3:
+      case EOpConstructIVec4:
+      case EOpConstructInt:
+      case EOpConstructUVec2:
+      case EOpConstructUVec3:
+      case EOpConstructUVec4:
+      case EOpConstructUInt:
+      case EOpConstructBVec2:
+      case EOpConstructBVec3:
+      case EOpConstructBVec4:
+      case EOpConstructBool:
+      case EOpConstructStruct:
+        return true;
+      default:
+        return false;
+    }
+}
+
+//
+// Make sure the type of a unary operator is appropriate for its
+// combination of operation and operand type.
+//
+void TIntermUnary::promote(const TType *funcReturnType)
+{
+    switch (mOp)
+    {
+      case EOpFloatBitsToInt:
+      case EOpFloatBitsToUint:
+      case EOpIntBitsToFloat:
+      case EOpUintBitsToFloat:
+      case EOpPackSnorm2x16:
+      case EOpPackUnorm2x16:
+      case EOpPackHalf2x16:
+      case EOpUnpackSnorm2x16:
+      case EOpUnpackUnorm2x16:
+        mType.setPrecision(EbpHigh);
+        break;
+      case EOpUnpackHalf2x16:
+        mType.setPrecision(EbpMedium);
+        break;
+      default:
+        setType(mOperand-&gt;getType());
+    }
+
+    if (funcReturnType != nullptr)
+    {
+        if (funcReturnType-&gt;getBasicType() == EbtBool)
+        {
+            // Bool types should not have precision.
+            setType(*funcReturnType);
+        }
+        else
+        {
+            // Precision of the node has been set based on the operand.
+            setTypePreservePrecision(*funcReturnType);
+        }
+    }
+
+    mType.setQualifier(EvqTemporary);
+}
+
+//
+// Establishes the type of the resultant operation, as well as
+// makes the operator the correct one for the operands.
+//
+// For lots of operations it should already be established that the operand
+// combination is valid, but returns false if operator can't work on operands.
+//
+bool TIntermBinary::promote(TInfoSink &amp;infoSink)
+{
+    ASSERT(mLeft-&gt;isArray() == mRight-&gt;isArray());
+
+    //
+    // Base assumption:  just make the type the same as the left
+    // operand.  Then only deviations from this need be coded.
+    //
+    setType(mLeft-&gt;getType());
+
+    // The result gets promoted to the highest precision.
+    TPrecision higherPrecision = GetHigherPrecision(
+        mLeft-&gt;getPrecision(), mRight-&gt;getPrecision());
+    getTypePointer()-&gt;setPrecision(higherPrecision);
+
+    // Binary operations results in temporary variables unless both
+    // operands are const.
+    if (mLeft-&gt;getQualifier() != EvqConst || mRight-&gt;getQualifier() != EvqConst)
+    {
+        getTypePointer()-&gt;setQualifier(EvqTemporary);
+    }
+
+    const int nominalSize =
+        std::max(mLeft-&gt;getNominalSize(), mRight-&gt;getNominalSize());
+
+    //
+    // All scalars or structs. Code after this test assumes this case is removed!
+    //
+    if (nominalSize == 1)
+    {
+        switch (mOp)
+        {
+          //
+          // Promote to conditional
+          //
+          case EOpEqual:
+          case EOpNotEqual:
+          case EOpLessThan:
+          case EOpGreaterThan:
+          case EOpLessThanEqual:
+          case EOpGreaterThanEqual:
+            setType(TType(EbtBool, EbpUndefined));
+            break;
+
+          //
+          // And and Or operate on conditionals
+          //
+          case EOpLogicalAnd:
+          case EOpLogicalXor:
+          case EOpLogicalOr:
+            ASSERT(mLeft-&gt;getBasicType() == EbtBool &amp;&amp; mRight-&gt;getBasicType() == EbtBool);
+            setType(TType(EbtBool, EbpUndefined));
+            break;
+
+          default:
+            break;
+        }
+        return true;
+    }
+
+    // If we reach here, at least one of the operands is vector or matrix.
+    // The other operand could be a scalar, vector, or matrix.
+    // Can these two operands be combined?
+    //
+    TBasicType basicType = mLeft-&gt;getBasicType();
+    switch (mOp)
+    {
+      case EOpMul:
+        if (!mLeft-&gt;isMatrix() &amp;&amp; mRight-&gt;isMatrix())
+        {
+            if (mLeft-&gt;isVector())
+            {
+                mOp = EOpVectorTimesMatrix;
+                setType(TType(basicType, higherPrecision, EvqTemporary,
+                              static_cast&lt;unsigned char&gt;(mRight-&gt;getCols()), 1));
+            }
+            else
+            {
+                mOp = EOpMatrixTimesScalar;
+                setType(TType(basicType, higherPrecision, EvqTemporary,
+                              static_cast&lt;unsigned char&gt;(mRight-&gt;getCols()), static_cast&lt;unsigned char&gt;(mRight-&gt;getRows())));
+            }
+        }
+        else if (mLeft-&gt;isMatrix() &amp;&amp; !mRight-&gt;isMatrix())
+        {
+            if (mRight-&gt;isVector())
+            {
+                mOp = EOpMatrixTimesVector;
+                setType(TType(basicType, higherPrecision, EvqTemporary,
+                              static_cast&lt;unsigned char&gt;(mLeft-&gt;getRows()), 1));
+            }
+            else
+            {
+                mOp = EOpMatrixTimesScalar;
+            }
+        }
+        else if (mLeft-&gt;isMatrix() &amp;&amp; mRight-&gt;isMatrix())
+        {
+            mOp = EOpMatrixTimesMatrix;
+            setType(TType(basicType, higherPrecision, EvqTemporary,
+                          static_cast&lt;unsigned char&gt;(mRight-&gt;getCols()), static_cast&lt;unsigned char&gt;(mLeft-&gt;getRows())));
+        }
+        else if (!mLeft-&gt;isMatrix() &amp;&amp; !mRight-&gt;isMatrix())
+        {
+            if (mLeft-&gt;isVector() &amp;&amp; mRight-&gt;isVector())
+            {
+                // leave as component product
+            }
+            else if (mLeft-&gt;isVector() || mRight-&gt;isVector())
+            {
+                mOp = EOpVectorTimesScalar;
+                setType(TType(basicType, higherPrecision, EvqTemporary,
+                              static_cast&lt;unsigned char&gt;(nominalSize), 1));
+            }
+        }
+        else
+        {
+            infoSink.info.message(EPrefixInternalError, getLine(),
+                                  &quot;Missing elses&quot;);
+            return false;
+        }
+
+        if (!ValidateMultiplication(mOp, mLeft-&gt;getType(), mRight-&gt;getType()))
+        {
+            return false;
+        }
+        break;
+
+      case EOpMulAssign:
+        if (!mLeft-&gt;isMatrix() &amp;&amp; mRight-&gt;isMatrix())
+        {
+            if (mLeft-&gt;isVector())
+            {
+                mOp = EOpVectorTimesMatrixAssign;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        else if (mLeft-&gt;isMatrix() &amp;&amp; !mRight-&gt;isMatrix())
+        {
+            if (mRight-&gt;isVector())
+            {
+                return false;
+            }
+            else
+            {
+                mOp = EOpMatrixTimesScalarAssign;
+            }
+        }
+        else if (mLeft-&gt;isMatrix() &amp;&amp; mRight-&gt;isMatrix())
+        {
+            mOp = EOpMatrixTimesMatrixAssign;
+            setType(TType(basicType, higherPrecision, EvqTemporary,
+                          static_cast&lt;unsigned char&gt;(mRight-&gt;getCols()), static_cast&lt;unsigned char&gt;(mLeft-&gt;getRows())));
+        }
+        else if (!mLeft-&gt;isMatrix() &amp;&amp; !mRight-&gt;isMatrix())
+        {
+            if (mLeft-&gt;isVector() &amp;&amp; mRight-&gt;isVector())
+            {
+                // leave as component product
+            }
+            else if (mLeft-&gt;isVector() || mRight-&gt;isVector())
+            {
+                if (!mLeft-&gt;isVector())
+                    return false;
+                mOp = EOpVectorTimesScalarAssign;
+                setType(TType(basicType, higherPrecision, EvqTemporary,
+                              static_cast&lt;unsigned char&gt;(mLeft-&gt;getNominalSize()), 1));
+            }
+        }
+        else
+        {
+            infoSink.info.message(EPrefixInternalError, getLine(),
+                                  &quot;Missing elses&quot;);
+            return false;
+        }
+
+        if (!ValidateMultiplication(mOp, mLeft-&gt;getType(), mRight-&gt;getType()))
+        {
+            return false;
+        }
+        break;
+
+      case EOpAssign:
+      case EOpInitialize:
+        // No more additional checks are needed.
+        ASSERT((mLeft-&gt;getNominalSize() == mRight-&gt;getNominalSize()) &amp;&amp;
+            (mLeft-&gt;getSecondarySize() == mRight-&gt;getSecondarySize()));
+        break;
+      case EOpAdd:
+      case EOpSub:
+      case EOpDiv:
+      case EOpIMod:
+      case EOpBitShiftLeft:
+      case EOpBitShiftRight:
+      case EOpBitwiseAnd:
+      case EOpBitwiseXor:
+      case EOpBitwiseOr:
+      case EOpAddAssign:
+      case EOpSubAssign:
+      case EOpDivAssign:
+      case EOpIModAssign:
+      case EOpBitShiftLeftAssign:
+      case EOpBitShiftRightAssign:
+      case EOpBitwiseAndAssign:
+      case EOpBitwiseXorAssign:
+      case EOpBitwiseOrAssign:
+        if ((mLeft-&gt;isMatrix() &amp;&amp; mRight-&gt;isVector()) ||
+            (mLeft-&gt;isVector() &amp;&amp; mRight-&gt;isMatrix()))
+        {
+            return false;
+        }
+
+        // Are the sizes compatible?
+        if (mLeft-&gt;getNominalSize() != mRight-&gt;getNominalSize() ||
+            mLeft-&gt;getSecondarySize() != mRight-&gt;getSecondarySize())
+        {
+            // If the nominal sizes of operands do not match:
+            // One of them must be a scalar.
+            if (!mLeft-&gt;isScalar() &amp;&amp; !mRight-&gt;isScalar())
+                return false;
+
+            // In the case of compound assignment other than multiply-assign,
+            // the right side needs to be a scalar. Otherwise a vector/matrix
+            // would be assigned to a scalar. A scalar can't be shifted by a
+            // vector either.
+            if (!mRight-&gt;isScalar() &amp;&amp;
+                (isAssignment() ||
+                mOp == EOpBitShiftLeft ||
+                mOp == EOpBitShiftRight))
+                return false;
+        }
+
+        {
+            const int secondarySize = std::max(
+                mLeft-&gt;getSecondarySize(), mRight-&gt;getSecondarySize());
+            setType(TType(basicType, higherPrecision, EvqTemporary,
+                          static_cast&lt;unsigned char&gt;(nominalSize), static_cast&lt;unsigned char&gt;(secondarySize)));
+            if (mLeft-&gt;isArray())
+            {
+                ASSERT(mLeft-&gt;getArraySize() == mRight-&gt;getArraySize());
+                mType.setArraySize(mLeft-&gt;getArraySize());
+            }
+        }
+        break;
+
+      case EOpEqual:
+      case EOpNotEqual:
+      case EOpLessThan:
+      case EOpGreaterThan:
+      case EOpLessThanEqual:
+      case EOpGreaterThanEqual:
+        ASSERT((mLeft-&gt;getNominalSize() == mRight-&gt;getNominalSize()) &amp;&amp;
+            (mLeft-&gt;getSecondarySize() == mRight-&gt;getSecondarySize()));
+        setType(TType(EbtBool, EbpUndefined));
+        break;
+
+      default:
+        return false;
+    }
+    return true;
+}
+
+//
+// The fold functions see if an operation on a constant can be done in place,
+// without generating run-time code.
+//
+// Returns the node to keep using, which may or may not be the node passed in.
+//
+TIntermTyped *TIntermConstantUnion::fold(
+    TOperator op, TIntermConstantUnion *rightNode, TInfoSink &amp;infoSink)
+{
+    TConstantUnion *unionArray = getUnionArrayPointer();
+
+    if (!unionArray)
+        return nullptr;
+
+    size_t objectSize = getType().getObjectSize();
+
+    if (rightNode)
+    {
+        // binary operations
+        TConstantUnion *rightUnionArray = rightNode-&gt;getUnionArrayPointer();
+        TType returnType = getType();
+
+        if (!rightUnionArray)
+            return nullptr;
+
+        // for a case like float f = vec4(2, 3, 4, 5) + 1.2;
+        if (rightNode-&gt;getType().getObjectSize() == 1 &amp;&amp; objectSize &gt; 1)
+        {
+            rightUnionArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; ++i)
+            {
+                rightUnionArray[i] = *rightNode-&gt;getUnionArrayPointer();
+            }
+            returnType = getType();
+        }
+        else if (rightNode-&gt;getType().getObjectSize() &gt; 1 &amp;&amp; objectSize == 1)
+        {
+            // for a case like float f = 1.2 + vec4(2, 3, 4, 5);
+            unionArray = new TConstantUnion[rightNode-&gt;getType().getObjectSize()];
+            for (size_t i = 0; i &lt; rightNode-&gt;getType().getObjectSize(); ++i)
+            {
+                unionArray[i] = *getUnionArrayPointer();
+            }
+            returnType = rightNode-&gt;getType();
+            objectSize = rightNode-&gt;getType().getObjectSize();
+        }
+
+        TConstantUnion *tempConstArray = nullptr;
+        TIntermConstantUnion *tempNode;
+
+        bool boolNodeFlag = false;
+        switch(op)
+        {
+          case EOpAdd:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] + rightUnionArray[i];
+            break;
+          case EOpSub:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] - rightUnionArray[i];
+            break;
+
+          case EOpMul:
+          case EOpVectorTimesScalar:
+          case EOpMatrixTimesScalar:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] * rightUnionArray[i];
+            break;
+
+          case EOpMatrixTimesMatrix:
+            {
+                if (getType().getBasicType() != EbtFloat ||
+                    rightNode-&gt;getBasicType() != EbtFloat)
+                {
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Constant Folding cannot be done for matrix multiply&quot;);
+                    return nullptr;
+                }
+
+                const int leftCols = getCols();
+                const int leftRows = getRows();
+                const int rightCols = rightNode-&gt;getType().getCols();
+                const int rightRows = rightNode-&gt;getType().getRows();
+                const int resultCols = rightCols;
+                const int resultRows = leftRows;
+
+                tempConstArray = new TConstantUnion[resultCols * resultRows];
+                for (int row = 0; row &lt; resultRows; row++)
+                {
+                    for (int column = 0; column &lt; resultCols; column++)
+                    {
+                        tempConstArray[resultRows * column + row].setFConst(0.0f);
+                        for (int i = 0; i &lt; leftCols; i++)
+                        {
+                            tempConstArray[resultRows * column + row].setFConst(
+                                tempConstArray[resultRows * column + row].getFConst() +
+                                unionArray[i * leftRows + row].getFConst() *
+                                rightUnionArray[column * rightRows + i].getFConst());
+                        }
+                    }
+                }
+
+                // update return type for matrix product
+                returnType.setPrimarySize(static_cast&lt;unsigned char&gt;(resultCols));
+                returnType.setSecondarySize(static_cast&lt;unsigned char&gt;(resultRows));
+            }
+            break;
+
+          case EOpDiv:
+          case EOpIMod:
+            {
+                tempConstArray = new TConstantUnion[objectSize];
+                for (size_t i = 0; i &lt; objectSize; i++)
+                {
+                    switch (getType().getBasicType())
+                    {
+                      case EbtFloat:
+                        if (rightUnionArray[i] == 0.0f)
+                        {
+                            infoSink.info.message(
+                                EPrefixWarning, getLine(),
+                                &quot;Divide by zero error during constant folding&quot;);
+                            tempConstArray[i].setFConst(
+                                unionArray[i].getFConst() &lt; 0 ? -FLT_MAX : FLT_MAX);
+                        }
+                        else
+                        {
+                            ASSERT(op == EOpDiv);
+                            tempConstArray[i].setFConst(
+                                unionArray[i].getFConst() /
+                                rightUnionArray[i].getFConst());
+                        }
+                        break;
+
+                      case EbtInt:
+                        if (rightUnionArray[i] == 0)
+                        {
+                            infoSink.info.message(
+                                EPrefixWarning, getLine(),
+                                &quot;Divide by zero error during constant folding&quot;);
+                            tempConstArray[i].setIConst(INT_MAX);
+                        }
+                        else
+                        {
+                            if (op == EOpDiv)
+                            {
+                                tempConstArray[i].setIConst(
+                                    unionArray[i].getIConst() /
+                                    rightUnionArray[i].getIConst());
+                            }
+                            else
+                            {
+                                ASSERT(op == EOpIMod);
+                                tempConstArray[i].setIConst(
+                                    unionArray[i].getIConst() %
+                                    rightUnionArray[i].getIConst());
+                            }
+                        }
+                        break;
+
+                      case EbtUInt:
+                        if (rightUnionArray[i] == 0)
+                        {
+                            infoSink.info.message(
+                                EPrefixWarning, getLine(),
+                                &quot;Divide by zero error during constant folding&quot;);
+                            tempConstArray[i].setUConst(UINT_MAX);
+                        }
+                        else
+                        {
+                            if (op == EOpDiv)
+                            {
+                                tempConstArray[i].setUConst(
+                                    unionArray[i].getUConst() /
+                                    rightUnionArray[i].getUConst());
+                            }
+                            else
+                            {
+                                ASSERT(op == EOpIMod);
+                                tempConstArray[i].setUConst(
+                                    unionArray[i].getUConst() %
+                                    rightUnionArray[i].getUConst());
+                            }
+                        }
+                        break;
+
+                      default:
+                        infoSink.info.message(
+                            EPrefixInternalError, getLine(),
+                            &quot;Constant folding cannot be done for \&quot;/\&quot;&quot;);
+                        return nullptr;
+                    }
+                }
+            }
+            break;
+
+          case EOpMatrixTimesVector:
+            {
+                if (rightNode-&gt;getBasicType() != EbtFloat)
+                {
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Constant Folding cannot be done for matrix times vector&quot;);
+                    return nullptr;
+                }
+
+                const int matrixCols = getCols();
+                const int matrixRows = getRows();
+
+                tempConstArray = new TConstantUnion[matrixRows];
+
+                for (int matrixRow = 0; matrixRow &lt; matrixRows; matrixRow++)
+                {
+                    tempConstArray[matrixRow].setFConst(0.0f);
+                    for (int col = 0; col &lt; matrixCols; col++)
+                    {
+                        tempConstArray[matrixRow].setFConst(
+                            tempConstArray[matrixRow].getFConst() +
+                            unionArray[col * matrixRows + matrixRow].getFConst() *
+                            rightUnionArray[col].getFConst());
+                    }
+                }
+
+                returnType = rightNode-&gt;getType();
+                returnType.setPrimarySize(static_cast&lt;unsigned char&gt;(matrixRows));
+
+                tempNode = new TIntermConstantUnion(tempConstArray, returnType);
+                tempNode-&gt;setLine(getLine());
+
+                return tempNode;
+            }
+
+          case EOpVectorTimesMatrix:
+            {
+                if (getType().getBasicType() != EbtFloat)
+                {
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Constant Folding cannot be done for vector times matrix&quot;);
+                    return nullptr;
+                }
+
+                const int matrixCols = rightNode-&gt;getType().getCols();
+                const int matrixRows = rightNode-&gt;getType().getRows();
+
+                tempConstArray = new TConstantUnion[matrixCols];
+
+                for (int matrixCol = 0; matrixCol &lt; matrixCols; matrixCol++)
+                {
+                    tempConstArray[matrixCol].setFConst(0.0f);
+                    for (int matrixRow = 0; matrixRow &lt; matrixRows; matrixRow++)
+                    {
+                        tempConstArray[matrixCol].setFConst(
+                            tempConstArray[matrixCol].getFConst() +
+                            unionArray[matrixRow].getFConst() *
+                            rightUnionArray[matrixCol * matrixRows + matrixRow].getFConst());
+                    }
+                }
+
+                returnType.setPrimarySize(static_cast&lt;unsigned char&gt;(matrixCols));
+            }
+            break;
+
+          case EOpLogicalAnd:
+            // this code is written for possible future use,
+            // will not get executed currently
+            {
+                tempConstArray = new TConstantUnion[objectSize];
+                for (size_t i = 0; i &lt; objectSize; i++)
+                {
+                    tempConstArray[i] = unionArray[i] &amp;&amp; rightUnionArray[i];
+                }
+            }
+            break;
+
+          case EOpLogicalOr:
+            // this code is written for possible future use,
+            // will not get executed currently
+            {
+                tempConstArray = new TConstantUnion[objectSize];
+                for (size_t i = 0; i &lt; objectSize; i++)
+                {
+                    tempConstArray[i] = unionArray[i] || rightUnionArray[i];
+                }
+            }
+            break;
+
+          case EOpLogicalXor:
+            {
+                tempConstArray = new TConstantUnion[objectSize];
+                for (size_t i = 0; i &lt; objectSize; i++)
+                {
+                    switch (getType().getBasicType())
+                    {
+                      case EbtBool:
+                        tempConstArray[i].setBConst(
+                            unionArray[i] == rightUnionArray[i] ? false : true);
+                        break;
+                      default:
+                        UNREACHABLE();
+                        break;
+                    }
+                }
+            }
+            break;
+
+          case EOpBitwiseAnd:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] &amp; rightUnionArray[i];
+            break;
+          case EOpBitwiseXor:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] ^ rightUnionArray[i];
+            break;
+          case EOpBitwiseOr:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] | rightUnionArray[i];
+            break;
+          case EOpBitShiftLeft:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] &lt;&lt; rightUnionArray[i];
+            break;
+          case EOpBitShiftRight:
+            tempConstArray = new TConstantUnion[objectSize];
+            for (size_t i = 0; i &lt; objectSize; i++)
+                tempConstArray[i] = unionArray[i] &gt;&gt; rightUnionArray[i];
+            break;
+
+          case EOpLessThan:
+            ASSERT(objectSize == 1);
+            tempConstArray = new TConstantUnion[1];
+            tempConstArray-&gt;setBConst(*unionArray &lt; *rightUnionArray);
+            returnType = TType(EbtBool, EbpUndefined, EvqConst);
+            break;
+
+          case EOpGreaterThan:
+            ASSERT(objectSize == 1);
+            tempConstArray = new TConstantUnion[1];
+            tempConstArray-&gt;setBConst(*unionArray &gt; *rightUnionArray);
+            returnType = TType(EbtBool, EbpUndefined, EvqConst);
+            break;
+
+          case EOpLessThanEqual:
+            {
+                ASSERT(objectSize == 1);
+                TConstantUnion constant;
+                constant.setBConst(*unionArray &gt; *rightUnionArray);
+                tempConstArray = new TConstantUnion[1];
+                tempConstArray-&gt;setBConst(!constant.getBConst());
+                returnType = TType(EbtBool, EbpUndefined, EvqConst);
+                break;
+            }
+
+          case EOpGreaterThanEqual:
+            {
+                ASSERT(objectSize == 1);
+                TConstantUnion constant;
+                constant.setBConst(*unionArray &lt; *rightUnionArray);
+                tempConstArray = new TConstantUnion[1];
+                tempConstArray-&gt;setBConst(!constant.getBConst());
+                returnType = TType(EbtBool, EbpUndefined, EvqConst);
+                break;
+            }
+
+          case EOpEqual:
+            if (getType().getBasicType() == EbtStruct)
+            {
+                if (!CompareStructure(rightNode-&gt;getType(),
+                                      rightNode-&gt;getUnionArrayPointer(),
+                                      unionArray))
+                {
+                    boolNodeFlag = true;
+                }
+            }
+            else
+            {
+                for (size_t i = 0; i &lt; objectSize; i++)
+                {
+                    if (unionArray[i] != rightUnionArray[i])
+                    {
+                        boolNodeFlag = true;
+                        break;  // break out of for loop
+                    }
+                }
+            }
+
+            tempConstArray = new TConstantUnion[1];
+            if (!boolNodeFlag)
+            {
+                tempConstArray-&gt;setBConst(true);
+            }
+            else
+            {
+                tempConstArray-&gt;setBConst(false);
+            }
+
+            tempNode = new TIntermConstantUnion(
+                tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+            tempNode-&gt;setLine(getLine());
+
+            return tempNode;
+
+          case EOpNotEqual:
+            if (getType().getBasicType() == EbtStruct)
+            {
+                if (CompareStructure(rightNode-&gt;getType(),
+                                     rightNode-&gt;getUnionArrayPointer(),
+                                     unionArray))
+                {
+                    boolNodeFlag = true;
+                }
+            }
+            else
+            {
+                for (size_t i = 0; i &lt; objectSize; i++)
+                {
+                    if (unionArray[i] == rightUnionArray[i])
+                    {
+                        boolNodeFlag = true;
+                        break;  // break out of for loop
+                    }
+                }
+            }
+
+            tempConstArray = new TConstantUnion[1];
+            if (!boolNodeFlag)
+            {
+                tempConstArray-&gt;setBConst(true);
+            }
+            else
+            {
+                tempConstArray-&gt;setBConst(false);
+            }
+
+            tempNode = new TIntermConstantUnion(
+                tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
+            tempNode-&gt;setLine(getLine());
+
+            return tempNode;
+
+          default:
+            infoSink.info.message(
+                EPrefixInternalError, getLine(),
+                &quot;Invalid operator for constant folding&quot;);
+            return nullptr;
+        }
+        tempNode = new TIntermConstantUnion(tempConstArray, returnType);
+        tempNode-&gt;setLine(getLine());
+
+        return tempNode;
+    }
+    else
+    {
+        //
+        // Do unary operations
+        //
+        TIntermConstantUnion *newNode = 0;
+        TConstantUnion* tempConstArray = new TConstantUnion[objectSize];
+        for (size_t i = 0; i &lt; objectSize; i++)
+        {
+            switch(op)
+            {
+              case EOpNegative:
+                switch (getType().getBasicType())
+                {
+                  case EbtFloat:
+                    tempConstArray[i].setFConst(-unionArray[i].getFConst());
+                    break;
+                  case EbtInt:
+                    tempConstArray[i].setIConst(-unionArray[i].getIConst());
+                    break;
+                  case EbtUInt:
+                    tempConstArray[i].setUConst(static_cast&lt;unsigned int&gt;(
+                        -static_cast&lt;int&gt;(unionArray[i].getUConst())));
+                    break;
+                  default:
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Unary operation not folded into constant&quot;);
+                    return nullptr;
+                }
+                break;
+
+              case EOpPositive:
+                switch (getType().getBasicType())
+                {
+                  case EbtFloat:
+                    tempConstArray[i].setFConst(unionArray[i].getFConst());
+                    break;
+                  case EbtInt:
+                    tempConstArray[i].setIConst(unionArray[i].getIConst());
+                    break;
+                  case EbtUInt:
+                    tempConstArray[i].setUConst(static_cast&lt;unsigned int&gt;(
+                        static_cast&lt;int&gt;(unionArray[i].getUConst())));
+                    break;
+                  default:
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Unary operation not folded into constant&quot;);
+                    return nullptr;
+                }
+                break;
+
+              case EOpLogicalNot:
+                // this code is written for possible future use,
+                // will not get executed currently
+                switch (getType().getBasicType())
+                {
+                  case EbtBool:
+                    tempConstArray[i].setBConst(!unionArray[i].getBConst());
+                    break;
+                  default:
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Unary operation not folded into constant&quot;);
+                    return nullptr;
+                }
+                break;
+
+              case EOpBitwiseNot:
+                switch (getType().getBasicType())
+                {
+                  case EbtInt:
+                    tempConstArray[i].setIConst(~unionArray[i].getIConst());
+                    break;
+                  case EbtUInt:
+                    tempConstArray[i].setUConst(~unionArray[i].getUConst());
+                    break;
+                  default:
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Unary operation not folded into constant&quot;);
+                    return nullptr;
+                }
+                break;
+
+              case EOpRadians:
+                if (getType().getBasicType() == EbtFloat)
+                {
+                    tempConstArray[i].setFConst(kDegreesToRadiansMultiplier * unionArray[i].getFConst());
+                    break;
+                }
+                infoSink.info.message(
+                    EPrefixInternalError, getLine(),
+                    &quot;Unary operation not folded into constant&quot;);
+                return nullptr;
+
+              case EOpDegrees:
+                if (getType().getBasicType() == EbtFloat)
+                {
+                    tempConstArray[i].setFConst(kRadiansToDegreesMultiplier * unionArray[i].getFConst());
+                    break;
+                }
+                infoSink.info.message(
+                    EPrefixInternalError, getLine(),
+                    &quot;Unary operation not folded into constant&quot;);
+                return nullptr;
+
+              case EOpSin:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;sinf, infoSink, &amp;tempConstArray[i]))
+                   return nullptr;
+                break;
+
+              case EOpCos:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;cosf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpTan:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;tanf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpAsin:
+                // For asin(x), results are undefined if |x| &gt; 1, we are choosing to set result to 0.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; fabsf(unionArray[i].getFConst()) &gt; 1.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;asinf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpAcos:
+                // For acos(x), results are undefined if |x| &gt; 1, we are choosing to set result to 0.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; fabsf(unionArray[i].getFConst()) &gt; 1.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;acosf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpAtan:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;atanf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpSinh:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;sinhf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpCosh:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;coshf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpTanh:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;tanhf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpAsinh:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;asinhf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpAcosh:
+                // For acosh(x), results are undefined if x &lt; 1, we are choosing to set result to 0.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; unionArray[i].getFConst() &lt; 1.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;acoshf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpAtanh:
+                // For atanh(x), results are undefined if |x| &gt;= 1, we are choosing to set result to 0.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; fabsf(unionArray[i].getFConst()) &gt;= 1.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;atanhf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpAbs:
+                switch (getType().getBasicType())
+                {
+                  case EbtFloat:
+                    tempConstArray[i].setFConst(fabsf(unionArray[i].getFConst()));
+                    break;
+                  case EbtInt:
+                    tempConstArray[i].setIConst(abs(unionArray[i].getIConst()));
+                    break;
+                  default:
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Unary operation not folded into constant&quot;);
+                    return nullptr;
+                }
+                break;
+
+              case EOpSign:
+                switch (getType().getBasicType())
+                {
+                  case EbtFloat:
+                    {
+                        float fConst = unionArray[i].getFConst();
+                        float fResult = 0.0f;
+                        if (fConst &gt; 0.0f)
+                            fResult = 1.0f;
+                        else if (fConst &lt; 0.0f)
+                            fResult = -1.0f;
+                        tempConstArray[i].setFConst(fResult);
+                    }
+                    break;
+                  case EbtInt:
+                    {
+                        int iConst = unionArray[i].getIConst();
+                        int iResult = 0;
+                        if (iConst &gt; 0)
+                            iResult = 1;
+                        else if (iConst &lt; 0)
+                            iResult = -1;
+                        tempConstArray[i].setIConst(iResult);
+                    }
+                    break;
+                  default:
+                    infoSink.info.message(
+                        EPrefixInternalError, getLine(),
+                        &quot;Unary operation not folded into constant&quot;);
+                    return nullptr;
+                }
+                break;
+
+              case EOpFloor:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;floorf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpTrunc:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;truncf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpRound:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;roundf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpRoundEven:
+                if (getType().getBasicType() == EbtFloat)
+                {
+                    float x = unionArray[i].getFConst();
+                    float result;
+                    float fractPart = modff(x, &amp;result);
+                    if (fabsf(fractPart) == 0.5f)
+                        result = 2.0f * roundf(x / 2.0f);
+                    else
+                        result = roundf(x);
+                    tempConstArray[i].setFConst(result);
+                    break;
+                }
+                infoSink.info.message(
+                    EPrefixInternalError, getLine(),
+                    &quot;Unary operation not folded into constant&quot;);
+                return nullptr;
+
+              case EOpCeil:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;ceilf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpFract:
+                if (getType().getBasicType() == EbtFloat)
+                {
+                    float x = unionArray[i].getFConst();
+                    tempConstArray[i].setFConst(x - floorf(x));
+                    break;
+                }
+                infoSink.info.message(
+                    EPrefixInternalError, getLine(),
+                    &quot;Unary operation not folded into constant&quot;);
+                return nullptr;
+
+              case EOpExp:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;expf, infoSink, &amp;tempConstArray[i]))
+                  return nullptr;
+                break;
+
+              case EOpLog:
+                // For log(x), results are undefined if x &lt;= 0, we are choosing to set result to 0.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; unionArray[i].getFConst() &lt;= 0.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;logf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpExp2:
+                if (!foldFloatTypeUnary(unionArray[i], &amp;exp2f, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpLog2:
+                // For log2(x), results are undefined if x &lt;= 0, we are choosing to set result to 0.
+                // And log2f is not available on some plarforms like old android, so just using log(x)/log(2) here.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; unionArray[i].getFConst() &lt;= 0.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;logf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                else
+                    tempConstArray[i].setFConst(tempConstArray[i].getFConst() / logf(2.0f));
+                break;
+
+              case EOpSqrt:
+                // For sqrt(x), results are undefined if x &lt; 0, we are choosing to set result to 0.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; unionArray[i].getFConst() &lt; 0.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;sqrtf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                break;
+
+              case EOpInverseSqrt:
+                // There is no stdlib built-in function equavalent for GLES built-in inversesqrt(),
+                // so getting the square root first using builtin function sqrt() and then taking its inverse.
+                // Also, for inversesqrt(x), results are undefined if x &lt;= 0, we are choosing to set result to 0.
+                if (getType().getBasicType() == EbtFloat &amp;&amp; unionArray[i].getFConst() &lt;= 0.0f)
+                    tempConstArray[i].setFConst(0.0f);
+                else if (!foldFloatTypeUnary(unionArray[i], &amp;sqrtf, infoSink, &amp;tempConstArray[i]))
+                    return nullptr;
+                else
+                    tempConstArray[i].setFConst(1.0f / tempConstArray[i].getFConst());
+                break;
+
+              default:
+                return nullptr;
+            }
+        }
+        newNode = new TIntermConstantUnion(tempConstArray, getType());
+        newNode-&gt;setLine(getLine());
+        return newNode;
+    }
+}
+
+bool TIntermConstantUnion::foldFloatTypeUnary(const TConstantUnion &amp;parameter, FloatTypeUnaryFunc builtinFunc,
+                                              TInfoSink &amp;infoSink, TConstantUnion *result) const
+{
+    ASSERT(builtinFunc);
+
+    if (getType().getBasicType() == EbtFloat)
+    {
+        result-&gt;setFConst(builtinFunc(parameter.getFConst()));
+        return true;
+    }
+
+    infoSink.info.message(
+        EPrefixInternalError, getLine(),
+        &quot;Unary operation not folded into constant&quot;);
+    return false;
+}
+
+// static
+TString TIntermTraverser::hash(const TString &amp;name, ShHashFunction64 hashFunction)
+{
+    if (hashFunction == NULL || name.empty())
+        return name;
+    khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
+    TStringStream stream;
+    stream &lt;&lt; HASHED_NAME_PREFIX &lt;&lt; std::hex &lt;&lt; number;
+    TString hashedName = stream.str();
+    return hashedName;
+}
+
+void TIntermTraverser::updateTree()
+{
+    for (size_t ii = 0; ii &lt; mReplacements.size(); ++ii)
+    {
+        const NodeUpdateEntry &amp;replacement = mReplacements[ii];
+        ASSERT(replacement.parent);
+        bool replaced = replacement.parent-&gt;replaceChildNode(
+            replacement.original, replacement.replacement);
+        ASSERT(replaced);
+        UNUSED_ASSERTION_VARIABLE(replaced);
+
+        if (!replacement.originalBecomesChildOfReplacement)
+        {
+            // In AST traversing, a parent is visited before its children.
+            // After we replace a node, if its immediate child is to
+            // be replaced, we need to make sure we don't update the replaced
+            // node; instead, we update the replacement node.
+            for (size_t jj = ii + 1; jj &lt; mReplacements.size(); ++jj)
+            {
+                NodeUpdateEntry &amp;replacement2 = mReplacements[jj];
+                if (replacement2.parent == replacement.original)
+                    replacement2.parent = replacement.replacement;
+            }
+        }
+    }
+    for (size_t ii = 0; ii &lt; mMultiReplacements.size(); ++ii)
+    {
+        const NodeReplaceWithMultipleEntry &amp;replacement = mMultiReplacements[ii];
+        ASSERT(replacement.parent);
+        bool replaced = replacement.parent-&gt;replaceChildNodeWithMultiple(
+            replacement.original, replacement.replacements);
+        ASSERT(replaced);
+        UNUSED_ASSERTION_VARIABLE(replaced);
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorIntermNodeh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermNode.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,716 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+//
+// Definition of the in-memory high-level intermediate representation
+// of shaders.  This is a tree that parser creates.
+//
+// Nodes in the tree are defined as a hierarchy of classes derived from
+// TIntermNode. Each is a node in a tree.  There is no preset branching factor;
+// each node can have it's own type of list of children.
+//
+
+#ifndef COMPILER_TRANSLATOR_INTERMNODE_H_
+#define COMPILER_TRANSLATOR_INTERMNODE_H_
+
+#include &quot;GLSLANG/ShaderLang.h&quot;
+
+#include &lt;algorithm&gt;
+#include &lt;queue&gt;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;compiler/translator/Common.h&quot;
+#include &quot;compiler/translator/ConstantUnion.h&quot;
+#include &quot;compiler/translator/Operator.h&quot;
+#include &quot;compiler/translator/Types.h&quot;
+
+class TIntermTraverser;
+class TIntermAggregate;
+class TIntermBinary;
+class TIntermUnary;
+class TIntermConstantUnion;
+class TIntermSelection;
+class TIntermSwitch;
+class TIntermCase;
+class TIntermTyped;
+class TIntermSymbol;
+class TIntermLoop;
+class TInfoSink;
+class TInfoSinkBase;
+class TIntermRaw;
+
+//
+// Base class for the tree nodes
+//
+class TIntermNode
+{
+  public:
+    POOL_ALLOCATOR_NEW_DELETE();
+    TIntermNode()
+    {
+        // TODO: Move this to TSourceLoc constructor
+        // after getting rid of TPublicType.
+        mLine.first_file = mLine.last_file = 0;
+        mLine.first_line = mLine.last_line = 0;
+    }
+    virtual ~TIntermNode() { }
+
+    const TSourceLoc &amp;getLine() const { return mLine; }
+    void setLine(const TSourceLoc &amp;l) { mLine = l; }
+
+    virtual void traverse(TIntermTraverser *) = 0;
+    virtual TIntermTyped *getAsTyped() { return 0; }
+    virtual TIntermConstantUnion *getAsConstantUnion() { return 0; }
+    virtual TIntermAggregate *getAsAggregate() { return 0; }
+    virtual TIntermBinary *getAsBinaryNode() { return 0; }
+    virtual TIntermUnary *getAsUnaryNode() { return 0; }
+    virtual TIntermSelection *getAsSelectionNode() { return 0; }
+    virtual TIntermSwitch *getAsSwitchNode() { return 0; }
+    virtual TIntermCase *getAsCaseNode() { return 0; }
+    virtual TIntermSymbol *getAsSymbolNode() { return 0; }
+    virtual TIntermLoop *getAsLoopNode() { return 0; }
+    virtual TIntermRaw *getAsRawNode() { return 0; }
+
+    // Replace a child node. Return true if |original| is a child
+    // node and it is replaced; otherwise, return false.
+    virtual bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement) = 0;
+
+  protected:
+    TSourceLoc mLine;
+};
+
+//
+// This is just to help yacc.
+//
+struct TIntermNodePair
+{
+    TIntermNode *node1;
+    TIntermNode *node2;
+};
+
+//
+// Intermediate class for nodes that have a type.
+//
+class TIntermTyped : public TIntermNode
+{
+  public:
+    TIntermTyped(const TType &amp;t) : mType(t)  { }
+    virtual TIntermTyped *getAsTyped() { return this; }
+
+    virtual bool hasSideEffects() const = 0;
+
+    void setType(const TType &amp;t) { mType = t; }
+    void setTypePreservePrecision(const TType &amp;t);
+    const TType &amp;getType() const { return mType; }
+    TType *getTypePointer() { return &amp;mType; }
+
+    TBasicType getBasicType() const { return mType.getBasicType(); }
+    TQualifier getQualifier() const { return mType.getQualifier(); }
+    TPrecision getPrecision() const { return mType.getPrecision(); }
+    int getCols() const { return mType.getCols(); }
+    int getRows() const { return mType.getRows(); }
+    int getNominalSize() const { return mType.getNominalSize(); }
+    int getSecondarySize() const { return mType.getSecondarySize(); }
+
+    bool isInterfaceBlock() const { return mType.isInterfaceBlock(); }
+    bool isMatrix() const { return mType.isMatrix(); }
+    bool isArray()  const { return mType.isArray(); }
+    bool isVector() const { return mType.isVector(); }
+    bool isScalar() const { return mType.isScalar(); }
+    bool isScalarInt() const { return mType.isScalarInt(); }
+    const char *getBasicString() const { return mType.getBasicString(); }
+    const char *getQualifierString() const { return mType.getQualifierString(); }
+    TString getCompleteString() const { return mType.getCompleteString(); }
+
+    int getArraySize() const { return mType.getArraySize(); }
+
+  protected:
+    TType mType;
+};
+
+//
+// Handle for, do-while, and while loops.
+//
+enum TLoopType
+{
+    ELoopFor,
+    ELoopWhile,
+    ELoopDoWhile
+};
+
+class TIntermLoop : public TIntermNode
+{
+  public:
+    TIntermLoop(TLoopType type,
+                TIntermNode *init, TIntermTyped *cond, TIntermTyped *expr,
+                TIntermNode *body)
+        : mType(type),
+          mInit(init),
+          mCond(cond),
+          mExpr(expr),
+          mBody(body),
+          mUnrollFlag(false) { }
+
+    virtual TIntermLoop *getAsLoopNode() { return this; }
+    virtual void traverse(TIntermTraverser *);
+    virtual bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement);
+
+    TLoopType getType() const { return mType; }
+    TIntermNode *getInit() { return mInit; }
+    TIntermTyped *getCondition() { return mCond; }
+    TIntermTyped *getExpression() { return mExpr; }
+    TIntermNode *getBody() { return mBody; }
+
+    void setUnrollFlag(bool flag) { mUnrollFlag = flag; }
+    bool getUnrollFlag() const { return mUnrollFlag; }
+
+  protected:
+    TLoopType mType;
+    TIntermNode *mInit;  // for-loop initialization
+    TIntermTyped *mCond; // loop exit condition
+    TIntermTyped *mExpr; // for-loop expression
+    TIntermNode *mBody;  // loop body
+
+    bool mUnrollFlag; // Whether the loop should be unrolled or not.
+};
+
+//
+// Handle break, continue, return, and kill.
+//
+class TIntermBranch : public TIntermNode
+{
+  public:
+    TIntermBranch(TOperator op, TIntermTyped *e)
+        : mFlowOp(op),
+          mExpression(e) { }
+
+    virtual void traverse(TIntermTraverser *);
+    virtual bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement);
+
+    TOperator getFlowOp() { return mFlowOp; }
+    TIntermTyped* getExpression() { return mExpression; }
+
+protected:
+    TOperator mFlowOp;
+    TIntermTyped *mExpression;  // non-zero except for &quot;return exp;&quot; statements
+};
+
+//
+// Nodes that correspond to symbols or constants in the source code.
+//
+class TIntermSymbol : public TIntermTyped
+{
+  public:
+    // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym.
+    // If sym comes from per process globalpoolallocator, then it causes increased memory usage
+    // per compile it is essential to use &quot;symbol = sym&quot; to assign to symbol
+    TIntermSymbol(int id, const TString &amp;symbol, const TType &amp;type)
+        : TIntermTyped(type),
+          mId(id),
+          mInternal(false)
+    {
+        mSymbol = symbol;
+    }
+
+    virtual bool hasSideEffects() const { return false; }
+
+    int getId() const { return mId; }
+    const TString &amp;getSymbol() const { return mSymbol; }
+
+    void setId(int newId) { mId = newId; }
+
+    bool isInternal() const { return mInternal; }
+    void setInternal(bool isInternal) { mInternal = isInternal; }
+
+    virtual void traverse(TIntermTraverser *);
+    virtual TIntermSymbol *getAsSymbolNode() { return this; }
+    virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+
+  protected:
+    int mId;
+    bool mInternal;
+    TString mSymbol;
+};
+
+// A Raw node stores raw code, that the translator will insert verbatim
+// into the output stream. Useful for transformation operations that make
+// complex code that might not fit naturally into the GLSL model.
+class TIntermRaw : public TIntermTyped
+{
+  public:
+    TIntermRaw(const TType &amp;type, const TString &amp;rawText)
+        : TIntermTyped(type),
+          mRawText(rawText) { }
+
+    virtual bool hasSideEffects() const { return false; }
+
+    TString getRawText() const { return mRawText; }
+
+    virtual void traverse(TIntermTraverser *);
+
+    virtual TIntermRaw *getAsRawNode() { return this; }
+    virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+
+  protected:
+    TString mRawText;
+};
+
+class TIntermConstantUnion : public TIntermTyped
+{
+  public:
+    TIntermConstantUnion(TConstantUnion *unionPointer, const TType &amp;type)
+        : TIntermTyped(type),
+          mUnionArrayPointer(unionPointer) { }
+
+    virtual bool hasSideEffects() const { return false; }
+
+    const TConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
+    TConstantUnion *getUnionArrayPointer() { return mUnionArrayPointer; }
+
+    int getIConst(size_t index) const
+    {
+        return mUnionArrayPointer ? mUnionArrayPointer[index].getIConst() : 0;
+    }
+    unsigned int getUConst(size_t index) const
+    {
+        return mUnionArrayPointer ? mUnionArrayPointer[index].getUConst() : 0;
+    }
+    float getFConst(size_t index) const
+    {
+        return mUnionArrayPointer ? mUnionArrayPointer[index].getFConst() : 0.0f;
+    }
+    bool getBConst(size_t index) const
+    {
+        return mUnionArrayPointer ? mUnionArrayPointer[index].getBConst() : false;
+    }
+
+    void replaceConstantUnion(TConstantUnion *safeConstantUnion)
+    {
+        // Previous union pointer freed on pool deallocation.
+        mUnionArrayPointer = safeConstantUnion;
+    }
+
+    virtual TIntermConstantUnion *getAsConstantUnion()  { return this; }
+    virtual void traverse(TIntermTraverser *);
+    virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
+
+    TIntermTyped *fold(TOperator op, TIntermConstantUnion *rightNode, TInfoSink &amp;infoSink);
+
+  protected:
+    TConstantUnion *mUnionArrayPointer;
+
+  private:
+    typedef float(*FloatTypeUnaryFunc) (float);
+    bool foldFloatTypeUnary(const TConstantUnion &amp;parameter, FloatTypeUnaryFunc builtinFunc, TInfoSink &amp;infoSink, TConstantUnion *result) const;
+};
+
+//
+// Intermediate class for node types that hold operators.
+//
+class TIntermOperator : public TIntermTyped
+{
+  public:
+    TOperator getOp() const { return mOp; }
+    void setOp(TOperator op) { mOp = op; }
+
+    bool isAssignment() const;
+    bool isConstructor() const;
+
+    virtual bool hasSideEffects() const { return isAssignment(); }
+
+  protected:
+    TIntermOperator(TOperator op)
+        : TIntermTyped(TType(EbtFloat, EbpUndefined)),
+          mOp(op) {}
+    TIntermOperator(TOperator op, const TType &amp;type)
+        : TIntermTyped(type),
+          mOp(op) {}
+
+    TOperator mOp;
+};
+
+//
+// Nodes for all the basic binary math operators.
+//
+class TIntermBinary : public TIntermOperator
+{
+  public:
+    TIntermBinary(TOperator op)
+        : TIntermOperator(op),
+          mAddIndexClamp(false) {}
+
+    virtual TIntermBinary *getAsBinaryNode() { return this; }
+    virtual void traverse(TIntermTraverser *);
+    virtual bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement);
+
+    virtual bool hasSideEffects() const
+    {
+        return isAssignment() || mLeft-&gt;hasSideEffects() || mRight-&gt;hasSideEffects();
+    }
+
+    void setLeft(TIntermTyped *node) { mLeft = node; }
+    void setRight(TIntermTyped *node) { mRight = node; }
+    TIntermTyped *getLeft() const { return mLeft; }
+    TIntermTyped *getRight() const { return mRight; }
+    bool promote(TInfoSink &amp;);
+
+    void setAddIndexClamp() { mAddIndexClamp = true; }
+    bool getAddIndexClamp() { return mAddIndexClamp; }
+
+  protected:
+    TIntermTyped* mLeft;
+    TIntermTyped* mRight;
+
+    // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
+    bool mAddIndexClamp;
+};
+
+//
+// Nodes for unary math operators.
+//
+class TIntermUnary : public TIntermOperator
+{
+  public:
+    TIntermUnary(TOperator op, const TType &amp;type)
+        : TIntermOperator(op, type),
+          mOperand(NULL),
+          mUseEmulatedFunction(false) {}
+    TIntermUnary(TOperator op)
+        : TIntermOperator(op),
+          mOperand(NULL),
+          mUseEmulatedFunction(false) {}
+
+    virtual void traverse(TIntermTraverser *);
+    virtual TIntermUnary *getAsUnaryNode() { return this; }
+    virtual bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement);
+
+    virtual bool hasSideEffects() const
+    {
+        return isAssignment() || mOperand-&gt;hasSideEffects();
+    }
+
+    void setOperand(TIntermTyped *operand) { mOperand = operand; }
+    TIntermTyped *getOperand() { return mOperand; }
+    void promote(const TType *funcReturnType);
+
+    void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
+    bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
+
+  protected:
+    TIntermTyped *mOperand;
+
+    // If set to true, replace the built-in function call with an emulated one
+    // to work around driver bugs.
+    bool mUseEmulatedFunction;
+};
+
+typedef TVector&lt;TIntermNode *&gt; TIntermSequence;
+typedef TVector&lt;int&gt; TQualifierList;
+
+//
+// Nodes that operate on an arbitrary sized set of children.
+//
+class TIntermAggregate : public TIntermOperator
+{
+  public:
+    TIntermAggregate()
+        : TIntermOperator(EOpNull),
+          mUserDefined(false),
+          mUseEmulatedFunction(false) { }
+    TIntermAggregate(TOperator op)
+        : TIntermOperator(op),
+          mUseEmulatedFunction(false) { }
+    ~TIntermAggregate() { }
+
+    virtual TIntermAggregate *getAsAggregate() { return this; }
+    virtual void traverse(TIntermTraverser *);
+    virtual bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement);
+    bool replaceChildNodeWithMultiple(TIntermNode *original, TIntermSequence replacements);
+    // Conservatively assume function calls and other aggregate operators have side-effects
+    virtual bool hasSideEffects() const { return true; }
+
+    TIntermSequence *getSequence() { return &amp;mSequence; }
+
+    void setName(const TString &amp;name) { mName = name; }
+    const TString &amp;getName() const { return mName; }
+
+    void setUserDefined() { mUserDefined = true; }
+    bool isUserDefined() const { return mUserDefined; }
+
+    void setOptimize(bool optimize) { mOptimize = optimize; }
+    bool getOptimize() const { return mOptimize; }
+    void setDebug(bool debug) { mDebug = debug; }
+    bool getDebug() const { return mDebug; }
+
+    void setFunctionId(int functionId) { mFunctionId = functionId; }
+    int getFunctionId() const { return mFunctionId; }
+
+    void setUseEmulatedFunction() { mUseEmulatedFunction = true; }
+    bool getUseEmulatedFunction() { return mUseEmulatedFunction; }
+
+    void setPrecisionFromChildren();
+    void setBuiltInFunctionPrecision();
+
+  protected:
+    TIntermAggregate(const TIntermAggregate &amp;); // disallow copy constructor
+    TIntermAggregate &amp;operator=(const TIntermAggregate &amp;); // disallow assignment operator
+    TIntermSequence mSequence;
+    TString mName;
+    bool mUserDefined; // used for user defined function names
+    int mFunctionId;
+
+    bool mOptimize;
+    bool mDebug;
+
+    // If set to true, replace the built-in function call with an emulated one
+    // to work around driver bugs.
+    bool mUseEmulatedFunction;
+};
+
+//
+// For if tests.
+//
+class TIntermSelection : public TIntermTyped
+{
+  public:
+    TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB)
+        : TIntermTyped(TType(EbtVoid, EbpUndefined)),
+          mCondition(cond),
+          mTrueBlock(trueB),
+          mFalseBlock(falseB) {}
+    TIntermSelection(TIntermTyped *cond, TIntermNode *trueB, TIntermNode *falseB,
+                     const TType &amp;type)
+        : TIntermTyped(type),
+          mCondition(cond),
+          mTrueBlock(trueB),
+          mFalseBlock(falseB) {}
+
+    virtual void traverse(TIntermTraverser *);
+    virtual bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement);
+
+    // Conservatively assume selections have side-effects
+    virtual bool hasSideEffects() const { return true; }
+
+    bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
+    TIntermNode *getCondition() const { return mCondition; }
+    TIntermNode *getTrueBlock() const { return mTrueBlock; }
+    TIntermNode *getFalseBlock() const { return mFalseBlock; }
+    TIntermSelection *getAsSelectionNode() { return this; }
+
+protected:
+    TIntermTyped *mCondition;
+    TIntermNode *mTrueBlock;
+    TIntermNode *mFalseBlock;
+};
+
+//
+// Switch statement.
+//
+class TIntermSwitch : public TIntermNode
+{
+  public:
+    TIntermSwitch(TIntermTyped *init, TIntermAggregate *statementList)
+        : TIntermNode(),
+          mInit(init),
+          mStatementList(statementList)
+    {
+    }
+
+    void traverse(TIntermTraverser *it) override;
+    bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement) override;
+
+    TIntermSwitch *getAsSwitchNode() override { return this; }
+
+    TIntermAggregate *getStatementList() { return mStatementList; }
+    void setStatementList(TIntermAggregate *statementList) { mStatementList = statementList; }
+
+  protected:
+    TIntermTyped *mInit;
+    TIntermAggregate *mStatementList;
+};
+
+//
+// Case label.
+//
+class TIntermCase : public TIntermNode
+{
+  public:
+    TIntermCase(TIntermTyped *condition)
+        : TIntermNode(),
+          mCondition(condition)
+    {
+    }
+
+    void traverse(TIntermTraverser *it) override;
+    bool replaceChildNode(
+        TIntermNode *original, TIntermNode *replacement) override;
+
+    TIntermCase *getAsCaseNode() override { return this; }
+
+    bool hasCondition() const { return mCondition != nullptr; }
+    TIntermTyped *getCondition() const { return mCondition; }
+
+  protected:
+    TIntermTyped *mCondition;
+};
+
+enum Visit
+{
+    PreVisit,
+    InVisit,
+    PostVisit
+};
+
+//
+// For traversing the tree.  User should derive from this,
+// put their traversal specific data in it, and then pass
+// it to a Traverse method.
+//
+// When using this, just fill in the methods for nodes you want visited.
+// Return false from a pre-visit to skip visiting that node's subtree.
+//
+class TIntermTraverser : angle::NonCopyable
+{
+  public:
+    POOL_ALLOCATOR_NEW_DELETE();
+    // TODO(zmo): remove default values.
+    TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false,
+                     bool rightToLeft = false)
+        : preVisit(preVisit),
+          inVisit(inVisit),
+          postVisit(postVisit),
+          rightToLeft(rightToLeft),
+          mDepth(0),
+          mMaxDepth(0) {}
+    virtual ~TIntermTraverser() {}
+
+    virtual void visitSymbol(TIntermSymbol *) {}
+    virtual void visitRaw(TIntermRaw *) {}
+    virtual void visitConstantUnion(TIntermConstantUnion *) {}
+    virtual bool visitBinary(Visit, TIntermBinary *) { return true; }
+    virtual bool visitUnary(Visit, TIntermUnary *) { return true; }
+    virtual bool visitSelection(Visit, TIntermSelection *) { return true; }
+    virtual bool visitSwitch(Visit, TIntermSwitch *) { return true; }
+    virtual bool visitCase(Visit, TIntermCase *) { return true; }
+    virtual bool visitAggregate(Visit, TIntermAggregate *) { return true; }
+    virtual bool visitLoop(Visit, TIntermLoop *) { return true; }
+    virtual bool visitBranch(Visit, TIntermBranch *) { return true; }
+
+    int getMaxDepth() const { return mMaxDepth; }
+
+    void incrementDepth(TIntermNode *current)
+    {
+        mDepth++;
+        mMaxDepth = std::max(mMaxDepth, mDepth);
+        mPath.push_back(current);
+    }
+
+    void decrementDepth()
+    {
+        mDepth--;
+        mPath.pop_back();
+    }
+
+    TIntermNode *getParentNode()
+    {
+        return mPath.size() == 0 ? NULL : mPath.back();
+    }
+
+    // Return the original name if hash function pointer is NULL;
+    // otherwise return the hashed name.
+    static TString hash(const TString&amp; name, ShHashFunction64 hashFunction);
+
+    const bool preVisit;
+    const bool inVisit;
+    const bool postVisit;
+    const bool rightToLeft;
+
+    // If traversers need to replace nodes, they can add the replacements in
+    // mReplacements/mMultiReplacements during traversal and the user of the traverser should call
+    // this function after traversal to perform them.
+    void updateTree();
+
+  protected:
+    int mDepth;
+    int mMaxDepth;
+
+    // All the nodes from root to the current node's parent during traversing.
+    TVector&lt;TIntermNode *&gt; mPath;
+
+    // To replace a single node with another on the parent node
+    struct NodeUpdateEntry
+    {
+        NodeUpdateEntry(TIntermNode *_parent,
+                        TIntermNode *_original,
+                        TIntermNode *_replacement,
+                        bool _originalBecomesChildOfReplacement)
+            : parent(_parent),
+              original(_original),
+              replacement(_replacement),
+              originalBecomesChildOfReplacement(_originalBecomesChildOfReplacement) {}
+
+        TIntermNode *parent;
+        TIntermNode *original;
+        TIntermNode *replacement;
+        bool originalBecomesChildOfReplacement;
+    };
+
+    // To replace a single node with multiple nodes on the parent aggregate node
+    struct NodeReplaceWithMultipleEntry
+    {
+        NodeReplaceWithMultipleEntry(TIntermAggregate *_parent, TIntermNode *_original, TIntermSequence _replacements)
+            : parent(_parent),
+              original(_original),
+              replacements(_replacements)
+        {
+        }
+
+        TIntermAggregate *parent;
+        TIntermNode *original;
+        TIntermSequence replacements;
+    };
+
+    // During traversing, save all the changes that need to happen into
+    // mReplacements/mMultiReplacements, then do them by calling updateTree().
+    // Multi replacements are processed after single replacements.
+    std::vector&lt;NodeUpdateEntry&gt; mReplacements;
+    std::vector&lt;NodeReplaceWithMultipleEntry&gt; mMultiReplacements;
+};
+
+//
+// For traversing the tree, and computing max depth.
+// Takes a maximum depth limit to prevent stack overflow.
+//
+class TMaxDepthTraverser : public TIntermTraverser
+{
+  public:
+    POOL_ALLOCATOR_NEW_DELETE();
+    TMaxDepthTraverser(int depthLimit)
+        : TIntermTraverser(true, true, false, false),
+          mDepthLimit(depthLimit) { }
+
+    virtual bool visitBinary(Visit, TIntermBinary *) { return depthCheck(); }
+    virtual bool visitUnary(Visit, TIntermUnary *) { return depthCheck(); }
+    virtual bool visitSelection(Visit, TIntermSelection *) { return depthCheck(); }
+    virtual bool visitAggregate(Visit, TIntermAggregate *) { return depthCheck(); }
+    virtual bool visitLoop(Visit, TIntermLoop *) { return depthCheck(); }
+    virtual bool visitBranch(Visit, TIntermBranch *) { return depthCheck(); }
+
+  protected:
+    bool depthCheck() const { return mMaxDepth &lt; mDepthLimit; }
+
+    int mDepthLimit;
+};
+
+#endif  // COMPILER_TRANSLATOR_INTERMNODE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorIntermTraversecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermTraverse.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermTraverse.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/IntermTraverse.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Traverse the intermediate representation tree, and
</span><span class="lines">@@ -55,25 +55,25 @@
</span><span class="cx"> 
</span><span class="cx">         if (it-&gt;rightToLeft)
</span><span class="cx">         {
</span><del>-            if (right)
-                right-&gt;traverse(it);
</del><ins>+            if (mRight)
+                mRight-&gt;traverse(it);
</ins><span class="cx"> 
</span><span class="cx">             if (it-&gt;inVisit)
</span><span class="cx">                 visit = it-&gt;visitBinary(InVisit, this);
</span><span class="cx"> 
</span><del>-            if (visit &amp;&amp; left)
-                left-&gt;traverse(it);
</del><ins>+            if (visit &amp;&amp; mLeft)
+                mLeft-&gt;traverse(it);
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            if (left)
-                left-&gt;traverse(it);
</del><ins>+            if (mLeft)
+                mLeft-&gt;traverse(it);
</ins><span class="cx"> 
</span><span class="cx">             if (it-&gt;inVisit)
</span><span class="cx">                 visit = it-&gt;visitBinary(InVisit, this);
</span><span class="cx"> 
</span><del>-            if (visit &amp;&amp; right)
-                right-&gt;traverse(it);
</del><ins>+            if (visit &amp;&amp; mRight)
+                mRight-&gt;traverse(it);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         it-&gt;decrementDepth();
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (visit) {
</span><span class="cx">         it-&gt;incrementDepth(this);
</span><del>-        operand-&gt;traverse(it);
</del><ins>+        mOperand-&gt;traverse(it);
</ins><span class="cx">         it-&gt;decrementDepth();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -123,26 +123,28 @@
</span><span class="cx"> 
</span><span class="cx">         if (it-&gt;rightToLeft)
</span><span class="cx">         {
</span><del>-            for (TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
</del><ins>+            for (TIntermSequence::reverse_iterator sit = mSequence.rbegin();
+                 sit != mSequence.rend(); sit++)
</ins><span class="cx">             {
</span><span class="cx">                 (*sit)-&gt;traverse(it);
</span><span class="cx"> 
</span><span class="cx">                 if (visit &amp;&amp; it-&gt;inVisit)
</span><span class="cx">                 {
</span><del>-                    if (*sit != sequence.front())
</del><ins>+                    if (*sit != mSequence.front())
</ins><span class="cx">                         visit = it-&gt;visitAggregate(InVisit, this);
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
</del><ins>+            for (TIntermSequence::iterator sit = mSequence.begin();
+                 sit != mSequence.end(); sit++)
</ins><span class="cx">             {
</span><span class="cx">                 (*sit)-&gt;traverse(it);
</span><span class="cx"> 
</span><span class="cx">                 if (visit &amp;&amp; it-&gt;inVisit)
</span><span class="cx">                 {
</span><del>-                    if (*sit != sequence.back())
</del><ins>+                    if (*sit != mSequence.back())
</ins><span class="cx">                         visit = it-&gt;visitAggregate(InVisit, this);
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -165,21 +167,25 @@
</span><span class="cx">     if (it-&gt;preVisit)
</span><span class="cx">         visit = it-&gt;visitSelection(PreVisit, this);
</span><span class="cx"> 
</span><del>-    if (visit) {
</del><ins>+    if (visit)
+    {
</ins><span class="cx">         it-&gt;incrementDepth(this);
</span><del>-        if (it-&gt;rightToLeft) {
-            if (falseBlock)
-                falseBlock-&gt;traverse(it);
-            if (trueBlock)
-                trueBlock-&gt;traverse(it);
-            condition-&gt;traverse(it);
-        } else {
-            condition-&gt;traverse(it);
-            if (trueBlock)
-                trueBlock-&gt;traverse(it);
-            if (falseBlock)
-                falseBlock-&gt;traverse(it);
</del><ins>+        if (it-&gt;rightToLeft)
+        {
+            if (mFalseBlock)
+                mFalseBlock-&gt;traverse(it);
+            if (mTrueBlock)
+                mTrueBlock-&gt;traverse(it);
+            mCondition-&gt;traverse(it);
</ins><span class="cx">         }
</span><ins>+        else
+        {
+            mCondition-&gt;traverse(it);
+            if (mTrueBlock)
+                mTrueBlock-&gt;traverse(it);
+            if (mFalseBlock)
+                mFalseBlock-&gt;traverse(it);
+        }
</ins><span class="cx">         it-&gt;decrementDepth();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -188,6 +194,60 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><ins>+// Traverse a switch node.  Same comments in binary node apply here.
+//
+void TIntermSwitch::traverse(TIntermTraverser *it)
+{
+    bool visit = true;
+
+    if (it-&gt;preVisit)
+        visit = it-&gt;visitSwitch(PreVisit, this);
+
+    if (visit)
+    {
+        it-&gt;incrementDepth(this);
+        if (it-&gt;rightToLeft)
+        {
+            if (mStatementList)
+                mStatementList-&gt;traverse(it);
+            if (it-&gt;inVisit)
+                visit = it-&gt;visitSwitch(InVisit, this);
+            if (visit)
+                mInit-&gt;traverse(it);
+        }
+        else
+        {
+            mInit-&gt;traverse(it);
+            if (it-&gt;inVisit)
+                visit = it-&gt;visitSwitch(InVisit, this);
+            if (visit &amp;&amp; mStatementList)
+                mStatementList-&gt;traverse(it);
+        }
+        it-&gt;decrementDepth();
+    }
+
+    if (visit &amp;&amp; it-&gt;postVisit)
+        it-&gt;visitSwitch(PostVisit, this);
+}
+
+//
+// Traverse a switch node.  Same comments in binary node apply here.
+//
+void TIntermCase::traverse(TIntermTraverser *it)
+{
+    bool visit = true;
+
+    if (it-&gt;preVisit)
+        visit = it-&gt;visitCase(PreVisit, this);
+
+    if (visit &amp;&amp; mCondition)
+        mCondition-&gt;traverse(it);
+
+    if (visit &amp;&amp; it-&gt;postVisit)
+        it-&gt;visitCase(PostVisit, this);
+}
+
+//
</ins><span class="cx"> // Traverse a loop node.  Same comments in binary node apply here.
</span><span class="cx"> //
</span><span class="cx"> void TIntermLoop::traverse(TIntermTraverser *it)
</span><span class="lines">@@ -203,31 +263,31 @@
</span><span class="cx"> 
</span><span class="cx">         if (it-&gt;rightToLeft)
</span><span class="cx">         {
</span><del>-            if (expr)
-                expr-&gt;traverse(it);
</del><ins>+            if (mExpr)
+                mExpr-&gt;traverse(it);
</ins><span class="cx"> 
</span><del>-            if (body)
-                body-&gt;traverse(it);
</del><ins>+            if (mBody)
+                mBody-&gt;traverse(it);
</ins><span class="cx"> 
</span><del>-            if (cond)
-                cond-&gt;traverse(it);
</del><ins>+            if (mCond)
+                mCond-&gt;traverse(it);
</ins><span class="cx"> 
</span><del>-            if (init)
-                init-&gt;traverse(it);
</del><ins>+            if (mInit)
+                mInit-&gt;traverse(it);
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            if (init)
-                init-&gt;traverse(it);
</del><ins>+            if (mInit)
+                mInit-&gt;traverse(it);
</ins><span class="cx"> 
</span><del>-            if (cond)
-                cond-&gt;traverse(it);
</del><ins>+            if (mCond)
+                mCond-&gt;traverse(it);
</ins><span class="cx"> 
</span><del>-            if (body)
-                body-&gt;traverse(it);
</del><ins>+            if (mBody)
+                mBody-&gt;traverse(it);
</ins><span class="cx"> 
</span><del>-            if (expr)
-                expr-&gt;traverse(it);
</del><ins>+            if (mExpr)
+                mExpr-&gt;traverse(it);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         it-&gt;decrementDepth();
</span><span class="lines">@@ -247,9 +307,9 @@
</span><span class="cx">     if (it-&gt;preVisit)
</span><span class="cx">         visit = it-&gt;visitBranch(PreVisit, this);
</span><span class="cx"> 
</span><del>-    if (visit &amp;&amp; expression) {
</del><ins>+    if (visit &amp;&amp; mExpression) {
</ins><span class="cx">         it-&gt;incrementDepth(this);
</span><del>-        expression-&gt;traverse(it);
</del><ins>+        mExpression-&gt;traverse(it);
</ins><span class="cx">         it-&gt;decrementDepth();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -257,3 +317,7 @@
</span><span class="cx">         it-&gt;visitBranch(PostVisit, this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TIntermRaw::traverse(TIntermTraverser *it)
+{
+    it-&gt;visitRaw(this);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorIntermediatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Intermediate.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="lines">@@ -12,124 +12,9 @@
</span><span class="cx"> #include &lt;limits.h&gt;
</span><span class="cx"> #include &lt;algorithm&gt;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/HashNames.h&quot;
-#include &quot;compiler/translator/localintermediate.h&quot;
-#include &quot;compiler/translator/QualifierAlive.h&quot;
-#include &quot;compiler/translator/RemoveTree.h&quot;
</del><ins>+#include &quot;compiler/translator/intermediate.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/SymbolTable.h&quot;
</span><span class="cx"> 
</span><del>-bool CompareStructure(const TType&amp; leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
-
-static TPrecision GetHigherPrecision(TPrecision left, TPrecision right)
-{
-    return left &gt; right ? left : right;
-}
-
-const char* getOperatorString(TOperator op)
-{
-    switch (op) {
-      case EOpInitialize: return &quot;=&quot;;
-      case EOpAssign: return &quot;=&quot;;
-      case EOpAddAssign: return &quot;+=&quot;;
-      case EOpSubAssign: return &quot;-=&quot;;
-      case EOpDivAssign: return &quot;/=&quot;;
-
-      // Fall-through.
-      case EOpMulAssign: 
-      case EOpVectorTimesMatrixAssign:
-      case EOpVectorTimesScalarAssign:
-      case EOpMatrixTimesScalarAssign:
-      case EOpMatrixTimesMatrixAssign: return &quot;*=&quot;;
-
-      // Fall-through.
-      case EOpIndexDirect:
-      case EOpIndexIndirect: return &quot;[]&quot;;
-
-      case EOpIndexDirectStruct:
-      case EOpIndexDirectInterfaceBlock: return &quot;.&quot;;
-      case EOpVectorSwizzle: return &quot;.&quot;;
-      case EOpAdd: return &quot;+&quot;;
-      case EOpSub: return &quot;-&quot;;
-      case EOpMul: return &quot;*&quot;;
-      case EOpDiv: return &quot;/&quot;;
-      case EOpMod: UNIMPLEMENTED(); break;
-      case EOpEqual: return &quot;==&quot;;
-      case EOpNotEqual: return &quot;!=&quot;;
-      case EOpLessThan: return &quot;&lt;&quot;;
-      case EOpGreaterThan: return &quot;&gt;&quot;;
-      case EOpLessThanEqual: return &quot;&lt;=&quot;;
-      case EOpGreaterThanEqual: return &quot;&gt;=&quot;;
-
-      // Fall-through.
-      case EOpVectorTimesScalar:
-      case EOpVectorTimesMatrix:
-      case EOpMatrixTimesVector:
-      case EOpMatrixTimesScalar:
-      case EOpMatrixTimesMatrix: return &quot;*&quot;;
-
-      case EOpLogicalOr: return &quot;||&quot;;
-      case EOpLogicalXor: return &quot;^^&quot;;
-      case EOpLogicalAnd: return &quot;&amp;&amp;&quot;;
-      case EOpNegative: return &quot;-&quot;;
-      case EOpVectorLogicalNot: return &quot;not&quot;;
-      case EOpLogicalNot: return &quot;!&quot;;
-      case EOpPostIncrement: return &quot;++&quot;;
-      case EOpPostDecrement: return &quot;--&quot;;
-      case EOpPreIncrement: return &quot;++&quot;;
-      case EOpPreDecrement: return &quot;--&quot;;
-
-      // Fall-through.
-      case EOpConvIntToBool:
-      case EOpConvUIntToBool:
-      case EOpConvFloatToBool: return &quot;bool&quot;;

-      // Fall-through.
-      case EOpConvBoolToFloat:
-      case EOpConvUIntToFloat:
-      case EOpConvIntToFloat: return &quot;float&quot;;

-      // Fall-through.
-      case EOpConvFloatToInt:
-      case EOpConvUIntToInt:
-      case EOpConvBoolToInt: return &quot;int&quot;;
-
-      // Fall-through.
-      case EOpConvIntToUInt:
-      case EOpConvFloatToUInt:
-      case EOpConvBoolToUInt: return &quot;uint&quot;;
-
-      case EOpRadians: return &quot;radians&quot;;
-      case EOpDegrees: return &quot;degrees&quot;;
-      case EOpSin: return &quot;sin&quot;;
-      case EOpCos: return &quot;cos&quot;;
-      case EOpTan: return &quot;tan&quot;;
-      case EOpAsin: return &quot;asin&quot;;
-      case EOpAcos: return &quot;acos&quot;;
-      case EOpAtan: return &quot;atan&quot;;
-      case EOpExp: return &quot;exp&quot;;
-      case EOpLog: return &quot;log&quot;;
-      case EOpExp2: return &quot;exp2&quot;;
-      case EOpLog2: return &quot;log2&quot;;
-      case EOpSqrt: return &quot;sqrt&quot;;
-      case EOpInverseSqrt: return &quot;inversesqrt&quot;;
-      case EOpAbs: return &quot;abs&quot;;
-      case EOpSign: return &quot;sign&quot;;
-      case EOpFloor: return &quot;floor&quot;;
-      case EOpCeil: return &quot;ceil&quot;;
-      case EOpFract: return &quot;fract&quot;;
-      case EOpLength: return &quot;length&quot;;
-      case EOpNormalize: return &quot;normalize&quot;;
-      case EOpDFdx: return &quot;dFdx&quot;;
-      case EOpDFdy: return &quot;dFdy&quot;;
-      case EOpFwidth: return &quot;fwidth&quot;;
-      case EOpAny: return &quot;any&quot;;
-      case EOpAll: return &quot;all&quot;;
-
-      default: break;
-    }
-    return &quot;&quot;;
-}
-
</del><span class="cx"> ////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> //
</span><span class="cx"> // First set of functions are to help build the intermediate representation.
</span><span class="lines">@@ -143,9 +28,10 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns the added node.
</span><span class="cx"> //
</span><del>-TIntermSymbol* TIntermediate::addSymbol(int id, const TString&amp; name, const TType&amp; type, const TSourceLoc&amp; line)
</del><ins>+TIntermSymbol *TIntermediate::addSymbol(
+    int id, const TString &amp;name, const TType &amp;type, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    TIntermSymbol* node = new TIntermSymbol(id, name, type);
</del><ins>+    TIntermSymbol *node = new TIntermSymbol(id, name, type);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="lines">@@ -156,76 +42,30 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns the added node.
</span><span class="cx"> //
</span><del>-TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TIntermediate::addBinaryMath(
+    TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    switch (op) {
-        case EOpEqual:
-        case EOpNotEqual:
-            if (left-&gt;isArray())
-                return 0;
-            break;
-        case EOpLessThan:
-        case EOpGreaterThan:
-        case EOpLessThanEqual:
-        case EOpGreaterThanEqual:
-            if (left-&gt;isMatrix() || left-&gt;isArray() || left-&gt;isVector() || left-&gt;getBasicType() == EbtStruct) {
-                return 0;
-            }
-            break;
-        case EOpLogicalOr:
-        case EOpLogicalXor:
-        case EOpLogicalAnd:
-            if (left-&gt;getBasicType() != EbtBool || left-&gt;isMatrix() || left-&gt;isArray() || left-&gt;isVector()) {
-                return 0;
-            }
-            break;
-        case EOpAdd:
-        case EOpSub:
-        case EOpDiv:
-        case EOpMul:
-            if (left-&gt;getBasicType() == EbtStruct || left-&gt;getBasicType() == EbtBool)
-                return 0;
-        default: break;
-    }
-
</del><span class="cx">     //
</span><del>-    // First try converting the children to compatible types.
-    //
-    if (left-&gt;getType().getStruct() &amp;&amp; right-&gt;getType().getStruct()) {
-        if (left-&gt;getType() != right-&gt;getType())
-            return 0;
-    } else {
-        TIntermTyped* child = addConversion(op, left-&gt;getType(), right);
-        if (child)
-            right = child;
-        else {
-            child = addConversion(op, right-&gt;getType(), left);
-            if (child)
-                left = child;
-            else
-                return 0;
-        }
-    }
-
-    //
</del><span class="cx">     // Need a new node holding things together then.  Make
</span><span class="cx">     // one and promote it to the right type.
</span><span class="cx">     //
</span><del>-    TIntermBinary* node = new TIntermBinary(op);
</del><ins>+    TIntermBinary *node = new TIntermBinary(op);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="cx">     node-&gt;setLeft(left);
</span><span class="cx">     node-&gt;setRight(right);
</span><del>-    if (!node-&gt;promote(infoSink))
-        return 0;
</del><ins>+    if (!node-&gt;promote(mInfoSink))
+        return NULL;
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // See if we can fold constants.
</span><span class="cx">     //
</span><span class="cx">     TIntermConstantUnion *leftTempConstant = left-&gt;getAsConstantUnion();
</span><span class="cx">     TIntermConstantUnion *rightTempConstant = right-&gt;getAsConstantUnion();
</span><del>-    if (leftTempConstant &amp;&amp; rightTempConstant) {
-        TIntermTyped *typedReturnNode = leftTempConstant-&gt;fold(node-&gt;getOp(), rightTempConstant, infoSink);
</del><ins>+    if (leftTempConstant &amp;&amp; rightTempConstant)
+    {
+        TIntermTyped *typedReturnNode =
+            leftTempConstant-&gt;fold(node-&gt;getOp(), rightTempConstant, mInfoSink);
</ins><span class="cx"> 
</span><span class="cx">         if (typedReturnNode)
</span><span class="cx">             return typedReturnNode;
</span><span class="lines">@@ -239,23 +79,24 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns the added node.
</span><span class="cx"> //
</span><del>-TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TIntermediate::addAssign(
+    TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    //
-    // Like adding binary math, except the conversion can only go
-    // from right to left.
-    //
-    TIntermBinary* node = new TIntermBinary(op);
</del><ins>+    if (left-&gt;getType().getStruct() || right-&gt;getType().getStruct())
+    {
+        if (left-&gt;getType() != right-&gt;getType())
+        {
+            return NULL;
+        }
+    }
+
+    TIntermBinary *node = new TIntermBinary(op);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><del>-    TIntermTyped* child = addConversion(op, left-&gt;getType(), right);
-    if (child == 0)
-        return 0;
-
</del><span class="cx">     node-&gt;setLeft(left);
</span><del>-    node-&gt;setRight(child);
-    if (! node-&gt;promote(infoSink))
-        return 0;
</del><ins>+    node-&gt;setRight(right);
+    if (!node-&gt;promote(mInfoSink))
+        return NULL;
</ins><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="cx"> }
</span><span class="lines">@@ -267,9 +108,10 @@
</span><span class="cx"> // Returns the added node.
</span><span class="cx"> // The caller should set the type of the returned node.
</span><span class="cx"> //
</span><del>-TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TIntermediate::addIndex(
+    TOperator op, TIntermTyped *base, TIntermTyped *index, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    TIntermBinary* node = new TIntermBinary(op);
</del><ins>+    TIntermBinary *node = new TIntermBinary(op);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx">     node-&gt;setLeft(base);
</span><span class="cx">     node-&gt;setRight(index);
</span><span class="lines">@@ -284,69 +126,9 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns the added node.
</span><span class="cx"> //
</span><del>-TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TIntermediate::addUnaryMath(
+    TOperator op, TIntermTyped *child, const TSourceLoc &amp;line, const TType *funcReturnType)
</ins><span class="cx"> {
</span><del>-    TIntermUnary* node;
-    TIntermTyped* child = childNode-&gt;getAsTyped();
-
-    if (child == 0) {
-        infoSink.info.message(EPrefixInternalError, line, &quot;Bad type in AddUnaryMath&quot;);
-        return 0;
-    }
-
-    switch (op) {
-        case EOpLogicalNot:
-            if (child-&gt;getType().getBasicType() != EbtBool || child-&gt;getType().isMatrix() || child-&gt;getType().isArray() || child-&gt;getType().isVector()) {
-                return 0;
-            }
-            break;
-
-        case EOpPostIncrement:
-        case EOpPreIncrement:
-        case EOpPostDecrement:
-        case EOpPreDecrement:
-        case EOpNegative:
-            if (child-&gt;getType().getBasicType() == EbtStruct || child-&gt;getType().isArray())
-                return 0;
-        default: break;
-    }
-
-    //
-    // Do we need to promote the operand?
-    //
-    // Note: Implicit promotions were removed from the language.
-    //
-    TBasicType newType = EbtVoid;
-    switch (op) {
-        case EOpConstructInt:   newType = EbtInt;   break;
-        case EOpConstructUInt:  newType = EbtUInt;  break;
-        case EOpConstructBool:  newType = EbtBool;  break;
-        case EOpConstructFloat: newType = EbtFloat; break;
-        default: break;
-    }
-
-    if (newType != EbtVoid) {
-        child = addConversion(op, TType(newType, child-&gt;getPrecision(), EvqTemporary,
-            child-&gt;getNominalSize(),
-            child-&gt;getSecondarySize(),
-            child-&gt;isArray()),
-            child);
-        if (child == 0)
-            return 0;
-    }
-
-    //
-    // For constructors, we are now done, it's all in the conversion.
-    //
-    switch (op) {
-        case EOpConstructInt:
-        case EOpConstructUInt:
-        case EOpConstructBool:
-        case EOpConstructFloat:
-            return child;
-        default: break;
-    }
-
</del><span class="cx">     TIntermConstantUnion *childTempConstant = 0;
</span><span class="cx">     if (child-&gt;getAsConstantUnion())
</span><span class="cx">         childTempConstant = child-&gt;getAsConstantUnion();
</span><span class="lines">@@ -354,16 +136,15 @@
</span><span class="cx">     //
</span><span class="cx">     // Make a new node for the operator.
</span><span class="cx">     //
</span><del>-    node = new TIntermUnary(op);
</del><ins>+    TIntermUnary *node = new TIntermUnary(op);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx">     node-&gt;setOperand(child);
</span><ins>+    node-&gt;promote(funcReturnType);
</ins><span class="cx"> 
</span><del>-    if (! node-&gt;promote(infoSink))
-        return 0;
</del><ins>+    if (childTempConstant)
+    {
+        TIntermTyped *newChild = childTempConstant-&gt;fold(op, nullptr, mInfoSink);
</ins><span class="cx"> 
</span><del>-    if (childTempConstant)  {
-        TIntermTyped* newChild = childTempConstant-&gt;fold(op, 0, infoSink);
-
</del><span class="cx">         if (newChild)
</span><span class="cx">             return newChild;
</span><span class="cx">     }
</span><span class="lines">@@ -381,24 +162,30 @@
</span><span class="cx"> // Returns an aggregate node, which could be the one passed in if
</span><span class="cx"> // it was already an aggregate but no operator was set.
</span><span class="cx"> //
</span><del>-TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, const TSourceLoc&amp; line)
</del><ins>+TIntermAggregate *TIntermediate::setAggregateOperator(
+    TIntermNode *node, TOperator op, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    TIntermAggregate* aggNode;
</del><ins>+    TIntermAggregate *aggNode;
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // Make sure we have an aggregate.  If not turn it into one.
</span><span class="cx">     //
</span><del>-    if (node) {
</del><ins>+    if (node)
+    {
</ins><span class="cx">         aggNode = node-&gt;getAsAggregate();
</span><del>-        if (aggNode == 0 || aggNode-&gt;getOp() != EOpNull) {
</del><ins>+        if (aggNode == NULL || aggNode-&gt;getOp() != EOpNull)
+        {
</ins><span class="cx">             //
</span><span class="cx">             // Make an aggregate containing this node.
</span><span class="cx">             //
</span><span class="cx">             aggNode = new TIntermAggregate();
</span><del>-            aggNode-&gt;getSequence().push_back(node);
</del><ins>+            aggNode-&gt;getSequence()-&gt;push_back(node);
</ins><span class="cx">         }
</span><del>-    } else
</del><ins>+    }
+    else
+    {
</ins><span class="cx">         aggNode = new TIntermAggregate();
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // Set the operator.
</span><span class="lines">@@ -410,162 +197,30 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><del>-// Convert one type to another.
-//
-// Returns the node representing the conversion, which could be the same
-// node passed in if no conversion was needed.
-//
-// Return 0 if a conversion can't be done.
-//
-TIntermTyped* TIntermediate::addConversion(TOperator op, const TType&amp; type, TIntermTyped* node)
-{
-    //
-    // Does the base type allow operation?
-    //
-    if (node-&gt;getBasicType() == EbtVoid ||
-        IsSampler(node-&gt;getBasicType()))
-    {
-        return 0;
-    }
-
-    //
-    // Otherwise, if types are identical, no problem
-    //
-    if (type == node-&gt;getType())
-        return node;
-
-    //
-    // If one's a structure, then no conversions.
-    //
-    if (type.getStruct() || node-&gt;getType().getStruct())
-        return 0;
-
-    //
-    // If one's an array, then no conversions.
-    //
-    if (type.isArray() || node-&gt;getType().isArray())
-        return 0;
-
-    TBasicType promoteTo;
-
-    switch (op) {
-        //
-        // Explicit conversions
-        //
-        case EOpConstructBool:
-            promoteTo = EbtBool;
-            break;
-        case EOpConstructFloat:
-            promoteTo = EbtFloat;
-            break;
-        case EOpConstructInt:
-            promoteTo = EbtInt;
-            break;
-        case EOpConstructUInt:
-            promoteTo = EbtUInt;
-            break;
-        default:
-            //
-            // implicit conversions were removed from the language.
-            //
-            if (type.getBasicType() != node-&gt;getType().getBasicType())
-                return 0;
-            //
-            // Size and structure could still differ, but that's
-            // handled by operator promotion.
-            //
-            return node;
-    }
-
-    if (node-&gt;getAsConstantUnion()) {
-
-        return (promoteConstantUnion(promoteTo, node-&gt;getAsConstantUnion()));
-    } else {
-
-        //
-        // Add a new newNode for the conversion.
-        //
-        TIntermUnary* newNode = 0;
-
-        TOperator newOp = EOpNull;
-        switch (promoteTo) {
-            case EbtFloat:
-                switch (node-&gt;getBasicType()) {
-                    case EbtInt:    newOp = EOpConvIntToFloat;  break;
-                    case EbtUInt:   newOp = EOpConvFloatToUInt; break;
-                    case EbtBool:   newOp = EOpConvBoolToFloat; break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Bad promotion node&quot;);
-                        return 0;
-                }
-                break;
-            case EbtBool:
-                switch (node-&gt;getBasicType()) {
-                    case EbtInt:    newOp = EOpConvIntToBool;   break;
-                    case EbtUInt:   newOp = EOpConvBoolToUInt;  break;
-                    case EbtFloat:  newOp = EOpConvFloatToBool; break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Bad promotion node&quot;);
-                        return 0;
-                }
-                break;
-            case EbtInt:
-                switch (node-&gt;getBasicType()) {
-                    case EbtUInt:   newOp = EOpConvUIntToInt;  break;
-                    case EbtBool:   newOp = EOpConvBoolToInt;  break;
-                    case EbtFloat:  newOp = EOpConvFloatToInt; break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Bad promotion node&quot;);
-                        return 0;
-                }
-                break;
-            case EbtUInt:
-                switch (node-&gt;getBasicType()) {
-                    case EbtInt:    newOp = EOpConvIntToUInt;   break;
-                    case EbtBool:   newOp = EOpConvBoolToUInt;  break;
-                    case EbtFloat:  newOp = EOpConvFloatToUInt; break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Bad promotion node&quot;);
-                        return 0;
-                }
-                break;
-            default:
-                infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Bad promotion type&quot;);
-                return 0;
-        }
-
-        TType type(promoteTo, node-&gt;getPrecision(), EvqTemporary, node-&gt;getNominalSize(), node-&gt;getSecondarySize(), node-&gt;isArray());
-        newNode = new TIntermUnary(newOp, type);
-        newNode-&gt;setLine(node-&gt;getLine());
-        newNode-&gt;setOperand(node);
-
-        return newNode;
-    }
-}
-
-//
</del><span class="cx"> // Safe way to combine two nodes into an aggregate.  Works with null pointers,
</span><span class="cx"> // a node that's not a aggregate yet, etc.
</span><span class="cx"> //
</span><span class="cx"> // Returns the resulting aggregate, unless 0 was passed in for
</span><span class="cx"> // both existing nodes.
</span><span class="cx"> //
</span><del>-TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&amp; line)
</del><ins>+TIntermAggregate *TIntermediate::growAggregate(
+    TIntermNode *left, TIntermNode *right, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    if (left == 0 &amp;&amp; right == 0)
-        return 0;
</del><ins>+    if (left == NULL &amp;&amp; right == NULL)
+        return NULL;
</ins><span class="cx"> 
</span><del>-    TIntermAggregate* aggNode = 0;
</del><ins>+    TIntermAggregate *aggNode = NULL;
</ins><span class="cx">     if (left)
</span><span class="cx">         aggNode = left-&gt;getAsAggregate();
</span><del>-    if (!aggNode || aggNode-&gt;getOp() != EOpNull) {
</del><ins>+    if (!aggNode || aggNode-&gt;getOp() != EOpNull)
+    {
</ins><span class="cx">         aggNode = new TIntermAggregate;
</span><span class="cx">         if (left)
</span><del>-            aggNode-&gt;getSequence().push_back(left);
</del><ins>+            aggNode-&gt;getSequence()-&gt;push_back(left);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (right)
</span><del>-        aggNode-&gt;getSequence().push_back(right);
</del><ins>+        aggNode-&gt;getSequence()-&gt;push_back(right);
</ins><span class="cx"> 
</span><span class="cx">     aggNode-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="lines">@@ -575,15 +230,16 @@
</span><span class="cx"> //
</span><span class="cx"> // Turn an existing node into an aggregate.
</span><span class="cx"> //
</span><del>-// Returns an aggregate, unless 0 was passed in for the existing node.
</del><ins>+// Returns an aggregate, unless NULL was passed in for the existing node.
</ins><span class="cx"> //
</span><del>-TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc&amp; line)
</del><ins>+TIntermAggregate *TIntermediate::makeAggregate(
+    TIntermNode *node, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    if (node == 0)
-        return 0;
</del><ins>+    if (node == NULL)
+        return NULL;
</ins><span class="cx"> 
</span><del>-    TIntermAggregate* aggNode = new TIntermAggregate;
-    aggNode-&gt;getSequence().push_back(node);
</del><ins>+    TIntermAggregate *aggNode = new TIntermAggregate;
+    aggNode-&gt;getSequence()-&gt;push_back(node);
</ins><span class="cx"> 
</span><span class="cx">     aggNode-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="lines">@@ -597,32 +253,45 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns the selection node created.
</span><span class="cx"> //
</span><del>-TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc&amp; line)
</del><ins>+TIntermNode *TIntermediate::addSelection(
+    TIntermTyped *cond, TIntermNodePair nodePair, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><span class="cx">     //
</span><span class="cx">     // For compile time constant selections, prune the code and
</span><span class="cx">     // test now.
</span><span class="cx">     //
</span><span class="cx"> 
</span><del>-    if (cond-&gt;getAsTyped() &amp;&amp; cond-&gt;getAsTyped()-&gt;getAsConstantUnion()) {
</del><ins>+    if (cond-&gt;getAsTyped() &amp;&amp; cond-&gt;getAsTyped()-&gt;getAsConstantUnion())
+    {
</ins><span class="cx">         if (cond-&gt;getAsConstantUnion()-&gt;getBConst(0) == true)
</span><del>-            return nodePair.node1 ? setAggregateOperator(nodePair.node1, EOpSequence, nodePair.node1-&gt;getLine()) : NULL;
</del><ins>+        {
+            return nodePair.node1 ? setAggregateOperator(
+                nodePair.node1, EOpSequence, nodePair.node1-&gt;getLine()) : NULL;
+        }
</ins><span class="cx">         else
</span><del>-            return nodePair.node2 ? setAggregateOperator(nodePair.node2, EOpSequence, nodePair.node2-&gt;getLine()) : NULL;
</del><ins>+        {
+            return nodePair.node2 ? setAggregateOperator(
+                nodePair.node2, EOpSequence, nodePair.node2-&gt;getLine()) : NULL;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2);
</del><ins>+    TIntermSelection *node = new TIntermSelection(
+        cond, nodePair.node1, nodePair.node2);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TIntermediate::addComma(
+    TIntermTyped *left, TIntermTyped *right, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    if (left-&gt;getType().getQualifier() == EvqConst &amp;&amp; right-&gt;getType().getQualifier() == EvqConst) {
</del><ins>+    if (left-&gt;getType().getQualifier() == EvqConst &amp;&amp;
+        right-&gt;getType().getQualifier() == EvqConst)
+    {
</ins><span class="cx">         return right;
</span><del>-    } else {
</del><ins>+    }
+    else
+    {
</ins><span class="cx">         TIntermTyped *commaAggregate = growAggregate(left, right, line);
</span><span class="cx">         commaAggregate-&gt;getAsAggregate()-&gt;setOp(EOpComma);
</span><span class="cx">         commaAggregate-&gt;setType(right-&gt;getType());
</span><span class="lines">@@ -636,29 +305,21 @@
</span><span class="cx"> // a true path, and a false path.  The two paths are specified
</span><span class="cx"> // as separate parameters.
</span><span class="cx"> //
</span><del>-// Returns the selection node created, or 0 if one could not be.
</del><ins>+// Returns the selection node created, or one of trueBlock and falseBlock if the expression could be folded.
</ins><span class="cx"> //
</span><del>-TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TIntermediate::addSelection(TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock,
+                                          const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    //
-    // Get compatible types.
-    //
-    TIntermTyped* child = addConversion(EOpSequence, trueBlock-&gt;getType(), falseBlock);
-    if (child)
-        falseBlock = child;
-    else {
-        child = addConversion(EOpSequence, falseBlock-&gt;getType(), trueBlock);
-        if (child)
-            trueBlock = child;
-        else
-            return 0;
-    }
-
-    //
-    // See if all the operands are constant, then fold it otherwise not.
-    //
-
-    if (cond-&gt;getAsConstantUnion() &amp;&amp; trueBlock-&gt;getAsConstantUnion() &amp;&amp; falseBlock-&gt;getAsConstantUnion()) {
</del><ins>+    // Right now it's safe to fold ternary operators only when all operands
+    // are constant. If only the condition is constant, it's theoretically
+    // possible to fold the ternary operator, but that requires making sure
+    // that the node returned from here won't be treated as a constant
+    // expression in case the node that gets eliminated was not a constant
+    // expression.
+    if (cond-&gt;getAsConstantUnion() &amp;&amp;
+        trueBlock-&gt;getAsConstantUnion() &amp;&amp;
+        falseBlock-&gt;getAsConstantUnion())
+    {
</ins><span class="cx">         if (cond-&gt;getAsConstantUnion()-&gt;getBConst(0))
</span><span class="cx">             return trueBlock;
</span><span class="cx">         else
</span><span class="lines">@@ -668,42 +329,64 @@
</span><span class="cx">     //
</span><span class="cx">     // Make a selection node.
</span><span class="cx">     //
</span><del>-    TIntermSelection* node = new TIntermSelection(cond, trueBlock, falseBlock, trueBlock-&gt;getType());
</del><ins>+    TIntermSelection *node = new TIntermSelection(cond, trueBlock, falseBlock, trueBlock-&gt;getType());
</ins><span class="cx">     node-&gt;getTypePointer()-&gt;setQualifier(EvqTemporary);
</span><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TIntermSwitch *TIntermediate::addSwitch(
+    TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &amp;line)
+{
+    TIntermSwitch *node = new TIntermSwitch(init, statementList);
+    node-&gt;setLine(line);
+
+    return node;
+}
+
+TIntermCase *TIntermediate::addCase(
+    TIntermTyped *condition, const TSourceLoc &amp;line)
+{
+    TIntermCase *node = new TIntermCase(condition);
+    node-&gt;setLine(line);
+
+    return node;
+}
+
</ins><span class="cx"> //
</span><span class="cx"> // Constant terminal nodes.  Has a union that contains bool, float or int constants
</span><span class="cx"> //
</span><span class="cx"> // Returns the constant union node created.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType&amp; t, const TSourceLoc&amp; line)
</del><ins>+TIntermConstantUnion *TIntermediate::addConstantUnion(
+    TConstantUnion *constantUnion, const TType &amp;type, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t);
</del><ins>+    TIntermConstantUnion *node = new TIntermConstantUnion(constantUnion, type);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermTyped* TIntermediate::addSwizzle(TVectorFields&amp; fields, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TIntermediate::addSwizzle(
+    TVectorFields &amp;fields, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><span class="cx"> 
</span><del>-    TIntermAggregate* node = new TIntermAggregate(EOpSequence);
</del><ins>+    TIntermAggregate *node = new TIntermAggregate(EOpSequence);
</ins><span class="cx"> 
</span><span class="cx">     node-&gt;setLine(line);
</span><del>-    TIntermConstantUnion* constIntNode;
-    TIntermSequence &amp;sequenceVector = node-&gt;getSequence();
-    ConstantUnion* unionArray;
</del><ins>+    TIntermConstantUnion *constIntNode;
+    TIntermSequence *sequenceVector = node-&gt;getSequence();
+    TConstantUnion *unionArray;
</ins><span class="cx"> 
</span><del>-    for (int i = 0; i &lt; fields.num; i++) {
-        unionArray = new ConstantUnion[1];
</del><ins>+    for (int i = 0; i &lt; fields.num; i++)
+    {
+        unionArray = new TConstantUnion[1];
</ins><span class="cx">         unionArray-&gt;setIConst(fields.offsets[i]);
</span><del>-        constIntNode = addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), line);
-        sequenceVector.push_back(constIntNode);
</del><ins>+        constIntNode = addConstantUnion(
+            unionArray, TType(EbtInt, EbpUndefined, EvqConst), line);
+        sequenceVector-&gt;push_back(constIntNode);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="lines">@@ -712,9 +395,11 @@
</span><span class="cx"> //
</span><span class="cx"> // Create loop nodes.
</span><span class="cx"> //
</span><del>-TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTyped* cond, TIntermTyped* expr, TIntermNode* body, const TSourceLoc&amp; line)
</del><ins>+TIntermNode *TIntermediate::addLoop(
+    TLoopType type, TIntermNode *init, TIntermTyped *cond, TIntermTyped *expr,
+    TIntermNode *body, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    TIntermNode* node = new TIntermLoop(type, init, cond, expr, body);
</del><ins>+    TIntermNode *node = new TIntermLoop(type, init, cond, expr, body);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="lines">@@ -723,14 +408,16 @@
</span><span class="cx"> //
</span><span class="cx"> // Add branches.
</span><span class="cx"> //
</span><del>-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc&amp; line)
</del><ins>+TIntermBranch* TIntermediate::addBranch(
+    TOperator branchOp, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><span class="cx">     return addBranch(branchOp, 0, line);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc&amp; line)
</del><ins>+TIntermBranch* TIntermediate::addBranch(
+    TOperator branchOp, TIntermTyped *expression, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    TIntermBranch* node = new TIntermBranch(branchOp, expression);
</del><ins>+    TIntermBranch *node = new TIntermBranch(branchOp, expression);
</ins><span class="cx">     node-&gt;setLine(line);
</span><span class="cx"> 
</span><span class="cx">     return node;
</span><span class="lines">@@ -740,1096 +427,17 @@
</span><span class="cx"> // This is to be executed once the final root is put on top by the parsing
</span><span class="cx"> // process.
</span><span class="cx"> //
</span><del>-bool TIntermediate::postProcess(TIntermNode* root)
</del><ins>+bool TIntermediate::postProcess(TIntermNode *root)
</ins><span class="cx"> {
</span><del>-    if (root == 0)
</del><ins>+    if (root == NULL)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // First, finish off the top level sequence, if any
</span><span class="cx">     //
</span><del>-    TIntermAggregate* aggRoot = root-&gt;getAsAggregate();
</del><ins>+    TIntermAggregate *aggRoot = root-&gt;getAsAggregate();
</ins><span class="cx">     if (aggRoot &amp;&amp; aggRoot-&gt;getOp() == EOpNull)
</span><span class="cx">         aggRoot-&gt;setOp(EOpSequence);
</span><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><del>-
-//
-// This deletes the tree.
-//
-void TIntermediate::remove(TIntermNode* root)
-{
-    if (root)
-        RemoveAllTreeNodes(root);
-}
-
-////////////////////////////////////////////////////////////////
-//
-// Member functions of the nodes used for building the tree.
-//
-////////////////////////////////////////////////////////////////
-
-#define REPLACE_IF_IS(node, type, original, replacement) \
-    if (node == original) { \
-        node = static_cast&lt;type *&gt;(replacement); \
-        return true; \
-    }
-
-bool TIntermLoop::replaceChildNode(
-    TIntermNode *original, TIntermNode *replacement)
-{
-    REPLACE_IF_IS(init, TIntermNode, original, replacement);
-    REPLACE_IF_IS(cond, TIntermTyped, original, replacement);
-    REPLACE_IF_IS(expr, TIntermTyped, original, replacement);
-    REPLACE_IF_IS(body, TIntermNode, original, replacement);
-    return false;
-}
-
-void TIntermLoop::enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const
-{
-    if (init)
-    {
-        nodeQueue-&gt;push(init);
-    }
-    if (cond)
-    {
-        nodeQueue-&gt;push(cond);
-    }
-    if (expr)
-    {
-        nodeQueue-&gt;push(expr);
-    }
-    if (body)
-    {
-        nodeQueue-&gt;push(body);
-    }
-}
-
-bool TIntermBranch::replaceChildNode(
-    TIntermNode *original, TIntermNode *replacement)
-{
-    REPLACE_IF_IS(expression, TIntermTyped, original, replacement);
-    return false;
-}
-
-void TIntermBranch::enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const
-{
-    if (expression)
-    {
-        nodeQueue-&gt;push(expression);
-    }
-}
-
-bool TIntermBinary::replaceChildNode(
-    TIntermNode *original, TIntermNode *replacement)
-{
-    REPLACE_IF_IS(left, TIntermTyped, original, replacement);
-    REPLACE_IF_IS(right, TIntermTyped, original, replacement);
-    return false;
-}
-
-void TIntermBinary::enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const
-{
-    if (left)
-    {
-        nodeQueue-&gt;push(left);
-    }
-    if (right)
-    {
-        nodeQueue-&gt;push(right);
-    }
-}
-
-bool TIntermUnary::replaceChildNode(
-    TIntermNode *original, TIntermNode *replacement)
-{
-    REPLACE_IF_IS(operand, TIntermTyped, original, replacement);
-    return false;
-}
-
-void TIntermUnary::enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const
-{
-    if (operand)
-    {
-        nodeQueue-&gt;push(operand);
-    }
-}
-
-bool TIntermAggregate::replaceChildNode(
-    TIntermNode *original, TIntermNode *replacement)
-{
-    for (size_t ii = 0; ii &lt; sequence.size(); ++ii)
-    {
-        REPLACE_IF_IS(sequence[ii], TIntermNode, original, replacement);
-    }
-    return false;
-}
-
-void TIntermAggregate::enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const
-{
-    for (size_t childIndex = 0; childIndex &lt; sequence.size(); childIndex++)
-    {
-        nodeQueue-&gt;push(sequence[childIndex]);
-    }
-}
-
-bool TIntermSelection::replaceChildNode(
-    TIntermNode *original, TIntermNode *replacement)
-{
-    REPLACE_IF_IS(condition, TIntermTyped, original, replacement);
-    REPLACE_IF_IS(trueBlock, TIntermNode, original, replacement);
-    REPLACE_IF_IS(falseBlock, TIntermNode, original, replacement);
-    return false;
-}
-
-void TIntermSelection::enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const
-{
-    if (condition)
-    {
-        nodeQueue-&gt;push(condition);
-    }
-    if (trueBlock)
-    {
-        nodeQueue-&gt;push(trueBlock);
-    }
-    if (falseBlock)
-    {
-        nodeQueue-&gt;push(falseBlock);
-    }
-}
-
-//
-// Say whether or not an operation node changes the value of a variable.
-//
-bool TIntermOperator::isAssignment() const
-{
-    switch (op) {
-        case EOpPostIncrement:
-        case EOpPostDecrement:
-        case EOpPreIncrement:
-        case EOpPreDecrement:
-        case EOpAssign:
-        case EOpAddAssign:
-        case EOpSubAssign:
-        case EOpMulAssign:
-        case EOpVectorTimesMatrixAssign:
-        case EOpVectorTimesScalarAssign:
-        case EOpMatrixTimesScalarAssign:
-        case EOpMatrixTimesMatrixAssign:
-        case EOpDivAssign:
-            return true;
-        default:
-            return false;
-    }
-}
-
-//
-// returns true if the operator is for one of the constructors
-//
-bool TIntermOperator::isConstructor() const
-{
-    switch (op) {
-        case EOpConstructVec2:
-        case EOpConstructVec3:
-        case EOpConstructVec4:
-        case EOpConstructMat2:
-        case EOpConstructMat3:
-        case EOpConstructMat4:
-        case EOpConstructFloat:
-        case EOpConstructIVec2:
-        case EOpConstructIVec3:
-        case EOpConstructIVec4:
-        case EOpConstructInt:
-        case EOpConstructUVec2:
-        case EOpConstructUVec3:
-        case EOpConstructUVec4:
-        case EOpConstructUInt:
-        case EOpConstructBVec2:
-        case EOpConstructBVec3:
-        case EOpConstructBVec4:
-        case EOpConstructBool:
-        case EOpConstructStruct:
-            return true;
-        default:
-            return false;
-    }
-}
-
-//
-// Make sure the type of a unary operator is appropriate for its
-// combination of operation and operand type.
-//
-// Returns false in nothing makes sense.
-//
-bool TIntermUnary::promote(TInfoSink&amp;)
-{
-    switch (op) {
-        case EOpLogicalNot:
-            if (operand-&gt;getBasicType() != EbtBool)
-                return false;
-            break;
-        case EOpNegative:
-        case EOpPostIncrement:
-        case EOpPostDecrement:
-        case EOpPreIncrement:
-        case EOpPreDecrement:
-            if (operand-&gt;getBasicType() == EbtBool)
-                return false;
-            break;
-
-            // operators for built-ins are already type checked against their prototype
-        case EOpAny:
-        case EOpAll:
-        case EOpVectorLogicalNot:
-            return true;
-
-        default:
-            if (operand-&gt;getBasicType() != EbtFloat)
-                return false;
-    }
-
-    setType(operand-&gt;getType());
-    type.setQualifier(EvqTemporary);
-
-    return true;
-}
-
-bool validateMultiplication(TOperator op, const TType &amp;left, const TType &amp;right)
-{
-    switch (op)
-    {
-      case EOpMul:
-      case EOpMulAssign:
-        return left.getNominalSize() == right.getNominalSize() &amp;&amp; left.getSecondarySize() == right.getSecondarySize();
-      case EOpVectorTimesScalar:
-      case EOpVectorTimesScalarAssign:
-        return true;
-      case EOpVectorTimesMatrix:
-        return left.getNominalSize() == right.getRows();
-      case EOpVectorTimesMatrixAssign:
-        return left.getNominalSize() == right.getRows() &amp;&amp; left.getNominalSize() == right.getCols();
-      case EOpMatrixTimesVector:
-        return left.getCols() == right.getNominalSize();
-      case EOpMatrixTimesScalar:
-      case EOpMatrixTimesScalarAssign:
-        return true;
-      case EOpMatrixTimesMatrix:
-        return left.getCols() == right.getRows();
-      case EOpMatrixTimesMatrixAssign:
-        return left.getCols() == right.getCols() &amp;&amp; left.getRows() == right.getRows();
-
-      default:
-        UNREACHABLE();
-        return false;
-    }
-}
-
-//
-// Establishes the type of the resultant operation, as well as
-// makes the operator the correct one for the operands.
-//
-// Returns false if operator can't work on operands.
-//
-bool TIntermBinary::promote(TInfoSink&amp; infoSink)
-{
-    // This function only handles scalars, vectors, and matrices.
-    if (left-&gt;isArray() || right-&gt;isArray())
-    {
-        infoSink.info.message(EPrefixInternalError, getLine(), &quot;Invalid operation for arrays&quot;);
-        return false;
-    }
-
-    // GLSL ES 2.0 does not support implicit type casting.
-    // So the basic type should always match.
-    if (left-&gt;getBasicType() != right-&gt;getBasicType())
-        return false;
-
-    //
-    // Base assumption:  just make the type the same as the left
-    // operand.  Then only deviations from this need be coded.
-    //
-    setType(left-&gt;getType());
-
-    // The result gets promoted to the highest precision.
-    TPrecision higherPrecision = GetHigherPrecision(left-&gt;getPrecision(), right-&gt;getPrecision());
-    getTypePointer()-&gt;setPrecision(higherPrecision);
-
-    // Binary operations results in temporary variables unless both
-    // operands are const.
-    if (left-&gt;getQualifier() != EvqConst || right-&gt;getQualifier() != EvqConst)
-    {
-        getTypePointer()-&gt;setQualifier(EvqTemporary);
-    }
-
-    const int nominalSize = std::max(left-&gt;getNominalSize(), right-&gt;getNominalSize());
-
-    //
-    // All scalars or structs. Code after this test assumes this case is removed!
-    //
-    if (nominalSize == 1)
-    {
-        switch (op)
-        {
-            //
-            // Promote to conditional
-            //
-            case EOpEqual:
-            case EOpNotEqual:
-            case EOpLessThan:
-            case EOpGreaterThan:
-            case EOpLessThanEqual:
-            case EOpGreaterThanEqual:
-                setType(TType(EbtBool, EbpUndefined));
-                break;
-
-            //
-            // And and Or operate on conditionals
-            //
-            case EOpLogicalAnd:
-            case EOpLogicalOr:
-                // Both operands must be of type bool.
-                if (left-&gt;getBasicType() != EbtBool || right-&gt;getBasicType() != EbtBool)
-                {
-                    return false;
-                }
-                setType(TType(EbtBool, EbpUndefined));
-                break;
-
-            default:
-                break;
-        }
-        return true;
-    }
-
-    // If we reach here, at least one of the operands is vector or matrix.
-    // The other operand could be a scalar, vector, or matrix.
-    // Can these two operands be combined?
-    //
-    TBasicType basicType = left-&gt;getBasicType();
-    switch (op)
-    {
-        case EOpMul:
-            if (!left-&gt;isMatrix() &amp;&amp; right-&gt;isMatrix())
-            {
-                if (left-&gt;isVector())
-                {
-                    op = EOpVectorTimesMatrix;
-                    setType(TType(basicType, higherPrecision, EvqTemporary, right-&gt;getCols(), 1));
-                }
-                else
-                {
-                    op = EOpMatrixTimesScalar;
-                    setType(TType(basicType, higherPrecision, EvqTemporary, right-&gt;getCols(), right-&gt;getRows()));
-                }
-            }
-            else if (left-&gt;isMatrix() &amp;&amp; !right-&gt;isMatrix())
-            {
-                if (right-&gt;isVector())
-                {
-                    op = EOpMatrixTimesVector;
-                    setType(TType(basicType, higherPrecision, EvqTemporary, left-&gt;getRows(), 1));
-                }
-                else
-                {
-                    op = EOpMatrixTimesScalar;
-                }
-            }
-            else if (left-&gt;isMatrix() &amp;&amp; right-&gt;isMatrix())
-            {
-                op = EOpMatrixTimesMatrix;
-                setType(TType(basicType, higherPrecision, EvqTemporary, right-&gt;getCols(), left-&gt;getRows()));
-            }
-            else if (!left-&gt;isMatrix() &amp;&amp; !right-&gt;isMatrix())
-            {
-                if (left-&gt;isVector() &amp;&amp; right-&gt;isVector())
-                {
-                    // leave as component product
-                }
-                else if (left-&gt;isVector() || right-&gt;isVector())
-                {
-                    op = EOpVectorTimesScalar;
-                    setType(TType(basicType, higherPrecision, EvqTemporary, nominalSize, 1));
-                }
-            }
-            else
-            {
-                infoSink.info.message(EPrefixInternalError, getLine(), &quot;Missing elses&quot;);
-                return false;
-            }
-
-            if (!validateMultiplication(op, left-&gt;getType(), right-&gt;getType()))
-            {
-                return false;
-            }
-            break;
-
-        case EOpMulAssign:
-            if (!left-&gt;isMatrix() &amp;&amp; right-&gt;isMatrix())
-            {
-                if (left-&gt;isVector())
-                {
-                    op = EOpVectorTimesMatrixAssign;
-                }
-                else
-                {
-                    return false;
-                }
-            }
-            else if (left-&gt;isMatrix() &amp;&amp; !right-&gt;isMatrix())
-            {
-                if (right-&gt;isVector())
-                {
-                    return false;
-                }
-                else
-                {
-                    op = EOpMatrixTimesScalarAssign;
-                }
-            }
-            else if (left-&gt;isMatrix() &amp;&amp; right-&gt;isMatrix())
-            {
-                op = EOpMatrixTimesMatrixAssign;
-                setType(TType(basicType, higherPrecision, EvqTemporary, right-&gt;getCols(), left-&gt;getRows()));
-            }
-            else if (!left-&gt;isMatrix() &amp;&amp; !right-&gt;isMatrix())
-            {
-                if (left-&gt;isVector() &amp;&amp; right-&gt;isVector())
-                {
-                    // leave as component product
-                }
-                else if (left-&gt;isVector() || right-&gt;isVector())
-                {
-                    if (! left-&gt;isVector())
-                        return false;
-                    op = EOpVectorTimesScalarAssign;
-                    setType(TType(basicType, higherPrecision, EvqTemporary, left-&gt;getNominalSize(), 1));
-                }
-            }
-            else
-            {
-                infoSink.info.message(EPrefixInternalError, getLine(), &quot;Missing elses&quot;);
-                return false;
-            }
-
-            if (!validateMultiplication(op, left-&gt;getType(), right-&gt;getType()))
-            {
-                return false;
-            }
-            break;
-
-        case EOpAssign:
-        case EOpInitialize:
-        case EOpAdd:
-        case EOpSub:
-        case EOpDiv:
-        case EOpAddAssign:
-        case EOpSubAssign:
-        case EOpDivAssign:
-            {
-                if ((left-&gt;isMatrix() &amp;&amp; right-&gt;isVector()) ||
-                    (left-&gt;isVector() &amp;&amp; right-&gt;isMatrix()))
-                    return false;
-
-                // Are the sizes compatible?
-                if (left-&gt;getNominalSize() != right-&gt;getNominalSize() || left-&gt;getSecondarySize() != right-&gt;getSecondarySize())
-                {
-                    // If the nominal size of operands do not match:
-                    // One of them must be scalar.
-                    if (!left-&gt;isScalar() &amp;&amp; !right-&gt;isScalar())
-                        return false;
-
-                    // Operator cannot be of type pure assignment.
-                    if (op == EOpAssign || op == EOpInitialize)
-                        return false;
-                }
-
-                const int secondarySize = std::max(left-&gt;getSecondarySize(), right-&gt;getSecondarySize());
-
-                setType(TType(basicType, higherPrecision, EvqTemporary, nominalSize, secondarySize));
-            }
-            break;
-
-        case EOpEqual:
-        case EOpNotEqual:
-        case EOpLessThan:
-        case EOpGreaterThan:
-        case EOpLessThanEqual:
-        case EOpGreaterThanEqual:
-            if ((left-&gt;getNominalSize() != right-&gt;getNominalSize()) ||
-                (left-&gt;getSecondarySize() != right-&gt;getSecondarySize()))
-                return false;
-            setType(TType(EbtBool, EbpUndefined));
-            break;
-
-        default:
-            return false;
-    }
-    
-    return true;
-}
-
-bool CompareStruct(const TType&amp; leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
-{
-    const TFieldList&amp; fields = leftNodeType.getStruct()-&gt;fields();
-
-    size_t structSize = fields.size();
-    size_t index = 0;
-
-    for (size_t j = 0; j &lt; structSize; j++) {
-        size_t size = fields[j]-&gt;type()-&gt;getObjectSize();
-        for (size_t i = 0; i &lt; size; i++) {
-            if (fields[j]-&gt;type()-&gt;getBasicType() == EbtStruct) {
-                if (!CompareStructure(*fields[j]-&gt;type(), &amp;rightUnionArray[index], &amp;leftUnionArray[index]))
-                    return false;
-            } else {
-                if (leftUnionArray[index] != rightUnionArray[index])
-                    return false;
-                index++;
-            }
-
-        }
-    }
-    return true;
-}
-
-bool CompareStructure(const TType&amp; leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
-{
-    if (leftNodeType.isArray()) {
-        TType typeWithoutArrayness = leftNodeType;
-        typeWithoutArrayness.clearArrayness();
-
-        size_t arraySize = leftNodeType.getArraySize();
-
-        for (size_t i = 0; i &lt; arraySize; ++i) {
-            size_t offset = typeWithoutArrayness.getObjectSize() * i;
-            if (!CompareStruct(typeWithoutArrayness, &amp;rightUnionArray[offset], &amp;leftUnionArray[offset]))
-                return false;
-        }
-    } else
-        return CompareStruct(leftNodeType, rightUnionArray, leftUnionArray);
-
-    return true;
-}
-
-//
-// The fold functions see if an operation on a constant can be done in place,
-// without generating run-time code.
-//
-// Returns the node to keep using, which may or may not be the node passed in.
-//
-
-TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink&amp; infoSink)
-{
-    ConstantUnion *unionArray = getUnionArrayPointer();
-
-    if (!unionArray)
-        return 0;
-
-    size_t objectSize = getType().getObjectSize();
-
-    if (constantNode)
-    {
-        // binary operations
-        TIntermConstantUnion *node = constantNode-&gt;getAsConstantUnion();
-        ConstantUnion *rightUnionArray = node-&gt;getUnionArrayPointer();
-        TType returnType = getType();
-
-        if (!rightUnionArray)
-            return 0;
-
-        // for a case like float f = 1.2 + vec4(2,3,4,5);
-        if (constantNode-&gt;getType().getObjectSize() == 1 &amp;&amp; objectSize &gt; 1)
-        {
-            rightUnionArray = new ConstantUnion[objectSize];
-            for (size_t i = 0; i &lt; objectSize; ++i)
-            {
-                rightUnionArray[i] = *node-&gt;getUnionArrayPointer();
-            }
-            returnType = getType();
-        }
-        else if (constantNode-&gt;getType().getObjectSize() &gt; 1 &amp;&amp; objectSize == 1)
-        {
-            // for a case like float f = vec4(2,3,4,5) + 1.2;
-            unionArray = new ConstantUnion[constantNode-&gt;getType().getObjectSize()];
-            for (size_t i = 0; i &lt; constantNode-&gt;getType().getObjectSize(); ++i)
-            {
-                unionArray[i] = *getUnionArrayPointer();
-            }
-            returnType = node-&gt;getType();
-            objectSize = constantNode-&gt;getType().getObjectSize();
-        }
-
-        ConstantUnion* tempConstArray = 0;
-        TIntermConstantUnion *tempNode;
-
-        bool boolNodeFlag = false;
-        switch(op) {
-          case EOpAdd:
-            tempConstArray = new ConstantUnion[objectSize];
-            {
-                for (size_t i = 0; i &lt; objectSize; i++)
-                    tempConstArray[i] = unionArray[i] + rightUnionArray[i];
-            }
-            break;
-          case EOpSub:
-            tempConstArray = new ConstantUnion[objectSize];
-            {
-                for (size_t i = 0; i &lt; objectSize; i++)
-                    tempConstArray[i] = unionArray[i] - rightUnionArray[i];
-            }
-            break;
-
-          case EOpMul:
-          case EOpVectorTimesScalar:
-          case EOpMatrixTimesScalar:
-            tempConstArray = new ConstantUnion[objectSize];
-            {
-                for (size_t i = 0; i &lt; objectSize; i++)
-                    tempConstArray[i] = unionArray[i] * rightUnionArray[i];
-            }
-            break;
-
-          case EOpMatrixTimesMatrix:
-            {
-                if (getType().getBasicType() != EbtFloat || node-&gt;getBasicType() != EbtFloat)
-                {
-                    infoSink.info.message(EPrefixInternalError, getLine(), &quot;Constant Folding cannot be done for matrix multiply&quot;);
-                    return 0;
-                }
-
-                const int leftCols = getCols();
-                const int leftRows = getRows();
-                const int rightCols = constantNode-&gt;getType().getCols();
-                const int rightRows = constantNode-&gt;getType().getRows();
-                const int resultCols = rightCols;
-                const int resultRows = leftRows;
-
-                tempConstArray = new ConstantUnion[resultCols*resultRows];
-                for (int row = 0; row &lt; resultRows; row++)
-                {
-                    for (int column = 0; column &lt; resultCols; column++)
-                    {
-                        tempConstArray[resultRows * column + row].setFConst(0.0f);
-                        for (int i = 0; i &lt; leftCols; i++)
-                        {
-                            tempConstArray[resultRows * column + row].setFConst(tempConstArray[resultRows * column + row].getFConst() + unionArray[i * leftRows + row].getFConst() * (rightUnionArray[column * rightRows + i].getFConst()));
-                        }
-                    }
-                }
-
-                // update return type for matrix product
-                returnType.setPrimarySize(resultCols);
-                returnType.setSecondarySize(resultRows);
-            }
-            break;
-
-          case EOpDiv:
-            {
-                tempConstArray = new ConstantUnion[objectSize];
-                for (size_t i = 0; i &lt; objectSize; i++)
-                {
-                    switch (getType().getBasicType())
-                    {
-                      case EbtFloat:
-                        if (rightUnionArray[i] == 0.0f)
-                        {
-                            infoSink.info.message(EPrefixWarning, getLine(), &quot;Divide by zero error during constant folding&quot;);
-                            tempConstArray[i].setFConst(unionArray[i].getFConst() &lt; 0 ? -FLT_MAX : FLT_MAX);
-                        }
-                        else
-                        {
-                            tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
-                        }
-                        break;
-
-                      case EbtInt:
-                        if (rightUnionArray[i] == 0)
-                        {
-                            infoSink.info.message(EPrefixWarning, getLine(), &quot;Divide by zero error during constant folding&quot;);
-                            tempConstArray[i].setIConst(INT_MAX);
-                        }
-                        else
-                        {
-                            tempConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
-                        }
-                        break;
-
-                      case EbtUInt:
-                        if (rightUnionArray[i] == 0)
-                        {
-                            infoSink.info.message(EPrefixWarning, getLine(), &quot;Divide by zero error during constant folding&quot;);
-                            tempConstArray[i].setUConst(UINT_MAX);
-                        }
-                        else
-                        {
-                            tempConstArray[i].setUConst(unionArray[i].getUConst() / rightUnionArray[i].getUConst());
-                        }
-                        break;
-
-                      default:
-                        infoSink.info.message(EPrefixInternalError, getLine(), &quot;Constant folding cannot be done for \&quot;/\&quot;&quot;);
-                        return 0;
-                    }
-                }
-            }
-            break;
-
-          case EOpMatrixTimesVector:
-            {
-                if (node-&gt;getBasicType() != EbtFloat)
-                {
-                    infoSink.info.message(EPrefixInternalError, getLine(), &quot;Constant Folding cannot be done for matrix times vector&quot;);
-                    return 0;
-                }
-
-                const int matrixCols = getCols();
-                const int matrixRows = getRows();
-
-                tempConstArray = new ConstantUnion[matrixRows];
-
-                for (int matrixRow = 0; matrixRow &lt; matrixRows; matrixRow++)
-                {
-                    tempConstArray[matrixRow].setFConst(0.0f);
-                    for (int col = 0; col &lt; matrixCols; col++)
-                    {
-                        tempConstArray[matrixRow].setFConst(tempConstArray[matrixRow].getFConst() + ((unionArray[col * matrixRows + matrixRow].getFConst()) * rightUnionArray[col].getFConst()));
-                    }
-                }
-
-                returnType = node-&gt;getType();
-                returnType.setPrimarySize(matrixRows);
-
-                tempNode = new TIntermConstantUnion(tempConstArray, returnType);
-                tempNode-&gt;setLine(getLine());
-
-                return tempNode;
-            }
-
-          case EOpVectorTimesMatrix:
-            {
-                if (getType().getBasicType() != EbtFloat)
-                {
-                    infoSink.info.message(EPrefixInternalError, getLine(), &quot;Constant Folding cannot be done for vector times matrix&quot;);
-                    return 0;
-                }
-
-                const int matrixCols = constantNode-&gt;getType().getCols();
-                const int matrixRows = constantNode-&gt;getType().getRows();
-
-                tempConstArray = new ConstantUnion[matrixCols];
-
-                for (int matrixCol = 0; matrixCol &lt; matrixCols; matrixCol++)
-                {
-                    tempConstArray[matrixCol].setFConst(0.0f);
-                    for (int matrixRow = 0; matrixRow &lt; matrixRows; matrixRow++)
-                    {
-                        tempConstArray[matrixCol].setFConst(tempConstArray[matrixCol].getFConst() + ((unionArray[matrixRow].getFConst()) * rightUnionArray[matrixCol * matrixRows + matrixRow].getFConst()));
-                    }
-                }
-
-                returnType.setPrimarySize(matrixCols);
-            }
-            break;
-
-          case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
-            {
-                tempConstArray = new ConstantUnion[objectSize];
-                for (size_t i = 0; i &lt; objectSize; i++)
-                {
-                    tempConstArray[i] = unionArray[i] &amp;&amp; rightUnionArray[i];
-                }
-            }
-            break;
-
-          case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
-            {
-                tempConstArray = new ConstantUnion[objectSize];
-                for (size_t i = 0; i &lt; objectSize; i++)
-                {
-                    tempConstArray[i] = unionArray[i] || rightUnionArray[i];
-                }
-            }
-            break;
-
-          case EOpLogicalXor:
-            {
-                tempConstArray = new ConstantUnion[objectSize];
-                for (size_t i = 0; i &lt; objectSize; i++)
-                {
-                    switch (getType().getBasicType())
-                    {
-                      case EbtBool:
-                        tempConstArray[i].setBConst((unionArray[i] == rightUnionArray[i]) ? false : true);
-                        break;
-                      default:
-                        UNREACHABLE();
-                        break;
-                    }
-                }
-            }
-            break;
-
-          case EOpLessThan:
-            assert(objectSize == 1);
-            tempConstArray = new ConstantUnion[1];
-            tempConstArray-&gt;setBConst(*unionArray &lt; *rightUnionArray);
-            returnType = TType(EbtBool, EbpUndefined, EvqConst);
-            break;
-
-          case EOpGreaterThan:
-            assert(objectSize == 1);
-            tempConstArray = new ConstantUnion[1];
-            tempConstArray-&gt;setBConst(*unionArray &gt; *rightUnionArray);
-            returnType = TType(EbtBool, EbpUndefined, EvqConst);
-            break;
-
-          case EOpLessThanEqual:
-            {
-                assert(objectSize == 1);
-                ConstantUnion constant;
-                constant.setBConst(*unionArray &gt; *rightUnionArray);
-                tempConstArray = new ConstantUnion[1];
-                tempConstArray-&gt;setBConst(!constant.getBConst());
-                returnType = TType(EbtBool, EbpUndefined, EvqConst);
-                break;
-            }
-
-          case EOpGreaterThanEqual:
-            {
-                assert(objectSize == 1);
-                ConstantUnion constant;
-                constant.setBConst(*unionArray &lt; *rightUnionArray);
-                tempConstArray = new ConstantUnion[1];
-                tempConstArray-&gt;setBConst(!constant.getBConst());
-                returnType = TType(EbtBool, EbpUndefined, EvqConst);
-                break;
-            }
-
-          case EOpEqual:
-            if (getType().getBasicType() == EbtStruct)
-            {
-                if (!CompareStructure(node-&gt;getType(), node-&gt;getUnionArrayPointer(), unionArray))
-                    boolNodeFlag = true;
-            }
-            else
-            {
-                for (size_t i = 0; i &lt; objectSize; i++)
-                {
-                    if (unionArray[i] != rightUnionArray[i])
-                    {
-                        boolNodeFlag = true;
-                        break;  // break out of for loop
-                    }
-                }
-            }
-
-            tempConstArray = new ConstantUnion[1];
-            if (!boolNodeFlag)
-            {
-                tempConstArray-&gt;setBConst(true);
-            }
-            else
-            {
-                tempConstArray-&gt;setBConst(false);
-            }
-
-            tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
-            tempNode-&gt;setLine(getLine());
-
-            return tempNode;
-
-          case EOpNotEqual:
-            if (getType().getBasicType() == EbtStruct)
-            {
-                if (CompareStructure(node-&gt;getType(), node-&gt;getUnionArrayPointer(), unionArray))
-                    boolNodeFlag = true;
-            }
-            else
-            {
-                for (size_t i = 0; i &lt; objectSize; i++)
-                {
-                    if (unionArray[i] == rightUnionArray[i])
-                    {
-                        boolNodeFlag = true;
-                        break;  // break out of for loop
-                    }
-                }
-            }
-
-            tempConstArray = new ConstantUnion[1];
-            if (!boolNodeFlag)
-            {
-                tempConstArray-&gt;setBConst(true);
-            }
-            else
-            {
-                tempConstArray-&gt;setBConst(false);
-            }
-
-            tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConst));
-            tempNode-&gt;setLine(getLine());
-
-            return tempNode;
-
-          default:
-            infoSink.info.message(EPrefixInternalError, getLine(), &quot;Invalid operator for constant folding&quot;);
-            return 0;
-        }
-        tempNode = new TIntermConstantUnion(tempConstArray, returnType);
-        tempNode-&gt;setLine(getLine());
-
-        return tempNode;
-    }
-    else
-    {
-        //
-        // Do unary operations
-        //
-        TIntermConstantUnion *newNode = 0;
-        ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
-        for (size_t i = 0; i &lt; objectSize; i++)
-        {
-            switch(op)
-            {
-              case EOpNegative:
-                switch (getType().getBasicType())
-                {
-                  case EbtFloat: tempConstArray[i].setFConst(-unionArray[i].getFConst()); break;
-                  case EbtInt:   tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
-                  case EbtUInt:  tempConstArray[i].setUConst(static_cast&lt;unsigned int&gt;(-static_cast&lt;int&gt;(unionArray[i].getUConst()))); break;
-                  default:
-                    infoSink.info.message(EPrefixInternalError, getLine(), &quot;Unary operation not folded into constant&quot;);
-                    return 0;
-                }
-                break;
-
-              case EOpLogicalNot: // this code is written for possible future use, will not get executed currently
-                switch (getType().getBasicType())
-                {
-                  case EbtBool:  tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
-                  default:
-                    infoSink.info.message(EPrefixInternalError, getLine(), &quot;Unary operation not folded into constant&quot;);
-                    return 0;
-                }
-                break;
-
-              default:
-                return 0;
-            }
-        }
-        newNode = new TIntermConstantUnion(tempConstArray, getType());
-        newNode-&gt;setLine(getLine());
-        return newNode;
-    }
-}
-
-TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
-{
-    size_t size = node-&gt;getType().getObjectSize();
-
-    ConstantUnion *leftUnionArray = new ConstantUnion[size];
-
-    for (size_t i=0; i &lt; size; i++) {
-
-        switch (promoteTo) {
-            case EbtFloat:
-                switch (node-&gt;getType().getBasicType()) {
-                    case EbtInt:
-                        leftUnionArray[i].setFConst(static_cast&lt;float&gt;(node-&gt;getIConst(i)));
-                        break;
-                    case EbtUInt:
-                        leftUnionArray[i].setFConst(static_cast&lt;float&gt;(node-&gt;getUConst(i)));
-                        break;
-                    case EbtBool:
-                        leftUnionArray[i].setFConst(static_cast&lt;float&gt;(node-&gt;getBConst(i)));
-                        break;
-                    case EbtFloat:
-                        leftUnionArray[i].setFConst(static_cast&lt;float&gt;(node-&gt;getFConst(i)));
-                        break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Cannot promote&quot;);
-                        return 0;
-                }
-                break;
-            case EbtInt:
-                switch (node-&gt;getType().getBasicType()) {
-                    case EbtInt:
-                        leftUnionArray[i].setIConst(static_cast&lt;int&gt;(node-&gt;getIConst(i)));
-                        break;
-                    case EbtUInt:
-                        leftUnionArray[i].setIConst(static_cast&lt;int&gt;(node-&gt;getUConst(i)));
-                        break;
-                    case EbtBool:
-                        leftUnionArray[i].setIConst(static_cast&lt;int&gt;(node-&gt;getBConst(i)));
-                        break;
-                    case EbtFloat:
-                        leftUnionArray[i].setIConst(static_cast&lt;int&gt;(node-&gt;getFConst(i)));
-                        break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Cannot promote&quot;);
-                        return 0;
-                }
-                break;
-            case EbtUInt:
-                switch (node-&gt;getType().getBasicType()) {
-                    case EbtInt:
-                        leftUnionArray[i].setUConst(static_cast&lt;unsigned int&gt;(node-&gt;getIConst(i)));
-                        break;
-                    case EbtUInt:
-                        leftUnionArray[i].setUConst(static_cast&lt;unsigned int&gt;(node-&gt;getUConst(i)));
-                        break;
-                    case EbtBool:
-                        leftUnionArray[i].setUConst(static_cast&lt;unsigned int&gt;(node-&gt;getBConst(i)));
-                        break;
-                    case EbtFloat:
-                        leftUnionArray[i].setUConst(static_cast&lt;unsigned int&gt;(node-&gt;getFConst(i)));
-                        break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Cannot promote&quot;);
-                        return 0;
-                }
-                break;
-            case EbtBool:
-                switch (node-&gt;getType().getBasicType()) {
-                    case EbtInt:
-                        leftUnionArray[i].setBConst(node-&gt;getIConst(i) != 0);
-                        break;
-                    case EbtUInt:
-                        leftUnionArray[i].setBConst(node-&gt;getUConst(i) != 0);
-                        break;
-                    case EbtBool:
-                        leftUnionArray[i].setBConst(node-&gt;getBConst(i));
-                        break;
-                    case EbtFloat:
-                        leftUnionArray[i].setBConst(node-&gt;getFConst(i) != 0.0f);
-                        break;
-                    default:
-                        infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Cannot promote&quot;);
-                        return 0;
-                }
-
-                break;
-            default:
-                infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Incorrect data type found&quot;);
-                return 0;
-        }
-
-    }
-
-    const TType&amp; t = node-&gt;getType();
-
-    return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.getSecondarySize(), t.isArray()), node-&gt;getLine());
-}
-
-// static
-TString TIntermTraverser::hash(const TString&amp; name, ShHashFunction64 hashFunction)
-{
-    if (hashFunction == NULL || name.empty())
-        return name;
-    khronos_uint64_t number = (*hashFunction)(name.c_str(), name.length());
-    TStringStream stream;
-    stream &lt;&lt; HASHED_NAME_PREFIX &lt;&lt; std::hex &lt;&lt; number;
-    TString hashedName = stream.str();
-    return hashedName;
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorLoopInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -93,9 +93,9 @@
</span><span class="cx"> 
</span><span class="cx">     // Here we assume all the operations are valid, because the loop node is
</span><span class="cx">     // already validated in ValidateLimitations.
</span><del>-    TIntermSequence &amp;declSeq =
</del><ins>+    TIntermSequence *declSeq =
</ins><span class="cx">         node-&gt;getInit()-&gt;getAsAggregate()-&gt;getSequence();
</span><del>-    TIntermBinary *declInit = declSeq[0]-&gt;getAsBinaryNode();
</del><ins>+    TIntermBinary *declInit = (*declSeq)[0]-&gt;getAsBinaryNode();
</ins><span class="cx">     TIntermSymbol *symbol = declInit-&gt;getLeft()-&gt;getAsSymbolNode();
</span><span class="cx"> 
</span><span class="cx">     mId = symbol-&gt;getId();
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorLoopInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/LoopInfo.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_TRANSLATOR_LOOP_INFO_H_
-#define COMPILER_TRANSLATOR_LOOP_INFO_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_LOOPINFO_H_
+#define COMPILER_TRANSLATOR_LOOPINFO_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> class TLoopIndexInfo
</span><span class="cx"> {
</span><span class="lines">@@ -76,5 +76,5 @@
</span><span class="cx">     void pop();
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // COMPILER_TRANSLATOR_LOOP_INDEX_H_
</del><ins>+#endif // COMPILER_TRANSLATOR_LOOPINFO_H_
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorMMaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MMap.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MMap.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/MMap.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _MMAP_INCLUDED_
-#define _MMAP_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_MMAP_H_
+#define COMPILER_TRANSLATOR_MMAP_H_
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Encapsulate memory mapped files
</span><span class="lines">@@ -53,4 +53,4 @@
</span><span class="cx">     char*           fBuff;      // the actual data;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // _MMAP_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_MMAP_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorNodeSearchh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/NodeSearch.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/NodeSearch.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/NodeSearch.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,10 +6,10 @@
</span><span class="cx"> // NodeSearch.h: Utilities for searching translator node graphs
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef TRANSLATOR_NODESEARCH_H_
-#define TRANSLATOR_NODESEARCH_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_NODESEARCH_H_
+#define COMPILER_TRANSLATOR_NODESEARCH_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="lines">@@ -77,4 +77,4 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif // TRANSLATOR_NODESEARCH_H_
</del><ins>+#endif // COMPILER_TRANSLATOR_NODESEARCH_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOperatorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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 &quot;compiler/translator/Operator.h&quot;
+
+const char *GetOperatorString(TOperator op)
+{
+    switch (op)
+    {
+      // Note: ops from EOpNull to EOpPrototype can't be handled here.
+
+      case EOpNegative: return &quot;-&quot;;
+      case EOpPositive: return &quot;+&quot;;
+      case EOpLogicalNot: return &quot;!&quot;;
+      case EOpVectorLogicalNot: return &quot;not&quot;;
+      case EOpBitwiseNot: return &quot;~&quot;;
+
+      case EOpPostIncrement: return &quot;++&quot;;
+      case EOpPostDecrement: return &quot;--&quot;;
+      case EOpPreIncrement: return &quot;++&quot;;
+      case EOpPreDecrement: return &quot;--&quot;;
+
+      case EOpAdd: return &quot;+&quot;;
+      case EOpSub: return &quot;-&quot;;
+      case EOpMul: return &quot;*&quot;;
+      case EOpDiv: return &quot;/&quot;;
+      case EOpIMod: return &quot;%&quot;;
+      case EOpEqual: return &quot;==&quot;;
+      case EOpNotEqual: return &quot;!=&quot;;
+      case EOpVectorEqual: return &quot;equal&quot;;
+      case EOpVectorNotEqual: return &quot;notEqual&quot;;
+      case EOpLessThan: return &quot;&lt;&quot;;
+      case EOpGreaterThan: return &quot;&gt;&quot;;
+      case EOpLessThanEqual: return &quot;&lt;=&quot;;
+      case EOpGreaterThanEqual: return &quot;&gt;=&quot;;
+      case EOpComma: return &quot;,&quot;;
+
+      // Fall-through.
+      case EOpVectorTimesScalar:
+      case EOpVectorTimesMatrix:
+      case EOpMatrixTimesVector:
+      case EOpMatrixTimesScalar: return &quot;*&quot;;
+
+      case EOpLogicalOr: return &quot;||&quot;;
+      case EOpLogicalXor: return &quot;^^&quot;;
+      case EOpLogicalAnd: return &quot;&amp;&amp;&quot;;
+
+      case EOpBitShiftLeft: return &quot;&lt;&lt;&quot;;
+      case EOpBitShiftRight: return &quot;&gt;&gt;&quot;;
+
+      case EOpBitwiseAnd: return &quot;&amp;&quot;;
+      case EOpBitwiseXor: return &quot;^&quot;;
+      case EOpBitwiseOr: return &quot;|&quot;;
+
+      // Fall-through.
+      case EOpIndexDirect:
+      case EOpIndexIndirect: return &quot;[]&quot;;
+
+      case EOpIndexDirectStruct:
+      case EOpIndexDirectInterfaceBlock: return &quot;.&quot;;
+
+      case EOpVectorSwizzle: return &quot;.&quot;;
+
+      case EOpRadians: return &quot;radians&quot;;
+      case EOpDegrees: return &quot;degrees&quot;;
+      case EOpSin: return &quot;sin&quot;;
+      case EOpCos: return &quot;cos&quot;;
+      case EOpTan: return &quot;tan&quot;;
+      case EOpAsin: return &quot;asin&quot;;
+      case EOpAcos: return &quot;acos&quot;;
+      case EOpAtan: return &quot;atan&quot;;
+
+      case EOpSinh: return &quot;sinh&quot;;
+      case EOpCosh: return &quot;cosh&quot;;
+      case EOpTanh: return &quot;tanh&quot;;
+      case EOpAsinh: return &quot;asinh&quot;;
+      case EOpAcosh: return &quot;acosh&quot;;
+      case EOpAtanh: return &quot;atanh&quot;;
+
+      case EOpPow: return &quot;pow&quot;;
+      case EOpExp: return &quot;exp&quot;;
+      case EOpLog: return &quot;log&quot;;
+      case EOpExp2: return &quot;exp2&quot;;
+      case EOpLog2: return &quot;log2&quot;;
+      case EOpSqrt: return &quot;sqrt&quot;;
+      case EOpInverseSqrt: return &quot;inversesqrt&quot;;
+
+      case EOpAbs: return &quot;abs&quot;;
+      case EOpSign: return &quot;sign&quot;;
+      case EOpFloor: return &quot;floor&quot;;
+      case EOpTrunc: return &quot;trunc&quot;;
+      case EOpRound: return &quot;round&quot;;
+      case EOpRoundEven: return &quot;roundEven&quot;;
+      case EOpCeil: return &quot;ceil&quot;;
+      case EOpFract: return &quot;fract&quot;;
+      case EOpMod: return &quot;mod&quot;;
+      case EOpModf: return &quot;modf&quot;;
+      case EOpMin: return &quot;min&quot;;
+      case EOpMax: return &quot;max&quot;;
+      case EOpClamp: return &quot;clamp&quot;;
+      case EOpMix: return &quot;mix&quot;;
+      case EOpStep: return &quot;step&quot;;
+      case EOpSmoothStep: return &quot;smoothstep&quot;;
+      case EOpIsNan: return &quot;isnan&quot;;
+      case EOpIsInf: return &quot;isinf&quot;;
+
+      case EOpFloatBitsToInt: return &quot;floatBitsToInt&quot;;
+      case EOpFloatBitsToUint: return &quot;floatBitsToUint&quot;;
+      case EOpIntBitsToFloat: return &quot;intBitsToFloat&quot;;
+      case EOpUintBitsToFloat: return &quot;uintBitsToFloat&quot;;
+
+      case EOpPackSnorm2x16: return &quot;packSnorm2x16&quot;;
+      case EOpPackUnorm2x16: return &quot;packUnorm2x16&quot;;
+      case EOpPackHalf2x16: return &quot;packHalf2x16&quot;;
+      case EOpUnpackSnorm2x16: return &quot;unpackSnorm2x16&quot;;
+      case EOpUnpackUnorm2x16: return &quot;unpackUnorm2x16&quot;;
+      case EOpUnpackHalf2x16: return &quot;unpackHalf2x16&quot;;
+
+      case EOpLength: return &quot;length&quot;;
+      case EOpDistance: return &quot;distance&quot;;
+      case EOpDot: return &quot;dot&quot;;
+      case EOpCross: return &quot;cross&quot;;
+      case EOpNormalize: return &quot;normalize&quot;;
+      case EOpFaceForward: return &quot;faceforward&quot;;
+      case EOpReflect: return &quot;reflect&quot;;
+      case EOpRefract: return &quot;refract&quot;;
+
+      case EOpDFdx: return &quot;dFdx&quot;;
+      case EOpDFdy: return &quot;dFdy&quot;;
+      case EOpFwidth: return &quot;fwidth&quot;;
+
+      case EOpMatrixTimesMatrix: return &quot;*&quot;;
+
+      case EOpOuterProduct: return &quot;outerProduct&quot;;
+      case EOpTranspose: return &quot;transpose&quot;;
+      case EOpDeterminant: return &quot;determinant&quot;;
+      case EOpInverse: return &quot;inverse&quot;;
+
+      case EOpAny: return &quot;any&quot;;
+      case EOpAll: return &quot;all&quot;;
+
+      case EOpKill: return &quot;kill&quot;;
+      case EOpReturn: return &quot;return&quot;;
+      case EOpBreak: return &quot;break&quot;;
+      case EOpContinue: return &quot;continue&quot;;
+
+      case EOpConstructInt: return &quot;int&quot;;
+      case EOpConstructUInt: return &quot;uint&quot;;
+      case EOpConstructBool: return &quot;bool&quot;;
+      case EOpConstructFloat: return &quot;float&quot;;
+      case EOpConstructVec2: return &quot;vec2&quot;;
+      case EOpConstructVec3: return &quot;vec3&quot;;
+      case EOpConstructVec4: return &quot;vec4&quot;;
+      case EOpConstructBVec2: return &quot;bvec2&quot;;
+      case EOpConstructBVec3: return &quot;bvec3&quot;;
+      case EOpConstructBVec4: return &quot;bvec4&quot;;
+      case EOpConstructIVec2: return &quot;ivec2&quot;;
+      case EOpConstructIVec3: return &quot;ivec3&quot;;
+      case EOpConstructIVec4: return &quot;ivec4&quot;;
+      case EOpConstructUVec2: return &quot;uvec2&quot;;
+      case EOpConstructUVec3: return &quot;uvec3&quot;;
+      case EOpConstructUVec4: return &quot;uvec4&quot;;
+      case EOpConstructMat2: return &quot;mat2&quot;;
+      case EOpConstructMat3: return &quot;mat3&quot;;
+      case EOpConstructMat4: return &quot;mat4&quot;;
+      // Note: EOpConstructStruct can't be handled here
+
+      case EOpAssign: return &quot;=&quot;;
+      case EOpInitialize: return &quot;=&quot;;
+      case EOpAddAssign: return &quot;+=&quot;;
+      case EOpSubAssign: return &quot;-=&quot;;
+
+      // Fall-through.
+      case EOpMulAssign:
+      case EOpVectorTimesMatrixAssign:
+      case EOpVectorTimesScalarAssign:
+      case EOpMatrixTimesScalarAssign:
+      case EOpMatrixTimesMatrixAssign: return &quot;*=&quot;;
+
+      case EOpDivAssign: return &quot;/=&quot;;
+      case EOpIModAssign: return &quot;%=&quot;;
+      case EOpBitShiftLeftAssign: return &quot;&lt;&lt;=&quot;;
+      case EOpBitShiftRightAssign: return &quot;&gt;&gt;=&quot;;
+      case EOpBitwiseAndAssign: return &quot;&amp;=&quot;;
+      case EOpBitwiseXorAssign: return &quot;^=&quot;;
+      case EOpBitwiseOrAssign: return &quot;|=&quot;;
+
+      default: break;
+    }
+    return &quot;&quot;;
+}
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOperatorh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Operator.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,226 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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_TRANSLATOR_OPERATOR_H_
+#define COMPILER_TRANSLATOR_OPERATOR_H_
+
+//
+// Operators used by the high-level (parse tree) representation.
+//
+enum TOperator
+{
+    EOpNull,            // if in a node, should only mean a node is still being built
+    EOpSequence,        // denotes a list of statements, or parameters, etc.
+    EOpFunctionCall,
+    EOpInternalFunctionCall, // Call to an internal helper function
+    EOpFunction,        // For function definition
+    EOpParameters,      // an aggregate listing the parameters to a function
+
+    EOpDeclaration,
+    EOpInvariantDeclaration, // Specialized declarations for attributing invariance
+    EOpPrototype,
+
+    //
+    // Unary operators
+    //
+
+    EOpNegative,
+    EOpPositive,
+    EOpLogicalNot,
+    EOpVectorLogicalNot,
+    EOpBitwiseNot,
+
+    EOpPostIncrement,
+    EOpPostDecrement,
+    EOpPreIncrement,
+    EOpPreDecrement,
+
+    //
+    // binary operations
+    //
+
+    EOpAdd,
+    EOpSub,
+    EOpMul,
+    EOpDiv,
+    EOpIMod,
+    EOpEqual,
+    EOpNotEqual,
+    EOpVectorEqual,
+    EOpVectorNotEqual,
+    EOpLessThan,
+    EOpGreaterThan,
+    EOpLessThanEqual,
+    EOpGreaterThanEqual,
+    EOpComma,
+
+    EOpVectorTimesScalar,
+    EOpVectorTimesMatrix,
+    EOpMatrixTimesVector,
+    EOpMatrixTimesScalar,
+
+    EOpLogicalOr,
+    EOpLogicalXor,
+    EOpLogicalAnd,
+
+    EOpBitShiftLeft,
+    EOpBitShiftRight,
+
+    EOpBitwiseAnd,
+    EOpBitwiseXor,
+    EOpBitwiseOr,
+
+    EOpIndexDirect,
+    EOpIndexIndirect,
+    EOpIndexDirectStruct,
+    EOpIndexDirectInterfaceBlock,
+
+    EOpVectorSwizzle,
+
+    //
+    // Built-in functions potentially mapped to operators
+    //
+
+    EOpRadians,
+    EOpDegrees,
+    EOpSin,
+    EOpCos,
+    EOpTan,
+    EOpAsin,
+    EOpAcos,
+    EOpAtan,
+
+    EOpSinh,
+    EOpCosh,
+    EOpTanh,
+    EOpAsinh,
+    EOpAcosh,
+    EOpAtanh,
+
+    EOpPow,
+    EOpExp,
+    EOpLog,
+    EOpExp2,
+    EOpLog2,
+    EOpSqrt,
+    EOpInverseSqrt,
+
+    EOpAbs,
+    EOpSign,
+    EOpFloor,
+    EOpTrunc,
+    EOpRound,
+    EOpRoundEven,
+    EOpCeil,
+    EOpFract,
+    EOpMod,
+    EOpModf,
+    EOpMin,
+    EOpMax,
+    EOpClamp,
+    EOpMix,
+    EOpStep,
+    EOpSmoothStep,
+    EOpIsNan,
+    EOpIsInf,
+
+    EOpFloatBitsToInt,
+    EOpFloatBitsToUint,
+    EOpIntBitsToFloat,
+    EOpUintBitsToFloat,
+
+    EOpPackSnorm2x16,
+    EOpPackUnorm2x16,
+    EOpPackHalf2x16,
+    EOpUnpackSnorm2x16,
+    EOpUnpackUnorm2x16,
+    EOpUnpackHalf2x16,
+
+    EOpLength,
+    EOpDistance,
+    EOpDot,
+    EOpCross,
+    EOpNormalize,
+    EOpFaceForward,
+    EOpReflect,
+    EOpRefract,
+
+    EOpDFdx,            // Fragment only, OES_standard_derivatives extension
+    EOpDFdy,            // Fragment only, OES_standard_derivatives extension
+    EOpFwidth,          // Fragment only, OES_standard_derivatives extension
+
+    EOpMatrixTimesMatrix,
+
+    EOpOuterProduct,
+    EOpTranspose,
+    EOpDeterminant,
+    EOpInverse,
+
+    EOpAny,
+    EOpAll,
+
+    //
+    // Branch
+    //
+
+    EOpKill,            // Fragment only
+    EOpReturn,
+    EOpBreak,
+    EOpContinue,
+
+    //
+    // Constructors
+    //
+
+    EOpConstructInt,
+    EOpConstructUInt,
+    EOpConstructBool,
+    EOpConstructFloat,
+    EOpConstructVec2,
+    EOpConstructVec3,
+    EOpConstructVec4,
+    EOpConstructBVec2,
+    EOpConstructBVec3,
+    EOpConstructBVec4,
+    EOpConstructIVec2,
+    EOpConstructIVec3,
+    EOpConstructIVec4,
+    EOpConstructUVec2,
+    EOpConstructUVec3,
+    EOpConstructUVec4,
+    EOpConstructMat2,
+    EOpConstructMat3,
+    EOpConstructMat4,
+    EOpConstructStruct,
+
+    //
+    // moves
+    //
+
+    EOpAssign,
+    EOpInitialize,
+    EOpAddAssign,
+    EOpSubAssign,
+
+    EOpMulAssign,
+    EOpVectorTimesMatrixAssign,
+    EOpVectorTimesScalarAssign,
+    EOpMatrixTimesScalarAssign,
+    EOpMatrixTimesMatrixAssign,
+
+    EOpDivAssign,
+    EOpIModAssign,
+    EOpBitShiftLeftAssign,
+    EOpBitShiftRightAssign,
+    EOpBitwiseAndAssign,
+    EOpBitwiseXorAssign,
+    EOpBitwiseOrAssign
+};
+
+// Returns the string corresponding to the operator in GLSL
+const char* GetOperatorString(TOperator op);
+
+#endif  // COMPILER_TRANSLATOR_OPERATOR_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputESSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,13 +6,21 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/OutputESSL.h&quot;
</span><span class="cx"> 
</span><del>-TOutputESSL::TOutputESSL(TInfoSinkBase&amp; objSink,
</del><ins>+TOutputESSL::TOutputESSL(TInfoSinkBase &amp;objSink,
</ins><span class="cx">                          ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx">                          ShHashFunction64 hashFunction,
</span><del>-                         NameMap&amp; nameMap,
-                         TSymbolTable&amp; symbolTable,
-                         int shaderVersion)
-    : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
</del><ins>+                         NameMap &amp;nameMap,
+                         TSymbolTable &amp;symbolTable,
+                         int shaderVersion,
+                         bool forceHighp)
+    : TOutputGLSLBase(objSink,
+                      clampingStrategy,
+                      hashFunction,
+                      nameMap,
+                      symbolTable,
+                      shaderVersion,
+                      SH_ESSL_OUTPUT),
+      mForceHighp(forceHighp)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -22,6 +30,9 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     TInfoSinkBase&amp; out = objSink();
</span><del>-    out &lt;&lt; getPrecisionString(precision);
</del><ins>+    if (mForceHighp)
+        out &lt;&lt; getPrecisionString(EbpHigh);
+    else
+        out &lt;&lt; getPrecisionString(precision);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputESSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputESSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef CROSSCOMPILERGLSL_OUTPUTESSL_H_
-#define CROSSCOMPILERGLSL_OUTPUTESSL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_OUTPUTESSL_H_
+#define COMPILER_TRANSLATOR_OUTPUTESSL_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/OutputGLSLBase.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -17,10 +17,13 @@
</span><span class="cx">                 ShHashFunction64 hashFunction,
</span><span class="cx">                 NameMap&amp; nameMap,
</span><span class="cx">                 TSymbolTable&amp; symbolTable,
</span><del>-                int shaderVersion);
</del><ins>+                int shaderVersion,
+                bool forceHighp);
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual bool writeVariablePrecision(TPrecision precision);
</span><ins>+private:
+    bool mForceHighp;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // CROSSCOMPILERGLSL_OUTPUTESSL_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_OUTPUTESSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -11,8 +11,15 @@
</span><span class="cx">                          ShHashFunction64 hashFunction,
</span><span class="cx">                          NameMap&amp; nameMap,
</span><span class="cx">                          TSymbolTable&amp; symbolTable,
</span><del>-                         int shaderVersion)
-    : TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
</del><ins>+                         int shaderVersion,
+                         ShShaderOutput output)
+    : TOutputGLSLBase(objSink,
+                      clampingStrategy,
+                      hashFunction,
+                      nameMap,
+                      symbolTable,
+                      shaderVersion,
+                      output)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -21,21 +28,30 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSL::visitSymbol(TIntermSymbol* node)
</del><ins>+void TOutputGLSL::visitSymbol(TIntermSymbol *node)
</ins><span class="cx"> {
</span><span class="cx">     TInfoSinkBase&amp; out = objSink();
</span><span class="cx"> 
</span><del>-    if (node-&gt;getSymbol() == &quot;gl_FragDepthEXT&quot;)
</del><ins>+    const TString &amp;symbol = node-&gt;getSymbol();
+    if (symbol == &quot;gl_FragDepthEXT&quot;)
</ins><span class="cx">     {
</span><span class="cx">         out &lt;&lt; &quot;gl_FragDepth&quot;;
</span><span class="cx">     }
</span><ins>+    else if (symbol == &quot;gl_FragColor&quot; &amp;&amp; IsGLSL130OrNewer(getShaderOutput()))
+    {
+        out &lt;&lt; &quot;webgl_FragColor&quot;;
+    }
+    else if (symbol == &quot;gl_FragData&quot; &amp;&amp; IsGLSL130OrNewer(getShaderOutput()))
+    {
+        out &lt;&lt; &quot;webgl_FragData&quot;;
+    }
</ins><span class="cx">     else
</span><span class="cx">     {
</span><span class="cx">         TOutputGLSLBase::visitSymbol(node);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString TOutputGLSL::translateTextureFunction(TString&amp; name)
</del><ins>+TString TOutputGLSL::translateTextureFunction(TString &amp;name)
</ins><span class="cx"> {
</span><span class="cx">     static const char *simpleRename[] = {
</span><span class="cx">         &quot;texture2DLodEXT&quot;, &quot;texture2DLod&quot;,
</span><span class="lines">@@ -46,10 +62,30 @@
</span><span class="cx">         &quot;textureCubeGradEXT&quot;, &quot;textureCubeGradARB&quot;,
</span><span class="cx">         NULL, NULL
</span><span class="cx">     };
</span><ins>+    static const char *legacyToCoreRename[] = {
+        &quot;texture2D&quot;, &quot;texture&quot;,
+        &quot;texture2DProj&quot;, &quot;textureProj&quot;,
+        &quot;texture2DLod&quot;, &quot;textureLod&quot;,
+        &quot;texture2DProjLod&quot;, &quot;textureProjLod&quot;,
+        &quot;textureCube&quot;, &quot;texture&quot;,
+        &quot;textureCubeLod&quot;, &quot;textureLod&quot;,
+        // Extensions
+        &quot;texture2DLodEXT&quot;, &quot;textureLod&quot;,
+        &quot;texture2DProjLodEXT&quot;, &quot;textureProjLod&quot;,
+        &quot;textureCubeLodEXT&quot;, &quot;textureLod&quot;,
+        &quot;texture2DGradEXT&quot;, &quot;textureGrad&quot;,
+        &quot;texture2DProjGradEXT&quot;, &quot;textureProjGrad&quot;,
+        &quot;textureCubeGradEXT&quot;, &quot;textureGrad&quot;,
+        NULL, NULL
+    };
+    const char **mapping = (IsGLSL130OrNewer(getShaderOutput())) ?
+        legacyToCoreRename : simpleRename;
</ins><span class="cx"> 
</span><del>-    for (int i = 0; simpleRename[i] != NULL; i += 2) {
-        if (name == simpleRename[i]) {
-            return simpleRename[i+1];
</del><ins>+    for (int i = 0; mapping[i] != NULL; i += 2)
+    {
+        if (name == mapping[i])
+        {
+            return mapping[i+1];
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,25 +4,26 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef CROSSCOMPILERGLSL_OUTPUTGLSL_H_
-#define CROSSCOMPILERGLSL_OUTPUTGLSL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_OUTPUTGLSL_H_
+#define COMPILER_TRANSLATOR_OUTPUTGLSL_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/OutputGLSLBase.h&quot;
</span><span class="cx"> 
</span><span class="cx"> class TOutputGLSL : public TOutputGLSLBase
</span><span class="cx"> {
</span><del>-public:
</del><ins>+  public:
</ins><span class="cx">     TOutputGLSL(TInfoSinkBase&amp; objSink,
</span><span class="cx">                 ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx">                 ShHashFunction64 hashFunction,
</span><span class="cx">                 NameMap&amp; nameMap,
</span><span class="cx">                 TSymbolTable&amp; symbolTable,
</span><del>-                int shaderVersion);
</del><ins>+                int shaderVersion,
+                ShShaderOutput output);
</ins><span class="cx"> 
</span><del>-protected:
</del><ins>+  protected:
</ins><span class="cx">     virtual bool writeVariablePrecision(TPrecision);
</span><span class="cx">     virtual void visitSymbol(TIntermSymbol* node);
</span><span class="cx">     virtual TString translateTextureFunction(TString&amp; name);
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_OUTPUTGLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,17 +1,18 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/OutputGLSLBase.h&quot;
</span><del>-#include &quot;compiler/translator/compilerdebug.h&quot;
</del><span class="cx"> 
</span><ins>+#include &quot;common/debug.h&quot;
+
</ins><span class="cx"> #include &lt;cfloat&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace
</span><span class="cx"> {
</span><del>-TString arrayBrackets(const TType&amp; type)
</del><ins>+TString arrayBrackets(const TType &amp;type)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(type.isArray());
</span><span class="cx">     TInfoSinkBase out;
</span><span class="lines">@@ -19,13 +20,14 @@
</span><span class="cx">     return TString(out.c_str());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isSingleStatement(TIntermNode* node) {
-    if (const TIntermAggregate* aggregate = node-&gt;getAsAggregate())
</del><ins>+bool isSingleStatement(TIntermNode *node)
+{
+    if (const TIntermAggregate *aggregate = node-&gt;getAsAggregate())
</ins><span class="cx">     {
</span><span class="cx">         return (aggregate-&gt;getOp() != EOpFunction) &amp;&amp;
</span><span class="cx">                (aggregate-&gt;getOp() != EOpSequence);
</span><span class="cx">     }
</span><del>-    else if (const TIntermSelection* selection = node-&gt;getAsSelectionNode())
</del><ins>+    else if (const TIntermSelection *selection = node-&gt;getAsSelectionNode())
</ins><span class="cx">     {
</span><span class="cx">         // Ternary operators are usually part of an assignment operator.
</span><span class="cx">         // This handles those rare cases in which they are all by themselves.
</span><span class="lines">@@ -35,16 +37,26 @@
</span><span class="cx">     {
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><ins>+    else if (node-&gt;getAsSwitchNode())
+    {
+        return false;
+    }
+    else if (node-&gt;getAsCaseNode())
+    {
+        return false;
+    }
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> }  // namespace
</span><span class="cx"> 
</span><del>-TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase&amp; objSink,
</del><ins>+TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase &amp;objSink,
</ins><span class="cx">                                  ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx">                                  ShHashFunction64 hashFunction,
</span><del>-                                 NameMap&amp; nameMap,
-                                 TSymbolTable&amp; symbolTable,
-                                 int shaderVersion)
</del><ins>+                                 NameMap &amp;nameMap,
+                                 TSymbolTable &amp;symbolTable,
+                                 int shaderVersion,
+                                 ShShaderOutput output)
</ins><span class="cx">     : TIntermTraverser(true, true, true),
</span><span class="cx">       mObjSink(objSink),
</span><span class="cx">       mDeclaringVariables(false),
</span><span class="lines">@@ -52,38 +64,77 @@
</span><span class="cx">       mHashFunction(hashFunction),
</span><span class="cx">       mNameMap(nameMap),
</span><span class="cx">       mSymbolTable(symbolTable),
</span><del>-      mShaderVersion(shaderVersion)
</del><ins>+      mShaderVersion(shaderVersion),
+      mOutput(output)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSLBase::writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr)
</del><ins>+void TOutputGLSLBase::writeTriplet(
+    Visit visit, const char *preStr, const char *inStr, const char *postStr)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx">     if (visit == PreVisit &amp;&amp; preStr)
</span><del>-    {
</del><span class="cx">         out &lt;&lt; preStr;
</span><del>-    }
</del><span class="cx">     else if (visit == InVisit &amp;&amp; inStr)
</span><del>-    {
</del><span class="cx">         out &lt;&lt; inStr;
</span><del>-    }
</del><span class="cx">     else if (visit == PostVisit &amp;&amp; postStr)
</span><del>-    {
</del><span class="cx">         out &lt;&lt; postStr;
</span><del>-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSLBase::writeVariableType(const TType&amp; type)
</del><ins>+void TOutputGLSLBase::writeBuiltInFunctionTriplet(
+    Visit visit, const char *preStr, bool useEmulatedFunction)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TString preString = useEmulatedFunction ?
+        BuiltInFunctionEmulator::GetEmulatedFunctionName(preStr) : preStr;
+    writeTriplet(visit, preString.c_str(), &quot;, &quot;, &quot;)&quot;);
+}
+
+void TOutputGLSLBase::writeVariableType(const TType &amp;type)
+{
+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx">     TQualifier qualifier = type.getQualifier();
</span><del>-    // TODO(alokp): Validate qualifier for variable declarations.
-    if ((qualifier != EvqTemporary) &amp;&amp; (qualifier != EvqGlobal))
-        out &lt;&lt; type.getQualifierString() &lt;&lt; &quot; &quot;;
</del><ins>+    if (qualifier != EvqTemporary &amp;&amp; qualifier != EvqGlobal)
+    {
+        if (IsGLSL130OrNewer(mOutput))
+        {
+            switch (qualifier)
+            {
+              case EvqAttribute:
+                out &lt;&lt; &quot;in&quot; &lt;&lt; &quot; &quot;;
+                break;
+              case EvqVaryingIn:
+                out &lt;&lt; &quot;in&quot; &lt;&lt; &quot; &quot;;
+                break;
+              case EvqVaryingOut:
+                out &lt;&lt; &quot;out&quot; &lt;&lt; &quot; &quot;;
+                break;
+              case EvqInvariantVaryingIn:
+                out &lt;&lt; &quot;invariant in&quot; &lt;&lt; &quot; &quot;;
+                break;
+              case EvqInvariantVaryingOut:
+                out &lt;&lt; &quot;invariant out&quot; &lt;&lt; &quot; &quot;;
+                break;
+              default:
+                out &lt;&lt; type.getQualifierString() &lt;&lt; &quot; &quot;;
+                break;
+            }
+        }
+        else
+        {
+            out &lt;&lt; type.getQualifierString() &lt;&lt; &quot; &quot;;
+        }
+    }
</ins><span class="cx">     // Declare the struct if we have not done so already.
</span><del>-    if ((type.getBasicType() == EbtStruct) &amp;&amp; !structDeclared(type.getStruct()))
</del><ins>+    if (type.getBasicType() == EbtStruct &amp;&amp; !structDeclared(type.getStruct()))
</ins><span class="cx">     {
</span><del>-        declareStruct(type.getStruct());
</del><ins>+        TStructure *structure = type.getStruct();
+
+        declareStruct(structure);
+
+        if (!structure-&gt;name().empty())
+        {
+            mDeclaredStructs.insert(structure-&gt;uniqueId());
+        }
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="lines">@@ -93,19 +144,19 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence&amp; args)
</del><ins>+void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence &amp;args)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx">     for (TIntermSequence::const_iterator iter = args.begin();
</span><span class="cx">          iter != args.end(); ++iter)
</span><span class="cx">     {
</span><del>-        const TIntermSymbol* arg = (*iter)-&gt;getAsSymbolNode();
</del><ins>+        const TIntermSymbol *arg = (*iter)-&gt;getAsSymbolNode();
</ins><span class="cx">         ASSERT(arg != NULL);
</span><span class="cx"> 
</span><del>-        const TType&amp; type = arg-&gt;getType();
</del><ins>+        const TType &amp;type = arg-&gt;getType();
</ins><span class="cx">         writeVariableType(type);
</span><span class="cx"> 
</span><del>-        const TString&amp; name = arg-&gt;getSymbol();
</del><ins>+        const TString &amp;name = arg-&gt;getSymbol();
</ins><span class="cx">         if (!name.empty())
</span><span class="cx">             out &lt;&lt; &quot; &quot; &lt;&lt; hashName(name);
</span><span class="cx">         if (type.isArray())
</span><span class="lines">@@ -117,23 +168,24 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const ConstantUnion* TOutputGLSLBase::writeConstantUnion(const TType&amp; type,
-                                                         const ConstantUnion* pConstUnion)
</del><ins>+const TConstantUnion *TOutputGLSLBase::writeConstantUnion(
+    const TType &amp;type, const TConstantUnion *pConstUnion)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx"> 
</span><span class="cx">     if (type.getBasicType() == EbtStruct)
</span><span class="cx">     {
</span><del>-        const TStructure* structure = type.getStruct();
</del><ins>+        const TStructure *structure = type.getStruct();
</ins><span class="cx">         out &lt;&lt; hashName(structure-&gt;name()) &lt;&lt; &quot;(&quot;;
</span><span class="cx"> 
</span><del>-        const TFieldList&amp; fields = structure-&gt;fields();
</del><ins>+        const TFieldList &amp;fields = structure-&gt;fields();
</ins><span class="cx">         for (size_t i = 0; i &lt; fields.size(); ++i)
</span><span class="cx">         {
</span><del>-            const TType* fieldType = fields[i]-&gt;type();
</del><ins>+            const TType *fieldType = fields[i]-&gt;type();
</ins><span class="cx">             ASSERT(fieldType != NULL);
</span><span class="cx">             pConstUnion = writeConstantUnion(*fieldType, pConstUnion);
</span><del>-            if (i != fields.size() - 1) out &lt;&lt; &quot;, &quot;;
</del><ins>+            if (i != fields.size() - 1)
+                out &lt;&lt; &quot;, &quot;;
</ins><span class="cx">         }
</span><span class="cx">         out &lt;&lt; &quot;)&quot;;
</span><span class="cx">     }
</span><span class="lines">@@ -141,26 +193,60 @@
</span><span class="cx">     {
</span><span class="cx">         size_t size = type.getObjectSize();
</span><span class="cx">         bool writeType = size &gt; 1;
</span><del>-        if (writeType) out &lt;&lt; getTypeName(type) &lt;&lt; &quot;(&quot;;
</del><ins>+        if (writeType)
+            out &lt;&lt; getTypeName(type) &lt;&lt; &quot;(&quot;;
</ins><span class="cx">         for (size_t i = 0; i &lt; size; ++i, ++pConstUnion)
</span><span class="cx">         {
</span><span class="cx">             switch (pConstUnion-&gt;getType())
</span><span class="cx">             {
</span><del>-                case EbtFloat: out &lt;&lt; std::min(FLT_MAX, std::max(-FLT_MAX, pConstUnion-&gt;getFConst())); break;
-                case EbtInt: out &lt;&lt; pConstUnion-&gt;getIConst(); break;
-                case EbtBool: out &lt;&lt; pConstUnion-&gt;getBConst(); break;
-                default: UNREACHABLE();
</del><ins>+              case EbtFloat:
+                out &lt;&lt; std::min(FLT_MAX, std::max(-FLT_MAX, pConstUnion-&gt;getFConst()));
+                break;
+              case EbtInt:
+                out &lt;&lt; pConstUnion-&gt;getIConst();
+                break;
+              case EbtUInt:
+                out &lt;&lt; pConstUnion-&gt;getUConst() &lt;&lt; &quot;u&quot;;
+                break;
+              case EbtBool:
+                out &lt;&lt; pConstUnion-&gt;getBConst();
+                break;
+              default: UNREACHABLE();
</ins><span class="cx">             }
</span><del>-            if (i != size - 1) out &lt;&lt; &quot;, &quot;;
</del><ins>+            if (i != size - 1)
+                out &lt;&lt; &quot;, &quot;;
</ins><span class="cx">         }
</span><del>-        if (writeType) out &lt;&lt; &quot;)&quot;;
</del><ins>+        if (writeType)
+            out &lt;&lt; &quot;)&quot;;
</ins><span class="cx">     }
</span><span class="cx">     return pConstUnion;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSLBase::visitSymbol(TIntermSymbol* node)
</del><ins>+void TOutputGLSLBase::writeConstructorTriplet(Visit visit, const TType &amp;type, const char *constructorBaseType)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
+    if (visit == PreVisit)
+    {
+        if (type.isArray())
+        {
+            out &lt;&lt; constructorBaseType;
+            out &lt;&lt; arrayBrackets(type);
+            out &lt;&lt; &quot;(&quot;;
+        }
+        else
+        {
+            out &lt;&lt; constructorBaseType &lt;&lt; &quot;(&quot;;
+        }
+    }
+    else
+    {
+        writeTriplet(visit, nullptr, &quot;, &quot;, &quot;)&quot;);
+    }
+}
+
+void TOutputGLSLBase::visitSymbol(TIntermSymbol *node)
+{
+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx">     if (mLoopUnrollStack.needsToReplaceSymbolWithValue(node))
</span><span class="cx">         out &lt;&lt; mLoopUnrollStack.getLoopIndexValue(node);
</span><span class="cx">     else
</span><span class="lines">@@ -170,240 +256,415 @@
</span><span class="cx">         out &lt;&lt; arrayBrackets(node-&gt;getType());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion* node)
</del><ins>+void TOutputGLSLBase::visitConstantUnion(TIntermConstantUnion *node)
</ins><span class="cx"> {
</span><span class="cx">     writeConstantUnion(node-&gt;getType(), node-&gt;getUnionArrayPointer());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
</del><ins>+bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary *node)
</ins><span class="cx"> {
</span><span class="cx">     bool visitChildren = true;
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><del>-        case EOpInitialize:
</del><ins>+      case EOpInitialize:
+        if (visit == InVisit)
+        {
+            out &lt;&lt; &quot; = &quot;;
+            // RHS of initialize is not being declared.
+            mDeclaringVariables = false;
+        }
+        break;
+      case EOpAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; = &quot;, &quot;)&quot;);
+        break;
+      case EOpAddAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; += &quot;, &quot;)&quot;);
+        break;
+      case EOpSubAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; -= &quot;, &quot;)&quot;);
+        break;
+      case EOpDivAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; /= &quot;, &quot;)&quot;);
+        break;
+      case EOpIModAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; %= &quot;, &quot;)&quot;);
+        break;
+      // Notice the fall-through.
+      case EOpMulAssign:
+      case EOpVectorTimesMatrixAssign:
+      case EOpVectorTimesScalarAssign:
+      case EOpMatrixTimesScalarAssign:
+      case EOpMatrixTimesMatrixAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; *= &quot;, &quot;)&quot;);
+        break;
+      case EOpBitShiftLeftAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; &lt;&lt;= &quot;, &quot;)&quot;);
+        break;
+      case EOpBitShiftRightAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; &gt;&gt;= &quot;, &quot;)&quot;);
+        break;
+      case EOpBitwiseAndAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; &amp;= &quot;, &quot;)&quot;);
+        break;
+      case EOpBitwiseXorAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; ^= &quot;, &quot;)&quot;);
+        break;
+      case EOpBitwiseOrAssign:
+        writeTriplet(visit, &quot;(&quot;, &quot; |= &quot;, &quot;)&quot;);
+        break;
+
+      case EOpIndexDirect:
+        writeTriplet(visit, NULL, &quot;[&quot;, &quot;]&quot;);
+        break;
+      case EOpIndexIndirect:
+        if (node-&gt;getAddIndexClamp())
+        {
</ins><span class="cx">             if (visit == InVisit)
</span><span class="cx">             {
</span><del>-                out &lt;&lt; &quot; = &quot;;
-                // RHS of initialize is not being declared.
-                mDeclaringVariables = false;
</del><ins>+                if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC)
+                    out &lt;&lt; &quot;[int(clamp(float(&quot;;
+                else
+                    out &lt;&lt; &quot;[webgl_int_clamp(&quot;;
</ins><span class="cx">             }
</span><del>-            break;
-        case EOpAssign: writeTriplet(visit, &quot;(&quot;, &quot; = &quot;, &quot;)&quot;); break;
-        case EOpAddAssign: writeTriplet(visit, &quot;(&quot;, &quot; += &quot;, &quot;)&quot;); break;
-        case EOpSubAssign: writeTriplet(visit, &quot;(&quot;, &quot; -= &quot;, &quot;)&quot;); break;
-        case EOpDivAssign: writeTriplet(visit, &quot;(&quot;, &quot; /= &quot;, &quot;)&quot;); break;
-        // Notice the fall-through.
-        case EOpMulAssign: 
-        case EOpVectorTimesMatrixAssign:
-        case EOpVectorTimesScalarAssign:
-        case EOpMatrixTimesScalarAssign:
-        case EOpMatrixTimesMatrixAssign:
-            writeTriplet(visit, &quot;(&quot;, &quot; *= &quot;, &quot;)&quot;);
-            break;
</del><ins>+            else if (visit == PostVisit)
+            {
+                int maxSize;
+                TIntermTyped *left = node-&gt;getLeft();
+                TType leftType = left-&gt;getType();
</ins><span class="cx"> 
</span><del>-        case EOpIndexDirect:
-            writeTriplet(visit, NULL, &quot;[&quot;, &quot;]&quot;);
-            break;
-        case EOpIndexIndirect:
-            if (node-&gt;getAddIndexClamp())
-            {
-                if (visit == InVisit)
</del><ins>+                if (left-&gt;isArray())
</ins><span class="cx">                 {
</span><del>-                    if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
-                        out &lt;&lt; &quot;[int(clamp(float(&quot;;
-                    } else {
-                        out &lt;&lt; &quot;[webgl_int_clamp(&quot;;
-                    }
</del><ins>+                    // The shader will fail validation if the array length is not &gt; 0.
+                    maxSize = leftType.getArraySize() - 1;
</ins><span class="cx">                 }
</span><del>-                else if (visit == PostVisit)
</del><ins>+                else
</ins><span class="cx">                 {
</span><del>-                    int maxSize;
-                    TIntermTyped *left = node-&gt;getLeft();
-                    TType leftType = left-&gt;getType();
</del><ins>+                    maxSize = leftType.getNominalSize() - 1;
+                }
</ins><span class="cx"> 
</span><del>-                    if (left-&gt;isArray())
-                    {
-                        // The shader will fail validation if the array length is not &gt; 0.
-                        maxSize = leftType.getArraySize() - 1;
-                    }
-                    else
-                    {
-                        maxSize = leftType.getNominalSize() - 1;
-                    }
-
-                    if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC) {
-                        out &lt;&lt; &quot;), 0.0, float(&quot; &lt;&lt; maxSize &lt;&lt; &quot;)))]&quot;;
-                    } else {
-                        out &lt;&lt; &quot;, 0, &quot; &lt;&lt; maxSize &lt;&lt; &quot;)]&quot;;
-                    }
-                }
</del><ins>+                if (mClampingStrategy == SH_CLAMP_WITH_CLAMP_INTRINSIC)
+                    out &lt;&lt; &quot;), 0.0, float(&quot; &lt;&lt; maxSize &lt;&lt; &quot;)))]&quot;;
+                else
+                    out &lt;&lt; &quot;, 0, &quot; &lt;&lt; maxSize &lt;&lt; &quot;)]&quot;;
</ins><span class="cx">             }
</span><del>-            else
-            {
-                writeTriplet(visit, NULL, &quot;[&quot;, &quot;]&quot;);
-            }
-            break;
-        case EOpIndexDirectStruct:
-            if (visit == InVisit)
-            {
-                // Here we are writing out &quot;foo.bar&quot;, where &quot;foo&quot; is struct
-                // and &quot;bar&quot; is field. In AST, it is represented as a binary
-                // node, where left child represents &quot;foo&quot; and right child &quot;bar&quot;.
-                // The node itself represents &quot;.&quot;. The struct field &quot;bar&quot; is
-                // actually stored as an index into TStructure::fields.
-                out &lt;&lt; &quot;.&quot;;
-                const TStructure* structure = node-&gt;getLeft()-&gt;getType().getStruct();
-                const TIntermConstantUnion* index = node-&gt;getRight()-&gt;getAsConstantUnion();
-                const TField* field = structure-&gt;fields()[index-&gt;getIConst(0)];
</del><ins>+        }
+        else
+        {
+            writeTriplet(visit, NULL, &quot;[&quot;, &quot;]&quot;);
+        }
+        break;
+      case EOpIndexDirectStruct:
+        if (visit == InVisit)
+        {
+            // Here we are writing out &quot;foo.bar&quot;, where &quot;foo&quot; is struct
+            // and &quot;bar&quot; is field. In AST, it is represented as a binary
+            // node, where left child represents &quot;foo&quot; and right child &quot;bar&quot;.
+            // The node itself represents &quot;.&quot;. The struct field &quot;bar&quot; is
+            // actually stored as an index into TStructure::fields.
+            out &lt;&lt; &quot;.&quot;;
+            const TStructure *structure = node-&gt;getLeft()-&gt;getType().getStruct();
+            const TIntermConstantUnion *index = node-&gt;getRight()-&gt;getAsConstantUnion();
+            const TField *field = structure-&gt;fields()[index-&gt;getIConst(0)];
</ins><span class="cx"> 
</span><del>-                TString fieldName = field-&gt;name();
-                if (!mSymbolTable.findBuiltIn(structure-&gt;name(), mShaderVersion))
-                    fieldName = hashName(fieldName);
</del><ins>+            TString fieldName = field-&gt;name();
+            if (!mSymbolTable.findBuiltIn(structure-&gt;name(), mShaderVersion))
+                fieldName = hashName(fieldName);
</ins><span class="cx"> 
</span><del>-                out &lt;&lt; fieldName;
-                visitChildren = false;
-            }
-            break;
-        case EOpVectorSwizzle:
-            if (visit == InVisit)
</del><ins>+            out &lt;&lt; fieldName;
+            visitChildren = false;
+        }
+        break;
+      case EOpVectorSwizzle:
+        if (visit == InVisit)
+        {
+            out &lt;&lt; &quot;.&quot;;
+            TIntermAggregate *rightChild = node-&gt;getRight()-&gt;getAsAggregate();
+            TIntermSequence *sequence = rightChild-&gt;getSequence();
+            for (TIntermSequence::iterator sit = sequence-&gt;begin(); sit != sequence-&gt;end(); ++sit)
</ins><span class="cx">             {
</span><del>-                out &lt;&lt; &quot;.&quot;;
-                TIntermAggregate* rightChild = node-&gt;getRight()-&gt;getAsAggregate();
-                TIntermSequence&amp; sequence = rightChild-&gt;getSequence();
-                for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); ++sit)
</del><ins>+                TIntermConstantUnion *element = (*sit)-&gt;getAsConstantUnion();
+                ASSERT(element-&gt;getBasicType() == EbtInt);
+                ASSERT(element-&gt;getNominalSize() == 1);
+                const TConstantUnion&amp; data = element-&gt;getUnionArrayPointer()[0];
+                ASSERT(data.getType() == EbtInt);
+                switch (data.getIConst())
</ins><span class="cx">                 {
</span><del>-                    TIntermConstantUnion* element = (*sit)-&gt;getAsConstantUnion();
-                    ASSERT(element-&gt;getBasicType() == EbtInt);
-                    ASSERT(element-&gt;getNominalSize() == 1);
-                    const ConstantUnion&amp; data = element-&gt;getUnionArrayPointer()[0];
-                    ASSERT(data.getType() == EbtInt);
-                    switch (data.getIConst())
-                    {
-                        case 0: out &lt;&lt; &quot;x&quot;; break;
-                        case 1: out &lt;&lt; &quot;y&quot;; break;
-                        case 2: out &lt;&lt; &quot;z&quot;; break;
-                        case 3: out &lt;&lt; &quot;w&quot;; break;
-                        default: UNREACHABLE(); break;
-                    }
</del><ins>+                  case 0:
+                    out &lt;&lt; &quot;x&quot;;
+                    break;
+                  case 1:
+                    out &lt;&lt; &quot;y&quot;;
+                    break;
+                  case 2:
+                    out &lt;&lt; &quot;z&quot;;
+                    break;
+                  case 3:
+                    out &lt;&lt; &quot;w&quot;;
+                    break;
+                  default:
+                    UNREACHABLE();
</ins><span class="cx">                 }
</span><del>-                visitChildren = false;
</del><span class="cx">             }
</span><del>-            break;
</del><ins>+            visitChildren = false;
+        }
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpAdd: writeTriplet(visit, &quot;(&quot;, &quot; + &quot;, &quot;)&quot;); break;
-        case EOpSub: writeTriplet(visit, &quot;(&quot;, &quot; - &quot;, &quot;)&quot;); break;
-        case EOpMul: writeTriplet(visit, &quot;(&quot;, &quot; * &quot;, &quot;)&quot;); break;
-        case EOpDiv: writeTriplet(visit, &quot;(&quot;, &quot; / &quot;, &quot;)&quot;); break;
-        case EOpMod: UNIMPLEMENTED(); break;
-        case EOpEqual: writeTriplet(visit, &quot;(&quot;, &quot; == &quot;, &quot;)&quot;); break;
-        case EOpNotEqual: writeTriplet(visit, &quot;(&quot;, &quot; != &quot;, &quot;)&quot;); break;
-        case EOpLessThan: writeTriplet(visit, &quot;(&quot;, &quot; &lt; &quot;, &quot;)&quot;); break;
-        case EOpGreaterThan: writeTriplet(visit, &quot;(&quot;, &quot; &gt; &quot;, &quot;)&quot;); break;
-        case EOpLessThanEqual: writeTriplet(visit, &quot;(&quot;, &quot; &lt;= &quot;, &quot;)&quot;); break;
-        case EOpGreaterThanEqual: writeTriplet(visit, &quot;(&quot;, &quot; &gt;= &quot;, &quot;)&quot;); break;
</del><ins>+      case EOpAdd:
+        writeTriplet(visit, &quot;(&quot;, &quot; + &quot;, &quot;)&quot;);
+        break;
+      case EOpSub:
+        writeTriplet(visit, &quot;(&quot;, &quot; - &quot;, &quot;)&quot;);
+        break;
+      case EOpMul:
+        writeTriplet(visit, &quot;(&quot;, &quot; * &quot;, &quot;)&quot;);
+        break;
+      case EOpDiv:
+        writeTriplet(visit, &quot;(&quot;, &quot; / &quot;, &quot;)&quot;);
+        break;
+      case EOpIMod:
+        writeTriplet(visit, &quot;(&quot;, &quot; % &quot;, &quot;)&quot;);
+        break;
+      case EOpBitShiftLeft:
+        writeTriplet(visit, &quot;(&quot;, &quot; &lt;&lt; &quot;, &quot;)&quot;);
+        break;
+      case EOpBitShiftRight:
+        writeTriplet(visit, &quot;(&quot;, &quot; &gt;&gt; &quot;, &quot;)&quot;);
+        break;
+      case EOpBitwiseAnd:
+        writeTriplet(visit, &quot;(&quot;, &quot; &amp; &quot;, &quot;)&quot;);
+        break;
+      case EOpBitwiseXor:
+        writeTriplet(visit, &quot;(&quot;, &quot; ^ &quot;, &quot;)&quot;);
+        break;
+      case EOpBitwiseOr:
+        writeTriplet(visit, &quot;(&quot;, &quot; | &quot;, &quot;)&quot;);
+        break;
</ins><span class="cx"> 
</span><del>-        // Notice the fall-through.
-        case EOpVectorTimesScalar:
-        case EOpVectorTimesMatrix:
-        case EOpMatrixTimesVector:
-        case EOpMatrixTimesScalar:
-        case EOpMatrixTimesMatrix:
-            writeTriplet(visit, &quot;(&quot;, &quot; * &quot;, &quot;)&quot;);
-            break;
</del><ins>+      case EOpEqual:
+        writeTriplet(visit, &quot;(&quot;, &quot; == &quot;, &quot;)&quot;);
+        break;
+      case EOpNotEqual:
+        writeTriplet(visit, &quot;(&quot;, &quot; != &quot;, &quot;)&quot;);
+        break;
+      case EOpLessThan:
+        writeTriplet(visit, &quot;(&quot;, &quot; &lt; &quot;, &quot;)&quot;);
+        break;
+      case EOpGreaterThan:
+        writeTriplet(visit, &quot;(&quot;, &quot; &gt; &quot;, &quot;)&quot;);
+        break;
+      case EOpLessThanEqual:
+        writeTriplet(visit, &quot;(&quot;, &quot; &lt;= &quot;, &quot;)&quot;);
+        break;
+      case EOpGreaterThanEqual:
+        writeTriplet(visit, &quot;(&quot;, &quot; &gt;= &quot;, &quot;)&quot;);
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpLogicalOr: writeTriplet(visit, &quot;(&quot;, &quot; || &quot;, &quot;)&quot;); break;
-        case EOpLogicalXor: writeTriplet(visit, &quot;(&quot;, &quot; ^^ &quot;, &quot;)&quot;); break;
-        case EOpLogicalAnd: writeTriplet(visit, &quot;(&quot;, &quot; &amp;&amp; &quot;, &quot;)&quot;); break;
-        default: UNREACHABLE(); break;
</del><ins>+      // Notice the fall-through.
+      case EOpVectorTimesScalar:
+      case EOpVectorTimesMatrix:
+      case EOpMatrixTimesVector:
+      case EOpMatrixTimesScalar:
+      case EOpMatrixTimesMatrix:
+        writeTriplet(visit, &quot;(&quot;, &quot; * &quot;, &quot;)&quot;);
+        break;
+
+      case EOpLogicalOr:
+        writeTriplet(visit, &quot;(&quot;, &quot; || &quot;, &quot;)&quot;);
+        break;
+      case EOpLogicalXor:
+        writeTriplet(visit, &quot;(&quot;, &quot; ^^ &quot;, &quot;)&quot;);
+        break;
+      case EOpLogicalAnd:
+        writeTriplet(visit, &quot;(&quot;, &quot; &amp;&amp; &quot;, &quot;)&quot;);
+        break;
+      default:
+        UNREACHABLE();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return visitChildren;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary* node)
</del><ins>+bool TOutputGLSLBase::visitUnary(Visit visit, TIntermUnary *node)
</ins><span class="cx"> {
</span><span class="cx">     TString preString;
</span><span class="cx">     TString postString = &quot;)&quot;;
</span><span class="cx"> 
</span><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><del>-        case EOpNegative: preString = &quot;(-&quot;; break;
-        case EOpVectorLogicalNot: preString = &quot;not(&quot;; break;
-        case EOpLogicalNot: preString = &quot;(!&quot;; break;
</del><ins>+      case EOpNegative: preString = &quot;(-&quot;; break;
+      case EOpPositive: preString = &quot;(+&quot;; break;
+      case EOpVectorLogicalNot: preString = &quot;not(&quot;; break;
+      case EOpLogicalNot: preString = &quot;(!&quot;; break;
+      case EOpBitwiseNot: preString = &quot;(~&quot;; break;
</ins><span class="cx"> 
</span><del>-        case EOpPostIncrement: preString = &quot;(&quot;; postString = &quot;++)&quot;; break;
-        case EOpPostDecrement: preString = &quot;(&quot;; postString = &quot;--)&quot;; break;
-        case EOpPreIncrement: preString = &quot;(++&quot;; break;
-        case EOpPreDecrement: preString = &quot;(--&quot;; break;
</del><ins>+      case EOpPostIncrement: preString = &quot;(&quot;; postString = &quot;++)&quot;; break;
+      case EOpPostDecrement: preString = &quot;(&quot;; postString = &quot;--)&quot;; break;
+      case EOpPreIncrement: preString = &quot;(++&quot;; break;
+      case EOpPreDecrement: preString = &quot;(--&quot;; break;
</ins><span class="cx"> 
</span><del>-        case EOpConvIntToBool:
-        case EOpConvFloatToBool:
-            switch (node-&gt;getOperand()-&gt;getType().getNominalSize())
-            {
-                case 1: preString =  &quot;bool(&quot;;  break;
-                case 2: preString = &quot;bvec2(&quot;; break;
-                case 3: preString = &quot;bvec3(&quot;; break;
-                case 4: preString = &quot;bvec4(&quot;; break;
-                default: UNREACHABLE();
-            }
-            break;
-        case EOpConvBoolToFloat:
-        case EOpConvIntToFloat:
-            switch (node-&gt;getOperand()-&gt;getType().getNominalSize())
-            {
-                case 1: preString = &quot;float(&quot;;  break;
-                case 2: preString = &quot;vec2(&quot;; break;
-                case 3: preString = &quot;vec3(&quot;; break;
-                case 4: preString = &quot;vec4(&quot;; break;
-                default: UNREACHABLE();
-            }
-            break;
-        case EOpConvFloatToInt:
-        case EOpConvBoolToInt:
-            switch (node-&gt;getOperand()-&gt;getType().getNominalSize())
-            {
-                case 1: preString = &quot;int(&quot;;  break;
-                case 2: preString = &quot;ivec2(&quot;; break;
-                case 3: preString = &quot;ivec3(&quot;; break;
-                case 4: preString = &quot;ivec4(&quot;; break;
-                default: UNREACHABLE();
-            }
-            break;
</del><ins>+      case EOpRadians:
+        preString = &quot;radians(&quot;;
+        break;
+      case EOpDegrees:
+        preString = &quot;degrees(&quot;;
+        break;
+      case EOpSin:
+        preString = &quot;sin(&quot;;
+        break;
+      case EOpCos:
+        preString = &quot;cos(&quot;;
+        break;
+      case EOpTan:
+        preString = &quot;tan(&quot;;
+        break;
+      case EOpAsin:
+        preString = &quot;asin(&quot;;
+        break;
+      case EOpAcos:
+        preString = &quot;acos(&quot;;
+        break;
+      case EOpAtan:
+        preString = &quot;atan(&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpRadians: preString = &quot;radians(&quot;; break;
-        case EOpDegrees: preString = &quot;degrees(&quot;; break;
-        case EOpSin: preString = &quot;sin(&quot;; break;
-        case EOpCos: preString = &quot;cos(&quot;; break;
-        case EOpTan: preString = &quot;tan(&quot;; break;
-        case EOpAsin: preString = &quot;asin(&quot;; break;
-        case EOpAcos: preString = &quot;acos(&quot;; break;
-        case EOpAtan: preString = &quot;atan(&quot;; break;
</del><ins>+      case EOpSinh:
+        preString = &quot;sinh(&quot;;
+        break;
+      case EOpCosh:
+        preString = &quot;cosh(&quot;;
+        break;
+      case EOpTanh:
+        preString = &quot;tanh(&quot;;
+        break;
+      case EOpAsinh:
+        preString = &quot;asinh(&quot;;
+        break;
+      case EOpAcosh:
+        preString = &quot;acosh(&quot;;
+        break;
+      case EOpAtanh:
+        preString = &quot;atanh(&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpExp: preString = &quot;exp(&quot;; break;
-        case EOpLog: preString = &quot;log(&quot;; break;
-        case EOpExp2: preString = &quot;exp2(&quot;; break;
-        case EOpLog2: preString = &quot;log2(&quot;; break;
-        case EOpSqrt: preString = &quot;sqrt(&quot;; break;
-        case EOpInverseSqrt: preString = &quot;inversesqrt(&quot;; break;
</del><ins>+      case EOpExp:
+        preString = &quot;exp(&quot;;
+        break;
+      case EOpLog:
+        preString = &quot;log(&quot;;
+        break;
+      case EOpExp2:
+        preString = &quot;exp2(&quot;;
+        break;
+      case EOpLog2:
+        preString = &quot;log2(&quot;;
+        break;
+      case EOpSqrt:
+        preString = &quot;sqrt(&quot;;
+        break;
+      case EOpInverseSqrt:
+        preString = &quot;inversesqrt(&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpAbs: preString = &quot;abs(&quot;; break;
-        case EOpSign: preString = &quot;sign(&quot;; break;
-        case EOpFloor: preString = &quot;floor(&quot;; break;
-        case EOpCeil: preString = &quot;ceil(&quot;; break;
-        case EOpFract: preString = &quot;fract(&quot;; break;
</del><ins>+      case EOpAbs:
+        preString = &quot;abs(&quot;;
+        break;
+      case EOpSign:
+        preString = &quot;sign(&quot;;
+        break;
+      case EOpFloor:
+        preString = &quot;floor(&quot;;
+        break;
+      case EOpTrunc:
+        preString = &quot;trunc(&quot;;
+        break;
+      case EOpRound:
+        preString = &quot;round(&quot;;
+        break;
+      case EOpRoundEven:
+        preString = &quot;roundEven(&quot;;
+        break;
+      case EOpCeil:
+        preString = &quot;ceil(&quot;;
+        break;
+      case EOpFract:
+        preString = &quot;fract(&quot;;
+        break;
+      case EOpIsNan:
+        preString = &quot;isnan(&quot;;
+        break;
+      case EOpIsInf:
+        preString = &quot;isinf(&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpLength: preString = &quot;length(&quot;; break;
-        case EOpNormalize: preString = &quot;normalize(&quot;; break;
</del><ins>+      case EOpFloatBitsToInt:
+        preString = &quot;floatBitsToInt(&quot;;
+        break;
+      case EOpFloatBitsToUint:
+        preString = &quot;floatBitsToUint(&quot;;
+        break;
+      case EOpIntBitsToFloat:
+        preString = &quot;intBitsToFloat(&quot;;
+        break;
+      case EOpUintBitsToFloat:
+        preString = &quot;uintBitsToFloat(&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpDFdx: preString = &quot;dFdx(&quot;; break;
-        case EOpDFdy: preString = &quot;dFdy(&quot;; break;
-        case EOpFwidth: preString = &quot;fwidth(&quot;; break;
</del><ins>+      case EOpPackSnorm2x16:
+        preString = &quot;packSnorm2x16(&quot;;
+        break;
+      case EOpPackUnorm2x16:
+        preString = &quot;packUnorm2x16(&quot;;
+        break;
+      case EOpPackHalf2x16:
+        preString = &quot;packHalf2x16(&quot;;
+        break;
+      case EOpUnpackSnorm2x16:
+        preString = &quot;unpackSnorm2x16(&quot;;
+        break;
+      case EOpUnpackUnorm2x16:
+        preString = &quot;unpackUnorm2x16(&quot;;
+        break;
+      case EOpUnpackHalf2x16:
+        preString = &quot;unpackHalf2x16(&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpAny: preString = &quot;any(&quot;; break;
-        case EOpAll: preString = &quot;all(&quot;; break;
</del><ins>+      case EOpLength:
+        preString = &quot;length(&quot;;
+        break;
+      case EOpNormalize:
+        preString = &quot;normalize(&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        default: UNREACHABLE(); break;
</del><ins>+      case EOpDFdx:
+        preString = &quot;dFdx(&quot;;
+        break;
+      case EOpDFdy:
+        preString = &quot;dFdy(&quot;;
+        break;
+      case EOpFwidth:
+        preString = &quot;fwidth(&quot;;
+        break;
+
+      case EOpTranspose:
+        preString = &quot;transpose(&quot;;
+        break;
+      case EOpDeterminant:
+        preString = &quot;determinant(&quot;;
+        break;
+      case EOpInverse:
+        preString = &quot;inverse(&quot;;
+        break;
+
+      case EOpAny:
+        preString = &quot;any(&quot;;
+        break;
+      case EOpAll:
+        preString = &quot;all(&quot;;
+        break;
+
+      default:
+        UNREACHABLE();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (visit == PreVisit &amp;&amp; node-&gt;getUseEmulatedFunction())
</span><span class="lines">@@ -413,9 +674,9 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection* node)
</del><ins>+bool TOutputGLSLBase::visitSelection(Visit visit, TIntermSelection *node)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx"> 
</span><span class="cx">     if (node-&gt;usesTernaryOperator())
</span><span class="cx">     {
</span><span class="lines">@@ -450,195 +711,323 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate* node)
</del><ins>+bool TOutputGLSLBase::visitSwitch(Visit visit, TIntermSwitch *node)
</ins><span class="cx"> {
</span><ins>+    if (node-&gt;getStatementList())
+    {
+        writeTriplet(visit, &quot;switch (&quot;, &quot;) &quot;, nullptr);
+        // The curly braces get written when visiting the statementList aggregate
+    }
+    else
+    {
+        // No statementList, so it won't output curly braces
+        writeTriplet(visit, &quot;switch (&quot;, &quot;) {&quot;, &quot;}\n&quot;);
+    }
+    return true;
+}
+
+bool TOutputGLSLBase::visitCase(Visit visit, TIntermCase *node)
+{
+    if (node-&gt;hasCondition())
+    {
+        writeTriplet(visit, &quot;case (&quot;, nullptr, &quot;):\n&quot;);
+        return true;
+    }
+    else
+    {
+        TInfoSinkBase &amp;out = objSink();
+        out &lt;&lt; &quot;default:\n&quot;;
+        return false;
+    }
+}
+
+bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
+{
</ins><span class="cx">     bool visitChildren = true;
</span><del>-    TInfoSinkBase&amp; out = objSink();
-    TString preString;
-    bool delayedWrite = false;
</del><ins>+    TInfoSinkBase &amp;out = objSink();
+    bool useEmulatedFunction = (visit == PreVisit &amp;&amp; node-&gt;getUseEmulatedFunction());
</ins><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><del>-        case EOpSequence: {
-            // Scope the sequences except when at the global scope.
-            if (depth &gt; 0) out &lt;&lt; &quot;{\n&quot;;
</del><ins>+      case EOpSequence:
+        // Scope the sequences except when at the global scope.
+        if (mDepth &gt; 0)
+        {
+            out &lt;&lt; &quot;{\n&quot;;
+        }
</ins><span class="cx"> 
</span><del>-            incrementDepth(node);
-            const TIntermSequence&amp; sequence = node-&gt;getSequence();
-            for (TIntermSequence::const_iterator iter = sequence.begin();
-                 iter != sequence.end(); ++iter)
-            {
-                TIntermNode* node = *iter;
-                ASSERT(node != NULL);
-                node-&gt;traverse(this);
</del><ins>+        incrementDepth(node);
+        for (TIntermSequence::const_iterator iter = node-&gt;getSequence()-&gt;begin();
+             iter != node-&gt;getSequence()-&gt;end(); ++iter)
+        {
+            TIntermNode *curNode = *iter;
+            ASSERT(curNode != NULL);
+            curNode-&gt;traverse(this);
</ins><span class="cx"> 
</span><del>-                if (isSingleStatement(node))
-                    out &lt;&lt; &quot;;\n&quot;;
-            }
-            decrementDepth();
</del><ins>+            if (isSingleStatement(curNode))
+                out &lt;&lt; &quot;;\n&quot;;
+        }
+        decrementDepth();
</ins><span class="cx"> 
</span><del>-            // Scope the sequences except when at the global scope.
-            if (depth &gt; 0) out &lt;&lt; &quot;}\n&quot;;
-            visitChildren = false;
-            break;
</del><ins>+        // Scope the sequences except when at the global scope.
+        if (mDepth &gt; 0)
+        {
+            out &lt;&lt; &quot;}\n&quot;;
</ins><span class="cx">         }
</span><del>-        case EOpPrototype: {
-            // Function declaration.
-            ASSERT(visit == PreVisit);
-            writeVariableType(node-&gt;getType());
-            out &lt;&lt; &quot; &quot; &lt;&lt; hashName(node-&gt;getName());
</del><ins>+        visitChildren = false;
+        break;
+      case EOpPrototype:
+        // Function declaration.
+        ASSERT(visit == PreVisit);
+        {
+            const TType &amp;type = node-&gt;getType();
+            writeVariableType(type);
+            if (type.isArray())
+                out &lt;&lt; arrayBrackets(type);
+        }
</ins><span class="cx"> 
</span><del>-            out &lt;&lt; &quot;(&quot;;
-            writeFunctionParameters(node-&gt;getSequence());
-            out &lt;&lt; &quot;)&quot;;
</del><ins>+        out &lt;&lt; &quot; &quot; &lt;&lt; hashFunctionName(node-&gt;getName());
</ins><span class="cx"> 
</span><del>-            visitChildren = false;
-            break;
</del><ins>+        out &lt;&lt; &quot;(&quot;;
+        writeFunctionParameters(*(node-&gt;getSequence()));
+        out &lt;&lt; &quot;)&quot;;
+
+        visitChildren = false;
+        break;
+      case EOpFunction: {
+        // Function definition.
+        ASSERT(visit == PreVisit);
+        {
+            const TType &amp;type = node-&gt;getType();
+            writeVariableType(type);
+            if (type.isArray())
+                out &lt;&lt; arrayBrackets(type);
</ins><span class="cx">         }
</span><del>-        case EOpFunction: {
-            // Function definition.
-            ASSERT(visit == PreVisit);
-            writeVariableType(node-&gt;getType());
-            out &lt;&lt; &quot; &quot; &lt;&lt; hashFunctionName(node-&gt;getName());
</del><span class="cx"> 
</span><del>-            incrementDepth(node);
-            // Function definition node contains one or two children nodes
-            // representing function parameters and function body. The latter
-            // is not present in case of empty function bodies.
-            const TIntermSequence&amp; sequence = node-&gt;getSequence();
-            ASSERT((sequence.size() == 1) || (sequence.size() == 2));
-            TIntermSequence::const_iterator seqIter = sequence.begin();
</del><ins>+        out &lt;&lt; &quot; &quot; &lt;&lt; hashFunctionName(node-&gt;getName());
</ins><span class="cx"> 
</span><del>-            // Traverse function parameters.
-            TIntermAggregate* params = (*seqIter)-&gt;getAsAggregate();
-            ASSERT(params != NULL);
-            ASSERT(params-&gt;getOp() == EOpParameters);
-            params-&gt;traverse(this);
</del><ins>+        incrementDepth(node);
+        // Function definition node contains one or two children nodes
+        // representing function parameters and function body. The latter
+        // is not present in case of empty function bodies.
+        const TIntermSequence &amp;sequence = *(node-&gt;getSequence());
+        ASSERT((sequence.size() == 1) || (sequence.size() == 2));
+        TIntermSequence::const_iterator seqIter = sequence.begin();
</ins><span class="cx"> 
</span><del>-            // Traverse function body.
-            TIntermAggregate* body = ++seqIter != sequence.end() ?
-                (*seqIter)-&gt;getAsAggregate() : NULL;
-            visitCodeBlock(body);
-            decrementDepth();

-            // Fully processed; no need to visit children.
-            visitChildren = false;
-            break;
-        }
-        case EOpFunctionCall:
-            // Function call.
-            if (visit == PreVisit)
-            {
-                out &lt;&lt; hashFunctionName(node-&gt;getName()) &lt;&lt; &quot;(&quot;;
-            }
-            else if (visit == InVisit)
-            {
-                out &lt;&lt; &quot;, &quot;;
-            }
-            else
-            {
-                out &lt;&lt; &quot;)&quot;;
-            }
-            break;
-        case EOpParameters: {
-            // Function parameters.
-            ASSERT(visit == PreVisit);
-            out &lt;&lt; &quot;(&quot;;
-            writeFunctionParameters(node-&gt;getSequence());
</del><ins>+        // Traverse function parameters.
+        TIntermAggregate *params = (*seqIter)-&gt;getAsAggregate();
+        ASSERT(params != NULL);
+        ASSERT(params-&gt;getOp() == EOpParameters);
+        params-&gt;traverse(this);
+
+        // Traverse function body.
+        TIntermAggregate *body = ++seqIter != sequence.end() ?
+            (*seqIter)-&gt;getAsAggregate() : NULL;
+        visitCodeBlock(body);
+        decrementDepth();
+
+        // Fully processed; no need to visit children.
+        visitChildren = false;
+        break;
+      }
+      case EOpFunctionCall:
+        // Function call.
+        if (visit == PreVisit)
+            out &lt;&lt; hashFunctionName(node-&gt;getName()) &lt;&lt; &quot;(&quot;;
+        else if (visit == InVisit)
+            out &lt;&lt; &quot;, &quot;;
+        else
</ins><span class="cx">             out &lt;&lt; &quot;)&quot;;
</span><del>-            visitChildren = false;
-            break;
</del><ins>+        break;
+      case EOpInternalFunctionCall:
+        // Function call to an internal helper function.
+        if (visit == PreVisit)
+            out &lt;&lt; node-&gt;getName() &lt;&lt; &quot;(&quot;;
+        else if (visit == InVisit)
+            out &lt;&lt; &quot;, &quot;;
+        else
+            out &lt;&lt; &quot;)&quot;;
+        break;
+      case EOpParameters:
+        // Function parameters.
+        ASSERT(visit == PreVisit);
+        out &lt;&lt; &quot;(&quot;;
+        writeFunctionParameters(*(node-&gt;getSequence()));
+        out &lt;&lt; &quot;)&quot;;
+        visitChildren = false;
+        break;
+      case EOpDeclaration:
+        // Variable declaration.
+        if (visit == PreVisit)
+        {
+            const TIntermSequence &amp;sequence = *(node-&gt;getSequence());
+            const TIntermTyped *variable = sequence.front()-&gt;getAsTyped();
+            writeVariableType(variable-&gt;getType());
+            out &lt;&lt; &quot; &quot;;
+            mDeclaringVariables = true;
</ins><span class="cx">         }
</span><del>-        case EOpDeclaration: {
-            // Variable declaration.
-            if (visit == PreVisit)
-            {
-                const TIntermSequence&amp; sequence = node-&gt;getSequence();
-                const TIntermTyped* variable = sequence.front()-&gt;getAsTyped();
-                writeVariableType(variable-&gt;getType());
-                out &lt;&lt; &quot; &quot;;
-                mDeclaringVariables = true;
-            }
-            else if (visit == InVisit)
-            {
-                out &lt;&lt; &quot;, &quot;;
-                mDeclaringVariables = true;
-            }
-            else
-            {
-                mDeclaringVariables = false;
-            }
</del><ins>+        else if (visit == InVisit)
+        {
+            out &lt;&lt; &quot;, &quot;;
+            mDeclaringVariables = true;
+        }
+        else
+        {
+            mDeclaringVariables = false;
+        }
+        break;
+      case EOpInvariantDeclaration:
+        // Invariant declaration.
+        ASSERT(visit == PreVisit);
+        {
+            const TIntermSequence *sequence = node-&gt;getSequence();
+            ASSERT(sequence &amp;&amp; sequence-&gt;size() == 1);
+            const TIntermSymbol *symbol = sequence-&gt;front()-&gt;getAsSymbolNode();
+            ASSERT(symbol);
+            out &lt;&lt; &quot;invariant &quot; &lt;&lt; hashVariableName(symbol-&gt;getSymbol());
+        }
+        visitChildren = false;
+        break;
+      case EOpConstructFloat:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;float&quot;);
+        break;
+      case EOpConstructVec2:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;vec2&quot;);
+        break;
+      case EOpConstructVec3:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;vec3&quot;);
+        break;
+      case EOpConstructVec4:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;vec4&quot;);
+        break;
+      case EOpConstructBool:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;bool&quot;);
+        break;
+      case EOpConstructBVec2:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;bvec2&quot;);
+        break;
+      case EOpConstructBVec3:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;bvec3&quot;);
+        break;
+      case EOpConstructBVec4:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;bvec4&quot;);
+        break;
+      case EOpConstructInt:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;int&quot;);
+        break;
+      case EOpConstructIVec2:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;ivec2&quot;);
+        break;
+      case EOpConstructIVec3:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;ivec3&quot;);
+        break;
+      case EOpConstructIVec4:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;ivec4&quot;);
+        break;
+      case EOpConstructMat2:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;mat2&quot;);
+        break;
+      case EOpConstructMat3:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;mat3&quot;);
+        break;
+      case EOpConstructMat4:
+        writeConstructorTriplet(visit, node-&gt;getType(), &quot;mat4&quot;);
+        break;
+      case EOpConstructStruct:
+        {
+            const TType &amp;type = node-&gt;getType();
+            ASSERT(type.getBasicType() == EbtStruct);
+            TString constructorName = hashName(type.getStruct()-&gt;name());
+            writeConstructorTriplet(visit, node-&gt;getType(), constructorName.c_str());
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><del>-        case EOpConstructFloat: writeTriplet(visit, &quot;float(&quot;, NULL, &quot;)&quot;); break;
-        case EOpConstructVec2: writeTriplet(visit, &quot;vec2(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructVec3: writeTriplet(visit, &quot;vec3(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructVec4: writeTriplet(visit, &quot;vec4(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructBool: writeTriplet(visit, &quot;bool(&quot;, NULL, &quot;)&quot;); break;
-        case EOpConstructBVec2: writeTriplet(visit, &quot;bvec2(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructBVec3: writeTriplet(visit, &quot;bvec3(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructBVec4: writeTriplet(visit, &quot;bvec4(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructInt: writeTriplet(visit, &quot;int(&quot;, NULL, &quot;)&quot;); break;
-        case EOpConstructIVec2: writeTriplet(visit, &quot;ivec2(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructIVec3: writeTriplet(visit, &quot;ivec3(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructIVec4: writeTriplet(visit, &quot;ivec4(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructMat2: writeTriplet(visit, &quot;mat2(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructMat3: writeTriplet(visit, &quot;mat3(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructMat4: writeTriplet(visit, &quot;mat4(&quot;, &quot;, &quot;, &quot;)&quot;); break;
-        case EOpConstructStruct:
-            if (visit == PreVisit)
-            {
-                const TType&amp; type = node-&gt;getType();
-                ASSERT(type.getBasicType() == EbtStruct);
-                out &lt;&lt; hashName(type.getStruct()-&gt;name()) &lt;&lt; &quot;(&quot;;
-            }
-            else if (visit == InVisit)
-            {
-                out &lt;&lt; &quot;, &quot;;
-            }
-            else
-            {
-                out &lt;&lt; &quot;)&quot;;
-            }
-            break;
</del><span class="cx"> 
</span><del>-        case EOpLessThan: preString = &quot;lessThan(&quot;; delayedWrite = true; break;
-        case EOpGreaterThan: preString = &quot;greaterThan(&quot;; delayedWrite = true; break;
-        case EOpLessThanEqual: preString = &quot;lessThanEqual(&quot;; delayedWrite = true; break;
-        case EOpGreaterThanEqual: preString = &quot;greaterThanEqual(&quot;; delayedWrite = true; break;
-        case EOpVectorEqual: preString = &quot;equal(&quot;; delayedWrite = true; break;
-        case EOpVectorNotEqual: preString = &quot;notEqual(&quot;; delayedWrite = true; break;
-        case EOpComma: writeTriplet(visit, NULL, &quot;, &quot;, NULL); break;
</del><ins>+      case EOpOuterProduct:
+        writeBuiltInFunctionTriplet(visit, &quot;outerProduct(&quot;, useEmulatedFunction);
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpMod: preString = &quot;mod(&quot;; delayedWrite = true; break;
-        case EOpPow: preString = &quot;pow(&quot;; delayedWrite = true; break;
-        case EOpAtan: preString = &quot;atan(&quot;; delayedWrite = true; break;
-        case EOpMin: preString = &quot;min(&quot;; delayedWrite = true; break;
-        case EOpMax: preString = &quot;max(&quot;; delayedWrite = true; break;
-        case EOpClamp: preString = &quot;clamp(&quot;; delayedWrite = true; break;
-        case EOpMix: preString = &quot;mix(&quot;; delayedWrite = true; break;
-        case EOpStep: preString = &quot;step(&quot;; delayedWrite = true; break;
-        case EOpSmoothStep: preString = &quot;smoothstep(&quot;; delayedWrite = true; break;
</del><ins>+      case EOpLessThan:
+        writeBuiltInFunctionTriplet(visit, &quot;lessThan(&quot;, useEmulatedFunction);
+        break;
+      case EOpGreaterThan:
+        writeBuiltInFunctionTriplet(visit, &quot;greaterThan(&quot;, useEmulatedFunction);
+        break;
+      case EOpLessThanEqual:
+        writeBuiltInFunctionTriplet(visit, &quot;lessThanEqual(&quot;, useEmulatedFunction);
+        break;
+      case EOpGreaterThanEqual:
+        writeBuiltInFunctionTriplet(visit, &quot;greaterThanEqual(&quot;, useEmulatedFunction);
+        break;
+      case EOpVectorEqual:
+        writeBuiltInFunctionTriplet(visit, &quot;equal(&quot;, useEmulatedFunction);
+        break;
+      case EOpVectorNotEqual:
+        writeBuiltInFunctionTriplet(visit, &quot;notEqual(&quot;, useEmulatedFunction);
+        break;
+      case EOpComma:
+        writeTriplet(visit, &quot;(&quot;, &quot;, &quot;, &quot;)&quot;);
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpDistance: preString = &quot;distance(&quot;; delayedWrite = true; break;
-        case EOpDot: preString = &quot;dot(&quot;; delayedWrite = true; break;
-        case EOpCross: preString = &quot;cross(&quot;; delayedWrite = true; break;
-        case EOpFaceForward: preString = &quot;faceforward(&quot;; delayedWrite = true; break;
-        case EOpReflect: preString = &quot;reflect(&quot;; delayedWrite = true; break;
-        case EOpRefract: preString = &quot;refract(&quot;; delayedWrite = true; break;
-        case EOpMul: preString = &quot;matrixCompMult(&quot;; delayedWrite = true; break;
</del><ins>+      case EOpMod:
+        writeBuiltInFunctionTriplet(visit, &quot;mod(&quot;, useEmulatedFunction);
+        break;
+      case EOpModf:
+        writeBuiltInFunctionTriplet(visit, &quot;modf(&quot;, useEmulatedFunction);
+        break;
+      case EOpPow:
+        writeBuiltInFunctionTriplet(visit, &quot;pow(&quot;, useEmulatedFunction);
+        break;
+      case EOpAtan:
+        writeBuiltInFunctionTriplet(visit, &quot;atan(&quot;, useEmulatedFunction);
+        break;
+      case EOpMin:
+        writeBuiltInFunctionTriplet(visit, &quot;min(&quot;, useEmulatedFunction);
+        break;
+      case EOpMax:
+        writeBuiltInFunctionTriplet(visit, &quot;max(&quot;, useEmulatedFunction);
+        break;
+      case EOpClamp:
+        writeBuiltInFunctionTriplet(visit, &quot;clamp(&quot;, useEmulatedFunction);
+        break;
+      case EOpMix:
+        writeBuiltInFunctionTriplet(visit, &quot;mix(&quot;, useEmulatedFunction);
+        break;
+      case EOpStep:
+        writeBuiltInFunctionTriplet(visit, &quot;step(&quot;, useEmulatedFunction);
+        break;
+      case EOpSmoothStep:
+        writeBuiltInFunctionTriplet(visit, &quot;smoothstep(&quot;, useEmulatedFunction);
+        break;
+      case EOpDistance:
+        writeBuiltInFunctionTriplet(visit, &quot;distance(&quot;, useEmulatedFunction);
+        break;
+      case EOpDot:
+        writeBuiltInFunctionTriplet(visit, &quot;dot(&quot;, useEmulatedFunction);
+        break;
+      case EOpCross:
+        writeBuiltInFunctionTriplet(visit, &quot;cross(&quot;, useEmulatedFunction);
+        break;
+      case EOpFaceForward:
+        writeBuiltInFunctionTriplet(visit, &quot;faceforward(&quot;, useEmulatedFunction);
+        break;
+      case EOpReflect:
+        writeBuiltInFunctionTriplet(visit, &quot;reflect(&quot;, useEmulatedFunction);
+        break;
+      case EOpRefract:
+        writeBuiltInFunctionTriplet(visit, &quot;refract(&quot;, useEmulatedFunction);
+        break;
+      case EOpMul:
+        writeBuiltInFunctionTriplet(visit, &quot;matrixCompMult(&quot;, useEmulatedFunction);
+        break;
</ins><span class="cx"> 
</span><del>-        default: UNREACHABLE(); break;
</del><ins>+      default:
+        UNREACHABLE();
</ins><span class="cx">     }
</span><del>-    if (delayedWrite &amp;&amp; visit == PreVisit &amp;&amp; node-&gt;getUseEmulatedFunction())
-        preString = BuiltInFunctionEmulator::GetEmulatedFunctionName(preString);
-    if (delayedWrite)
-        writeTriplet(visit, preString.c_str(), &quot;, &quot;, &quot;)&quot;);
</del><span class="cx">     return visitChildren;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop* node)
</del><ins>+bool TOutputGLSLBase::visitLoop(Visit visit, TIntermLoop *node)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx"> 
</span><span class="cx">     incrementDepth(node);
</span><span class="cx">     // Loop header.
</span><span class="lines">@@ -663,10 +1052,10 @@
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="cx">             // Need to put a one-iteration loop here to handle break.
</span><del>-            TIntermSequence &amp;declSeq =
</del><ins>+            TIntermSequence *declSeq =
</ins><span class="cx">                 node-&gt;getInit()-&gt;getAsAggregate()-&gt;getSequence();
</span><span class="cx">             TIntermSymbol *indexSymbol =
</span><del>-                declSeq[0]-&gt;getAsBinaryNode()-&gt;getLeft()-&gt;getAsSymbolNode();
</del><ins>+                (*declSeq)[0]-&gt;getAsBinaryNode()-&gt;getLeft()-&gt;getAsSymbolNode();
</ins><span class="cx">             TString name = hashVariableName(indexSymbol-&gt;getSymbol());
</span><span class="cx">             out &lt;&lt; &quot;for (int &quot; &lt;&lt; name &lt;&lt; &quot; = 0; &quot;
</span><span class="cx">                 &lt;&lt; name &lt;&lt; &quot; &lt; 1; &quot;
</span><span class="lines">@@ -719,21 +1108,31 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputGLSLBase::visitBranch(Visit visit, TIntermBranch* node)
</del><ins>+bool TOutputGLSLBase::visitBranch(Visit visit, TIntermBranch *node)
</ins><span class="cx"> {
</span><span class="cx">     switch (node-&gt;getFlowOp())
</span><span class="cx">     {
</span><del>-        case EOpKill: writeTriplet(visit, &quot;discard&quot;, NULL, NULL); break;
-        case EOpBreak: writeTriplet(visit, &quot;break&quot;, NULL, NULL); break;
-        case EOpContinue: writeTriplet(visit, &quot;continue&quot;, NULL, NULL); break;
-        case EOpReturn: writeTriplet(visit, &quot;return &quot;, NULL, NULL); break;
-        default: UNREACHABLE(); break;
</del><ins>+      case EOpKill:
+        writeTriplet(visit, &quot;discard&quot;, NULL, NULL);
+        break;
+      case EOpBreak:
+        writeTriplet(visit, &quot;break&quot;, NULL, NULL);
+        break;
+      case EOpContinue:
+        writeTriplet(visit, &quot;continue&quot;, NULL, NULL);
+        break;
+      case EOpReturn:
+        writeTriplet(visit, &quot;return &quot;, NULL, NULL);
+        break;
+      default:
+        UNREACHABLE();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSLBase::visitCodeBlock(TIntermNode* node) {
</del><ins>+void TOutputGLSLBase::visitCodeBlock(TIntermNode *node)
+{
</ins><span class="cx">     TInfoSinkBase &amp;out = objSink();
</span><span class="cx">     if (node != NULL)
</span><span class="cx">     {
</span><span class="lines">@@ -749,7 +1148,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString TOutputGLSLBase::getTypeName(const TType&amp; type)
</del><ins>+TString TOutputGLSLBase::getTypeName(const TType &amp;type)
</ins><span class="cx"> {
</span><span class="cx">     TInfoSinkBase out;
</span><span class="cx">     if (type.isMatrix())
</span><span class="lines">@@ -761,10 +1160,17 @@
</span><span class="cx">     {
</span><span class="cx">         switch (type.getBasicType())
</span><span class="cx">         {
</span><del>-            case EbtFloat: out &lt;&lt; &quot;vec&quot;; break;
-            case EbtInt: out &lt;&lt; &quot;ivec&quot;; break;
-            case EbtBool: out &lt;&lt; &quot;bvec&quot;; break;
-            default: UNREACHABLE(); break;
</del><ins>+          case EbtFloat:
+            out &lt;&lt; &quot;vec&quot;;
+            break;
+          case EbtInt:
+            out &lt;&lt; &quot;ivec&quot;;
+            break;
+          case EbtBool:
+            out &lt;&lt; &quot;bvec&quot;;
+            break;
+          default:
+            UNREACHABLE();
</ins><span class="cx">         }
</span><span class="cx">         out &lt;&lt; type.getNominalSize();
</span><span class="cx">     }
</span><span class="lines">@@ -778,7 +1184,7 @@
</span><span class="cx">     return TString(out.c_str());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString TOutputGLSLBase::hashName(const TString&amp; name)
</del><ins>+TString TOutputGLSLBase::hashName(const TString &amp;name)
</ins><span class="cx"> {
</span><span class="cx">     if (mHashFunction == NULL || name.empty())
</span><span class="cx">         return name;
</span><span class="lines">@@ -790,37 +1196,41 @@
</span><span class="cx">     return hashedName;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString TOutputGLSLBase::hashVariableName(const TString&amp; name)
</del><ins>+TString TOutputGLSLBase::hashVariableName(const TString &amp;name)
</ins><span class="cx"> {
</span><span class="cx">     if (mSymbolTable.findBuiltIn(name, mShaderVersion) != NULL)
</span><span class="cx">         return name;
</span><span class="cx">     return hashName(name);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString TOutputGLSLBase::hashFunctionName(const TString&amp; mangled_name)
</del><ins>+TString TOutputGLSLBase::hashFunctionName(const TString &amp;mangled_name)
</ins><span class="cx"> {
</span><span class="cx">     TString name = TFunction::unmangleName(mangled_name);
</span><span class="cx">     if (mSymbolTable.findBuiltIn(mangled_name, mShaderVersion) != NULL || name == &quot;main&quot;)
</span><del>-    {
</del><span class="cx">         return translateTextureFunction(name);
</span><del>-    }
</del><span class="cx">     return hashName(name);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputGLSLBase::structDeclared(const TStructure* structure) const
</del><ins>+bool TOutputGLSLBase::structDeclared(const TStructure *structure) const
</ins><span class="cx"> {
</span><del>-    return mDeclaredStructs.find(structure-&gt;name()) != mDeclaredStructs.end();
</del><ins>+    ASSERT(structure);
+    if (structure-&gt;name().empty())
+    {
+        return false;
+    }
+
+    return (mDeclaredStructs.count(structure-&gt;uniqueId()) &gt; 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputGLSLBase::declareStruct(const TStructure* structure)
</del><ins>+void TOutputGLSLBase::declareStruct(const TStructure *structure)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = objSink();
</del><ins>+    TInfoSinkBase &amp;out = objSink();
</ins><span class="cx"> 
</span><span class="cx">     out &lt;&lt; &quot;struct &quot; &lt;&lt; hashName(structure-&gt;name()) &lt;&lt; &quot;{\n&quot;;
</span><del>-    const TFieldList&amp; fields = structure-&gt;fields();
</del><ins>+    const TFieldList &amp;fields = structure-&gt;fields();
</ins><span class="cx">     for (size_t i = 0; i &lt; fields.size(); ++i)
</span><span class="cx">     {
</span><del>-        const TField* field = fields[i];
</del><ins>+        const TField *field = fields[i];
</ins><span class="cx">         if (writeVariablePrecision(field-&gt;type()-&gt;getPrecision()))
</span><span class="cx">             out &lt;&lt; &quot; &quot;;
</span><span class="cx">         out &lt;&lt; getTypeName(*field-&gt;type()) &lt;&lt; &quot; &quot; &lt;&lt; hashName(field-&gt;name());
</span><span class="lines">@@ -829,6 +1239,5 @@
</span><span class="cx">         out &lt;&lt; &quot;;\n&quot;;
</span><span class="cx">     }
</span><span class="cx">     out &lt;&lt; &quot;}&quot;;
</span><ins>+}
</ins><span class="cx"> 
</span><del>-    mDeclaredStructs.insert(structure-&gt;name());
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputGLSLBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputGLSLBase.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,68 +4,75 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
-#define CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_OUTPUTGLSLBASE_H_
+#define COMPILER_TRANSLATOR_OUTPUTGLSLBASE_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;set&gt;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/LoopInfo.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><span class="cx"> 
</span><span class="cx"> class TOutputGLSLBase : public TIntermTraverser
</span><span class="cx"> {
</span><del>-public:
-    TOutputGLSLBase(TInfoSinkBase&amp; objSink,
</del><ins>+  public:
+    TOutputGLSLBase(TInfoSinkBase &amp;objSink,
</ins><span class="cx">                     ShArrayIndexClampingStrategy clampingStrategy,
</span><span class="cx">                     ShHashFunction64 hashFunction,
</span><del>-                    NameMap&amp; nameMap,
</del><ins>+                    NameMap &amp;nameMap,
</ins><span class="cx">                     TSymbolTable&amp; symbolTable,
</span><del>-                    int shaderVersion);
</del><ins>+                    int shaderVersion,
+                    ShShaderOutput output);
</ins><span class="cx"> 
</span><del>-protected:
-    TInfoSinkBase&amp; objSink() { return mObjSink; }
-    void writeTriplet(Visit visit, const char* preStr, const char* inStr, const char* postStr);
-    void writeVariableType(const TType&amp; type);
</del><ins>+    ShShaderOutput getShaderOutput() const
+    {
+        return mOutput;
+    }
+
+  protected:
+    TInfoSinkBase &amp;objSink() { return mObjSink; }
+    void writeTriplet(Visit visit, const char *preStr, const char *inStr, const char *postStr);
+    void writeVariableType(const TType &amp;type);
</ins><span class="cx">     virtual bool writeVariablePrecision(TPrecision precision) = 0;
</span><del>-    void writeFunctionParameters(const TIntermSequence&amp; args);
-    const ConstantUnion* writeConstantUnion(const TType&amp; type, const ConstantUnion* pConstUnion);
-    TString getTypeName(const TType&amp; type);
</del><ins>+    void writeFunctionParameters(const TIntermSequence &amp;args);
+    const TConstantUnion *writeConstantUnion(const TType &amp;type, const TConstantUnion *pConstUnion);
+    void writeConstructorTriplet(Visit visit, const TType &amp;type, const char *constructorBaseType);
+    TString getTypeName(const TType &amp;type);
</ins><span class="cx"> 
</span><del>-    virtual void visitSymbol(TIntermSymbol* node);
-    virtual void visitConstantUnion(TIntermConstantUnion* node);
-    virtual bool visitBinary(Visit visit, TIntermBinary* node);
-    virtual bool visitUnary(Visit visit, TIntermUnary* node);
-    virtual bool visitSelection(Visit visit, TIntermSelection* node);
-    virtual bool visitAggregate(Visit visit, TIntermAggregate* node);
-    virtual bool visitLoop(Visit visit, TIntermLoop* node);
-    virtual bool visitBranch(Visit visit, TIntermBranch* node);
</del><ins>+    virtual void visitSymbol(TIntermSymbol *node);
+    virtual void visitConstantUnion(TIntermConstantUnion *node);
+    virtual bool visitBinary(Visit visit, TIntermBinary *node);
+    virtual bool visitUnary(Visit visit, TIntermUnary *node);
+    virtual bool visitSelection(Visit visit, TIntermSelection *node);
+    virtual bool visitSwitch(Visit visit, TIntermSwitch *node);
+    virtual bool visitCase(Visit visit, TIntermCase *node);
+    virtual bool visitAggregate(Visit visit, TIntermAggregate *node);
+    virtual bool visitLoop(Visit visit, TIntermLoop *node);
+    virtual bool visitBranch(Visit visit, TIntermBranch *node);
</ins><span class="cx"> 
</span><del>-    void visitCodeBlock(TIntermNode* node);
</del><ins>+    void visitCodeBlock(TIntermNode *node);
</ins><span class="cx"> 
</span><del>-
</del><span class="cx">     // Return the original name if hash function pointer is NULL;
</span><span class="cx">     // otherwise return the hashed name.
</span><del>-    TString hashName(const TString&amp; name);
</del><ins>+    TString hashName(const TString &amp;name);
</ins><span class="cx">     // Same as hashName(), but without hashing built-in variables.
</span><del>-    TString hashVariableName(const TString&amp; name);
</del><ins>+    TString hashVariableName(const TString &amp;name);
</ins><span class="cx">     // Same as hashName(), but without hashing built-in functions.
</span><del>-    TString hashFunctionName(const TString&amp; mangled_name);
</del><ins>+    TString hashFunctionName(const TString &amp;mangled_name);
</ins><span class="cx">     // Used to translate function names for differences between ESSL and GLSL
</span><del>-    virtual TString translateTextureFunction(TString&amp; name) { return name; }
</del><ins>+    virtual TString translateTextureFunction(TString &amp;name) { return name; }
</ins><span class="cx"> 
</span><del>-private:
-    bool structDeclared(const TStructure* structure) const;
-    void declareStruct(const TStructure* structure);
</del><ins>+  private:
+    bool structDeclared(const TStructure *structure) const;
+    void declareStruct(const TStructure *structure);
</ins><span class="cx"> 
</span><del>-    TInfoSinkBase&amp; mObjSink;
</del><ins>+    void writeBuiltInFunctionTriplet(Visit visit, const char *preStr, bool useEmulatedFunction);
+
+    TInfoSinkBase &amp;mObjSink;
</ins><span class="cx">     bool mDeclaringVariables;
</span><span class="cx"> 
</span><del>-    // Structs are declared as the tree is traversed. This set contains all
-    // the structs already declared. It is maintained so that a struct is
-    // declared only once.
-    typedef std::set&lt;TString&gt; DeclaredStructs;
-    DeclaredStructs mDeclaredStructs;
</del><ins>+    // This set contains all the ids of the structs from every scope.
+    std::set&lt;int&gt; mDeclaredStructs;
</ins><span class="cx"> 
</span><span class="cx">     // Stack of loops that need to be unrolled.
</span><span class="cx">     TLoopStack mLoopUnrollStack;
</span><span class="lines">@@ -75,11 +82,13 @@
</span><span class="cx">     // name hashing.
</span><span class="cx">     ShHashFunction64 mHashFunction;
</span><span class="cx"> 
</span><del>-    NameMap&amp; mNameMap;
</del><ins>+    NameMap &amp;mNameMap;
</ins><span class="cx"> 
</span><del>-    TSymbolTable&amp; mSymbolTable;
</del><ins>+    TSymbolTable &amp;mSymbolTable;
</ins><span class="cx"> 
</span><span class="cx">     const int mShaderVersion;
</span><ins>+
+    ShShaderOutput mOutput;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_OUTPUTGLSLBASE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputHLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,22 +6,29 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/OutputHLSL.h&quot;
</span><span class="cx"> 
</span><ins>+#include &lt;algorithm&gt;
+#include &lt;cfloat&gt;
+#include &lt;stdio.h&gt;
+
</ins><span class="cx"> #include &quot;common/angleutils.h&quot;
</span><ins>+#include &quot;common/debug.h&quot;
</ins><span class="cx"> #include &quot;common/utilities.h&quot;
</span><del>-#include &quot;common/blocklayout.h&quot;
-#include &quot;compiler/translator/compilerdebug.h&quot;
-#include &quot;compiler/translator/InfoSink.h&quot;
-#include &quot;compiler/translator/DetectDiscontinuity.h&quot;
-#include &quot;compiler/translator/SearchSymbol.h&quot;
-#include &quot;compiler/translator/UnfoldShortCircuit.h&quot;
</del><ins>+#include &quot;compiler/translator/BuiltInFunctionEmulator.h&quot;
+#include &quot;compiler/translator/BuiltInFunctionEmulatorHLSL.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/FlagStd140Structs.h&quot;
</span><ins>+#include &quot;compiler/translator/InfoSink.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/NodeSearch.h&quot;
</span><ins>+#include &quot;compiler/translator/RemoveSwitchFallThrough.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/RewriteElseBlocks.h&quot;
</span><ins>+#include &quot;compiler/translator/SearchSymbol.h&quot;
+#include &quot;compiler/translator/StructureHLSL.h&quot;
+#include &quot;compiler/translator/TranslatorHLSL.h&quot;
+#include &quot;compiler/translator/UnfoldShortCircuit.h&quot;
+#include &quot;compiler/translator/UniformHLSL.h&quot;
+#include &quot;compiler/translator/UtilsHLSL.h&quot;
+#include &quot;compiler/translator/blocklayout.h&quot;
+#include &quot;compiler/translator/util.h&quot;
</ins><span class="cx"> 
</span><del>-#include &lt;algorithm&gt;
-#include &lt;cfloat&gt;
-#include &lt;stdio.h&gt;
-
</del><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="cx"> 
</span><span class="lines">@@ -69,18 +76,6 @@
</span><span class="cx">     return name + &quot;(&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-const char *RegisterPrefix(const TType &amp;type)
-{
-    if (IsSampler(type.getBasicType()))
-    {
-        return &quot;s&quot;;
-    }
-    else
-    {
-        return &quot;c&quot;;
-    }
-}
-
</del><span class="cx"> bool OutputHLSL::TextureFunction::operator&lt;(const TextureFunction &amp;rhs) const
</span><span class="cx"> {
</span><span class="cx">     if (sampler &lt; rhs.sampler) return true;
</span><span class="lines">@@ -101,10 +96,22 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-OutputHLSL::OutputHLSL(TParseContext &amp;context, const ShBuiltInResources&amp; resources, ShShaderOutput outputType)
-    : TIntermTraverser(true, true, true), mContext(context), mOutputType(outputType)
</del><ins>+OutputHLSL::OutputHLSL(sh::GLenum shaderType, int shaderVersion,
+    const TExtensionBehavior &amp;extensionBehavior,
+    const char *sourcePath, ShShaderOutput outputType,
+    int numRenderTargets, const std::vector&lt;Uniform&gt; &amp;uniforms,
+    int compileOptions)
+    : TIntermTraverser(true, true, true),
+      mShaderType(shaderType),
+      mShaderVersion(shaderVersion),
+      mExtensionBehavior(extensionBehavior),
+      mSourcePath(sourcePath),
+      mOutputType(outputType),
+      mNumRenderTargets(numRenderTargets),
+      mCompileOptions(compileOptions),
+      mCurrentFunctionMetadata(nullptr)
</ins><span class="cx"> {
</span><del>-    mUnfoldShortCircuit = new UnfoldShortCircuit(context, this);
</del><ins>+    mUnfoldShortCircuit = new UnfoldShortCircuit(this);
</ins><span class="cx">     mInsideFunction = false;
</span><span class="cx"> 
</span><span class="cx">     mUsesFragColor = false;
</span><span class="lines">@@ -114,83 +121,94 @@
</span><span class="cx">     mUsesPointCoord = false;
</span><span class="cx">     mUsesFrontFacing = false;
</span><span class="cx">     mUsesPointSize = false;
</span><ins>+    mUsesInstanceID = false;
</ins><span class="cx">     mUsesFragDepth = false;
</span><span class="cx">     mUsesXor = false;
</span><del>-    mUsesMod1 = false;
-    mUsesMod2v = false;
-    mUsesMod2f = false;
-    mUsesMod3v = false;
-    mUsesMod3f = false;
-    mUsesMod4v = false;
-    mUsesMod4f = false;
-    mUsesFaceforward1 = false;
-    mUsesFaceforward2 = false;
-    mUsesFaceforward3 = false;
-    mUsesFaceforward4 = false;
-    mUsesAtan2_1 = false;
-    mUsesAtan2_2 = false;
-    mUsesAtan2_3 = false;
-    mUsesAtan2_4 = false;
</del><span class="cx">     mUsesDiscardRewriting = false;
</span><span class="cx">     mUsesNestedBreak = false;
</span><ins>+    mRequiresIEEEStrictCompiling = false;
</ins><span class="cx"> 
</span><del>-    mNumRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
-
-    mScopeDepth = 0;
-
</del><span class="cx">     mUniqueIndex = 0;
</span><span class="cx"> 
</span><del>-    mContainsLoopDiscontinuity = false;
</del><span class="cx">     mOutputLod0Function = false;
</span><span class="cx">     mInsideDiscontinuousLoop = false;
</span><span class="cx">     mNestedLoopDepth = 0;
</span><span class="cx"> 
</span><span class="cx">     mExcessiveLoopIndex = NULL;
</span><span class="cx"> 
</span><ins>+    mStructureHLSL = new StructureHLSL;
+    mUniformHLSL = new UniformHLSL(mStructureHLSL, outputType, uniforms);
+
</ins><span class="cx">     if (mOutputType == SH_HLSL9_OUTPUT)
</span><span class="cx">     {
</span><del>-        if (mContext.shaderType == SH_FRAGMENT_SHADER)
-        {
-            mUniformRegister = 3;   // Reserve registers for dx_DepthRange, dx_ViewCoords and dx_DepthFront
-        }
-        else
-        {
-            mUniformRegister = 2;   // Reserve registers for dx_DepthRange and dx_ViewAdjust
-        }
</del><ins>+        // Fragment shaders need dx_DepthRange, dx_ViewCoords and dx_DepthFront.
+        // Vertex shaders need a slightly different set: dx_DepthRange, dx_ViewCoords and dx_ViewAdjust.
+        // In both cases total 3 uniform registers need to be reserved.
+        mUniformHLSL-&gt;reserveUniformRegisters(3);
</ins><span class="cx">     }
</span><del>-    else
-    {
-        mUniformRegister = 0;
-    }
</del><span class="cx"> 
</span><del>-    mSamplerRegister = 0;
-    mInterfaceBlockRegister = 2; // Reserve registers for the default uniform block and driver constants
-    mPaddingCounter = 0;
</del><ins>+    // Reserve registers for the default uniform block and driver constants
+    mUniformHLSL-&gt;reserveInterfaceBlockRegisters(2);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> OutputHLSL::~OutputHLSL()
</span><span class="cx"> {
</span><del>-    delete mUnfoldShortCircuit;
</del><ins>+    SafeDelete(mUnfoldShortCircuit);
+    SafeDelete(mStructureHLSL);
+    SafeDelete(mUniformHLSL);
+    for (auto &amp;eqFunction : mStructEqualityFunctions)
+    {
+        SafeDelete(eqFunction);
+    }
+    for (auto &amp;eqFunction : mArrayEqualityFunctions)
+    {
+        SafeDelete(eqFunction);
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void OutputHLSL::output()
</del><ins>+void OutputHLSL::output(TIntermNode *treeRoot, TInfoSinkBase &amp;objSink)
</ins><span class="cx"> {
</span><del>-    mContainsLoopDiscontinuity = mContext.shaderType == SH_FRAGMENT_SHADER &amp;&amp; containsLoopDiscontinuity(mContext.treeRoot);
-    const std::vector&lt;TIntermTyped*&gt; &amp;flaggedStructs = FlagStd140ValueStructs(mContext.treeRoot);
</del><ins>+    const std::vector&lt;TIntermTyped*&gt; &amp;flaggedStructs = FlagStd140ValueStructs(treeRoot);
</ins><span class="cx">     makeFlaggedStructMaps(flaggedStructs);
</span><span class="cx"> 
</span><span class="cx">     // Work around D3D9 bug that would manifest in vertex shaders with selection blocks which
</span><span class="cx">     // use a vertex attribute as a condition, and some related computation in the else block.
</span><del>-    if (mOutputType == SH_HLSL9_OUTPUT &amp;&amp; mContext.shaderType == SH_VERTEX_SHADER)
</del><ins>+    if (mOutputType == SH_HLSL9_OUTPUT &amp;&amp; mShaderType == GL_VERTEX_SHADER)
</ins><span class="cx">     {
</span><del>-        RewriteElseBlocks(mContext.treeRoot);
</del><ins>+        RewriteElseBlocks(treeRoot);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    mContext.treeRoot-&gt;traverse(this);   // Output the body first to determine what has to go in the header
-    header();
</del><ins>+    BuiltInFunctionEmulator builtInFunctionEmulator;
+    InitBuiltInFunctionEmulatorForHLSL(&amp;builtInFunctionEmulator);
+    builtInFunctionEmulator.MarkBuiltInFunctionsForEmulation(treeRoot);
</ins><span class="cx"> 
</span><del>-    mContext.infoSink().obj &lt;&lt; mHeader.c_str();
-    mContext.infoSink().obj &lt;&lt; mBody.c_str();
</del><ins>+    // Now that we are done changing the AST, do the analyses need for HLSL generation
+    CallDAG::InitResult success = mCallDag.init(treeRoot, &amp;objSink);
+    ASSERT(success == CallDAG::INITDAG_SUCCESS);
+    UNUSED_ASSERTION_VARIABLE(success);
+    mASTMetadataList = CreateASTMetadataHLSL(treeRoot, mCallDag);
+
+    // Output the body and footer first to determine what has to go in the header
+    mInfoSinkStack.push(&amp;mBody);
+    treeRoot-&gt;traverse(this);
+    mInfoSinkStack.pop();
+
+    mInfoSinkStack.push(&amp;mFooter);
+    if (!mDeferredGlobalInitializers.empty())
+    {
+        writeDeferredGlobalInitializers(mFooter);
+    }
+    mInfoSinkStack.pop();
+
+    mInfoSinkStack.push(&amp;mHeader);
+    header(&amp;builtInFunctionEmulator);
+    mInfoSinkStack.pop();
+
+    objSink &lt;&lt; mHeader.c_str();
+    objSink &lt;&lt; mBody.c_str();
+    objSink &lt;&lt; mFooter.c_str();
+
+    builtInFunctionEmulator.Cleanup();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void OutputHLSL::makeFlaggedStructMaps(const std::vector&lt;TIntermTyped *&gt; &amp;flaggedStructs)
</span><span class="lines">@@ -199,11 +217,15 @@
</span><span class="cx">     {
</span><span class="cx">         TIntermTyped *flaggedNode = flaggedStructs[structIndex];
</span><span class="cx"> 
</span><ins>+        TInfoSinkBase structInfoSink;
+        mInfoSinkStack.push(&amp;structInfoSink);
+
</ins><span class="cx">         // This will mark the necessary block elements as referenced
</span><span class="cx">         flaggedNode-&gt;traverse(this);
</span><del>-        TString structName(mBody.c_str());
-        mBody.erase();
</del><span class="cx"> 
</span><ins>+        TString structName(structInfoSink.c_str());
+        mInfoSinkStack.pop();
+
</ins><span class="cx">         mFlaggedStructOriginalNames[flaggedNode] = structName;
</span><span class="cx"> 
</span><span class="cx">         for (size_t pos = structName.find('.'); pos != std::string::npos; pos = structName.find('.'))
</span><span class="lines">@@ -215,36 +237,16 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TInfoSinkBase &amp;OutputHLSL::getBodyStream()
</del><ins>+const std::map&lt;std::string, unsigned int&gt; &amp;OutputHLSL::getInterfaceBlockRegisterMap() const
</ins><span class="cx"> {
</span><del>-    return mBody;
</del><ins>+    return mUniformHLSL-&gt;getInterfaceBlockRegisterMap();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-const std::vector&lt;gl::Uniform&gt; &amp;OutputHLSL::getUniforms()
</del><ins>+const std::map&lt;std::string, unsigned int&gt; &amp;OutputHLSL::getUniformRegisterMap() const
</ins><span class="cx"> {
</span><del>-    return mActiveUniforms;
</del><ins>+    return mUniformHLSL-&gt;getUniformRegisterMap();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-const std::vector&lt;gl::InterfaceBlock&gt; &amp;OutputHLSL::getInterfaceBlocks() const
-{
-    return mActiveInterfaceBlocks;
-}
-
-const std::vector&lt;gl::Attribute&gt; &amp;OutputHLSL::getOutputVariables() const
-{
-    return mActiveOutputVariables;
-}
-
-const std::vector&lt;gl::Attribute&gt; &amp;OutputHLSL::getAttributes() const
-{
-    return mActiveAttributes;
-}
-
-const std::vector&lt;gl::Varying&gt; &amp;OutputHLSL::getVaryings() const
-{
-    return mActiveVaryings;
-}
-
</del><span class="cx"> int OutputHLSL::vectorSize(const TType &amp;type) const
</span><span class="cx"> {
</span><span class="cx">     int elementSize = type.isMatrix() ? type.getCols() : 1;
</span><span class="lines">@@ -253,267 +255,6 @@
</span><span class="cx">     return elementSize * arraySize;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString OutputHLSL::interfaceBlockFieldString(const TInterfaceBlock &amp;interfaceBlock, const TField &amp;field)
-{
-    if (interfaceBlock.hasInstanceName())
-    {
-        return interfaceBlock.name() + &quot;.&quot; + field.name();
-    }
-    else
-    {
-        return field.name();
-    }
-}
-
-TString OutputHLSL::decoratePrivate(const TString &amp;privateText)
-{
-    return &quot;dx_&quot; + privateText;
-}
-
-TString OutputHLSL::interfaceBlockStructNameString(const TInterfaceBlock &amp;interfaceBlock)
-{
-    return decoratePrivate(interfaceBlock.name()) + &quot;_type&quot;;
-}
-
-TString OutputHLSL::interfaceBlockInstanceString(const TInterfaceBlock&amp; interfaceBlock, unsigned int arrayIndex)
-{
-    if (!interfaceBlock.hasInstanceName())
-    {
-        return &quot;&quot;;
-    }
-    else if (interfaceBlock.isArray())
-    {
-        return decoratePrivate(interfaceBlock.instanceName()) + &quot;_&quot; + str(arrayIndex);
-    }
-    else
-    {
-        return decorate(interfaceBlock.instanceName());
-    }
-}
-
-TString OutputHLSL::interfaceBlockFieldTypeString(const TField &amp;field, TLayoutBlockStorage blockStorage)
-{
-    const TType &amp;fieldType = *field.type();
-    const TLayoutMatrixPacking matrixPacking = fieldType.getLayoutQualifier().matrixPacking;
-    ASSERT(matrixPacking != EmpUnspecified);
-
-    if (fieldType.isMatrix())
-    {
-        // Use HLSL row-major packing for GLSL column-major matrices
-        const TString &amp;matrixPackString = (matrixPacking == EmpRowMajor ? &quot;column_major&quot; : &quot;row_major&quot;);
-        return matrixPackString + &quot; &quot; + typeString(fieldType);
-    }
-    else if (fieldType.getStruct())
-    {
-        // Use HLSL row-major packing for GLSL column-major matrices
-        return structureTypeName(*fieldType.getStruct(), matrixPacking == EmpColumnMajor, blockStorage == EbsStd140);
-    }
-    else
-    {
-        return typeString(fieldType);
-    }
-}
-
-TString OutputHLSL::interfaceBlockFieldString(const TInterfaceBlock &amp;interfaceBlock, TLayoutBlockStorage blockStorage)
-{
-    TString hlsl;
-
-    int elementIndex = 0;
-
-    for (unsigned int typeIndex = 0; typeIndex &lt; interfaceBlock.fields().size(); typeIndex++)
-    {
-        const TField &amp;field = *interfaceBlock.fields()[typeIndex];
-        const TType &amp;fieldType = *field.type();
-
-        if (blockStorage == EbsStd140)
-        {
-            // 2 and 3 component vector types in some cases need pre-padding
-            hlsl += std140PrePaddingString(fieldType, &amp;elementIndex);
-        }
-
-        hlsl += &quot;    &quot; + interfaceBlockFieldTypeString(field, blockStorage) +
-                &quot; &quot; + decorate(field.name()) + arrayString(fieldType) + &quot;;\n&quot;;
-
-        // must pad out after matrices and arrays, where HLSL usually allows itself room to pack stuff
-        if (blockStorage == EbsStd140)
-        {
-            const bool useHLSLRowMajorPacking = (fieldType.getLayoutQualifier().matrixPacking == EmpColumnMajor);
-            hlsl += std140PostPaddingString(fieldType, useHLSLRowMajorPacking);
-        }
-    }
-
-    return hlsl;
-}
-
-TString OutputHLSL::interfaceBlockStructString(const TInterfaceBlock &amp;interfaceBlock)
-{
-    const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
-
-    return &quot;struct &quot; + interfaceBlockStructNameString(interfaceBlock) + &quot;\n&quot;
-           &quot;{\n&quot; +
-           interfaceBlockFieldString(interfaceBlock, blockStorage) +
-           &quot;};\n\n&quot;;
-}
-
-TString OutputHLSL::interfaceBlockString(const TInterfaceBlock &amp;interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex)
-{
-    const TString &amp;arrayIndexString =  (arrayIndex != GL_INVALID_INDEX ? decorate(str(arrayIndex)) : &quot;&quot;);
-    const TString &amp;blockName = interfaceBlock.name() + arrayIndexString;
-    TString hlsl;
-
-    hlsl += &quot;cbuffer &quot; + blockName + &quot; : register(b&quot; + str(registerIndex) + &quot;)\n&quot;
-            &quot;{\n&quot;;
-
-    if (interfaceBlock.hasInstanceName())
-    {
-        hlsl += &quot;    &quot; + interfaceBlockStructNameString(interfaceBlock) + &quot; &quot; + interfaceBlockInstanceString(interfaceBlock, arrayIndex) + &quot;;\n&quot;;
-    }
-    else
-    {
-        const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
-        hlsl += interfaceBlockFieldString(interfaceBlock, blockStorage);
-    }
-
-    hlsl += &quot;};\n\n&quot;;
-
-    return hlsl;
-}
-
-TString OutputHLSL::std140PrePaddingString(const TType &amp;type, int *elementIndex)
-{
-    if (type.getBasicType() == EbtStruct || type.isMatrix() || type.isArray())
-    {
-        // no padding needed, HLSL will align the field to a new register
-        *elementIndex = 0;
-        return &quot;&quot;;
-    }
-
-    const GLenum glType = glVariableType(type);
-    const int numComponents = gl::UniformComponentCount(glType);
-
-    if (numComponents &gt;= 4)
-    {
-        // no padding needed, HLSL will align the field to a new register
-        *elementIndex = 0;
-        return &quot;&quot;;
-    }
-
-    if (*elementIndex + numComponents &gt; 4)
-    {
-        // no padding needed, HLSL will align the field to a new register
-        *elementIndex = numComponents;
-        return &quot;&quot;;
-    }
-
-    TString padding;
-
-    const int alignment = numComponents == 3 ? 4 : numComponents;
-    const int paddingOffset = (*elementIndex % alignment);
-
-    if (paddingOffset != 0)
-    {
-        // padding is neccessary
-        for (int paddingIndex = paddingOffset; paddingIndex &lt; alignment; paddingIndex++)
-        {
-            padding += &quot;    float pad_&quot; + str(mPaddingCounter++) + &quot;;\n&quot;;
-        }
-
-        *elementIndex += (alignment - paddingOffset);
-    }
-
-    *elementIndex += numComponents;
-    *elementIndex %= 4;
-
-    return padding;
-}
-
-TString OutputHLSL::std140PostPaddingString(const TType &amp;type, bool useHLSLRowMajorPacking)
-{
-    if (!type.isMatrix() &amp;&amp; !type.isArray() &amp;&amp; type.getBasicType() != EbtStruct)
-    {
-        return &quot;&quot;;
-    }
-
-    int numComponents = 0;
-
-    if (type.isMatrix())
-    {
-        // This method can also be called from structureString, which does not use layout qualifiers.
-        // Thus, use the method parameter for determining the matrix packing.
-        //
-        // Note HLSL row major packing corresponds to GL API column-major, and vice-versa, since we
-        // wish to always transpose GL matrices to play well with HLSL's matrix array indexing.
-        //
-        const bool isRowMajorMatrix = !useHLSLRowMajorPacking;
-        const GLenum glType = glVariableType(type);
-        numComponents = gl::MatrixComponentCount(glType, isRowMajorMatrix);
-    }
-    else if (type.getStruct())
-    {
-        const TString &amp;structName = structureTypeName(*type.getStruct(), useHLSLRowMajorPacking, true);
-        numComponents = mStd140StructElementIndexes[structName];
-
-        if (numComponents == 0)
-        {
-            return &quot;&quot;;
-        }
-    }
-    else
-    {
-        const GLenum glType = glVariableType(type);
-        numComponents = gl::UniformComponentCount(glType);
-    }
-
-    TString padding;
-    for (int paddingOffset = numComponents; paddingOffset &lt; 4; paddingOffset++)
-    {
-        padding += &quot;    float pad_&quot; + str(mPaddingCounter++) + &quot;;\n&quot;;
-    }
-    return padding;
-}
-
-// Use the same layout for packed and shared
-void setBlockLayout(gl::InterfaceBlock *interfaceBlock, gl::BlockLayoutType newLayout)
-{
-    interfaceBlock-&gt;layout = newLayout;
-    interfaceBlock-&gt;blockInfo.clear();
-
-    switch (newLayout)
-    {
-      case gl::BLOCKLAYOUT_SHARED:
-      case gl::BLOCKLAYOUT_PACKED:
-        {
-            gl::HLSLBlockEncoder hlslEncoder(&amp;interfaceBlock-&gt;blockInfo);
-            hlslEncoder.encodeInterfaceBlockFields(interfaceBlock-&gt;fields);
-            interfaceBlock-&gt;dataSize = hlslEncoder.getBlockSize();
-        }
-        break;
-
-      case gl::BLOCKLAYOUT_STANDARD:
-        {
-            gl::Std140BlockEncoder stdEncoder(&amp;interfaceBlock-&gt;blockInfo);
-            stdEncoder.encodeInterfaceBlockFields(interfaceBlock-&gt;fields);
-            interfaceBlock-&gt;dataSize = stdEncoder.getBlockSize();
-        }
-        break;
-
-      default:
-        UNREACHABLE();
-        break;
-    }
-}
-
-gl::BlockLayoutType convertBlockLayoutType(TLayoutBlockStorage blockStorage)
-{
-    switch (blockStorage)
-    {
-      case EbsPacked: return gl::BLOCKLAYOUT_PACKED;
-      case EbsShared: return gl::BLOCKLAYOUT_SHARED;
-      case EbsStd140: return gl::BLOCKLAYOUT_STANDARD;
-      default: UNREACHABLE(); return gl::BLOCKLAYOUT_SHARED;
-    }
-}
-
</del><span class="cx"> TString OutputHLSL::structInitializerString(int indent, const TStructure &amp;structure, const TString &amp;rhsStructName)
</span><span class="cx"> {
</span><span class="cx">     TString init;
</span><span class="lines">@@ -537,7 +278,7 @@
</span><span class="cx">     for (unsigned int fieldIndex = 0; fieldIndex &lt; fields.size(); fieldIndex++)
</span><span class="cx">     {
</span><span class="cx">         const TField &amp;field = *fields[fieldIndex];
</span><del>-        const TString &amp;fieldName = rhsStructName + &quot;.&quot; + decorate(field.name());
</del><ins>+        const TString &amp;fieldName = rhsStructName + &quot;.&quot; + Decorate(field.name());
</ins><span class="cx">         const TType &amp;fieldType = *field.type();
</span><span class="cx"> 
</span><span class="cx">         if (fieldType.getStruct())
</span><span class="lines">@@ -555,88 +296,14 @@
</span><span class="cx">     return init;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void OutputHLSL::header()
</del><ins>+void OutputHLSL::header(const BuiltInFunctionEmulator *builtInFunctionEmulator)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mHeader;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><del>-    TString uniforms;
-    TString interfaceBlocks;
</del><span class="cx">     TString varyings;
</span><span class="cx">     TString attributes;
</span><span class="cx">     TString flaggedStructs;
</span><span class="cx"> 
</span><del>-    for (ReferencedSymbols::const_iterator uniformIt = mReferencedUniforms.begin(); uniformIt != mReferencedUniforms.end(); uniformIt++)
-    {
-        const TIntermSymbol &amp;uniform = *uniformIt-&gt;second;
-        const TType &amp;type = uniform.getType();
-        const TString &amp;name = uniform.getSymbol();
-
-        int registerIndex = declareUniformAndAssignRegister(type, name);
-
-        if (mOutputType == SH_HLSL11_OUTPUT &amp;&amp; IsSampler(type.getBasicType()))   // Also declare the texture
-        {
-            uniforms += &quot;uniform &quot; + samplerString(type) + &quot; sampler_&quot; + decorateUniform(name, type) + arrayString(type) + 
-                        &quot; : register(s&quot; + str(registerIndex) + &quot;);\n&quot;;
-
-            uniforms += &quot;uniform &quot; + textureString(type) + &quot; texture_&quot; + decorateUniform(name, type) + arrayString(type) +
-                        &quot; : register(t&quot; + str(registerIndex) + &quot;);\n&quot;;
-        }
-        else
-        {
-            const TStructure *structure = type.getStruct();
-            const TString &amp;typeName = (structure ? structureTypeName(*structure, false, false) : typeString(type));
-
-            const TString &amp;registerString = TString(&quot;register(&quot;) + RegisterPrefix(type) + str(registerIndex) + &quot;)&quot;;
-
-            uniforms += &quot;uniform &quot; + typeName + &quot; &quot; + decorateUniform(name, type) + arrayString(type) + &quot; : &quot; + registerString + &quot;;\n&quot;;
-        }
-    }
-
-    for (ReferencedSymbols::const_iterator interfaceBlockIt = mReferencedInterfaceBlocks.begin(); interfaceBlockIt != mReferencedInterfaceBlocks.end(); interfaceBlockIt++)
-    {
-        const TType &amp;nodeType = interfaceBlockIt-&gt;second-&gt;getType();
-        const TInterfaceBlock &amp;interfaceBlock = *nodeType.getInterfaceBlock();
-        const TFieldList &amp;fieldList = interfaceBlock.fields();
-
-        unsigned int arraySize = static_cast&lt;unsigned int&gt;(interfaceBlock.arraySize());
-        gl::InterfaceBlock activeBlock(interfaceBlock.name().c_str(), arraySize, mInterfaceBlockRegister);
-        for (unsigned int typeIndex = 0; typeIndex &lt; fieldList.size(); typeIndex++)
-        {
-            const TField &amp;field = *fieldList[typeIndex];
-            const TString &amp;fullUniformName = interfaceBlockFieldString(interfaceBlock, field);
-            declareInterfaceBlockField(*field.type(), fullUniformName, activeBlock.fields);
-        }
-
-        mInterfaceBlockRegister += std::max(1u, arraySize);
-
-        gl::BlockLayoutType blockLayoutType = convertBlockLayoutType(interfaceBlock.blockStorage());
-        setBlockLayout(&amp;activeBlock, blockLayoutType);
-
-        if (interfaceBlock.matrixPacking() == EmpRowMajor)
-        {
-            activeBlock.isRowMajorLayout = true;
-        }
-
-        mActiveInterfaceBlocks.push_back(activeBlock);
-
-        if (interfaceBlock.hasInstanceName())
-        {
-            interfaceBlocks += interfaceBlockStructString(interfaceBlock);
-        }
-
-        if (arraySize &gt; 0)
-        {
-            for (unsigned int arrayIndex = 0; arrayIndex &lt; arraySize; arrayIndex++)
-            {
-                interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex + arrayIndex, arrayIndex);
-            }
-        }
-        else
-        {
-            interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex, GL_INVALID_INDEX);
-        }
-    }
-
</del><span class="cx">     for (std::map&lt;TIntermTyped*, TString&gt;::const_iterator flaggedStructIt = mFlaggedStructMappedNames.begin(); flaggedStructIt != mFlaggedStructMappedNames.end(); flaggedStructIt++)
</span><span class="cx">     {
</span><span class="cx">         TIntermTyped *structNode = flaggedStructIt-&gt;first;
</span><span class="lines">@@ -644,7 +311,7 @@
</span><span class="cx">         const TStructure &amp;structure = *structNode-&gt;getType().getStruct();
</span><span class="cx">         const TString &amp;originalName = mFlaggedStructOriginalNames[structNode];
</span><span class="cx"> 
</span><del>-        flaggedStructs += &quot;static &quot; + decorate(structure.name()) + &quot; &quot; + mappedName + &quot; =\n&quot;;
</del><ins>+        flaggedStructs += &quot;static &quot; + Decorate(structure.name()) + &quot; &quot; + mappedName + &quot; =\n&quot;;
</ins><span class="cx">         flaggedStructs += structInitializerString(0, structure, originalName);
</span><span class="cx">         flaggedStructs += &quot;\n&quot;;
</span><span class="cx">     }
</span><span class="lines">@@ -655,10 +322,8 @@
</span><span class="cx">         const TString &amp;name = varying-&gt;second-&gt;getSymbol();
</span><span class="cx"> 
</span><span class="cx">         // Program linking depends on this exact format
</span><del>-        varyings += &quot;static &quot; + interpolationString(type.getQualifier()) + &quot; &quot; + typeString(type) + &quot; &quot; +
-                    decorate(name) + arrayString(type) + &quot; = &quot; + initializer(type) + &quot;;\n&quot;;
-
-        declareVaryingToList(type, type.getQualifier(), name, mActiveVaryings);
</del><ins>+        varyings += &quot;static &quot; + InterpolationString(type.getQualifier()) + &quot; &quot; + TypeString(type) + &quot; &quot; +
+                    Decorate(name) + ArrayString(type) + &quot; = &quot; + initializer(type) + &quot;;\n&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     for (ReferencedSymbols::const_iterator attribute = mReferencedAttributes.begin(); attribute != mReferencedAttributes.end(); attribute++)
</span><span class="lines">@@ -666,56 +331,80 @@
</span><span class="cx">         const TType &amp;type = attribute-&gt;second-&gt;getType();
</span><span class="cx">         const TString &amp;name = attribute-&gt;second-&gt;getSymbol();
</span><span class="cx"> 
</span><del>-        attributes += &quot;static &quot; + typeString(type) + &quot; &quot; + decorate(name) + arrayString(type) + &quot; = &quot; + initializer(type) + &quot;;\n&quot;;
-
-        gl::Attribute attributeVar(glVariableType(type), glVariablePrecision(type), name.c_str(),
-                               (unsigned int)type.getArraySize(), type.getLayoutQualifier().location);
-        mActiveAttributes.push_back(attributeVar);
</del><ins>+        attributes += &quot;static &quot; + TypeString(type) + &quot; &quot; + Decorate(name) + ArrayString(type) + &quot; = &quot; + initializer(type) + &quot;;\n&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
</del><ins>+    out &lt;&lt; mStructureHLSL-&gt;structsHeader();
+
+    out &lt;&lt; mUniformHLSL-&gt;uniformsHeader(mOutputType, mReferencedUniforms);
+    out &lt;&lt; mUniformHLSL-&gt;interfaceBlocksHeader(mReferencedInterfaceBlocks);
+
+    if (!mEqualityFunctions.empty())
</ins><span class="cx">     {
</span><del>-        out &lt;&lt; *structDeclaration;
</del><ins>+        out &lt;&lt; &quot;\n// Equality functions\n\n&quot;;
+        for (const auto &amp;eqFunction : mEqualityFunctions)
+        {
+            out &lt;&lt; eqFunction-&gt;functionDefinition &lt;&lt; &quot;\n&quot;;
+        }
</ins><span class="cx">     }
</span><del>-
-    for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
</del><ins>+    if (!mArrayAssignmentFunctions.empty())
</ins><span class="cx">     {
</span><del>-        out &lt;&lt; *constructor;
</del><ins>+        out &lt;&lt; &quot;\n// Assignment functions\n\n&quot;;
+        for (const auto &amp;assignmentFunction : mArrayAssignmentFunctions)
+        {
+            out &lt;&lt; assignmentFunction.functionDefinition &lt;&lt; &quot;\n&quot;;
+        }
</ins><span class="cx">     }
</span><ins>+    if (!mArrayConstructIntoFunctions.empty())
+    {
+        out &lt;&lt; &quot;\n// Array constructor functions\n\n&quot;;
+        for (const auto &amp;constructIntoFunction : mArrayConstructIntoFunctions)
+        {
+            out &lt;&lt; constructIntoFunction.functionDefinition &lt;&lt; &quot;\n&quot;;
+        }
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (mUsesDiscardRewriting)
</span><span class="cx">     {
</span><del>-        out &lt;&lt; &quot;#define ANGLE_USES_DISCARD_REWRITING&quot; &lt;&lt; &quot;\n&quot;;
</del><ins>+        out &lt;&lt; &quot;#define ANGLE_USES_DISCARD_REWRITING\n&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (mUsesNestedBreak)
</span><span class="cx">     {
</span><del>-        out &lt;&lt; &quot;#define ANGLE_USES_NESTED_BREAK&quot; &lt;&lt; &quot;\n&quot;;
</del><ins>+        out &lt;&lt; &quot;#define ANGLE_USES_NESTED_BREAK\n&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (mContext.shaderType == SH_FRAGMENT_SHADER)
</del><ins>+    if (mRequiresIEEEStrictCompiling)
</ins><span class="cx">     {
</span><del>-        TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find(&quot;GL_EXT_draw_buffers&quot;);
-        const bool usingMRTExtension = (iter != mContext.extensionBehavior().end() &amp;&amp; (iter-&gt;second == EBhEnable || iter-&gt;second == EBhRequire));
</del><ins>+        out &lt;&lt; &quot;#define ANGLE_REQUIRES_IEEE_STRICT_COMPILING\n&quot;;
+    }
</ins><span class="cx"> 
</span><ins>+    out &lt;&lt; &quot;#ifdef ANGLE_ENABLE_LOOP_FLATTEN\n&quot;
+           &quot;#define LOOP [loop]\n&quot;
+           &quot;#define FLATTEN [flatten]\n&quot;
+           &quot;#else\n&quot;
+           &quot;#define LOOP\n&quot;
+           &quot;#define FLATTEN\n&quot;
+           &quot;#endif\n&quot;;
+
+    if (mShaderType == GL_FRAGMENT_SHADER)
+    {
+        TExtensionBehavior::const_iterator iter = mExtensionBehavior.find(&quot;GL_EXT_draw_buffers&quot;);
+        const bool usingMRTExtension = (iter != mExtensionBehavior.end() &amp;&amp; (iter-&gt;second == EBhEnable || iter-&gt;second == EBhRequire));
+
</ins><span class="cx">         out &lt;&lt; &quot;// Varyings\n&quot;;
</span><span class="cx">         out &lt;&lt;  varyings;
</span><span class="cx">         out &lt;&lt; &quot;\n&quot;;
</span><span class="cx"> 
</span><del>-        if (mContext.getShaderVersion() &gt;= 300)
</del><ins>+        if (mShaderVersion &gt;= 300)
</ins><span class="cx">         {
</span><span class="cx">             for (ReferencedSymbols::const_iterator outputVariableIt = mReferencedOutputVariables.begin(); outputVariableIt != mReferencedOutputVariables.end(); outputVariableIt++)
</span><span class="cx">             {
</span><span class="cx">                 const TString &amp;variableName = outputVariableIt-&gt;first;
</span><span class="cx">                 const TType &amp;variableType = outputVariableIt-&gt;second-&gt;getType();
</span><del>-                const TLayoutQualifier &amp;layoutQualifier = variableType.getLayoutQualifier();
</del><span class="cx"> 
</span><del>-                out &lt;&lt; &quot;static &quot; + typeString(variableType) + &quot; out_&quot; + variableName + arrayString(variableType) +
</del><ins>+                out &lt;&lt; &quot;static &quot; + TypeString(variableType) + &quot; out_&quot; + variableName + ArrayString(variableType) +
</ins><span class="cx">                        &quot; = &quot; + initializer(variableType) + &quot;;\n&quot;;
</span><del>-
-                gl::Attribute outputVar(glVariableType(variableType), glVariablePrecision(variableType), variableName.c_str(),
-                                    (unsigned int)variableType.getArraySize(), layoutQualifier.location);
-                mActiveOutputVariables.push_back(outputVar);
</del><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="lines">@@ -817,22 +506,13 @@
</span><span class="cx">             out &lt;&lt; &quot;static gl_DepthRangeParameters gl_DepthRange = {dx_DepthRange.x, dx_DepthRange.y, dx_DepthRange.z};\n&quot;
</span><span class="cx">                    &quot;\n&quot;;
</span><span class="cx">         }
</span><del>-        
-        out &lt;&lt;  uniforms;
-        out &lt;&lt; &quot;\n&quot;;
</del><span class="cx"> 
</span><del>-        if (!interfaceBlocks.empty())
</del><ins>+        if (!flaggedStructs.empty())
</ins><span class="cx">         {
</span><del>-            out &lt;&lt; interfaceBlocks;
</del><ins>+            out &lt;&lt; &quot;// Std140 Structures accessed by value\n&quot;;
</ins><span class="cx">             out &lt;&lt; &quot;\n&quot;;
</span><del>-
-            if (!flaggedStructs.empty())
-            {
-                out &lt;&lt; &quot;// Std140 Structures accessed by value\n&quot;;
-                out &lt;&lt; &quot;\n&quot;;
-                out &lt;&lt; flaggedStructs;
-                out &lt;&lt; &quot;\n&quot;;
-            }
</del><ins>+            out &lt;&lt; flaggedStructs;
+            out &lt;&lt; &quot;\n&quot;;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (usingMRTExtension &amp;&amp; mNumRenderTargets &gt; 1)
</span><span class="lines">@@ -856,12 +536,17 @@
</span><span class="cx">         out &lt;&lt;  attributes;
</span><span class="cx">         out &lt;&lt; &quot;\n&quot;
</span><span class="cx">                &quot;static float4 gl_Position = float4(0, 0, 0, 0);\n&quot;;
</span><del>-        
</del><ins>+
</ins><span class="cx">         if (mUsesPointSize)
</span><span class="cx">         {
</span><span class="cx">             out &lt;&lt; &quot;static float gl_PointSize = float(1);\n&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        if (mUsesInstanceID)
+        {
+            out &lt;&lt; &quot;static int gl_InstanceID;&quot;;
+        }
+
</ins><span class="cx">         out &lt;&lt; &quot;\n&quot;
</span><span class="cx">                &quot;// Varyings\n&quot;;
</span><span class="cx">         out &lt;&lt;  varyings;
</span><span class="lines">@@ -880,14 +565,22 @@
</span><span class="cx"> 
</span><span class="cx">         if (mOutputType == SH_HLSL11_OUTPUT)
</span><span class="cx">         {
</span><ins>+            out &lt;&lt; &quot;cbuffer DriverConstants : register(b1)\n&quot;
+                    &quot;{\n&quot;;
+
</ins><span class="cx">             if (mUsesDepthRange)
</span><span class="cx">             {
</span><del>-                out &lt;&lt; &quot;cbuffer DriverConstants : register(b1)\n&quot;
-                       &quot;{\n&quot;
-                       &quot;    float3 dx_DepthRange : packoffset(c0);\n&quot;
-                       &quot;};\n&quot;
-                       &quot;\n&quot;;
</del><ins>+                out &lt;&lt; &quot;    float3 dx_DepthRange : packoffset(c0);\n&quot;;
</ins><span class="cx">             }
</span><ins>+
+            // dx_ViewAdjust and dx_ViewCoords will only be used in Feature Level 9 shaders.
+            // However, we declare it for all shaders (including Feature Level 10+).
+            // The bytecode is the same whether we declare it or not, since D3DCompiler removes it if it's unused.
+            out &lt;&lt; &quot;    float4 dx_ViewAdjust : packoffset(c1);\n&quot;;
+            out &lt;&lt; &quot;    float2 dx_ViewCoords : packoffset(c2);\n&quot;;
+
+            out &lt;&lt; &quot;};\n&quot;
+                   &quot;\n&quot;;
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="lines">@@ -896,7 +589,8 @@
</span><span class="cx">                 out &lt;&lt; &quot;uniform float3 dx_DepthRange : register(c0);\n&quot;;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            out &lt;&lt; &quot;uniform float4 dx_ViewAdjust : register(c1);\n&quot;
</del><ins>+            out &lt;&lt; &quot;uniform float4 dx_ViewAdjust : register(c1);\n&quot;;
+            out &lt;&lt; &quot;uniform float2 dx_ViewCoords : register(c2);\n&quot;
</ins><span class="cx">                    &quot;\n&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -906,21 +600,12 @@
</span><span class="cx">                    &quot;\n&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        out &lt;&lt; uniforms;
-        out &lt;&lt; &quot;\n&quot;;
-        
-        if (!interfaceBlocks.empty())
</del><ins>+        if (!flaggedStructs.empty())
</ins><span class="cx">         {
</span><del>-            out &lt;&lt; interfaceBlocks;
</del><ins>+            out &lt;&lt; &quot;// Std140 Structures accessed by value\n&quot;;
</ins><span class="cx">             out &lt;&lt; &quot;\n&quot;;
</span><del>-
-            if (!flaggedStructs.empty())
-            {
-                out &lt;&lt; &quot;// Std140 Structures accessed by value\n&quot;;
-                out &lt;&lt; &quot;\n&quot;;
-                out &lt;&lt; flaggedStructs;
-                out &lt;&lt; &quot;\n&quot;;
-            }
</del><ins>+            out &lt;&lt; flaggedStructs;
+            out &lt;&lt; &quot;\n&quot;;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1358,7 +1043,15 @@
</span><span class="cx">                 }
</span><span class="cx">                 else if (IsShadowSampler(textureFunction-&gt;sampler))
</span><span class="cx">                 {
</span><del>-                    out &lt;&lt; &quot;x.SampleCmp(s, &quot;;
</del><ins>+                    switch(textureFunction-&gt;method)
+                    {
+                      case TextureFunction::IMPLICIT: out &lt;&lt; &quot;x.SampleCmp(s, &quot;;          break;
+                      case TextureFunction::BIAS:     out &lt;&lt; &quot;x.SampleCmp(s, &quot;;          break;
+                      case TextureFunction::LOD:      out &lt;&lt; &quot;x.SampleCmp(s, &quot;;          break;
+                      case TextureFunction::LOD0:     out &lt;&lt; &quot;x.SampleCmpLevelZero(s, &quot;; break;
+                      case TextureFunction::LOD0BIAS: out &lt;&lt; &quot;x.SampleCmpLevelZero(s, &quot;; break;
+                      default: UNREACHABLE();
+                    }
</ins><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><span class="lines">@@ -1390,7 +1083,7 @@
</span><span class="cx">                   case 3: out &lt;&lt; &quot;int4(&quot;; break;
</span><span class="cx">                   default: UNREACHABLE();
</span><span class="cx">                 }
</span><del>-            
</del><ins>+
</ins><span class="cx">                 // Convert from normalized floating-point to integer
</span><span class="cx">                 if (textureFunction-&gt;method != TextureFunction::FETCH)
</span><span class="cx">                 {
</span><span class="lines">@@ -1425,7 +1118,7 @@
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             TString proj = &quot;&quot;;   // Only used for projected textures
</span><del>-        
</del><ins>+
</ins><span class="cx">             if (textureFunction-&gt;proj)
</span><span class="cx">             {
</span><span class="cx">                 switch(textureFunction-&gt;coords)
</span><span class="lines">@@ -1489,12 +1182,21 @@
</span><span class="cx">                     else if (IsShadowSampler(textureFunction-&gt;sampler))
</span><span class="cx">                     {
</span><span class="cx">                         // Compare value
</span><del>-                        switch(textureFunction-&gt;coords)
</del><ins>+                        if (textureFunction-&gt;proj)
</ins><span class="cx">                         {
</span><del>-                          case 3: out &lt;&lt; &quot;), t.z&quot;; break;
-                          case 4: out &lt;&lt; &quot;), t.w&quot;; break;
-                          default: UNREACHABLE();
</del><ins>+                            // According to ESSL 3.00.4 sec 8.8 p95 on textureProj:
+                            // The resulting third component of P' in the shadow forms is used as Dref
+                            out &lt;&lt; &quot;), t.z&quot; &lt;&lt; proj;
</ins><span class="cx">                         }
</span><ins>+                        else
+                        {
+                            switch(textureFunction-&gt;coords)
+                            {
+                              case 3: out &lt;&lt; &quot;), t.z&quot;; break;
+                              case 4: out &lt;&lt; &quot;), t.w&quot;; break;
+                              default: UNREACHABLE();
+                            }
+                        }
</ins><span class="cx">                     }
</span><span class="cx">                     else
</span><span class="cx">                     {
</span><span class="lines">@@ -1509,12 +1211,21 @@
</span><span class="cx">                 else if (IsShadowSampler(textureFunction-&gt;sampler))
</span><span class="cx">                 {
</span><span class="cx">                     // Compare value
</span><del>-                    switch(textureFunction-&gt;coords)
</del><ins>+                    if (textureFunction-&gt;proj)
</ins><span class="cx">                     {
</span><del>-                      case 3: out &lt;&lt; &quot;), t.z&quot;; break;
-                      case 4: out &lt;&lt; &quot;), t.w&quot;; break;
-                      default: UNREACHABLE();
</del><ins>+                        // According to ESSL 3.00.4 sec 8.8 p95 on textureProj:
+                        // The resulting third component of P' in the shadow forms is used as Dref
+                        out &lt;&lt; &quot;), t.z&quot; &lt;&lt; proj;
</ins><span class="cx">                     }
</span><ins>+                    else
+                    {
+                        switch(textureFunction-&gt;coords)
+                        {
+                          case 3: out &lt;&lt; &quot;), t.z&quot;; break;
+                          case 4: out &lt;&lt; &quot;), t.w&quot;; break;
+                          default: UNREACHABLE();
+                        }
+                    }
</ins><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><span class="lines">@@ -1583,179 +1294,12 @@
</span><span class="cx">                &quot;\n&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (mUsesMod1)
-    {
-        out &lt;&lt; &quot;float mod(float x, float y)\n&quot;
-               &quot;{\n&quot;
-               &quot;    return x - y * floor(x / y);\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesMod2v)
-    {
-        out &lt;&lt; &quot;float2 mod(float2 x, float2 y)\n&quot;
-               &quot;{\n&quot;
-               &quot;    return x - y * floor(x / y);\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesMod2f)
-    {
-        out &lt;&lt; &quot;float2 mod(float2 x, float y)\n&quot;
-               &quot;{\n&quot;
-               &quot;    return x - y * floor(x / y);\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-    
-    if (mUsesMod3v)
-    {
-        out &lt;&lt; &quot;float3 mod(float3 x, float3 y)\n&quot;
-               &quot;{\n&quot;
-               &quot;    return x - y * floor(x / y);\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesMod3f)
-    {
-        out &lt;&lt; &quot;float3 mod(float3 x, float y)\n&quot;
-               &quot;{\n&quot;
-               &quot;    return x - y * floor(x / y);\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesMod4v)
-    {
-        out &lt;&lt; &quot;float4 mod(float4 x, float4 y)\n&quot;
-               &quot;{\n&quot;
-               &quot;    return x - y * floor(x / y);\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesMod4f)
-    {
-        out &lt;&lt; &quot;float4 mod(float4 x, float y)\n&quot;
-               &quot;{\n&quot;
-               &quot;    return x - y * floor(x / y);\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesFaceforward1)
-    {
-        out &lt;&lt; &quot;float faceforward(float N, float I, float Nref)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return -N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;    else\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesFaceforward2)
-    {
-        out &lt;&lt; &quot;float2 faceforward(float2 N, float2 I, float2 Nref)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return -N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;    else\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesFaceforward3)
-    {
-        out &lt;&lt; &quot;float3 faceforward(float3 N, float3 I, float3 Nref)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return -N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;    else\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesFaceforward4)
-    {
-        out &lt;&lt; &quot;float4 faceforward(float4 N, float4 I, float4 Nref)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(dot(Nref, I) &gt;= 0)\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return -N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;    else\n&quot;
-               &quot;    {\n&quot;
-               &quot;        return N;\n&quot;
-               &quot;    }\n&quot;
-               &quot;}\n&quot;
-               &quot;\n&quot;;
-    }
-
-    if (mUsesAtan2_1)
-    {
-        out &lt;&lt; &quot;float atanyx(float y, float x)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(x == 0 &amp;&amp; y == 0) x = 1;\n&quot;   // Avoid producing a NaN
-               &quot;    return atan2(y, x);\n&quot;
-               &quot;}\n&quot;;
-    }
-
-    if (mUsesAtan2_2)
-    {
-        out &lt;&lt; &quot;float2 atanyx(float2 y, float2 x)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(x[0] == 0 &amp;&amp; y[0] == 0) x[0] = 1;\n&quot;
-               &quot;    if(x[1] == 0 &amp;&amp; y[1] == 0) x[1] = 1;\n&quot;
-               &quot;    return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));\n&quot;
-               &quot;}\n&quot;;
-    }
-
-    if (mUsesAtan2_3)
-    {
-        out &lt;&lt; &quot;float3 atanyx(float3 y, float3 x)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(x[0] == 0 &amp;&amp; y[0] == 0) x[0] = 1;\n&quot;
-               &quot;    if(x[1] == 0 &amp;&amp; y[1] == 0) x[1] = 1;\n&quot;
-               &quot;    if(x[2] == 0 &amp;&amp; y[2] == 0) x[2] = 1;\n&quot;
-               &quot;    return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));\n&quot;
-               &quot;}\n&quot;;
-    }
-
-    if (mUsesAtan2_4)
-    {
-        out &lt;&lt; &quot;float4 atanyx(float4 y, float4 x)\n&quot;
-               &quot;{\n&quot;
-               &quot;    if(x[0] == 0 &amp;&amp; y[0] == 0) x[0] = 1;\n&quot;
-               &quot;    if(x[1] == 0 &amp;&amp; y[1] == 0) x[1] = 1;\n&quot;
-               &quot;    if(x[2] == 0 &amp;&amp; y[2] == 0) x[2] = 1;\n&quot;
-               &quot;    if(x[3] == 0 &amp;&amp; y[3] == 0) x[3] = 1;\n&quot;
-               &quot;    return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]), atan2(y[3], x[3]));\n&quot;
-               &quot;}\n&quot;;
-    }
</del><ins>+    builtInFunctionEmulator-&gt;OutputEmulatedFunctions(out);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void OutputHLSL::visitSymbol(TIntermSymbol *node)
</span><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mBody;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     // Handle accessing std140 structs by value
</span><span class="cx">     if (mFlaggedStructMappedNames.count(node) &gt; 0)
</span><span class="lines">@@ -1777,8 +1321,8 @@
</span><span class="cx"> 
</span><span class="cx">         if (qualifier == EvqUniform)
</span><span class="cx">         {
</span><del>-            const TType&amp; nodeType = node-&gt;getType();
-            const TInterfaceBlock* interfaceBlock = nodeType.getInterfaceBlock();
</del><ins>+            const TType &amp;nodeType = node-&gt;getType();
+            const TInterfaceBlock *interfaceBlock = nodeType.getInterfaceBlock();
</ins><span class="cx"> 
</span><span class="cx">             if (interfaceBlock)
</span><span class="cx">             {
</span><span class="lines">@@ -1789,17 +1333,19 @@
</span><span class="cx">                 mReferencedUniforms[name] = node;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            out &lt;&lt; decorateUniform(name, nodeType);
</del><ins>+            ensureStructDefined(nodeType);
+
+            out &lt;&lt; DecorateUniform(name, nodeType);
</ins><span class="cx">         }
</span><span class="cx">         else if (qualifier == EvqAttribute || qualifier == EvqVertexIn)
</span><span class="cx">         {
</span><span class="cx">             mReferencedAttributes[name] = node;
</span><del>-            out &lt;&lt; decorate(name);
</del><ins>+            out &lt;&lt; Decorate(name);
</ins><span class="cx">         }
</span><del>-        else if (isVarying(qualifier))
</del><ins>+        else if (IsVarying(qualifier))
</ins><span class="cx">         {
</span><span class="cx">             mReferencedVaryings[name] = node;
</span><del>-            out &lt;&lt; decorate(name);
</del><ins>+            out &lt;&lt; Decorate(name);
</ins><span class="cx">         }
</span><span class="cx">         else if (qualifier == EvqFragmentOut)
</span><span class="cx">         {
</span><span class="lines">@@ -1836,25 +1382,74 @@
</span><span class="cx">             mUsesPointSize = true;
</span><span class="cx">             out &lt;&lt; name;
</span><span class="cx">         }
</span><ins>+        else if (qualifier == EvqInstanceID)
+        {
+            mUsesInstanceID = true;
+            out &lt;&lt; name;
+        }
</ins><span class="cx">         else if (name == &quot;gl_FragDepthEXT&quot;)
</span><span class="cx">         {
</span><span class="cx">             mUsesFragDepth = true;
</span><span class="cx">             out &lt;&lt; &quot;gl_Depth&quot;;
</span><span class="cx">         }
</span><del>-        else if (qualifier == EvqInternal)
</del><ins>+        else if (node-&gt;isInternal())
</ins><span class="cx">         {
</span><span class="cx">             out &lt;&lt; name;
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            out &lt;&lt; decorate(name);
</del><ins>+            out &lt;&lt; Decorate(name);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void OutputHLSL::visitRaw(TIntermRaw *node)
+{
+    getInfoSink() &lt;&lt; node-&gt;getRawText();
+}
+
+void OutputHLSL::outputEqual(Visit visit, const TType &amp;type, TOperator op, TInfoSinkBase &amp;out)
+{
+    if (type.isScalar() &amp;&amp; !type.isArray())
+    {
+        if (op == EOpEqual)
+        {
+            outputTriplet(visit, &quot;(&quot;, &quot; == &quot;, &quot;)&quot;, out);
+        }
+        else
+        {
+            outputTriplet(visit, &quot;(&quot;, &quot; != &quot;, &quot;)&quot;, out);
+        }
+    }
+    else
+    {
+        if (visit == PreVisit &amp;&amp; op == EOpNotEqual)
+        {
+            out &lt;&lt; &quot;!&quot;;
+        }
+
+        if (type.isArray())
+        {
+            const TString &amp;functionName = addArrayEqualityFunction(type);
+            outputTriplet(visit, (functionName + &quot;(&quot;).c_str(), &quot;, &quot;, &quot;)&quot;, out);
+        }
+        else if (type.getBasicType() == EbtStruct)
+        {
+            const TStructure &amp;structure = *type.getStruct();
+            const TString &amp;functionName = addStructEqualityFunction(structure);
+            outputTriplet(visit, (functionName + &quot;(&quot;).c_str(), &quot;, &quot;, &quot;)&quot;, out);
+        }
+        else
+        {
+            ASSERT(type.isMatrix() || type.isVector());
+            outputTriplet(visit, &quot;all(&quot;, &quot; == &quot;, &quot;)&quot;, out);
+        }
+    }
+}
+
</ins><span class="cx"> bool OutputHLSL::visitBinary(Visit visit, TIntermBinary *node)
</span><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mBody;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     // Handle accessing std140 structs by value
</span><span class="cx">     if (mFlaggedStructMappedNames.count(node) &gt; 0)
</span><span class="lines">@@ -1865,7 +1460,35 @@
</span><span class="cx"> 
</span><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><del>-      case EOpAssign:                  outputTriplet(visit, &quot;(&quot;, &quot; = &quot;, &quot;)&quot;);           break;
</del><ins>+      case EOpAssign:
+        if (node-&gt;getLeft()-&gt;isArray())
+        {
+            TIntermAggregate *rightAgg = node-&gt;getRight()-&gt;getAsAggregate();
+            if (rightAgg != nullptr &amp;&amp; rightAgg-&gt;isConstructor())
+            {
+                const TString &amp;functionName = addArrayConstructIntoFunction(node-&gt;getType());
+                out &lt;&lt; functionName &lt;&lt; &quot;(&quot;;
+                node-&gt;getLeft()-&gt;traverse(this);
+                TIntermSequence *seq = rightAgg-&gt;getSequence();
+                for (auto &amp;arrayElement : *seq)
+                {
+                    out &lt;&lt; &quot;, &quot;;
+                    arrayElement-&gt;traverse(this);
+                }
+                out &lt;&lt; &quot;)&quot;;
+                return false;
+            }
+            // ArrayReturnValueToOutParameter should have eliminated expressions where a function call is assigned.
+            ASSERT(rightAgg == nullptr || rightAgg-&gt;getOp() != EOpFunctionCall);
+
+            const TString &amp;functionName = addArrayAssignmentFunction(node-&gt;getType());
+            outputTriplet(visit, (functionName + &quot;(&quot;).c_str(), &quot;, &quot;, &quot;)&quot;);
+        }
+        else
+        {
+            outputTriplet(visit, &quot;(&quot;, &quot; = &quot;, &quot;)&quot;);
+        }
+        break;
</ins><span class="cx">       case EOpInitialize:
</span><span class="cx">         if (visit == PreVisit)
</span><span class="cx">         {
</span><span class="lines">@@ -1875,22 +1498,21 @@
</span><span class="cx">             // this to &quot;float t = x, x = t;&quot;.
</span><span class="cx"> 
</span><span class="cx">             TIntermSymbol *symbolNode = node-&gt;getLeft()-&gt;getAsSymbolNode();
</span><ins>+            ASSERT(symbolNode);
</ins><span class="cx">             TIntermTyped *expression = node-&gt;getRight();
</span><span class="cx"> 
</span><del>-            sh::SearchSymbol searchSymbol(symbolNode-&gt;getSymbol());
-            expression-&gt;traverse(&amp;searchSymbol);
-            bool sameSymbol = searchSymbol.foundMatch();
-
-            if (sameSymbol)
</del><ins>+            // TODO (jmadill): do a 'deep' scan to know if an expression is statically const
+            if (symbolNode-&gt;getQualifier() == EvqGlobal &amp;&amp; expression-&gt;getQualifier() != EvqConst)
</ins><span class="cx">             {
</span><del>-                // Type already printed
-                out &lt;&lt; &quot;t&quot; + str(mUniqueIndex) + &quot; = &quot;;
-                expression-&gt;traverse(this);
-                out &lt;&lt; &quot;, &quot;;
-                symbolNode-&gt;traverse(this);
-                out &lt;&lt; &quot; = t&quot; + str(mUniqueIndex);
-
-                mUniqueIndex++;
</del><ins>+                // For variables which are not constant, defer their real initialization until
+                // after we initialize other globals: uniforms, attributes and varyings.
+                mDeferredGlobalInitializers.push_back(std::make_pair(symbolNode, expression));
+                const TString &amp;initString = initializer(node-&gt;getType());
+                node-&gt;setRight(new TIntermRaw(node-&gt;getType(), initString));
+            }
+            else if (writeSameSymbolInitializer(out, symbolNode, expression))
+            {
+                // Skip initializing the rest of the expression
</ins><span class="cx">                 return false;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -1913,7 +1535,7 @@
</span><span class="cx">         {
</span><span class="cx">             out &lt;&lt; &quot; = mul(&quot;;
</span><span class="cx">             node-&gt;getLeft()-&gt;traverse(this);
</span><del>-            out &lt;&lt; &quot;, transpose(&quot;;   
</del><ins>+            out &lt;&lt; &quot;, transpose(&quot;;
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="lines">@@ -1927,16 +1549,22 @@
</span><span class="cx">         }
</span><span class="cx">         else if (visit == InVisit)
</span><span class="cx">         {
</span><del>-            out &lt;&lt; &quot; = mul(&quot;;
</del><ins>+            out &lt;&lt; &quot; = transpose(mul(transpose(&quot;;
</ins><span class="cx">             node-&gt;getLeft()-&gt;traverse(this);
</span><del>-            out &lt;&lt; &quot;, &quot;;   
</del><ins>+            out &lt;&lt; &quot;), transpose(&quot;;
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            out &lt;&lt; &quot;))&quot;;
</del><ins>+            out &lt;&lt; &quot;))))&quot;;
</ins><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">       case EOpDivAssign:               outputTriplet(visit, &quot;(&quot;, &quot; /= &quot;, &quot;)&quot;);          break;
</span><ins>+      case EOpIModAssign:              outputTriplet(visit, &quot;(&quot;, &quot; %= &quot;, &quot;)&quot;);          break;
+      case EOpBitShiftLeftAssign:      outputTriplet(visit, &quot;(&quot;, &quot; &lt;&lt;= &quot;, &quot;)&quot;);         break;
+      case EOpBitShiftRightAssign:     outputTriplet(visit, &quot;(&quot;, &quot; &gt;&gt;= &quot;, &quot;)&quot;);         break;
+      case EOpBitwiseAndAssign:        outputTriplet(visit, &quot;(&quot;, &quot; &amp;= &quot;, &quot;)&quot;);          break;
+      case EOpBitwiseXorAssign:        outputTriplet(visit, &quot;(&quot;, &quot; ^= &quot;, &quot;)&quot;);          break;
+      case EOpBitwiseOrAssign:         outputTriplet(visit, &quot;(&quot;, &quot; |= &quot;, &quot;)&quot;);          break;
</ins><span class="cx">       case EOpIndexDirect:
</span><span class="cx">         {
</span><span class="cx">             const TType&amp; leftType = node-&gt;getLeft()-&gt;getType();
</span><span class="lines">@@ -1946,10 +1574,8 @@
</span><span class="cx">                 {
</span><span class="cx">                     TInterfaceBlock* interfaceBlock = leftType.getInterfaceBlock();
</span><span class="cx">                     const int arrayIndex = node-&gt;getRight()-&gt;getAsConstantUnion()-&gt;getIConst(0);
</span><del>-
</del><span class="cx">                     mReferencedInterfaceBlocks[interfaceBlock-&gt;instanceName()] = node-&gt;getLeft()-&gt;getAsSymbolNode();
</span><del>-                    out &lt;&lt; interfaceBlockInstanceString(*interfaceBlock, arrayIndex);
-
</del><ins>+                    out &lt;&lt; mUniformHLSL-&gt;interfaceBlockInstanceString(*interfaceBlock, arrayIndex);
</ins><span class="cx">                     return false;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -1970,7 +1596,7 @@
</span><span class="cx">             const TStructure* structure = node-&gt;getLeft()-&gt;getType().getStruct();
</span><span class="cx">             const TIntermConstantUnion* index = node-&gt;getRight()-&gt;getAsConstantUnion();
</span><span class="cx">             const TField* field = structure-&gt;fields()[index-&gt;getIConst(0)];
</span><del>-            out &lt;&lt; &quot;.&quot; + decorateField(field-&gt;name(), *structure);
</del><ins>+            out &lt;&lt; &quot;.&quot; + DecorateField(field-&gt;name(), *structure);
</ins><span class="cx"> 
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="lines">@@ -1981,7 +1607,7 @@
</span><span class="cx">             const TInterfaceBlock* interfaceBlock = node-&gt;getLeft()-&gt;getType().getInterfaceBlock();
</span><span class="cx">             const TIntermConstantUnion* index = node-&gt;getRight()-&gt;getAsConstantUnion();
</span><span class="cx">             const TField* field = interfaceBlock-&gt;fields()[index-&gt;getIConst(0)];
</span><del>-            out &lt;&lt; &quot;.&quot; + decorate(field-&gt;name());
</del><ins>+            out &lt;&lt; &quot;.&quot; + Decorate(field-&gt;name());
</ins><span class="cx"> 
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="lines">@@ -1995,9 +1621,9 @@
</span><span class="cx"> 
</span><span class="cx">             if (swizzle)
</span><span class="cx">             {
</span><del>-                TIntermSequence &amp;sequence = swizzle-&gt;getSequence();
</del><ins>+                TIntermSequence *sequence = swizzle-&gt;getSequence();
</ins><span class="cx"> 
</span><del>-                for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
</del><ins>+                for (TIntermSequence::iterator sit = sequence-&gt;begin(); sit != sequence-&gt;end(); sit++)
</ins><span class="cx">                 {
</span><span class="cx">                     TIntermConstantUnion *element = (*sit)-&gt;getAsConstantUnion();
</span><span class="cx"> 
</span><span class="lines">@@ -2026,65 +1652,15 @@
</span><span class="cx">       case EOpSub:               outputTriplet(visit, &quot;(&quot;, &quot; - &quot;, &quot;)&quot;); break;
</span><span class="cx">       case EOpMul:               outputTriplet(visit, &quot;(&quot;, &quot; * &quot;, &quot;)&quot;); break;
</span><span class="cx">       case EOpDiv:               outputTriplet(visit, &quot;(&quot;, &quot; / &quot;, &quot;)&quot;); break;
</span><ins>+      case EOpIMod:              outputTriplet(visit, &quot;(&quot;, &quot; % &quot;, &quot;)&quot;); break;
+      case EOpBitShiftLeft:      outputTriplet(visit, &quot;(&quot;, &quot; &lt;&lt; &quot;, &quot;)&quot;); break;
+      case EOpBitShiftRight:     outputTriplet(visit, &quot;(&quot;, &quot; &gt;&gt; &quot;, &quot;)&quot;); break;
+      case EOpBitwiseAnd:        outputTriplet(visit, &quot;(&quot;, &quot; &amp; &quot;, &quot;)&quot;); break;
+      case EOpBitwiseXor:        outputTriplet(visit, &quot;(&quot;, &quot; ^ &quot;, &quot;)&quot;); break;
+      case EOpBitwiseOr:         outputTriplet(visit, &quot;(&quot;, &quot; | &quot;, &quot;)&quot;); break;
</ins><span class="cx">       case EOpEqual:
</span><span class="cx">       case EOpNotEqual:
</span><del>-        if (node-&gt;getLeft()-&gt;isScalar())
-        {
-            if (node-&gt;getOp() == EOpEqual)
-            {
-                outputTriplet(visit, &quot;(&quot;, &quot; == &quot;, &quot;)&quot;);
-            }
-            else
-            {
-                outputTriplet(visit, &quot;(&quot;, &quot; != &quot;, &quot;)&quot;);
-            }
-        }
-        else if (node-&gt;getLeft()-&gt;getBasicType() == EbtStruct)
-        {
-            if (node-&gt;getOp() == EOpEqual)
-            {
-                out &lt;&lt; &quot;(&quot;;
-            }
-            else
-            {
-                out &lt;&lt; &quot;!(&quot;;
-            }
-
-            const TStructure &amp;structure = *node-&gt;getLeft()-&gt;getType().getStruct();
-            const TFieldList &amp;fields = structure.fields();
-
-            for (size_t i = 0; i &lt; fields.size(); i++)
-            {
-                const TField *field = fields[i];
-
-                node-&gt;getLeft()-&gt;traverse(this);
-                out &lt;&lt; &quot;.&quot; + decorateField(field-&gt;name(), structure) + &quot; == &quot;;
-                node-&gt;getRight()-&gt;traverse(this);
-                out &lt;&lt; &quot;.&quot; + decorateField(field-&gt;name(), structure);
-
-                if (i &lt; fields.size() - 1)
-                {
-                    out &lt;&lt; &quot; &amp;&amp; &quot;;
-                }
-            }
-
-            out &lt;&lt; &quot;)&quot;;
-
-            return false;
-        }
-        else
-        {
-            ASSERT(node-&gt;getLeft()-&gt;isMatrix() || node-&gt;getLeft()-&gt;isVector());
-
-            if (node-&gt;getOp() == EOpEqual)
-            {
-                outputTriplet(visit, &quot;all(&quot;, &quot; == &quot;, &quot;)&quot;);
-            }
-            else
-            {
-                outputTriplet(visit, &quot;!all(&quot;, &quot; == &quot;, &quot;)&quot;);
-            }
-        }
</del><ins>+        outputEqual(visit, node-&gt;getLeft()-&gt;getType(), node-&gt;getOp(), out);
</ins><span class="cx">         break;
</span><span class="cx">       case EOpLessThan:          outputTriplet(visit, &quot;(&quot;, &quot; &lt; &quot;, &quot;)&quot;);   break;
</span><span class="cx">       case EOpGreaterThan:       outputTriplet(visit, &quot;(&quot;, &quot; &gt; &quot;, &quot;)&quot;);   break;
</span><span class="lines">@@ -2131,61 +1707,15 @@
</span><span class="cx"> {
</span><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><del>-      case EOpNegative:         outputTriplet(visit, &quot;(-&quot;, &quot;&quot;, &quot;)&quot;);  break;
-      case EOpVectorLogicalNot: outputTriplet(visit, &quot;(!&quot;, &quot;&quot;, &quot;)&quot;);  break;
-      case EOpLogicalNot:       outputTriplet(visit, &quot;(!&quot;, &quot;&quot;, &quot;)&quot;);  break;
-      case EOpPostIncrement:    outputTriplet(visit, &quot;(&quot;, &quot;&quot;, &quot;++)&quot;); break;
-      case EOpPostDecrement:    outputTriplet(visit, &quot;(&quot;, &quot;&quot;, &quot;--)&quot;); break;
-      case EOpPreIncrement:     outputTriplet(visit, &quot;(++&quot;, &quot;&quot;, &quot;)&quot;); break;
-      case EOpPreDecrement:     outputTriplet(visit, &quot;(--&quot;, &quot;&quot;, &quot;)&quot;); break;
-      case EOpConvIntToBool:
-      case EOpConvUIntToBool:
-      case EOpConvFloatToBool:
-        switch (node-&gt;getOperand()-&gt;getType().getNominalSize())
-        {
-          case 1:    outputTriplet(visit, &quot;bool(&quot;, &quot;&quot;, &quot;)&quot;);  break;
-          case 2:    outputTriplet(visit, &quot;bool2(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          case 3:    outputTriplet(visit, &quot;bool3(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          case 4:    outputTriplet(visit, &quot;bool4(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          default: UNREACHABLE();
-        }
-        break;
-      case EOpConvBoolToFloat:
-      case EOpConvIntToFloat:
-      case EOpConvUIntToFloat:
-        switch (node-&gt;getOperand()-&gt;getType().getNominalSize())
-        {
-          case 1:    outputTriplet(visit, &quot;float(&quot;, &quot;&quot;, &quot;)&quot;);  break;
-          case 2:    outputTriplet(visit, &quot;float2(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          case 3:    outputTriplet(visit, &quot;float3(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          case 4:    outputTriplet(visit, &quot;float4(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          default: UNREACHABLE();
-        }
-        break;
-      case EOpConvFloatToInt:
-      case EOpConvBoolToInt:
-      case EOpConvUIntToInt:
-        switch (node-&gt;getOperand()-&gt;getType().getNominalSize())
-        {
-          case 1:    outputTriplet(visit, &quot;int(&quot;, &quot;&quot;, &quot;)&quot;);  break;
-          case 2:    outputTriplet(visit, &quot;int2(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          case 3:    outputTriplet(visit, &quot;int3(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          case 4:    outputTriplet(visit, &quot;int4(&quot;, &quot;&quot;, &quot;)&quot;); break;
-          default: UNREACHABLE();
-        }
-        break;
-      case EOpConvFloatToUInt:
-      case EOpConvBoolToUInt:
-      case EOpConvIntToUInt:
-        switch (node-&gt;getOperand()-&gt;getType().getNominalSize())
-        {
-          case 1:    outputTriplet(visit, &quot;uint(&quot;, &quot;&quot;, &quot;)&quot;);  break;
-          case 2:    outputTriplet(visit, &quot;uint2(&quot;, &quot;&quot;, &quot;)&quot;);  break;
-          case 3:    outputTriplet(visit, &quot;uint3(&quot;, &quot;&quot;, &quot;)&quot;);  break;
-          case 4:    outputTriplet(visit, &quot;uint4(&quot;, &quot;&quot;, &quot;)&quot;);  break;
-          default: UNREACHABLE();
-        }
-        break;
</del><ins>+      case EOpNegative:         outputTriplet(visit, &quot;(-&quot;, &quot;&quot;, &quot;)&quot;);         break;
+      case EOpPositive:         outputTriplet(visit, &quot;(+&quot;, &quot;&quot;, &quot;)&quot;);         break;
+      case EOpVectorLogicalNot: outputTriplet(visit, &quot;(!&quot;, &quot;&quot;, &quot;)&quot;);         break;
+      case EOpLogicalNot:       outputTriplet(visit, &quot;(!&quot;, &quot;&quot;, &quot;)&quot;);         break;
+      case EOpBitwiseNot:       outputTriplet(visit, &quot;(~&quot;, &quot;&quot;, &quot;)&quot;);         break;
+      case EOpPostIncrement:    outputTriplet(visit, &quot;(&quot;, &quot;&quot;, &quot;++)&quot;);        break;
+      case EOpPostDecrement:    outputTriplet(visit, &quot;(&quot;, &quot;&quot;, &quot;--)&quot;);        break;
+      case EOpPreIncrement:     outputTriplet(visit, &quot;(++&quot;, &quot;&quot;, &quot;)&quot;);        break;
+      case EOpPreDecrement:     outputTriplet(visit, &quot;(--&quot;, &quot;&quot;, &quot;)&quot;);        break;
</ins><span class="cx">       case EOpRadians:          outputTriplet(visit, &quot;radians(&quot;, &quot;&quot;, &quot;)&quot;);   break;
</span><span class="cx">       case EOpDegrees:          outputTriplet(visit, &quot;degrees(&quot;, &quot;&quot;, &quot;)&quot;);   break;
</span><span class="cx">       case EOpSin:              outputTriplet(visit, &quot;sin(&quot;, &quot;&quot;, &quot;)&quot;);       break;
</span><span class="lines">@@ -2194,6 +1724,21 @@
</span><span class="cx">       case EOpAsin:             outputTriplet(visit, &quot;asin(&quot;, &quot;&quot;, &quot;)&quot;);      break;
</span><span class="cx">       case EOpAcos:             outputTriplet(visit, &quot;acos(&quot;, &quot;&quot;, &quot;)&quot;);      break;
</span><span class="cx">       case EOpAtan:             outputTriplet(visit, &quot;atan(&quot;, &quot;&quot;, &quot;)&quot;);      break;
</span><ins>+      case EOpSinh:             outputTriplet(visit, &quot;sinh(&quot;, &quot;&quot;, &quot;)&quot;);      break;
+      case EOpCosh:             outputTriplet(visit, &quot;cosh(&quot;, &quot;&quot;, &quot;)&quot;);      break;
+      case EOpTanh:             outputTriplet(visit, &quot;tanh(&quot;, &quot;&quot;, &quot;)&quot;);      break;
+      case EOpAsinh:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;asinh(&quot;);
+        break;
+      case EOpAcosh:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;acosh(&quot;);
+        break;
+      case EOpAtanh:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;atanh(&quot;);
+        break;
</ins><span class="cx">       case EOpExp:              outputTriplet(visit, &quot;exp(&quot;, &quot;&quot;, &quot;)&quot;);       break;
</span><span class="cx">       case EOpLog:              outputTriplet(visit, &quot;log(&quot;, &quot;&quot;, &quot;)&quot;);       break;
</span><span class="cx">       case EOpExp2:             outputTriplet(visit, &quot;exp2(&quot;, &quot;&quot;, &quot;)&quot;);      break;
</span><span class="lines">@@ -2203,8 +1748,47 @@
</span><span class="cx">       case EOpAbs:              outputTriplet(visit, &quot;abs(&quot;, &quot;&quot;, &quot;)&quot;);       break;
</span><span class="cx">       case EOpSign:             outputTriplet(visit, &quot;sign(&quot;, &quot;&quot;, &quot;)&quot;);      break;
</span><span class="cx">       case EOpFloor:            outputTriplet(visit, &quot;floor(&quot;, &quot;&quot;, &quot;)&quot;);     break;
</span><ins>+      case EOpTrunc:            outputTriplet(visit, &quot;trunc(&quot;, &quot;&quot;, &quot;)&quot;);     break;
+      case EOpRound:            outputTriplet(visit, &quot;round(&quot;, &quot;&quot;, &quot;)&quot;);     break;
+      case EOpRoundEven:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;roundEven(&quot;);
+        break;
</ins><span class="cx">       case EOpCeil:             outputTriplet(visit, &quot;ceil(&quot;, &quot;&quot;, &quot;)&quot;);      break;
</span><span class="cx">       case EOpFract:            outputTriplet(visit, &quot;frac(&quot;, &quot;&quot;, &quot;)&quot;);      break;
</span><ins>+      case EOpIsNan:
+        outputTriplet(visit, &quot;isnan(&quot;, &quot;&quot;, &quot;)&quot;);
+        mRequiresIEEEStrictCompiling = true;
+        break;
+      case EOpIsInf:            outputTriplet(visit, &quot;isinf(&quot;, &quot;&quot;, &quot;)&quot;);     break;
+      case EOpFloatBitsToInt:   outputTriplet(visit, &quot;asint(&quot;, &quot;&quot;, &quot;)&quot;);     break;
+      case EOpFloatBitsToUint:  outputTriplet(visit, &quot;asuint(&quot;, &quot;&quot;, &quot;)&quot;);    break;
+      case EOpIntBitsToFloat:   outputTriplet(visit, &quot;asfloat(&quot;, &quot;&quot;, &quot;)&quot;);   break;
+      case EOpUintBitsToFloat:  outputTriplet(visit, &quot;asfloat(&quot;, &quot;&quot;, &quot;)&quot;);   break;
+      case EOpPackSnorm2x16:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;packSnorm2x16(&quot;);
+        break;
+      case EOpPackUnorm2x16:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;packUnorm2x16(&quot;);
+        break;
+      case EOpPackHalf2x16:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;packHalf2x16(&quot;);
+        break;
+      case EOpUnpackSnorm2x16:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;unpackSnorm2x16(&quot;);
+        break;
+      case EOpUnpackUnorm2x16:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;unpackUnorm2x16(&quot;);
+        break;
+      case EOpUnpackHalf2x16:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;unpackHalf2x16(&quot;);
+        break;
</ins><span class="cx">       case EOpLength:           outputTriplet(visit, &quot;length(&quot;, &quot;&quot;, &quot;)&quot;);    break;
</span><span class="cx">       case EOpNormalize:        outputTriplet(visit, &quot;normalize(&quot;, &quot;&quot;, &quot;)&quot;); break;
</span><span class="cx">       case EOpDFdx:
</span><span class="lines">@@ -2237,6 +1821,13 @@
</span><span class="cx">             outputTriplet(visit, &quot;fwidth(&quot;, &quot;&quot;, &quot;)&quot;);
</span><span class="cx">         }
</span><span class="cx">         break;
</span><ins>+      case EOpTranspose:        outputTriplet(visit, &quot;transpose(&quot;, &quot;&quot;, &quot;)&quot;);   break;
+      case EOpDeterminant:      outputTriplet(visit, &quot;determinant(transpose(&quot;, &quot;&quot;, &quot;))&quot;); break;
+      case EOpInverse:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;inverse(&quot;);
+        break;
+
</ins><span class="cx">       case EOpAny:              outputTriplet(visit, &quot;any(&quot;, &quot;&quot;, &quot;)&quot;);       break;
</span><span class="cx">       case EOpAll:              outputTriplet(visit, &quot;all(&quot;, &quot;&quot;, &quot;)&quot;);       break;
</span><span class="cx">       default: UNREACHABLE();
</span><span class="lines">@@ -2247,7 +1838,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
</span><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mBody;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><span class="lines">@@ -2257,34 +1848,25 @@
</span><span class="cx">             {
</span><span class="cx">                 outputLineDirective(node-&gt;getLine().first_line);
</span><span class="cx">                 out &lt;&lt; &quot;{\n&quot;;
</span><del>-
-                mScopeDepth++;
-
-                if (mScopeBracket.size() &lt; mScopeDepth)
-                {
-                    mScopeBracket.push_back(0);   // New scope level
-                }
-                else
-                {
-                    mScopeBracket[mScopeDepth - 1]++;   // New scope at existing level
-                }
</del><span class="cx">             }
</span><span class="cx"> 
</span><del>-            for (TIntermSequence::iterator sit = node-&gt;getSequence().begin(); sit != node-&gt;getSequence().end(); sit++)
</del><ins>+            for (TIntermSequence::iterator sit = node-&gt;getSequence()-&gt;begin(); sit != node-&gt;getSequence()-&gt;end(); sit++)
</ins><span class="cx">             {
</span><span class="cx">                 outputLineDirective((*sit)-&gt;getLine().first_line);
</span><span class="cx"> 
</span><span class="cx">                 traverseStatements(*sit);
</span><span class="cx"> 
</span><del>-                out &lt;&lt; &quot;;\n&quot;;
</del><ins>+                // Don't output ; after case labels, they're terminated by :
+                // This is needed especially since outputting a ; after a case statement would turn empty
+                // case statements into non-empty case statements, disallowing fall-through from them.
+                if ((*sit)-&gt;getAsCaseNode() == nullptr)
+                    out &lt;&lt; &quot;;\n&quot;;
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             if (mInsideFunction)
</span><span class="cx">             {
</span><span class="cx">                 outputLineDirective(node-&gt;getLine().last_line);
</span><span class="cx">                 out &lt;&lt; &quot;}\n&quot;;
</span><del>-
-                mScopeDepth--;
</del><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             return false;
</span><span class="lines">@@ -2292,43 +1874,45 @@
</span><span class="cx">       case EOpDeclaration:
</span><span class="cx">         if (visit == PreVisit)
</span><span class="cx">         {
</span><del>-            TIntermSequence &amp;sequence = node-&gt;getSequence();
-            TIntermTyped *variable = sequence[0]-&gt;getAsTyped();
</del><ins>+            TIntermSequence *sequence = node-&gt;getSequence();
+            TIntermTyped *variable = (*sequence)[0]-&gt;getAsTyped();
</ins><span class="cx"> 
</span><span class="cx">             if (variable &amp;&amp; (variable-&gt;getQualifier() == EvqTemporary || variable-&gt;getQualifier() == EvqGlobal))
</span><span class="cx">             {
</span><del>-                if (variable-&gt;getType().getStruct())
-                {
-                    addConstructor(variable-&gt;getType(), scopedStruct(variable-&gt;getType().getStruct()-&gt;name()), NULL);
-                }
</del><ins>+                ensureStructDefined(variable-&gt;getType());
</ins><span class="cx"> 
</span><span class="cx">                 if (!variable-&gt;getAsSymbolNode() || variable-&gt;getAsSymbolNode()-&gt;getSymbol() != &quot;&quot;)   // Variable declaration
</span><span class="cx">                 {
</span><del>-                    if (!mInsideFunction)
</del><ins>+                    for (const auto &amp;seqElement : *sequence)
</ins><span class="cx">                     {
</span><del>-                        out &lt;&lt; &quot;static &quot;;
-                    }
</del><ins>+                        if (isSingleStatement(seqElement))
+                        {
+                            mUnfoldShortCircuit-&gt;traverse(seqElement);
+                        }
</ins><span class="cx"> 
</span><del>-                    out &lt;&lt; typeString(variable-&gt;getType()) + &quot; &quot;;
</del><ins>+                        if (!mInsideFunction)
+                        {
+                            out &lt;&lt; &quot;static &quot;;
+                        }
</ins><span class="cx"> 
</span><del>-                    for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
-                    {
-                        TIntermSymbol *symbol = (*sit)-&gt;getAsSymbolNode();
</del><ins>+                        out &lt;&lt; TypeString(variable-&gt;getType()) + &quot; &quot;;
</ins><span class="cx"> 
</span><ins>+                        TIntermSymbol *symbol = seqElement-&gt;getAsSymbolNode();
+
</ins><span class="cx">                         if (symbol)
</span><span class="cx">                         {
</span><span class="cx">                             symbol-&gt;traverse(this);
</span><del>-                            out &lt;&lt; arrayString(symbol-&gt;getType());
</del><ins>+                            out &lt;&lt; ArrayString(symbol-&gt;getType());
</ins><span class="cx">                             out &lt;&lt; &quot; = &quot; + initializer(symbol-&gt;getType());
</span><span class="cx">                         }
</span><span class="cx">                         else
</span><span class="cx">                         {
</span><del>-                            (*sit)-&gt;traverse(this);
</del><ins>+                            seqElement-&gt;traverse(this);
</ins><span class="cx">                         }
</span><span class="cx"> 
</span><del>-                        if (*sit != sequence.back())
</del><ins>+                        if (seqElement != sequence-&gt;back())
</ins><span class="cx">                         {
</span><del>-                            out &lt;&lt; &quot;, &quot;;
</del><ins>+                            out &lt;&lt; &quot;;\n&quot;;
</ins><span class="cx">                         }
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="lines">@@ -2338,9 +1922,9 @@
</span><span class="cx">                 }
</span><span class="cx">                 else UNREACHABLE();
</span><span class="cx">             }
</span><del>-            else if (variable &amp;&amp; isVaryingOut(variable-&gt;getQualifier()))
</del><ins>+            else if (variable &amp;&amp; IsVaryingOut(variable-&gt;getQualifier()))
</ins><span class="cx">             {
</span><del>-                for (TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
</del><ins>+                for (TIntermSequence::iterator sit = sequence-&gt;begin(); sit != sequence-&gt;end(); sit++)
</ins><span class="cx">                 {
</span><span class="cx">                     TIntermSymbol *symbol = (*sit)-&gt;getAsSymbolNode();
</span><span class="cx"> 
</span><span class="lines">@@ -2363,22 +1947,32 @@
</span><span class="cx">             out &lt;&lt; &quot;, &quot;;
</span><span class="cx">         }
</span><span class="cx">         break;
</span><ins>+      case EOpInvariantDeclaration:
+        // Do not do any translation
+        return false;
</ins><span class="cx">       case EOpPrototype:
</span><span class="cx">         if (visit == PreVisit)
</span><span class="cx">         {
</span><del>-            out &lt;&lt; typeString(node-&gt;getType()) &lt;&lt; &quot; &quot; &lt;&lt; decorate(node-&gt;getName()) &lt;&lt; (mOutputLod0Function ? &quot;Lod0(&quot; : &quot;(&quot;);
</del><ins>+            size_t index = mCallDag.findIndex(node);
+            // Skip the prototype if it is not implemented (and thus not used)
+            if (index == CallDAG::InvalidIndex)
+            {
+                return false;
+            }
</ins><span class="cx"> 
</span><del>-            TIntermSequence &amp;arguments = node-&gt;getSequence();
</del><ins>+            out &lt;&lt; TypeString(node-&gt;getType()) &lt;&lt; &quot; &quot; &lt;&lt; Decorate(TFunction::unmangleName(node-&gt;getName())) &lt;&lt; (mOutputLod0Function ? &quot;Lod0(&quot; : &quot;(&quot;);
</ins><span class="cx"> 
</span><del>-            for (unsigned int i = 0; i &lt; arguments.size(); i++)
</del><ins>+            TIntermSequence *arguments = node-&gt;getSequence();
+
+            for (unsigned int i = 0; i &lt; arguments-&gt;size(); i++)
</ins><span class="cx">             {
</span><del>-                TIntermSymbol *symbol = arguments[i]-&gt;getAsSymbolNode();
</del><ins>+                TIntermSymbol *symbol = (*arguments)[i]-&gt;getAsSymbolNode();
</ins><span class="cx"> 
</span><span class="cx">                 if (symbol)
</span><span class="cx">                 {
</span><span class="cx">                     out &lt;&lt; argumentString(symbol);
</span><span class="cx"> 
</span><del>-                    if (i &lt; arguments.size() - 1)
</del><ins>+                    if (i &lt; arguments-&gt;size() - 1)
</ins><span class="cx">                     {
</span><span class="cx">                         out &lt;&lt; &quot;, &quot;;
</span><span class="cx">                     }
</span><span class="lines">@@ -2389,7 +1983,8 @@
</span><span class="cx">             out &lt;&lt; &quot;);\n&quot;;
</span><span class="cx"> 
</span><span class="cx">             // Also prototype the Lod0 variant if needed
</span><del>-            if (mContainsLoopDiscontinuity &amp;&amp; !mOutputLod0Function)
</del><ins>+            bool needsLod0 = mASTMetadataList[index].mNeedsLod0;
+            if (needsLod0 &amp;&amp; !mOutputLod0Function &amp;&amp; mShaderType == GL_FRAGMENT_SHADER)
</ins><span class="cx">             {
</span><span class="cx">                 mOutputLod0Function = true;
</span><span class="cx">                 node-&gt;traverse(this);
</span><span class="lines">@@ -2402,36 +1997,38 @@
</span><span class="cx">       case EOpComma:            outputTriplet(visit, &quot;(&quot;, &quot;, &quot;, &quot;)&quot;);                break;
</span><span class="cx">       case EOpFunction:
</span><span class="cx">         {
</span><ins>+            ASSERT(mCurrentFunctionMetadata == nullptr);
</ins><span class="cx">             TString name = TFunction::unmangleName(node-&gt;getName());
</span><span class="cx"> 
</span><del>-            out &lt;&lt; typeString(node-&gt;getType()) &lt;&lt; &quot; &quot;;
</del><ins>+            size_t index = mCallDag.findIndex(node);
+            ASSERT(index != CallDAG::InvalidIndex);
+            mCurrentFunctionMetadata = &amp;mASTMetadataList[index];
</ins><span class="cx"> 
</span><ins>+            out &lt;&lt; TypeString(node-&gt;getType()) &lt;&lt; &quot; &quot;;
+
</ins><span class="cx">             if (name == &quot;main&quot;)
</span><span class="cx">             {
</span><span class="cx">                 out &lt;&lt; &quot;gl_main(&quot;;
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                out &lt;&lt; decorate(name) &lt;&lt; (mOutputLod0Function ? &quot;Lod0(&quot; : &quot;(&quot;);
</del><ins>+                out &lt;&lt; Decorate(name) &lt;&lt; (mOutputLod0Function ? &quot;Lod0(&quot; : &quot;(&quot;);
</ins><span class="cx">             }
</span><span class="cx"> 
</span><del>-            TIntermSequence &amp;sequence = node-&gt;getSequence();
-            TIntermSequence &amp;arguments = sequence[0]-&gt;getAsAggregate()-&gt;getSequence();
</del><ins>+            TIntermSequence *sequence = node-&gt;getSequence();
+            TIntermSequence *arguments = (*sequence)[0]-&gt;getAsAggregate()-&gt;getSequence();
</ins><span class="cx"> 
</span><del>-            for (unsigned int i = 0; i &lt; arguments.size(); i++)
</del><ins>+            for (unsigned int i = 0; i &lt; arguments-&gt;size(); i++)
</ins><span class="cx">             {
</span><del>-                TIntermSymbol *symbol = arguments[i]-&gt;getAsSymbolNode();
</del><ins>+                TIntermSymbol *symbol = (*arguments)[i]-&gt;getAsSymbolNode();
</ins><span class="cx"> 
</span><span class="cx">                 if (symbol)
</span><span class="cx">                 {
</span><del>-                    if (symbol-&gt;getType().getStruct())
-                    {
-                        addConstructor(symbol-&gt;getType(), scopedStruct(symbol-&gt;getType().getStruct()-&gt;name()), NULL);
-                    }
</del><ins>+                    ensureStructDefined(symbol-&gt;getType());
</ins><span class="cx"> 
</span><span class="cx">                     out &lt;&lt; argumentString(symbol);
</span><span class="cx"> 
</span><del>-                    if (i &lt; arguments.size() - 1)
</del><ins>+                    if (i &lt; arguments-&gt;size() - 1)
</ins><span class="cx">                     {
</span><span class="cx">                         out &lt;&lt; &quot;, &quot;;
</span><span class="cx">                     }
</span><span class="lines">@@ -2441,24 +2038,25 @@
</span><span class="cx"> 
</span><span class="cx">             out &lt;&lt; &quot;)\n&quot;
</span><span class="cx">                 &quot;{\n&quot;;
</span><del>-            
-            if (sequence.size() &gt; 1)
</del><ins>+
+            if (sequence-&gt;size() &gt; 1)
</ins><span class="cx">             {
</span><span class="cx">                 mInsideFunction = true;
</span><del>-                sequence[1]-&gt;traverse(this);
</del><ins>+                (*sequence)[1]-&gt;traverse(this);
</ins><span class="cx">                 mInsideFunction = false;
</span><span class="cx">             }
</span><del>-            
</del><ins>+
</ins><span class="cx">             out &lt;&lt; &quot;}\n&quot;;
</span><span class="cx"> 
</span><del>-            if (mContainsLoopDiscontinuity &amp;&amp; !mOutputLod0Function)
</del><ins>+            mCurrentFunctionMetadata = nullptr;
+
+            bool needsLod0 = mASTMetadataList[index].mNeedsLod0;
+            if (needsLod0 &amp;&amp; !mOutputLod0Function &amp;&amp; mShaderType == GL_FRAGMENT_SHADER)
</ins><span class="cx">             {
</span><del>-                if (name != &quot;main&quot;)
-                {
-                    mOutputLod0Function = true;
-                    node-&gt;traverse(this);
-                    mOutputLod0Function = false;
-                }
</del><ins>+                ASSERT(name != &quot;main&quot;);
+                mOutputLod0Function = true;
+                node-&gt;traverse(this);
+                mOutputLod0Function = false;
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             return false;
</span><span class="lines">@@ -2467,20 +2065,28 @@
</span><span class="cx">       case EOpFunctionCall:
</span><span class="cx">         {
</span><span class="cx">             TString name = TFunction::unmangleName(node-&gt;getName());
</span><del>-            bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
-            TIntermSequence &amp;arguments = node-&gt;getSequence();
</del><ins>+            TIntermSequence *arguments = node-&gt;getSequence();
</ins><span class="cx"> 
</span><ins>+            bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
</ins><span class="cx">             if (node-&gt;isUserDefined())
</span><span class="cx">             {
</span><del>-                out &lt;&lt; decorate(name) &lt;&lt; (lod0 ? &quot;Lod0(&quot; : &quot;(&quot;);
</del><ins>+                if (node-&gt;isArray())
+                {
+                    UNIMPLEMENTED();
+                }
+                size_t index = mCallDag.findIndex(node);
+                ASSERT(index != CallDAG::InvalidIndex);
+                lod0 &amp;= mASTMetadataList[index].mNeedsLod0;
+
+                out &lt;&lt; Decorate(name) &lt;&lt; (lod0 ? &quot;Lod0(&quot; : &quot;(&quot;);
</ins><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                TBasicType samplerType = arguments[0]-&gt;getAsTyped()-&gt;getType().getBasicType();
</del><ins>+                TBasicType samplerType = (*arguments)[0]-&gt;getAsTyped()-&gt;getType().getBasicType();
</ins><span class="cx"> 
</span><span class="cx">                 TextureFunction textureFunction;
</span><span class="cx">                 textureFunction.sampler = samplerType;
</span><del>-                textureFunction.coords = arguments[1]-&gt;getAsTyped()-&gt;getNominalSize();
</del><ins>+                textureFunction.coords = (*arguments)[1]-&gt;getAsTyped()-&gt;getNominalSize();
</ins><span class="cx">                 textureFunction.method = TextureFunction::IMPLICIT;
</span><span class="cx">                 textureFunction.proj = false;
</span><span class="cx">                 textureFunction.offset = false;
</span><span class="lines">@@ -2570,9 +2176,9 @@
</span><span class="cx">                         mandatoryArgumentCount++;
</span><span class="cx">                     }
</span><span class="cx"> 
</span><del>-                    bool bias = (arguments.size() &gt; mandatoryArgumentCount);   // Bias argument is optional
</del><ins>+                    bool bias = (arguments-&gt;size() &gt; mandatoryArgumentCount);   // Bias argument is optional
</ins><span class="cx"> 
</span><del>-                    if (lod0 || mContext.shaderType == SH_VERTEX_SHADER)
</del><ins>+                    if (lod0 || mShaderType == GL_VERTEX_SHADER)
</ins><span class="cx">                     {
</span><span class="cx">                         if (bias)
</span><span class="cx">                         {
</span><span class="lines">@@ -2594,7 +2200,7 @@
</span><span class="cx">                 out &lt;&lt; textureFunction.name();
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            for (TIntermSequence::iterator arg = arguments.begin(); arg != arguments.end(); arg++)
</del><ins>+            for (TIntermSequence::iterator arg = arguments-&gt;begin(); arg != arguments-&gt;end(); arg++)
</ins><span class="cx">             {
</span><span class="cx">                 if (mOutputType == SH_HLSL11_OUTPUT &amp;&amp; IsSampler((*arg)-&gt;getAsTyped()-&gt;getBasicType()))
</span><span class="cx">                 {
</span><span class="lines">@@ -2605,7 +2211,7 @@
</span><span class="cx"> 
</span><span class="cx">                 (*arg)-&gt;traverse(this);
</span><span class="cx"> 
</span><del>-                if (arg &lt; arguments.end() - 1)
</del><ins>+                if (arg &lt; arguments-&gt;end() - 1)
</ins><span class="cx">                 {
</span><span class="cx">                     out &lt;&lt; &quot;, &quot;;
</span><span class="cx">                 }
</span><span class="lines">@@ -2616,86 +2222,36 @@
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">         break;
</span><del>-      case EOpParameters:       outputTriplet(visit, &quot;(&quot;, &quot;, &quot;, &quot;)\n{\n&quot;);             break;
-      case EOpConstructFloat:
-        addConstructor(node-&gt;getType(), &quot;vec1&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;vec1(&quot;, &quot;&quot;, &quot;)&quot;);
-        break;
-      case EOpConstructVec2:
-        addConstructor(node-&gt;getType(), &quot;vec2&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;vec2(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructVec3:
-        addConstructor(node-&gt;getType(), &quot;vec3&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;vec3(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructVec4:
-        addConstructor(node-&gt;getType(), &quot;vec4&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;vec4(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructBool:
-        addConstructor(node-&gt;getType(), &quot;bvec1&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;bvec1(&quot;, &quot;&quot;, &quot;)&quot;);
-        break;
-      case EOpConstructBVec2:
-        addConstructor(node-&gt;getType(), &quot;bvec2&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;bvec2(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructBVec3:
-        addConstructor(node-&gt;getType(), &quot;bvec3&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;bvec3(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructBVec4:
-        addConstructor(node-&gt;getType(), &quot;bvec4&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;bvec4(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructInt:
-        addConstructor(node-&gt;getType(), &quot;ivec1&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;ivec1(&quot;, &quot;&quot;, &quot;)&quot;);
-        break;
-      case EOpConstructIVec2:
-        addConstructor(node-&gt;getType(), &quot;ivec2&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;ivec2(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructIVec3:
-        addConstructor(node-&gt;getType(), &quot;ivec3&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;ivec3(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructIVec4:
-        addConstructor(node-&gt;getType(), &quot;ivec4&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;ivec4(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructUInt:
-        addConstructor(node-&gt;getType(), &quot;uvec1&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;uvec1(&quot;, &quot;&quot;, &quot;)&quot;);
-        break;
-      case EOpConstructUVec2:
-        addConstructor(node-&gt;getType(), &quot;uvec2&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;uvec2(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructUVec3:
-        addConstructor(node-&gt;getType(), &quot;uvec3&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;uvec3(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructUVec4:
-        addConstructor(node-&gt;getType(), &quot;uvec4&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;uvec4(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructMat2:
-        addConstructor(node-&gt;getType(), &quot;mat2&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;mat2(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructMat3:
-        addConstructor(node-&gt;getType(), &quot;mat3&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;mat3(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
-      case EOpConstructMat4: 
-        addConstructor(node-&gt;getType(), &quot;mat4&quot;, &amp;node-&gt;getSequence());
-        outputTriplet(visit, &quot;mat4(&quot;, &quot;, &quot;, &quot;)&quot;);
-        break;
</del><ins>+      case EOpParameters:       outputTriplet(visit, &quot;(&quot;, &quot;, &quot;, &quot;)\n{\n&quot;);                                break;
+      case EOpConstructFloat:   outputConstructor(visit, node-&gt;getType(), &quot;vec1&quot;, node-&gt;getSequence());  break;
+      case EOpConstructVec2:    outputConstructor(visit, node-&gt;getType(), &quot;vec2&quot;, node-&gt;getSequence());  break;
+      case EOpConstructVec3:    outputConstructor(visit, node-&gt;getType(), &quot;vec3&quot;, node-&gt;getSequence());  break;
+      case EOpConstructVec4:    outputConstructor(visit, node-&gt;getType(), &quot;vec4&quot;, node-&gt;getSequence());  break;
+      case EOpConstructBool:    outputConstructor(visit, node-&gt;getType(), &quot;bvec1&quot;, node-&gt;getSequence()); break;
+      case EOpConstructBVec2:   outputConstructor(visit, node-&gt;getType(), &quot;bvec2&quot;, node-&gt;getSequence()); break;
+      case EOpConstructBVec3:   outputConstructor(visit, node-&gt;getType(), &quot;bvec3&quot;, node-&gt;getSequence()); break;
+      case EOpConstructBVec4:   outputConstructor(visit, node-&gt;getType(), &quot;bvec4&quot;, node-&gt;getSequence()); break;
+      case EOpConstructInt:     outputConstructor(visit, node-&gt;getType(), &quot;ivec1&quot;, node-&gt;getSequence()); break;
+      case EOpConstructIVec2:   outputConstructor(visit, node-&gt;getType(), &quot;ivec2&quot;, node-&gt;getSequence()); break;
+      case EOpConstructIVec3:   outputConstructor(visit, node-&gt;getType(), &quot;ivec3&quot;, node-&gt;getSequence()); break;
+      case EOpConstructIVec4:   outputConstructor(visit, node-&gt;getType(), &quot;ivec4&quot;, node-&gt;getSequence()); break;
+      case EOpConstructUInt:    outputConstructor(visit, node-&gt;getType(), &quot;uvec1&quot;, node-&gt;getSequence()); break;
+      case EOpConstructUVec2:   outputConstructor(visit, node-&gt;getType(), &quot;uvec2&quot;, node-&gt;getSequence()); break;
+      case EOpConstructUVec3:   outputConstructor(visit, node-&gt;getType(), &quot;uvec3&quot;, node-&gt;getSequence()); break;
+      case EOpConstructUVec4:   outputConstructor(visit, node-&gt;getType(), &quot;uvec4&quot;, node-&gt;getSequence()); break;
+      case EOpConstructMat2:    outputConstructor(visit, node-&gt;getType(), &quot;mat2&quot;, node-&gt;getSequence());  break;
+      case EOpConstructMat3:    outputConstructor(visit, node-&gt;getType(), &quot;mat3&quot;, node-&gt;getSequence());  break;
+      case EOpConstructMat4:    outputConstructor(visit, node-&gt;getType(), &quot;mat4&quot;, node-&gt;getSequence());  break;
</ins><span class="cx">       case EOpConstructStruct:
</span><del>-        addConstructor(node-&gt;getType(), scopedStruct(node-&gt;getType().getStruct()-&gt;name()), &amp;node-&gt;getSequence());
-        outputTriplet(visit, structLookup(node-&gt;getType().getStruct()-&gt;name()) + &quot;_ctor(&quot;, &quot;, &quot;, &quot;)&quot;);
</del><ins>+        {
+            if (node-&gt;getType().isArray())
+            {
+                UNIMPLEMENTED();
+            }
+            const TString &amp;structName = StructNameString(*node-&gt;getType().getStruct());
+            mStructureHLSL-&gt;addConstructor(node-&gt;getType(), structName, node-&gt;getSequence());
+            outputTriplet(visit, (structName + &quot;_ctor(&quot;).c_str(), &quot;, &quot;, &quot;)&quot;);
+        }
</ins><span class="cx">         break;
</span><span class="cx">       case EOpLessThan:         outputTriplet(visit, &quot;(&quot;, &quot; &lt; &quot;, &quot;)&quot;);                 break;
</span><span class="cx">       case EOpGreaterThan:      outputTriplet(visit, &quot;(&quot;, &quot; &gt; &quot;, &quot;)&quot;);                 break;
</span><span class="lines">@@ -2704,37 +2260,15 @@
</span><span class="cx">       case EOpVectorEqual:      outputTriplet(visit, &quot;(&quot;, &quot; == &quot;, &quot;)&quot;);                break;
</span><span class="cx">       case EOpVectorNotEqual:   outputTriplet(visit, &quot;(&quot;, &quot; != &quot;, &quot;)&quot;);                break;
</span><span class="cx">       case EOpMod:
</span><del>-        {
-            // We need to look at the number of components in both arguments
-            const int modValue = node-&gt;getSequence()[0]-&gt;getAsTyped()-&gt;getNominalSize() * 10
-                               + node-&gt;getSequence()[1]-&gt;getAsTyped()-&gt;getNominalSize();
-            switch (modValue)
-            {
-              case 11: mUsesMod1 = true; break;
-              case 22: mUsesMod2v = true; break;
-              case 21: mUsesMod2f = true; break;
-              case 33: mUsesMod3v = true; break;
-              case 31: mUsesMod3f = true; break;
-              case 44: mUsesMod4v = true; break;
-              case 41: mUsesMod4f = true; break;
-              default: UNREACHABLE();
-            }
-
-            outputTriplet(visit, &quot;mod(&quot;, &quot;, &quot;, &quot;)&quot;);
-        }
</del><ins>+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;mod(&quot;);
</ins><span class="cx">         break;
</span><ins>+      case EOpModf:             outputTriplet(visit, &quot;modf(&quot;, &quot;, &quot;, &quot;)&quot;);              break;
</ins><span class="cx">       case EOpPow:              outputTriplet(visit, &quot;pow(&quot;, &quot;, &quot;, &quot;)&quot;);               break;
</span><span class="cx">       case EOpAtan:
</span><del>-        ASSERT(node-&gt;getSequence().size() == 2);   // atan(x) is a unary operator
-        switch (node-&gt;getSequence()[0]-&gt;getAsTyped()-&gt;getNominalSize())
-        {
-          case 1: mUsesAtan2_1 = true; break;
-          case 2: mUsesAtan2_2 = true; break;
-          case 3: mUsesAtan2_3 = true; break;
-          case 4: mUsesAtan2_4 = true; break;
-          default: UNREACHABLE();
-        }
-        outputTriplet(visit, &quot;atanyx(&quot;, &quot;, &quot;, &quot;)&quot;);
</del><ins>+        ASSERT(node-&gt;getSequence()-&gt;size() == 2);   // atan(x) is a unary operator
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;atan(&quot;);
</ins><span class="cx">         break;
</span><span class="cx">       case EOpMin:           outputTriplet(visit, &quot;min(&quot;, &quot;, &quot;, &quot;)&quot;);           break;
</span><span class="cx">       case EOpMax:           outputTriplet(visit, &quot;max(&quot;, &quot;, &quot;, &quot;)&quot;);           break;
</span><span class="lines">@@ -2746,21 +2280,15 @@
</span><span class="cx">       case EOpDot:           outputTriplet(visit, &quot;dot(&quot;, &quot;, &quot;, &quot;)&quot;);           break;
</span><span class="cx">       case EOpCross:         outputTriplet(visit, &quot;cross(&quot;, &quot;, &quot;, &quot;)&quot;);         break;
</span><span class="cx">       case EOpFaceForward:
</span><del>-        {
-            switch (node-&gt;getSequence()[0]-&gt;getAsTyped()-&gt;getNominalSize())   // Number of components in the first argument
-            {
-            case 1: mUsesFaceforward1 = true; break;
-            case 2: mUsesFaceforward2 = true; break;
-            case 3: mUsesFaceforward3 = true; break;
-            case 4: mUsesFaceforward4 = true; break;
-            default: UNREACHABLE();
-            }
-            
-            outputTriplet(visit, &quot;faceforward(&quot;, &quot;, &quot;, &quot;)&quot;);
-        }
</del><ins>+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;faceforward(&quot;);
</ins><span class="cx">         break;
</span><span class="cx">       case EOpReflect:       outputTriplet(visit, &quot;reflect(&quot;, &quot;, &quot;, &quot;)&quot;);       break;
</span><span class="cx">       case EOpRefract:       outputTriplet(visit, &quot;refract(&quot;, &quot;, &quot;, &quot;)&quot;);       break;
</span><ins>+      case EOpOuterProduct:
+        ASSERT(node-&gt;getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, &quot;outerProduct(&quot;);
+        break;
</ins><span class="cx">       case EOpMul:           outputTriplet(visit, &quot;(&quot;, &quot; * &quot;, &quot;)&quot;);             break;
</span><span class="cx">       default: UNREACHABLE();
</span><span class="cx">     }
</span><span class="lines">@@ -2770,7 +2298,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
</span><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mBody;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     if (node-&gt;usesTernaryOperator())
</span><span class="cx">     {
</span><span class="lines">@@ -2780,12 +2308,20 @@
</span><span class="cx">     {
</span><span class="cx">         mUnfoldShortCircuit-&gt;traverse(node-&gt;getCondition());
</span><span class="cx"> 
</span><ins>+        // D3D errors when there is a gradient operation in a loop in an unflattened if.
+        if (mShaderType == GL_FRAGMENT_SHADER
+            &amp;&amp; mCurrentFunctionMetadata-&gt;hasDiscontinuousLoop(node)
+            &amp;&amp; mCurrentFunctionMetadata-&gt;hasGradientInCallGraph(node))
+        {
+            out &lt;&lt; &quot;FLATTEN &quot;;
+        }
+
</ins><span class="cx">         out &lt;&lt; &quot;if (&quot;;
</span><span class="cx"> 
</span><span class="cx">         node-&gt;getCondition()-&gt;traverse(this);
</span><span class="cx"> 
</span><span class="cx">         out &lt;&lt; &quot;)\n&quot;;
</span><del>-        
</del><ins>+
</ins><span class="cx">         outputLineDirective(node-&gt;getLine().first_line);
</span><span class="cx">         out &lt;&lt; &quot;{\n&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -2829,6 +2365,37 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool OutputHLSL::visitSwitch(Visit visit, TIntermSwitch *node)
+{
+    if (node-&gt;getStatementList())
+    {
+        node-&gt;setStatementList(RemoveSwitchFallThrough::removeFallThrough(node-&gt;getStatementList()));
+        outputTriplet(visit, &quot;switch (&quot;, &quot;) &quot;, &quot;&quot;);
+        // The curly braces get written when visiting the statementList aggregate
+    }
+    else
+    {
+        // No statementList, so it won't output curly braces
+        outputTriplet(visit, &quot;switch (&quot;, &quot;) {&quot;, &quot;}\n&quot;);
+    }
+    return true;
+}
+
+bool OutputHLSL::visitCase(Visit visit, TIntermCase *node)
+{
+    if (node-&gt;hasCondition())
+    {
+        outputTriplet(visit, &quot;case (&quot;, &quot;&quot;, &quot;):\n&quot;);
+        return true;
+    }
+    else
+    {
+        TInfoSinkBase &amp;out = getInfoSink();
+        out &lt;&lt; &quot;default:\n&quot;;
+        return false;
+    }
+}
+
</ins><span class="cx"> void OutputHLSL::visitConstantUnion(TIntermConstantUnion *node)
</span><span class="cx"> {
</span><span class="cx">     writeConstantUnion(node-&gt;getType(), node-&gt;getUnionArrayPointer());
</span><span class="lines">@@ -2839,12 +2406,9 @@
</span><span class="cx">     mNestedLoopDepth++;
</span><span class="cx"> 
</span><span class="cx">     bool wasDiscontinuous = mInsideDiscontinuousLoop;
</span><ins>+    mInsideDiscontinuousLoop = mInsideDiscontinuousLoop ||
+    mCurrentFunctionMetadata-&gt;mDiscontinuousLoops.count(node) &gt; 0;
</ins><span class="cx"> 
</span><del>-    if (mContainsLoopDiscontinuity &amp;&amp; !mInsideDiscontinuousLoop)
-    {
-        mInsideDiscontinuousLoop = containsLoopDiscontinuity(node);
-    }
-
</del><span class="cx">     if (mOutputType == SH_HLSL9_OUTPUT)
</span><span class="cx">     {
</span><span class="cx">         if (handleExcessiveLoop(node))
</span><span class="lines">@@ -2856,19 +2420,20 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    TInfoSinkBase &amp;out = mBody;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><ins>+    const char *unroll = mCurrentFunctionMetadata-&gt;hasGradientInCallGraph(node) ? &quot;LOOP&quot; : &quot;&quot;;
</ins><span class="cx">     if (node-&gt;getType() == ELoopDoWhile)
</span><span class="cx">     {
</span><del>-        out &lt;&lt; &quot;{do\n&quot;;
</del><ins>+        out &lt;&lt; &quot;{&quot; &lt;&lt; unroll &lt;&lt; &quot; do\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">         outputLineDirective(node-&gt;getLine().first_line);
</span><span class="cx">         out &lt;&lt; &quot;{\n&quot;;
</span><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><del>-        out &lt;&lt; &quot;{for(&quot;;
-        
</del><ins>+        out &lt;&lt; &quot;{&quot; &lt;&lt; unroll &lt;&lt; &quot; for(&quot;;
+
</ins><span class="cx">         if (node-&gt;getInit())
</span><span class="cx">         {
</span><span class="cx">             node-&gt;getInit()-&gt;traverse(this);
</span><span class="lines">@@ -2889,7 +2454,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         out &lt;&lt; &quot;)\n&quot;;
</span><del>-        
</del><ins>+
</ins><span class="cx">         outputLineDirective(node-&gt;getLine().first_line);
</span><span class="cx">         out &lt;&lt; &quot;{\n&quot;;
</span><span class="cx">     }
</span><span class="lines">@@ -2922,7 +2487,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool OutputHLSL::visitBranch(Visit visit, TIntermBranch *node)
</span><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mBody;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     switch (node-&gt;getFlowOp())
</span><span class="cx">     {
</span><span class="lines">@@ -2996,9 +2561,15 @@
</span><span class="cx">         {
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><ins>+        else if (aggregate-&gt;getOp() == EOpDeclaration)
+        {
+            // Declaring multiple comma-separated variables must be considered multiple statements
+            // because each individual declaration has side effects which are visible in the next.
+            return false;
+        }
</ins><span class="cx">         else
</span><span class="cx">         {
</span><del>-            for (TIntermSequence::iterator sit = aggregate-&gt;getSequence().begin(); sit != aggregate-&gt;getSequence().end(); sit++)
</del><ins>+            for (TIntermSequence::iterator sit = aggregate-&gt;getSequence()-&gt;begin(); sit != aggregate-&gt;getSequence()-&gt;end(); sit++)
</ins><span class="cx">             {
</span><span class="cx">                 if (!isSingleStatement(*sit))
</span><span class="cx">                 {
</span><span class="lines">@@ -3018,7 +2589,7 @@
</span><span class="cx"> bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
</span><span class="cx"> {
</span><span class="cx">     const int MAX_LOOP_ITERATIONS = 254;
</span><del>-    TInfoSinkBase &amp;out = mBody;
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     // Parse loops of the form:
</span><span class="cx">     // for(int index = initial; index [comparator] limit; index += increment)
</span><span class="lines">@@ -3035,8 +2606,8 @@
</span><span class="cx"> 
</span><span class="cx">         if (init)
</span><span class="cx">         {
</span><del>-            TIntermSequence &amp;sequence = init-&gt;getSequence();
-            TIntermTyped *variable = sequence[0]-&gt;getAsTyped();
</del><ins>+            TIntermSequence *sequence = init-&gt;getSequence();
+            TIntermTyped *variable = (*sequence)[0]-&gt;getAsTyped();
</ins><span class="cx"> 
</span><span class="cx">             if (variable &amp;&amp; variable-&gt;getQualifier() == EvqTemporary)
</span><span class="cx">             {
</span><span class="lines">@@ -3064,7 +2635,7 @@
</span><span class="cx">     if (index != NULL &amp;&amp; node-&gt;getCondition())
</span><span class="cx">     {
</span><span class="cx">         TIntermBinary *test = node-&gt;getCondition()-&gt;getAsBinaryNode();
</span><del>-        
</del><ins>+
</ins><span class="cx">         if (test &amp;&amp; test-&gt;getLeft()-&gt;getAsSymbolNode()-&gt;getId() == index-&gt;getId())
</span><span class="cx">         {
</span><span class="cx">             TIntermConstantUnion *constant = test-&gt;getRight()-&gt;getAsConstantUnion();
</span><span class="lines">@@ -3085,7 +2656,7 @@
</span><span class="cx">     {
</span><span class="cx">         TIntermBinary *binaryTerminal = node-&gt;getExpression()-&gt;getAsBinaryNode();
</span><span class="cx">         TIntermUnary *unaryTerminal = node-&gt;getExpression()-&gt;getAsUnaryNode();
</span><del>-        
</del><ins>+
</ins><span class="cx">         if (binaryTerminal)
</span><span class="cx">         {
</span><span class="cx">             TOperator op = binaryTerminal-&gt;getOp();
</span><span class="lines">@@ -3165,10 +2736,11 @@
</span><span class="cx">                 {
</span><span class="cx">                     mExcessiveLoopIndex = NULL;   // Stops setting the Break flag
</span><span class="cx">                 }
</span><del>-                
</del><ins>+
</ins><span class="cx">                 // for(int index = initial; index &lt; clampedLimit; index += increment)
</span><ins>+                const char *unroll = mCurrentFunctionMetadata-&gt;hasGradientInCallGraph(node) ? &quot;LOOP&quot; : &quot;&quot;;
</ins><span class="cx"> 
</span><del>-                out &lt;&lt; &quot;for(&quot;;
</del><ins>+                out &lt;&lt; unroll &lt;&lt; &quot; for(&quot;;
</ins><span class="cx">                 index-&gt;traverse(this);
</span><span class="cx">                 out &lt;&lt; &quot; = &quot;;
</span><span class="cx">                 out &lt;&lt; initial;
</span><span class="lines">@@ -3183,7 +2755,7 @@
</span><span class="cx">                 out &lt;&lt; &quot; += &quot;;
</span><span class="cx">                 out &lt;&lt; increment;
</span><span class="cx">                 out &lt;&lt; &quot;)\n&quot;;
</span><del>-                
</del><ins>+
</ins><span class="cx">                 outputLineDirective(node-&gt;getLine().first_line);
</span><span class="cx">                 out &lt;&lt; &quot;{\n&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -3205,7 +2777,7 @@
</span><span class="cx">                 initial += MAX_LOOP_ITERATIONS * increment;
</span><span class="cx">                 iterations -= MAX_LOOP_ITERATIONS;
</span><span class="cx">             }
</span><del>-            
</del><ins>+
</ins><span class="cx">             out &lt;&lt; &quot;}&quot;;
</span><span class="cx"> 
</span><span class="cx">             mExcessiveLoopIndex = restoreIndex;
</span><span class="lines">@@ -3218,10 +2790,8 @@
</span><span class="cx">     return false;   // Not handled as an excessive loop
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void OutputHLSL::outputTriplet(Visit visit, const TString &amp;preString, const TString &amp;inString, const TString &amp;postString)
</del><ins>+void OutputHLSL::outputTriplet(Visit visit, const char *preString, const char *inString, const char *postString, TInfoSinkBase &amp;out)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mBody;
-
</del><span class="cx">     if (visit == PreVisit)
</span><span class="cx">     {
</span><span class="cx">         out &lt;&lt; preString;
</span><span class="lines">@@ -3236,19 +2806,26 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void OutputHLSL::outputTriplet(Visit visit, const char *preString, const char *inString, const char *postString)
+{
+    outputTriplet(visit, preString, inString, postString, getInfoSink());
+}
+
</ins><span class="cx"> void OutputHLSL::outputLineDirective(int line)
</span><span class="cx"> {
</span><del>-    if ((mContext.compileOptions &amp; SH_LINE_DIRECTIVES) &amp;&amp; (line &gt; 0))
</del><ins>+    if ((mCompileOptions &amp; SH_LINE_DIRECTIVES) &amp;&amp; (line &gt; 0))
</ins><span class="cx">     {
</span><del>-        mBody &lt;&lt; &quot;\n&quot;;
-        mBody &lt;&lt; &quot;#line &quot; &lt;&lt; line;
</del><ins>+        TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><del>-        if (mContext.sourcePath)
</del><ins>+        out &lt;&lt; &quot;\n&quot;;
+        out &lt;&lt; &quot;#line &quot; &lt;&lt; line;
+
+        if (mSourcePath)
</ins><span class="cx">         {
</span><del>-            mBody &lt;&lt; &quot; \&quot;&quot; &lt;&lt; mContext.sourcePath &lt;&lt; &quot;\&quot;&quot;;
</del><ins>+            out &lt;&lt; &quot; \&quot;&quot; &lt;&lt; mSourcePath &lt;&lt; &quot;\&quot;&quot;;
</ins><span class="cx">         }
</span><del>-        
-        mBody &lt;&lt; &quot;\n&quot;;
</del><ins>+
+        out &lt;&lt; &quot;\n&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3262,185 +2839,20 @@
</span><span class="cx">     {
</span><span class="cx">         name = &quot;x&quot; + str(mUniqueIndex++);
</span><span class="cx">     }
</span><del>-    else
</del><ins>+    else if (!symbol-&gt;isInternal())
</ins><span class="cx">     {
</span><del>-        name = decorate(name);
</del><ins>+        name = Decorate(name);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (mOutputType == SH_HLSL11_OUTPUT &amp;&amp; IsSampler(type.getBasicType()))
</span><span class="cx">     {
</span><del>-        return qualifierString(qualifier) + &quot; &quot; + textureString(type) + &quot; texture_&quot; + name + arrayString(type) + &quot;, &quot; +
-               qualifierString(qualifier) + &quot; &quot; + samplerString(type) + &quot; sampler_&quot; + name + arrayString(type);        
</del><ins>+        return QualifierString(qualifier) + &quot; &quot; + TextureString(type) + &quot; texture_&quot; + name + ArrayString(type) + &quot;, &quot; +
+               QualifierString(qualifier) + &quot; &quot; + SamplerString(type) + &quot; sampler_&quot; + name + ArrayString(type);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return qualifierString(qualifier) + &quot; &quot; + typeString(type) + &quot; &quot; + name + arrayString(type);
</del><ins>+    return QualifierString(qualifier) + &quot; &quot; + TypeString(type) + &quot; &quot; + name + ArrayString(type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString OutputHLSL::interpolationString(TQualifier qualifier)
-{
-    switch(qualifier)
-    {
-      case EvqVaryingIn:           return &quot;&quot;;
-      case EvqFragmentIn:          return &quot;&quot;;
-      case EvqInvariantVaryingIn:  return &quot;&quot;;
-      case EvqSmoothIn:            return &quot;linear&quot;;
-      case EvqFlatIn:              return &quot;nointerpolation&quot;;
-      case EvqCentroidIn:          return &quot;centroid&quot;;
-      case EvqVaryingOut:          return &quot;&quot;;
-      case EvqVertexOut:           return &quot;&quot;;
-      case EvqInvariantVaryingOut: return &quot;&quot;;
-      case EvqSmoothOut:           return &quot;linear&quot;;
-      case EvqFlatOut:             return &quot;nointerpolation&quot;;
-      case EvqCentroidOut:         return &quot;centroid&quot;;
-      default: UNREACHABLE();
-    }
-
-    return &quot;&quot;;
-}
-
-TString OutputHLSL::qualifierString(TQualifier qualifier)
-{
-    switch(qualifier)
-    {
-      case EvqIn:            return &quot;in&quot;;
-      case EvqOut:           return &quot;out&quot;;
-      case EvqInOut:         return &quot;inout&quot;;
-      case EvqConstReadOnly: return &quot;const&quot;;
-      default: UNREACHABLE();
-    }
-
-    return &quot;&quot;;
-}
-
-TString OutputHLSL::typeString(const TType &amp;type)
-{
-    const TStructure* structure = type.getStruct();
-    if (structure)
-    {
-        const TString&amp; typeName = structure-&gt;name();
-        if (typeName != &quot;&quot;)
-        {
-            return structLookup(typeName);
-        }
-        else   // Nameless structure, define in place
-        {
-            return structureString(*structure, false, false);
-        }
-    }
-    else if (type.isMatrix())
-    {
-        int cols = type.getCols();
-        int rows = type.getRows();
-        return &quot;float&quot; + str(cols) + &quot;x&quot; + str(rows);
-    }
-    else
-    {
-        switch (type.getBasicType())
-        {
-          case EbtFloat:
-            switch (type.getNominalSize())
-            {
-              case 1: return &quot;float&quot;;
-              case 2: return &quot;float2&quot;;
-              case 3: return &quot;float3&quot;;
-              case 4: return &quot;float4&quot;;
-            }
-          case EbtInt:
-            switch (type.getNominalSize())
-            {
-              case 1: return &quot;int&quot;;
-              case 2: return &quot;int2&quot;;
-              case 3: return &quot;int3&quot;;
-              case 4: return &quot;int4&quot;;
-            }
-          case EbtUInt:
-            switch (type.getNominalSize())
-            {
-              case 1: return &quot;uint&quot;;
-              case 2: return &quot;uint2&quot;;
-              case 3: return &quot;uint3&quot;;
-              case 4: return &quot;uint4&quot;;
-            }
-          case EbtBool:
-            switch (type.getNominalSize())
-            {
-              case 1: return &quot;bool&quot;;
-              case 2: return &quot;bool2&quot;;
-              case 3: return &quot;bool3&quot;;
-              case 4: return &quot;bool4&quot;;
-            }
-          case EbtVoid:
-            return &quot;void&quot;;
-          case EbtSampler2D:
-          case EbtISampler2D:
-          case EbtUSampler2D:
-          case EbtSampler2DArray:
-          case EbtISampler2DArray:
-          case EbtUSampler2DArray:
-            return &quot;sampler2D&quot;;
-          case EbtSamplerCube:
-          case EbtISamplerCube:
-          case EbtUSamplerCube:
-            return &quot;samplerCUBE&quot;;
-          case EbtSamplerExternalOES:
-            return &quot;sampler2D&quot;;
-          default:
-            break;
-        }
-    }
-
-    UNREACHABLE();
-    return &quot;&lt;unknown type&gt;&quot;;
-}
-
-TString OutputHLSL::textureString(const TType &amp;type)
-{
-    switch (type.getBasicType())
-    {
-      case EbtSampler2D:            return &quot;Texture2D&quot;;
-      case EbtSamplerCube:          return &quot;TextureCube&quot;;
-      case EbtSamplerExternalOES:   return &quot;Texture2D&quot;;
-      case EbtSampler2DArray:       return &quot;Texture2DArray&quot;;
-      case EbtSampler3D:            return &quot;Texture3D&quot;;
-      case EbtISampler2D:           return &quot;Texture2D&lt;int4&gt;&quot;;
-      case EbtISampler3D:           return &quot;Texture3D&lt;int4&gt;&quot;;
-      case EbtISamplerCube:         return &quot;Texture2DArray&lt;int4&gt;&quot;;
-      case EbtISampler2DArray:      return &quot;Texture2DArray&lt;int4&gt;&quot;;
-      case EbtUSampler2D:           return &quot;Texture2D&lt;uint4&gt;&quot;;
-      case EbtUSampler3D:           return &quot;Texture3D&lt;uint4&gt;&quot;;
-      case EbtUSamplerCube:         return &quot;Texture2DArray&lt;uint4&gt;&quot;;
-      case EbtUSampler2DArray:      return &quot;Texture2DArray&lt;uint4&gt;&quot;;
-      case EbtSampler2DShadow:      return &quot;Texture2D&quot;;
-      case EbtSamplerCubeShadow:    return &quot;TextureCube&quot;;
-      case EbtSampler2DArrayShadow: return &quot;Texture2DArray&quot;;
-      default: UNREACHABLE();
-    }
-    
-    return &quot;&lt;unknown texture type&gt;&quot;;
-}
-
-TString OutputHLSL::samplerString(const TType &amp;type)
-{
-    if (IsShadowSampler(type.getBasicType()))
-    {
-        return &quot;SamplerComparisonState&quot;;
-    }
-    else
-    {
-        return &quot;SamplerState&quot;;
-    }
-}
-
-TString OutputHLSL::arrayString(const TType &amp;type)
-{
-    if (!type.isArray())
-    {
-        return &quot;&quot;;
-    }
-
-    return &quot;[&quot; + str(type.getArraySize()) + &quot;]&quot;;
-}
-
</del><span class="cx"> TString OutputHLSL::initializer(const TType &amp;type)
</span><span class="cx"> {
</span><span class="cx">     TString string;
</span><span class="lines">@@ -3459,309 +2871,44 @@
</span><span class="cx">     return &quot;{&quot; + string + &quot;}&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString OutputHLSL::structureString(const TStructure &amp;structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
</del><ins>+void OutputHLSL::outputConstructor(Visit visit, const TType &amp;type, const char *name, const TIntermSequence *parameters)
</ins><span class="cx"> {
</span><del>-    const TFieldList &amp;fields = structure.fields();
-    const bool isNameless = (structure.name() == &quot;&quot;);
-    const TString &amp;structName = structureTypeName(structure, useHLSLRowMajorPacking, useStd140Packing);
-    const TString declareString = (isNameless ? &quot;struct&quot; : &quot;struct &quot; + structName);
-
-    TString string;
-    string += declareString + &quot;\n&quot;
-              &quot;{\n&quot;;
-
-    int elementIndex = 0;
-
-    for (unsigned int i = 0; i &lt; fields.size(); i++)
</del><ins>+    if (type.isArray())
</ins><span class="cx">     {
</span><del>-        const TField &amp;field = *fields[i];
-        const TType &amp;fieldType = *field.type();
-        const TStructure *fieldStruct = fieldType.getStruct();
-        const TString &amp;fieldTypeString = fieldStruct ? structureTypeName(*fieldStruct, useHLSLRowMajorPacking, useStd140Packing) : typeString(fieldType);
-
-        if (useStd140Packing)
-        {
-            string += std140PrePaddingString(*field.type(), &amp;elementIndex);
-        }
-
-        string += &quot;    &quot; + fieldTypeString + &quot; &quot; + decorateField(field.name(), structure) + arrayString(fieldType) + &quot;;\n&quot;;
-
-        if (useStd140Packing)
-        {
-            string += std140PostPaddingString(*field.type(), useHLSLRowMajorPacking);
-        }
</del><ins>+        UNIMPLEMENTED();
</ins><span class="cx">     }
</span><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><del>-    // Nameless structs do not finish with a semicolon and newline, to leave room for an instance variable
-    string += (isNameless ? &quot;} &quot; : &quot;};\n&quot;);
-
-    // Add remaining element index to the global map, for use with nested structs in standard layouts
-    if (useStd140Packing)
</del><ins>+    if (visit == PreVisit)
</ins><span class="cx">     {
</span><del>-        mStd140StructElementIndexes[structName] = elementIndex;
-    }
</del><ins>+        mStructureHLSL-&gt;addConstructor(type, name, parameters);
</ins><span class="cx"> 
</span><del>-    return string;
-}
-
-TString OutputHLSL::structureTypeName(const TStructure &amp;structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
-{
-    if (structure.name() == &quot;&quot;)
-    {
-        return &quot;&quot;;
</del><ins>+        out &lt;&lt; name &lt;&lt; &quot;(&quot;;
</ins><span class="cx">     }
</span><del>-
-    TString prefix = &quot;&quot;;
-
-    // Structs packed with row-major matrices in HLSL are prefixed with &quot;rm&quot;
-    // GLSL column-major maps to HLSL row-major, and the converse is true
-
-    if (useStd140Packing)
</del><ins>+    else if (visit == InVisit)
</ins><span class="cx">     {
</span><del>-        prefix += &quot;std&quot;;
</del><ins>+        out &lt;&lt; &quot;, &quot;;
</ins><span class="cx">     }
</span><del>-
-    if (useHLSLRowMajorPacking)
</del><ins>+    else if (visit == PostVisit)
</ins><span class="cx">     {
</span><del>-        if (prefix != &quot;&quot;) prefix += &quot;_&quot;;
-        prefix += &quot;rm&quot;;
</del><ins>+        out &lt;&lt; &quot;)&quot;;
</ins><span class="cx">     }
</span><del>-
-    return prefix + structLookup(structure.name());
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void OutputHLSL::addConstructor(const TType &amp;type, const TString &amp;name, const TIntermSequence *parameters)
</del><ins>+const TConstantUnion *OutputHLSL::writeConstantUnion(const TType &amp;type, const TConstantUnion *constUnion)
</ins><span class="cx"> {
</span><del>-    if (name == &quot;&quot;)
-    {
-        return;   // Nameless structures don't have constructors
-    }
</del><ins>+    TInfoSinkBase &amp;out = getInfoSink();
</ins><span class="cx"> 
</span><del>-    if (type.getStruct() &amp;&amp; mStructNames.find(decorate(name)) != mStructNames.end())
-    {
-        return;   // Already added
-    }
-
-    TType ctorType = type;
-    ctorType.clearArrayness();
-    ctorType.setPrecision(EbpHigh);
-    ctorType.setQualifier(EvqTemporary);
-
-    TString ctorName = type.getStruct() ? decorate(name) : name;
-
-    typedef std::vector&lt;TType&gt; ParameterArray;
-    ParameterArray ctorParameters;
-
</del><span class="cx">     const TStructure* structure = type.getStruct();
</span><span class="cx">     if (structure)
</span><span class="cx">     {
</span><del>-        mStructNames.insert(decorate(name));
</del><ins>+        out &lt;&lt; StructNameString(*structure) + &quot;_ctor(&quot;;
</ins><span class="cx"> 
</span><del>-        const TString &amp;structString = structureString(*structure, false, false);
-
-        if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structString) == mStructDeclarations.end())
-        {
-            // Add row-major packed struct for interface blocks
-            TString rowMajorString = &quot;#pragma pack_matrix(row_major)\n&quot; +
-                                     structureString(*structure, true, false) +
-                                     &quot;#pragma pack_matrix(column_major)\n&quot;;
-
-            TString std140String = structureString(*structure, false, true);
-            TString std140RowMajorString = &quot;#pragma pack_matrix(row_major)\n&quot; +
-                                           structureString(*structure, true, true) +
-                                           &quot;#pragma pack_matrix(column_major)\n&quot;;
-
-            mStructDeclarations.push_back(structString);
-            mStructDeclarations.push_back(rowMajorString);
-            mStructDeclarations.push_back(std140String);
-            mStructDeclarations.push_back(std140RowMajorString);
-        }
-
-        const TFieldList &amp;fields = structure-&gt;fields();
-        for (unsigned int i = 0; i &lt; fields.size(); i++)
-        {
-            ctorParameters.push_back(*fields[i]-&gt;type());
-        }
-    }
-    else if (parameters)
-    {
-        for (TIntermSequence::const_iterator parameter = parameters-&gt;begin(); parameter != parameters-&gt;end(); parameter++)
-        {
-            ctorParameters.push_back((*parameter)-&gt;getAsTyped()-&gt;getType());
-        }
-    }
-    else UNREACHABLE();
-
-    TString constructor;
-
-    if (ctorType.getStruct())
-    {
-        constructor += ctorName + &quot; &quot; + ctorName + &quot;_ctor(&quot;;
-    }
-    else   // Built-in type
-    {
-        constructor += typeString(ctorType) + &quot; &quot; + ctorName + &quot;(&quot;;
-    }
-
-    for (unsigned int parameter = 0; parameter &lt; ctorParameters.size(); parameter++)
-    {
-        const TType &amp;type = ctorParameters[parameter];
-
-        constructor += typeString(type) + &quot; x&quot; + str(parameter) + arrayString(type);
-
-        if (parameter &lt; ctorParameters.size() - 1)
-        {
-            constructor += &quot;, &quot;;
-        }
-    }
-
-    constructor += &quot;)\n&quot;
-                   &quot;{\n&quot;;
-
-    if (ctorType.getStruct())
-    {
-        constructor += &quot;    &quot; + ctorName + &quot; structure = {&quot;;
-    }
-    else
-    {
-        constructor += &quot;    return &quot; + typeString(ctorType) + &quot;(&quot;;
-    }
-
-    if (ctorType.isMatrix() &amp;&amp; ctorParameters.size() == 1)
-    {
-        int rows = ctorType.getRows();
-        int cols = ctorType.getCols();
-        const TType &amp;parameter = ctorParameters[0];
-
-        if (parameter.isScalar())
-        {
-            for (int row = 0; row &lt; rows; row++)
-            {
-                for (int col = 0; col &lt; cols; col++)
-                {
-                    constructor += TString((row == col) ? &quot;x0&quot; : &quot;0.0&quot;);
-                    
-                    if (row &lt; rows - 1 || col &lt; cols - 1)
-                    {
-                        constructor += &quot;, &quot;;
-                    }
-                }
-            }
-        }
-        else if (parameter.isMatrix())
-        {
-            for (int row = 0; row &lt; rows; row++)
-            {
-                for (int col = 0; col &lt; cols; col++)
-                {
-                    if (row &lt; parameter.getRows() &amp;&amp; col &lt; parameter.getCols())
-                    {
-                        constructor += TString(&quot;x0&quot;) + &quot;[&quot; + str(row) + &quot;]&quot; + &quot;[&quot; + str(col) + &quot;]&quot;;
-                    }
-                    else
-                    {
-                        constructor += TString((row == col) ? &quot;1.0&quot; : &quot;0.0&quot;);
-                    }
-
-                    if (row &lt; rows - 1 || col &lt; cols - 1)
-                    {
-                        constructor += &quot;, &quot;;
-                    }
-                }
-            }
-        }
-        else UNREACHABLE();
-    }
-    else
-    {
-        size_t remainingComponents = ctorType.getObjectSize();
-        size_t parameterIndex = 0;
-
-        while (remainingComponents &gt; 0)
-        {
-            const TType &amp;parameter = ctorParameters[parameterIndex];
-            const size_t parameterSize = parameter.getObjectSize();
-            bool moreParameters = parameterIndex + 1 &lt; ctorParameters.size();
-
-            constructor += &quot;x&quot; + str(parameterIndex);
-
-            if (parameter.isScalar())
-            {
-                remainingComponents -= parameter.getObjectSize();
-            }
-            else if (parameter.isVector())
-            {
-                if (remainingComponents == parameterSize || moreParameters)
-                {
-                    ASSERT(parameterSize &lt;= remainingComponents);
-                    remainingComponents -= parameterSize;
-                }
-                else if (remainingComponents &lt; static_cast&lt;size_t&gt;(parameter.getNominalSize()))
-                {
-                    switch (remainingComponents)
-                    {
-                      case 1: constructor += &quot;.x&quot;;    break;
-                      case 2: constructor += &quot;.xy&quot;;   break;
-                      case 3: constructor += &quot;.xyz&quot;;  break;
-                      case 4: constructor += &quot;.xyzw&quot;; break;
-                      default: UNREACHABLE();
-                    }
-
-                    remainingComponents = 0;
-                }
-                else UNREACHABLE();
-            }
-            else if (parameter.isMatrix() || parameter.getStruct())
-            {
-                ASSERT(remainingComponents == parameterSize || moreParameters);
-                ASSERT(parameterSize &lt;= remainingComponents);
-                
-                remainingComponents -= parameterSize;
-            }
-            else UNREACHABLE();
-
-            if (moreParameters)
-            {
-                parameterIndex++;
-            }
-
-            if (remainingComponents)
-            {
-                constructor += &quot;, &quot;;
-            }
-        }
-    }
-
-    if (ctorType.getStruct())
-    {
-        constructor += &quot;};\n&quot;
-                       &quot;    return structure;\n&quot;
-                       &quot;}\n&quot;;
-    }
-    else
-    {
-        constructor += &quot;);\n&quot;
-                       &quot;}\n&quot;;
-    }
-
-    mConstructors.insert(constructor);
-}
-
-const ConstantUnion *OutputHLSL::writeConstantUnion(const TType &amp;type, const ConstantUnion *constUnion)
-{
-    TInfoSinkBase &amp;out = mBody;
-
-    const TStructure* structure = type.getStruct();
-    if (structure)
-    {
-        out &lt;&lt; structLookup(structure-&gt;name()) + &quot;_ctor(&quot;;
-        
</del><span class="cx">         const TFieldList&amp; fields = structure-&gt;fields();
</span><span class="cx"> 
</span><span class="cx">         for (size_t i = 0; i &lt; fields.size(); i++)
</span><span class="cx">         {
</span><span class="cx">             const TType *fieldType = fields[i]-&gt;type();
</span><del>-
</del><span class="cx">             constUnion = writeConstantUnion(*fieldType, constUnion);
</span><span class="cx"> 
</span><span class="cx">             if (i != fields.size() - 1)
</span><span class="lines">@@ -3776,10 +2923,10 @@
</span><span class="cx">     {
</span><span class="cx">         size_t size = type.getObjectSize();
</span><span class="cx">         bool writeType = size &gt; 1;
</span><del>-        
</del><ins>+
</ins><span class="cx">         if (writeType)
</span><span class="cx">         {
</span><del>-            out &lt;&lt; typeString(type) &lt;&lt; &quot;(&quot;;
</del><ins>+            out &lt;&lt; TypeString(type) &lt;&lt; &quot;(&quot;;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         for (size_t i = 0; i &lt; size; i++, constUnion++)
</span><span class="lines">@@ -3808,418 +2955,260 @@
</span><span class="cx">     return constUnion;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString OutputHLSL::scopeString(unsigned int depthLimit)
</del><ins>+void OutputHLSL::writeEmulatedFunctionTriplet(Visit visit, const char *preStr)
</ins><span class="cx"> {
</span><del>-    TString string;
-
-    for (unsigned int i = 0; i &lt; mScopeBracket.size() &amp;&amp; i &lt; depthLimit; i++)
-    {
-        string += &quot;_&quot; + str(i);
-    }
-
-    return string;
</del><ins>+    TString preString = BuiltInFunctionEmulator::GetEmulatedFunctionName(preStr);
+    outputTriplet(visit, preString.c_str(), &quot;, &quot;, &quot;)&quot;);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString OutputHLSL::scopedStruct(const TString &amp;typeName)
</del><ins>+bool OutputHLSL::writeSameSymbolInitializer(TInfoSinkBase &amp;out, TIntermSymbol *symbolNode, TIntermTyped *expression)
</ins><span class="cx"> {
</span><del>-    if (typeName == &quot;&quot;)
</del><ins>+    sh::SearchSymbol searchSymbol(symbolNode-&gt;getSymbol());
+    expression-&gt;traverse(&amp;searchSymbol);
+
+    if (searchSymbol.foundMatch())
</ins><span class="cx">     {
</span><del>-        return typeName;
</del><ins>+        // Type already printed
+        out &lt;&lt; &quot;t&quot; + str(mUniqueIndex) + &quot; = &quot;;
+        expression-&gt;traverse(this);
+        out &lt;&lt; &quot;, &quot;;
+        symbolNode-&gt;traverse(this);
+        out &lt;&lt; &quot; = t&quot; + str(mUniqueIndex);
+
+        mUniqueIndex++;
+        return true;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return typeName + scopeString(mScopeDepth);
</del><ins>+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString OutputHLSL::structLookup(const TString &amp;typeName)
</del><ins>+void OutputHLSL::writeDeferredGlobalInitializers(TInfoSinkBase &amp;out)
</ins><span class="cx"> {
</span><del>-    for (int depth = mScopeDepth; depth &gt;= 0; depth--)
</del><ins>+    out &lt;&lt; &quot;#define ANGLE_USES_DEFERRED_INIT\n&quot;
+        &lt;&lt; &quot;\n&quot;
+        &lt;&lt; &quot;void initializeDeferredGlobals()\n&quot;
+        &lt;&lt; &quot;{\n&quot;;
+
+    for (const auto &amp;deferredGlobal : mDeferredGlobalInitializers)
</ins><span class="cx">     {
</span><del>-        TString scopedName = decorate(typeName + scopeString(depth));
</del><ins>+        TIntermSymbol *symbol = deferredGlobal.first;
+        TIntermTyped *expression = deferredGlobal.second;
+        ASSERT(symbol);
+        ASSERT(symbol-&gt;getQualifier() == EvqGlobal &amp;&amp; expression-&gt;getQualifier() != EvqConst);
</ins><span class="cx"> 
</span><del>-        for (StructNames::iterator structName = mStructNames.begin(); structName != mStructNames.end(); structName++)
</del><ins>+        out &lt;&lt; &quot;    &quot; &lt;&lt; Decorate(symbol-&gt;getSymbol()) &lt;&lt; &quot; = &quot;;
+
+        if (!writeSameSymbolInitializer(out, symbol, expression))
</ins><span class="cx">         {
</span><del>-            if (*structName == scopedName)
-            {
-                return scopedName;
-            }
</del><ins>+            ASSERT(mInfoSinkStack.top() == &amp;out);
+            expression-&gt;traverse(this);
</ins><span class="cx">         }
</span><ins>+
+        out &lt;&lt; &quot;;\n&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    UNREACHABLE();   // Should have found a matching constructor
-
-    return typeName;
</del><ins>+    out &lt;&lt; &quot;}\n&quot;
+        &lt;&lt; &quot;\n&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TString OutputHLSL::decorate(const TString &amp;string)
</del><ins>+TString OutputHLSL::addStructEqualityFunction(const TStructure &amp;structure)
</ins><span class="cx"> {
</span><del>-    if (string.compare(0, 3, &quot;gl_&quot;) != 0 &amp;&amp; string.compare(0, 3, &quot;dx_&quot;) != 0)
-    {
-        return &quot;_&quot; + string;
-    }
-    
-    return string;
-}
</del><ins>+    const TFieldList &amp;fields = structure.fields();
</ins><span class="cx"> 
</span><del>-TString OutputHLSL::decorateUniform(const TString &amp;string, const TType &amp;type)
-{
-    if (type.getBasicType() == EbtSamplerExternalOES)
</del><ins>+    for (const auto &amp;eqFunction : mStructEqualityFunctions)
</ins><span class="cx">     {
</span><del>-        return &quot;ex_&quot; + string;
</del><ins>+        if (eqFunction-&gt;structure == &amp;structure)
+        {
+            return eqFunction-&gt;functionName;
+        }
</ins><span class="cx">     }
</span><del>-    
-    return decorate(string);
-}
</del><span class="cx"> 
</span><del>-TString OutputHLSL::decorateField(const TString &amp;string, const TStructure &amp;structure)
-{
-    if (structure.name().compare(0, 3, &quot;gl_&quot;) != 0)
-    {
-        return decorate(string);
-    }
</del><ins>+    const TString &amp;structNameString = StructNameString(structure);
</ins><span class="cx"> 
</span><del>-    return string;
-}
</del><ins>+    StructEqualityFunction *function = new StructEqualityFunction();
+    function-&gt;structure = &amp;structure;
+    function-&gt;functionName = &quot;angle_eq_&quot; + structNameString;
</ins><span class="cx"> 
</span><del>-void OutputHLSL::declareInterfaceBlockField(const TType &amp;type, const TString &amp;name, std::vector&lt;gl::InterfaceBlockField&gt;&amp; output)
-{
-    const TStructure *structure = type.getStruct();
</del><ins>+    TInfoSinkBase fnOut;
</ins><span class="cx"> 
</span><del>-    if (!structure)
</del><ins>+    fnOut &lt;&lt; &quot;bool &quot; &lt;&lt; function-&gt;functionName &lt;&lt; &quot;(&quot; &lt;&lt; structNameString &lt;&lt; &quot; a, &quot; &lt;&lt; structNameString + &quot; b)\n&quot;
+          &lt;&lt; &quot;{\n&quot;
+             &quot;    return &quot;;
+
+    for (size_t i = 0; i &lt; fields.size(); i++)
</ins><span class="cx">     {
</span><del>-        const bool isRowMajorMatrix = (type.isMatrix() &amp;&amp; type.getLayoutQualifier().matrixPacking == EmpRowMajor);
-        gl::InterfaceBlockField field(glVariableType(type), glVariablePrecision(type), name.c_str(),
-                                      (unsigned int)type.getArraySize(), isRowMajorMatrix);
-        output.push_back(field);
-   }
-    else
-    {
-        gl::InterfaceBlockField structField(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(), false);
</del><ins>+        const TField *field = fields[i];
+        const TType *fieldType = field-&gt;type();
</ins><span class="cx"> 
</span><del>-        const TFieldList &amp;fields = structure-&gt;fields();
</del><ins>+        const TString &amp;fieldNameA = &quot;a.&quot; + Decorate(field-&gt;name());
+        const TString &amp;fieldNameB = &quot;b.&quot; + Decorate(field-&gt;name());
</ins><span class="cx"> 
</span><del>-        for (size_t fieldIndex = 0; fieldIndex &lt; fields.size(); fieldIndex++)
</del><ins>+        if (i &gt; 0)
</ins><span class="cx">         {
</span><del>-            TField *field = fields[fieldIndex];
-            TType *fieldType = field-&gt;type();
-
-            // make sure to copy matrix packing information
-            fieldType-&gt;setLayoutQualifier(type.getLayoutQualifier());
-
-            declareInterfaceBlockField(*fieldType, field-&gt;name(), structField.fields);
</del><ins>+            fnOut &lt;&lt; &quot; &amp;&amp; &quot;;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        output.push_back(structField);
</del><ins>+        fnOut &lt;&lt; &quot;(&quot;;
+        outputEqual(PreVisit, *fieldType, EOpEqual, fnOut);
+        fnOut &lt;&lt; fieldNameA;
+        outputEqual(InVisit, *fieldType, EOpEqual, fnOut);
+        fnOut &lt;&lt; fieldNameB;
+        outputEqual(PostVisit, *fieldType, EOpEqual, fnOut);
+        fnOut &lt;&lt; &quot;)&quot;;
</ins><span class="cx">     }
</span><ins>+
+    fnOut &lt;&lt; &quot;;\n&quot; &lt;&lt; &quot;}\n&quot;;
+
+    function-&gt;functionDefinition = fnOut.c_str();
+
+    mStructEqualityFunctions.push_back(function);
+    mEqualityFunctions.push_back(function);
+
+    return function-&gt;functionName;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-gl::Uniform OutputHLSL::declareUniformToList(const TType &amp;type, const TString &amp;name, int registerIndex, std::vector&lt;gl::Uniform&gt;&amp; output)
</del><ins>+TString OutputHLSL::addArrayEqualityFunction(const TType&amp; type)
</ins><span class="cx"> {
</span><del>-    const TStructure *structure = type.getStruct();
-
-    if (!structure)
</del><ins>+    for (const auto &amp;eqFunction : mArrayEqualityFunctions)
</ins><span class="cx">     {
</span><del>-        gl::Uniform uniform(glVariableType(type), glVariablePrecision(type), name.c_str(),
-                            (unsigned int)type.getArraySize(), (unsigned int)registerIndex, 0);
-        output.push_back(uniform);
</del><ins>+        if (eqFunction-&gt;type == type)
+        {
+            return eqFunction-&gt;functionName;
+        }
+    }
</ins><span class="cx"> 
</span><del>-        return uniform;
-   }
-    else
-    {
-        gl::Uniform structUniform(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(),
-                                  (unsigned int)registerIndex, GL_INVALID_INDEX);
</del><ins>+    const TString &amp;typeName = TypeString(type);
</ins><span class="cx"> 
</span><del>-        const TFieldList &amp;fields = structure-&gt;fields();
</del><ins>+    ArrayHelperFunction *function = new ArrayHelperFunction();
+    function-&gt;type = type;
</ins><span class="cx"> 
</span><del>-        for (size_t fieldIndex = 0; fieldIndex &lt; fields.size(); fieldIndex++)
-        {
-            TField *field = fields[fieldIndex];
-            TType *fieldType = field-&gt;type();
</del><ins>+    TInfoSinkBase fnNameOut;
+    fnNameOut &lt;&lt; &quot;angle_eq_&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;_&quot; &lt;&lt; typeName;
+    function-&gt;functionName = fnNameOut.c_str();
</ins><span class="cx"> 
</span><del>-            declareUniformToList(*fieldType, field-&gt;name(), GL_INVALID_INDEX, structUniform.fields);
-        }
</del><ins>+    TType nonArrayType = type;
+    nonArrayType.clearArrayness();
</ins><span class="cx"> 
</span><del>-        // assign register offset information -- this will override the information in any sub-structures.
-        HLSLVariableGetRegisterInfo(registerIndex, &amp;structUniform);
</del><ins>+    TInfoSinkBase fnOut;
</ins><span class="cx"> 
</span><del>-        output.push_back(structUniform);
</del><ins>+    fnOut &lt;&lt; &quot;bool &quot; &lt;&lt; function-&gt;functionName &lt;&lt; &quot;(&quot;
+          &lt;&lt; typeName &lt;&lt; &quot; a[&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;], &quot;
+          &lt;&lt; typeName &lt;&lt; &quot; b[&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;])\n&quot;
+          &lt;&lt; &quot;{\n&quot;
+             &quot;    for (int i = 0; i &lt; &quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;; ++i)\n&quot;
+             &quot;    {\n&quot;
+             &quot;        if (&quot;;
</ins><span class="cx"> 
</span><del>-        return structUniform;
-    }
-}
</del><ins>+    outputEqual(PreVisit, nonArrayType, EOpNotEqual, fnOut);
+    fnOut &lt;&lt; &quot;a[i]&quot;;
+    outputEqual(InVisit, nonArrayType, EOpNotEqual, fnOut);
+    fnOut &lt;&lt; &quot;b[i]&quot;;
+    outputEqual(PostVisit, nonArrayType, EOpNotEqual, fnOut);
</ins><span class="cx"> 
</span><del>-gl::InterpolationType getInterpolationType(TQualifier qualifier)
-{
-    switch (qualifier)
-    {
-      case EvqFlatIn:
-      case EvqFlatOut:
-        return gl::INTERPOLATION_FLAT;
</del><ins>+    fnOut &lt;&lt; &quot;) { return false; }\n&quot;
+             &quot;    }\n&quot;
+             &quot;    return true;\n&quot;
+             &quot;}\n&quot;;
</ins><span class="cx"> 
</span><del>-      case EvqSmoothIn:
-      case EvqSmoothOut:
-      case EvqVertexOut:
-      case EvqFragmentIn:
-      case EvqVaryingIn:
-      case EvqVaryingOut:
-        return gl::INTERPOLATION_SMOOTH;
</del><ins>+    function-&gt;functionDefinition = fnOut.c_str();
</ins><span class="cx"> 
</span><del>-      case EvqCentroidIn:
-      case EvqCentroidOut:
-        return gl::INTERPOLATION_CENTROID;
</del><ins>+    mArrayEqualityFunctions.push_back(function);
+    mEqualityFunctions.push_back(function);
</ins><span class="cx"> 
</span><del>-      default: UNREACHABLE();
-        return gl::INTERPOLATION_SMOOTH;
-    }
</del><ins>+    return function-&gt;functionName;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void OutputHLSL::declareVaryingToList(const TType &amp;type, TQualifier baseTypeQualifier, const TString &amp;name, std::vector&lt;gl::Varying&gt;&amp; fieldsOut)
</del><ins>+TString OutputHLSL::addArrayAssignmentFunction(const TType&amp; type)
</ins><span class="cx"> {
</span><del>-    const TStructure *structure = type.getStruct();
-
-    gl::InterpolationType interpolation = getInterpolationType(baseTypeQualifier);
-    if (!structure)
</del><ins>+    for (const auto &amp;assignFunction : mArrayAssignmentFunctions)
</ins><span class="cx">     {
</span><del>-        gl::Varying varying(glVariableType(type), glVariablePrecision(type), name.c_str(), (unsigned int)type.getArraySize(), interpolation);
-        fieldsOut.push_back(varying);
</del><ins>+        if (assignFunction.type == type)
+        {
+            return assignFunction.functionName;
+        }
</ins><span class="cx">     }
</span><del>-    else
-    {
-        gl::Varying structVarying(GL_STRUCT_ANGLEX, GL_NONE, name.c_str(), (unsigned int)type.getArraySize(), interpolation);
-        const TFieldList &amp;fields = structure-&gt;fields();
</del><span class="cx"> 
</span><del>-        structVarying.structName = structure-&gt;name().c_str();
</del><ins>+    const TString &amp;typeName = TypeString(type);
</ins><span class="cx"> 
</span><del>-        for (size_t fieldIndex = 0; fieldIndex &lt; fields.size(); fieldIndex++)
-        {
-            const TField &amp;field = *fields[fieldIndex];
-            declareVaryingToList(*field.type(), baseTypeQualifier, field.name(), structVarying.fields);
-        }
</del><ins>+    ArrayHelperFunction function;
+    function.type = type;
</ins><span class="cx"> 
</span><del>-        fieldsOut.push_back(structVarying);
-    }
-}
</del><ins>+    TInfoSinkBase fnNameOut;
+    fnNameOut &lt;&lt; &quot;angle_assign_&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;_&quot; &lt;&lt; typeName;
+    function.functionName = fnNameOut.c_str();
</ins><span class="cx"> 
</span><del>-int OutputHLSL::declareUniformAndAssignRegister(const TType &amp;type, const TString &amp;name)
-{
-    int registerIndex = (IsSampler(type.getBasicType()) ? mSamplerRegister : mUniformRegister);
</del><ins>+    TInfoSinkBase fnOut;
</ins><span class="cx"> 
</span><del>-    const gl::Uniform &amp;uniform = declareUniformToList(type, name, registerIndex, mActiveUniforms);
</del><ins>+    fnOut &lt;&lt; &quot;void &quot; &lt;&lt; function.functionName &lt;&lt; &quot;(out &quot;
+        &lt;&lt; typeName &lt;&lt; &quot; a[&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;], &quot;
+        &lt;&lt; typeName &lt;&lt; &quot; b[&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;])\n&quot;
+        &lt;&lt; &quot;{\n&quot;
+           &quot;    for (int i = 0; i &lt; &quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;; ++i)\n&quot;
+           &quot;    {\n&quot;
+           &quot;        a[i] = b[i];\n&quot;
+           &quot;    }\n&quot;
+           &quot;}\n&quot;;
</ins><span class="cx"> 
</span><del>-    if (IsSampler(type.getBasicType()))
-    {
-        mSamplerRegister += gl::HLSLVariableRegisterCount(uniform);
-    }
-    else
-    {
-        mUniformRegister += gl::HLSLVariableRegisterCount(uniform);
-    }
</del><ins>+    function.functionDefinition = fnOut.c_str();
</ins><span class="cx"> 
</span><del>-    return registerIndex;
</del><ins>+    mArrayAssignmentFunctions.push_back(function);
+
+    return function.functionName;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLenum OutputHLSL::glVariableType(const TType &amp;type)
</del><ins>+TString OutputHLSL::addArrayConstructIntoFunction(const TType&amp; type)
</ins><span class="cx"> {
</span><del>-    if (type.getBasicType() == EbtFloat)
</del><ins>+    for (const auto &amp;constructIntoFunction : mArrayConstructIntoFunctions)
</ins><span class="cx">     {
</span><del>-        if (type.isScalar())
</del><ins>+        if (constructIntoFunction.type == type)
</ins><span class="cx">         {
</span><del>-            return GL_FLOAT;
</del><ins>+            return constructIntoFunction.functionName;
</ins><span class="cx">         }
</span><del>-        else if (type.isVector())
-        {
-            switch(type.getNominalSize())
-            {
-              case 2: return GL_FLOAT_VEC2;
-              case 3: return GL_FLOAT_VEC3;
-              case 4: return GL_FLOAT_VEC4;
-              default: UNREACHABLE();
-            }
-        }
-        else if (type.isMatrix())
-        {
-            switch (type.getCols())
-            {
-              case 2:
-                switch(type.getRows())
-                {
-                  case 2: return GL_FLOAT_MAT2;
-                  case 3: return GL_FLOAT_MAT2x3;
-                  case 4: return GL_FLOAT_MAT2x4;
-                  default: UNREACHABLE();
-                }
</del><ins>+    }
</ins><span class="cx"> 
</span><del>-              case 3:
-                switch(type.getRows())
-                {
-                  case 2: return GL_FLOAT_MAT3x2;
-                  case 3: return GL_FLOAT_MAT3;
-                  case 4: return GL_FLOAT_MAT3x4;
-                  default: UNREACHABLE();
-                }
</del><ins>+    const TString &amp;typeName = TypeString(type);
</ins><span class="cx"> 
</span><del>-              case 4:
-                switch(type.getRows())
-                {
-                  case 2: return GL_FLOAT_MAT4x2;
-                  case 3: return GL_FLOAT_MAT4x3;
-                  case 4: return GL_FLOAT_MAT4;
-                  default: UNREACHABLE();
-                }
</del><ins>+    ArrayHelperFunction function;
+    function.type = type;
</ins><span class="cx"> 
</span><del>-              default: UNREACHABLE();
-            }
-        }
-        else UNREACHABLE();
-    }
-    else if (type.getBasicType() == EbtInt)
</del><ins>+    TInfoSinkBase fnNameOut;
+    fnNameOut &lt;&lt; &quot;angle_construct_into_&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;_&quot; &lt;&lt; typeName;
+    function.functionName = fnNameOut.c_str();
+
+    TInfoSinkBase fnOut;
+
+    fnOut &lt;&lt; &quot;void &quot; &lt;&lt; function.functionName &lt;&lt; &quot;(out &quot;
+          &lt;&lt; typeName &lt;&lt; &quot; a[&quot; &lt;&lt; type.getArraySize() &lt;&lt; &quot;]&quot;;
+    for (int i = 0; i &lt; type.getArraySize(); ++i)
</ins><span class="cx">     {
</span><del>-        if (type.isScalar())
-        {
-            return GL_INT;
-        }
-        else if (type.isVector())
-        {
-            switch(type.getNominalSize())
-            {
-              case 2: return GL_INT_VEC2;
-              case 3: return GL_INT_VEC3;
-              case 4: return GL_INT_VEC4;
-              default: UNREACHABLE();
-            }
-        }
-        else UNREACHABLE();
</del><ins>+        fnOut &lt;&lt; &quot;, &quot; &lt;&lt; typeName &lt;&lt; &quot; b&quot; &lt;&lt; i;
</ins><span class="cx">     }
</span><del>-    else if (type.getBasicType() == EbtUInt)
-    {
-        if (type.isScalar())
-        {
-            return GL_UNSIGNED_INT;
-        }
-        else if (type.isVector())
-        {
-            switch(type.getNominalSize())
-            {
-              case 2: return GL_UNSIGNED_INT_VEC2;
-              case 3: return GL_UNSIGNED_INT_VEC3;
-              case 4: return GL_UNSIGNED_INT_VEC4;
-              default: UNREACHABLE();
-            }
-        }
-        else UNREACHABLE();
-    }
-    else if (type.getBasicType() == EbtBool)
-    {
-        if (type.isScalar())
-        {
-            return GL_BOOL;
-        }
-        else if (type.isVector())
-        {
-            switch(type.getNominalSize())
-            {
-              case 2: return GL_BOOL_VEC2;
-              case 3: return GL_BOOL_VEC3;
-              case 4: return GL_BOOL_VEC4;
-              default: UNREACHABLE();
-            }
-        }
-        else UNREACHABLE();
-    }
</del><ins>+    fnOut &lt;&lt; &quot;)\n&quot;
+             &quot;{\n&quot;;
</ins><span class="cx"> 
</span><del>-    switch(type.getBasicType())
</del><ins>+    for (int i = 0; i &lt; type.getArraySize(); ++i)
</ins><span class="cx">     {
</span><del>-      case EbtSampler2D:            return GL_SAMPLER_2D;
-      case EbtSampler3D:            return GL_SAMPLER_3D;
-      case EbtSamplerCube:          return GL_SAMPLER_CUBE;
-      case EbtSampler2DArray:       return GL_SAMPLER_2D_ARRAY;
-      case EbtISampler2D:           return GL_INT_SAMPLER_2D;
-      case EbtISampler3D:           return GL_INT_SAMPLER_3D;
-      case EbtISamplerCube:         return GL_INT_SAMPLER_CUBE;
-      case EbtISampler2DArray:      return GL_INT_SAMPLER_2D_ARRAY;
-      case EbtUSampler2D:           return GL_UNSIGNED_INT_SAMPLER_2D;
-      case EbtUSampler3D:           return GL_UNSIGNED_INT_SAMPLER_3D;
-      case EbtUSamplerCube:         return GL_UNSIGNED_INT_SAMPLER_CUBE;
-      case EbtUSampler2DArray:      return GL_UNSIGNED_INT_SAMPLER_2D_ARRAY;
-      case EbtSampler2DShadow:      return GL_SAMPLER_2D_SHADOW;
-      case EbtSamplerCubeShadow:    return GL_SAMPLER_CUBE_SHADOW;
-      case EbtSampler2DArrayShadow: return GL_SAMPLER_2D_ARRAY_SHADOW;
-      default: UNREACHABLE();
</del><ins>+        fnOut &lt;&lt; &quot;    a[&quot; &lt;&lt; i &lt;&lt; &quot;] = b&quot; &lt;&lt; i &lt;&lt; &quot;;\n&quot;;
</ins><span class="cx">     }
</span><ins>+    fnOut &lt;&lt; &quot;}\n&quot;;
</ins><span class="cx"> 
</span><del>-    return GL_NONE;
-}
</del><ins>+    function.functionDefinition = fnOut.c_str();
</ins><span class="cx"> 
</span><del>-GLenum OutputHLSL::glVariablePrecision(const TType &amp;type)
-{
-    if (type.getBasicType() == EbtFloat)
-    {
-        switch (type.getPrecision())
-        {
-          case EbpHigh:   return GL_HIGH_FLOAT;
-          case EbpMedium: return GL_MEDIUM_FLOAT;
-          case EbpLow:    return GL_LOW_FLOAT;
-          case EbpUndefined:
-            // Should be defined as the default precision by the parser
-          default: UNREACHABLE();
-        }
-    }
-    else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
-    {
-        switch (type.getPrecision())
-        {
-          case EbpHigh:   return GL_HIGH_INT;
-          case EbpMedium: return GL_MEDIUM_INT;
-          case EbpLow:    return GL_LOW_INT;
-          case EbpUndefined:
-            // Should be defined as the default precision by the parser
-          default: UNREACHABLE();
-        }
-    }
</del><ins>+    mArrayConstructIntoFunctions.push_back(function);
</ins><span class="cx"> 
</span><del>-    // Other types (boolean, sampler) don't have a precision
-    return GL_NONE;
</del><ins>+    return function.functionName;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool OutputHLSL::isVaryingOut(TQualifier qualifier)
</del><ins>+void OutputHLSL::ensureStructDefined(const TType &amp;type)
</ins><span class="cx"> {
</span><del>-    switch(qualifier)
-    {
-      case EvqVaryingOut:
-      case EvqInvariantVaryingOut:
-      case EvqSmoothOut:
-      case EvqFlatOut:
-      case EvqCentroidOut:
-      case EvqVertexOut:
-        return true;
</del><ins>+    TStructure *structure = type.getStruct();
</ins><span class="cx"> 
</span><del>-      default: break;
</del><ins>+    if (structure)
+    {
+        mStructureHLSL-&gt;addConstructor(type, StructNameString(*structure), nullptr);
</ins><span class="cx">     }
</span><del>-
-    return false;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool OutputHLSL::isVaryingIn(TQualifier qualifier)
-{
-    switch(qualifier)
-    {
-      case EvqVaryingIn:
-      case EvqInvariantVaryingIn:
-      case EvqSmoothIn:
-      case EvqFlatIn:
-      case EvqCentroidIn:
-      case EvqFragmentIn:
-        return true;
</del><span class="cx"> 
</span><del>-      default: break;
-    }
</del><span class="cx"> 
</span><del>-    return false;
</del><span class="cx"> }
</span><del>-
-bool OutputHLSL::isVarying(TQualifier qualifier)
-{
-    return isVaryingIn(qualifier) || isVaryingOut(qualifier);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorOutputHLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/OutputHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,62 +4,61 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_OUTPUTHLSL_H_
-#define COMPILER_OUTPUTHLSL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_OUTPUTHLSL_H_
+#define COMPILER_TRANSLATOR_OUTPUTHLSL_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;list&gt;
</span><span class="cx"> #include &lt;set&gt;
</span><span class="cx"> #include &lt;map&gt;
</span><ins>+#include &lt;stack&gt;
</ins><span class="cx"> 
</span><del>-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;angle_gl.h&quot;
+#include &quot;compiler/translator/ASTMetadataHLSL.h&quot;
+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><del>-#include &quot;common/shadervars.h&quot;
</del><span class="cx"> 
</span><ins>+class BuiltInFunctionEmulator;
+
</ins><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="cx"> class UnfoldShortCircuit;
</span><ins>+class StructureHLSL;
+class UniformHLSL;
</ins><span class="cx"> 
</span><ins>+typedef std::map&lt;TString, TIntermSymbol*&gt; ReferencedSymbols;
+
</ins><span class="cx"> class OutputHLSL : public TIntermTraverser
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    OutputHLSL(TParseContext &amp;context, const ShBuiltInResources&amp; resources, ShShaderOutput outputType);
</del><ins>+    OutputHLSL(sh::GLenum shaderType, int shaderVersion,
+        const TExtensionBehavior &amp;extensionBehavior,
+        const char *sourcePath, ShShaderOutput outputType,
+        int numRenderTargets, const std::vector&lt;Uniform&gt; &amp;uniforms,
+        int compileOptions);
+
</ins><span class="cx">     ~OutputHLSL();
</span><span class="cx"> 
</span><del>-    void output();
</del><ins>+    void output(TIntermNode *treeRoot, TInfoSinkBase &amp;objSink);
</ins><span class="cx"> 
</span><del>-    TInfoSinkBase &amp;getBodyStream();
-    const std::vector&lt;gl::Uniform&gt; &amp;getUniforms();
-    const std::vector&lt;gl::InterfaceBlock&gt; &amp;getInterfaceBlocks() const;
-    const std::vector&lt;gl::Attribute&gt; &amp;getOutputVariables() const;
-    const std::vector&lt;gl::Attribute&gt; &amp;getAttributes() const;
-    const std::vector&lt;gl::Varying&gt; &amp;getVaryings() const;
</del><ins>+    const std::map&lt;std::string, unsigned int&gt; &amp;getInterfaceBlockRegisterMap() const;
+    const std::map&lt;std::string, unsigned int&gt; &amp;getUniformRegisterMap() const;
</ins><span class="cx"> 
</span><del>-    TString typeString(const TType &amp;type);
-    TString textureString(const TType &amp;type);
-    TString samplerString(const TType &amp;type);
-    TString interpolationString(TQualifier qualifier);
-    TString structureString(const TStructure &amp;structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
-    TString structureTypeName(const TStructure &amp;structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
-    static TString qualifierString(TQualifier qualifier);
-    static TString arrayString(const TType &amp;type);
</del><span class="cx">     static TString initializer(const TType &amp;type);
</span><del>-    static TString decorate(const TString &amp;string);                      // Prepends an underscore to avoid naming clashes
-    static TString decorateUniform(const TString &amp;string, const TType &amp;type);
-    static TString decorateField(const TString &amp;string, const TStructure &amp;structure);
</del><span class="cx"> 
</span><ins>+    TInfoSinkBase &amp;getInfoSink() { ASSERT(!mInfoSinkStack.empty()); return *mInfoSinkStack.top(); }
+
</ins><span class="cx">   protected:
</span><del>-    void header();
</del><ins>+    void header(const BuiltInFunctionEmulator *builtInFunctionEmulator);
</ins><span class="cx"> 
</span><span class="cx">     // Visit AST nodes and output their code to the body stream
</span><span class="cx">     void visitSymbol(TIntermSymbol*);
</span><ins>+    void visitRaw(TIntermRaw*);
</ins><span class="cx">     void visitConstantUnion(TIntermConstantUnion*);
</span><span class="cx">     bool visitBinary(Visit visit, TIntermBinary*);
</span><span class="cx">     bool visitUnary(Visit visit, TIntermUnary*);
</span><span class="cx">     bool visitSelection(Visit visit, TIntermSelection*);
</span><ins>+    bool visitSwitch(Visit visit, TIntermSwitch *);
+    bool visitCase(Visit visit, TIntermCase *);
</ins><span class="cx">     bool visitAggregate(Visit visit, TIntermAggregate*);
</span><span class="cx">     bool visitLoop(Visit visit, TIntermLoop*);
</span><span class="cx">     bool visitBranch(Visit visit, TIntermBranch*);
</span><span class="lines">@@ -67,20 +66,43 @@
</span><span class="cx">     void traverseStatements(TIntermNode *node);
</span><span class="cx">     bool isSingleStatement(TIntermNode *node);
</span><span class="cx">     bool handleExcessiveLoop(TIntermLoop *node);
</span><del>-    void outputTriplet(Visit visit, const TString &amp;preString, const TString &amp;inString, const TString &amp;postString);
</del><ins>+
+    // Emit one of three strings depending on traverse phase. Called with literal strings so using const char* instead of TString.
+    void outputTriplet(Visit visit, const char *preString, const char *inString, const char *postString, TInfoSinkBase &amp;out);
+    void outputTriplet(Visit visit, const char *preString, const char *inString, const char *postString);
</ins><span class="cx">     void outputLineDirective(int line);
</span><span class="cx">     TString argumentString(const TIntermSymbol *symbol);
</span><span class="cx">     int vectorSize(const TType &amp;type) const;
</span><span class="cx"> 
</span><del>-    void addConstructor(const TType &amp;type, const TString &amp;name, const TIntermSequence *parameters);
-    const ConstantUnion *writeConstantUnion(const TType &amp;type, const ConstantUnion *constUnion);
</del><ins>+    // Emit constructor. Called with literal names so using const char* instead of TString.
+    void outputConstructor(Visit visit, const TType &amp;type, const char *name, const TIntermSequence *parameters);
+    const TConstantUnion *writeConstantUnion(const TType &amp;type, const TConstantUnion *constUnion);
</ins><span class="cx"> 
</span><del>-    TString scopeString(unsigned int depthLimit);
-    TString scopedStruct(const TString &amp;typeName);
-    TString structLookup(const TString &amp;typeName);
</del><ins>+    void outputEqual(Visit visit, const TType &amp;type, TOperator op, TInfoSinkBase &amp;out);
</ins><span class="cx"> 
</span><del>-    TParseContext &amp;mContext;
</del><ins>+    void writeEmulatedFunctionTriplet(Visit visit, const char *preStr);
+    void makeFlaggedStructMaps(const std::vector&lt;TIntermTyped *&gt; &amp;flaggedStructs);
+
+    // Returns true if it found a 'same symbol' initializer (initializer that references the variable it's initting)
+    bool writeSameSymbolInitializer(TInfoSinkBase &amp;out, TIntermSymbol *symbolNode, TIntermTyped *expression);
+    void writeDeferredGlobalInitializers(TInfoSinkBase &amp;out);
+
+    // Returns the function name
+    TString addStructEqualityFunction(const TStructure &amp;structure);
+    TString addArrayEqualityFunction(const TType &amp;type);
+    TString addArrayAssignmentFunction(const TType &amp;type);
+    TString addArrayConstructIntoFunction(const TType &amp;type);
+
+    // Ensures if the type is a struct, the struct is defined
+    void ensureStructDefined(const TType &amp;type);
+
+    sh::GLenum mShaderType;
+    int mShaderVersion;
+    const TExtensionBehavior &amp;mExtensionBehavior;
+    const char *mSourcePath;
</ins><span class="cx">     const ShShaderOutput mOutputType;
</span><ins>+    int mCompileOptions;
+
</ins><span class="cx">     UnfoldShortCircuit *mUnfoldShortCircuit;
</span><span class="cx">     bool mInsideFunction;
</span><span class="cx"> 
</span><span class="lines">@@ -89,13 +111,20 @@
</span><span class="cx">     TInfoSinkBase mBody;
</span><span class="cx">     TInfoSinkBase mFooter;
</span><span class="cx"> 
</span><del>-    typedef std::map&lt;TString, TIntermSymbol*&gt; ReferencedSymbols;
</del><ins>+    // A stack is useful when we want to traverse in the header, or in helper functions, but not always
+    // write to the body. Instead use an InfoSink stack to keep our current state intact.
+    // TODO (jmadill): Just passing an InfoSink in function parameters would be simpler.
+    std::stack&lt;TInfoSinkBase *&gt; mInfoSinkStack;
+
</ins><span class="cx">     ReferencedSymbols mReferencedUniforms;
</span><span class="cx">     ReferencedSymbols mReferencedInterfaceBlocks;
</span><span class="cx">     ReferencedSymbols mReferencedAttributes;
</span><span class="cx">     ReferencedSymbols mReferencedVaryings;
</span><span class="cx">     ReferencedSymbols mReferencedOutputVariables;
</span><span class="cx"> 
</span><ins>+    StructureHLSL *mStructureHLSL;
+    UniformHLSL *mUniformHLSL;
+
</ins><span class="cx">     struct TextureFunction
</span><span class="cx">     {
</span><span class="cx">         enum Method
</span><span class="lines">@@ -132,95 +161,72 @@
</span><span class="cx">     bool mUsesPointCoord;
</span><span class="cx">     bool mUsesFrontFacing;
</span><span class="cx">     bool mUsesPointSize;
</span><ins>+    bool mUsesInstanceID;
</ins><span class="cx">     bool mUsesFragDepth;
</span><span class="cx">     bool mUsesXor;
</span><del>-    bool mUsesMod1;
-    bool mUsesMod2v;
-    bool mUsesMod2f;
-    bool mUsesMod3v;
-    bool mUsesMod3f;
-    bool mUsesMod4v;
-    bool mUsesMod4f;
-    bool mUsesFaceforward1;
-    bool mUsesFaceforward2;
-    bool mUsesFaceforward3;
-    bool mUsesFaceforward4;
-    bool mUsesAtan2_1;
-    bool mUsesAtan2_2;
-    bool mUsesAtan2_3;
-    bool mUsesAtan2_4;
</del><span class="cx">     bool mUsesDiscardRewriting;
</span><span class="cx">     bool mUsesNestedBreak;
</span><ins>+    bool mRequiresIEEEStrictCompiling;
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">     int mNumRenderTargets;
</span><span class="cx"> 
</span><del>-    typedef std::set&lt;TString&gt; Constructors;
-    Constructors mConstructors;
-
-    typedef std::set&lt;TString&gt; StructNames;
-    StructNames mStructNames;
-
-    typedef std::list&lt;TString&gt; StructDeclarations;
-    StructDeclarations mStructDeclarations;
-
-    typedef std::vector&lt;int&gt; ScopeBracket;
-    ScopeBracket mScopeBracket;
-    unsigned int mScopeDepth;
-
</del><span class="cx">     int mUniqueIndex;   // For creating unique names
</span><span class="cx"> 
</span><del>-    bool mContainsLoopDiscontinuity;
</del><ins>+    CallDAG mCallDag;
+    MetadataList mASTMetadataList;
+    ASTMetadataHLSL *mCurrentFunctionMetadata;
</ins><span class="cx">     bool mOutputLod0Function;
</span><span class="cx">     bool mInsideDiscontinuousLoop;
</span><span class="cx">     int mNestedLoopDepth;
</span><span class="cx"> 
</span><span class="cx">     TIntermSymbol *mExcessiveLoopIndex;
</span><span class="cx"> 
</span><del>-    int mUniformRegister;
-    int mInterfaceBlockRegister;
-    int mSamplerRegister;
-    int mPaddingCounter;
-
-    TString registerString(TIntermSymbol *operand);
-    int samplerRegister(TIntermSymbol *sampler);
-    int uniformRegister(TIntermSymbol *uniform);
-    void declareInterfaceBlockField(const TType &amp;type, const TString &amp;name, std::vector&lt;gl::InterfaceBlockField&gt;&amp; output);
-    gl::Uniform declareUniformToList(const TType &amp;type, const TString &amp;name, int registerIndex, std::vector&lt;gl::Uniform&gt;&amp; output);
-    void declareUniform(const TType &amp;type, const TString &amp;name, int index);
-    void declareVaryingToList(const TType &amp;type, TQualifier baseTypeQualifier, const TString &amp;name, std::vector&lt;gl::Varying&gt;&amp; fieldsOut);
-
-    // Returns the uniform's register index
-    int declareUniformAndAssignRegister(const TType &amp;type, const TString &amp;name);
-
-    TString interfaceBlockFieldString(const TInterfaceBlock &amp;interfaceBlock, const TField &amp;field);
-    TString decoratePrivate(const TString &amp;privateText);
-    TString interfaceBlockStructNameString(const TInterfaceBlock &amp;interfaceBlockType);
-    TString interfaceBlockInstanceString(const TInterfaceBlock&amp; interfaceBlock, unsigned int arrayIndex);
-    TString interfaceBlockFieldTypeString(const TField &amp;field, TLayoutBlockStorage blockStorage);
-    TString interfaceBlockFieldString(const TInterfaceBlock &amp;interfaceBlock, TLayoutBlockStorage blockStorage);
-    TString interfaceBlockStructString(const TInterfaceBlock &amp;interfaceBlock);
-    TString interfaceBlockString(const TInterfaceBlock &amp;interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex);
-    TString std140PrePaddingString(const TType &amp;type, int *elementIndex);
-    TString std140PostPaddingString(const TType &amp;type, bool useHLSLRowMajorPacking);
</del><span class="cx">     TString structInitializerString(int indent, const TStructure &amp;structure, const TString &amp;rhsStructName);
</span><del>-    
-    static GLenum glVariableType(const TType &amp;type);
-    static GLenum glVariablePrecision(const TType &amp;type);
-    static bool isVaryingIn(TQualifier qualifier);
-    static bool isVaryingOut(TQualifier qualifier);
-    static bool isVarying(TQualifier qualifier);
</del><span class="cx"> 
</span><del>-    std::vector&lt;gl::Uniform&gt; mActiveUniforms;
-    std::vector&lt;gl::InterfaceBlock&gt; mActiveInterfaceBlocks;
-    std::vector&lt;gl::Attribute&gt; mActiveOutputVariables;
-    std::vector&lt;gl::Attribute&gt; mActiveAttributes;
-    std::vector&lt;gl::Varying&gt; mActiveVaryings;
-    std::map&lt;TString, int&gt; mStd140StructElementIndexes;
</del><span class="cx">     std::map&lt;TIntermTyped*, TString&gt; mFlaggedStructMappedNames;
</span><span class="cx">     std::map&lt;TIntermTyped*, TString&gt; mFlaggedStructOriginalNames;
</span><span class="cx"> 
</span><del>-    void makeFlaggedStructMaps(const std::vector&lt;TIntermTyped *&gt; &amp;flaggedStructs);
</del><ins>+    // Some initializers use varyings, uniforms or attributes, thus we can't evaluate some variables
+    // at global static scope in HLSL. These variables depend on values which we retrieve from the
+    // shader input structure, which we set in the D3D main function. Instead, we can initialize
+    // these static globals after we initialize our other globals.
+    std::vector&lt;std::pair&lt;TIntermSymbol*, TIntermTyped*&gt;&gt; mDeferredGlobalInitializers;
+
+    struct HelperFunction
+    {
+        TString functionName;
+        TString functionDefinition;
+
+        virtual ~HelperFunction() {}
+    };
+
+    // A list of all equality comparison functions. It's important to preserve the order at
+    // which we add the functions, since nested structures call each other recursively, and
+    // structure equality functions may need to call array equality functions and vice versa.
+    // The ownership of the pointers is maintained by the type-specific arrays.
+    std::vector&lt;HelperFunction*&gt; mEqualityFunctions;
+
+    struct StructEqualityFunction : public HelperFunction
+    {
+        const TStructure *structure;
+    };
+    std::vector&lt;StructEqualityFunction*&gt; mStructEqualityFunctions;
+
+    struct ArrayHelperFunction : public HelperFunction
+    {
+        TType type;
+    };
+    std::vector&lt;ArrayHelperFunction*&gt; mArrayEqualityFunctions;
+
+    std::vector&lt;ArrayHelperFunction&gt; mArrayAssignmentFunctions;
+
+    // The construct-into functions are functions that fill an N-element array passed as an out parameter
+    // with the other N parameters of the function. This is used to work around that arrays can't be
+    // return values in HLSL.
+    std::vector&lt;ArrayHelperFunction&gt; mArrayConstructIntoFunctions;
</ins><span class="cx"> };
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif   // COMPILER_OUTPUTHLSL_H_
</del><ins>+#endif   // COMPILER_TRANSLATOR_OUTPUTHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorParseContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="lines">@@ -9,8 +9,9 @@
</span><span class="cx"> #include &lt;stdarg.h&gt;
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> 
</span><ins>+#include &quot;compiler/preprocessor/SourceLocation.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/glslang.h&quot;
</span><del>-#include &quot;compiler/preprocessor/SourceLocation.h&quot;
</del><ins>+#include &quot;compiler/translator/ValidateSwitch.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> ///////////////////////////////////////////////////////////////////////
</span><span class="cx"> //
</span><span class="lines">@@ -197,11 +198,6 @@
</span><span class="cx">                           srcLoc, reason, token, extraInfo);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TParseContext::trace(const char* str)
-{
-    diagnostics.writeDebug(str);
-}
-
</del><span class="cx"> //
</span><span class="cx"> // Same error message for all places assignments don't work.
</span><span class="cx"> //
</span><span class="lines">@@ -286,21 +282,21 @@
</span><span class="cx"> 
</span><span class="cx">                 TIntermTyped* rightNode = binaryNode-&gt;getRight();
</span><span class="cx">                 TIntermAggregate *aggrNode = rightNode-&gt;getAsAggregate();
</span><del>-                
-                for (TIntermSequence::iterator p = aggrNode-&gt;getSequence().begin(); 
-                                               p != aggrNode-&gt;getSequence().end(); p++) {
</del><ins>+
+                for (TIntermSequence::iterator p = aggrNode-&gt;getSequence()-&gt;begin();
+                                               p != aggrNode-&gt;getSequence()-&gt;end(); p++) {
</ins><span class="cx">                     int value = (*p)-&gt;getAsTyped()-&gt;getAsConstantUnion()-&gt;getIConst(0);
</span><del>-                    offset[value]++;     
</del><ins>+                    offset[value]++;
</ins><span class="cx">                     if (offset[value] &gt; 1) {
</span><span class="cx">                         error(line, &quot; l-value of swizzle cannot have duplicate components&quot;, op);
</span><span class="cx"> 
</span><span class="cx">                         return true;
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><del>-            } 
</del><ins>+            }
</ins><span class="cx"> 
</span><span class="cx">             return errorReturn;
</span><del>-        default: 
</del><ins>+        default:
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         error(line, &quot; l-value required&quot;, op);
</span><span class="lines">@@ -511,9 +507,17 @@
</span><span class="cx">     if (constType)
</span><span class="cx">         type-&gt;setQualifier(EvqConst);
</span><span class="cx"> 
</span><del>-    if (type-&gt;isArray() &amp;&amp; static_cast&lt;size_t&gt;(type-&gt;getArraySize()) != function.getParamCount()) {
-        error(line, &quot;array constructor needs one argument per array element&quot;, &quot;constructor&quot;);
-        return true;
</del><ins>+    if (type-&gt;isArray())
+    {
+        if (type-&gt;isUnsizedArray())
+        {
+            type-&gt;setArraySize(static_cast&lt;int&gt;(function.getParamCount()));
+        }
+        else if (static_cast&lt;size_t&gt;(type-&gt;getArraySize()) != function.getParamCount())
+        {
+            error(line, &quot;array constructor needs one argument per array element&quot;, &quot;constructor&quot;);
+            return true;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (arrayArg &amp;&amp; op != EOpConstructStruct) {
</span><span class="lines">@@ -567,12 +571,13 @@
</span><span class="cx"> //
</span><span class="cx"> // returns true in case of an error
</span><span class="cx"> //
</span><del>-bool TParseContext::voidErrorCheck(const TSourceLoc&amp; line, const TString&amp; identifier, const TPublicType&amp; pubType)
</del><ins>+bool TParseContext::voidErrorCheck(const TSourceLoc &amp;line, const TString &amp;identifier, const TBasicType &amp;type)
</ins><span class="cx"> {
</span><del>-    if (pubType.type == EbtVoid) {
</del><ins>+    if (type == EbtVoid)
+    {
</ins><span class="cx">         error(line, &quot;illegal use of type 'void'&quot;, identifier.c_str());
</span><span class="cx">         return true;
</span><del>-    } 
</del><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="lines">@@ -624,30 +629,6 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TParseContext::structQualifierErrorCheck(const TSourceLoc&amp; line, const TPublicType&amp; pType)
-{
-    switch (pType.qualifier)
-    {
-      case EvqVaryingIn:
-      case EvqVaryingOut:
-      case EvqAttribute:
-      case EvqVertexIn:
-      case EvqFragmentOut:
-        if (pType.type == EbtStruct)
-        {
-            error(line, &quot;cannot be used with a structure&quot;, getQualifierString(pType.qualifier));
-            return true;
-        }
-
-      default: break;
-    }
-
-    if (pType.qualifier != EvqUniform &amp;&amp; samplerErrorCheck(line, pType, &quot;samplers must be uniform&quot;))
-        return true;
-
-    return false;
-}
-
</del><span class="cx"> bool TParseContext::locationDeclaratorListCheck(const TSourceLoc&amp; line, const TPublicType &amp;pType)
</span><span class="cx"> {
</span><span class="cx">     if (pType.layoutQualifier.location != -1)
</span><span class="lines">@@ -695,36 +676,53 @@
</span><span class="cx"> {
</span><span class="cx">     TIntermConstantUnion* constant = expr-&gt;getAsConstantUnion();
</span><span class="cx"> 
</span><del>-    if (constant == 0 || !constant-&gt;isScalarInt())
</del><ins>+    if (constant == nullptr || !constant-&gt;isScalarInt())
</ins><span class="cx">     {
</span><span class="cx">         error(line, &quot;array size must be a constant integer expression&quot;, &quot;&quot;);
</span><ins>+        size = 1;
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    unsigned int unsignedSize = 0;
+
</ins><span class="cx">     if (constant-&gt;getBasicType() == EbtUInt)
</span><span class="cx">     {
</span><del>-        unsigned int uintSize = constant-&gt;getUConst(0);
-        if (uintSize &gt; static_cast&lt;unsigned int&gt;(std::numeric_limits&lt;int&gt;::max()))
-        {
-            error(line, &quot;array size too large&quot;, &quot;&quot;);
-            size = 1;
-            return true;
-        }
-
-        size = static_cast&lt;int&gt;(uintSize);
</del><ins>+        unsignedSize = constant-&gt;getUConst(0);
+        size = static_cast&lt;int&gt;(unsignedSize);
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="cx">         size = constant-&gt;getIConst(0);
</span><span class="cx"> 
</span><del>-        if (size &lt;= 0)
</del><ins>+        if (size &lt; 0)
</ins><span class="cx">         {
</span><del>-            error(line, &quot;array size must be a positive integer&quot;, &quot;&quot;);
</del><ins>+            error(line, &quot;array size must be non-negative&quot;, &quot;&quot;);
</ins><span class="cx">             size = 1;
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><ins>+
+        unsignedSize = static_cast&lt;unsigned int&gt;(size);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (size == 0)
+    {
+        error(line, &quot;array size must be greater than zero&quot;, &quot;&quot;);
+        size = 1;
+        return true;
+    }
+
+    // The size of arrays is restricted here to prevent issues further down the
+    // compiler/translator/driver stack. Shader Model 5 generation hardware is limited to
+    // 4096 registers so this should be reasonable even for aggressively optimizable code.
+    const unsigned int sizeLimit = 65536;
+
+    if (unsignedSize &gt; sizeLimit)
+    {
+        error(line, &quot;array size too large&quot;, &quot;&quot;);
+        size = 1;
+        return true;
+    }
+
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -733,9 +731,11 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns true if there is an error.
</span><span class="cx"> //
</span><del>-bool TParseContext::arrayQualifierErrorCheck(const TSourceLoc&amp; line, TPublicType type)
</del><ins>+bool TParseContext::arrayQualifierErrorCheck(const TSourceLoc &amp;line, const TPublicType &amp;type)
</ins><span class="cx"> {
</span><del>-    if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqVertexIn) || (type.qualifier == EvqConst)) {
</del><ins>+    if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqVertexIn) ||
+        (type.qualifier == EvqConst &amp;&amp; shaderVersion &lt; 300))
+    {
</ins><span class="cx">         error(line, &quot;cannot declare arrays of this qualifier&quot;, TType(type).getCompleteString().c_str());
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="lines">@@ -762,86 +762,22 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><del>-// Do all the semantic checking for declaring an array, with and 
-// without a size, and make the right changes to the symbol table.
-//
-// size == 0 means no specified size.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::arrayErrorCheck(const TSourceLoc&amp; line, const TString&amp; identifier, const TPublicType &amp;type, TVariable*&amp; variable)
-{
-    //
-    // Don't check for reserved word use until after we know it's not in the symbol table,
-    // because reserved arrays can be redeclared.
-    //
-
-    bool builtIn = false; 
-    bool sameScope = false;
-    TSymbol* symbol = symbolTable.find(identifier, 0, &amp;builtIn, &amp;sameScope);
-    if (symbol == 0 || !sameScope) {
-        if (reservedErrorCheck(line, identifier))
-            return true;
-        
-        variable = new TVariable(&amp;identifier, TType(type));
-
-        if (type.arraySize)
-            variable-&gt;getType().setArraySize(type.arraySize);
-
-        if (! symbolTable.declare(*variable)) {
-            delete variable;
-            error(line, &quot;INTERNAL ERROR inserting new symbol&quot;, identifier.c_str());
-            return true;
-        }
-    } else {
-        if (! symbol-&gt;isVariable()) {
-            error(line, &quot;variable expected&quot;, identifier.c_str());
-            return true;
-        }
-
-        variable = static_cast&lt;TVariable*&gt;(symbol);
-        if (! variable-&gt;getType().isArray()) {
-            error(line, &quot;redeclaring non-array as array&quot;, identifier.c_str());
-            return true;
-        }
-        if (variable-&gt;getType().getArraySize() &gt; 0) {
-            error(line, &quot;redeclaration of array with size&quot;, identifier.c_str());
-            return true;
-        }
-        
-        if (! variable-&gt;getType().sameElementType(TType(type))) {
-            error(line, &quot;redeclaration of array with a different type&quot;, identifier.c_str());
-            return true;
-        }
-
-        if (type.arraySize)
-            variable-&gt;getType().setArraySize(type.arraySize);
-    } 
-
-    if (voidErrorCheck(line, identifier, type))
-        return true;
-
-    return false;
-}
-
-//
</del><span class="cx"> // Enforce non-initializer type/qualifier rules.
</span><span class="cx"> //
</span><span class="cx"> // Returns true if there was an error.
</span><span class="cx"> //
</span><del>-bool TParseContext::nonInitConstErrorCheck(const TSourceLoc&amp; line, const TString&amp; identifier, TPublicType&amp; type, bool array)
</del><ins>+bool TParseContext::nonInitErrorCheck(const TSourceLoc &amp;line, const TString &amp;identifier, TPublicType *type)
</ins><span class="cx"> {
</span><del>-    if (type.qualifier == EvqConst)
</del><ins>+    ASSERT(type != nullptr);
+    if (type-&gt;qualifier == EvqConst)
</ins><span class="cx">     {
</span><span class="cx">         // Make the qualifier make sense.
</span><del>-        type.qualifier = EvqTemporary;
-        
-        if (array)
</del><ins>+        type-&gt;qualifier = EvqTemporary;
+
+        // Generate informative error messages for ESSL1.
+        // In ESSL3 arrays and structures containing arrays can be constant.
+        if (shaderVersion &lt; 300 &amp;&amp; type-&gt;isStructureContainingArrays())
</ins><span class="cx">         {
</span><del>-            error(line, &quot;arrays may not be declared constant since they cannot be initialized&quot;, identifier.c_str());
-        }
-        else if (type.isStructureContainingArrays())
-        {
</del><span class="cx">             error(line, &quot;structures containing arrays may not be declared constant since they cannot be initialized&quot;, identifier.c_str());
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="lines">@@ -851,34 +787,61 @@
</span><span class="cx"> 
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><del>-
</del><ins>+    if (type-&gt;isUnsizedArray())
+    {
+        error(line, &quot;implicitly sized arrays need to be initialized&quot;, identifier.c_str());
+        return true;
+    }
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-//
-// Do semantic checking for a variable declaration that has no initializer,
</del><ins>+// Do some simple checks that are shared between all variable declarations,
</ins><span class="cx"> // and update the symbol table.
</span><span class="cx"> //
</span><del>-// Returns true if there was an error.
</del><ins>+// Returns true if declaring the variable succeeded.
</ins><span class="cx"> //
</span><del>-bool TParseContext::nonInitErrorCheck(const TSourceLoc&amp; line, const TString&amp; identifier, const TPublicType&amp; type, TVariable*&amp; variable)
</del><ins>+bool TParseContext::declareVariable(const TSourceLoc &amp;line, const TString &amp;identifier, const TType &amp;type,
+                                    TVariable **variable)
</ins><span class="cx"> {
</span><del>-    if (reservedErrorCheck(line, identifier))
-        recover();
</del><ins>+    ASSERT((*variable) == nullptr);
</ins><span class="cx"> 
</span><del>-    variable = new TVariable(&amp;identifier, TType(type));
</del><ins>+    bool needsReservedErrorCheck = true;
</ins><span class="cx"> 
</span><del>-    if (! symbolTable.declare(*variable)) {
-        error(line, &quot;redefinition&quot;, variable-&gt;getName().c_str());
-        delete variable;
-        variable = 0;
-        return true;
</del><ins>+    // gl_LastFragData may be redeclared with a new precision qualifier
+    if (type.isArray() &amp;&amp; identifier.compare(0, 15, &quot;gl_LastFragData&quot;) == 0)
+    {
+        const TVariable *maxDrawBuffers =
+            static_cast&lt;const TVariable *&gt;(symbolTable.findBuiltIn(&quot;gl_MaxDrawBuffers&quot;, shaderVersion));
+        if (type.getArraySize() == maxDrawBuffers-&gt;getConstPointer()-&gt;getIConst())
+        {
+            if (TSymbol *builtInSymbol = symbolTable.findBuiltIn(identifier, shaderVersion))
+            {
+                needsReservedErrorCheck = extensionErrorCheck(line, builtInSymbol-&gt;getExtension());
+            }
+        }
+        else
+        {
+            error(line, &quot;redeclaration of gl_LastFragData with size != gl_MaxDrawBuffers&quot;, identifier.c_str());
+            return false;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (voidErrorCheck(line, identifier, type))
-        return true;
</del><ins>+    if (needsReservedErrorCheck &amp;&amp; reservedErrorCheck(line, identifier))
+        return false;
</ins><span class="cx"> 
</span><del>-    return false;
</del><ins>+    (*variable) = new TVariable(&amp;identifier, type);
+    if (!symbolTable.declare(*variable))
+    {
+        error(line, &quot;redefinition&quot;, identifier.c_str());
+        delete (*variable);
+        (*variable) = nullptr;
+        return false;
+    }
+
+    if (voidErrorCheck(line, identifier, type.getBasicType()))
+        return false;
+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool TParseContext::paramErrorCheck(const TSourceLoc&amp; line, TQualifier qualifier, TQualifier paramQualifier, TType* type)
</span><span class="lines">@@ -921,27 +884,53 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TParseContext::singleDeclarationErrorCheck(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier)
</del><ins>+// These checks are common for all declarations starting a declarator list, and declarators that follow an empty
+// declaration.
+//
+bool TParseContext::singleDeclarationErrorCheck(TPublicType &amp;publicType, const TSourceLoc &amp;identifierLocation)
</ins><span class="cx"> {
</span><del>-    if (structQualifierErrorCheck(identifierLocation, publicType))
</del><ins>+    switch (publicType.qualifier)
+    {
+      case EvqVaryingIn:
+      case EvqVaryingOut:
+      case EvqAttribute:
+      case EvqVertexIn:
+      case EvqFragmentOut:
+        if (publicType.type == EbtStruct)
+        {
+            error(identifierLocation, &quot;cannot be used with a structure&quot;,
+                  getQualifierString(publicType.qualifier));
+            return true;
+        }
+
+      default: break;
+    }
+
+    if (publicType.qualifier != EvqUniform &amp;&amp; samplerErrorCheck(identifierLocation, publicType,
+                                                                &quot;samplers must be uniform&quot;))
+    {
</ins><span class="cx">         return true;
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     // check for layout qualifier issues
</span><span class="cx">     const TLayoutQualifier layoutQualifier = publicType.layoutQualifier;
</span><span class="cx"> 
</span><span class="cx">     if (layoutQualifier.matrixPacking != EmpUnspecified)
</span><span class="cx">     {
</span><del>-        error(identifierLocation, &quot;layout qualifier&quot;, getMatrixPackingString(layoutQualifier.matrixPacking), &quot;only valid for interface blocks&quot;);
</del><ins>+        error(identifierLocation, &quot;layout qualifier&quot;, getMatrixPackingString(layoutQualifier.matrixPacking),
+              &quot;only valid for interface blocks&quot;);
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (layoutQualifier.blockStorage != EbsUnspecified)
</span><span class="cx">     {
</span><del>-        error(identifierLocation, &quot;layout qualifier&quot;, getBlockStorageString(layoutQualifier.blockStorage), &quot;only valid for interface blocks&quot;);
</del><ins>+        error(identifierLocation, &quot;layout qualifier&quot;, getBlockStorageString(layoutQualifier.blockStorage),
+              &quot;only valid for interface blocks&quot;);
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (publicType.qualifier != EvqVertexIn &amp;&amp; publicType.qualifier != EvqFragmentOut &amp;&amp; layoutLocationErrorCheck(identifierLocation, publicType.layoutQualifier))
</del><ins>+    if (publicType.qualifier != EvqVertexIn &amp;&amp; publicType.qualifier != EvqFragmentOut &amp;&amp;
+        layoutLocationErrorCheck(identifierLocation, publicType.layoutQualifier))
</ins><span class="cx">     {
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="lines">@@ -960,6 +949,26 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool TParseContext::functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *aggregate)
+{
+    for (size_t i = 0; i &lt; fnCandidate-&gt;getParamCount(); ++i)
+    {
+        TQualifier qual = fnCandidate-&gt;getParam(i).type-&gt;getQualifier();
+        if (qual == EvqOut || qual == EvqInOut)
+        {
+            TIntermTyped *node = (*(aggregate-&gt;getSequence()))[i]-&gt;getAsTyped();
+            if (lValueErrorCheck(node-&gt;getLine(), &quot;assign&quot;, node))
+            {
+                error(node-&gt;getLine(),
+                    &quot;Constant value cannot be passed for 'out' or 'inout' parameters.&quot;, &quot;Error&quot;);
+                recover();
+                return true;
+            }
+        }
+    }
+    return false;
+}
+
</ins><span class="cx"> bool TParseContext::supportsExtension(const char* extension)
</span><span class="cx"> {
</span><span class="cx">     const TExtensionBehavior&amp; extbehavior = extensionBehavior();
</span><span class="lines">@@ -988,12 +997,12 @@
</span><span class="cx">     directiveHandler.handleExtension(srcLoc, extName, behavior);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TParseContext::handlePragmaDirective(const TSourceLoc&amp; loc, const char* name, const char* value)
</del><ins>+void TParseContext::handlePragmaDirective(const TSourceLoc&amp; loc, const char* name, const char* value, bool stdgl)
</ins><span class="cx"> {
</span><span class="cx">     pp::SourceLocation srcLoc;
</span><span class="cx">     srcLoc.file = loc.first_file;
</span><span class="cx">     srcLoc.line = loc.first_line;
</span><del>-    directiveHandler.handlePragma(srcLoc, name, value);
</del><ins>+    directiveHandler.handlePragma(srcLoc, name, value, stdgl);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /////////////////////////////////////////////////////////////////////////////////
</span><span class="lines">@@ -1002,19 +1011,58 @@
</span><span class="cx"> //
</span><span class="cx"> /////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> 
</span><ins>+const TVariable *TParseContext::getNamedVariable(const TSourceLoc &amp;location,
+                                                 const TString *name,
+                                                 const TSymbol *symbol)
+{
+    const TVariable *variable = NULL;
+
+    if (!symbol)
+    {
+        error(location, &quot;undeclared identifier&quot;, name-&gt;c_str());
+        recover();
+    }
+    else if (!symbol-&gt;isVariable())
+    {
+        error(location, &quot;variable expected&quot;, name-&gt;c_str());
+        recover();
+    }
+    else
+    {
+        variable = static_cast&lt;const TVariable*&gt;(symbol);
+
+        if (symbolTable.findBuiltIn(variable-&gt;getName(), shaderVersion) &amp;&amp;
+            !variable-&gt;getExtension().empty() &amp;&amp;
+            extensionErrorCheck(location, variable-&gt;getExtension()))
+        {
+            recover();
+        }
+    }
+
+    if (!variable)
+    {
+        TType type(EbtFloat, EbpUndefined);
+        TVariable *fakeVariable = new TVariable(name, type);
+        symbolTable.declare(fakeVariable);
+        variable = fakeVariable;
+    }
+
+    return variable;
+}
+
</ins><span class="cx"> //
</span><span class="cx"> // Look up a function name in the symbol table, and make sure it is a function.
</span><span class="cx"> //
</span><span class="cx"> // Return the function symbol if found, otherwise 0.
</span><span class="cx"> //
</span><del>-const TFunction* TParseContext::findFunction(const TSourceLoc&amp; line, TFunction* call, int shaderVersion, bool *builtIn)
</del><ins>+const TFunction* TParseContext::findFunction(const TSourceLoc&amp; line, TFunction* call, int inputShaderVersion, bool *builtIn)
</ins><span class="cx"> {
</span><span class="cx">     // First find by unmangled name to check whether the function name has been
</span><span class="cx">     // hidden by a variable name or struct typename.
</span><span class="cx">     // If a function is found, check for one with a matching argument list.
</span><del>-    const TSymbol* symbol = symbolTable.find(call-&gt;getName(), shaderVersion, builtIn);
</del><ins>+    const TSymbol* symbol = symbolTable.find(call-&gt;getName(), inputShaderVersion, builtIn);
</ins><span class="cx">     if (symbol == 0 || symbol-&gt;isFunction()) {
</span><del>-        symbol = symbolTable.find(call-&gt;getMangledName(), shaderVersion, builtIn);
</del><ins>+        symbol = symbolTable.find(call-&gt;getMangledName(), inputShaderVersion, builtIn);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (symbol == 0) {
</span><span class="lines">@@ -1034,29 +1082,23 @@
</span><span class="cx"> // Initializers show up in several places in the grammar.  Have one set of
</span><span class="cx"> // code to handle them here.
</span><span class="cx"> //
</span><del>-bool TParseContext::executeInitializer(const TSourceLoc&amp; line, const TString&amp; identifier, TPublicType&amp; pType, 
-                                       TIntermTyped* initializer, TIntermNode*&amp; intermNode, TVariable* variable)
</del><ins>+// Returns true on error, false if no error
+//
+bool TParseContext::executeInitializer(const TSourceLoc &amp;line, const TString &amp;identifier, TPublicType &amp;pType,
+                                       TIntermTyped *initializer, TIntermNode **intermNode)
</ins><span class="cx"> {
</span><ins>+    ASSERT(intermNode != nullptr);
</ins><span class="cx">     TType type = TType(pType);
</span><span class="cx"> 
</span><del>-    if (variable == 0) {
-        if (reservedErrorCheck(line, identifier))
-            return true;
-
-        if (voidErrorCheck(line, identifier, pType))
-            return true;
-
-        //
-        // add variable to symbol table
-        //
-        variable = new TVariable(&amp;identifier, type);
-        if (! symbolTable.declare(*variable)) {
-            error(line, &quot;redefinition&quot;, variable-&gt;getName().c_str());
-            return true;
-            // don't delete variable, it's used by error recovery, and the pool 
-            // pop will take care of the memory
-        }
</del><ins>+    TVariable *variable = nullptr;
+    if (type.isUnsizedArray())
+    {
+        type.setArraySize(initializer-&gt;getArraySize());
</ins><span class="cx">     }
</span><ins>+    if (!declareVariable(line, identifier, type, &amp;variable))
+    {
+        return true;
+    }
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // identifier must be of type constant, a global, or a temporary
</span><span class="lines">@@ -1091,7 +1133,7 @@
</span><span class="cx">             const TSymbol* symbol = symbolTable.find(initializer-&gt;getAsSymbolNode()-&gt;getSymbol(), 0);
</span><span class="cx">             const TVariable* tVar = static_cast&lt;const TVariable*&gt;(symbol);
</span><span class="cx"> 
</span><del>-            ConstantUnion* constArray = tVar-&gt;getConstPointer();
</del><ins>+            TConstantUnion* constArray = tVar-&gt;getConstPointer();
</ins><span class="cx">             variable-&gt;shareConstPointer(constArray);
</span><span class="cx">         } else {
</span><span class="cx">             std::stringstream extraInfoStream;
</span><span class="lines">@@ -1102,16 +1144,22 @@
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>- 
-    if (qualifier != EvqConst) {
-        TIntermSymbol* intermSymbol = intermediate.addSymbol(variable-&gt;getUniqueId(), variable-&gt;getName(), variable-&gt;getType(), line);
-        intermNode = intermediate.addAssign(EOpInitialize, intermSymbol, initializer, line);
-        if (intermNode == 0) {
</del><ins>+
+    if (qualifier != EvqConst)
+    {
+        TIntermSymbol *intermSymbol = intermediate.addSymbol(variable-&gt;getUniqueId(), variable-&gt;getName(),
+                                                             variable-&gt;getType(), line);
+        *intermNode = createAssign(EOpInitialize, intermSymbol, initializer, line);
+        if (*intermNode == nullptr)
+        {
</ins><span class="cx">             assignError(line, &quot;=&quot;, intermSymbol-&gt;getCompleteString(), initializer-&gt;getCompleteString());
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><del>-    } else 
-        intermNode = 0;
</del><ins>+    }
+    else
+    {
+        *intermNode = nullptr;
+    }
</ins><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1126,8 +1174,8 @@
</span><span class="cx"> 
</span><span class="cx">     // check if all the child nodes are constants so that they can be inserted into 
</span><span class="cx">     // the parent node
</span><del>-    TIntermSequence &amp;sequence = aggrNode-&gt;getSequence() ;
-    for (TIntermSequence::iterator p = sequence.begin(); p != sequence.end(); ++p) {
</del><ins>+    TIntermSequence *sequence = aggrNode-&gt;getSequence() ;
+    for (TIntermSequence::iterator p = sequence-&gt;begin(); p != sequence-&gt;end(); ++p) {
</ins><span class="cx">         if (!(*p)-&gt;getAsTyped()-&gt;getAsConstantUnion())
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="lines">@@ -1145,7 +1193,7 @@
</span><span class="cx">     {
</span><span class="cx">         error(typeSpecifier.line, &quot;not supported&quot;, &quot;first-class array&quot;);
</span><span class="cx">         recover();
</span><del>-        returnType.setArray(false);
</del><ins>+        returnType.clearArrayness();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (shaderVersion &lt; 300)
</span><span class="lines">@@ -1203,41 +1251,45 @@
</span><span class="cx">     return returnType;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermAggregate* TParseContext::parseSingleDeclaration(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier)
</del><ins>+TIntermAggregate *TParseContext::parseSingleDeclaration(TPublicType &amp;publicType,
+                                                        const TSourceLoc &amp;identifierOrTypeLocation,
+                                                        const TString &amp;identifier)
</ins><span class="cx"> {
</span><del>-    TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
-    TIntermAggregate* aggregate = intermediate.makeAggregate(symbol, identifierLocation);
</del><ins>+    TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierOrTypeLocation);
</ins><span class="cx"> 
</span><del>-    if (identifier != &quot;&quot;)
</del><ins>+    mDeferredSingleDeclarationErrorCheck = (identifier == &quot;&quot;);
+
+    if (!mDeferredSingleDeclarationErrorCheck)
</ins><span class="cx">     {
</span><del>-        if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
</del><ins>+        if (singleDeclarationErrorCheck(publicType, identifierOrTypeLocation))
</ins><span class="cx">             recover();
</span><span class="cx"> 
</span><del>-        // this error check can mutate the type
-        if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, false))
</del><ins>+        if (nonInitErrorCheck(identifierOrTypeLocation, identifier, &amp;publicType))
</ins><span class="cx">             recover();
</span><span class="cx"> 
</span><del>-        TVariable* variable = 0;
-
-        if (nonInitErrorCheck(identifierLocation, identifier, publicType, variable))
</del><ins>+        TVariable *variable = nullptr;
+        if (!declareVariable(identifierOrTypeLocation, identifier, TType(publicType), &amp;variable))
</ins><span class="cx">             recover();
</span><span class="cx"> 
</span><span class="cx">         if (variable &amp;&amp; symbol)
</span><del>-        {
</del><span class="cx">             symbol-&gt;setId(variable-&gt;getUniqueId());
</span><del>-        }
</del><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return aggregate;
</del><ins>+    return intermediate.makeAggregate(symbol, identifierOrTypeLocation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermAggregate* TParseContext::parseSingleArrayDeclaration(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; indexLocation, TIntermTyped *indexExpression)
</del><ins>+TIntermAggregate *TParseContext::parseSingleArrayDeclaration(TPublicType &amp;publicType,
+                                                             const TSourceLoc &amp;identifierLocation,
+                                                             const TString &amp;identifier,
+                                                             const TSourceLoc &amp;indexLocation,
+                                                             TIntermTyped *indexExpression)
</ins><span class="cx"> {
</span><del>-    if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
</del><ins>+    mDeferredSingleDeclarationErrorCheck = false;
+
+    if (singleDeclarationErrorCheck(publicType, identifierLocation))
</ins><span class="cx">         recover();
</span><span class="cx"> 
</span><del>-    // this error check can mutate the type
-    if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, true))
</del><ins>+    if (nonInitErrorCheck(identifierLocation, identifier, &amp;publicType))
</ins><span class="cx">         recover();
</span><span class="cx"> 
</span><span class="cx">     if (arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
</span><span class="lines">@@ -1245,154 +1297,303 @@
</span><span class="cx">         recover();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    TPublicType arrayType = publicType;
</del><ins>+    TType arrayType(publicType);
</ins><span class="cx"> 
</span><span class="cx">     int size;
</span><span class="cx">     if (arraySizeErrorCheck(identifierLocation, indexExpression, size))
</span><span class="cx">     {
</span><span class="cx">         recover();
</span><span class="cx">     }
</span><del>-    else
-    {
-        arrayType.setArray(true, size);
-    }
</del><ins>+    // Make the type an array even if size check failed.
+    // This ensures useless error messages regarding the variable's non-arrayness won't follow.
+    arrayType.setArraySize(size);
</ins><span class="cx"> 
</span><del>-    TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(arrayType), identifierLocation);
-    TIntermAggregate* aggregate = intermediate.makeAggregate(symbol, identifierLocation);
-    TVariable* variable = 0;
-
-    if (arrayErrorCheck(identifierLocation, identifier, arrayType, variable))
</del><ins>+    TVariable *variable = nullptr;
+    if (!declareVariable(identifierLocation, identifier, arrayType, &amp;variable))
</ins><span class="cx">         recover();
</span><span class="cx"> 
</span><ins>+    TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, arrayType, identifierLocation);
</ins><span class="cx">     if (variable &amp;&amp; symbol)
</span><del>-    {
</del><span class="cx">         symbol-&gt;setId(variable-&gt;getUniqueId());
</span><del>-    }
</del><span class="cx"> 
</span><del>-    return aggregate;
</del><ins>+    return intermediate.makeAggregate(symbol, identifierLocation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermAggregate* TParseContext::parseSingleInitDeclaration(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; initLocation, TIntermTyped *initializer)
</del><ins>+TIntermAggregate *TParseContext::parseSingleInitDeclaration(TPublicType &amp;publicType,
+                                                            const TSourceLoc &amp;identifierLocation,
+                                                            const TString &amp;identifier,
+                                                            const TSourceLoc &amp;initLocation,
+                                                            TIntermTyped *initializer)
</ins><span class="cx"> {
</span><del>-    if (singleDeclarationErrorCheck(publicType, identifierLocation, identifier))
</del><ins>+    mDeferredSingleDeclarationErrorCheck = false;
+
+    if (singleDeclarationErrorCheck(publicType, identifierLocation))
</ins><span class="cx">         recover();
</span><span class="cx"> 
</span><del>-    TIntermNode* intermNode;
-    if (!executeInitializer(identifierLocation, identifier, publicType, initializer, intermNode))
</del><ins>+    TIntermNode *intermNode = nullptr;
+    if (!executeInitializer(identifierLocation, identifier, publicType, initializer, &amp;intermNode))
</ins><span class="cx">     {
</span><span class="cx">         //
</span><span class="cx">         // Build intermediate representation
</span><span class="cx">         //
</span><del>-        return intermNode ? intermediate.makeAggregate(intermNode, initLocation) : NULL;
</del><ins>+        return intermNode ? intermediate.makeAggregate(intermNode, initLocation) : nullptr;
</ins><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="cx">         recover();
</span><del>-        return NULL;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermAggregate* TParseContext::parseDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier)
</del><ins>+TIntermAggregate *TParseContext::parseSingleArrayInitDeclaration(TPublicType &amp;publicType,
+                                                                 const TSourceLoc &amp;identifierLocation,
+                                                                 const TString &amp;identifier,
+                                                                 const TSourceLoc &amp;indexLocation,
+                                                                 TIntermTyped *indexExpression,
+                                                                 const TSourceLoc &amp;initLocation,
+                                                                 TIntermTyped *initializer)
</ins><span class="cx"> {
</span><del>-    if (publicType.type == EbtInvariant &amp;&amp; !identifierSymbol)
</del><ins>+    mDeferredSingleDeclarationErrorCheck = false;
+
+    if (singleDeclarationErrorCheck(publicType, identifierLocation))
+        recover();
+
+    if (arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
</ins><span class="cx">     {
</span><del>-        error(identifierLocation, &quot;undeclared identifier declared as invariant&quot;, identifier.c_str());
</del><span class="cx">         recover();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    TIntermSymbol* symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
-    TIntermAggregate* intermAggregate = intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
</del><ins>+    TPublicType arrayType(publicType);
</ins><span class="cx"> 
</span><del>-    if (structQualifierErrorCheck(identifierLocation, publicType))
</del><ins>+    int size = 0;
+    // If indexExpression is nullptr, then the array will eventually get its size implicitly from the initializer.
+    if (indexExpression != nullptr &amp;&amp; arraySizeErrorCheck(identifierLocation, indexExpression, size))
+    {
</ins><span class="cx">         recover();
</span><ins>+    }
+    // Make the type an array even if size check failed.
+    // This ensures useless error messages regarding the variable's non-arrayness won't follow.
+    arrayType.setArraySize(size);
</ins><span class="cx"> 
</span><ins>+    // initNode will correspond to the whole of &quot;type b[n] = initializer&quot;.
+    TIntermNode *initNode = nullptr;
+    if (!executeInitializer(identifierLocation, identifier, arrayType, initializer, &amp;initNode))
+    {
+        return initNode ? intermediate.makeAggregate(initNode, initLocation) : nullptr;
+    }
+    else
+    {
+        recover();
+        return nullptr;
+    }
+}
+
+TIntermAggregate *TParseContext::parseInvariantDeclaration(const TSourceLoc &amp;invariantLoc,
+                                                           const TSourceLoc &amp;identifierLoc,
+                                                           const TString *identifier,
+                                                           const TSymbol *symbol)
+{
+    // invariant declaration
+    if (globalErrorCheck(invariantLoc, symbolTable.atGlobalLevel(), &quot;invariant varying&quot;))
+    {
+        recover();
+    }
+
+    if (!symbol)
+    {
+        error(identifierLoc, &quot;undeclared identifier declared as invariant&quot;, identifier-&gt;c_str());
+        recover();
+        return nullptr;
+    }
+    else
+    {
+        const TString kGlFrontFacing(&quot;gl_FrontFacing&quot;);
+        if (*identifier == kGlFrontFacing)
+        {
+            error(identifierLoc, &quot;identifier should not be declared as invariant&quot;, identifier-&gt;c_str());
+            recover();
+            return nullptr;
+        }
+        symbolTable.addInvariantVarying(std::string(identifier-&gt;c_str()));
+        const TVariable *variable = getNamedVariable(identifierLoc, identifier, symbol);
+        ASSERT(variable);
+        const TType &amp;type = variable-&gt;getType();
+        TIntermSymbol *intermSymbol = intermediate.addSymbol(variable-&gt;getUniqueId(),
+                                                             *identifier, type, identifierLoc);
+
+        TIntermAggregate *aggregate = intermediate.makeAggregate(intermSymbol, identifierLoc);
+        aggregate-&gt;setOp(EOpInvariantDeclaration);
+        return aggregate;
+    }
+}
+
+TIntermAggregate *TParseContext::parseDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration,
+                                                 const TSourceLoc &amp;identifierLocation, const TString &amp;identifier)
+{
+    // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
+    if (mDeferredSingleDeclarationErrorCheck)
+    {
+        if (singleDeclarationErrorCheck(publicType, identifierLocation))
+            recover();
+        mDeferredSingleDeclarationErrorCheck = false;
+    }
+
</ins><span class="cx">     if (locationDeclaratorListCheck(identifierLocation, publicType))
</span><span class="cx">         recover();
</span><span class="cx"> 
</span><del>-    if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, false))
</del><ins>+    if (nonInitErrorCheck(identifierLocation, identifier, &amp;publicType))
</ins><span class="cx">         recover();
</span><span class="cx"> 
</span><del>-    TVariable* variable = 0;
-    if (nonInitErrorCheck(identifierLocation, identifier, publicType, variable))
</del><ins>+    TVariable *variable = nullptr;
+    if (!declareVariable(identifierLocation, identifier, TType(publicType), &amp;variable))
</ins><span class="cx">         recover();
</span><del>-    if (symbol &amp;&amp; variable)
</del><ins>+
+    TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
+    if (variable &amp;&amp; symbol)
</ins><span class="cx">         symbol-&gt;setId(variable-&gt;getUniqueId());
</span><span class="cx"> 
</span><del>-    return intermAggregate;
</del><ins>+    return intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermAggregate* TParseContext::parseArrayDeclarator(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression)
</del><ins>+TIntermAggregate *TParseContext::parseArrayDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration,
+                                                      const TSourceLoc &amp;identifierLocation, const TString &amp;identifier,
+                                                      const TSourceLoc &amp;arrayLocation, TIntermTyped *indexExpression)
</ins><span class="cx"> {
</span><del>-    if (structQualifierErrorCheck(identifierLocation, publicType))
-        recover();
</del><ins>+    // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
+    if (mDeferredSingleDeclarationErrorCheck)
+    {
+        if (singleDeclarationErrorCheck(publicType, identifierLocation))
+            recover();
+        mDeferredSingleDeclarationErrorCheck = false;
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (locationDeclaratorListCheck(identifierLocation, publicType))
</span><span class="cx">         recover();
</span><span class="cx"> 
</span><del>-    if (nonInitConstErrorCheck(identifierLocation, identifier, publicType, true))
</del><ins>+    if (nonInitErrorCheck(identifierLocation, identifier, &amp;publicType))
</ins><span class="cx">         recover();
</span><span class="cx"> 
</span><span class="cx">     if (arrayTypeErrorCheck(arrayLocation, publicType) || arrayQualifierErrorCheck(arrayLocation, publicType))
</span><span class="cx">     {
</span><span class="cx">         recover();
</span><span class="cx">     }
</span><del>-    else if (indexExpression)
</del><ins>+    else
</ins><span class="cx">     {
</span><ins>+        TType arrayType = TType(publicType);
</ins><span class="cx">         int size;
</span><span class="cx">         if (arraySizeErrorCheck(arrayLocation, indexExpression, size))
</span><ins>+        {
</ins><span class="cx">             recover();
</span><del>-        TPublicType arrayType(publicType);
-        arrayType.setArray(true, size);
-        TVariable* variable = NULL;
-        if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
</del><ins>+        }
+        arrayType.setArraySize(size);
+
+        TVariable *variable = nullptr;
+        if (!declareVariable(identifierLocation, identifier, arrayType, &amp;variable))
</ins><span class="cx">             recover();
</span><del>-        TType type = TType(arrayType);
-        type.setArraySize(size);
</del><span class="cx"> 
</span><del>-        return intermediate.growAggregate(declaratorList, intermediate.addSymbol(variable ? variable-&gt;getUniqueId() : 0, identifier, type, identifierLocation), identifierLocation);
</del><ins>+        TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, arrayType, identifierLocation);
+        if (variable &amp;&amp; symbol)
+            symbol-&gt;setId(variable-&gt;getUniqueId());
+
+        return intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
</ins><span class="cx">     }
</span><del>-    else
-    {
-        TPublicType arrayType(publicType);
-        arrayType.setArray(true);
-        TVariable* variable = NULL;
-        if (arrayErrorCheck(arrayLocation, identifier, arrayType, variable))
-            recover();
-    }
</del><span class="cx"> 
</span><del>-    return NULL;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TIntermAggregate* TParseContext::parseInitDeclarator(TPublicType &amp;publicType, TIntermAggregate *declaratorList, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; initLocation, TIntermTyped *initializer)
</del><ins>+TIntermAggregate *TParseContext::parseInitDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration,
+                                                     const TSourceLoc &amp;identifierLocation, const TString &amp;identifier,
+                                                     const TSourceLoc &amp;initLocation, TIntermTyped *initializer)
</ins><span class="cx"> {
</span><del>-    if (structQualifierErrorCheck(identifierLocation, publicType))
-        recover();
</del><ins>+    // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
+    if (mDeferredSingleDeclarationErrorCheck)
+    {
+        if (singleDeclarationErrorCheck(publicType, identifierLocation))
+            recover();
+        mDeferredSingleDeclarationErrorCheck = false;
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (locationDeclaratorListCheck(identifierLocation, publicType))
</span><span class="cx">         recover();
</span><span class="cx"> 
</span><del>-    TIntermNode* intermNode;
-    if (!executeInitializer(identifierLocation, identifier, publicType, initializer, intermNode))
</del><ins>+    TIntermNode *intermNode = nullptr;
+    if (!executeInitializer(identifierLocation, identifier, publicType, initializer, &amp;intermNode))
</ins><span class="cx">     {
</span><span class="cx">         //
</span><span class="cx">         // build the intermediate representation
</span><span class="cx">         //
</span><span class="cx">         if (intermNode)
</span><span class="cx">         {
</span><del>-            return intermediate.growAggregate(declaratorList, intermNode, initLocation);
</del><ins>+            return intermediate.growAggregate(aggregateDeclaration, intermNode, initLocation);
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            return declaratorList;
</del><ins>+            return aggregateDeclaration;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     else
</span><span class="cx">     {
</span><span class="cx">         recover();
</span><del>-        return NULL;
</del><ins>+        return nullptr;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TIntermAggregate *TParseContext::parseArrayInitDeclarator(TPublicType &amp;publicType,
+                                                          TIntermAggregate *aggregateDeclaration,
+                                                          const TSourceLoc&amp; identifierLocation,
+                                                          const TString &amp;identifier,
+                                                          const TSourceLoc&amp; indexLocation,
+                                                          TIntermTyped *indexExpression,
+                                                          const TSourceLoc &amp;initLocation, TIntermTyped *initializer)
+{
+    // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
+    if (mDeferredSingleDeclarationErrorCheck)
+    {
+        if (singleDeclarationErrorCheck(publicType, identifierLocation))
+            recover();
+        mDeferredSingleDeclarationErrorCheck = false;
+    }
+
+    if (locationDeclaratorListCheck(identifierLocation, publicType))
+        recover();
+
+    if (arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
+    {
+        recover();
+    }
+
+    TPublicType arrayType(publicType);
+
+    int size = 0;
+    // If indexExpression is nullptr, then the array will eventually get its size implicitly from the initializer.
+    if (indexExpression != nullptr &amp;&amp; arraySizeErrorCheck(identifierLocation, indexExpression, size))
+    {
+        recover();
+    }
+    // Make the type an array even if size check failed.
+    // This ensures useless error messages regarding the variable's non-arrayness won't follow.
+    arrayType.setArraySize(size);
+
+    // initNode will correspond to the whole of &quot;b[n] = initializer&quot;.
+    TIntermNode *initNode = nullptr;
+    if (!executeInitializer(identifierLocation, identifier, arrayType, initializer, &amp;initNode))
+    {
+        if (initNode)
+        {
+            return intermediate.growAggregate(aggregateDeclaration, initNode, initLocation);
+        }
+        else
+        {
+            return aggregateDeclaration;
+        }
+    }
+    else
+    {
+        recover();
+        return nullptr;
+    }
+}
+
</ins><span class="cx"> void TParseContext::parseGlobalLayoutQualifier(const TPublicType &amp;typeQualifier)
</span><span class="cx"> {
</span><span class="cx">     if (typeQualifier.qualifier != EvqUniform)
</span><span class="lines">@@ -1515,93 +1716,78 @@
</span><span class="cx"> //
</span><span class="cx"> // Returns 0 for an error or the constructed node (aggregate or typed) for no error.
</span><span class="cx"> //
</span><del>-TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType* type, TOperator op, TFunction* fnCall, const TSourceLoc&amp; line)
</del><ins>+TIntermTyped *TParseContext::addConstructor(TIntermNode *arguments, TType *type, TOperator op, TFunction *fnCall, const TSourceLoc &amp;line)
</ins><span class="cx"> {
</span><del>-    if (node == 0)
-        return 0;
</del><ins>+    TIntermAggregate *aggregateArguments = arguments-&gt;getAsAggregate();
</ins><span class="cx"> 
</span><del>-    TIntermAggregate* aggrNode = node-&gt;getAsAggregate();
-    
-    TFieldList::const_iterator memberTypes;
-    if (op == EOpConstructStruct)
-        memberTypes = type-&gt;getStruct()-&gt;fields().begin();
-    
-    TType elementType = *type;
</del><ins>+    if (!aggregateArguments)
+    {
+        aggregateArguments = new TIntermAggregate;
+        aggregateArguments-&gt;getSequence()-&gt;push_back(arguments);
+    }
+
</ins><span class="cx">     if (type-&gt;isArray())
</span><del>-        elementType.clearArrayness();
</del><ins>+    {
+        // GLSL ES 3.00 section 5.4.4: Each argument must be the same type as the element type of the array.
+        TIntermSequence *args = aggregateArguments-&gt;getSequence();
+        for (size_t i = 0; i &lt; args-&gt;size(); i++)
+        {
+            const TType &amp;argType = (*args)[i]-&gt;getAsTyped()-&gt;getType();
+            // It has already been checked that the argument is not an array.
+            ASSERT(!argType.isArray());
+            if (!argType.sameElementType(*type))
+            {
+                error(line, &quot;Array constructor argument has an incorrect type&quot;, &quot;Error&quot;);
+                recover();
+                return nullptr;
+            }
+        }
+    }
+    else if (op == EOpConstructStruct)
+    {
+        const TFieldList &amp;fields = type-&gt;getStruct()-&gt;fields();
+        TIntermSequence *args = aggregateArguments-&gt;getSequence();
</ins><span class="cx"> 
</span><del>-    bool singleArg;
-    if (aggrNode) {
-        if (aggrNode-&gt;getOp() != EOpNull || aggrNode-&gt;getSequence().size() == 1)
-            singleArg = true;
-        else
-            singleArg = false;
-    } else
-        singleArg = true;
</del><ins>+        for (size_t i = 0; i &lt; fields.size(); i++)
+        {
+            if (i &gt;= args-&gt;size() || (*args)[i]-&gt;getAsTyped()-&gt;getType() != *fields[i]-&gt;type())
+            {
+                error(line, &quot;Structure constructor arguments do not match structure fields&quot;, &quot;Error&quot;);
+                recover();
</ins><span class="cx"> 
</span><del>-    TIntermTyped *newNode;
-    if (singleArg) {
-        // If structure constructor or array constructor is being called 
-        // for only one parameter inside the structure, we need to call constructStruct function once.
-        if (type-&gt;isArray())
-            newNode = constructStruct(node, &amp;elementType, 1, node-&gt;getLine(), false);
-        else if (op == EOpConstructStruct)
-            newNode = constructStruct(node, (*memberTypes)-&gt;type(), 1, node-&gt;getLine(), false);
-        else
-            newNode = constructBuiltIn(type, op, node, node-&gt;getLine(), false);
-
-        if (newNode &amp;&amp; newNode-&gt;getAsAggregate()) {
-            TIntermTyped* constConstructor = foldConstConstructor(newNode-&gt;getAsAggregate(), *type);
-            if (constConstructor)
-                return constConstructor;
</del><ins>+                return 0;
+            }
</ins><span class="cx">         }
</span><del>-
-        return newNode;
</del><span class="cx">     }
</span><del>-    
-    //
-    // Handle list of arguments.
-    //
-    TIntermSequence &amp;sequenceVector = aggrNode-&gt;getSequence() ;    // Stores the information about the parameter to the constructor
-    // if the structure constructor contains more than one parameter, then construct
-    // each parameter
-    
-    int paramCount = 0;  // keeps a track of the constructor parameter number being checked    
-    
-    // for each parameter to the constructor call, check to see if the right type is passed or convert them 
-    // to the right type if possible (and allowed).
-    // for structure constructors, just check if the right type is passed, no conversion is allowed.
-    
-    for (TIntermSequence::iterator p = sequenceVector.begin(); 
-                                   p != sequenceVector.end(); p++, paramCount++) {
-        if (type-&gt;isArray())
-            newNode = constructStruct(*p, &amp;elementType, paramCount+1, node-&gt;getLine(), true);
-        else if (op == EOpConstructStruct)
-            newNode = constructStruct(*p, (memberTypes[paramCount])-&gt;type(), paramCount+1, node-&gt;getLine(), true);
-        else
-            newNode = constructBuiltIn(type, op, *p, node-&gt;getLine(), true);
-        
-        if (newNode) {
-            *p = newNode;
-        }
-    }
</del><span class="cx"> 
</span><del>-    TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, line);
-    TIntermTyped* constConstructor = foldConstConstructor(constructor-&gt;getAsAggregate(), *type);
</del><ins>+    // Turn the argument list itself into a constructor
+    TIntermAggregate *constructor = intermediate.setAggregateOperator(aggregateArguments, op, line);
+    TIntermTyped *constConstructor = foldConstConstructor(constructor, *type);
</ins><span class="cx">     if (constConstructor)
</span><ins>+    {
</ins><span class="cx">         return constConstructor;
</span><ins>+    }
</ins><span class="cx"> 
</span><ins>+    // Structs should not be precision qualified, the individual members may be.
+    // Built-in types on the other hand should be precision qualified.
+    if (op != EOpConstructStruct)
+    {
+        constructor-&gt;setPrecisionFromChildren();
+        type-&gt;setPrecision(constructor-&gt;getPrecision());
+    }
+
</ins><span class="cx">     return constructor;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, const TType&amp; type)
</span><span class="cx"> {
</span><del>-    bool canBeFolded = areAllChildConst(aggrNode);
</del><ins>+    // TODO: Add support for folding array constructors
+    bool canBeFolded = areAllChildConst(aggrNode) &amp;&amp; !type.isArray();
</ins><span class="cx">     aggrNode-&gt;setType(type);
</span><span class="cx">     if (canBeFolded) {
</span><span class="cx">         bool returnVal = false;
</span><del>-        ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
-        if (aggrNode-&gt;getSequence().size() == 1)  {
</del><ins>+        TConstantUnion* unionArray = new TConstantUnion[type.getObjectSize()];
+        if (aggrNode-&gt;getSequence()-&gt;size() == 1)  {
</ins><span class="cx">             returnVal = intermediate.parseConstTree(aggrNode-&gt;getLine(), aggrNode, unionArray, aggrNode-&gt;getOp(), type, true);
</span><span class="cx">         }
</span><span class="cx">         else {
</span><span class="lines">@@ -1616,103 +1802,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Function for constructor implementation. Calls addUnaryMath with appropriate EOp value
-// for the parameter to the constructor (passed to this function). Essentially, it converts
-// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a 
-// float, then float is converted to int.
</del><span class="cx"> //
</span><del>-// Returns 0 for an error or the constructed node.
-//
-TIntermTyped* TParseContext::constructBuiltIn(const TType* type, TOperator op, TIntermNode* node, const TSourceLoc&amp; line, bool subset)
-{
-    TIntermTyped* newNode;
-    TOperator basicOp;
-
-    //
-    // First, convert types as needed.
-    //
-    switch (op) {
-    case EOpConstructVec2:
-    case EOpConstructVec3:
-    case EOpConstructVec4:
-    case EOpConstructMat2:
-    case EOpConstructMat3:
-    case EOpConstructMat4:
-    case EOpConstructFloat:
-        basicOp = EOpConstructFloat;
-        break;
-
-    case EOpConstructIVec2:
-    case EOpConstructIVec3:
-    case EOpConstructIVec4:
-    case EOpConstructInt:
-        basicOp = EOpConstructInt;
-        break;
-
-    case EOpConstructUVec2:
-    case EOpConstructUVec3:
-    case EOpConstructUVec4:
-    case EOpConstructUInt:
-        basicOp = EOpConstructUInt;
-        break;
-
-    case EOpConstructBVec2:
-    case EOpConstructBVec3:
-    case EOpConstructBVec4:
-    case EOpConstructBool:
-        basicOp = EOpConstructBool;
-        break;
-
-    default:
-        error(line, &quot;unsupported construction&quot;, &quot;&quot;);
-        recover();
-
-        return 0;
-    }
-    newNode = intermediate.addUnaryMath(basicOp, node, node-&gt;getLine());
-    if (newNode == 0) {
-        error(line, &quot;can't convert&quot;, &quot;constructor&quot;);
-        return 0;
-    }
-
-    //
-    // Now, if there still isn't an operation to do the construction, and we need one, add one.
-    //
-    
-    // Otherwise, skip out early.
-    if (subset || (newNode != node &amp;&amp; newNode-&gt;getType() == *type))
-        return newNode;
-
-    // setAggregateOperator will insert a new node for the constructor, as needed.
-    return intermediate.setAggregateOperator(newNode, op, line);
-}
-
-// This function tests for the type of the parameters to the structures constructors. Raises
-// an error message if the expected type does not match the parameter passed to the constructor.
-//
-// Returns 0 for an error or the input node itself if the expected and the given parameter types match.
-//
-TIntermTyped* TParseContext::constructStruct(TIntermNode* node, TType* type, int paramCount, const TSourceLoc&amp; line, bool subset)
-{
-    if (*type == node-&gt;getAsTyped()-&gt;getType()) {
-        if (subset)
-            return node-&gt;getAsTyped();
-        else
-            return intermediate.setAggregateOperator(node-&gt;getAsTyped(), EOpConstructStruct, line);
-    } else {
-        std::stringstream extraInfoStream;
-        extraInfoStream &lt;&lt; &quot;cannot convert parameter &quot; &lt;&lt; paramCount 
-                        &lt;&lt; &quot; from '&quot; &lt;&lt; node-&gt;getAsTyped()-&gt;getType().getBasicString()
-                        &lt;&lt; &quot;' to '&quot; &lt;&lt; type-&gt;getBasicString() &lt;&lt; &quot;'&quot;;
-        std::string extraInfo = extraInfoStream.str();
-        error(line, &quot;&quot;, &quot;constructor&quot;, extraInfo.c_str());
-        recover();
-    }
-
-    return 0;
-}
-
-//
</del><span class="cx"> // This function returns the tree representation for the vector field(s) being accessed from contant vector.
</span><span class="cx"> // If only one component of vector is accessed (v.x or v[0] where v is a contant vector), then a contant node is
</span><span class="cx"> // returned, else an aggregate node is returned (for v.xy). The input to this function could either be the symbol
</span><span class="lines">@@ -1724,7 +1814,7 @@
</span><span class="cx">     TIntermTyped* typedNode;
</span><span class="cx">     TIntermConstantUnion* tempConstantNode = node-&gt;getAsConstantUnion();
</span><span class="cx"> 
</span><del>-    ConstantUnion *unionArray;
</del><ins>+    const TConstantUnion *unionArray;
</ins><span class="cx">     if (tempConstantNode) {
</span><span class="cx">         unionArray = tempConstantNode-&gt;getUnionArrayPointer();
</span><span class="cx"> 
</span><span class="lines">@@ -1738,7 +1828,7 @@
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion* constArray = new ConstantUnion[fields.num];
</del><ins>+    TConstantUnion* constArray = new TConstantUnion[fields.num];
</ins><span class="cx"> 
</span><span class="cx">     for (int i = 0; i &lt; fields.num; i++) {
</span><span class="cx">         if (fields.offsets[i] &gt;= node-&gt;getType().getNominalSize()) {
</span><span class="lines">@@ -1778,7 +1868,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (tempConstantNode) {
</span><del>-         ConstantUnion* unionArray = tempConstantNode-&gt;getUnionArrayPointer();
</del><ins>+         TConstantUnion *unionArray = tempConstantNode-&gt;getUnionArrayPointer();
</ins><span class="cx">          int size = tempConstantNode-&gt;getType().getCols();
</span><span class="cx">          typedNode = intermediate.addConstantUnion(&amp;unionArray[size*index], tempConstantNode-&gt;getType(), line);
</span><span class="cx">     } else {
</span><span class="lines">@@ -1816,7 +1906,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (tempConstantNode) {
</span><span class="cx">         size_t arrayElementSize = arrayElementType.getObjectSize();
</span><del>-        ConstantUnion* unionArray = tempConstantNode-&gt;getUnionArrayPointer();
</del><ins>+        TConstantUnion* unionArray = tempConstantNode-&gt;getUnionArrayPointer();
</ins><span class="cx">         typedNode = intermediate.addConstantUnion(&amp;unionArray[arrayElementSize * index], tempConstantNode-&gt;getType(), line);
</span><span class="cx">     } else {
</span><span class="cx">         error(line, &quot;Cannot offset into the array&quot;, &quot;Error&quot;);
</span><span class="lines">@@ -1850,7 +1940,7 @@
</span><span class="cx">     TIntermTyped *typedNode;
</span><span class="cx">     TIntermConstantUnion *tempConstantNode = node-&gt;getAsConstantUnion();
</span><span class="cx">     if (tempConstantNode) {
</span><del>-         ConstantUnion* constArray = tempConstantNode-&gt;getUnionArrayPointer();
</del><ins>+         TConstantUnion* constArray = tempConstantNode-&gt;getUnionArrayPointer();
</ins><span class="cx"> 
</span><span class="cx">          typedNode = intermediate.addConstantUnion(constArray+instanceSize, tempConstantNode-&gt;getType(), line); // type will be changed in the calling function
</span><span class="cx">     } else {
</span><span class="lines">@@ -1895,7 +1985,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     TSymbol* blockNameSymbol = new TInterfaceBlockName(&amp;blockName);
</span><del>-    if (!symbolTable.declare(*blockNameSymbol)) {
</del><ins>+    if (!symbolTable.declare(blockNameSymbol)) {
</ins><span class="cx">         error(nameLine, &quot;redefinition&quot;, blockName.c_str(), &quot;interface block name&quot;);
</span><span class="cx">         recover();
</span><span class="cx">     }
</span><span class="lines">@@ -1975,7 +2065,7 @@
</span><span class="cx">             TVariable* fieldVariable = new TVariable(&amp;field-&gt;name(), *fieldType);
</span><span class="cx">             fieldVariable-&gt;setQualifier(typeQualifier.qualifier);
</span><span class="cx"> 
</span><del>-            if (!symbolTable.declare(*fieldVariable)) {
</del><ins>+            if (!symbolTable.declare(fieldVariable)) {
</ins><span class="cx">                 error(field-&gt;line(), &quot;redefinition&quot;, field-&gt;name().c_str(), &quot;interface block member name&quot;);
</span><span class="cx">                 recover();
</span><span class="cx">             }
</span><span class="lines">@@ -1987,7 +2077,7 @@
</span><span class="cx">         TVariable* instanceTypeDef = new TVariable(instanceName, interfaceBlockType, false);
</span><span class="cx">         instanceTypeDef-&gt;setQualifier(typeQualifier.qualifier);
</span><span class="cx"> 
</span><del>-        if (!symbolTable.declare(*instanceTypeDef)) {
</del><ins>+        if (!symbolTable.declare(instanceTypeDef)) {
</ins><span class="cx">             error(instanceLine, &quot;redefinition&quot;, instanceName-&gt;c_str(), &quot;interface block instance name&quot;);
</span><span class="cx">             recover();
</span><span class="cx">         }
</span><span class="lines">@@ -2075,9 +2165,11 @@
</span><span class="cx">         recover();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (indexExpression-&gt;getQualifier() == EvqConst)
</del><ins>+    TIntermConstantUnion *indexConstantUnion = indexExpression-&gt;getAsConstantUnion();
+
+    if (indexExpression-&gt;getQualifier() == EvqConst &amp;&amp; indexConstantUnion)
</ins><span class="cx">     {
</span><del>-        int index = indexExpression-&gt;getAsConstantUnion()-&gt;getIConst(0);
</del><ins>+        int index = indexConstantUnion-&gt;getIConst(0);
</ins><span class="cx">         if (index &lt; 0)
</span><span class="cx">         {
</span><span class="cx">             std::stringstream infoStream;
</span><span class="lines">@@ -2110,6 +2202,8 @@
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><ins>+            int safeIndex = -1;
+
</ins><span class="cx">             if (baseExpression-&gt;isArray())
</span><span class="cx">             {
</span><span class="cx">                 if (index &gt;= baseExpression-&gt;getType().getArraySize())
</span><span class="lines">@@ -2119,13 +2213,13 @@
</span><span class="cx">                     std::string extraInfo = extraInfoStream.str();
</span><span class="cx">                     error(location, &quot;&quot;, &quot;[&quot;, extraInfo.c_str());
</span><span class="cx">                     recover();
</span><del>-                    index = baseExpression-&gt;getType().getArraySize() - 1;
</del><ins>+                    safeIndex = baseExpression-&gt;getType().getArraySize() - 1;
</ins><span class="cx">                 }
</span><span class="cx">                 else if (baseExpression-&gt;getQualifier() == EvqFragData &amp;&amp; index &gt; 0 &amp;&amp; !isExtensionEnabled(&quot;GL_EXT_draw_buffers&quot;))
</span><span class="cx">                 {
</span><span class="cx">                     error(location, &quot;&quot;, &quot;[&quot;, &quot;array indexes for gl_FragData must be zero when GL_EXT_draw_buffers is disabled&quot;);
</span><span class="cx">                     recover();
</span><del>-                    index = 0;
</del><ins>+                    safeIndex = 0;
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             else if ((baseExpression-&gt;isVector() || baseExpression-&gt;isMatrix()) &amp;&amp; baseExpression-&gt;getType().getNominalSize() &lt;= index)
</span><span class="lines">@@ -2135,10 +2229,18 @@
</span><span class="cx">                 std::string extraInfo = extraInfoStream.str();
</span><span class="cx">                 error(location, &quot;&quot;, &quot;[&quot;, extraInfo.c_str());
</span><span class="cx">                 recover();
</span><del>-                index = baseExpression-&gt;getType().getNominalSize() - 1;
</del><ins>+                safeIndex = baseExpression-&gt;getType().getNominalSize() - 1;
</ins><span class="cx">             }
</span><span class="cx"> 
</span><del>-            indexExpression-&gt;getAsConstantUnion()-&gt;getUnionArrayPointer()-&gt;setIConst(index);
</del><ins>+            // Don't modify the data of the previous constant union, because it can point
+            // to builtins, like gl_MaxDrawBuffers. Instead use a new sanitized object.
+            if (safeIndex != -1)
+            {
+                TConstantUnion *safeConstantUnion = new TConstantUnion();
+                safeConstantUnion-&gt;setIConst(safeIndex);
+                indexConstantUnion-&gt;replaceConstantUnion(safeConstantUnion);
+            }
+
</ins><span class="cx">             indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, indexExpression, location);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -2160,7 +2262,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (indexedExpression == 0)
</span><span class="cx">     {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">         unionArray-&gt;setFConst(0.0f);
</span><span class="cx">         indexedExpression = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConst), location);
</span><span class="cx">     }
</span><span class="lines">@@ -2179,7 +2281,8 @@
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), EvqTemporary, baseExpression-&gt;getNominalSize(), baseExpression-&gt;getSecondarySize()));
</del><ins>+            indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), EvqTemporary,
+                                       static_cast&lt;unsigned char&gt;(baseExpression-&gt;getNominalSize()), static_cast&lt;unsigned char&gt;(baseExpression-&gt;getSecondarySize())));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (baseExpression-&gt;getType().getQualifier() == EvqConst)
</span><span class="lines">@@ -2190,7 +2293,7 @@
</span><span class="cx">     else if (baseExpression-&gt;isMatrix())
</span><span class="cx">     {
</span><span class="cx">         TQualifier qualifier = baseExpression-&gt;getType().getQualifier() == EvqConst ? EvqConst : EvqTemporary;
</span><del>-        indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), qualifier, baseExpression-&gt;getRows()));
</del><ins>+        indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), qualifier, static_cast&lt;unsigned char&gt;(baseExpression-&gt;getRows())));
</ins><span class="cx">     }
</span><span class="cx">     else if (baseExpression-&gt;isVector())
</span><span class="cx">     {
</span><span class="lines">@@ -2236,7 +2339,7 @@
</span><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), EvqConst, (int) (fieldString).size()));
</del><ins>+                indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), EvqConst, (unsigned char) (fieldString).size()));
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="lines">@@ -2244,7 +2347,7 @@
</span><span class="cx">             TString vectorString = fieldString;
</span><span class="cx">             TIntermTyped* index = intermediate.addSwizzle(fields, fieldLocation);
</span><span class="cx">             indexedExpression = intermediate.addIndex(EOpVectorSwizzle, baseExpression, index, dotLocation);
</span><del>-            indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), EvqTemporary, (int) vectorString.size()));
</del><ins>+            indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(), EvqTemporary, (unsigned char) vectorString.size()));
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     else if (baseExpression-&gt;isMatrix())
</span><span class="lines">@@ -2263,15 +2366,16 @@
</span><span class="cx">         {
</span><span class="cx">             error(dotLocation, &quot; non-scalar fields not implemented yet&quot;, &quot;.&quot;);
</span><span class="cx">             recover();
</span><del>-            ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+            TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">             unionArray-&gt;setIConst(0);
</span><span class="cx">             TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
</span><span class="cx">             indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
</span><del>-            indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(),EvqTemporary, baseExpression-&gt;getCols(), baseExpression-&gt;getRows()));
</del><ins>+            indexedExpression-&gt;setType(TType(baseExpression-&gt;getBasicType(), baseExpression-&gt;getPrecision(),EvqTemporary,
+                                       static_cast&lt;unsigned char&gt;(baseExpression-&gt;getCols()), static_cast&lt;unsigned char&gt;(baseExpression-&gt;getRows())));
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-            ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+            TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">             unionArray-&gt;setIConst(fields.col * baseExpression-&gt;getRows() + fields.row);
</span><span class="cx">             TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
</span><span class="cx">             indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
</span><span class="lines">@@ -2319,7 +2423,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><del>-                    ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+                    TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">                     unionArray-&gt;setIConst(i);
</span><span class="cx">                     TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]-&gt;type(), fieldLocation);
</span><span class="cx">                     indexedExpression = intermediate.addIndex(EOpIndexDirectStruct, baseExpression, index, dotLocation);
</span><span class="lines">@@ -2357,7 +2461,7 @@
</span><span class="cx">             }
</span><span class="cx">             if (fieldFound)
</span><span class="cx">             {
</span><del>-                ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+                TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">                 unionArray-&gt;setIConst(i);
</span><span class="cx">                 TIntermTyped* index = intermediate.addConstantUnion(unionArray, *fields[i]-&gt;type(), fieldLocation);
</span><span class="cx">                 indexedExpression = intermediate.addIndex(EOpIndexDirectInterfaceBlock, baseExpression, index, dotLocation);
</span><span class="lines">@@ -2527,7 +2631,8 @@
</span><span class="cx"> 
</span><span class="cx"> TFieldList *TParseContext::addStructDeclaratorList(const TPublicType&amp; typeSpecifier, TFieldList *fieldList)
</span><span class="cx"> {
</span><del>-    if (voidErrorCheck(typeSpecifier.line, (*fieldList)[0]-&gt;name(), typeSpecifier)) {
</del><ins>+    if (voidErrorCheck(typeSpecifier.line, (*fieldList)[0]-&gt;name(), typeSpecifier.type))
+    {
</ins><span class="cx">         recover();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -2567,6 +2672,11 @@
</span><span class="cx">     TStructure* structure = new TStructure(structName, fieldList);
</span><span class="cx">     TType* structureType = new TType(structure);
</span><span class="cx"> 
</span><ins>+    // Store a bool in the struct if we're at global scope, to allow us to
+    // skip the local struct scoping workaround in HLSL.
+    structure-&gt;setUniqueId(TSymbolTable::nextUniqueId());
+    structure-&gt;setAtGlobalScope(symbolTable.atGlobalLevel());
+
</ins><span class="cx">     if (!structName-&gt;empty())
</span><span class="cx">     {
</span><span class="cx">         if (reservedErrorCheck(nameLine, *structName))
</span><span class="lines">@@ -2574,7 +2684,7 @@
</span><span class="cx">             recover();
</span><span class="cx">         }
</span><span class="cx">         TVariable* userTypeDef = new TVariable(structName, *structureType, true);
</span><del>-        if (!symbolTable.declare(*userTypeDef)) {
</del><ins>+        if (!symbolTable.declare(userTypeDef)) {
</ins><span class="cx">             error(nameLine, &quot;redefinition&quot;, structName-&gt;c_str(), &quot;struct&quot;);
</span><span class="cx">             recover();
</span><span class="cx">         }
</span><span class="lines">@@ -2605,6 +2715,617 @@
</span><span class="cx">     return publicType;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+TIntermSwitch *TParseContext::addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &amp;loc)
+{
+    TBasicType switchType = init-&gt;getBasicType();
+    if ((switchType != EbtInt &amp;&amp; switchType != EbtUInt) ||
+        init-&gt;isMatrix() ||
+        init-&gt;isArray() ||
+        init-&gt;isVector())
+    {
+        error(init-&gt;getLine(), &quot;init-expression in a switch statement must be a scalar integer&quot;, &quot;switch&quot;);
+        recover();
+        return nullptr;
+    }
+
+    if (statementList)
+    {
+        if (!ValidateSwitch::validate(switchType, this, statementList, loc))
+        {
+            recover();
+            return nullptr;
+        }
+    }
+
+    TIntermSwitch *node = intermediate.addSwitch(init, statementList, loc);
+    if (node == nullptr)
+    {
+        error(loc, &quot;erroneous switch statement&quot;, &quot;switch&quot;);
+        recover();
+        return nullptr;
+    }
+    return node;
+}
+
+TIntermCase *TParseContext::addCase(TIntermTyped *condition, const TSourceLoc &amp;loc)
+{
+    if (mSwitchNestingLevel == 0)
+    {
+        error(loc, &quot;case labels need to be inside switch statements&quot;, &quot;case&quot;);
+        recover();
+        return nullptr;
+    }
+    if (condition == nullptr)
+    {
+        error(loc, &quot;case label must have a condition&quot;, &quot;case&quot;);
+        recover();
+        return nullptr;
+    }
+    if ((condition-&gt;getBasicType() != EbtInt &amp;&amp; condition-&gt;getBasicType() != EbtUInt) ||
+        condition-&gt;isMatrix() ||
+        condition-&gt;isArray() ||
+        condition-&gt;isVector())
+    {
+        error(condition-&gt;getLine(), &quot;case label must be a scalar integer&quot;, &quot;case&quot;);
+        recover();
+    }
+    TIntermConstantUnion *conditionConst = condition-&gt;getAsConstantUnion();
+    if (conditionConst == nullptr)
+    {
+        error(condition-&gt;getLine(), &quot;case label must be constant&quot;, &quot;case&quot;);
+        recover();
+    }
+    TIntermCase *node = intermediate.addCase(condition, loc);
+    if (node == nullptr)
+    {
+        error(loc, &quot;erroneous case statement&quot;, &quot;case&quot;);
+        recover();
+        return nullptr;
+    }
+    return node;
+}
+
+TIntermCase *TParseContext::addDefault(const TSourceLoc &amp;loc)
+{
+    if (mSwitchNestingLevel == 0)
+    {
+        error(loc, &quot;default labels need to be inside switch statements&quot;, &quot;default&quot;);
+        recover();
+        return nullptr;
+    }
+    TIntermCase *node = intermediate.addCase(nullptr, loc);
+    if (node == nullptr)
+    {
+        error(loc, &quot;erroneous default statement&quot;, &quot;default&quot;);
+        recover();
+        return nullptr;
+    }
+    return node;
+}
+
+TIntermTyped *TParseContext::createUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &amp;loc,
+    const TType *funcReturnType)
+{
+    if (child == nullptr)
+    {
+        return nullptr;
+    }
+
+    switch (op)
+    {
+      case EOpLogicalNot:
+        if (child-&gt;getBasicType() != EbtBool ||
+            child-&gt;isMatrix() ||
+            child-&gt;isArray() ||
+            child-&gt;isVector())
+        {
+            return nullptr;
+        }
+        break;
+      case EOpBitwiseNot:
+        if ((child-&gt;getBasicType() != EbtInt &amp;&amp; child-&gt;getBasicType() != EbtUInt) ||
+            child-&gt;isMatrix() ||
+            child-&gt;isArray())
+        {
+            return nullptr;
+        }
+        break;
+      case EOpPostIncrement:
+      case EOpPreIncrement:
+      case EOpPostDecrement:
+      case EOpPreDecrement:
+      case EOpNegative:
+      case EOpPositive:
+        if (child-&gt;getBasicType() == EbtStruct ||
+            child-&gt;getBasicType() == EbtBool ||
+            child-&gt;isArray())
+        {
+            return nullptr;
+        }
+      // Operators for built-ins are already type checked against their prototype.
+      default:
+        break;
+    }
+
+    return intermediate.addUnaryMath(op, child, loc, funcReturnType);
+}
+
+TIntermTyped *TParseContext::addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &amp;loc)
+{
+    TIntermTyped *node = createUnaryMath(op, child, loc, nullptr);
+    if (node == nullptr)
+    {
+        unaryOpError(loc, GetOperatorString(op), child-&gt;getCompleteString());
+        recover();
+        return child;
+    }
+    return node;
+}
+
+TIntermTyped *TParseContext::addUnaryMathLValue(TOperator op, TIntermTyped *child, const TSourceLoc &amp;loc)
+{
+    if (lValueErrorCheck(loc, GetOperatorString(op), child))
+        recover();
+    return addUnaryMath(op, child, loc);
+}
+
+bool TParseContext::binaryOpCommonCheck(TOperator op, TIntermTyped *left, TIntermTyped *right,
+    const TSourceLoc &amp;loc)
+{
+    if (left-&gt;isArray() || right-&gt;isArray())
+    {
+        if (shaderVersion &lt; 300)
+        {
+            error(loc, &quot;Invalid operation for arrays&quot;, GetOperatorString(op));
+            return false;
+        }
+
+        if (left-&gt;isArray() != right-&gt;isArray())
+        {
+            error(loc, &quot;array / non-array mismatch&quot;, GetOperatorString(op));
+            return false;
+        }
+
+        switch (op)
+        {
+          case EOpEqual:
+          case EOpNotEqual:
+          case EOpAssign:
+          case EOpInitialize:
+            break;
+          default:
+            error(loc, &quot;Invalid operation for arrays&quot;, GetOperatorString(op));
+            return false;
+        }
+        // At this point, size of implicitly sized arrays should be resolved.
+        if (left-&gt;getArraySize() != right-&gt;getArraySize())
+        {
+            error(loc, &quot;array size mismatch&quot;, GetOperatorString(op));
+            return false;
+        }
+    }
+
+    // Check ops which require integer / ivec parameters
+    bool isBitShift = false;
+    switch (op)
+    {
+      case EOpBitShiftLeft:
+      case EOpBitShiftRight:
+      case EOpBitShiftLeftAssign:
+      case EOpBitShiftRightAssign:
+        // Unsigned can be bit-shifted by signed and vice versa, but we need to
+        // check that the basic type is an integer type.
+        isBitShift = true;
+        if (!IsInteger(left-&gt;getBasicType()) || !IsInteger(right-&gt;getBasicType()))
+        {
+            return false;
+        }
+        break;
+      case EOpBitwiseAnd:
+      case EOpBitwiseXor:
+      case EOpBitwiseOr:
+      case EOpBitwiseAndAssign:
+      case EOpBitwiseXorAssign:
+      case EOpBitwiseOrAssign:
+        // It is enough to check the type of only one operand, since later it
+        // is checked that the operand types match.
+        if (!IsInteger(left-&gt;getBasicType()))
+        {
+            return false;
+        }
+        break;
+      default:
+        break;
+    }
+
+    // GLSL ES 1.00 and 3.00 do not support implicit type casting.
+    // So the basic type should usually match.
+    if (!isBitShift &amp;&amp; left-&gt;getBasicType() != right-&gt;getBasicType())
+    {
+        return false;
+    }
+
+    // Check that type sizes match exactly on ops that require that.
+    // Also check restrictions for structs that contain arrays or samplers.
+    switch(op)
+    {
+      case EOpAssign:
+      case EOpInitialize:
+      case EOpEqual:
+      case EOpNotEqual:
+        // ESSL 1.00 sections 5.7, 5.8, 5.9
+        if (shaderVersion &lt; 300 &amp;&amp; left-&gt;getType().isStructureContainingArrays())
+        {
+            error(loc, &quot;undefined operation for structs containing arrays&quot;, GetOperatorString(op));
+            return false;
+        }
+        // Samplers as l-values are disallowed also in ESSL 3.00, see section 4.1.7,
+        // we interpret the spec so that this extends to structs containing samplers,
+        // similarly to ESSL 1.00 spec.
+        if ((shaderVersion &lt; 300 || op == EOpAssign || op == EOpInitialize) &amp;&amp;
+            left-&gt;getType().isStructureContainingSamplers())
+        {
+            error(loc, &quot;undefined operation for structs containing samplers&quot;, GetOperatorString(op));
+            return false;
+        }
+      case EOpLessThan:
+      case EOpGreaterThan:
+      case EOpLessThanEqual:
+      case EOpGreaterThanEqual:
+        if ((left-&gt;getNominalSize() != right-&gt;getNominalSize()) ||
+            (left-&gt;getSecondarySize() != right-&gt;getSecondarySize()))
+        {
+            return false;
+        }
+      default:
+        break;
+    }
+
+    return true;
+}
+
+TIntermTyped *TParseContext::addBinaryMathInternal(TOperator op, TIntermTyped *left, TIntermTyped *right,
+    const TSourceLoc &amp;loc)
+{
+    if (!binaryOpCommonCheck(op, left, right, loc))
+        return nullptr;
+
+    switch (op)
+    {
+      case EOpEqual:
+      case EOpNotEqual:
+        break;
+      case EOpLessThan:
+      case EOpGreaterThan:
+      case EOpLessThanEqual:
+      case EOpGreaterThanEqual:
+        ASSERT(!left-&gt;isArray() &amp;&amp; !right-&gt;isArray());
+        if (left-&gt;isMatrix() || left-&gt;isVector() ||
+            left-&gt;getBasicType() == EbtStruct)
+        {
+            return nullptr;
+        }
+        break;
+      case EOpLogicalOr:
+      case EOpLogicalXor:
+      case EOpLogicalAnd:
+        ASSERT(!left-&gt;isArray() &amp;&amp; !right-&gt;isArray());
+        if (left-&gt;getBasicType() != EbtBool ||
+            left-&gt;isMatrix() || left-&gt;isVector())
+        {
+            return nullptr;
+        }
+        break;
+      case EOpAdd:
+      case EOpSub:
+      case EOpDiv:
+      case EOpMul:
+        ASSERT(!left-&gt;isArray() &amp;&amp; !right-&gt;isArray());
+        if (left-&gt;getBasicType() == EbtStruct || left-&gt;getBasicType() == EbtBool)
+        {
+            return nullptr;
+        }
+        break;
+      case EOpIMod:
+        ASSERT(!left-&gt;isArray() &amp;&amp; !right-&gt;isArray());
+        // Note that this is only for the % operator, not for mod()
+        if (left-&gt;getBasicType() == EbtStruct || left-&gt;getBasicType() == EbtBool || left-&gt;getBasicType() == EbtFloat)
+        {
+            return nullptr;
+        }
+        break;
+      // Note that for bitwise ops, type checking is done in promote() to
+      // share code between ops and compound assignment
+      default:
+        break;
+    }
+
+    return intermediate.addBinaryMath(op, left, right, loc);
+}
+
+TIntermTyped *TParseContext::addBinaryMath(TOperator op, TIntermTyped *left, TIntermTyped *right,
+    const TSourceLoc &amp;loc)
+{
+    TIntermTyped *node = addBinaryMathInternal(op, left, right, loc);
+    if (node == 0)
+    {
+        binaryOpError(loc, GetOperatorString(op), left-&gt;getCompleteString(), right-&gt;getCompleteString());
+        recover();
+        return left;
+    }
+    return node;
+}
+
+TIntermTyped *TParseContext::addBinaryMathBooleanResult(TOperator op, TIntermTyped *left, TIntermTyped *right,
+    const TSourceLoc &amp;loc)
+{
+    TIntermTyped *node = addBinaryMathInternal(op, left, right, loc);
+    if (node == 0)
+    {
+        binaryOpError(loc, GetOperatorString(op), left-&gt;getCompleteString(), right-&gt;getCompleteString());
+        recover();
+        TConstantUnion *unionArray = new TConstantUnion[1];
+        unionArray-&gt;setBConst(false);
+        return intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), loc);
+    }
+    return node;
+}
+
+TIntermTyped *TParseContext::createAssign(TOperator op, TIntermTyped *left, TIntermTyped *right,
+    const TSourceLoc &amp;loc)
+{
+    if (binaryOpCommonCheck(op, left, right, loc))
+    {
+        return intermediate.addAssign(op, left, right, loc);
+    }
+    return nullptr;
+}
+
+TIntermTyped *TParseContext::addAssign(TOperator op, TIntermTyped *left, TIntermTyped *right,
+    const TSourceLoc &amp;loc)
+{
+    TIntermTyped *node = createAssign(op, left, right, loc);
+    if (node == nullptr)
+    {
+        assignError(loc, &quot;assign&quot;, left-&gt;getCompleteString(), right-&gt;getCompleteString());
+        recover();
+        return left;
+    }
+    return node;
+}
+
+TIntermBranch *TParseContext::addBranch(TOperator op, const TSourceLoc &amp;loc)
+{
+    switch (op)
+    {
+      case EOpContinue:
+        if (mLoopNestingLevel &lt;= 0)
+        {
+            error(loc, &quot;continue statement only allowed in loops&quot;, &quot;&quot;);
+            recover();
+        }
+        break;
+      case EOpBreak:
+        if (mLoopNestingLevel &lt;= 0 &amp;&amp; mSwitchNestingLevel &lt;= 0)
+        {
+            error(loc, &quot;break statement only allowed in loops and switch statements&quot;, &quot;&quot;);
+            recover();
+        }
+        break;
+      case EOpReturn:
+        if (currentFunctionType-&gt;getBasicType() != EbtVoid)
+        {
+            error(loc, &quot;non-void function must return a value&quot;, &quot;return&quot;);
+            recover();
+        }
+        break;
+      default:
+        // No checks for discard
+        break;
+    }
+    return intermediate.addBranch(op, loc);
+}
+
+TIntermBranch *TParseContext::addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &amp;loc)
+{
+    ASSERT(op == EOpReturn);
+    mFunctionReturnsValue = true;
+    if (currentFunctionType-&gt;getBasicType() == EbtVoid)
+    {
+        error(loc, &quot;void function cannot return a value&quot;, &quot;return&quot;);
+        recover();
+    }
+    else if (*currentFunctionType != returnValue-&gt;getType())
+    {
+        error(loc, &quot;function return is not matching type:&quot;, &quot;return&quot;);
+        recover();
+    }
+    return intermediate.addBranch(op, returnValue, loc);
+}
+
+TIntermTyped *TParseContext::addFunctionCallOrMethod(TFunction *fnCall, TIntermNode *paramNode, TIntermNode *thisNode,
+                                                     const TSourceLoc &amp;loc, bool *fatalError)
+{
+    *fatalError = false;
+    TOperator op = fnCall-&gt;getBuiltInOp();
+    TIntermTyped *callNode = nullptr;
+
+    if (thisNode != nullptr)
+    {
+        TConstantUnion *unionArray = new TConstantUnion[1];
+        int arraySize = 0;
+        TIntermTyped *typedThis = thisNode-&gt;getAsTyped();
+        if (fnCall-&gt;getName() != &quot;length&quot;)
+        {
+            error(loc, &quot;invalid method&quot;, fnCall-&gt;getName().c_str());
+            recover();
+        }
+        else if (paramNode != nullptr)
+        {
+            error(loc, &quot;method takes no parameters&quot;, &quot;length&quot;);
+            recover();
+        }
+        else if (typedThis == nullptr || !typedThis-&gt;isArray())
+        {
+            error(loc, &quot;length can only be called on arrays&quot;, &quot;length&quot;);
+            recover();
+        }
+        else
+        {
+            arraySize = typedThis-&gt;getArraySize();
+            if (typedThis-&gt;getAsSymbolNode() == nullptr)
+            {
+                // This code path can be hit with expressions like these:
+                // (a = b).length()
+                // (func()).length()
+                // (int[3](0, 1, 2)).length()
+                // ESSL 3.00 section 5.9 defines expressions so that this is not actually a valid expression.
+                // It allows &quot;An array name with the length method applied&quot; in contrast to GLSL 4.4 spec section 5.9
+                // which allows &quot;An array, vector or matrix expression with the length method applied&quot;.
+                error(loc, &quot;length can only be called on array names, not on array expressions&quot;, &quot;length&quot;);
+                recover();
+            }
+        }
+        unionArray-&gt;setIConst(arraySize);
+        callNode = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), loc);
+    }
+    else if (op != EOpNull)
+    {
+        //
+        // Then this should be a constructor.
+        // Don't go through the symbol table for constructors.
+        // Their parameters will be verified algorithmically.
+        //
+        TType type(EbtVoid, EbpUndefined);  // use this to get the type back
+        if (!constructorErrorCheck(loc, paramNode, *fnCall, op, &amp;type))
+        {
+            //
+            // It's a constructor, of type 'type'.
+            //
+            callNode = addConstructor(paramNode, &amp;type, op, fnCall, loc);
+        }
+
+        if (callNode == nullptr)
+        {
+            recover();
+            callNode = intermediate.setAggregateOperator(nullptr, op, loc);
+        }
+        callNode-&gt;setType(type);
+    }
+    else
+    {
+        //
+        // Not a constructor.  Find it in the symbol table.
+        //
+        const TFunction* fnCandidate;
+        bool builtIn;
+        fnCandidate = findFunction(loc, fnCall, shaderVersion, &amp;builtIn);
+        if (fnCandidate)
+        {
+            //
+            // A declared function.
+            //
+            if (builtIn &amp;&amp; !fnCandidate-&gt;getExtension().empty() &amp;&amp;
+                extensionErrorCheck(loc, fnCandidate-&gt;getExtension()))
+            {
+                recover();
+            }
+            op = fnCandidate-&gt;getBuiltInOp();
+            if (builtIn &amp;&amp; op != EOpNull)
+            {
+                //
+                // A function call mapped to a built-in operation.
+                //
+                if (fnCandidate-&gt;getParamCount() == 1)
+                {
+                    //
+                    // Treat it like a built-in unary operator.
+                    //
+                    callNode = createUnaryMath(op, paramNode-&gt;getAsTyped(), loc, &amp;fnCandidate-&gt;getReturnType());
+                    if (callNode == nullptr)
+                    {
+                        std::stringstream extraInfoStream;
+                        extraInfoStream &lt;&lt; &quot;built in unary operator function.  Type: &quot;
+                            &lt;&lt; static_cast&lt;TIntermTyped*&gt;(paramNode)-&gt;getCompleteString();
+                        std::string extraInfo = extraInfoStream.str();
+                        error(paramNode-&gt;getLine(), &quot; wrong operand type&quot;, &quot;Internal Error&quot;, extraInfo.c_str());
+                        *fatalError = true;
+                        return nullptr;
+                    }
+                }
+                else
+                {
+                    TIntermAggregate *aggregate = intermediate.setAggregateOperator(paramNode, op, loc);
+                    aggregate-&gt;setType(fnCandidate-&gt;getReturnType());
+                    aggregate-&gt;setPrecisionFromChildren();
+                    callNode = aggregate;
+
+                    // Some built-in functions have out parameters too.
+                    functionCallLValueErrorCheck(fnCandidate, aggregate);
+                }
+            }
+            else
+            {
+                // This is a real function call
+
+                TIntermAggregate *aggregate = intermediate.setAggregateOperator(paramNode, EOpFunctionCall, loc);
+                aggregate-&gt;setType(fnCandidate-&gt;getReturnType());
+
+                // this is how we know whether the given function is a builtIn function or a user defined function
+                // if builtIn == false, it's a userDefined -&gt; could be an overloaded builtIn function also
+                // if builtIn == true, it's definitely a builtIn function with EOpNull
+                if (!builtIn)
+                    aggregate-&gt;setUserDefined();
+                aggregate-&gt;setName(fnCandidate-&gt;getMangledName());
+                aggregate-&gt;setFunctionId(fnCandidate-&gt;getUniqueId());
+
+                // This needs to happen after the name is set
+                if (builtIn)
+                    aggregate-&gt;setBuiltInFunctionPrecision();
+
+                callNode = aggregate;
+
+                functionCallLValueErrorCheck(fnCandidate, aggregate);
+            }
+        }
+        else
+        {
+            // error message was put out by findFunction()
+            // Put on a dummy node for error recovery
+            TConstantUnion *unionArray = new TConstantUnion[1];
+            unionArray-&gt;setFConst(0.0f);
+            callNode = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), loc);
+            recover();
+        }
+    }
+    delete fnCall;
+    return callNode;
+}
+
+TIntermTyped *TParseContext::addTernarySelection(TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock,
+                                                 const TSourceLoc &amp;loc)
+{
+    if (boolErrorCheck(loc, cond))
+        recover();
+
+    if (trueBlock-&gt;getType() != falseBlock-&gt;getType())
+    {
+        binaryOpError(loc, &quot;:&quot;, trueBlock-&gt;getCompleteString(), falseBlock-&gt;getCompleteString());
+        recover();
+        return falseBlock;
+    }
+    // ESSL1 sections 5.2 and 5.7:
+    // ESSL3 section 5.7:
+    // Ternary operator is not among the operators allowed for structures/arrays.
+    if (trueBlock-&gt;isArray() || trueBlock-&gt;getBasicType() == EbtStruct)
+    {
+        error(loc, &quot;ternary operator is not allowed for structures or arrays&quot;, &quot;:&quot;);
+        recover();
+        return falseBlock;
+    }
+    return intermediate.addSelection(cond, trueBlock, falseBlock, loc);
+}
+
</ins><span class="cx"> //
</span><span class="cx"> // Parse an array of strings using yyparse.
</span><span class="cx"> //
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorParseContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ParseContext.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,15 +1,15 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><del>-#ifndef _PARSER_HELPER_INCLUDED_
-#define _PARSER_HELPER_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_PARSECONTEXT_H_
+#define COMPILER_TRANSLATOR_PARSECONTEXT_H_
</ins><span class="cx"> 
</span><ins>+#include &quot;compiler/translator/Compiler.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/Diagnostics.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/DirectiveHandler.h&quot;
</span><del>-#include &quot;compiler/translator/localintermediate.h&quot;
-#include &quot;compiler/translator/ShHandle.h&quot;
</del><ins>+#include &quot;compiler/translator/intermediate.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/SymbolTable.h&quot;
</span><span class="cx"> #include &quot;compiler/preprocessor/Preprocessor.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -25,38 +25,42 @@
</span><span class="cx"> // they can be passed to the parser without needing a global.
</span><span class="cx"> //
</span><span class="cx"> struct TParseContext {
</span><del>-    TParseContext(TSymbolTable&amp; symt, TExtensionBehavior&amp; ext, TIntermediate&amp; interm, ShShaderType type, ShShaderSpec spec, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink&amp; is) :
</del><ins>+    TParseContext(TSymbolTable&amp; symt, TExtensionBehavior&amp; ext, TIntermediate&amp; interm, sh::GLenum type, ShShaderSpec spec, int options, bool checksPrecErrors, TInfoSink&amp; is, bool debugShaderPrecisionSupported) :
</ins><span class="cx">             intermediate(interm),
</span><span class="cx">             symbolTable(symt),
</span><span class="cx">             shaderType(type),
</span><span class="cx">             shaderSpec(spec),
</span><span class="cx">             compileOptions(options),
</span><del>-            sourcePath(sourcePath),
</del><span class="cx">             treeRoot(0),
</span><del>-            loopNestingLevel(0),
</del><ins>+            mLoopNestingLevel(0),
</ins><span class="cx">             structNestingLevel(0),
</span><ins>+            mSwitchNestingLevel(0),
</ins><span class="cx">             currentFunctionType(NULL),
</span><del>-            functionReturnsValue(false),
</del><ins>+            mFunctionReturnsValue(false),
</ins><span class="cx">             checksPrecisionErrors(checksPrecErrors),
</span><ins>+            fragmentPrecisionHigh(false),
</ins><span class="cx">             defaultMatrixPacking(EmpColumnMajor),
</span><span class="cx">             defaultBlockStorage(EbsShared),
</span><span class="cx">             diagnostics(is),
</span><span class="cx">             shaderVersion(100),
</span><del>-            directiveHandler(ext, diagnostics, shaderVersion),
</del><ins>+            directiveHandler(ext, diagnostics, shaderVersion, debugShaderPrecisionSupported),
</ins><span class="cx">             preprocessor(&amp;diagnostics, &amp;directiveHandler),
</span><del>-            scanner(NULL) {  }
</del><ins>+            scanner(NULL),
+            mDeferredSingleDeclarationErrorCheck(false)
+    {
+    }
</ins><span class="cx">     TIntermediate&amp; intermediate; // to hold and build a parse tree
</span><span class="cx">     TSymbolTable&amp; symbolTable;   // symbol table that goes with the language currently being parsed
</span><del>-    ShShaderType shaderType;              // vertex or fragment language (future: pack or unpack)
</del><ins>+    sh::GLenum shaderType;              // vertex or fragment language (future: pack or unpack)
</ins><span class="cx">     ShShaderSpec shaderSpec;              // The language specification compiler conforms to - GLES2 or WebGL.
</span><span class="cx">     int shaderVersion;
</span><span class="cx">     int compileOptions;
</span><del>-    const char* sourcePath;      // Path of source file or NULL.
</del><span class="cx">     TIntermNode* treeRoot;       // root of parse tree being created
</span><del>-    int loopNestingLevel;        // 0 if outside all loops
</del><ins>+    int mLoopNestingLevel;       // 0 if outside all loops
</ins><span class="cx">     int structNestingLevel;      // incremented while parsing a struct declaration
</span><ins>+    int mSwitchNestingLevel;     // 0 if outside all switch statements
</ins><span class="cx">     const TType* currentFunctionType;  // the return type of the function that's currently being parsed
</span><del>-    bool functionReturnsValue;   // true if a non-void function has a return
</del><ins>+    bool mFunctionReturnsValue;  // true if a non-void function has a return
</ins><span class="cx">     bool checksPrecisionErrors;  // true if an error will be generated when a variable is declared without precision, explicit or implicit.
</span><span class="cx">     bool fragmentPrecisionHigh;  // true if highp precision is supported in the fragment language.
</span><span class="cx">     TLayoutMatrixPacking defaultMatrixPacking;
</span><span class="lines">@@ -74,9 +78,11 @@
</span><span class="cx">                const char* extraInfo=&quot;&quot;);
</span><span class="cx">     void warning(const TSourceLoc&amp; loc, const char* reason, const char* token,
</span><span class="cx">                  const char* extraInfo=&quot;&quot;);
</span><del>-    void trace(const char* str);
</del><span class="cx">     void recover();
</span><span class="cx"> 
</span><ins>+    // This method is guaranteed to succeed, even if no variable with 'name' exists.
+    const TVariable *getNamedVariable(const TSourceLoc &amp;location, const TString *name, const TSymbol *symbol);
+
</ins><span class="cx">     bool parseVectorFields(const TString&amp;, int vecSize, TVectorFields&amp;, const TSourceLoc&amp; line);
</span><span class="cx">     bool parseMatrixFields(const TString&amp;, int matCols, int matRows, TMatrixFields&amp;, const TSourceLoc&amp; line);
</span><span class="cx"> 
</span><span class="lines">@@ -91,50 +97,74 @@
</span><span class="cx">     bool globalErrorCheck(const TSourceLoc&amp; line, bool global, const char* token);
</span><span class="cx">     bool constructorErrorCheck(const TSourceLoc&amp; line, TIntermNode*, TFunction&amp;, TOperator, TType*);
</span><span class="cx">     bool arraySizeErrorCheck(const TSourceLoc&amp; line, TIntermTyped* expr, int&amp; size);
</span><del>-    bool arrayQualifierErrorCheck(const TSourceLoc&amp; line, TPublicType type);
</del><ins>+    bool arrayQualifierErrorCheck(const TSourceLoc &amp;line, const TPublicType &amp;type);
</ins><span class="cx">     bool arrayTypeErrorCheck(const TSourceLoc&amp; line, TPublicType type);
</span><del>-    bool arrayErrorCheck(const TSourceLoc&amp; line, const TString&amp; identifier, const TPublicType &amp;type, TVariable*&amp; variable);
-    bool voidErrorCheck(const TSourceLoc&amp;, const TString&amp;, const TPublicType&amp;);
</del><ins>+    bool voidErrorCheck(const TSourceLoc &amp;line, const TString &amp;identifier, const TBasicType &amp;type);
</ins><span class="cx">     bool boolErrorCheck(const TSourceLoc&amp;, const TIntermTyped*);
</span><span class="cx">     bool boolErrorCheck(const TSourceLoc&amp;, const TPublicType&amp;);
</span><span class="cx">     bool samplerErrorCheck(const TSourceLoc&amp; line, const TPublicType&amp; pType, const char* reason);
</span><del>-    bool structQualifierErrorCheck(const TSourceLoc&amp; line, const TPublicType&amp; pType);
</del><span class="cx">     bool locationDeclaratorListCheck(const TSourceLoc&amp; line, const TPublicType &amp;pType);
</span><span class="cx">     bool parameterSamplerErrorCheck(const TSourceLoc&amp; line, TQualifier qualifier, const TType&amp; type);
</span><del>-    bool nonInitConstErrorCheck(const TSourceLoc&amp; line, const TString&amp; identifier, TPublicType&amp; type, bool array);
-    bool nonInitErrorCheck(const TSourceLoc&amp; line, const TString&amp; identifier, const TPublicType&amp; type, TVariable*&amp; variable);
</del><span class="cx">     bool paramErrorCheck(const TSourceLoc&amp; line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
</span><span class="cx">     bool extensionErrorCheck(const TSourceLoc&amp; line, const TString&amp;);
</span><del>-    bool singleDeclarationErrorCheck(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier);
</del><ins>+    bool singleDeclarationErrorCheck(TPublicType &amp;publicType, const TSourceLoc &amp;identifierLocation);
</ins><span class="cx">     bool layoutLocationErrorCheck(const TSourceLoc&amp; location, const TLayoutQualifier &amp;layoutQualifier);
</span><ins>+    bool functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *);
</ins><span class="cx"> 
</span><span class="cx">     const TPragma&amp; pragma() const { return directiveHandler.pragma(); }
</span><span class="cx">     const TExtensionBehavior&amp; extensionBehavior() const { return directiveHandler.extensionBehavior(); }
</span><span class="cx">     bool supportsExtension(const char* extension);
</span><span class="cx">     bool isExtensionEnabled(const char* extension) const;
</span><span class="cx">     void handleExtensionDirective(const TSourceLoc&amp; loc, const char* extName, const char* behavior);
</span><del>-    void handlePragmaDirective(const TSourceLoc&amp; loc, const char* name, const char* value);
</del><ins>+    void handlePragmaDirective(const TSourceLoc&amp; loc, const char* name, const char* value, bool stdgl);
</ins><span class="cx"> 
</span><span class="cx">     bool containsSampler(TType&amp; type);
</span><span class="cx">     bool areAllChildConst(TIntermAggregate* aggrNode);
</span><del>-    const TFunction* findFunction(const TSourceLoc&amp; line, TFunction* pfnCall, int shaderVersion, bool *builtIn = 0);
-    bool executeInitializer(const TSourceLoc&amp; line, const TString&amp; identifier, TPublicType&amp; pType,
-                            TIntermTyped* initializer, TIntermNode*&amp; intermNode, TVariable* variable = 0);
</del><ins>+    const TFunction* findFunction(const TSourceLoc&amp; line, TFunction* pfnCall, int inputShaderVersion, bool *builtIn = 0);
+    bool executeInitializer(const TSourceLoc &amp;line, const TString &amp;identifier, TPublicType &amp;pType,
+                            TIntermTyped *initializer, TIntermNode **intermNode);
</ins><span class="cx"> 
</span><span class="cx">     TPublicType addFullySpecifiedType(TQualifier qualifier, const TPublicType&amp; typeSpecifier);
</span><span class="cx">     TPublicType addFullySpecifiedType(TQualifier qualifier, TLayoutQualifier layoutQualifier, const TPublicType&amp; typeSpecifier);
</span><del>-    TIntermAggregate* parseSingleDeclaration(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier);
-    TIntermAggregate* parseSingleArrayDeclaration(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; indexLocation, TIntermTyped *indexExpression);
-    TIntermAggregate* parseSingleInitDeclaration(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; initLocation, TIntermTyped *initializer);
-    TIntermAggregate* parseDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration, TSymbol *identifierSymbol, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier);
-    TIntermAggregate* parseArrayDeclarator(TPublicType &amp;publicType, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; arrayLocation, TIntermNode *declaratorList, TIntermTyped *indexExpression);
-    TIntermAggregate* parseInitDeclarator(TPublicType &amp;publicType, TIntermAggregate *declaratorList, const TSourceLoc&amp; identifierLocation, const TString &amp;identifier, const TSourceLoc&amp; initLocation, TIntermTyped *initializer);
</del><ins>+
+    TIntermAggregate *parseSingleDeclaration(TPublicType &amp;publicType,
+                                             const TSourceLoc &amp;identifierOrTypeLocation, const TString &amp;identifier);
+    TIntermAggregate *parseSingleArrayDeclaration(TPublicType &amp;publicType,
+                                                  const TSourceLoc &amp;identifierLocation, const TString &amp;identifier,
+                                                  const TSourceLoc &amp;indexLocation, TIntermTyped *indexExpression);
+    TIntermAggregate *parseSingleInitDeclaration(TPublicType &amp;publicType,
+                                                 const TSourceLoc &amp;identifierLocation, const TString &amp;identifier,
+                                                 const TSourceLoc &amp;initLocation, TIntermTyped *initializer);
+
+    // Parse a declaration like &quot;type a[n] = initializer&quot;
+    // Note that this does not apply to declarations like &quot;type[n] a = initializer&quot;
+    TIntermAggregate *parseSingleArrayInitDeclaration(TPublicType &amp;publicType,
+                                                      const TSourceLoc &amp;identifierLocation, const TString &amp;identifier,
+                                                      const TSourceLoc &amp;indexLocation, TIntermTyped *indexExpression,
+                                                      const TSourceLoc &amp;initLocation, TIntermTyped *initializer);
+
+    TIntermAggregate *parseInvariantDeclaration(const TSourceLoc &amp;invariantLoc, const TSourceLoc &amp;identifierLoc,
+                                                const TString *identifier, const TSymbol *symbol);
+
+    TIntermAggregate *parseDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration,
+                                      const TSourceLoc &amp;identifierLocation, const TString &amp;identifier);
+    TIntermAggregate *parseArrayDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration,
+                                           const TSourceLoc &amp;identifierLocation, const TString &amp;identifier,
+                                           const TSourceLoc &amp;arrayLocation, TIntermTyped *indexExpression);
+    TIntermAggregate *parseInitDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration,
+                                          const TSourceLoc &amp;identifierLocation, const TString &amp;identifier,
+                                          const TSourceLoc &amp;initLocation, TIntermTyped *initializer);
+
+    // Parse a declarator like &quot;a[n] = initializer&quot;
+    TIntermAggregate *parseArrayInitDeclarator(TPublicType &amp;publicType, TIntermAggregate *aggregateDeclaration,
+                                               const TSourceLoc&amp; identifierLocation, const TString &amp;identifier,
+                                               const TSourceLoc&amp; indexLocation, TIntermTyped *indexExpression,
+                                               const TSourceLoc &amp;initLocation, TIntermTyped *initializer);
+
</ins><span class="cx">     void parseGlobalLayoutQualifier(const TPublicType &amp;typeQualifier);
</span><span class="cx">     TFunction *addConstructorFunc(TPublicType publicType);
</span><del>-    TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, const TSourceLoc&amp;);
</del><ins>+    TIntermTyped* addConstructor(TIntermNode*, TType*, TOperator, TFunction*, const TSourceLoc&amp;);
</ins><span class="cx">     TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType&amp; type);
</span><del>-    TIntermTyped* constructStruct(TIntermNode*, TType*, int, const TSourceLoc&amp;, bool subset);
-    TIntermTyped* constructBuiltIn(const TType*, TOperator, TIntermNode*, const TSourceLoc&amp;, bool subset);
</del><span class="cx">     TIntermTyped* addConstVectorNode(TVectorFields&amp;, TIntermTyped*, const TSourceLoc&amp;);
</span><span class="cx">     TIntermTyped* addConstMatrixNode(int , TIntermTyped*, const TSourceLoc&amp;);
</span><span class="cx">     TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc&amp; line);
</span><span class="lines">@@ -161,9 +191,52 @@
</span><span class="cx">     void exitStructDeclaration();
</span><span class="cx"> 
</span><span class="cx">     bool structNestingErrorCheck(const TSourceLoc&amp; line, const TField&amp; field);
</span><ins>+
+    TIntermSwitch *addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &amp;loc);
+    TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &amp;loc);
+    TIntermCase *addDefault(const TSourceLoc &amp;loc);
+
+    TIntermTyped *addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &amp;);
+    TIntermTyped *addUnaryMathLValue(TOperator op, TIntermTyped *child, const TSourceLoc &amp;);
+    TIntermTyped *addBinaryMath(TOperator op, TIntermTyped *left, TIntermTyped *right,
+        const TSourceLoc &amp;);
+    TIntermTyped *addBinaryMathBooleanResult(TOperator op, TIntermTyped *left, TIntermTyped *right,
+        const TSourceLoc &amp;);
+    TIntermTyped *addAssign(TOperator op, TIntermTyped *left, TIntermTyped *right,
+        const TSourceLoc &amp;loc);
+
+    TIntermBranch *addBranch(TOperator op, const TSourceLoc &amp;loc);
+    TIntermBranch *addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &amp;loc);
+
+    TIntermTyped *addFunctionCallOrMethod(TFunction *fnCall, TIntermNode *paramNode, TIntermNode *thisNode,
+                                          const TSourceLoc &amp;loc, bool *fatalError);
+
+    TIntermTyped *addTernarySelection(TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock,
+                                      const TSourceLoc &amp;line);
+
+  private:
+    bool declareVariable(const TSourceLoc &amp;line, const TString &amp;identifier, const TType &amp;type, TVariable **variable);
+
+    bool nonInitErrorCheck(const TSourceLoc &amp;line, const TString &amp;identifier, TPublicType *type);
+
+    TIntermTyped *addBinaryMathInternal(TOperator op, TIntermTyped *left, TIntermTyped *right,
+        const TSourceLoc &amp;loc);
+    TIntermTyped *createAssign(TOperator op, TIntermTyped *left, TIntermTyped *right,
+        const TSourceLoc &amp;loc);
+    // The funcReturnType parameter is expected to be non-null when the operation is a built-in function.
+    // It is expected to be null for other unary operators.
+    TIntermTyped *createUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &amp;loc,
+        const TType *funcReturnType);
+
+    // Return true if the checks pass
+    bool binaryOpCommonCheck(TOperator op, TIntermTyped *left, TIntermTyped *right,
+        const TSourceLoc &amp;loc);
+
+    // Set to true when the last/current declarator list was started with an empty declaration.
+    bool mDeferredSingleDeclarationErrorCheck;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> int PaParseStrings(size_t count, const char* const string[], const int length[],
</span><span class="cx">                    TParseContext* context);
</span><span class="cx"> 
</span><del>-#endif // _PARSER_HELPER_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_PARSECONTEXT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorPoolAlloccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,43 +6,44 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/PoolAlloc.h&quot;
</span><span class="cx"> 
</span><del>-#ifndef _MSC_VER
</del><ins>+#include &quot;compiler/translator/InitializeGlobals.h&quot;
+
+#include &quot;common/platform.h&quot;
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/tls.h&quot;
+
</ins><span class="cx"> #include &lt;stdint.h&gt;
</span><del>-#endif
</del><span class="cx"> #include &lt;stdio.h&gt;
</span><ins>+#include &lt;assert.h&gt;
</ins><span class="cx"> 
</span><del>-#include &quot;common/angleutils.h&quot;
-#include &quot;compiler/translator/InitializeGlobals.h&quot;
-#include &quot;compiler/translator/osinclude.h&quot;
</del><ins>+TLSIndex PoolIndex = TLS_INVALID_INDEX;
</ins><span class="cx"> 
</span><del>-OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
-
</del><span class="cx"> bool InitializePoolIndex()
</span><span class="cx"> {
</span><del>-    assert(PoolIndex == OS_INVALID_TLS_INDEX);
</del><ins>+    assert(PoolIndex == TLS_INVALID_INDEX);
</ins><span class="cx"> 
</span><del>-    PoolIndex = OS_AllocTLSIndex();
-    return PoolIndex != OS_INVALID_TLS_INDEX;
</del><ins>+    PoolIndex = CreateTLSIndex();
+    return PoolIndex != TLS_INVALID_INDEX;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FreePoolIndex()
</span><span class="cx"> {
</span><del>-    assert(PoolIndex != OS_INVALID_TLS_INDEX);
</del><ins>+    assert(PoolIndex != TLS_INVALID_INDEX);
</ins><span class="cx"> 
</span><del>-    OS_FreeTLSIndex(PoolIndex);
-    PoolIndex = OS_INVALID_TLS_INDEX;
</del><ins>+    DestroyTLSIndex(PoolIndex);
+    PoolIndex = TLS_INVALID_INDEX;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TPoolAllocator* GetGlobalPoolAllocator()
</span><span class="cx"> {
</span><del>-    assert(PoolIndex != OS_INVALID_TLS_INDEX);
-    return static_cast&lt;TPoolAllocator*&gt;(OS_GetTLSValue(PoolIndex));
</del><ins>+    assert(PoolIndex != TLS_INVALID_INDEX);
+    return static_cast&lt;TPoolAllocator*&gt;(GetTLSValue(PoolIndex));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator)
</span><span class="cx"> {
</span><del>-    assert(PoolIndex != OS_INVALID_TLS_INDEX);
-    OS_SetTLSValue(PoolIndex, poolAllocator);
</del><ins>+    assert(PoolIndex != TLS_INVALID_INDEX);
+    SetTLSValue(PoolIndex, poolAllocator);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorPoolAlloch"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PoolAlloc.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _POOLALLOC_INCLUDED_
-#define _POOLALLOC_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_POOLALLOC_H_
+#define COMPILER_TRANSLATOR_POOLALLOC_H_
</ins><span class="cx"> 
</span><span class="cx"> #ifdef _DEBUG
</span><span class="cx"> #define GUARD_BLOCKS  // define to enable guard block sanity checking
</span><span class="lines">@@ -297,4 +297,4 @@
</span><span class="cx">     TPoolAllocator* allocator;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // _POOLALLOC_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_POOLALLOC_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorPragmah"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Pragma.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Pragma.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Pragma.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,16 +4,29 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_PRAGMA_H_
-#define COMPILER_PRAGMA_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_PRAGMA_H_
+#define COMPILER_TRANSLATOR_PRAGMA_H_
</ins><span class="cx"> 
</span><del>-struct TPragma {
</del><ins>+struct TPragma
+{
+    struct STDGL
+    {
+        STDGL() : invariantAll(false) { }
+
+        bool invariantAll;
+    };
+
+
</ins><span class="cx">     // By default optimization is turned on and debug is turned off.
</span><del>-    TPragma() : optimize(true), debug(false) { }
-    TPragma(bool o, bool d) : optimize(o), debug(d) { }
</del><ins>+    // Precision emulation is turned on by default, but has no effect unless
+    // the extension is enabled.
+    TPragma() : optimize(true), debug(false), debugShaderPrecision(true) { }
+    TPragma(bool o, bool d) : optimize(o), debug(d), debugShaderPrecision(true) { }
</ins><span class="cx"> 
</span><span class="cx">     bool optimize;
</span><span class="cx">     bool debug;
</span><ins>+    bool debugShaderPrecision;
+    STDGL stdgl;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // COMPILER_PRAGMA_H_
</del><ins>+#endif // COMPILER_TRANSLATOR_PRAGMA_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorPruneEmptyDeclarationscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The PruneEmptyDeclarations function prunes unnecessary empty declarations and declarators from the AST.
+
+#include &quot;compiler/translator/PruneEmptyDeclarations.h&quot;
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+namespace
+{
+
+class PruneEmptyDeclarationsTraverser : private TIntermTraverser
+{
+  public:
+    static void apply(TIntermNode *root);
+  private:
+    PruneEmptyDeclarationsTraverser();
+    bool visitAggregate(Visit, TIntermAggregate *node) override;
+};
+
+void PruneEmptyDeclarationsTraverser::apply(TIntermNode *root)
+{
+    PruneEmptyDeclarationsTraverser prune;
+    root-&gt;traverse(&amp;prune);
+    prune.updateTree();
+}
+
+PruneEmptyDeclarationsTraverser::PruneEmptyDeclarationsTraverser()
+    : TIntermTraverser(true, false, false)
+{
+}
+
+bool PruneEmptyDeclarationsTraverser::visitAggregate(Visit, TIntermAggregate *node)
+{
+    if (node-&gt;getOp() == EOpDeclaration)
+    {
+        TIntermSequence *sequence = node-&gt;getSequence();
+        if (sequence-&gt;size() &gt;= 1)
+        {
+            TIntermSymbol *sym = sequence-&gt;front()-&gt;getAsSymbolNode();
+            // Prune declarations without a variable name, unless it's an interface block declaration.
+            if (sym != nullptr &amp;&amp; sym-&gt;getSymbol() == &quot;&quot; &amp;&amp; !sym-&gt;isInterfaceBlock())
+            {
+                if (sequence-&gt;size() &gt; 1)
+                {
+                    // Generate a replacement that will remove the empty declarator in the beginning of a declarator
+                    // list. Example of a declaration that will be changed:
+                    // float, a;
+                    // will be changed to
+                    // float a;
+                    // This applies also to struct declarations.
+                    TIntermSequence emptyReplacement;
+                    mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(node, sym, emptyReplacement));
+                }
+                else if (sym-&gt;getBasicType() != EbtStruct)
+                {
+                    // Single struct declarations may just declare the struct type and no variables, so they should
+                    // not be pruned. All other single empty declarations can be pruned entirely. Example of an empty
+                    // declaration that will be pruned:
+                    // float;
+                    TIntermSequence emptyReplacement;
+                    TIntermAggregate *parentAgg = getParentNode()-&gt;getAsAggregate();
+                    ASSERT(parentAgg != nullptr);
+                    mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(parentAgg, node, emptyReplacement));
+                }
+            }
+        }
+        return false;
+    }
+    return true;
+}
+
+} // namespace
+
+void PruneEmptyDeclarations(TIntermNode *root)
+{
+    PruneEmptyDeclarationsTraverser::apply(root);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorPruneEmptyDeclarationsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/PruneEmptyDeclarations.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The PruneEmptyDeclarations function prunes unnecessary empty declarations and declarators from the AST.
+
+#ifndef COMPILER_TRANSLATOR_PRUNEEMPTYDECLARATIONS_H_
+#define COMPILER_TRANSLATOR_PRUNEEMPTYDECLARATIONS_H_
+
+class TIntermNode;
+
+void PruneEmptyDeclarations(TIntermNode *root);
+
+#endif  // COMPILER_TRANSLATOR_PRUNEEMPTYDECLARATIONS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorQualifierAlivecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> class TAliveTraverser : public TIntermTraverser {
</span><span class="cx"> public:
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx">         found = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TAliveTraverser::visitSelection(Visit preVisit, TIntermSelection* node)
</del><ins>+bool TAliveTraverser::visitSelection(Visit, TIntermSelection*)
</ins><span class="cx"> {
</span><span class="cx">     if (wasFound())
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorQualifierAliveh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/QualifierAlive.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,4 +4,9 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><ins>+#ifndef COMPILER_TRANSLATOR_QUALIFIERALIVE_H_
+#define COMPILER_TRANSLATOR_QUALIFIERALIVE_H_
+
</ins><span class="cx"> bool QualifierWritten(TIntermNode* root, TQualifier);
</span><ins>+
+#endif // COMPILER_TRANSLATOR_QUALIFIERALIVE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRegenerateStructNamescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;common/debug.h&quot;
+#include &quot;compiler/translator/RegenerateStructNames.h&quot;
+
+void RegenerateStructNames::visitSymbol(TIntermSymbol *symbol)
+{
+    ASSERT(symbol);
+    TType *type = symbol-&gt;getTypePointer();
+    ASSERT(type);
+    TStructure *userType = type-&gt;getStruct();
+    if (!userType)
+        return;
+
+    if (mSymbolTable.findBuiltIn(userType-&gt;name(), mShaderVersion))
+    {
+        // Built-in struct, do not touch it.
+        return;
+    }
+
+    int uniqueId = userType-&gt;uniqueId();
+
+    ASSERT(mScopeDepth &gt; 0);
+    if (mScopeDepth == 1)
+    {
+        // If a struct is defined at global scope, we don't map its name.
+        // This is because at global level, the struct might be used to
+        // declare a uniform, so the same name needs to stay the same for
+        // vertex/fragment shaders. However, our mapping uses internal ID,
+        // which will be different for the same struct in vertex/fragment
+        // shaders.
+        // This is OK because names for any structs defined in other scopes
+        // will begin with &quot;_webgl&quot;, which is reserved. So there will be
+        // no conflicts among unmapped struct names from global scope and
+        // mapped struct names from other scopes.
+        // However, we need to keep track of these global structs, so if a
+        // variable is used in a local scope, we don't try to modify the
+        // struct name through that variable.
+        mDeclaredGlobalStructs.insert(uniqueId);
+        return;
+    }
+    if (mDeclaredGlobalStructs.count(uniqueId) &gt; 0)
+        return;
+    // Map {name} to _webgl_struct_{uniqueId}_{name}.
+    const char kPrefix[] = &quot;_webgl_struct_&quot;;
+    if (userType-&gt;name().find(kPrefix) == 0)
+    {
+        // The name has already been regenerated.
+        return;
+    }
+    std::string id = Str(uniqueId);
+    TString tmp = kPrefix + TString(id.c_str());
+    tmp += &quot;_&quot; + userType-&gt;name();
+    userType-&gt;setName(tmp);
+}
+
+bool RegenerateStructNames::visitAggregate(Visit, TIntermAggregate *aggregate)
+{
+    ASSERT(aggregate);
+    switch (aggregate-&gt;getOp())
+    {
+      case EOpSequence:
+        ++mScopeDepth;
+        {
+            TIntermSequence &amp;sequence = *(aggregate-&gt;getSequence());
+            for (size_t ii = 0; ii &lt; sequence.size(); ++ii)
+            {
+                TIntermNode *node = sequence[ii];
+                ASSERT(node != NULL);
+                node-&gt;traverse(this);
+            }
+        }
+        --mScopeDepth;
+        return false;
+      default:
+        return true;
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRegenerateStructNamesh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RegenerateStructNames.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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_TRANSLATOR_REGENERATESTRUCTNAMES_H_
+#define COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
+
+#include &quot;compiler/translator/intermediate.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
+
+#include &lt;set&gt;
+
+class RegenerateStructNames : public TIntermTraverser
+{
+  public:
+    RegenerateStructNames(const TSymbolTable &amp;symbolTable,
+                          int shaderVersion)
+        : mSymbolTable(symbolTable),
+          mShaderVersion(shaderVersion),
+          mScopeDepth(0) {}
+
+  protected:
+    virtual void visitSymbol(TIntermSymbol *);
+    virtual bool visitAggregate(Visit, TIntermAggregate *);
+
+  private:
+    const TSymbolTable &amp;mSymbolTable;
+    int mShaderVersion;
+
+    // Indicating the depth of the current scope.
+    // The global scope is 1.
+    int mScopeDepth;
+
+    // If a struct's declared globally, push its ID in this set.
+    std::set&lt;int&gt; mDeclaredGlobalStructs;
+};
+
+#endif  // COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveSwitchFallThroughcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,157 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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 &quot;compiler/translator/RemoveSwitchFallThrough.h&quot;
+
+TIntermAggregate *RemoveSwitchFallThrough::removeFallThrough(TIntermAggregate *statementList)
+{
+    RemoveSwitchFallThrough rm(statementList);
+    ASSERT(statementList);
+    statementList-&gt;traverse(&amp;rm);
+    bool lastStatementWasBreak = rm.mLastStatementWasBreak;
+    rm.mLastStatementWasBreak = true;
+    rm.handlePreviousCase();
+    if (!lastStatementWasBreak)
+    {
+        TIntermBranch *finalBreak = new TIntermBranch(EOpBreak, nullptr);
+        rm.mStatementListOut-&gt;getSequence()-&gt;push_back(finalBreak);
+    }
+    return rm.mStatementListOut;
+}
+
+RemoveSwitchFallThrough::RemoveSwitchFallThrough(TIntermAggregate *statementList)
+    : TIntermTraverser(true, false, false),
+      mStatementList(statementList),
+      mLastStatementWasBreak(false),
+      mPreviousCase(nullptr)
+{
+    mStatementListOut = new TIntermAggregate();
+    mStatementListOut-&gt;setOp(EOpSequence);
+}
+
+void RemoveSwitchFallThrough::visitSymbol(TIntermSymbol *node)
+{
+    // Note that this assumes that switch statements which don't begin by a case statement
+    // have already been weeded out in validation.
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    mLastStatementWasBreak = false;
+}
+
+void RemoveSwitchFallThrough::visitConstantUnion(TIntermConstantUnion *node)
+{
+    // Conditions of case labels are not traversed, so this is some other constant
+    // Could be just a statement like &quot;0;&quot;
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    mLastStatementWasBreak = false;
+}
+
+bool RemoveSwitchFallThrough::visitBinary(Visit, TIntermBinary *node)
+{
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    mLastStatementWasBreak = false;
+    return false;
+}
+
+bool RemoveSwitchFallThrough::visitUnary(Visit, TIntermUnary *node)
+{
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    mLastStatementWasBreak = false;
+    return false;
+}
+
+bool RemoveSwitchFallThrough::visitSelection(Visit, TIntermSelection *node)
+{
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    mLastStatementWasBreak = false;
+    return false;
+}
+
+bool RemoveSwitchFallThrough::visitSwitch(Visit, TIntermSwitch *node)
+{
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    mLastStatementWasBreak = false;
+    // Don't go into nested switch statements
+    return false;
+}
+
+void RemoveSwitchFallThrough::outputSequence(TIntermSequence *sequence, size_t startIndex)
+{
+    for (size_t i = startIndex; i &lt; sequence-&gt;size(); ++i)
+    {
+        mStatementListOut-&gt;getSequence()-&gt;push_back(sequence-&gt;at(i));
+    }
+}
+
+void RemoveSwitchFallThrough::handlePreviousCase()
+{
+    if (mPreviousCase)
+        mCasesSharingBreak.push_back(mPreviousCase);
+    if (mLastStatementWasBreak)
+    {
+        bool labelsWithNoStatements = true;
+        for (size_t i = 0; i &lt; mCasesSharingBreak.size(); ++i)
+        {
+            if (mCasesSharingBreak.at(i)-&gt;getSequence()-&gt;size() &gt; 1)
+            {
+                labelsWithNoStatements = false;
+            }
+            if (labelsWithNoStatements)
+            {
+                // Fall-through is allowed in case the label has no statements.
+                outputSequence(mCasesSharingBreak.at(i)-&gt;getSequence(), 0);
+            }
+            else
+            {
+                // Include all the statements that this case can fall through under the same label.
+                for (size_t j = i; j &lt; mCasesSharingBreak.size(); ++j)
+                {
+                    size_t startIndex = j &gt; i ? 1 : 0; // Add the label only from the first sequence.
+                    outputSequence(mCasesSharingBreak.at(j)-&gt;getSequence(), startIndex);
+
+                }
+            }
+        }
+        mCasesSharingBreak.clear();
+    }
+    mLastStatementWasBreak = false;
+    mPreviousCase = nullptr;
+}
+
+bool RemoveSwitchFallThrough::visitCase(Visit, TIntermCase *node)
+{
+    handlePreviousCase();
+    mPreviousCase = new TIntermAggregate();
+    mPreviousCase-&gt;setOp(EOpSequence);
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    // Don't traverse the condition of the case statement
+    return false;
+}
+
+bool RemoveSwitchFallThrough::visitAggregate(Visit, TIntermAggregate *node)
+{
+    if (node != mStatementList)
+    {
+        mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+        mLastStatementWasBreak = false;
+        return false;
+    }
+    return true;
+}
+
+bool RemoveSwitchFallThrough::visitLoop(Visit, TIntermLoop *node)
+{
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    mLastStatementWasBreak = false;
+    return false;
+}
+
+bool RemoveSwitchFallThrough::visitBranch(Visit, TIntermBranch *node)
+{
+    mPreviousCase-&gt;getSequence()-&gt;push_back(node);
+    // TODO: Verify that accepting return or continue statements here doesn't cause problems.
+    mLastStatementWasBreak = true;
+    return false;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveSwitchFallThroughh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_
+#define COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+class RemoveSwitchFallThrough : public TIntermTraverser
+{
+  public:
+    // When given a statementList from a switch AST node, return an updated
+    // statementList that has fall-through removed.
+    static TIntermAggregate *removeFallThrough(TIntermAggregate *statementList);
+
+  private:
+    RemoveSwitchFallThrough(TIntermAggregate *statementList);
+
+    void visitSymbol(TIntermSymbol *node) override;
+    void visitConstantUnion(TIntermConstantUnion *node) override;
+    bool visitBinary(Visit, TIntermBinary *node) override;
+    bool visitUnary(Visit, TIntermUnary *node) override;
+    bool visitSelection(Visit visit, TIntermSelection *node) override;
+    bool visitSwitch(Visit, TIntermSwitch *node) override;
+    bool visitCase(Visit, TIntermCase *node) override;
+    bool visitAggregate(Visit, TIntermAggregate *node) override;
+    bool visitLoop(Visit, TIntermLoop *node) override;
+    bool visitBranch(Visit, TIntermBranch *node) override;
+
+    void outputSequence(TIntermSequence *sequence, size_t startIndex);
+    void handlePreviousCase();
+
+    TIntermAggregate *mStatementList;
+    TIntermAggregate *mStatementListOut;
+    bool mLastStatementWasBreak;
+    TIntermAggregate *mPreviousCase;
+    std::vector&lt;TIntermAggregate *&gt; mCasesSharingBreak;
+};
+
+#endif // COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveTreecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,29 +0,0 @@
</span><del>-//
-// 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.
-//
-
-#include &quot;compiler/translator/intermediate.h&quot;
-#include &quot;compiler/translator/RemoveTree.h&quot;
-
-//
-// Code to delete the intermediate tree.
-//
-void RemoveAllTreeNodes(TIntermNode* root)
-{
-    std::queue&lt;TIntermNode*&gt; nodeQueue;
-
-    nodeQueue.push(root);
-
-    while (!nodeQueue.empty())
-    {
-        TIntermNode *node = nodeQueue.front();
-        nodeQueue.pop();
-
-        node-&gt;enqueueChildren(&amp;nodeQueue);
-
-        delete node;
-    }
-}
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRemoveTreeh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RemoveTree.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,7 +0,0 @@
</span><del>-//
-// 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.
-//
-
-void RemoveAllTreeNodes(TIntermNode*);
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRenameFunctionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RenameFunction.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RenameFunction.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RenameFunction.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_RENAME_FUNCTION
-#define COMPILER_RENAME_FUNCTION
</del><ins>+#ifndef COMPILER_TRANSLATOR_RENAMEFUNCTION_H_
+#define COMPILER_TRANSLATOR_RENAMEFUNCTION_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Renames a function, including its declaration and any calls to it.
</span><span class="lines">@@ -33,4 +33,4 @@
</span><span class="cx">     const TString mNewFunctionName;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_RENAME_FUNCTION
</del><ins>+#endif  // COMPILER_TRANSLATOR_RENAMEFUNCTION_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRewriteElseBlockscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -14,10 +14,30 @@
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="cx"> 
</span><ins>+namespace
+{
+
+class ElseBlockRewriter : public TIntermTraverser
+{
+  public:
+    ElseBlockRewriter();
+
+  protected:
+    bool visitAggregate(Visit visit, TIntermAggregate *aggregate);
+
+  private:
+    int mTemporaryIndex;
+    const TType *mFunctionType;
+
+    TIntermNode *rewriteSelection(TIntermSelection *selection);
+};
+
</ins><span class="cx"> TIntermSymbol *MakeNewTemporary(const TString &amp;name, TBasicType type)
</span><span class="cx"> {
</span><del>-    TType variableType(type, EbpHigh, EvqInternal);
-    return new TIntermSymbol(-1, name, variableType);
</del><ins>+    TType variableType(type, EbpHigh, EvqTemporary);
+    TIntermSymbol *node = new TIntermSymbol(-1, name, variableType);
+    node-&gt;setInternal(true);
+    return node;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TIntermBinary *MakeNewBinary(TOperator op, TIntermTyped *left, TIntermTyped *right, const TType &amp;resultType)
</span><span class="lines">@@ -36,25 +56,45 @@
</span><span class="cx">     return unary;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ElseBlockRewriter::ElseBlockRewriter()
+    : TIntermTraverser(true, false, true, false),
+      mTemporaryIndex(0),
+      mFunctionType(NULL)
+{}
+
</ins><span class="cx"> bool ElseBlockRewriter::visitAggregate(Visit visit, TIntermAggregate *node)
</span><span class="cx"> {
</span><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><span class="cx">       case EOpSequence:
</span><ins>+        if (visit == PostVisit)
</ins><span class="cx">         {
</span><del>-            for (size_t statementIndex = 0; statementIndex != node-&gt;getSequence().size(); statementIndex++)
</del><ins>+            for (size_t statementIndex = 0; statementIndex != node-&gt;getSequence()-&gt;size(); statementIndex++)
</ins><span class="cx">             {
</span><del>-                TIntermNode *statement = node-&gt;getSequence()[statementIndex];
</del><ins>+                TIntermNode *statement = (*node-&gt;getSequence())[statementIndex];
</ins><span class="cx">                 TIntermSelection *selection = statement-&gt;getAsSelectionNode();
</span><span class="cx">                 if (selection &amp;&amp; selection-&gt;getFalseBlock() != NULL)
</span><span class="cx">                 {
</span><del>-                    node-&gt;getSequence()[statementIndex] = rewriteSelection(selection);
</del><ins>+                    // Check for if / else if
+                    TIntermSelection *elseIfBranch = selection-&gt;getFalseBlock()-&gt;getAsSelectionNode();
+                    if (elseIfBranch)
+                    {
+                        selection-&gt;replaceChildNode(elseIfBranch, rewriteSelection(elseIfBranch));
+                        delete elseIfBranch;
+                    }
+
+                    (*node-&gt;getSequence())[statementIndex] = rewriteSelection(selection);
</ins><span class="cx">                     delete selection;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx"> 
</span><ins>+      case EOpFunction:
+        // Store the current function context (see comment below)
+        mFunctionType = ((visit == PreVisit) ? &amp;node-&gt;getType() : NULL);
+        break;
+
</ins><span class="cx">       default: break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -63,32 +103,54 @@
</span><span class="cx"> 
</span><span class="cx"> TIntermNode *ElseBlockRewriter::rewriteSelection(TIntermSelection *selection)
</span><span class="cx"> {
</span><del>-    ASSERT(selection-&gt;getFalseBlock() != NULL);
</del><ins>+    ASSERT(selection != NULL);
</ins><span class="cx"> 
</span><span class="cx">     TString temporaryName = &quot;cond_&quot; + str(mTemporaryIndex++);
</span><span class="cx">     TIntermTyped *typedCondition = selection-&gt;getCondition()-&gt;getAsTyped();
</span><span class="cx">     TType resultType(EbtBool, EbpUndefined);
</span><del>-    TIntermSymbol *conditionSymbolA = MakeNewTemporary(temporaryName, EbtBool);
-    TIntermSymbol *conditionSymbolB = MakeNewTemporary(temporaryName, EbtBool);
-    TIntermSymbol *conditionSymbolC = MakeNewTemporary(temporaryName, EbtBool);
-    TIntermBinary *storeCondition = MakeNewBinary(EOpInitialize, conditionSymbolA,
</del><ins>+    TIntermSymbol *conditionSymbolInit = MakeNewTemporary(temporaryName, EbtBool);
+    TIntermBinary *storeCondition = MakeNewBinary(EOpInitialize, conditionSymbolInit,
</ins><span class="cx">                                                   typedCondition, resultType);
</span><del>-    TIntermUnary *negatedCondition = MakeNewUnary(EOpLogicalNot, conditionSymbolB);
-    TIntermSelection *falseBlock = new TIntermSelection(negatedCondition,
-                                                        selection-&gt;getFalseBlock(), NULL);
-    TIntermSelection *newIfElse = new TIntermSelection(conditionSymbolC,
-                                                       selection-&gt;getTrueBlock(), falseBlock);
</del><ins>+    TIntermNode *negatedElse = NULL;
</ins><span class="cx"> 
</span><ins>+    TIntermSelection *falseBlock = NULL;
+
+    if (selection-&gt;getFalseBlock())
+    {
+        // crbug.com/346463
+        // D3D generates error messages claiming a function has no return value, when rewriting
+        // an if-else clause that returns something non-void in a function. By appending dummy
+        // returns (that are unreachable) we can silence this compile error.
+        if (mFunctionType &amp;&amp; mFunctionType-&gt;getBasicType() != EbtVoid)
+        {
+            TString typeString = mFunctionType-&gt;getStruct() ? mFunctionType-&gt;getStruct()-&gt;name() :
+                mFunctionType-&gt;getBasicString();
+            TString rawText = &quot;return (&quot; + typeString + &quot;)0&quot;;
+            negatedElse = new TIntermRaw(*mFunctionType, rawText);
+        }
+
+        TIntermSymbol *conditionSymbolElse = MakeNewTemporary(temporaryName, EbtBool);
+        TIntermUnary *negatedCondition = MakeNewUnary(EOpLogicalNot, conditionSymbolElse);
+        falseBlock = new TIntermSelection(negatedCondition,
+                                          selection-&gt;getFalseBlock(), negatedElse);
+    }
+
+    TIntermSymbol *conditionSymbolSel = MakeNewTemporary(temporaryName, EbtBool);
+    TIntermSelection *newSelection = new TIntermSelection(conditionSymbolSel,
+                                                          selection-&gt;getTrueBlock(), falseBlock);
+
</ins><span class="cx">     TIntermAggregate *declaration = new TIntermAggregate(EOpDeclaration);
</span><del>-    declaration-&gt;getSequence().push_back(storeCondition);
</del><ins>+    declaration-&gt;getSequence()-&gt;push_back(storeCondition);
</ins><span class="cx"> 
</span><span class="cx">     TIntermAggregate *block = new TIntermAggregate(EOpSequence);
</span><del>-    block-&gt;getSequence().push_back(declaration);
-    block-&gt;getSequence().push_back(newIfElse);
</del><ins>+    block-&gt;getSequence()-&gt;push_back(declaration);
+    block-&gt;getSequence()-&gt;push_back(newSelection);
</ins><span class="cx"> 
</span><span class="cx">     return block;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+}
+
</ins><span class="cx"> void RewriteElseBlocks(TIntermNode *node)
</span><span class="cx"> {
</span><span class="cx">     ElseBlockRewriter rewriter;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorRewriteElseBlocksh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/RewriteElseBlocks.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -7,33 +7,16 @@
</span><span class="cx"> //   all if-else blocks to if-if blocks.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_REWRITE_ELSE_BLOCKS_H_
-#define COMPILER_REWRITE_ELSE_BLOCKS_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_
+#define COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span><span class="cx"> 
</span><del>-class ElseBlockRewriter : public TIntermTraverser
-{
-  public:
-      ElseBlockRewriter()
-          : TIntermTraverser(false, false, true, false)
-          , mTemporaryIndex(0)
-      {}
-
-  protected:
-    bool visitAggregate(Visit visit, TIntermAggregate *aggregate);
-
-  private:
-    int mTemporaryIndex;
-
-    TIntermNode *rewriteSelection(TIntermSelection *selection);
-};
-
</del><span class="cx"> void RewriteElseBlocks(TIntermNode *node);
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif // COMPILER_REWRITE_ELSE_BLOCKS_H_
</del><ins>+#endif // COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorScalarizeVecAndMatConstructorArgscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,277 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;common/debug.h&quot;
+#include &quot;compiler/translator/ScalarizeVecAndMatConstructorArgs.h&quot;
+
+#include &lt;algorithm&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/angleutils.h&quot;
+
+namespace
+{
+
+bool ContainsMatrixNode(const TIntermSequence &amp;sequence)
+{
+    for (size_t ii = 0; ii &lt; sequence.size(); ++ii)
+    {
+        TIntermTyped *node = sequence[ii]-&gt;getAsTyped();
+        if (node &amp;&amp; node-&gt;isMatrix())
+            return true;
+    }
+    return false;
+}
+
+bool ContainsVectorNode(const TIntermSequence &amp;sequence)
+{
+    for (size_t ii = 0; ii &lt; sequence.size(); ++ii)
+    {
+        TIntermTyped *node = sequence[ii]-&gt;getAsTyped();
+        if (node &amp;&amp; node-&gt;isVector())
+            return true;
+    }
+    return false;
+}
+
+TIntermConstantUnion *ConstructIndexNode(int index)
+{
+    TConstantUnion *u = new TConstantUnion[1];
+    u[0].setIConst(index);
+
+    TType type(EbtInt, EbpUndefined, EvqConst, 1);
+    TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
+    return node;
+}
+
+TIntermBinary *ConstructVectorIndexBinaryNode(TIntermSymbol *symbolNode, int index)
+{
+    TIntermBinary *binary = new TIntermBinary(EOpIndexDirect);
+    binary-&gt;setLeft(symbolNode);
+    TIntermConstantUnion *indexNode = ConstructIndexNode(index);
+    binary-&gt;setRight(indexNode);
+    return binary;
+}
+
+TIntermBinary *ConstructMatrixIndexBinaryNode(
+    TIntermSymbol *symbolNode, int colIndex, int rowIndex)
+{
+    TIntermBinary *colVectorNode =
+        ConstructVectorIndexBinaryNode(symbolNode, colIndex);
+
+    TIntermBinary *binary = new TIntermBinary(EOpIndexDirect);
+    binary-&gt;setLeft(colVectorNode);
+    TIntermConstantUnion *rowIndexNode = ConstructIndexNode(rowIndex);
+    binary-&gt;setRight(rowIndexNode);
+    return binary;
+}
+
+}  // namespace anonymous
+
+bool ScalarizeVecAndMatConstructorArgs::visitAggregate(Visit visit, TIntermAggregate *node)
+{
+    if (visit == PreVisit)
+    {
+        switch (node-&gt;getOp())
+        {
+          case EOpSequence:
+            mSequenceStack.push_back(TIntermSequence());
+            {
+                for (TIntermSequence::const_iterator iter = node-&gt;getSequence()-&gt;begin();
+                     iter != node-&gt;getSequence()-&gt;end(); ++iter)
+                {
+                    TIntermNode *child = *iter;
+                    ASSERT(child != NULL);
+                    child-&gt;traverse(this);
+                    mSequenceStack.back().push_back(child);
+                }
+            }
+            if (mSequenceStack.back().size() &gt; node-&gt;getSequence()-&gt;size())
+            {
+                node-&gt;getSequence()-&gt;clear();
+                *(node-&gt;getSequence()) = mSequenceStack.back();
+            }
+            mSequenceStack.pop_back();
+            return false;
+          case EOpConstructVec2:
+          case EOpConstructVec3:
+          case EOpConstructVec4:
+          case EOpConstructBVec2:
+          case EOpConstructBVec3:
+          case EOpConstructBVec4:
+          case EOpConstructIVec2:
+          case EOpConstructIVec3:
+          case EOpConstructIVec4:
+            if (ContainsMatrixNode(*(node-&gt;getSequence())))
+                scalarizeArgs(node, false, true);
+            break;
+          case EOpConstructMat2:
+          case EOpConstructMat3:
+          case EOpConstructMat4:
+            if (ContainsVectorNode(*(node-&gt;getSequence())))
+                scalarizeArgs(node, true, false);
+            break;
+          default:
+            break;
+        }
+    }
+    return true;
+}
+
+void ScalarizeVecAndMatConstructorArgs::scalarizeArgs(
+    TIntermAggregate *aggregate, bool scalarizeVector, bool scalarizeMatrix)
+{
+    ASSERT(aggregate);
+    int size = 0;
+    switch (aggregate-&gt;getOp())
+    {
+      case EOpConstructVec2:
+      case EOpConstructBVec2:
+      case EOpConstructIVec2:
+        size = 2;
+        break;
+      case EOpConstructVec3:
+      case EOpConstructBVec3:
+      case EOpConstructIVec3:
+        size = 3;
+        break;
+      case EOpConstructVec4:
+      case EOpConstructBVec4:
+      case EOpConstructIVec4:
+      case EOpConstructMat2:
+        size = 4;
+        break;
+      case EOpConstructMat3:
+        size = 9;
+        break;
+      case EOpConstructMat4:
+        size = 16;
+        break;
+      default:
+        break;
+    }
+    TIntermSequence *sequence = aggregate-&gt;getSequence();
+    TIntermSequence original(*sequence);
+    sequence-&gt;clear();
+    for (size_t ii = 0; ii &lt; original.size(); ++ii)
+    {
+        ASSERT(size &gt; 0);
+        TIntermTyped *node = original[ii]-&gt;getAsTyped();
+        ASSERT(node);
+        TString varName = createTempVariable(node);
+        if (node-&gt;isScalar())
+        {
+            TIntermSymbol *symbolNode =
+                new TIntermSymbol(-1, varName, node-&gt;getType());
+            sequence-&gt;push_back(symbolNode);
+            size--;
+        }
+        else if (node-&gt;isVector())
+        {
+            if (scalarizeVector)
+            {
+                int repeat = std::min(size, node-&gt;getNominalSize());
+                size -= repeat;
+                for (int index = 0; index &lt; repeat; ++index)
+                {
+                    TIntermSymbol *symbolNode =
+                        new TIntermSymbol(-1, varName, node-&gt;getType());
+                    TIntermBinary *newNode = ConstructVectorIndexBinaryNode(
+                        symbolNode, index);
+                    sequence-&gt;push_back(newNode);
+                }
+            }
+            else
+            {
+                TIntermSymbol *symbolNode =
+                    new TIntermSymbol(-1, varName, node-&gt;getType());
+                sequence-&gt;push_back(symbolNode);
+                size -= node-&gt;getNominalSize();
+            }
+        }
+        else
+        {
+            ASSERT(node-&gt;isMatrix());
+            if (scalarizeMatrix)
+            {
+                int colIndex = 0, rowIndex = 0;
+                int repeat = std::min(size, node-&gt;getCols() * node-&gt;getRows());
+                size -= repeat;
+                while (repeat &gt; 0)
+                {
+                    TIntermSymbol *symbolNode =
+                        new TIntermSymbol(-1, varName, node-&gt;getType());
+                    TIntermBinary *newNode = ConstructMatrixIndexBinaryNode(
+                        symbolNode, colIndex, rowIndex);
+                    sequence-&gt;push_back(newNode);
+                    rowIndex++;
+                    if (rowIndex &gt;= node-&gt;getRows())
+                    {
+                        rowIndex = 0;
+                        colIndex++;
+                    }
+                    repeat--;
+                }
+            }
+            else
+            {
+                TIntermSymbol *symbolNode =
+                    new TIntermSymbol(-1, varName, node-&gt;getType());
+                sequence-&gt;push_back(symbolNode);
+                size -= node-&gt;getCols() * node-&gt;getRows();
+            }
+        }
+    }
+}
+
+TString ScalarizeVecAndMatConstructorArgs::createTempVariable(TIntermTyped *original)
+{
+    TString tempVarName = &quot;_webgl_tmp_&quot;;
+    if (original-&gt;isScalar())
+    {
+        tempVarName += &quot;scalar_&quot;;
+    }
+    else if (original-&gt;isVector())
+    {
+        tempVarName += &quot;vec_&quot;;
+    }
+    else
+    {
+        ASSERT(original-&gt;isMatrix());
+        tempVarName += &quot;mat_&quot;;
+    }
+    tempVarName += Str(mTempVarCount).c_str();
+    mTempVarCount++;
+
+    ASSERT(original);
+    TType type = original-&gt;getType();
+    type.setQualifier(EvqTemporary);
+
+    if (mShaderType == GL_FRAGMENT_SHADER &amp;&amp;
+        type.getBasicType() == EbtFloat &amp;&amp;
+        type.getPrecision() == EbpUndefined)
+    {
+        // We use the highest available precision for the temporary variable
+        // to avoid computing the actual precision using the rules defined
+        // in GLSL ES 1.0 Section 4.5.2.
+        type.setPrecision(mFragmentPrecisionHigh ? EbpHigh : EbpMedium);
+    }
+
+    TIntermBinary *init = new TIntermBinary(EOpInitialize);
+    TIntermSymbol *symbolNode = new TIntermSymbol(-1, tempVarName, type);
+    init-&gt;setLeft(symbolNode);
+    init-&gt;setRight(original);
+    init-&gt;setType(type);
+
+    TIntermAggregate *decl = new TIntermAggregate(EOpDeclaration);
+    decl-&gt;getSequence()-&gt;push_back(init);
+
+    ASSERT(mSequenceStack.size() &gt; 0);
+    TIntermSequence &amp;sequence = mSequenceStack.back();
+    sequence.push_back(decl);
+
+    return tempVarName;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorScalarizeVecAndMatConstructorArgsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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_TRANSLATOR_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
+#define COMPILER_TRANSLATOR_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+class ScalarizeVecAndMatConstructorArgs : public TIntermTraverser
+{
+  public:
+    ScalarizeVecAndMatConstructorArgs(sh::GLenum shaderType,
+                                      bool fragmentPrecisionHigh)
+        : mTempVarCount(0),
+          mShaderType(shaderType),
+          mFragmentPrecisionHigh(fragmentPrecisionHigh) {}
+
+  protected:
+    virtual bool visitAggregate(Visit visit, TIntermAggregate *node);
+
+  private:
+    void scalarizeArgs(TIntermAggregate *aggregate,
+                       bool scalarizeVector, bool scalarizeMatrix);
+
+    // If we have the following code:
+    //   mat4 m(0);
+    //   vec4 v(1, m);
+    // We will rewrite to:
+    //   mat4 m(0);
+    //   mat4 _webgl_tmp_mat_0 = m;
+    //   vec4 v(1, _webgl_tmp_mat_0[0][0], _webgl_tmp_mat_0[0][1], _webgl_tmp_mat_0[0][2]);
+    // This function is to create nodes for &quot;mat4 _webgl_tmp_mat_0 = m;&quot; and insert it to
+    // the code sequence.
+    // Return the temporary variable name.
+    TString createTempVariable(TIntermTyped *original);
+
+    std::vector&lt;TIntermSequence&gt; mSequenceStack;
+    int mTempVarCount;
+
+    sh::GLenum mShaderType;
+    bool mFragmentPrecisionHigh;
+};
+
+#endif  // COMPILER_TRANSLATOR_SCALARIZEVECANDMATCONSTRUCTORARGS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSearchSymbolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -9,7 +9,6 @@
</span><span class="cx"> #include &quot;compiler/translator/SearchSymbol.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><del>-#include &quot;compiler/translator/OutputHLSL.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSearchSymbolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SearchSymbol.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,10 +6,10 @@
</span><span class="cx"> // SearchSymbol is an AST traverser to detect the use of a given symbol name
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_SEARCHSYMBOL_H_
-#define COMPILER_SEARCHSYMBOL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_SEARCHSYMBOL_H_
+#define COMPILER_TRANSLATOR_SEARCHSYMBOL_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="lines">@@ -30,4 +30,4 @@
</span><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif   // COMPILER_SEARCHSYMBOL_H_
</del><ins>+#endif   // COMPILER_TRANSLATOR_SEARCHSYMBOL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateArrayInitializationcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The SeparateArrayInitialization function splits each array initialization into a declaration and an assignment.
+// Example:
+//     type[n] a = initializer;
+// will effectively become
+//     type[n] a;
+//     a = initializer;
+
+#include &quot;compiler/translator/SeparateArrayInitialization.h&quot;
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+namespace
+{
+
+class SeparateArrayInitTraverser : private TIntermTraverser
+{
+  public:
+    static void apply(TIntermNode *root);
+  private:
+    SeparateArrayInitTraverser();
+    bool visitAggregate(Visit, TIntermAggregate *node) override;
+};
+
+void SeparateArrayInitTraverser::apply(TIntermNode *root)
+{
+    SeparateArrayInitTraverser separateInit;
+    root-&gt;traverse(&amp;separateInit);
+    separateInit.updateTree();
+}
+
+SeparateArrayInitTraverser::SeparateArrayInitTraverser()
+    : TIntermTraverser(true, false, false)
+{
+}
+
+bool SeparateArrayInitTraverser::visitAggregate(Visit, TIntermAggregate *node)
+{
+    if (node-&gt;getOp() == EOpDeclaration)
+    {
+        TIntermSequence *sequence = node-&gt;getSequence();
+        TIntermBinary *initNode = sequence-&gt;back()-&gt;getAsBinaryNode();
+        if (initNode != nullptr &amp;&amp; initNode-&gt;getOp() == EOpInitialize)
+        {
+            TIntermTyped *initializer = initNode-&gt;getRight();
+            if (initializer-&gt;isArray())
+            {
+                // We rely on that array declarations have been isolated to single declarations.
+                ASSERT(sequence-&gt;size() == 1);
+                TIntermTyped *symbol = initNode-&gt;getLeft();
+                TIntermAggregate *parentAgg = getParentNode()-&gt;getAsAggregate();
+                ASSERT(parentAgg != nullptr);
+
+                TIntermSequence replacements;
+
+                TIntermAggregate *replacementDeclaration = new TIntermAggregate;
+                replacementDeclaration-&gt;setOp(EOpDeclaration);
+                replacementDeclaration-&gt;getSequence()-&gt;push_back(symbol);
+                replacementDeclaration-&gt;setLine(symbol-&gt;getLine());
+                replacements.push_back(replacementDeclaration);
+
+                TIntermBinary *replacementAssignment = new TIntermBinary(EOpAssign);
+                replacementAssignment-&gt;setLeft(symbol);
+                replacementAssignment-&gt;setRight(initializer);
+                replacementAssignment-&gt;setType(initializer-&gt;getType());
+                replacementAssignment-&gt;setLine(symbol-&gt;getLine());
+                replacements.push_back(replacementAssignment);
+
+                mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(parentAgg, node, replacements));
+            }
+        }
+        return false;
+    }
+    return true;
+}
+
+} // namespace
+
+void SeparateArrayInitialization(TIntermNode *root)
+{
+    SeparateArrayInitTraverser::apply(root);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateArrayInitializationh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateArrayInitialization.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The SeparateArrayInitialization function splits each array initialization into a declaration and an assignment.
+// Example:
+//     type[n] a = initializer;
+// will effectively become
+//     type[n] a;
+//     a = initializer;
+
+#ifndef COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_
+#define COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_
+
+class TIntermNode;
+
+void SeparateArrayInitialization(TIntermNode *root);
+
+#endif  // COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateDeclarationscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The SeparateArrayDeclarations function processes declarations that contain array declarators. Each declarator in
+// such declarations gets its own declaration.
+// This is useful as an intermediate step when initialization needs to be separated from declaration.
+// Example:
+//     int a[1] = int[1](1), b[1] = int[1](2);
+// gets transformed when run through this class into the AST equivalent of:
+//     int a[1] = int[1](1);
+//     int b[1] = int[1](2);
+
+#include &quot;compiler/translator/SeparateDeclarations.h&quot;
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+namespace
+{
+
+class SeparateDeclarations : private TIntermTraverser
+{
+  public:
+    static void apply(TIntermNode *root);
+  private:
+    SeparateDeclarations();
+    bool visitAggregate(Visit, TIntermAggregate *node) override;
+};
+
+void SeparateDeclarations::apply(TIntermNode *root)
+{
+    SeparateDeclarations separateDecl;
+    root-&gt;traverse(&amp;separateDecl);
+    separateDecl.updateTree();
+}
+
+SeparateDeclarations::SeparateDeclarations()
+    : TIntermTraverser(true, false, false)
+{
+}
+
+bool SeparateDeclarations::visitAggregate(Visit, TIntermAggregate *node)
+{
+    if (node-&gt;getOp() == EOpDeclaration)
+    {
+        TIntermSequence *sequence = node-&gt;getSequence();
+        bool sequenceContainsArrays = false;
+        for (size_t ii = 0; ii &lt; sequence-&gt;size(); ++ii)
+        {
+            TIntermTyped *typed = sequence-&gt;at(ii)-&gt;getAsTyped();
+            if (typed != nullptr &amp;&amp; typed-&gt;isArray())
+            {
+                sequenceContainsArrays = true;
+                break;
+            }
+        }
+        if (sequence-&gt;size() &gt; 1 &amp;&amp; sequenceContainsArrays)
+        {
+            TIntermAggregate *parentAgg = getParentNode()-&gt;getAsAggregate();
+            ASSERT(parentAgg != nullptr);
+
+            TIntermSequence replacementDeclarations;
+            for (size_t ii = 0; ii &lt; sequence-&gt;size(); ++ii)
+            {
+                TIntermAggregate *replacementDeclaration = new TIntermAggregate;
+
+                replacementDeclaration-&gt;setOp(EOpDeclaration);
+                replacementDeclaration-&gt;getSequence()-&gt;push_back(sequence-&gt;at(ii));
+                replacementDeclaration-&gt;setLine(sequence-&gt;at(ii)-&gt;getLine());
+                replacementDeclarations.push_back(replacementDeclaration);
+            }
+
+            mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(parentAgg, node, replacementDeclarations));
+        }
+        return false;
+    }
+    return true;
+}
+
+} // namespace
+
+void SeparateArrayDeclarations(TIntermNode *root)
+{
+    SeparateDeclarations::apply(root);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSeparateDeclarationsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SeparateDeclarations.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// The SeparateArrayDeclarations function processes declarations that contain array declarators. Each declarator in
+// such declarations gets its own declaration.
+// This is useful as an intermediate step when initialization needs to be separated from declaration.
+// Example:
+//     int a[1] = int[1](1), b[1] = int[1](2);
+// gets transformed when run through this class into the AST equivalent of:
+//     int a[1] = int[1](1);
+//     int b[1] = int[1](2);
+
+#ifndef COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_
+#define COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_
+
+class TIntermNode;
+
+void SeparateArrayDeclarations(TIntermNode *root);
+
+#endif  // COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorShHandleh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShHandle.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,175 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef _SHHANDLE_INCLUDED_
-#define _SHHANDLE_INCLUDED_
-
-//
-// Machine independent part of the compiler private objects
-// sent as ShHandle to the driver.
-//
-// This should not be included by driver code.
-//
-
-#include &quot;compiler/translator/BuiltInFunctionEmulator.h&quot;
-#include &quot;compiler/translator/ExtensionBehavior.h&quot;
-#include &quot;compiler/translator/HashNames.h&quot;
-#include &quot;compiler/translator/InfoSink.h&quot;
-#include &quot;compiler/translator/SymbolTable.h&quot;
-#include &quot;compiler/translator/VariableInfo.h&quot;
-#include &quot;third_party/compiler/ArrayBoundsClamper.h&quot;
-
-class TCompiler;
-class TDependencyGraph;
-class TranslatorHLSL;
-
-//
-// Helper function to identify specs that are based on the WebGL spec,
-// like the CSS Shaders spec.
-//
-bool IsWebGLBasedSpec(ShShaderSpec spec);
-
-//
-// The base class used to back handles returned to the driver.
-//
-class TShHandleBase {
-public:
-    TShHandleBase();
-    virtual ~TShHandleBase();
-    virtual TCompiler* getAsCompiler() { return 0; }
-    virtual TranslatorHLSL* getAsTranslatorHLSL() { return 0; }
-
-protected:
-    // Memory allocator. Allocates and tracks memory required by the compiler.
-    // Deallocates all memory when compiler is destructed.
-    TPoolAllocator allocator;
-};
-
-//
-// The base class for the machine dependent compiler to derive from
-// for managing object code from the compile.
-//
-class TCompiler : public TShHandleBase {
-public:
-    TCompiler(ShShaderType type, ShShaderSpec spec);
-    virtual ~TCompiler();
-    virtual TCompiler* getAsCompiler() { return this; }
-
-    bool Init(const ShBuiltInResources&amp; resources);
-    bool compile(const char* const shaderStrings[],
-                 size_t numStrings,
-                 int compileOptions);
-
-    // Get results of the last compilation.
-    int getShaderVersion() const { return shaderVersion; }
-    TInfoSink&amp; getInfoSink() { return infoSink; }
-    const TVariableInfoList&amp; getAttribs() const { return attribs; }
-    const TVariableInfoList&amp; getUniforms() const { return uniforms; }
-    const TVariableInfoList&amp; getVaryings() const { return varyings; }
-
-    ShHashFunction64 getHashFunction() const { return hashFunction; }
-    NameMap&amp; getNameMap() { return nameMap; }
-    TSymbolTable&amp; getSymbolTable() { return symbolTable; }
-    ShShaderSpec getShaderSpec() const { return shaderSpec; }
-
-protected:
-    ShShaderType getShaderType() const { return shaderType; }
-    // Initialize symbol-table with built-in symbols.
-    bool InitBuiltInSymbolTable(const ShBuiltInResources&amp; resources);
-    // Clears the results from the previous compilation.
-    void clearResults();
-    // Return true if function recursion is detected or call depth exceeded.
-    bool detectCallDepth(TIntermNode* root, TInfoSink&amp; infoSink, bool limitCallStackDepth);
-    // Returns true if a program has no conflicting or missing fragment outputs
-    bool validateOutputs(TIntermNode* root);
-    // Rewrites a shader's intermediate tree according to the CSS Shaders spec.
-    void rewriteCSSShader(TIntermNode* root);
-    // Returns true if the given shader does not exceed the minimum
-    // functionality mandated in GLSL 1.0 spec Appendix A.
-    bool validateLimitations(TIntermNode* root);
-    // Collect info for all attribs, uniforms, varyings.
-    void collectVariables(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();
-    // Insert statements to initialize varyings without static use in the beginning
-    // of main(). It is to work around a Mac driver where such varyings in a vertex
-    // shader may be optimized out incorrectly at compile time, causing a link failure.
-    // This function should only be applied to vertex shaders.
-    void initializeVaryingsWithoutStaticUse(TIntermNode* root);
-    // Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
-    // It is to work around a Linux driver bug where missing this causes compile failure
-    // while spec says it is allowed.
-    // This function should only be applied to vertex shaders.
-    void initializeGLPosition(TIntermNode* root);
-    // 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.
-    bool enforceVertexShaderTimingRestrictions(TIntermNode* root);
-    // Returns true if the shader does not use sampler dependent values to affect control 
-    // flow or in operations whose time can depend on the input values.
-    bool enforceFragmentShaderTimingRestrictions(const TDependencyGraph&amp; graph);
-    // Return true if the maximum expression complexity is below the limit.
-    bool limitExpressionComplexity(TIntermNode* root);
-    // Get built-in extensions with default behavior.
-    const TExtensionBehavior&amp; getExtensionBehavior() const;
-    // Get the resources set by InitBuiltInSymbolTable
-    const ShBuiltInResources&amp; getResources() const;
-
-    const ArrayBoundsClamper&amp; getArrayBoundsClamper() const;
-    ShArrayIndexClampingStrategy getArrayIndexClampingStrategy() const;
-    const BuiltInFunctionEmulator&amp; getBuiltInFunctionEmulator() const;
-
-private:
-    ShShaderType shaderType;
-    ShShaderSpec shaderSpec;
-
-    int maxUniformVectors;
-    int maxVaryingVectors;
-    int maxExpressionComplexity;
-    int maxCallStackDepth;
-
-    ShBuiltInResources compileResources;
-
-    // Built-in symbol table for the given language, spec, and resources.
-    // It is preserved from compile-to-compile.
-    TSymbolTable symbolTable;
-    // Built-in extensions with default behavior.
-    TExtensionBehavior extensionBehavior;
-    bool fragmentPrecisionHigh;
-
-    ArrayBoundsClamper arrayBoundsClamper;
-    ShArrayIndexClampingStrategy clampingStrategy;
-    BuiltInFunctionEmulator builtInFunctionEmulator;
-
-    // Results of compilation.
-    int shaderVersion;
-    TInfoSink infoSink;  // Output sink.
-    TVariableInfoList attribs;  // Active attributes in the compiled shader.
-    TVariableInfoList uniforms;  // Active uniforms in the compiled shader.
-    TVariableInfoList varyings;  // Varyings in the compiled shader.
-
-    // name hashing.
-    ShHashFunction64 hashFunction;
-    NameMap nameMap;
-};
-
-//
-// This is the interface between the machine independent code
-// and the machine dependent code.
-//
-// The machine dependent code should derive from the classes
-// above. Then Construct*() and Delete*() will create and 
-// destroy the machine dependent objects, which contain the
-// above machine independent information.
-//
-TCompiler* ConstructCompiler(
-    ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
-void DeleteCompiler(TCompiler*);
-
-#endif // _SHHANDLE_INCLUDED_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorShaderLangcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderLang.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -11,61 +11,125 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;GLSLANG/ShaderLang.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;compiler/translator/Compiler.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/InitializeDll.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/length_limits.h&quot;
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
</del><ins>+#ifdef ANGLE_ENABLE_HLSL
</ins><span class="cx"> #include &quot;compiler/translator/TranslatorHLSL.h&quot;
</span><ins>+#endif // ANGLE_ENABLE_HLSL
</ins><span class="cx"> #include &quot;compiler/translator/VariablePacker.h&quot;
</span><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> 
</span><del>-static bool isInitialized = false;
</del><ins>+namespace
+{
</ins><span class="cx"> 
</span><ins>+enum ShaderVariableType
+{
+    SHADERVAR_UNIFORM,
+    SHADERVAR_VARYING,
+    SHADERVAR_ATTRIBUTE,
+    SHADERVAR_OUTPUTVARIABLE,
+    SHADERVAR_INTERFACEBLOCK
+};
+    
+bool isInitialized = false;
+
</ins><span class="cx"> //
</span><span class="cx"> // This is the platform independent interface between an OGL driver
</span><span class="cx"> // and the shading language compiler.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-static bool checkVariableMaxLengths(const ShHandle handle,
-                                    size_t expectedValue)
</del><ins>+template &lt;typename VarT&gt;
+const std::vector&lt;VarT&gt; *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType);
+
+template &lt;&gt;
+const std::vector&lt;sh::Uniform&gt; *GetVariableList(const TCompiler *compiler, ShaderVariableType)
</ins><span class="cx"> {
</span><del>-    size_t activeUniformLimit = 0;
-    ShGetInfo(handle, SH_ACTIVE_UNIFORM_MAX_LENGTH, &amp;activeUniformLimit);
-    size_t activeAttribLimit = 0;
-    ShGetInfo(handle, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &amp;activeAttribLimit);
-    size_t varyingLimit = 0;
-    ShGetInfo(handle, SH_VARYING_MAX_LENGTH, &amp;varyingLimit);
-    return (expectedValue == activeUniformLimit &amp;&amp;
-            expectedValue == activeAttribLimit &amp;&amp;
-            expectedValue == varyingLimit);
</del><ins>+    return &amp;compiler-&gt;getUniforms();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue)
</del><ins>+template &lt;&gt;
+const std::vector&lt;sh::Varying&gt; *GetVariableList(const TCompiler *compiler, ShaderVariableType)
</ins><span class="cx"> {
</span><del>-    size_t mappedNameMaxLength = 0;
-    ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &amp;mappedNameMaxLength);
-    return (expectedValue == mappedNameMaxLength);
</del><ins>+    return &amp;compiler-&gt;getVaryings();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template &lt;&gt;
+const std::vector&lt;sh::Attribute&gt; *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType)
+{
+    return (variableType == SHADERVAR_ATTRIBUTE ?
+        &amp;compiler-&gt;getAttributes() :
+        &amp;compiler-&gt;getOutputVariables());
+}
+
+template &lt;&gt;
+const std::vector&lt;sh::InterfaceBlock&gt; *GetVariableList(const TCompiler *compiler, ShaderVariableType)
+{
+    return &amp;compiler-&gt;getInterfaceBlocks();
+}
+
+template &lt;typename VarT&gt;
+const std::vector&lt;VarT&gt; *GetShaderVariables(const ShHandle handle, ShaderVariableType variableType)
+{
+    if (!handle)
+    {
+        return NULL;
+    }
+
+    TShHandleBase* base = static_cast&lt;TShHandleBase*&gt;(handle);
+    TCompiler* compiler = base-&gt;getAsCompiler();
+    if (!compiler)
+    {
+        return NULL;
+    }
+
+    return GetVariableList&lt;VarT&gt;(compiler, variableType);
+}
+
+TCompiler *GetCompilerFromHandle(ShHandle handle)
+{
+    if (!handle)
+        return NULL;
+    TShHandleBase *base = static_cast&lt;TShHandleBase *&gt;(handle);
+    return base-&gt;getAsCompiler();
+}
+
+#ifdef ANGLE_ENABLE_HLSL
+TranslatorHLSL *GetTranslatorHLSLFromHandle(ShHandle handle)
+{
+    if (!handle)
+        return NULL;
+    TShHandleBase *base = static_cast&lt;TShHandleBase *&gt;(handle);
+    return base-&gt;getAsTranslatorHLSL();
+}
+#endif // ANGLE_ENABLE_HLSL
+
+}  // namespace anonymous
+
</ins><span class="cx"> //
</span><span class="cx"> // Driver must call this first, once, before doing any other compiler operations.
</span><span class="cx"> // Subsequent calls to this function are no-op.
</span><span class="cx"> //
</span><del>-int ShInitialize()
</del><ins>+bool ShInitialize()
</ins><span class="cx"> {
</span><span class="cx">     if (!isInitialized)
</span><span class="cx">     {
</span><span class="cx">         isInitialized = InitProcess();
</span><span class="cx">     }
</span><del>-    return isInitialized ? 1 : 0;
</del><ins>+    return isInitialized;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Cleanup symbol tables
</span><span class="cx"> //
</span><del>-int ShFinalize()
</del><ins>+bool ShFinalize()
</ins><span class="cx"> {
</span><del>-    DetachProcess();
-    isInitialized = false;
-    return 1;
</del><ins>+    if (isInitialized)
+    {
+        DetachProcess();
+        isInitialized = false;
+    }
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><span class="lines">@@ -73,6 +137,9 @@
</span><span class="cx"> //
</span><span class="cx"> void ShInitBuiltInResources(ShBuiltInResources* resources)
</span><span class="cx"> {
</span><ins>+    // Make comparable.
+    memset(resources, 0, sizeof(*resources));
+
</ins><span class="cx">     // Constants.
</span><span class="cx">     resources-&gt;MaxVertexAttribs = 8;
</span><span class="cx">     resources-&gt;MaxVertexUniformVectors = 128;
</span><span class="lines">@@ -90,7 +157,13 @@
</span><span class="cx">     resources-&gt;EXT_draw_buffers = 0;
</span><span class="cx">     resources-&gt;EXT_frag_depth = 0;
</span><span class="cx">     resources-&gt;EXT_shader_texture_lod = 0;
</span><ins>+    resources-&gt;WEBGL_debug_shader_precision = 0;
+    resources-&gt;EXT_shader_framebuffer_fetch = 0;
+    resources-&gt;NV_shader_framebuffer_fetch = 0;
+    resources-&gt;ARM_shader_framebuffer_fetch = 0;
</ins><span class="cx"> 
</span><ins>+    resources-&gt;NV_draw_buffers = 0;
+
</ins><span class="cx">     // Disable highp precision in fragment shader by default.
</span><span class="cx">     resources-&gt;FragmentPrecisionHigh = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -112,7 +185,7 @@
</span><span class="cx"> //
</span><span class="cx"> // Driver calls these to create and destroy compiler objects.
</span><span class="cx"> //
</span><del>-ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
</del><ins>+ShHandle ShConstructCompiler(sh::GLenum type, ShShaderSpec spec,
</ins><span class="cx">                              ShShaderOutput output,
</span><span class="cx">                              const ShBuiltInResources* resources)
</span><span class="cx"> {
</span><span class="lines">@@ -141,287 +214,158 @@
</span><span class="cx">         DeleteCompiler(base-&gt;getAsCompiler());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+const std::string &amp;ShGetBuiltInResourcesString(const ShHandle handle)
+{
+    TCompiler *compiler = GetCompilerFromHandle(handle);
+    ASSERT(compiler);
+    return compiler-&gt;getBuiltInResourcesString();
+}
+
</ins><span class="cx"> //
</span><del>-// Do an actual compile on the given strings.  The result is left 
</del><ins>+// Do an actual compile on the given strings.  The result is left
</ins><span class="cx"> // in the given compile object.
</span><span class="cx"> //
</span><span class="cx"> // Return:  The return value of ShCompile is really boolean, indicating
</span><span class="cx"> // success or failure.
</span><span class="cx"> //
</span><del>-int ShCompile(
</del><ins>+bool ShCompile(
</ins><span class="cx">     const ShHandle handle,
</span><del>-    const char* const shaderStrings[],
</del><ins>+    const char *const shaderStrings[],
</ins><span class="cx">     size_t numStrings,
</span><span class="cx">     int compileOptions)
</span><span class="cx"> {
</span><del>-    if (handle == 0)
-        return 0;
</del><ins>+    TCompiler *compiler = GetCompilerFromHandle(handle);
+    ASSERT(compiler);
</ins><span class="cx"> 
</span><del>-    TShHandleBase* base = reinterpret_cast&lt;TShHandleBase*&gt;(handle);
-    TCompiler* compiler = base-&gt;getAsCompiler();
-    if (compiler == 0)
-        return 0;
-
-    bool success = compiler-&gt;compile(shaderStrings, numStrings, compileOptions);
-    return success ? 1 : 0;
</del><ins>+    return compiler-&gt;compile(shaderStrings, numStrings, compileOptions);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ShGetInfo(const ShHandle handle, ShShaderInfo pname, size_t* params)
</del><ins>+int ShGetShaderVersion(const ShHandle handle)
</ins><span class="cx"> {
</span><del>-    if (!handle || !params)
-        return;
</del><ins>+    TCompiler* compiler = GetCompilerFromHandle(handle);
+    ASSERT(compiler);
+    return compiler-&gt;getShaderVersion();
+}
</ins><span class="cx"> 
</span><del>-    TShHandleBase* base = static_cast&lt;TShHandleBase*&gt;(handle);
-    TCompiler* compiler = base-&gt;getAsCompiler();
-    if (!compiler) return;
-
-    switch(pname)
-    {
-    case SH_INFO_LOG_LENGTH:
-        *params = compiler-&gt;getInfoSink().info.size() + 1;
-        break;
-    case SH_OBJECT_CODE_LENGTH:
-        *params = compiler-&gt;getInfoSink().obj.size() + 1;
-        break;
-    case SH_ACTIVE_UNIFORMS:
-        *params = compiler-&gt;getUniforms().size();
-        break;
-    case SH_ACTIVE_UNIFORM_MAX_LENGTH:
-        *params = 1 + GetGlobalMaxTokenSize(compiler-&gt;getShaderSpec());
-        break;
-    case SH_ACTIVE_ATTRIBUTES:
-        *params = compiler-&gt;getAttribs().size();
-        break;
-    case SH_ACTIVE_ATTRIBUTE_MAX_LENGTH:
-        *params = 1 + GetGlobalMaxTokenSize(compiler-&gt;getShaderSpec());
-        break;
-    case SH_VARYINGS:
-        *params = compiler-&gt;getVaryings().size();
-        break;
-    case SH_VARYING_MAX_LENGTH:
-        *params = 1 + GetGlobalMaxTokenSize(compiler-&gt;getShaderSpec());
-        break;
-    case SH_MAPPED_NAME_MAX_LENGTH:
-        // Use longer length than MAX_SHORTENED_IDENTIFIER_SIZE to
-        // handle array and struct dereferences.
-        *params = 1 + GetGlobalMaxTokenSize(compiler-&gt;getShaderSpec());
-        break;
-    case SH_NAME_MAX_LENGTH:
-        *params = 1 + GetGlobalMaxTokenSize(compiler-&gt;getShaderSpec());
-        break;
-    case SH_HASHED_NAME_MAX_LENGTH:
-        if (compiler-&gt;getHashFunction() == NULL) {
-            *params = 0;
-        } else {
-            // 64 bits hashing output requires 16 bytes for hex 
-            // representation.
-            const char HashedNamePrefix[] = HASHED_NAME_PREFIX;
-            (void)HashedNamePrefix;
-            *params = 16 + sizeof(HashedNamePrefix);
-        }
-        break;
-    case SH_HASHED_NAMES_COUNT:
-        *params = compiler-&gt;getNameMap().size();
-        break;
-    case SH_SHADER_VERSION:
-        *params = compiler-&gt;getShaderVersion();
-        break;
-    default: UNREACHABLE();
-    }
</del><ins>+ShShaderOutput ShGetShaderOutputType(const ShHandle handle)
+{
+    TCompiler* compiler = GetCompilerFromHandle(handle);
+    ASSERT(compiler);
+    return compiler-&gt;getOutputType();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Return any compiler log of messages for the application.
</span><span class="cx"> //
</span><del>-void ShGetInfoLog(const ShHandle handle, char* infoLog)
</del><ins>+const std::string &amp;ShGetInfoLog(const ShHandle handle)
</ins><span class="cx"> {
</span><del>-    if (!handle || !infoLog)
-        return;
</del><ins>+    TCompiler *compiler = GetCompilerFromHandle(handle);
+    ASSERT(compiler);
</ins><span class="cx"> 
</span><del>-    TShHandleBase* base = static_cast&lt;TShHandleBase*&gt;(handle);
-    TCompiler* compiler = base-&gt;getAsCompiler();
-    if (!compiler) return;
-
-    size_t infoLogLength = 0;
-    ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &amp;infoLogLength);
-
-    TInfoSink&amp; infoSink = compiler-&gt;getInfoSink();
-    strncpy(infoLog, infoSink.info.c_str(), infoLogLength);
-    infoLog[infoLogLength - 1] = '\0';
</del><ins>+    TInfoSink &amp;infoSink = compiler-&gt;getInfoSink();
+    return infoSink.info.str();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Return any object code.
</span><span class="cx"> //
</span><del>-void ShGetObjectCode(const ShHandle handle, char* objCode)
</del><ins>+const std::string &amp;ShGetObjectCode(const ShHandle handle)
</ins><span class="cx"> {
</span><del>-    if (!handle || !objCode)
-        return;
</del><ins>+    TCompiler *compiler = GetCompilerFromHandle(handle);
+    ASSERT(compiler);
</ins><span class="cx"> 
</span><del>-    TShHandleBase* base = static_cast&lt;TShHandleBase*&gt;(handle);
-    TCompiler* compiler = base-&gt;getAsCompiler();
-    if (!compiler) return;
</del><ins>+    TInfoSink &amp;infoSink = compiler-&gt;getInfoSink();
+    return infoSink.obj.str();
+}
</ins><span class="cx"> 
</span><del>-    size_t objCodeLength = 0;
-    ShGetInfo(handle, SH_OBJECT_CODE_LENGTH, &amp;objCodeLength);
</del><ins>+const std::map&lt;std::string, std::string&gt; *ShGetNameHashingMap(
+    const ShHandle handle)
+{
+    TCompiler *compiler = GetCompilerFromHandle(handle);
+    ASSERT(compiler);
+    return &amp;(compiler-&gt;getNameMap());
+}
</ins><span class="cx"> 
</span><del>-    TInfoSink&amp; infoSink = compiler-&gt;getInfoSink();
-    strncpy(objCode, infoSink.obj.c_str(), objCodeLength);
-    objCode[objCodeLength - 1] = '\0';
</del><ins>+const std::vector&lt;sh::Uniform&gt; *ShGetUniforms(const ShHandle handle)
+{
+    return GetShaderVariables&lt;sh::Uniform&gt;(handle, SHADERVAR_UNIFORM);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ShGetVariableInfo(const ShHandle handle,
-                       ShShaderInfo varType,
-                       int index,
-                       size_t* length,
-                       int* size,
-                       ShDataType* type,
-                       ShPrecisionType* precision,
-                       int* staticUse,
-                       char* name,
-                       char* mappedName)
</del><ins>+const std::vector&lt;sh::Varying&gt; *ShGetVaryings(const ShHandle handle)
</ins><span class="cx"> {
</span><del>-    if (!handle || !size || !type || !precision || !staticUse || !name)
-        return;
-    ASSERT((varType == SH_ACTIVE_ATTRIBUTES) ||
-           (varType == SH_ACTIVE_UNIFORMS) ||
-           (varType == SH_VARYINGS));
</del><ins>+    return GetShaderVariables&lt;sh::Varying&gt;(handle, SHADERVAR_VARYING);
+}
</ins><span class="cx"> 
</span><del>-    TShHandleBase* base = reinterpret_cast&lt;TShHandleBase*&gt;(handle);
-    TCompiler* compiler = base-&gt;getAsCompiler();
-    if (compiler == 0)
-        return;
</del><ins>+const std::vector&lt;sh::Attribute&gt; *ShGetAttributes(const ShHandle handle)
+{
+    return GetShaderVariables&lt;sh::Attribute&gt;(handle, SHADERVAR_ATTRIBUTE);
+}
</ins><span class="cx"> 
</span><del>-    const TVariableInfoList&amp; varList =
-        varType == SH_ACTIVE_ATTRIBUTES ? compiler-&gt;getAttribs() :
-            (varType == SH_ACTIVE_UNIFORMS ? compiler-&gt;getUniforms() :
-                compiler-&gt;getVaryings());
-    if (index &lt; 0 || index &gt;= static_cast&lt;int&gt;(varList.size()))
-        return;
-
-    const TVariableInfo&amp; varInfo = varList[index];
-    if (length) *length = varInfo.name.size();
-    *size = varInfo.size;
-    *type = varInfo.type;
-    switch (varInfo.precision) {
-    case EbpLow:
-        *precision = SH_PRECISION_LOWP;
-        break;
-    case EbpMedium:
-        *precision = SH_PRECISION_MEDIUMP;
-        break;
-    case EbpHigh:
-        *precision = SH_PRECISION_HIGHP;
-        break;
-    default:
-        // Some types does not support precision, for example, boolean.
-        *precision = SH_PRECISION_UNDEFINED;
-        break;
-    }
-    *staticUse = varInfo.staticUse ? 1 : 0;
-
-    // This size must match that queried by
-    // SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_VARYING_MAX_LENGTH
-    // in ShGetInfo, below.
-    size_t variableLength = 1 + GetGlobalMaxTokenSize(compiler-&gt;getShaderSpec());
-    ASSERT(checkVariableMaxLengths(handle, variableLength));
-    strncpy(name, varInfo.name.c_str(), variableLength);
-    name[variableLength - 1] = 0;
-    if (mappedName) {
-        // This size must match that queried by
-        // SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below.
-        size_t maxMappedNameLength = 1 + GetGlobalMaxTokenSize(compiler-&gt;getShaderSpec());
-        ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength));
-        strncpy(mappedName, varInfo.mappedName.c_str(), maxMappedNameLength);
-        mappedName[maxMappedNameLength - 1] = 0;
-    }
</del><ins>+const std::vector&lt;sh::Attribute&gt; *ShGetOutputVariables(const ShHandle handle)
+{
+    return GetShaderVariables&lt;sh::Attribute&gt;(handle, SHADERVAR_OUTPUTVARIABLE);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ShGetNameHashingEntry(const ShHandle handle,
-                           int index,
-                           char* name,
-                           char* hashedName)
</del><ins>+const std::vector&lt;sh::InterfaceBlock&gt; *ShGetInterfaceBlocks(const ShHandle handle)
</ins><span class="cx"> {
</span><del>-    if (!handle || !name || !hashedName || index &lt; 0)
-        return;
</del><ins>+    return GetShaderVariables&lt;sh::InterfaceBlock&gt;(handle, SHADERVAR_INTERFACEBLOCK);
+}
</ins><span class="cx"> 
</span><del>-    TShHandleBase* base = static_cast&lt;TShHandleBase*&gt;(handle);
-    TCompiler* compiler = base-&gt;getAsCompiler();
-    if (!compiler) return;
-
-    const NameMap&amp; nameMap = compiler-&gt;getNameMap();
-    if (index &gt;= static_cast&lt;int&gt;(nameMap.size()))
-        return;
-
-    NameMap::const_iterator it = nameMap.begin();
-    for (int i = 0; i &lt; index; ++i)
-        ++it;
-
-    size_t len = it-&gt;first.length() + 1;
-    size_t max_len = 0;
-    ShGetInfo(handle, SH_NAME_MAX_LENGTH, &amp;max_len);
-    if (len &gt; max_len) {
-        ASSERT(false);
-        len = max_len;
</del><ins>+bool ShCheckVariablesWithinPackingLimits(
+    int maxVectors, ShVariableInfo *varInfoArray, size_t varInfoArraySize)
+{
+    if (varInfoArraySize == 0)
+        return true;
+    ASSERT(varInfoArray);
+    std::vector&lt;sh::ShaderVariable&gt; variables;
+    for (size_t ii = 0; ii &lt; varInfoArraySize; ++ii)
+    {
+        sh::ShaderVariable var(varInfoArray[ii].type, varInfoArray[ii].size);
+        variables.push_back(var);
</ins><span class="cx">     }
</span><del>-    strncpy(name, it-&gt;first.c_str(), len);
-    // To be on the safe side in case the source is longer than expected.
-    name[len - 1] = '\0';
-
-    len = it-&gt;second.length() + 1;
-    max_len = 0;
-    ShGetInfo(handle, SH_HASHED_NAME_MAX_LENGTH, &amp;max_len);
-    if (len &gt; max_len) {
-        ASSERT(false);
-        len = max_len;
-    }
-    strncpy(hashedName, it-&gt;second.c_str(), len);
-    // To be on the safe side in case the source is longer than expected.
-    hashedName[len - 1] = '\0';
</del><ins>+    VariablePacker packer;
+    return packer.CheckVariablesWithinPackingLimits(maxVectors, variables);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params)
</del><ins>+bool ShGetInterfaceBlockRegister(const ShHandle handle,
+                                 const std::string &amp;interfaceBlockName,
+                                 unsigned int *indexOut)
</ins><span class="cx"> {
</span><del>-    if (!handle || !params)
-        return;
</del><ins>+#ifdef ANGLE_ENABLE_HLSL
+    ASSERT(indexOut);
</ins><span class="cx"> 
</span><del>-    TShHandleBase* base = static_cast&lt;TShHandleBase*&gt;(handle);
-    TranslatorHLSL* translator = base-&gt;getAsTranslatorHLSL();
-    if (!translator) return;
</del><ins>+    TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+    ASSERT(translator);
</ins><span class="cx"> 
</span><del>-    switch(pname)
</del><ins>+    if (!translator-&gt;hasInterfaceBlock(interfaceBlockName))
</ins><span class="cx">     {
</span><del>-    case SH_ACTIVE_UNIFORMS_ARRAY:
-        *params = (void*)&amp;translator-&gt;getUniforms();
-        break;
-    case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY:
-        *params = (void*)&amp;translator-&gt;getInterfaceBlocks();
-        break;
-    case SH_ACTIVE_OUTPUT_VARIABLES_ARRAY:
-        *params = (void*)&amp;translator-&gt;getOutputVariables();
-        break;
-    case SH_ACTIVE_ATTRIBUTES_ARRAY:
-        *params = (void*)&amp;translator-&gt;getAttributes();
-        break;
-    case SH_ACTIVE_VARYINGS_ARRAY:
-        *params = (void*)&amp;translator-&gt;getVaryings();
-        break;
-    default: UNREACHABLE();
</del><ins>+        return false;
</ins><span class="cx">     }
</span><ins>+
+    *indexOut = translator-&gt;getInterfaceBlockRegister(interfaceBlockName);
+    return true;
+#else
+    return false;
+#endif // ANGLE_ENABLE_HLSL
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int ShCheckVariablesWithinPackingLimits(
-    int maxVectors, ShVariableInfo* varInfoArray, size_t varInfoArraySize)
</del><ins>+bool ShGetUniformRegister(const ShHandle handle,
+                          const std::string &amp;uniformName,
+                          unsigned int *indexOut)
</ins><span class="cx"> {
</span><del>-    if (varInfoArraySize == 0)
-        return 1;
-    ASSERT(varInfoArray);
-    TVariableInfoList variables;
-    for (size_t ii = 0; ii &lt; varInfoArraySize; ++ii)
</del><ins>+#ifdef ANGLE_ENABLE_HLSL
+    ASSERT(indexOut);
+    TranslatorHLSL *translator = GetTranslatorHLSLFromHandle(handle);
+    ASSERT(translator);
+
+    if (!translator-&gt;hasUniform(uniformName))
</ins><span class="cx">     {
</span><del>-        TVariableInfo var(varInfoArray[ii].type, varInfoArray[ii].size);
-        variables.push_back(var);
</del><ins>+        return false;
</ins><span class="cx">     }
</span><del>-    VariablePacker packer;
-    return packer.CheckVariablesWithinPackingLimits(maxVectors, variables) ? 1 : 0;
</del><ins>+
+    *indexOut = translator-&gt;getUniformRegister(uniformName);
+    return true;
+#else
+    return false;
+#endif // ANGLE_ENABLE_HLSL
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorShaderVarscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderVars.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderVars.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ShaderVars.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,347 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// ShaderVars.cpp:
+//  Methods for GL variable types (varyings, uniforms, etc)
+//
+
+#include &lt;GLSLANG/ShaderLang.h&gt;
+
+#include &quot;common/debug.h&quot;
+
+namespace sh
+{
+
+namespace
+{
+
+InterpolationType GetNonAuxiliaryInterpolationType(InterpolationType interpolation)
+{
+    return (interpolation == INTERPOLATION_CENTROID ? INTERPOLATION_SMOOTH : interpolation);
+}
+
+}
+// The ES 3.0 spec is not clear on this point, but the ES 3.1 spec, and discussion
+// on Khronos.org, clarifies that a smooth/flat mismatch produces a link error,
+// but auxiliary qualifier mismatch (centroid) does not.
+bool InterpolationTypesMatch(InterpolationType a, InterpolationType b)
+{
+    return (GetNonAuxiliaryInterpolationType(a) == GetNonAuxiliaryInterpolationType(b));
+}
+
+ShaderVariable::ShaderVariable()
+    : type(0),
+      precision(0),
+      arraySize(0),
+      staticUse(false)
+{}
+
+ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn)
+    : type(typeIn),
+      precision(0),
+      arraySize(arraySizeIn),
+      staticUse(false)
+{}
+
+ShaderVariable::~ShaderVariable()
+{}
+
+ShaderVariable::ShaderVariable(const ShaderVariable &amp;other)
+    : type(other.type),
+      precision(other.precision),
+      name(other.name),
+      mappedName(other.mappedName),
+      arraySize(other.arraySize),
+      staticUse(other.staticUse),
+      fields(other.fields),
+      structName(other.structName)
+{}
+
+ShaderVariable &amp;ShaderVariable::operator=(const ShaderVariable &amp;other)
+{
+    type = other.type;
+    precision = other.precision;
+    name = other.name;
+    mappedName = other.mappedName;
+    arraySize = other.arraySize;
+    staticUse = other.staticUse;
+    fields = other.fields;
+    structName = other.structName;
+    return *this;
+}
+
+bool ShaderVariable::operator==(const ShaderVariable &amp;other) const
+{
+    if (type != other.type ||
+        precision != other.precision ||
+        name != other.name ||
+        mappedName != other.mappedName ||
+        arraySize != other.arraySize ||
+        staticUse != other.staticUse ||
+        fields.size() != other.fields.size() ||
+        structName != other.structName)
+    {
+        return false;
+    }
+    for (size_t ii = 0; ii &lt; fields.size(); ++ii)
+    {
+        if (fields[ii] != other.fields[ii])
+            return false;
+    }
+    return true;
+}
+
+bool ShaderVariable::findInfoByMappedName(
+    const std::string &amp;mappedFullName,
+    const ShaderVariable **leafVar, std::string *originalFullName) const
+{
+    ASSERT(leafVar &amp;&amp; originalFullName);
+    // There are three cases:
+    // 1) the top variable is of struct type;
+    // 2) the top variable is an array;
+    // 3) otherwise.
+    size_t pos = mappedFullName.find_first_of(&quot;.[&quot;);
+
+    if (pos == std::string::npos)
+    {
+        // Case 3.
+        if (mappedFullName != this-&gt;mappedName)
+            return false;
+        *originalFullName = this-&gt;name;
+        *leafVar = this;
+        return true;
+    }
+    else
+    {
+        std::string topName = mappedFullName.substr(0, pos);
+        if (topName != this-&gt;mappedName)
+            return false;
+        std::string originalName = this-&gt;name;
+        std::string remaining;
+        if (mappedFullName[pos] == '[')
+        {
+            // Case 2.
+            size_t closePos = mappedFullName.find_first_of(']');
+            if (closePos &lt; pos || closePos == std::string::npos)
+                return false;
+            // Append '[index]'.
+            originalName += mappedFullName.substr(pos, closePos - pos + 1);
+            if (closePos + 1 == mappedFullName.size())
+            {
+                *originalFullName = originalName;
+                *leafVar = this;
+                return true;
+            }
+            else
+            {
+                // In the form of 'a[0].b', so after ']', '.' is expected.
+                if (mappedFullName[closePos + 1]  != '.')
+                    return false;
+                remaining = mappedFullName.substr(closePos + 2);  // Skip &quot;].&quot;
+            }
+        }
+        else
+        {
+            // Case 1.
+            remaining = mappedFullName.substr(pos + 1);  // Skip &quot;.&quot;
+        }
+        for (size_t ii = 0; ii &lt; this-&gt;fields.size(); ++ii)
+        {
+            const ShaderVariable *fieldVar = NULL;
+            std::string originalFieldName;
+            bool found = fields[ii].findInfoByMappedName(
+                remaining, &amp;fieldVar, &amp;originalFieldName);
+            if (found)
+            {
+                *originalFullName = originalName + &quot;.&quot; + originalFieldName;
+                *leafVar = fieldVar;
+                return true;
+            }
+        }
+        return false;
+    }
+}
+
+bool ShaderVariable::isSameVariableAtLinkTime(
+    const ShaderVariable &amp;other, bool matchPrecision) const
+{
+    if (type != other.type)
+        return false;
+    if (matchPrecision &amp;&amp; precision != other.precision)
+        return false;
+    if (name != other.name)
+        return false;
+    ASSERT(mappedName == other.mappedName);
+    if (arraySize != other.arraySize)
+        return false;
+    if (fields.size() != other.fields.size())
+        return false;
+    for (size_t ii = 0; ii &lt; fields.size(); ++ii)
+    {
+        if (!fields[ii].isSameVariableAtLinkTime(other.fields[ii],
+                                                 matchPrecision))
+        {
+            return false;
+        }
+    }
+    if (structName != other.structName)
+        return false;
+    return true;
+}
+
+Uniform::Uniform()
+{}
+
+Uniform::~Uniform()
+{}
+
+Uniform::Uniform(const Uniform &amp;other)
+    : ShaderVariable(other)
+{}
+
+Uniform &amp;Uniform::operator=(const Uniform &amp;other)
+{
+    ShaderVariable::operator=(other);
+    return *this;
+}
+
+bool Uniform::operator==(const Uniform &amp;other) const
+{
+    return ShaderVariable::operator==(other);
+}
+
+bool Uniform::isSameUniformAtLinkTime(const Uniform &amp;other) const
+{
+    return ShaderVariable::isSameVariableAtLinkTime(other, true);
+}
+
+Attribute::Attribute()
+    : location(-1)
+{}
+
+Attribute::~Attribute()
+{}
+
+Attribute::Attribute(const Attribute &amp;other)
+    : ShaderVariable(other),
+      location(other.location)
+{}
+
+Attribute &amp;Attribute::operator=(const Attribute &amp;other)
+{
+    ShaderVariable::operator=(other);
+    location = other.location;
+    return *this;
+}
+
+bool Attribute::operator==(const Attribute &amp;other) const
+{
+    return (ShaderVariable::operator==(other) &amp;&amp;
+            location == other.location);
+}
+
+InterfaceBlockField::InterfaceBlockField()
+    : isRowMajorLayout(false)
+{}
+
+InterfaceBlockField::~InterfaceBlockField()
+{}
+
+InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &amp;other)
+    : ShaderVariable(other),
+      isRowMajorLayout(other.isRowMajorLayout)
+{}
+
+InterfaceBlockField &amp;InterfaceBlockField::operator=(const InterfaceBlockField &amp;other)
+{
+    ShaderVariable::operator=(other);
+    isRowMajorLayout = other.isRowMajorLayout;
+    return *this;
+}
+
+bool InterfaceBlockField::operator==(const InterfaceBlockField &amp;other) const
+{
+    return (ShaderVariable::operator==(other) &amp;&amp;
+            isRowMajorLayout == other.isRowMajorLayout);
+}
+
+bool InterfaceBlockField::isSameInterfaceBlockFieldAtLinkTime(
+    const InterfaceBlockField &amp;other) const
+{
+    return (ShaderVariable::isSameVariableAtLinkTime(other, true) &amp;&amp;
+            isRowMajorLayout == other.isRowMajorLayout);
+}
+
+Varying::Varying()
+    : interpolation(INTERPOLATION_SMOOTH),
+      isInvariant(false)
+{}
+
+Varying::~Varying()
+{}
+
+Varying::Varying(const Varying &amp;other)
+    : ShaderVariable(other),
+      interpolation(other.interpolation),
+      isInvariant(other.isInvariant)
+{}
+
+Varying &amp;Varying::operator=(const Varying &amp;other)
+{
+    ShaderVariable::operator=(other);
+    interpolation = other.interpolation;
+    isInvariant = other.isInvariant;
+    return *this;
+}
+
+bool Varying::operator==(const Varying &amp;other) const
+{
+    return (ShaderVariable::operator==(other) &amp;&amp;
+            interpolation == other.interpolation &amp;&amp;
+            isInvariant == other.isInvariant);
+}
+
+bool Varying::isSameVaryingAtLinkTime(const Varying &amp;other) const
+{
+    return (ShaderVariable::isSameVariableAtLinkTime(other, false) &amp;&amp;
+            interpolation == other.interpolation &amp;&amp;
+            isInvariant == other.isInvariant);
+}
+
+InterfaceBlock::InterfaceBlock()
+    : arraySize(0),
+      layout(BLOCKLAYOUT_PACKED),
+      isRowMajorLayout(false),
+      staticUse(false)
+{}
+
+InterfaceBlock::~InterfaceBlock()
+{}
+
+InterfaceBlock::InterfaceBlock(const InterfaceBlock &amp;other)
+    : name(other.name),
+      mappedName(other.mappedName),
+      instanceName(other.instanceName),
+      arraySize(other.arraySize),
+      layout(other.layout),
+      isRowMajorLayout(other.isRowMajorLayout),
+      staticUse(other.staticUse),
+      fields(other.fields)
+{}
+
+InterfaceBlock &amp;InterfaceBlock::operator=(const InterfaceBlock &amp;other)
+{
+    name = other.name;
+    mappedName = other.mappedName;
+    instanceName = other.instanceName;
+    arraySize = other.arraySize;
+    layout = other.layout;
+    isRowMajorLayout = other.isRowMajorLayout;
+    staticUse = other.staticUse;
+    fields = other.fields;
+    return *this;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSimplifyArrayAssignmentcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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 &quot;compiler/translator/SimplifyArrayAssignment.h&quot;
+
+bool SimplifyArrayAssignment::visitBinary(Visit visit, TIntermBinary *node)
+{
+    switch (node-&gt;getOp())
+    {
+      case EOpAssign:
+        {
+            TIntermNode *parent = getParentNode();
+            if (node-&gt;getLeft()-&gt;isArray() &amp;&amp; parent != nullptr)
+            {
+                TIntermAggregate *parentAgg = parent-&gt;getAsAggregate();
+                if (parentAgg != nullptr &amp;&amp; parentAgg-&gt;getOp() == EOpSequence)
+                {
+                    // This case is fine, the result of the assignment is not used.
+                    break;
+                }
+
+                // The result of the assignment needs to be stored into a temporary variable,
+                // the assignment needs to be replaced with a reference to the temporary variable,
+                // and the temporary variable needs to finally be assigned to the target variable.
+
+                // This also needs to interact correctly with unfolding short circuiting operators.
+                UNIMPLEMENTED();
+            }
+        }
+        break;
+      default:
+        break;
+    }
+    return true;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSimplifyArrayAssignmenth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SimplifyArrayAssignment.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+// SimplifyArrayAssignment is an AST traverser to replace statements where
+// the return value of array assignment is used with statements where
+// the return value of array assignment is not used.
+//
+
+#ifndef COMPILER_TRANSLATOR_SIMPLIFYARRAYASSIGNMENT_H_
+#define COMPILER_TRANSLATOR_SIMPLIFYARRAYASSIGNMENT_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+class SimplifyArrayAssignment : public TIntermTraverser
+{
+  public:
+    SimplifyArrayAssignment() { }
+
+    virtual bool visitBinary(Visit visit, TIntermBinary *node);
+};
+
+#endif  // COMPILER_TRANSLATOR_SIMPLIFYARRAYASSIGNMENT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorStructureHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,504 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// StructureHLSL.cpp:
+//   Definitions of methods for HLSL translation of GLSL structures.
+//
+
+#include &quot;compiler/translator/StructureHLSL.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;compiler/translator/OutputHLSL.h&quot;
+#include &quot;compiler/translator/Types.h&quot;
+#include &quot;compiler/translator/util.h&quot;
+#include &quot;compiler/translator/UtilsHLSL.h&quot;
+
+namespace sh
+{
+
+Std140PaddingHelper::Std140PaddingHelper(const std::map&lt;TString, int&gt; &amp;structElementIndexes,
+                                         unsigned *uniqueCounter)
+    : mPaddingCounter(uniqueCounter),
+      mElementIndex(0),
+      mStructElementIndexes(&amp;structElementIndexes)
+{}
+
+Std140PaddingHelper::Std140PaddingHelper(const Std140PaddingHelper &amp;other)
+    : mPaddingCounter(other.mPaddingCounter),
+      mElementIndex(other.mElementIndex),
+      mStructElementIndexes(other.mStructElementIndexes)
+{}
+
+Std140PaddingHelper &amp;Std140PaddingHelper::operator=(const Std140PaddingHelper &amp;other)
+{
+    mPaddingCounter = other.mPaddingCounter;
+    mElementIndex = other.mElementIndex;
+    mStructElementIndexes = other.mStructElementIndexes;
+    return *this;
+}
+
+TString Std140PaddingHelper::next()
+{
+    unsigned value = (*mPaddingCounter)++;
+    return str(value);
+}
+
+int Std140PaddingHelper::prePadding(const TType &amp;type)
+{
+    if (type.getBasicType() == EbtStruct || type.isMatrix() || type.isArray())
+    {
+        // no padding needed, HLSL will align the field to a new register
+        mElementIndex = 0;
+        return 0;
+    }
+
+    const GLenum glType = GLVariableType(type);
+    const int numComponents = gl::VariableComponentCount(glType);
+
+    if (numComponents &gt;= 4)
+    {
+        // no padding needed, HLSL will align the field to a new register
+        mElementIndex = 0;
+        return 0;
+    }
+
+    if (mElementIndex + numComponents &gt; 4)
+    {
+        // no padding needed, HLSL will align the field to a new register
+        mElementIndex = numComponents;
+        return 0;
+    }
+
+    const int alignment = numComponents == 3 ? 4 : numComponents;
+    const int paddingOffset = (mElementIndex % alignment);
+    const int paddingCount = (paddingOffset != 0 ? (alignment - paddingOffset) : 0);
+
+    mElementIndex += paddingCount;
+    mElementIndex += numComponents;
+    mElementIndex %= 4;
+
+    return paddingCount;
+}
+
+TString Std140PaddingHelper::prePaddingString(const TType &amp;type)
+{
+    int paddingCount = prePadding(type);
+
+    TString padding;
+
+    for (int paddingIndex = 0; paddingIndex &lt; paddingCount; paddingIndex++)
+    {
+        padding += &quot;    float pad_&quot; + next() + &quot;;\n&quot;;
+    }
+
+    return padding;
+}
+
+TString Std140PaddingHelper::postPaddingString(const TType &amp;type, bool useHLSLRowMajorPacking)
+{
+    if (!type.isMatrix() &amp;&amp; !type.isArray() &amp;&amp; type.getBasicType() != EbtStruct)
+    {
+        return &quot;&quot;;
+    }
+
+    int numComponents = 0;
+    TStructure *structure = type.getStruct();
+
+    if (type.isMatrix())
+    {
+        // This method can also be called from structureString, which does not use layout qualifiers.
+        // Thus, use the method parameter for determining the matrix packing.
+        //
+        // Note HLSL row major packing corresponds to GL API column-major, and vice-versa, since we
+        // wish to always transpose GL matrices to play well with HLSL's matrix array indexing.
+        //
+        const bool isRowMajorMatrix = !useHLSLRowMajorPacking;
+        const GLenum glType = GLVariableType(type);
+        numComponents = gl::MatrixComponentCount(glType, isRowMajorMatrix);
+    }
+    else if (structure)
+    {
+        const TString &amp;structName = QualifiedStructNameString(*structure,
+                                                              useHLSLRowMajorPacking, true);
+        numComponents = mStructElementIndexes-&gt;find(structName)-&gt;second;
+
+        if (numComponents == 0)
+        {
+            return &quot;&quot;;
+        }
+    }
+    else
+    {
+        const GLenum glType = GLVariableType(type);
+        numComponents = gl::VariableComponentCount(glType);
+    }
+
+    TString padding;
+    for (int paddingOffset = numComponents; paddingOffset &lt; 4; paddingOffset++)
+    {
+        padding += &quot;    float pad_&quot; + next() + &quot;;\n&quot;;
+    }
+    return padding;
+}
+
+StructureHLSL::StructureHLSL()
+    : mUniquePaddingCounter(0)
+{}
+
+Std140PaddingHelper StructureHLSL::getPaddingHelper()
+{
+    return Std140PaddingHelper(mStd140StructElementIndexes, &amp;mUniquePaddingCounter);
+}
+
+TString StructureHLSL::defineQualified(const TStructure &amp;structure, bool useHLSLRowMajorPacking, bool useStd140Packing)
+{
+    if (useStd140Packing)
+    {
+        Std140PaddingHelper padHelper = getPaddingHelper();
+        return define(structure, useHLSLRowMajorPacking, useStd140Packing, &amp;padHelper);
+    }
+    else
+    {
+        return define(structure, useHLSLRowMajorPacking, useStd140Packing, NULL);
+    }
+}
+
+TString StructureHLSL::defineNameless(const TStructure &amp;structure)
+{
+    return define(structure, false, false, NULL);
+}
+
+TString StructureHLSL::define(const TStructure &amp;structure, bool useHLSLRowMajorPacking,
+                              bool useStd140Packing, Std140PaddingHelper *padHelper)
+{
+    const TFieldList &amp;fields = structure.fields();
+    const bool isNameless = (structure.name() == &quot;&quot;);
+    const TString &amp;structName = QualifiedStructNameString(structure, useHLSLRowMajorPacking,
+                                                          useStd140Packing);
+    const TString declareString = (isNameless ? &quot;struct&quot; : &quot;struct &quot; + structName);
+
+    TString string;
+    string += declareString + &quot;\n&quot;
+              &quot;{\n&quot;;
+
+    for (unsigned int i = 0; i &lt; fields.size(); i++)
+    {
+        const TField &amp;field = *fields[i];
+        const TType &amp;fieldType = *field.type();
+        const TStructure *fieldStruct = fieldType.getStruct();
+        const TString &amp;fieldTypeString = fieldStruct ?
+                                         QualifiedStructNameString(*fieldStruct, useHLSLRowMajorPacking,
+                                                                   useStd140Packing) :
+                                         TypeString(fieldType);
+
+        if (padHelper)
+        {
+            string += padHelper-&gt;prePaddingString(fieldType);
+        }
+
+        string += &quot;    &quot; + fieldTypeString + &quot; &quot; + DecorateField(field.name(), structure) + ArrayString(fieldType) + &quot;;\n&quot;;
+
+        if (padHelper)
+        {
+            string += padHelper-&gt;postPaddingString(fieldType, useHLSLRowMajorPacking);
+        }
+    }
+
+    // Nameless structs do not finish with a semicolon and newline, to leave room for an instance variable
+    string += (isNameless ? &quot;} &quot; : &quot;};\n&quot;);
+
+    return string;
+}
+
+void StructureHLSL::addConstructor(const TType &amp;type, const TString &amp;name, const TIntermSequence *parameters)
+{
+    if (name == &quot;&quot;)
+    {
+        return;   // Nameless structures don't have constructors
+    }
+
+    if (type.getStruct() &amp;&amp; mStructNames.find(name) != mStructNames.end())
+    {
+        return;   // Already added
+    }
+
+    TType ctorType = type;
+    ctorType.clearArrayness();
+    ctorType.setPrecision(EbpHigh);
+    ctorType.setQualifier(EvqTemporary);
+
+    typedef std::vector&lt;TType&gt; ParameterArray;
+    ParameterArray ctorParameters;
+
+    const TStructure* structure = type.getStruct();
+    if (structure)
+    {
+        mStructNames.insert(name);
+
+        // Add element index
+        storeStd140ElementIndex(*structure, false);
+        storeStd140ElementIndex(*structure, true);
+
+        const TString &amp;structString = defineQualified(*structure, false, false);
+
+        if (std::find(mStructDeclarations.begin(), mStructDeclarations.end(), structString) == mStructDeclarations.end())
+        {
+            // Add row-major packed struct for interface blocks
+            TString rowMajorString = &quot;#pragma pack_matrix(row_major)\n&quot; +
+                defineQualified(*structure, true, false) +
+                &quot;#pragma pack_matrix(column_major)\n&quot;;
+
+            TString std140String = defineQualified(*structure, false, true);
+            TString std140RowMajorString = &quot;#pragma pack_matrix(row_major)\n&quot; +
+                defineQualified(*structure, true, true) +
+                &quot;#pragma pack_matrix(column_major)\n&quot;;
+
+            mStructDeclarations.push_back(structString);
+            mStructDeclarations.push_back(rowMajorString);
+            mStructDeclarations.push_back(std140String);
+            mStructDeclarations.push_back(std140RowMajorString);
+        }
+
+        const TFieldList &amp;fields = structure-&gt;fields();
+        for (unsigned int i = 0; i &lt; fields.size(); i++)
+        {
+            ctorParameters.push_back(*fields[i]-&gt;type());
+        }
+    }
+    else if (parameters)
+    {
+        for (TIntermSequence::const_iterator parameter = parameters-&gt;begin(); parameter != parameters-&gt;end(); parameter++)
+        {
+            ctorParameters.push_back((*parameter)-&gt;getAsTyped()-&gt;getType());
+        }
+    }
+    else UNREACHABLE();
+
+    TString constructor;
+
+    if (ctorType.getStruct())
+    {
+        constructor += name + &quot; &quot; + name + &quot;_ctor(&quot;;
+    }
+    else   // Built-in type
+    {
+        constructor += TypeString(ctorType) + &quot; &quot; + name + &quot;(&quot;;
+    }
+
+    for (unsigned int parameter = 0; parameter &lt; ctorParameters.size(); parameter++)
+    {
+        const TType &amp;paramType = ctorParameters[parameter];
+
+        constructor += TypeString(paramType) + &quot; x&quot; + str(parameter) + ArrayString(paramType);
+
+        if (parameter &lt; ctorParameters.size() - 1)
+        {
+            constructor += &quot;, &quot;;
+        }
+    }
+
+    constructor += &quot;)\n&quot;
+                   &quot;{\n&quot;;
+
+    if (ctorType.getStruct())
+    {
+        constructor += &quot;    &quot; + name + &quot; structure = {&quot;;
+    }
+    else
+    {
+        constructor += &quot;    return &quot; + TypeString(ctorType) + &quot;(&quot;;
+    }
+
+    if (ctorType.isMatrix() &amp;&amp; ctorParameters.size() == 1)
+    {
+        int rows = ctorType.getRows();
+        int cols = ctorType.getCols();
+        const TType &amp;parameter = ctorParameters[0];
+
+        if (parameter.isScalar())
+        {
+            for (int col = 0; col &lt; cols; col++)
+            {
+                for (int row = 0; row &lt; rows; row++)
+                {
+                    constructor += TString((row == col) ? &quot;x0&quot; : &quot;0.0&quot;);
+
+                    if (row &lt; rows - 1 || col &lt; cols - 1)
+                    {
+                        constructor += &quot;, &quot;;
+                    }
+                }
+            }
+        }
+        else if (parameter.isMatrix())
+        {
+            for (int col = 0; col &lt; cols; col++)
+            {
+                for (int row = 0; row &lt; rows; row++)
+                {
+                    if (row &lt; parameter.getRows() &amp;&amp; col &lt; parameter.getCols())
+                    {
+                        constructor += TString(&quot;x0&quot;) + &quot;[&quot; + str(col) + &quot;][&quot; + str(row) + &quot;]&quot;;
+                    }
+                    else
+                    {
+                        constructor += TString((row == col) ? &quot;1.0&quot; : &quot;0.0&quot;);
+                    }
+
+                    if (row &lt; rows - 1 || col &lt; cols - 1)
+                    {
+                        constructor += &quot;, &quot;;
+                    }
+                }
+            }
+        }
+        else
+        {
+            ASSERT(rows == 2 &amp;&amp; cols == 2 &amp;&amp; parameter.isVector() &amp;&amp; parameter.getNominalSize() == 4);
+
+            constructor += &quot;x0&quot;;
+        }
+    }
+    else
+    {
+        size_t remainingComponents = ctorType.getObjectSize();
+        size_t parameterIndex = 0;
+
+        while (remainingComponents &gt; 0)
+        {
+            const TType &amp;parameter = ctorParameters[parameterIndex];
+            const size_t parameterSize = parameter.getObjectSize();
+            bool moreParameters = parameterIndex + 1 &lt; ctorParameters.size();
+
+            constructor += &quot;x&quot; + str(parameterIndex);
+
+            if (ctorType.getStruct())
+            {
+                ASSERT(remainingComponents == parameterSize || moreParameters);
+                ASSERT(parameterSize &lt;= remainingComponents);
+
+                remainingComponents -= parameterSize;
+            }
+            else if (parameter.isScalar())
+            {
+                remainingComponents -= parameter.getObjectSize();
+            }
+            else if (parameter.isVector())
+            {
+                if (remainingComponents == parameterSize || moreParameters)
+                {
+                    ASSERT(parameterSize &lt;= remainingComponents);
+                    remainingComponents -= parameterSize;
+                }
+                else if (remainingComponents &lt; static_cast&lt;size_t&gt;(parameter.getNominalSize()))
+                {
+                    switch (remainingComponents)
+                    {
+                      case 1: constructor += &quot;.x&quot;;    break;
+                      case 2: constructor += &quot;.xy&quot;;   break;
+                      case 3: constructor += &quot;.xyz&quot;;  break;
+                      case 4: constructor += &quot;.xyzw&quot;; break;
+                      default: UNREACHABLE();
+                    }
+
+                    remainingComponents = 0;
+                }
+                else UNREACHABLE();
+            }
+            else if (parameter.isMatrix())
+            {
+                int column = 0;
+                while (remainingComponents &gt; 0 &amp;&amp; column &lt; parameter.getCols())
+                {
+                    constructor += &quot;[&quot; + str(column) + &quot;]&quot;;
+
+                    if (remainingComponents &lt; static_cast&lt;size_t&gt;(parameter.getRows()))
+                    {
+                        switch (remainingComponents)
+                        {
+                          case 1:  constructor += &quot;.x&quot;;    break;
+                          case 2:  constructor += &quot;.xy&quot;;   break;
+                          case 3:  constructor += &quot;.xyz&quot;;  break;
+                          default: UNREACHABLE();
+                        }
+
+                        remainingComponents = 0;
+                    }
+                    else
+                    {
+                        remainingComponents -= parameter.getRows();
+
+                        if (remainingComponents &gt; 0)
+                        {
+                            constructor += &quot;, x&quot; + str(parameterIndex);
+                        }
+                    }
+
+                    column++;
+                }
+            }
+            else UNREACHABLE();
+
+            if (moreParameters)
+            {
+                parameterIndex++;
+            }
+
+            if (remainingComponents)
+            {
+                constructor += &quot;, &quot;;
+            }
+        }
+    }
+
+    if (ctorType.getStruct())
+    {
+        constructor += &quot;};\n&quot;
+                        &quot;    return structure;\n&quot;
+                        &quot;}\n&quot;;
+    }
+    else
+    {
+        constructor += &quot;);\n&quot;
+                       &quot;}\n&quot;;
+    }
+
+    mConstructors.insert(constructor);
+}
+
+std::string StructureHLSL::structsHeader() const
+{
+    TInfoSinkBase out;
+
+    for (size_t structIndex = 0; structIndex &lt; mStructDeclarations.size(); structIndex++)
+    {
+        out &lt;&lt; mStructDeclarations[structIndex];
+    }
+
+    for (Constructors::const_iterator constructor = mConstructors.begin();
+         constructor != mConstructors.end();
+         constructor++)
+    {
+        out &lt;&lt; *constructor;
+    }
+
+    return out.str();
+}
+
+void StructureHLSL::storeStd140ElementIndex(const TStructure &amp;structure, bool useHLSLRowMajorPacking)
+{
+    Std140PaddingHelper padHelper = getPaddingHelper();
+    const TFieldList &amp;fields = structure.fields();
+
+    for (unsigned int i = 0; i &lt; fields.size(); i++)
+    {
+        padHelper.prePadding(*fields[i]-&gt;type());
+    }
+
+    // Add remaining element index to the global map, for use with nested structs in standard layouts
+    const TString &amp;structName = QualifiedStructNameString(structure, useHLSLRowMajorPacking, true);
+    mStd140StructElementIndexes[structName] = padHelper.elementIndex();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorStructureHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/StructureHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// StructureHLSL.h:
+//   Interfaces of methods for HLSL translation of GLSL structures.
+//
+
+#ifndef COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
+#define COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
+
+#include &quot;compiler/translator/Common.h&quot;
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+#include &lt;set&gt;
+
+class TInfoSinkBase;
+class TScopeBracket;
+
+namespace sh
+{
+
+// This helper class assists structure and interface block definitions in determining
+// how to pack std140 structs within HLSL's packing rules.
+class Std140PaddingHelper
+{
+  public:
+    explicit Std140PaddingHelper(const std::map&lt;TString, int&gt; &amp;structElementIndexes,
+                                 unsigned int *uniqueCounter);
+    Std140PaddingHelper(const Std140PaddingHelper &amp;other);
+    Std140PaddingHelper &amp;operator=(const Std140PaddingHelper &amp;other);
+
+    int elementIndex() const { return mElementIndex; }
+    int prePadding(const TType &amp;type);
+    TString prePaddingString(const TType &amp;type);
+    TString postPaddingString(const TType &amp;type, bool useHLSLRowMajorPacking);
+
+  private:
+    TString next();
+
+    unsigned *mPaddingCounter;
+    int mElementIndex;
+    const std::map&lt;TString, int&gt; *mStructElementIndexes;
+};
+
+class StructureHLSL : angle::NonCopyable
+{
+  public:
+    StructureHLSL();
+
+    void addConstructor(const TType &amp;type, const TString &amp;name, const TIntermSequence *parameters);
+    std::string structsHeader() const;
+
+    TString defineQualified(const TStructure &amp;structure, bool useHLSLRowMajorPacking, bool useStd140Packing);
+    static TString defineNameless(const TStructure &amp;structure);
+
+    Std140PaddingHelper getPaddingHelper();
+
+  private:
+    unsigned mUniquePaddingCounter;
+
+    std::map&lt;TString, int&gt; mStd140StructElementIndexes;
+
+    typedef std::set&lt;TString&gt; StructNames;
+    StructNames mStructNames;
+
+    typedef std::set&lt;TString&gt; Constructors;
+    Constructors mConstructors;
+
+    typedef std::vector&lt;TString&gt; StructDeclarations;
+    StructDeclarations mStructDeclarations;
+
+    void storeStd140ElementIndex(const TStructure &amp;structure, bool useHLSLRowMajorPacking);
+    static TString define(const TStructure &amp;structure, bool useHLSLRowMajorPacking,
+                         bool useStd140Packing, Std140PaddingHelper *padHelper);
+};
+
+}
+
+#endif // COMPILER_TRANSLATOR_STRUCTUREHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSymbolTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -17,143 +17,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;stdio.h&gt;
</span><span class="cx"> #include &lt;algorithm&gt;
</span><del>-#include &lt;climits&gt;
</del><span class="cx"> 
</span><del>-int TSymbolTableLevel::uniqueId = 0;
</del><ins>+int TSymbolTable::uniqueIdCounter = 0;
</ins><span class="cx"> 
</span><del>-TType::TType(const TPublicType &amp;p) :
-            type(p.type), precision(p.precision), qualifier(p.qualifier), primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), layoutQualifier(p.layoutQualifier), arraySize(p.arraySize),
-            interfaceBlock(0), structure(0)
-{
-    if (p.userDef) {
-        structure = p.userDef-&gt;getStruct();
-    }
-}
-
</del><span class="cx"> //
</span><del>-// Recursively generate mangled names.
-//
-TString TType::buildMangledName() const
-{
-    TString mangledName;
-    if (isMatrix())
-        mangledName += 'm';
-    else if (isVector())
-        mangledName += 'v';
-
-    switch (type)
-    {
-      case EbtFloat:                mangledName += 'f';      break;
-      case EbtInt:                  mangledName += 'i';      break;
-      case EbtUInt:                 mangledName += 'u';      break;
-      case EbtBool:                 mangledName += 'b';      break;
-      case EbtSampler2D:            mangledName += &quot;s2&quot;;     break;
-      case EbtSampler3D:            mangledName += &quot;s3&quot;;     break;
-      case EbtSamplerCube:          mangledName += &quot;sC&quot;;     break;
-      case EbtSampler2DArray:       mangledName += &quot;s2a&quot;;    break;
-      case EbtSamplerExternalOES:   mangledName += &quot;sext&quot;;   break;
-      case EbtSampler2DRect:        mangledName += &quot;s2r&quot;;    break;
-      case EbtISampler2D:           mangledName += &quot;is2&quot;;    break;
-      case EbtISampler3D:           mangledName += &quot;is3&quot;;    break;
-      case EbtISamplerCube:         mangledName += &quot;isC&quot;;    break;
-      case EbtISampler2DArray:      mangledName += &quot;is2a&quot;;   break;
-      case EbtUSampler2D:           mangledName += &quot;us2&quot;;    break;
-      case EbtUSampler3D:           mangledName += &quot;us3&quot;;    break;
-      case EbtUSamplerCube:         mangledName += &quot;usC&quot;;    break;
-      case EbtUSampler2DArray:      mangledName += &quot;us2a&quot;;   break;
-      case EbtSampler2DShadow:      mangledName += &quot;s2s&quot;;    break;
-      case EbtSamplerCubeShadow:    mangledName += &quot;sCs&quot;;    break;
-      case EbtSampler2DArrayShadow: mangledName += &quot;s2as&quot;;   break;
-      case EbtStruct:               mangledName += structure-&gt;mangledName(); break;
-      case EbtInterfaceBlock:       mangledName += interfaceBlock-&gt;mangledName(); break;
-      default:                      UNREACHABLE();
-    }
-
-    if (isMatrix())
-    {
-        mangledName += static_cast&lt;char&gt;('0' + getCols());
-        mangledName += static_cast&lt;char&gt;('x');
-        mangledName += static_cast&lt;char&gt;('0' + getRows());
-    }
-    else
-    {
-        mangledName += static_cast&lt;char&gt;('0' + getNominalSize());
-    }
-
-    if (isArray()) {
-        char buf[20];
-        snprintf(buf, sizeof(buf), &quot;%d&quot;, arraySize);
-        mangledName += '[';
-        mangledName += buf;
-        mangledName += ']';
-    }
-    return mangledName;
-}
-
-size_t TType::getObjectSize() const
-{
-    size_t totalSize;
-
-    if (getBasicType() == EbtStruct)
-        totalSize = structure-&gt;objectSize();
-    else
-        totalSize = primarySize * secondarySize;
-
-    if (isArray()) {
-        size_t arraySize = getArraySize();
-        if (arraySize &gt; INT_MAX / totalSize)
-            totalSize = INT_MAX;
-        else
-            totalSize *= arraySize;
-    }
-
-    return totalSize;
-}
-
-bool TStructure::containsArrays() const
-{
-    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i) {
-        const TType* fieldType = (*mFields)[i]-&gt;type();
-        if (fieldType-&gt;isArray() || fieldType-&gt;isStructureContainingArrays())
-            return true;
-    }
-    return false;
-}
-
-TString TFieldListCollection::buildMangledName() const
-{
-    TString mangledName(mangledNamePrefix());
-    mangledName += *mName;
-    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i) {
-        mangledName += '-';
-        mangledName += (*mFields)[i]-&gt;type()-&gt;getMangledName();
-    }
-    return mangledName;
-}
-
-size_t TFieldListCollection::calculateObjectSize() const
-{
-    size_t size = 0;
-    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i) {
-        size_t fieldSize = (*mFields)[i]-&gt;type()-&gt;getObjectSize();
-        if (fieldSize &gt; INT_MAX - size)
-            size = INT_MAX;
-        else
-            size += fieldSize;
-    }
-    return size;
-}
-
-int TStructure::calculateDeepestNesting() const
-{
-    int maxNesting = 0;
-    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i) {
-        maxNesting = std::max(maxNesting, (*mFields)[i]-&gt;type()-&gt;getDeepestStructNesting());
-    }
-    return 1 + maxNesting;
-}
-
-//
</del><span class="cx"> // Functions have buried pointers to delete.
</span><span class="cx"> //
</span><span class="cx"> TFunction::~TFunction()
</span><span class="lines">@@ -171,55 +38,47 @@
</span><span class="cx">         delete (*it).second;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-//
-// Change all function entries in the table with the non-mangled name
-// to be related to the provided built-in operation.  This is a low
-// performance operation, and only intended for symbol tables that
-// live across a large number of compiles.
-//
-void TSymbolTableLevel::relateToOperator(const char* name, TOperator op)
</del><ins>+bool TSymbolTableLevel::insert(TSymbol *symbol)
</ins><span class="cx"> {
</span><del>-    tLevel::iterator it;
-    for (it = level.begin(); it != level.end(); ++it) {
-        if ((*it).second-&gt;isFunction()) {
-            TFunction* function = static_cast&lt;TFunction*&gt;((*it).second);
-            if (function-&gt;getName() == name)
-                function-&gt;relateToOperator(op);
-        }
-    }
</del><ins>+    symbol-&gt;setUniqueId(TSymbolTable::nextUniqueId());
+
+    // returning true means symbol was added to the table
+    tInsertResult result = level.insert(tLevelPair(symbol-&gt;getMangledName(), symbol));
+
+    return result.second;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-//
-// Change all function entries in the table with the non-mangled name
-// to be related to the provided built-in extension. This is a low
-// performance operation, and only intended for symbol tables that
-// live across a large number of compiles.
-//
-void TSymbolTableLevel::relateToExtension(const char* name, const TString&amp; ext)
</del><ins>+bool TSymbolTableLevel::insertUnmangled(TFunction *function)
</ins><span class="cx"> {
</span><del>-    for (tLevel::iterator it = level.begin(); it != level.end(); ++it) {
-        TSymbol* symbol = it-&gt;second;
-        if (symbol-&gt;getName() == name) {
-            symbol-&gt;relateToExtension(ext);
-        }
-    }
</del><ins>+    function-&gt;setUniqueId(TSymbolTable::nextUniqueId());
+
+    // returning true means symbol was added to the table
+    tInsertResult result = level.insert(tLevelPair(function-&gt;getName(), function));
+
+    return result.second;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TSymbol::TSymbol(const TSymbol&amp; copyOf)
</del><ins>+TSymbol *TSymbolTableLevel::find(const TString &amp;name) const
</ins><span class="cx"> {
</span><del>-    name = NewPoolTString(copyOf.name-&gt;c_str());
-    uniqueId = copyOf.uniqueId;
</del><ins>+    tLevel::const_iterator it = level.find(name);
+    if (it == level.end())
+        return 0;
+    else
+        return (*it).second;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TSymbol *TSymbolTable::find(const TString &amp;name, int shaderVersion, bool *builtIn, bool *sameScope)
</del><ins>+TSymbol *TSymbolTable::find(const TString &amp;name, int shaderVersion,
+                            bool *builtIn, bool *sameScope) const
</ins><span class="cx"> {
</span><span class="cx">     int level = currentLevel();
</span><span class="cx">     TSymbol *symbol;
</span><span class="cx"> 
</span><span class="cx">     do
</span><span class="cx">     {
</span><del>-        if (level == ESSL3_BUILTINS &amp;&amp; shaderVersion != 300) level--;
-        if (level == ESSL1_BUILTINS &amp;&amp; shaderVersion != 100) level--;
</del><ins>+        if (level == ESSL3_BUILTINS &amp;&amp; shaderVersion != 300)
+            level--;
+        if (level == ESSL1_BUILTINS &amp;&amp; shaderVersion != 100)
+            level--;
</ins><span class="cx"> 
</span><span class="cx">         symbol = table[level]-&gt;find(name);
</span><span class="cx">     }
</span><span class="lines">@@ -233,12 +92,15 @@
</span><span class="cx">     return symbol;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TSymbol *TSymbolTable::findBuiltIn(const TString &amp;name, int shaderVersion)
</del><ins>+TSymbol *TSymbolTable::findBuiltIn(
+    const TString &amp;name, int shaderVersion) const
</ins><span class="cx"> {
</span><span class="cx">     for (int level = LAST_BUILTIN_LEVEL; level &gt;= 0; level--)
</span><span class="cx">     {
</span><del>-        if (level == ESSL3_BUILTINS &amp;&amp; shaderVersion != 300) level--;
-        if (level == ESSL1_BUILTINS &amp;&amp; shaderVersion != 100) level--;
</del><ins>+        if (level == ESSL3_BUILTINS &amp;&amp; shaderVersion != 300)
+            level--;
+        if (level == ESSL1_BUILTINS &amp;&amp; shaderVersion != 100)
+            level--;
</ins><span class="cx"> 
</span><span class="cx">         TSymbol *symbol = table[level]-&gt;find(name);
</span><span class="cx"> 
</span><span class="lines">@@ -254,3 +116,173 @@
</span><span class="cx">     while (table.size() &gt; 0)
</span><span class="cx">         pop();
</span><span class="cx"> }
</span><ins>+
+bool IsGenType(const TType *type)
+{
+    if (type)
+    {
+        TBasicType basicType = type-&gt;getBasicType();
+        return basicType == EbtGenType || basicType == EbtGenIType || basicType == EbtGenUType || basicType == EbtGenBType;
+    }
+
+    return false;
+}
+
+bool IsVecType(const TType *type)
+{
+    if (type)
+    {
+        TBasicType basicType = type-&gt;getBasicType();
+        return basicType == EbtVec || basicType == EbtIVec || basicType == EbtUVec || basicType == EbtBVec;
+    }
+
+    return false;
+}
+
+TType *SpecificType(TType *type, int size)
+{
+    ASSERT(size &gt;= 1 &amp;&amp; size &lt;= 4);
+
+    if (!type)
+    {
+        return nullptr;
+    }
+
+    ASSERT(!IsVecType(type));
+
+    switch(type-&gt;getBasicType())
+    {
+      case EbtGenType:  return new TType(EbtFloat, static_cast&lt;unsigned char&gt;(size));
+      case EbtGenIType: return new TType(EbtInt, static_cast&lt;unsigned char&gt;(size));
+      case EbtGenUType: return new TType(EbtUInt, static_cast&lt;unsigned char&gt;(size));
+      case EbtGenBType: return new TType(EbtBool, static_cast&lt;unsigned char&gt;(size));
+      default: return type;
+    }
+}
+
+TType *VectorType(TType *type, int size)
+{
+    ASSERT(size &gt;= 2 &amp;&amp; size &lt;= 4);
+
+    if (!type)
+    {
+        return nullptr;
+    }
+
+    ASSERT(!IsGenType(type));
+
+    switch(type-&gt;getBasicType())
+    {
+      case EbtVec:  return new TType(EbtFloat, static_cast&lt;unsigned char&gt;(size));
+      case EbtIVec: return new TType(EbtInt, static_cast&lt;unsigned char&gt;(size));
+      case EbtUVec: return new TType(EbtUInt, static_cast&lt;unsigned char&gt;(size));
+      case EbtBVec: return new TType(EbtBool, static_cast&lt;unsigned char&gt;(size));
+      default: return type;
+    }
+}
+
+void TSymbolTable::insertBuiltIn(ESymbolLevel level, TOperator op, const char *ext, TType *rvalue, const char *name,
+                                 TType *ptype1, TType *ptype2, TType *ptype3, TType *ptype4, TType *ptype5)
+{
+    if (ptype1-&gt;getBasicType() == EbtGSampler2D)
+    {
+        bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
+        insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
+    }
+    else if (ptype1-&gt;getBasicType() == EbtGSampler3D)
+    {
+        bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
+        insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
+    }
+    else if (ptype1-&gt;getBasicType() == EbtGSamplerCube)
+    {
+        bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
+        insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
+    }
+    else if (ptype1-&gt;getBasicType() == EbtGSampler2DArray)
+    {
+        bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
+        insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
+        insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
+    }
+    else if (IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3))
+    {
+        ASSERT(!ptype4 &amp;&amp; !ptype5);
+        insertBuiltIn(level, op, ext, SpecificType(rvalue, 1), name, SpecificType(ptype1, 1), SpecificType(ptype2, 1), SpecificType(ptype3, 1));
+        insertBuiltIn(level, op, ext, SpecificType(rvalue, 2), name, SpecificType(ptype1, 2), SpecificType(ptype2, 2), SpecificType(ptype3, 2));
+        insertBuiltIn(level, op, ext, SpecificType(rvalue, 3), name, SpecificType(ptype1, 3), SpecificType(ptype2, 3), SpecificType(ptype3, 3));
+        insertBuiltIn(level, op, ext, SpecificType(rvalue, 4), name, SpecificType(ptype1, 4), SpecificType(ptype2, 4), SpecificType(ptype3, 4));
+    }
+    else if (IsVecType(rvalue) || IsVecType(ptype1) || IsVecType(ptype2) || IsVecType(ptype3))
+    {
+        ASSERT(!ptype4 &amp;&amp; !ptype5);
+        insertBuiltIn(level, op, ext, VectorType(rvalue, 2), name, VectorType(ptype1, 2), VectorType(ptype2, 2), VectorType(ptype3, 2));
+        insertBuiltIn(level, op, ext, VectorType(rvalue, 3), name, VectorType(ptype1, 3), VectorType(ptype2, 3), VectorType(ptype3, 3));
+        insertBuiltIn(level, op, ext, VectorType(rvalue, 4), name, VectorType(ptype1, 4), VectorType(ptype2, 4), VectorType(ptype3, 4));
+    }
+    else
+    {
+        TFunction *function = new TFunction(NewPoolTString(name), *rvalue, op, ext);
+
+        TParameter param1 = {0, ptype1};
+        function-&gt;addParameter(param1);
+
+        if (ptype2)
+        {
+            TParameter param2 = {0, ptype2};
+            function-&gt;addParameter(param2);
+        }
+
+        if (ptype3)
+        {
+            TParameter param3 = {0, ptype3};
+            function-&gt;addParameter(param3);
+        }
+
+        if (ptype4)
+        {
+            TParameter param4 = {0, ptype4};
+            function-&gt;addParameter(param4);
+        }
+
+        if (ptype5)
+        {
+            TParameter param5 = {0, ptype5};
+            function-&gt;addParameter(param5);
+        }
+
+        insert(level, function);
+    }
+}
+
+TPrecision TSymbolTable::getDefaultPrecision(TBasicType type) const
+{
+    if (!SupportsPrecision(type))
+        return EbpUndefined;
+
+    // unsigned integers use the same precision as signed
+    TBasicType baseType = (type == EbtUInt) ? EbtInt : type;
+
+    int level = static_cast&lt;int&gt;(precisionStack.size()) - 1;
+    assert(level &gt;= 0); // Just to be safe. Should not happen.
+    // If we dont find anything we return this. Should we error check this?
+    TPrecision prec = EbpUndefined;
+    while (level &gt;= 0)
+    {
+        PrecisionStackLevel::iterator it = precisionStack[level]-&gt;find(baseType);
+        if (it != precisionStack[level]-&gt;end())
+        {
+            prec = (*it).second;
+            break;
+        }
+        level--;
+    }
+    return prec;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorSymbolTableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/SymbolTable.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,8 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _SYMBOL_TABLE_INCLUDED_
-#define _SYMBOL_TABLE_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_SYMBOLTABLE_H_
+#define COMPILER_TRANSLATOR_SYMBOLTABLE_H_
</ins><span class="cx"> 
</span><span class="cx"> //
</span><span class="cx"> // Symbol table for parsing.  Has these design characteristics:
</span><span class="lines">@@ -31,38 +31,66 @@
</span><span class="cx"> //
</span><span class="cx"> 
</span><span class="cx"> #include &lt;assert.h&gt;
</span><ins>+#include &lt;set&gt;
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;common/angleutils.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><del>-//
-// Symbol base class.  (Can build functions or variables out of these...)
-//
-class TSymbol {    
-public:
</del><ins>+// Symbol base class. (Can build functions or variables out of these...)
+class TSymbol : angle::NonCopyable
+{
+  public:
</ins><span class="cx">     POOL_ALLOCATOR_NEW_DELETE();
</span><del>-    TSymbol(const TString* n) :  uniqueId(0), name(n) { }
-    virtual ~TSymbol() { /* don't delete name, it's from the pool */ }
</del><ins>+    TSymbol(const TString *n)
+        : uniqueId(0),
+          name(n)
+    {
+    }
+    virtual ~TSymbol()
+    {
+        // don't delete name, it's from the pool
+    }
</ins><span class="cx"> 
</span><del>-    const TString&amp; getName() const { return *name; }
-    virtual const TString&amp; getMangledName() const { return getName(); }
-    virtual bool isFunction() const { return false; }
-    virtual bool isVariable() const { return false; }
-    void setUniqueId(int id) { uniqueId = id; }
-    int getUniqueId() const { return uniqueId; }
-    void relateToExtension(const TString&amp; ext) { extension = ext; }
-    const TString&amp; getExtension() const { return extension; }
</del><ins>+    const TString &amp;getName() const
+    {
+        return *name;
+    }
+    virtual const TString &amp;getMangledName() const
+    {
+        return getName();
+    }
+    virtual bool isFunction() const
+    {
+        return false;
+    }
+    virtual bool isVariable() const
+    {
+        return false;
+    }
+    void setUniqueId(int id)
+    {
+        uniqueId = id;
+    }
+    int getUniqueId() const
+    {
+        return uniqueId;
+    }
+    void relateToExtension(const TString &amp;ext)
+    {
+        extension = ext;
+    }
+    const TString &amp;getExtension() const
+    {
+        return extension;
+    }
</ins><span class="cx"> 
</span><del>-private:
-    DISALLOW_COPY_AND_ASSIGN(TSymbol);
-
-    int uniqueId;      // For real comparing during code generation
</del><ins>+  private:
+    int uniqueId; // For real comparing during code generation
</ins><span class="cx">     const TString *name;
</span><span class="cx">     TString extension;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-//
</del><span class="cx"> // Variable class, meaning a symbol that's not a function.
</span><span class="cx"> // 
</span><span class="cx"> // There could be a separate class heirarchy for Constant variables;
</span><span class="lines">@@ -71,28 +99,54 @@
</span><span class="cx"> // seem worth having separate classes, and &quot;getConst&quot; can't simply return
</span><span class="cx"> // different values for different types polymorphically, so this is 
</span><span class="cx"> // just simple and pragmatic.
</span><del>-//
-class TVariable : public TSymbol {
-public:
-    TVariable(const TString *name, const TType&amp; t, bool uT = false ) : TSymbol(name), type(t), userType(uT), unionArray(0) { }
-    virtual ~TVariable() { }
-    virtual bool isVariable() const { return true; }    
-    TType&amp; getType() { return type; }    
-    const TType&amp; getType() const { return type; }
-    bool isUserType() const { return userType; }
-    void setQualifier(TQualifier qualifier) { type.setQualifier(qualifier); }
</del><ins>+class TVariable : public TSymbol
+{
+  public:
+    TVariable(const TString *name, const TType &amp;t, bool uT = false)
+        : TSymbol(name),
+          type(t),
+          userType(uT),
+          unionArray(0)
+    {
+    }
+    virtual ~TVariable()
+    {
+    }
+    virtual bool isVariable() const
+    {
+        return true;
+    }
+    TType &amp;getType()
+    {
+        return type;
+    }
+    const TType &amp;getType() const
+    {
+        return type;
+    }
+    bool isUserType() const
+    {
+        return userType;
+    }
+    void setQualifier(TQualifier qualifier)
+    {
+        type.setQualifier(qualifier);
+    }
</ins><span class="cx"> 
</span><del>-    ConstantUnion* getConstPointer()
</del><ins>+    TConstantUnion *getConstPointer()
</ins><span class="cx">     { 
</span><span class="cx">         if (!unionArray)
</span><del>-            unionArray = new ConstantUnion[type.getObjectSize()];
</del><ins>+            unionArray = new TConstantUnion[type.getObjectSize()];
</ins><span class="cx"> 
</span><span class="cx">         return unionArray;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion* getConstPointer() const { return unionArray; }
</del><ins>+    TConstantUnion *getConstPointer() const
+    {
+        return unionArray;
+    }
</ins><span class="cx"> 
</span><del>-    void shareConstPointer( ConstantUnion *constArray)
</del><ins>+    void shareConstPointer(TConstantUnion *constArray)
</ins><span class="cx">     {
</span><span class="cx">         if (unionArray == constArray)
</span><span class="cx">             return;
</span><span class="lines">@@ -101,71 +155,96 @@
</span><span class="cx">         unionArray = constArray;  
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-private:
-    DISALLOW_COPY_AND_ASSIGN(TVariable);
-
</del><ins>+  private:
</ins><span class="cx">     TType type;
</span><span class="cx">     bool userType;
</span><del>-    // we are assuming that Pool Allocator will free the memory allocated to unionArray
-    // when this object is destroyed
-    ConstantUnion *unionArray;
</del><ins>+    // we are assuming that Pool Allocator will free the memory
+    // allocated to unionArray when this object is destroyed.
+    TConstantUnion *unionArray;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-//
</del><span class="cx"> // The function sub-class of symbols and the parser will need to
</span><span class="cx"> // share this definition of a function parameter.
</span><del>-//
-struct TParameter {
</del><ins>+struct TParameter
+{
</ins><span class="cx">     TString *name;
</span><span class="cx">     TType *type;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-//
</del><span class="cx"> // The function sub-class of a symbol.  
</span><del>-//
-class TFunction : public TSymbol {
-public:
-    TFunction(TOperator o) :
-        TSymbol(0),
-        returnType(TType(EbtVoid, EbpUndefined)),
-        op(o),
-        defined(false) { }
-    TFunction(const TString *name, TType&amp; retType, TOperator tOp = EOpNull) : 
-        TSymbol(name), 
-        returnType(retType),
-        mangledName(TFunction::mangleName(*name)),
-        op(tOp),
-        defined(false) { }
</del><ins>+class TFunction : public TSymbol
+{
+  public:
+    TFunction(TOperator o)
+        : TSymbol(0),
+          returnType(TType(EbtVoid, EbpUndefined)),
+          op(o),
+          defined(false)
+    {
+    }
+    TFunction(const TString *name, const TType &amp;retType, TOperator tOp = EOpNull, const char *ext = &quot;&quot;)
+        : TSymbol(name),
+          returnType(retType),
+          mangledName(TFunction::mangleName(*name)),
+          op(tOp),
+          defined(false)
+    {
+        relateToExtension(ext);
+    }
</ins><span class="cx">     virtual ~TFunction();
</span><del>-    virtual bool isFunction() const { return true; }    
</del><ins>+    virtual bool isFunction() const
+    {
+        return true;
+    }
</ins><span class="cx"> 
</span><del>-    static TString mangleName(const TString&amp; name) { return name + '('; }
-    static TString unmangleName(const TString&amp; mangledName)
</del><ins>+    static TString mangleName(const TString &amp;name)
</ins><span class="cx">     {
</span><ins>+        return name + '(';
+    }
+    static TString unmangleName(const TString &amp;mangledName)
+    {
</ins><span class="cx">         return TString(mangledName.c_str(), mangledName.find_first_of('('));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void addParameter(TParameter&amp; p) 
</del><ins>+    void addParameter(TParameter &amp;p)
</ins><span class="cx">     { 
</span><span class="cx">         parameters.push_back(p);
</span><span class="cx">         mangledName = mangledName + p.type-&gt;getMangledName();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const TString&amp; getMangledName() const { return mangledName; }
-    const TType&amp; getReturnType() const { return returnType; }
</del><ins>+    const TString &amp;getMangledName() const
+    {
+        return mangledName;
+    }
+    const TType &amp;getReturnType() const
+    {
+        return returnType;
+    }
</ins><span class="cx"> 
</span><del>-    void relateToOperator(TOperator o) { op = o; }
-    TOperator getBuiltInOp() const { return op; }
</del><ins>+    TOperator getBuiltInOp() const
+    {
+        return op;
+    }
</ins><span class="cx"> 
</span><del>-    void setDefined() { defined = true; }
-    bool isDefined() { return defined; }
</del><ins>+    void setDefined()
+    {
+        defined = true;
+    }
+    bool isDefined()
+    {
+        return defined;
+    }
</ins><span class="cx"> 
</span><del>-    size_t getParamCount() const { return parameters.size(); }  
-    const TParameter&amp; getParam(size_t i) const { return parameters[i]; }
</del><ins>+    size_t getParamCount() const
+    {
+        return parameters.size();
+    }
+    const TParameter &amp;getParam(size_t i) const
+    {
+        return parameters[i];
+    }
</ins><span class="cx"> 
</span><del>-private:
-    DISALLOW_COPY_AND_ASSIGN(TFunction);
-
</del><ins>+  private:
</ins><span class="cx">     typedef TVector&lt;TParameter&gt; TParamList;
</span><span class="cx">     TParamList parameters;
</span><span class="cx">     TType returnType;
</span><span class="lines">@@ -174,93 +253,82 @@
</span><span class="cx">     bool defined;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-//
</del><span class="cx"> // Interface block name sub-symbol
</span><del>-//
</del><span class="cx"> class TInterfaceBlockName : public TSymbol
</span><span class="cx"> {
</span><del>-public:
</del><ins>+  public:
</ins><span class="cx">     TInterfaceBlockName(const TString *name)
</span><span class="cx">         : TSymbol(name)
</span><del>-    {}
</del><ins>+    {
+    }
</ins><span class="cx"> 
</span><del>-    virtual ~TInterfaceBlockName() {}
</del><ins>+    virtual ~TInterfaceBlockName()
+    {
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-class TSymbolTableLevel {
-public:
-    typedef TMap&lt;TString, TSymbol*&gt; tLevel;
</del><ins>+class TSymbolTableLevel
+{
+  public:
+    typedef TMap&lt;TString, TSymbol *&gt; tLevel;
</ins><span class="cx">     typedef tLevel::const_iterator const_iterator;
</span><span class="cx">     typedef const tLevel::value_type tLevelPair;
</span><span class="cx">     typedef std::pair&lt;tLevel::iterator, bool&gt; tInsertResult;
</span><span class="cx"> 
</span><del>-    TSymbolTableLevel() { }
-    ~TSymbolTableLevel();
-
-    bool insert(const TString &amp;name, TSymbol &amp;symbol)
</del><ins>+    TSymbolTableLevel()
</ins><span class="cx">     {
</span><del>-        symbol.setUniqueId(++uniqueId);
-
-        //
-        // returning true means symbol was added to the table
-        //
-        tInsertResult result = level.insert(tLevelPair(name, &amp;symbol));
-
-        return result.second;
</del><span class="cx">     }
</span><ins>+    ~TSymbolTableLevel();
</ins><span class="cx"> 
</span><del>-    bool insert(TSymbol &amp;symbol)
-    {
-        return insert(symbol.getMangledName(), symbol);
-    }
</del><ins>+    bool insert(TSymbol *symbol);
</ins><span class="cx"> 
</span><del>-    TSymbol* find(const TString&amp; name) const
-    {
-        tLevel::const_iterator it = level.find(name);
-        if (it == level.end())
-            return 0;
-        else
-            return (*it).second;
-    }
</del><ins>+    // Insert a function using its unmangled name as the key.
+    bool insertUnmangled(TFunction *function);
</ins><span class="cx"> 
</span><del>-    void relateToOperator(const char* name, TOperator op);
-    void relateToExtension(const char* name, const TString&amp; ext);
</del><ins>+    TSymbol *find(const TString &amp;name) const;
</ins><span class="cx"> 
</span><del>-protected:
</del><ins>+  protected:
</ins><span class="cx">     tLevel level;
</span><del>-    static int uniqueId;     // for unique identification in code generation
</del><span class="cx"> };
</span><span class="cx"> 
</span><del>-enum ESymbolLevel
</del><ins>+// Define ESymbolLevel as int rather than an enum since level can go
+// above GLOBAL_LEVEL and cause atBuiltInLevel() to fail if the
+// compiler optimizes the &gt;= of the last element to ==.
+typedef int ESymbolLevel;
+const int COMMON_BUILTINS = 0;
+const int ESSL1_BUILTINS = 1;
+const int ESSL3_BUILTINS = 2;
+const int LAST_BUILTIN_LEVEL = ESSL3_BUILTINS;
+const int GLOBAL_LEVEL = 3;
+
+class TSymbolTable : angle::NonCopyable
</ins><span class="cx"> {
</span><del>-    COMMON_BUILTINS = 0,
-    ESSL1_BUILTINS = 1,
-    ESSL3_BUILTINS = 2,
-    LAST_BUILTIN_LEVEL = ESSL3_BUILTINS,
-    GLOBAL_LEVEL = 3
-};
-
-class TSymbolTable {
-public:
</del><ins>+  public:
</ins><span class="cx">     TSymbolTable()
</span><ins>+        : mGlobalInvariant(false)
</ins><span class="cx">     {
</span><del>-        //
</del><span class="cx">         // The symbol table cannot be used until push() is called, but
</span><span class="cx">         // the lack of an initial call to push() can be used to detect
</span><span class="cx">         // that the symbol table has not been preloaded with built-ins.
</span><del>-        //
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ~TSymbolTable();
</span><span class="cx"> 
</span><del>-    //
</del><span class="cx">     // When the symbol table is initialized with the built-ins, there should
</span><span class="cx">     // 'push' calls, so that built-ins are at level 0 and the shader
</span><span class="cx">     // globals are at level 1.
</span><del>-    //
-    bool isEmpty() { return table.empty(); }
-    bool atBuiltInLevel() { return currentLevel() &lt;= LAST_BUILTIN_LEVEL; }
-    bool atGlobalLevel() { return currentLevel() &lt;= GLOBAL_LEVEL; }
</del><ins>+    bool isEmpty() const
+    {
+        return table.empty();
+    }
+    bool atBuiltInLevel() const
+    {
+        return currentLevel() &lt;= LAST_BUILTIN_LEVEL;
+    }
+    bool atGlobalLevel() const
+    {
+        return currentLevel() &lt;= GLOBAL_LEVEL;
+    }
</ins><span class="cx">     void push()
</span><span class="cx">     {
</span><span class="cx">         table.push_back(new TSymbolTableLevel);
</span><span class="lines">@@ -276,151 +344,117 @@
</span><span class="cx">         precisionStack.pop_back();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool declare(TSymbol &amp;symbol)
</del><ins>+    bool declare(TSymbol *symbol)
</ins><span class="cx">     {
</span><span class="cx">         return insert(currentLevel(), symbol);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool insert(ESymbolLevel level, TSymbol &amp;symbol)
</del><ins>+    bool insert(ESymbolLevel level, TSymbol *symbol)
</ins><span class="cx">     {
</span><span class="cx">         return table[level]-&gt;insert(symbol);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    bool insert(ESymbolLevel level, const char *ext, TSymbol *symbol)
+    {
+        symbol-&gt;relateToExtension(ext);
+        return table[level]-&gt;insert(symbol);
+    }
+
</ins><span class="cx">     bool insertConstInt(ESymbolLevel level, const char *name, int value)
</span><span class="cx">     {
</span><del>-        TVariable *constant = new TVariable(NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConst, 1));
</del><ins>+        TVariable *constant = new TVariable(
+            NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConst, 1));
</ins><span class="cx">         constant-&gt;getConstPointer()-&gt;setIConst(value);
</span><del>-        return insert(level, *constant);
</del><ins>+        return insert(level, constant);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void insertBuiltIn(ESymbolLevel level, TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0)
</del><ins>+    void insertBuiltIn(ESymbolLevel level, TOperator op, const char *ext, TType *rvalue, const char *name,
+                       TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0);
+
+    void insertBuiltIn(ESymbolLevel level, TType *rvalue, const char *name,
+                       TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0)
</ins><span class="cx">     {
</span><del>-        if (ptype1-&gt;getBasicType() == EbtGSampler2D)
-        {
-            bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
-            insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
-            return;
-        }
-        else if (ptype1-&gt;getBasicType() == EbtGSampler3D)
-        {
-            bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
-            insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
-            return;
-        }
-        else if (ptype1-&gt;getBasicType() == EbtGSamplerCube)
-        {
-            bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
-            insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
-            return;
-        }
-        else if (ptype1-&gt;getBasicType() == EbtGSampler2DArray)
-        {
-            bool gvec4 = (rvalue-&gt;getBasicType() == EbtGVec4);
-            insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
-            insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
-            return;
-        }
</del><ins>+        insertBuiltIn(level, EOpNull, &quot;&quot;, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5);
+    }
</ins><span class="cx"> 
</span><del>-        TFunction *function = new TFunction(NewPoolTString(name), *rvalue);
</del><ins>+    void insertBuiltIn(ESymbolLevel level, const char *ext, TType *rvalue, const char *name,
+                       TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0)
+    {
+        insertBuiltIn(level, EOpNull, ext, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5);
+    }
</ins><span class="cx"> 
</span><del>-        TParameter param1 = {NULL, ptype1};
-        function-&gt;addParameter(param1);
-
-        if (ptype2)
-        {
-            TParameter param2 = {NULL, ptype2};
-            function-&gt;addParameter(param2);
-        }
-
-        if (ptype3)
-        {
-            TParameter param3 = {NULL, ptype3};
-            function-&gt;addParameter(param3);
-        }
-
-        if (ptype4)
-        {
-            TParameter param4 = {NULL, ptype4};
-            function-&gt;addParameter(param4);
-        }
-
-        if (ptype5)
-        {
-            TParameter param5 = {NULL, ptype5};
-            function-&gt;addParameter(param5);
-        }
-
-        insert(level, *function);
</del><ins>+    void insertBuiltIn(ESymbolLevel level, TOperator op, TType *rvalue, const char *name,
+                       TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0)
+    {
+        insertBuiltIn(level, op, &quot;&quot;, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    TSymbol *find(const TString &amp;name, int shaderVersion, bool *builtIn = NULL, bool *sameScope = NULL);
-    TSymbol *findBuiltIn(const TString &amp;name, int shaderVersion);
</del><ins>+    TSymbol *find(const TString &amp;name, int shaderVersion,
+                  bool *builtIn = NULL, bool *sameScope = NULL) const;
+    TSymbol *findBuiltIn(const TString &amp;name, int shaderVersion) const;
</ins><span class="cx">     
</span><del>-    TSymbolTableLevel *getOuterLevel() {
</del><ins>+    TSymbolTableLevel *getOuterLevel()
+    {
</ins><span class="cx">         assert(currentLevel() &gt;= 1);
</span><span class="cx">         return table[currentLevel() - 1];
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void relateToOperator(ESymbolLevel level, const char* name, TOperator op) {
-        table[level]-&gt;relateToOperator(name, op);
-    }
-    void relateToExtension(ESymbolLevel level, const char* name, const TString&amp; ext) {
-        table[level]-&gt;relateToExtension(name, ext);
-    }
</del><span class="cx">     void dump(TInfoSink &amp;infoSink) const;
</span><span class="cx"> 
</span><del>-    bool setDefaultPrecision(const TPublicType&amp; type, TPrecision prec) {
-        if (!supportsPrecision(type.type))
</del><ins>+    bool setDefaultPrecision(const TPublicType &amp;type, TPrecision prec)
+    {
+        if (!SupportsPrecision(type.type))
</ins><span class="cx">             return false;
</span><span class="cx">         if (type.isAggregate())
</span><span class="cx">             return false; // Not allowed to set for aggregate types
</span><span class="cx">         int indexOfLastElement = static_cast&lt;int&gt;(precisionStack.size()) - 1;
</span><del>-        (*precisionStack[indexOfLastElement])[type.type] = prec; // Uses map operator [], overwrites the current value
</del><ins>+        // Uses map operator [], overwrites the current value
+        (*precisionStack[indexOfLastElement])[type.type] = prec;
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Searches down the precisionStack for a precision qualifier for the specified TBasicType
-    TPrecision getDefaultPrecision( TBasicType type){
</del><ins>+    // Searches down the precisionStack for a precision qualifier
+    // for the specified TBasicType
+    TPrecision getDefaultPrecision(TBasicType type) const;
</ins><span class="cx"> 
</span><del>-        if (!supportsPrecision(type))
-            return EbpUndefined;
</del><ins>+    // This records invariant varyings declared through
+    // &quot;invariant varying_name;&quot;.
+    void addInvariantVarying(const std::string &amp;originalName)
+    {
+        mInvariantVaryings.insert(originalName);
+    }
+    // If this returns false, the varying could still be invariant
+    // if it is set as invariant during the varying variable
+    // declaration - this piece of information is stored in the
+    // variable's type, not here.
+    bool isVaryingInvariant(const std::string &amp;originalName) const
+    {
+      return (mGlobalInvariant ||
+              mInvariantVaryings.count(originalName) &gt; 0);
+    }
</ins><span class="cx"> 
</span><del>-        // unsigned integers use the same precision as signed
-        TBasicType baseType = (type == EbtUInt) ? EbtInt : type;
</del><ins>+    void setGlobalInvariant() { mGlobalInvariant = true; }
+    bool getGlobalInvariant() const { return mGlobalInvariant; }
</ins><span class="cx"> 
</span><del>-        int level = static_cast&lt;int&gt;(precisionStack.size()) - 1;
-        assert(level &gt;= 0); // Just to be safe. Should not happen.
-        PrecisionStackLevel::iterator it;
-        TPrecision prec = EbpUndefined; // If we dont find anything we return this. Should we error check this?
-        while (level &gt;= 0) {
-            it = precisionStack[level]-&gt;find(baseType);
-            if (it != precisionStack[level]-&gt;end()) {
-                prec = (*it).second;
-                break;
-            }
-            level--;
-        }
-        return prec;
</del><ins>+    static int nextUniqueId()
+    {
+        return ++uniqueIdCounter;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-private:
-    ESymbolLevel currentLevel() const { return static_cast&lt;ESymbolLevel&gt;(table.size() - 1); }
-
-    bool supportsPrecision(TBasicType type) {
-      // Only supports precision for int, float, and sampler types.
-      return type == EbtFloat || type == EbtInt || type == EbtUInt || IsSampler(type);
</del><ins>+  private:
+    ESymbolLevel currentLevel() const
+    {
+        return static_cast&lt;ESymbolLevel&gt;(table.size() - 1);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    std::vector&lt;TSymbolTableLevel*&gt; table;
</del><ins>+    std::vector&lt;TSymbolTableLevel *&gt; table;
</ins><span class="cx">     typedef TMap&lt;TBasicType, TPrecision&gt; PrecisionStackLevel;
</span><del>-    std::vector&lt; PrecisionStackLevel*&gt; precisionStack;
</del><ins>+    std::vector&lt; PrecisionStackLevel *&gt; precisionStack;
+
+    std::set&lt;std::string&gt; mInvariantVaryings;
+    bool mGlobalInvariant;
+
+    static int uniqueIdCounter;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // _SYMBOL_TABLE_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_SYMBOLTABLE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorESSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,38 +6,97 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/TranslatorESSL.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;compiler/translator/BuiltInFunctionEmulatorGLSL.h&quot;
+#include &quot;compiler/translator/EmulatePrecision.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/OutputESSL.h&quot;
</span><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> 
</span><del>-TranslatorESSL::TranslatorESSL(ShShaderType type, ShShaderSpec spec)
-    : TCompiler(type, spec) {
</del><ins>+TranslatorESSL::TranslatorESSL(sh::GLenum type, ShShaderSpec spec)
+    : TCompiler(type, spec, SH_ESSL_OUTPUT)
+{
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TranslatorESSL::translate(TIntermNode* root) {
</del><ins>+void TranslatorESSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions)
+{
+    if (compileOptions &amp; SH_EMULATE_BUILT_IN_FUNCTIONS)
+        InitBuiltInFunctionEmulatorForGLSL(emu, getShaderType());
+}
+
+void TranslatorESSL::translate(TIntermNode *root, int) {
</ins><span class="cx">     TInfoSinkBase&amp; sink = getInfoSink().obj;
</span><span class="cx"> 
</span><ins>+    int shaderVersion = getShaderVersion();
+    if (shaderVersion &gt; 100)
+    {
+        sink &lt;&lt; &quot;#version &quot; &lt;&lt; shaderVersion &lt;&lt; &quot; es\n&quot;;
+    }
+
+    writePragma();
+
</ins><span class="cx">     // Write built-in extension behaviors.
</span><span class="cx">     writeExtensionBehavior();
</span><span class="cx"> 
</span><ins>+    bool precisionEmulation = getResources().WEBGL_debug_shader_precision &amp;&amp; getPragma().debugShaderPrecision;
+
+    if (precisionEmulation)
+    {
+        EmulatePrecision emulatePrecision;
+        root-&gt;traverse(&amp;emulatePrecision);
+        emulatePrecision.updateTree();
+        emulatePrecision.writeEmulationHelpers(sink, SH_ESSL_OUTPUT);
+    }
+
</ins><span class="cx">     // Write emulated built-in functions if needed.
</span><del>-    getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
-        sink, getShaderType() == SH_FRAGMENT_SHADER);
</del><ins>+    if (!getBuiltInFunctionEmulator().IsOutputEmpty())
+    {
+        sink &lt;&lt; &quot;// BEGIN: Generated code for built-in function emulation\n\n&quot;;
+        if (getShaderType() == GL_FRAGMENT_SHADER)
+        {
+            sink &lt;&lt; &quot;#if defined(GL_FRAGMENT_PRECISION_HIGH)\n&quot;
+                 &lt;&lt; &quot;#define webgl_emu_precision highp\n&quot;
+                 &lt;&lt; &quot;#else\n&quot;
+                 &lt;&lt; &quot;#define webgl_emu_precision mediump\n&quot;
+                 &lt;&lt; &quot;#endif\n\n&quot;;
+        }
+        else
+        {
+            sink &lt;&lt; &quot;#define webgl_emu_precision highp\n&quot;;
+        }
</ins><span class="cx"> 
</span><ins>+        getBuiltInFunctionEmulator().OutputEmulatedFunctions(sink);
+        sink &lt;&lt; &quot;// END: Generated code for built-in function emulation\n\n&quot;;
+    }
+
</ins><span class="cx">     // Write array bounds clamping emulation if needed.
</span><span class="cx">     getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
</span><span class="cx"> 
</span><span class="cx">     // Write translated shader.
</span><del>-    TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
</del><ins>+    TOutputESSL outputESSL(sink,
+                           getArrayIndexClampingStrategy(),
+                           getHashFunction(),
+                           getNameMap(),
+                           getSymbolTable(),
+                           shaderVersion,
+                           precisionEmulation);
</ins><span class="cx">     root-&gt;traverse(&amp;outputESSL);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TranslatorESSL::writeExtensionBehavior() {
</span><span class="cx">     TInfoSinkBase&amp; sink = getInfoSink().obj;
</span><del>-    const TExtensionBehavior&amp; extensionBehavior = getExtensionBehavior();
-    for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
-         iter != extensionBehavior.end(); ++iter) {
</del><ins>+    const TExtensionBehavior&amp; extBehavior = getExtensionBehavior();
+    for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
+         iter != extBehavior.end(); ++iter) {
</ins><span class="cx">         if (iter-&gt;second != EBhUndefined) {
</span><del>-            sink &lt;&lt; &quot;#extension &quot; &lt;&lt; iter-&gt;first &lt;&lt; &quot; : &quot;
-                 &lt;&lt; getBehaviorString(iter-&gt;second) &lt;&lt; &quot;\n&quot;;
</del><ins>+            if (getResources().NV_shader_framebuffer_fetch &amp;&amp; iter-&gt;first == &quot;GL_EXT_shader_framebuffer_fetch&quot;) {
+                sink &lt;&lt; &quot;#extension GL_NV_shader_framebuffer_fetch : &quot;
+                     &lt;&lt; getBehaviorString(iter-&gt;second) &lt;&lt; &quot;\n&quot;;
+            } else if (getResources().NV_draw_buffers &amp;&amp; iter-&gt;first == &quot;GL_EXT_draw_buffers&quot;) {
+                sink &lt;&lt; &quot;#extension GL_NV_draw_buffers : &quot;
+                     &lt;&lt; getBehaviorString(iter-&gt;second) &lt;&lt; &quot;\n&quot;;
+            } else {
+                sink &lt;&lt; &quot;#extension &quot; &lt;&lt; iter-&gt;first &lt;&lt; &quot; : &quot;
+                     &lt;&lt; getBehaviorString(iter-&gt;second) &lt;&lt; &quot;\n&quot;;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorESSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorESSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,20 +4,23 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_TRANSLATORESSL_H_
-#define COMPILER_TRANSLATORESSL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_TRANSLATORESSL_H_
+#define COMPILER_TRANSLATOR_TRANSLATORESSL_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
</del><ins>+#include &quot;compiler/translator/Compiler.h&quot;
</ins><span class="cx"> 
</span><del>-class TranslatorESSL : public TCompiler {
-public:
-    TranslatorESSL(ShShaderType type, ShShaderSpec spec);
</del><ins>+class TranslatorESSL : public TCompiler
+{
+  public:
+    TranslatorESSL(sh::GLenum type, ShShaderSpec spec);
</ins><span class="cx"> 
</span><del>-protected:
-    virtual void translate(TIntermNode* root);
</del><ins>+  protected:
+    void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) override;
</ins><span class="cx"> 
</span><del>-private:
</del><ins>+    virtual void translate(TIntermNode *root, int compileOptions) override;
+
+  private:
</ins><span class="cx">     void writeExtensionBehavior();
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_TRANSLATORESSL_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_TRANSLATORESSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorGLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,51 +6,148 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/TranslatorGLSL.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;angle_gl.h&quot;
+#include &quot;compiler/translator/BuiltInFunctionEmulatorGLSL.h&quot;
+#include &quot;compiler/translator/EmulatePrecision.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/OutputGLSL.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/VersionGLSL.h&quot;
</span><span class="cx"> 
</span><del>-static void writeVersion(ShShaderType type, TIntermNode* root,
-                         TInfoSinkBase&amp; sink) {
-    TVersionGLSL versionGLSL(type);
-    root-&gt;traverse(&amp;versionGLSL);
-    int version = versionGLSL.getVersion();
-    // We need to write version directive only if it is greater than 110.
-    // If there is no version directive in the shader, 110 is implied.
-    if (version &gt; 110) {
-        sink &lt;&lt; &quot;#version &quot; &lt;&lt; version &lt;&lt; &quot;\n&quot;;
</del><ins>+namespace
+{
+
+// To search for what output variables are used in a fragment shader.
+// We handle gl_FragColor and gl_FragData at the moment.
+class TFragmentOutSearcher : public TIntermTraverser
+{
+  public:
+    TFragmentOutSearcher()
+        : mUsesGlFragColor(false),
+          mUsesGlFragData(false)
+    {
</ins><span class="cx">     }
</span><ins>+
+    bool usesGlFragColor() const
+    {
+        return mUsesGlFragColor;
+    }
+
+    bool usesGlFragData() const
+    {
+        return mUsesGlFragData;
+    }
+
+  protected:
+    virtual void visitSymbol(TIntermSymbol *node) override
+    {
+        if (node-&gt;getSymbol() == &quot;gl_FragColor&quot;)
+        {
+            mUsesGlFragColor = true;
+        }
+        else if (node-&gt;getSymbol() == &quot;gl_FragData&quot;)
+        {
+            mUsesGlFragData = true;
+        }
+    }
+
+  private:
+    bool mUsesGlFragColor;
+    bool mUsesGlFragData;
+};
+
+}  // namespace anonymous
+
+TranslatorGLSL::TranslatorGLSL(sh::GLenum type,
+                               ShShaderSpec spec,
+                               ShShaderOutput output)
+    : TCompiler(type, spec, output) {
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-TranslatorGLSL::TranslatorGLSL(ShShaderType type, ShShaderSpec spec)
-    : TCompiler(type, spec) {
</del><ins>+void TranslatorGLSL::initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions)
+{
+    if (compileOptions &amp; SH_EMULATE_BUILT_IN_FUNCTIONS)
+        InitBuiltInFunctionEmulatorForGLSL(emu, getShaderType());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TranslatorGLSL::translate(TIntermNode* root) {
</del><ins>+void TranslatorGLSL::translate(TIntermNode *root, int) {
</ins><span class="cx">     TInfoSinkBase&amp; sink = getInfoSink().obj;
</span><span class="cx"> 
</span><span class="cx">     // Write GLSL version.
</span><del>-    writeVersion(getShaderType(), root, sink);
</del><ins>+    writeVersion(root);
</ins><span class="cx"> 
</span><ins>+    writePragma();
+
</ins><span class="cx">     // Write extension behaviour as needed
</span><span class="cx">     writeExtensionBehavior();
</span><span class="cx"> 
</span><ins>+    bool precisionEmulation = getResources().WEBGL_debug_shader_precision &amp;&amp; getPragma().debugShaderPrecision;
+
+    if (precisionEmulation)
+    {
+        EmulatePrecision emulatePrecision;
+        root-&gt;traverse(&amp;emulatePrecision);
+        emulatePrecision.updateTree();
+        emulatePrecision.writeEmulationHelpers(sink, getOutputType());
+    }
+
</ins><span class="cx">     // Write emulated built-in functions if needed.
</span><del>-    getBuiltInFunctionEmulator().OutputEmulatedFunctionDefinition(
-        sink, false);
</del><ins>+    if (!getBuiltInFunctionEmulator().IsOutputEmpty())
+    {
+        sink &lt;&lt; &quot;// BEGIN: Generated code for built-in function emulation\n\n&quot;;
+        sink &lt;&lt; &quot;#define webgl_emu_precision\n\n&quot;;
+        getBuiltInFunctionEmulator().OutputEmulatedFunctions(sink);
+        sink &lt;&lt; &quot;// END: Generated code for built-in function emulation\n\n&quot;;
+    }
</ins><span class="cx"> 
</span><span class="cx">     // Write array bounds clamping emulation if needed.
</span><span class="cx">     getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
</span><span class="cx"> 
</span><ins>+    // Declare gl_FragColor and glFragData as webgl_FragColor and webgl_FragData
+    // if it's core profile shaders and they are used.
+    if (getShaderType() == GL_FRAGMENT_SHADER &amp;&amp; IsGLSL130OrNewer(getOutputType()))
+    {
+        TFragmentOutSearcher searcher;
+        root-&gt;traverse(&amp;searcher);
+        ASSERT(!(searcher.usesGlFragData() &amp;&amp; searcher.usesGlFragColor()));
+        if (searcher.usesGlFragColor())
+        {
+            sink &lt;&lt; &quot;out vec4 webgl_FragColor;\n&quot;;
+        }
+        if (searcher.usesGlFragData())
+        {
+            sink &lt;&lt; &quot;out vec4 webgl_FragData[gl_MaxDrawBuffers];\n&quot;;
+        }
+    }
+
</ins><span class="cx">     // Write translated shader.
</span><del>-    TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
</del><ins>+    TOutputGLSL outputGLSL(sink,
+                           getArrayIndexClampingStrategy(),
+                           getHashFunction(),
+                           getNameMap(),
+                           getSymbolTable(),
+                           getShaderVersion(),
+                           getOutputType());
</ins><span class="cx">     root-&gt;traverse(&amp;outputGLSL);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TranslatorGLSL::writeVersion(TIntermNode *root)
+{
+    TVersionGLSL versionGLSL(getShaderType(), getPragma(), getOutputType());
+    root-&gt;traverse(&amp;versionGLSL);
+    int version = versionGLSL.getVersion();
+    // We need to write version directive only if it is greater than 110.
+    // If there is no version directive in the shader, 110 is implied.
+    if (version &gt; 110)
+    {
+        TInfoSinkBase&amp; sink = getInfoSink().obj;
+        sink &lt;&lt; &quot;#version &quot; &lt;&lt; version &lt;&lt; &quot;\n&quot;;
+    }
+}
+
</ins><span class="cx"> void TranslatorGLSL::writeExtensionBehavior() {
</span><span class="cx">     TInfoSinkBase&amp; sink = getInfoSink().obj;
</span><del>-    const TExtensionBehavior&amp; extensionBehavior = getExtensionBehavior();
-    for (TExtensionBehavior::const_iterator iter = extensionBehavior.begin();
-         iter != extensionBehavior.end(); ++iter) {
</del><ins>+    const TExtensionBehavior&amp; extBehavior = getExtensionBehavior();
+    for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
+         iter != extBehavior.end(); ++iter) {
</ins><span class="cx">         if (iter-&gt;second == EBhUndefined)
</span><span class="cx">             continue;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorGLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorGLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,20 +4,24 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_TRANSLATORGLSL_H_
-#define COMPILER_TRANSLATORGLSL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_TRANSLATORGLSL_H_
+#define COMPILER_TRANSLATOR_TRANSLATORGLSL_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
</del><ins>+#include &quot;compiler/translator/Compiler.h&quot;
</ins><span class="cx"> 
</span><del>-class TranslatorGLSL : public TCompiler {
-public:
-    TranslatorGLSL(ShShaderType type, ShShaderSpec spec);
</del><ins>+class TranslatorGLSL : public TCompiler
+{
+  public:
+    TranslatorGLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
</ins><span class="cx"> 
</span><del>-protected:
-    virtual void translate(TIntermNode* root);
</del><ins>+  protected:
+    void initBuiltInFunctionEmulator(BuiltInFunctionEmulator *emu, int compileOptions) override;
</ins><span class="cx"> 
</span><del>-private:
</del><ins>+    virtual void translate(TIntermNode *root, int compileOptions) override;
+
+  private:
+    void writeVersion(TIntermNode *root);
</ins><span class="cx">     void writeExtensionBehavior();
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_TRANSLATORGLSL_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_TRANSLATORGLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorHLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,24 +6,61 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/TranslatorHLSL.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/InitializeParseContext.h&quot;
</del><ins>+#include &quot;compiler/translator/ArrayReturnValueToOutParameter.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/OutputHLSL.h&quot;
</span><ins>+#include &quot;compiler/translator/SeparateArrayInitialization.h&quot;
+#include &quot;compiler/translator/SeparateDeclarations.h&quot;
+#include &quot;compiler/translator/SimplifyArrayAssignment.h&quot;
</ins><span class="cx"> 
</span><del>-TranslatorHLSL::TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output)
-    : TCompiler(type, spec), mOutputType(output)
</del><ins>+TranslatorHLSL::TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output)
+    : TCompiler(type, spec, output)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TranslatorHLSL::translate(TIntermNode *root)
</del><ins>+void TranslatorHLSL::translate(TIntermNode *root, int compileOptions)
</ins><span class="cx"> {
</span><del>-    TParseContext&amp; parseContext = *GetGlobalParseContext();
-    sh::OutputHLSL outputHLSL(parseContext, getResources(), mOutputType);
</del><ins>+    const ShBuiltInResources &amp;resources = getResources();
+    int numRenderTargets = resources.EXT_draw_buffers ? resources.MaxDrawBuffers : 1;
</ins><span class="cx"> 
</span><del>-    outputHLSL.output();
</del><ins>+    SeparateArrayDeclarations(root);
</ins><span class="cx"> 
</span><del>-    mActiveUniforms         = outputHLSL.getUniforms();
-    mActiveInterfaceBlocks  = outputHLSL.getInterfaceBlocks();
-    mActiveOutputVariables  = outputHLSL.getOutputVariables();
-    mActiveAttributes       = outputHLSL.getAttributes();
-    mActiveVaryings         = outputHLSL.getVaryings();
</del><ins>+    // Note that SeparateDeclarations needs to be run before SeparateArrayInitialization.
+    SeparateArrayInitialization(root);
+
+    SimplifyArrayAssignment simplify;
+    root-&gt;traverse(&amp;simplify);
+
+    // HLSL doesn't support arrays as return values, we'll need to make functions that have an array
+    // as a return value to use an out parameter to transfer the array data instead.
+    ArrayReturnValueToOutParameter(root);
+
+    sh::OutputHLSL outputHLSL(getShaderType(), getShaderVersion(), getExtensionBehavior(),
+        getSourcePath(), getOutputType(), numRenderTargets, getUniforms(), compileOptions);
+
+    outputHLSL.output(root, getInfoSink().obj);
+
+    mInterfaceBlockRegisterMap = outputHLSL.getInterfaceBlockRegisterMap();
+    mUniformRegisterMap = outputHLSL.getUniformRegisterMap();
</ins><span class="cx"> }
</span><ins>+
+bool TranslatorHLSL::hasInterfaceBlock(const std::string &amp;interfaceBlockName) const
+{
+    return (mInterfaceBlockRegisterMap.count(interfaceBlockName) &gt; 0);
+}
+
+unsigned int TranslatorHLSL::getInterfaceBlockRegister(const std::string &amp;interfaceBlockName) const
+{
+    ASSERT(hasInterfaceBlock(interfaceBlockName));
+    return mInterfaceBlockRegisterMap.find(interfaceBlockName)-&gt;second;
+}
+
+bool TranslatorHLSL::hasUniform(const std::string &amp;uniformName) const
+{
+    return (mUniformRegisterMap.count(uniformName) &gt; 0);
+}
+
+unsigned int TranslatorHLSL::getUniformRegister(const std::string &amp;uniformName) const
+{
+    ASSERT(hasUniform(uniformName));
+    return mUniformRegisterMap.find(uniformName)-&gt;second;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTranslatorHLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/TranslatorHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,32 +4,28 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_TRANSLATORHLSL_H_
-#define COMPILER_TRANSLATORHLSL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_TRANSLATORHLSL_H_
+#define COMPILER_TRANSLATOR_TRANSLATORHLSL_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
-#include &quot;common/shadervars.h&quot;
</del><ins>+#include &quot;compiler/translator/Compiler.h&quot;
</ins><span class="cx"> 
</span><del>-class TranslatorHLSL : public TCompiler {
-public:
-    TranslatorHLSL(ShShaderType type, ShShaderSpec spec, ShShaderOutput output);
-
</del><ins>+class TranslatorHLSL : public TCompiler
+{
+  public:
+    TranslatorHLSL(sh::GLenum type, ShShaderSpec spec, ShShaderOutput output);
</ins><span class="cx">     virtual TranslatorHLSL *getAsTranslatorHLSL() { return this; }
</span><del>-    const std::vector&lt;gl::Uniform&gt; &amp;getUniforms() { return mActiveUniforms; }
-    const std::vector&lt;gl::InterfaceBlock&gt; &amp;getInterfaceBlocks() const { return mActiveInterfaceBlocks; }
-    const std::vector&lt;gl::Attribute&gt; &amp;getOutputVariables() { return mActiveOutputVariables; }
-    const std::vector&lt;gl::Attribute&gt; &amp;getAttributes() { return mActiveAttributes; }
-    const std::vector&lt;gl::Varying&gt; &amp;getVaryings() { return mActiveVaryings; }
</del><span class="cx"> 
</span><del>-protected:
-    virtual void translate(TIntermNode* root);
</del><ins>+    bool hasInterfaceBlock(const std::string &amp;interfaceBlockName) const;
+    unsigned int getInterfaceBlockRegister(const std::string &amp;interfaceBlockName) const;
</ins><span class="cx"> 
</span><del>-    std::vector&lt;gl::Uniform&gt; mActiveUniforms;
-    std::vector&lt;gl::InterfaceBlock&gt; mActiveInterfaceBlocks;
-    std::vector&lt;gl::Attribute&gt; mActiveOutputVariables;
-    std::vector&lt;gl::Attribute&gt; mActiveAttributes;
-    std::vector&lt;gl::Varying&gt; mActiveVaryings;
-    ShShaderOutput mOutputType;
</del><ins>+    bool hasUniform(const std::string &amp;uniformName) const;
+    unsigned int getUniformRegister(const std::string &amp;uniformName) const;
+
+  protected:
+    virtual void translate(TIntermNode *root, int compileOptions) override;
+
+    std::map&lt;std::string, unsigned int&gt; mInterfaceBlockRegisterMap;
+    std::map&lt;std::string, unsigned int&gt; mUniformRegisterMap;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_TRANSLATORHLSL_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_TRANSLATORHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTypescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,246 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+#if defined(_MSC_VER)
+#pragma warning(disable: 4718)
+#endif
+
+#include &quot;compiler/translator/Types.h&quot;
+
+#include &lt;algorithm&gt;
+#include &lt;climits&gt;
+
+const char* getBasicString(TBasicType t)
+{
+    switch (t)
+    {
+      case EbtVoid:                 return &quot;void&quot;;                 break;
+      case EbtFloat:                return &quot;float&quot;;                break;
+      case EbtInt:                  return &quot;int&quot;;                  break;
+      case EbtUInt:                 return &quot;uint&quot;;                 break;
+      case EbtBool:                 return &quot;bool&quot;;                 break;
+      case EbtSampler2D:            return &quot;sampler2D&quot;;            break;
+      case EbtSampler3D:            return &quot;sampler3D&quot;;            break;
+      case EbtSamplerCube:          return &quot;samplerCube&quot;;          break;
+      case EbtSamplerExternalOES:   return &quot;samplerExternalOES&quot;;   break;
+      case EbtSampler2DRect:        return &quot;sampler2DRect&quot;;        break;
+      case EbtSampler2DArray:       return &quot;sampler2DArray&quot;;       break;
+      case EbtISampler2D:           return &quot;isampler2D&quot;;           break;
+      case EbtISampler3D:           return &quot;isampler3D&quot;;           break;
+      case EbtISamplerCube:         return &quot;isamplerCube&quot;;         break;
+      case EbtISampler2DArray:      return &quot;isampler2DArray&quot;;      break;
+      case EbtUSampler2D:           return &quot;usampler2D&quot;;           break;
+      case EbtUSampler3D:           return &quot;usampler3D&quot;;           break;
+      case EbtUSamplerCube:         return &quot;usamplerCube&quot;;         break;
+      case EbtUSampler2DArray:      return &quot;usampler2DArray&quot;;      break;
+      case EbtSampler2DShadow:      return &quot;sampler2DShadow&quot;;      break;
+      case EbtSamplerCubeShadow:    return &quot;samplerCubeShadow&quot;;    break;
+      case EbtSampler2DArrayShadow: return &quot;sampler2DArrayShadow&quot;; break;
+      case EbtStruct:               return &quot;structure&quot;;            break;
+      case EbtInterfaceBlock:       return &quot;interface block&quot;;      break;
+      default: UNREACHABLE();       return &quot;unknown type&quot;;
+    }
+}
+
+TType::TType(const TPublicType &amp;p)
+    : type(p.type), precision(p.precision), qualifier(p.qualifier), layoutQualifier(p.layoutQualifier),
+      primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), arraySize(p.arraySize),
+      interfaceBlock(0), structure(0)
+{
+    if (p.userDef)
+        structure = p.userDef-&gt;getStruct();
+}
+
+bool TStructure::equals(const TStructure &amp;other) const
+{
+    return (uniqueId() == other.uniqueId());
+}
+
+//
+// Recursively generate mangled names.
+//
+TString TType::buildMangledName() const
+{
+    TString mangledName;
+    if (isMatrix())
+        mangledName += 'm';
+    else if (isVector())
+        mangledName += 'v';
+
+    switch (type)
+    {
+      case EbtFloat:
+        mangledName += 'f';
+        break;
+      case EbtInt:
+        mangledName += 'i';
+        break;
+      case EbtUInt:
+        mangledName += 'u';
+        break;
+      case EbtBool:
+        mangledName += 'b';
+        break;
+      case EbtSampler2D:
+        mangledName += &quot;s2&quot;;
+        break;
+      case EbtSampler3D:
+        mangledName += &quot;s3&quot;;
+        break;
+      case EbtSamplerCube:
+        mangledName += &quot;sC&quot;;
+        break;
+      case EbtSampler2DArray:
+        mangledName += &quot;s2a&quot;;
+        break;
+      case EbtSamplerExternalOES:
+        mangledName += &quot;sext&quot;;
+        break;
+      case EbtSampler2DRect:
+        mangledName += &quot;s2r&quot;;
+        break;
+      case EbtISampler2D:
+        mangledName += &quot;is2&quot;;
+        break;
+      case EbtISampler3D:
+        mangledName += &quot;is3&quot;;
+        break;
+      case EbtISamplerCube:
+        mangledName += &quot;isC&quot;;
+        break;
+      case EbtISampler2DArray:
+        mangledName += &quot;is2a&quot;;
+        break;
+      case EbtUSampler2D:
+        mangledName += &quot;us2&quot;;
+        break;
+      case EbtUSampler3D:
+        mangledName += &quot;us3&quot;;
+        break;
+      case EbtUSamplerCube:
+        mangledName += &quot;usC&quot;;
+        break;
+      case EbtUSampler2DArray:
+        mangledName += &quot;us2a&quot;;
+        break;
+      case EbtSampler2DShadow:
+        mangledName += &quot;s2s&quot;;
+        break;
+      case EbtSamplerCubeShadow:
+        mangledName += &quot;sCs&quot;;
+        break;
+      case EbtSampler2DArrayShadow:
+        mangledName += &quot;s2as&quot;;
+        break;
+      case EbtStruct:
+        mangledName += structure-&gt;mangledName();
+        break;
+      case EbtInterfaceBlock:
+        mangledName += interfaceBlock-&gt;mangledName();
+        break;
+      default:
+        UNREACHABLE();
+    }
+
+    if (isMatrix())
+    {
+        mangledName += static_cast&lt;char&gt;('0' + getCols());
+        mangledName += static_cast&lt;char&gt;('x');
+        mangledName += static_cast&lt;char&gt;('0' + getRows());
+    }
+    else
+    {
+        mangledName += static_cast&lt;char&gt;('0' + getNominalSize());
+    }
+
+    if (isArray())
+    {
+        char buf[20];
+        snprintf(buf, sizeof(buf), &quot;%d&quot;, arraySize);
+        mangledName += '[';
+        mangledName += buf;
+        mangledName += ']';
+    }
+    return mangledName;
+}
+
+size_t TType::getObjectSize() const
+{
+    size_t totalSize;
+
+    if (getBasicType() == EbtStruct)
+        totalSize = structure-&gt;objectSize();
+    else
+        totalSize = primarySize * secondarySize;
+
+    if (isArray())
+    {
+        // TODO: getArraySize() returns an int, not a size_t
+        size_t currentArraySize = getArraySize();
+        if (currentArraySize &gt; INT_MAX / totalSize)
+            totalSize = INT_MAX;
+        else
+            totalSize *= currentArraySize;
+    }
+
+    return totalSize;
+}
+
+bool TStructure::containsArrays() const
+{
+    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i)
+    {
+        const TType *fieldType = (*mFields)[i]-&gt;type();
+        if (fieldType-&gt;isArray() || fieldType-&gt;isStructureContainingArrays())
+            return true;
+    }
+    return false;
+}
+
+bool TStructure::containsSamplers() const
+{
+    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i)
+    {
+        const TType *fieldType = (*mFields)[i]-&gt;type();
+        if (IsSampler(fieldType-&gt;getBasicType()) || fieldType-&gt;isStructureContainingSamplers())
+            return true;
+    }
+    return false;
+}
+
+TString TFieldListCollection::buildMangledName() const
+{
+    TString mangledName(mangledNamePrefix());
+    mangledName += *mName;
+    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i)
+    {
+        mangledName += '-';
+        mangledName += (*mFields)[i]-&gt;type()-&gt;getMangledName();
+    }
+    return mangledName;
+}
+
+size_t TFieldListCollection::calculateObjectSize() const
+{
+    size_t size = 0;
+    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i)
+    {
+        size_t fieldSize = (*mFields)[i]-&gt;type()-&gt;getObjectSize();
+        if (fieldSize &gt; INT_MAX - size)
+            size = INT_MAX;
+        else
+            size += fieldSize;
+    }
+    return size;
+}
+
+int TStructure::calculateDeepestNesting() const
+{
+    int maxNesting = 0;
+    for (size_t i = 0; i &lt; mFields-&gt;size(); ++i)
+        maxNesting = std::max(maxNesting, (*mFields)[i]-&gt;type()-&gt;getDeepestStructNesting());
+    return 1 + maxNesting;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/Types.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,75 +4,101 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _TYPES_INCLUDED
-#define _TYPES_INCLUDED
</del><ins>+#ifndef COMPILER_TRANSLATOR_TYPES_H_
+#define COMPILER_TRANSLATOR_TYPES_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;common/angleutils.h&quot;
</span><ins>+#include &quot;common/debug.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/BaseTypes.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/Common.h&quot;
</span><del>-#include &quot;compiler/translator/compilerdebug.h&quot;
</del><span class="cx"> 
</span><span class="cx"> struct TPublicType;
</span><span class="cx"> class TType;
</span><ins>+class TSymbol;
</ins><span class="cx"> 
</span><del>-class TField
</del><ins>+class TField : angle::NonCopyable
</ins><span class="cx"> {
</span><del>-public:
</del><ins>+  public:
</ins><span class="cx">     POOL_ALLOCATOR_NEW_DELETE();
</span><del>-    TField(TType* type, TString* name, const TSourceLoc&amp; line) : mType(type), mName(name), mLine(line) {}
</del><ins>+    TField(TType *type, TString *name, const TSourceLoc &amp;line)
+        : mType(type),
+          mName(name),
+          mLine(line)
+    {
+    }
</ins><span class="cx"> 
</span><span class="cx">     // TODO(alokp): We should only return const type.
</span><span class="cx">     // Fix it by tweaking grammar.
</span><del>-    TType* type() { return mType; }
-    const TType* type() const { return mType; }
</del><ins>+    TType *type()
+    {
+        return mType;
+    }
+    const TType *type() const
+    {
+        return mType;
+    }
</ins><span class="cx"> 
</span><del>-    const TString&amp; name() const { return *mName; }
-    const TSourceLoc&amp; line() const { return mLine; }
</del><ins>+    const TString &amp;name() const
+    {
+        return *mName;
+    }
+    const TSourceLoc &amp;line() const
+    {
+        return mLine;
+    }
</ins><span class="cx"> 
</span><del>-private:
-    DISALLOW_COPY_AND_ASSIGN(TField);
-    TType* mType;
-    TString* mName;
</del><ins>+  private:
+    TType *mType;
+    TString *mName;
</ins><span class="cx">     TSourceLoc mLine;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-typedef TVector&lt;TField*&gt; TFieldList;
-inline TFieldList* NewPoolTFieldList()
</del><ins>+typedef TVector&lt;TField *&gt; TFieldList;
+inline TFieldList *NewPoolTFieldList()
</ins><span class="cx"> {
</span><del>-    void* memory = GetGlobalPoolAllocator()-&gt;allocate(sizeof(TFieldList));
</del><ins>+    void *memory = GetGlobalPoolAllocator()-&gt;allocate(sizeof(TFieldList));
</ins><span class="cx">     return new(memory) TFieldList;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-class TFieldListCollection
</del><ins>+class TFieldListCollection : angle::NonCopyable
</ins><span class="cx"> {
</span><del>-public:
-    const TString&amp; name() const { return *mName; }
-    const TFieldList&amp; fields() const { return *mFields; }
</del><ins>+  public:
+    const TString &amp;name() const
+    {
+        return *mName;
+    }
+    const TFieldList &amp;fields() const
+    {
+        return *mFields;
+    }
</ins><span class="cx"> 
</span><del>-    const TString&amp; mangledName() const {
</del><ins>+    const TString &amp;mangledName() const
+    {
</ins><span class="cx">         if (mMangledName.empty())
</span><span class="cx">             mMangledName = buildMangledName();
</span><span class="cx">         return mMangledName;
</span><span class="cx">     }
</span><del>-    size_t objectSize() const {
</del><ins>+    size_t objectSize() const
+    {
</ins><span class="cx">         if (mObjectSize == 0)
</span><span class="cx">             mObjectSize = calculateObjectSize();
</span><span class="cx">         return mObjectSize;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-protected:
-    TFieldListCollection(const TString* name, TFieldList* fields)
</del><ins>+  protected:
+    TFieldListCollection(const TString *name, TFieldList *fields)
</ins><span class="cx">         : mName(name),
</span><span class="cx">           mFields(fields),
</span><del>-          mObjectSize(0) {
</del><ins>+          mObjectSize(0)
+    {
</ins><span class="cx">     }
</span><span class="cx">     TString buildMangledName() const;
</span><span class="cx">     size_t calculateObjectSize() const;
</span><span class="cx">     virtual TString mangledNamePrefix() const = 0;
</span><span class="cx"> 
</span><del>-    const TString* mName;
-    TFieldList* mFields;
</del><ins>+    const TString *mName;
+    TFieldList *mFields;
</ins><span class="cx"> 
</span><span class="cx">     mutable TString mMangledName;
</span><span class="cx">     mutable size_t mObjectSize;
</span><span class="lines">@@ -81,52 +107,116 @@
</span><span class="cx"> // May also represent interface blocks
</span><span class="cx"> class TStructure : public TFieldListCollection
</span><span class="cx"> {
</span><del>-public:
</del><ins>+  public:
</ins><span class="cx">     POOL_ALLOCATOR_NEW_DELETE();
</span><del>-    TStructure(const TString* name, TFieldList* fields)
</del><ins>+    TStructure(const TString *name, TFieldList *fields)
</ins><span class="cx">         : TFieldListCollection(name, fields),
</span><del>-          mDeepestNesting(0) {
</del><ins>+          mDeepestNesting(0),
+          mUniqueId(0),
+          mAtGlobalScope(false)
+    {
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int deepestNesting() const {
</del><ins>+    int deepestNesting() const
+    {
</ins><span class="cx">         if (mDeepestNesting == 0)
</span><span class="cx">             mDeepestNesting = calculateDeepestNesting();
</span><span class="cx">         return mDeepestNesting;
</span><span class="cx">     }
</span><span class="cx">     bool containsArrays() const;
</span><ins>+    bool containsSamplers() const;
</ins><span class="cx"> 
</span><del>-private:
-    DISALLOW_COPY_AND_ASSIGN(TStructure);
-    virtual TString mangledNamePrefix() const { return &quot;struct-&quot;; }
</del><ins>+    bool equals(const TStructure &amp;other) const;
+
+    void setUniqueId(int uniqueId)
+    {
+        mUniqueId = uniqueId;
+    }
+
+    int uniqueId() const
+    {
+        ASSERT(mUniqueId != 0);
+        return mUniqueId;
+    }
+
+    void setAtGlobalScope(bool atGlobalScope)
+    {
+        mAtGlobalScope = atGlobalScope;
+    }
+
+    bool atGlobalScope() const
+    {
+        return mAtGlobalScope;
+    }
+
+  private:
+    // TODO(zmo): Find a way to get rid of the const_cast in function
+    // setName().  At the moment keep this function private so only
+    // friend class RegenerateStructNames may call it.
+    friend class RegenerateStructNames;
+    void setName(const TString &amp;name)
+    {
+        TString *mutableName = const_cast&lt;TString *&gt;(mName);
+        *mutableName = name;
+    }
+
+    virtual TString mangledNamePrefix() const
+    {
+        return &quot;struct-&quot;;
+    }
</ins><span class="cx">     int calculateDeepestNesting() const;
</span><span class="cx"> 
</span><span class="cx">     mutable int mDeepestNesting;
</span><ins>+    int mUniqueId;
+    bool mAtGlobalScope;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class TInterfaceBlock : public TFieldListCollection
</span><span class="cx"> {
</span><del>-public:
</del><ins>+  public:
</ins><span class="cx">     POOL_ALLOCATOR_NEW_DELETE();
</span><del>-    TInterfaceBlock(const TString* name, TFieldList* fields, const TString* instanceName, int arraySize, const TLayoutQualifier&amp; layoutQualifier)
</del><ins>+    TInterfaceBlock(const TString *name, TFieldList *fields, const TString *instanceName,
+                    int arraySize, const TLayoutQualifier &amp;layoutQualifier)
</ins><span class="cx">         : TFieldListCollection(name, fields),
</span><span class="cx">           mInstanceName(instanceName),
</span><span class="cx">           mArraySize(arraySize),
</span><span class="cx">           mBlockStorage(layoutQualifier.blockStorage),
</span><del>-          mMatrixPacking(layoutQualifier.matrixPacking) {
</del><ins>+          mMatrixPacking(layoutQualifier.matrixPacking)
+    {
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const TString&amp; instanceName() const { return *mInstanceName; }
-    bool hasInstanceName() const { return mInstanceName != NULL; }
-    bool isArray() const { return mArraySize &gt; 0; }
-    int arraySize() const { return mArraySize; }
-    TLayoutBlockStorage blockStorage() const { return mBlockStorage; }
-    TLayoutMatrixPacking matrixPacking() const { return mMatrixPacking; }
</del><ins>+    const TString &amp;instanceName() const
+    {
+        return *mInstanceName;
+    }
+    bool hasInstanceName() const
+    {
+        return mInstanceName != NULL;
+    }
+    bool isArray() const
+    {
+        return mArraySize &gt; 0;
+    }
+    int arraySize() const
+    {
+        return mArraySize;
+    }
+    TLayoutBlockStorage blockStorage() const
+    {
+        return mBlockStorage;
+    }
+    TLayoutMatrixPacking matrixPacking() const
+    {
+        return mMatrixPacking;
+    }
</ins><span class="cx"> 
</span><del>-private:
-    DISALLOW_COPY_AND_ASSIGN(TInterfaceBlock);
-    virtual TString mangledNamePrefix() const { return &quot;iblock-&quot;; }
</del><ins>+  private:
+    virtual TString mangledNamePrefix() const
+    {
+        return &quot;iblock-&quot;;
+    }
</ins><span class="cx"> 
</span><del>-    const TString* mInstanceName; // for interface block instance names
</del><ins>+    const TString *mInstanceName; // for interface block instance names
</ins><span class="cx">     int mArraySize; // 0 if not an array
</span><span class="cx">     TLayoutBlockStorage mBlockStorage;
</span><span class="cx">     TLayoutMatrixPacking mMatrixPacking;
</span><span class="lines">@@ -137,72 +227,179 @@
</span><span class="cx"> //
</span><span class="cx"> class TType
</span><span class="cx"> {
</span><del>-public:
</del><ins>+  public:
</ins><span class="cx">     POOL_ALLOCATOR_NEW_DELETE();
</span><del>-    TType() {}
-    TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1) :
-            type(t), precision(EbpUndefined), qualifier(EvqGlobal), layoutQualifier(TLayoutQualifier::create()), primarySize(ps), secondarySize(ss), array(false), arraySize(0),
-            interfaceBlock(0), structure(0)
</del><ins>+    TType()
</ins><span class="cx">     {
</span><span class="cx">     }
</span><del>-    TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, unsigned char ps = 1, unsigned char ss = 1, bool a = false) :
-            type(t), precision(p), qualifier(q), layoutQualifier(TLayoutQualifier::create()), primarySize(ps), secondarySize(ss), array(a), arraySize(0),
-            interfaceBlock(0), structure(0)
</del><ins>+    TType(TBasicType t, unsigned char ps = 1, unsigned char ss = 1)
+        : type(t), precision(EbpUndefined), qualifier(EvqGlobal),
+          layoutQualifier(TLayoutQualifier::create()),
+          primarySize(ps), secondarySize(ss), array(false), arraySize(0),
+          interfaceBlock(0), structure(0)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><ins>+    TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary,
+          unsigned char ps = 1, unsigned char ss = 1, bool a = false)
+        : type(t), precision(p), qualifier(q),
+          layoutQualifier(TLayoutQualifier::create()),
+          primarySize(ps), secondarySize(ss), array(a), arraySize(0),
+          interfaceBlock(0), structure(0)
+    {
+    }
</ins><span class="cx">     explicit TType(const TPublicType &amp;p);
</span><del>-    TType(TStructure* userDef, TPrecision p = EbpUndefined) :
-            type(EbtStruct), precision(p), qualifier(EvqTemporary), layoutQualifier(TLayoutQualifier::create()), primarySize(1), secondarySize(1), array(false), arraySize(0),
-            interfaceBlock(0), structure(userDef)
</del><ins>+    TType(TStructure *userDef, TPrecision p = EbpUndefined)
+        : type(EbtStruct), precision(p), qualifier(EvqTemporary),
+          layoutQualifier(TLayoutQualifier::create()),
+          primarySize(1), secondarySize(1), array(false), arraySize(0),
+          interfaceBlock(0), structure(userDef)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><del>-    TType(TInterfaceBlock* interfaceBlockIn, TQualifier qualifierIn, TLayoutQualifier layoutQualifierIn, int arraySizeIn) :
-            type(EbtInterfaceBlock), precision(EbpUndefined), qualifier(qualifierIn), layoutQualifier(layoutQualifierIn), primarySize(1), secondarySize(1), array(arraySizeIn &gt; 0), arraySize(arraySizeIn),
-            interfaceBlock(interfaceBlockIn), structure(0)
</del><ins>+    TType(TInterfaceBlock *interfaceBlockIn, TQualifier qualifierIn,
+          TLayoutQualifier layoutQualifierIn, int arraySizeIn)
+        : type(EbtInterfaceBlock), precision(EbpUndefined), qualifier(qualifierIn),
+          layoutQualifier(layoutQualifierIn),
+          primarySize(1), secondarySize(1), array(arraySizeIn &gt; 0), arraySize(arraySizeIn),
+          interfaceBlock(interfaceBlockIn), structure(0)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    TBasicType getBasicType() const { return type; }
-    void setBasicType(TBasicType t) { type = t; }
</del><ins>+    TBasicType getBasicType() const
+    {
+        return type;
+    }
+    void setBasicType(TBasicType t)
+    {
+        type = t;
+    }
</ins><span class="cx"> 
</span><del>-    TPrecision getPrecision() const { return precision; }
-    void setPrecision(TPrecision p) { precision = p; }
</del><ins>+    TPrecision getPrecision() const
+    {
+        return precision;
+    }
+    void setPrecision(TPrecision p)
+    {
+        precision = p;
+    }
</ins><span class="cx"> 
</span><del>-    TQualifier getQualifier() const { return qualifier; }
-    void setQualifier(TQualifier q) { qualifier = q; }
</del><ins>+    TQualifier getQualifier() const
+    {
+        return qualifier;
+    }
+    void setQualifier(TQualifier q)
+    {
+        qualifier = q;
+    }
</ins><span class="cx"> 
</span><del>-    TLayoutQualifier getLayoutQualifier() const { return layoutQualifier; }
-    void setLayoutQualifier(TLayoutQualifier lq) { layoutQualifier = lq; }
</del><ins>+    TLayoutQualifier getLayoutQualifier() const
+    {
+        return layoutQualifier;
+    }
+    void setLayoutQualifier(TLayoutQualifier lq)
+    {
+        layoutQualifier = lq;
+    }
</ins><span class="cx"> 
</span><del>-    int getNominalSize() const { return primarySize; }
-    int getSecondarySize() const { return secondarySize; }
-    int getCols() const { ASSERT(isMatrix()); return primarySize; }
-    int getRows() const { ASSERT(isMatrix()); return secondarySize; }
-    void setPrimarySize(unsigned char ps) { primarySize = ps; }
-    void setSecondarySize(unsigned char ss) { secondarySize = ss; }
</del><ins>+    int getNominalSize() const
+    {
+        return primarySize;
+    }
+    int getSecondarySize() const
+    {
+        return secondarySize;
+    }
+    int getCols() const
+    {
+        ASSERT(isMatrix());
+        return primarySize;
+    }
+    int getRows() const
+    {
+        ASSERT(isMatrix());
+        return secondarySize;
+    }
+    void setPrimarySize(unsigned char ps)
+    {
+        primarySize = ps;
+    }
+    void setSecondarySize(unsigned char ss)
+    {
+        secondarySize = ss;
+    }
</ins><span class="cx"> 
</span><span class="cx">     // Full size of single instance of type
</span><span class="cx">     size_t getObjectSize() const;
</span><span class="cx"> 
</span><del>-    bool isMatrix() const { return primarySize &gt; 1 &amp;&amp; secondarySize &gt; 1; }
-    bool isArray() const  { return array ? true : false; }
-    int getArraySize() const { return arraySize; }
-    void setArraySize(int s) { array = true; arraySize = s; }
-    void clearArrayness() { array = false; arraySize = 0; }
</del><ins>+    bool isMatrix() const
+    {
+        return primarySize &gt; 1 &amp;&amp; secondarySize &gt; 1;
+    }
+    bool isNonSquareMatrix() const
+    {
+        return isMatrix() &amp;&amp; primarySize != secondarySize;
+    }
+    bool isArray() const
+    {
+        return array;
+    }
+    bool isUnsizedArray() const
+    {
+        return array &amp;&amp; arraySize == 0;
+    }
+    int getArraySize() const
+    {
+        return arraySize;
+    }
+    void setArraySize(int s)
+    {
+        array = true;
+        arraySize = s;
+    }
+    void clearArrayness()
+    {
+        array = false;
+        arraySize = 0;
+    }
</ins><span class="cx"> 
</span><del>-    TInterfaceBlock* getInterfaceBlock() const { return interfaceBlock; }
-    void setInterfaceBlock(TInterfaceBlock* interfaceBlockIn) { interfaceBlock = interfaceBlockIn; }
-    bool isInterfaceBlock() const { return type == EbtInterfaceBlock; }
</del><ins>+    TInterfaceBlock *getInterfaceBlock() const
+    {
+        return interfaceBlock;
+    }
+    void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn)
+    {
+        interfaceBlock = interfaceBlockIn;
+    }
+    bool isInterfaceBlock() const
+    {
+        return type == EbtInterfaceBlock;
+    }
</ins><span class="cx"> 
</span><del>-    bool isVector() const { return primarySize &gt; 1 &amp;&amp; secondarySize == 1; }
-    bool isScalar() const { return primarySize == 1 &amp;&amp; secondarySize == 1 &amp;&amp; !structure; }
-    bool isScalarInt() const { return isScalar() &amp;&amp; (type == EbtInt || type == EbtUInt); }
</del><ins>+    bool isVector() const
+    {
+        return primarySize &gt; 1 &amp;&amp; secondarySize == 1;
+    }
+    bool isScalar() const
+    {
+        return primarySize == 1 &amp;&amp; secondarySize == 1 &amp;&amp; !structure;
+    }
+    bool isScalarInt() const
+    {
+        return isScalar() &amp;&amp; (type == EbtInt || type == EbtUInt);
+    }
</ins><span class="cx"> 
</span><del>-    TStructure* getStruct() const { return structure; }
-    void setStruct(TStructure* s) { structure = s; }
</del><ins>+    TStructure *getStruct() const
+    {
+        return structure;
+    }
+    void setStruct(TStructure *s)
+    {
+        structure = s;
+    }
</ins><span class="cx"> 
</span><del>-    const TString&amp; getMangledName() {
-        if (mangled.empty()) {
</del><ins>+    const TString &amp;getMangledName()
+    {
+        if (mangled.empty())
+        {
</ins><span class="cx">             mangled = buildMangledName();
</span><span class="cx">             mangled += ';';
</span><span class="cx">         }
</span><span class="lines">@@ -210,37 +407,56 @@
</span><span class="cx">         return mangled;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool sameElementType(const TType&amp; right) const {
-        return      type == right.type          &amp;&amp;
-             primarySize == right.primarySize   &amp;&amp;
-           secondarySize == right.secondarySize &amp;&amp;
-               structure == right.structure;
</del><ins>+    bool sameElementType(const TType &amp;right) const
+    {
+        return type == right.type &amp;&amp;
+            primarySize == right.primarySize &amp;&amp;
+            secondarySize == right.secondarySize &amp;&amp;
+            structure == right.structure;
</ins><span class="cx">     }
</span><del>-    bool operator==(const TType&amp; right) const {
-        return      type == right.type          &amp;&amp;
-             primarySize == right.primarySize   &amp;&amp;
-           secondarySize == right.secondarySize &amp;&amp;
-                   array == right.array &amp;&amp; (!array || arraySize == right.arraySize) &amp;&amp;
-               structure == right.structure;
</del><ins>+    bool operator==(const TType &amp;right) const
+    {
+        return type == right.type &amp;&amp;
+            primarySize == right.primarySize &amp;&amp;
+            secondarySize == right.secondarySize &amp;&amp;
+            array == right.array &amp;&amp; (!array || arraySize == right.arraySize) &amp;&amp;
+            structure == right.structure;
</ins><span class="cx">         // don't check the qualifier, it's not ever what's being sought after
</span><span class="cx">     }
</span><del>-    bool operator!=(const TType&amp; right) const {
</del><ins>+    bool operator!=(const TType &amp;right) const
+    {
</ins><span class="cx">         return !operator==(right);
</span><span class="cx">     }
</span><del>-    bool operator&lt;(const TType&amp; right) const {
-        if (type != right.type) return type &lt; right.type;
-        if (primarySize != right.primarySize) return primarySize &lt; right.primarySize;
-        if (secondarySize != right.secondarySize) return secondarySize &lt; right.secondarySize;
-        if (array != right.array) return array &lt; right.array;
-        if (arraySize != right.arraySize) return arraySize &lt; right.arraySize;
-        if (structure != right.structure) return structure &lt; right.structure;
</del><ins>+    bool operator&lt;(const TType &amp;right) const
+    {
+        if (type != right.type)
+            return type &lt; right.type;
+        if (primarySize != right.primarySize)
+            return primarySize &lt; right.primarySize;
+        if (secondarySize != right.secondarySize)
+            return secondarySize &lt; right.secondarySize;
+        if (array != right.array)
+            return array &lt; right.array;
+        if (arraySize != right.arraySize)
+            return arraySize &lt; right.arraySize;
+        if (structure != right.structure)
+            return structure &lt; right.structure;
</ins><span class="cx"> 
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const char* getBasicString() const { return ::getBasicString(type); }
-    const char* getPrecisionString() const { return ::getPrecisionString(precision); }
-    const char* getQualifierString() const { return ::getQualifierString(qualifier); }
</del><ins>+    const char *getBasicString() const
+    {
+        return ::getBasicString(type);
+    }
+    const char *getPrecisionString() const
+    {
+        return ::getPrecisionString(precision);
+    }
+    const char *getQualifierString() const
+    {
+        return ::getQualifierString(qualifier);
+    }
</ins><span class="cx">     TString getCompleteString() const;
</span><span class="cx"> 
</span><span class="cx">     // If this type is a struct, returns the deepest struct nesting of
</span><span class="lines">@@ -255,15 +471,22 @@
</span><span class="cx">     // For type &quot;nesting2&quot;, this method would return 2 -- the number
</span><span class="cx">     // of structures through which indirection must occur to reach the
</span><span class="cx">     // deepest field (nesting2.field1.position).
</span><del>-    int getDeepestStructNesting() const {
</del><ins>+    int getDeepestStructNesting() const
+    {
</ins><span class="cx">         return structure ? structure-&gt;deepestNesting() : 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool isStructureContainingArrays() const {
</del><ins>+    bool isStructureContainingArrays() const
+    {
</ins><span class="cx">         return structure ? structure-&gt;containsArrays() : false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-protected:
</del><ins>+    bool isStructureContainingSamplers() const
+    {
+        return structure ? structure-&gt;containsSamplers() : false;
+    }
+
+  protected:
</ins><span class="cx">     TString buildMangledName() const;
</span><span class="cx">     size_t getStructSize() const;
</span><span class="cx">     void computeDeepestStructNesting();
</span><span class="lines">@@ -278,10 +501,10 @@
</span><span class="cx">     int arraySize;
</span><span class="cx"> 
</span><span class="cx">     // 0 unless this is an interface block, or interface block member variable
</span><del>-    TInterfaceBlock* interfaceBlock;
</del><ins>+    TInterfaceBlock *interfaceBlock;
</ins><span class="cx"> 
</span><span class="cx">     // 0 unless this is a struct
</span><del>-    TStructure* structure;
</del><ins>+    TStructure *structure;
</ins><span class="cx"> 
</span><span class="cx">     mutable TString mangled;
</span><span class="cx"> };
</span><span class="lines">@@ -305,10 +528,10 @@
</span><span class="cx">     unsigned char secondarySize;        // rows of matrix
</span><span class="cx">     bool array;
</span><span class="cx">     int arraySize;
</span><del>-    TType* userDef;
</del><ins>+    TType *userDef;
</ins><span class="cx">     TSourceLoc line;
</span><span class="cx"> 
</span><del>-    void setBasic(TBasicType bt, TQualifier q, const TSourceLoc&amp; ln)
</del><ins>+    void setBasic(TBasicType bt, TQualifier q, const TSourceLoc &amp;ln)
</ins><span class="cx">     {
</span><span class="cx">         type = bt;
</span><span class="cx">         layoutQualifier = TLayoutQualifier::create();
</span><span class="lines">@@ -334,11 +557,20 @@
</span><span class="cx">         secondarySize = r;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void setArray(bool a, int s = 0)
</del><ins>+    bool isUnsizedArray() const
</ins><span class="cx">     {
</span><del>-        array = a;
</del><ins>+        return array &amp;&amp; arraySize == 0;
+    }
+    void setArraySize(int s)
+    {
+        array = true;
</ins><span class="cx">         arraySize = s;
</span><span class="cx">     }
</span><ins>+    void clearArrayness()
+    {
+        array = false;
+        arraySize = 0;
+    }
</ins><span class="cx"> 
</span><span class="cx">     bool isStructureContainingArrays() const
</span><span class="cx">     {
</span><span class="lines">@@ -383,4 +615,4 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // _TYPES_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_TYPES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -12,10 +12,11 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/OutputHLSL.h&quot;
</span><ins>+#include &quot;compiler/translator/UtilsHLSL.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="cx"> {
</span><del>-UnfoldShortCircuit::UnfoldShortCircuit(TParseContext &amp;context, OutputHLSL *outputHLSL) : mContext(context), mOutputHLSL(outputHLSL)
</del><ins>+UnfoldShortCircuit::UnfoldShortCircuit(OutputHLSL *outputHLSL) : mOutputHLSL(outputHLSL)
</ins><span class="cx"> {
</span><span class="cx">     mTemporaryIndex = 0;
</span><span class="cx"> }
</span><span class="lines">@@ -29,7 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool UnfoldShortCircuit::visitBinary(Visit visit, TIntermBinary *node)
</span><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mOutputHLSL-&gt;getBodyStream();
</del><ins>+    TInfoSinkBase &amp;out = mOutputHLSL-&gt;getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     // If our right node doesn't have side effects, we know we don't need to unfold this
</span><span class="cx">     // expression: there will be no short-circuiting side effects to avoid
</span><span class="lines">@@ -110,14 +111,14 @@
</span><span class="cx"> 
</span><span class="cx"> bool UnfoldShortCircuit::visitSelection(Visit visit, TIntermSelection *node)
</span><span class="cx"> {
</span><del>-    TInfoSinkBase &amp;out = mOutputHLSL-&gt;getBodyStream();
</del><ins>+    TInfoSinkBase &amp;out = mOutputHLSL-&gt;getInfoSink();
</ins><span class="cx"> 
</span><span class="cx">     // Unfold &quot;b ? x : y&quot; into &quot;type s; if(b) s = x; else s = y;&quot;
</span><span class="cx">     if (node-&gt;usesTernaryOperator())
</span><span class="cx">     {
</span><span class="cx">         int i = mTemporaryIndex;
</span><span class="cx"> 
</span><del>-        out &lt;&lt; mOutputHLSL-&gt;typeString(node-&gt;getType()) &lt;&lt; &quot; s&quot; &lt;&lt; i &lt;&lt; &quot;;\n&quot;;
</del><ins>+        out &lt;&lt; TypeString(node-&gt;getType()) &lt;&lt; &quot; s&quot; &lt;&lt; i &lt;&lt; &quot;;\n&quot;;
</ins><span class="cx"> 
</span><span class="cx">         out &lt;&lt; &quot;{\n&quot;;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuith"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuit.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,10 +6,10 @@
</span><span class="cx"> // UnfoldShortCircuit is an AST traverser to output short-circuiting operators as if-else statements
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_UNFOLDSHORTCIRCUIT_H_
-#define COMPILER_UNFOLDSHORTCIRCUIT_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_
+#define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace sh
</span><span class="lines">@@ -19,7 +19,7 @@
</span><span class="cx"> class UnfoldShortCircuit : public TIntermTraverser
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    UnfoldShortCircuit(TParseContext &amp;context, OutputHLSL *outputHLSL);
</del><ins>+    UnfoldShortCircuit(OutputHLSL *outputHLSL);
</ins><span class="cx"> 
</span><span class="cx">     void traverse(TIntermNode *node);
</span><span class="cx">     bool visitBinary(Visit visit, TIntermBinary*);
</span><span class="lines">@@ -29,11 +29,10 @@
</span><span class="cx">     int getNextTemporaryIndex();
</span><span class="cx"> 
</span><span class="cx">   protected:
</span><del>-    TParseContext &amp;mContext;
</del><span class="cx">     OutputHLSL *const mOutputHLSL;
</span><span class="cx"> 
</span><span class="cx">     int mTemporaryIndex;
</span><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif   // COMPILER_UNFOLDSHORTCIRCUIT_H_
</del><ins>+#endif   // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitASTcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> TIntermSelection *UnfoldOR(TIntermTyped *x, TIntermTyped *y)
</span><span class="cx"> {
</span><span class="cx">     const TType boolType(EbtBool, EbpUndefined);
</span><del>-    ConstantUnion *u = new ConstantUnion;
</del><ins>+    TConstantUnion *u = new TConstantUnion;
</ins><span class="cx">     u-&gt;setBConst(true);
</span><span class="cx">     TIntermConstantUnion *trueNode = new TIntermConstantUnion(
</span><span class="cx">         u, TType(EbtBool, EbpUndefined, EvqConst, 1));
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx"> TIntermSelection *UnfoldAND(TIntermTyped *x, TIntermTyped *y)
</span><span class="cx"> {
</span><span class="cx">     const TType boolType(EbtBool, EbpUndefined);
</span><del>-    ConstantUnion *u = new ConstantUnion;
</del><ins>+    TConstantUnion *u = new TConstantUnion;
</ins><span class="cx">     u-&gt;setBConst(false);
</span><span class="cx">     TIntermConstantUnion *falseNode = new TIntermConstantUnion(
</span><span class="cx">         u, TType(EbtBool, EbpUndefined, EvqConst, 1));
</span><span class="lines">@@ -50,32 +50,8 @@
</span><span class="cx">     }
</span><span class="cx">     if (replacement)
</span><span class="cx">     {
</span><del>-        replacements.push_back(
-            NodeUpdateEntry(getParentNode(), node, replacement));
</del><ins>+        mReplacements.push_back(
+            NodeUpdateEntry(getParentNode(), node, replacement, false));
</ins><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><del>-
-void UnfoldShortCircuitAST::updateTree()
-{
-    for (size_t ii = 0; ii &lt; replacements.size(); ++ii)
-    {
-        const NodeUpdateEntry&amp; entry = replacements[ii];
-        ASSERT(entry.parent);
-        bool replaced = entry.parent-&gt;replaceChildNode(
-            entry.original, entry.replacement);
-        ASSERT(replaced);
-
-        // In AST traversing, a parent is visited before its children.
-        // After we replace a node, if an immediate child is to
-        // be replaced, we need to make sure we don't update the replaced
-        // node; instead, we update the replacement node.
-        for (size_t jj = ii + 1; jj &lt; replacements.size(); ++jj)
-        {
-            NodeUpdateEntry&amp; entry2 = replacements[jj];
-            if (entry2.parent == entry.original)
-                entry2.parent = entry.replacement;
-        }
-    }
-}
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUnfoldShortCircuitASTh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -7,11 +7,11 @@
</span><span class="cx"> // operations with ternary operations.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
-#define COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_
+#define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;common/angleutils.h&quot;
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> // This traverser identifies all the short circuit binary  nodes that need to
</span><span class="cx"> // be replaced, and creates the corresponding replacement nodes. However,
</span><span class="lines">@@ -23,29 +23,6 @@
</span><span class="cx">     UnfoldShortCircuitAST() { }
</span><span class="cx"> 
</span><span class="cx">     virtual bool visitBinary(Visit visit, TIntermBinary *);
</span><del>-
-    void updateTree();
-
-  private:
-    struct NodeUpdateEntry
-    {
-        NodeUpdateEntry(TIntermNode *_parent,
-                        TIntermNode *_original,
-                        TIntermNode *_replacement)
-            : parent(_parent),
-              original(_original),
-              replacement(_replacement) {}
-
-        TIntermNode *parent;
-        TIntermNode *original;
-        TIntermNode *replacement;
-    };
-
-    // During traversing, save all the replacements that need to happen;
-    // then replace them by calling updateNodes().
-    std::vector&lt;NodeUpdateEntry&gt; replacements;
-
-    DISALLOW_COPY_AND_ASSIGN(UnfoldShortCircuitAST);
</del><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_UNFOLD_SHORT_CIRCUIT_AST_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUniformHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,280 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// UniformHLSL.cpp:
+//   Methods for GLSL to HLSL translation for uniforms and interface blocks.
+//
+
+#include &quot;compiler/translator/UniformHLSL.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;compiler/translator/StructureHLSL.h&quot;
+#include &quot;compiler/translator/UtilsHLSL.h&quot;
+#include &quot;compiler/translator/blocklayoutHLSL.h&quot;
+#include &quot;compiler/translator/util.h&quot;
+
+namespace sh
+{
+
+static const char *UniformRegisterPrefix(const TType &amp;type)
+{
+    if (IsSampler(type.getBasicType()))
+    {
+        return &quot;s&quot;;
+    }
+    else
+    {
+        return &quot;c&quot;;
+    }
+}
+
+static TString InterfaceBlockFieldTypeString(const TField &amp;field, TLayoutBlockStorage blockStorage)
+{
+    const TType &amp;fieldType = *field.type();
+    const TLayoutMatrixPacking matrixPacking = fieldType.getLayoutQualifier().matrixPacking;
+    ASSERT(matrixPacking != EmpUnspecified);
+    TStructure *structure = fieldType.getStruct();
+
+    if (fieldType.isMatrix())
+    {
+        // Use HLSL row-major packing for GLSL column-major matrices
+        const TString &amp;matrixPackString = (matrixPacking == EmpRowMajor ? &quot;column_major&quot; : &quot;row_major&quot;);
+        return matrixPackString + &quot; &quot; + TypeString(fieldType);
+    }
+    else if (structure)
+    {
+        // Use HLSL row-major packing for GLSL column-major matrices
+        return QualifiedStructNameString(*structure, matrixPacking == EmpColumnMajor,
+            blockStorage == EbsStd140);
+    }
+    else
+    {
+        return TypeString(fieldType);
+    }
+}
+
+static TString InterfaceBlockStructName(const TInterfaceBlock &amp;interfaceBlock)
+{
+    return DecoratePrivate(interfaceBlock.name()) + &quot;_type&quot;;
+}
+
+UniformHLSL::UniformHLSL(StructureHLSL *structureHLSL, ShShaderOutput outputType, const std::vector&lt;Uniform&gt; &amp;uniforms)
+    : mUniformRegister(0),
+      mInterfaceBlockRegister(0),
+      mSamplerRegister(0),
+      mStructureHLSL(structureHLSL),
+      mOutputType(outputType),
+      mUniforms(uniforms)
+{}
+
+void UniformHLSL::reserveUniformRegisters(unsigned int registerCount)
+{
+    mUniformRegister = registerCount;
+}
+
+void UniformHLSL::reserveInterfaceBlockRegisters(unsigned int registerCount)
+{
+    mInterfaceBlockRegister = registerCount;
+}
+
+const Uniform *UniformHLSL::findUniformByName(const TString &amp;name) const
+{
+    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); ++uniformIndex)
+    {
+        if (mUniforms[uniformIndex].name == name.c_str())
+        {
+            return &amp;mUniforms[uniformIndex];
+        }
+    }
+
+    UNREACHABLE();
+    return NULL;
+}
+
+unsigned int UniformHLSL::declareUniformAndAssignRegister(const TType &amp;type, const TString &amp;name)
+{
+    unsigned int registerIndex = (IsSampler(type.getBasicType()) ? mSamplerRegister : mUniformRegister);
+
+    const Uniform *uniform = findUniformByName(name);
+    ASSERT(uniform);
+
+    mUniformRegisterMap[uniform-&gt;name] = registerIndex;
+
+    unsigned int registerCount = HLSLVariableRegisterCount(*uniform, mOutputType);
+
+    if (gl::IsSamplerType(uniform-&gt;type))
+    {
+        mSamplerRegister += registerCount;
+    }
+    else
+    {
+        mUniformRegister += registerCount;
+    }
+
+    return registerIndex;
+}
+
+TString UniformHLSL::uniformsHeader(ShShaderOutput outputType, const ReferencedSymbols &amp;referencedUniforms)
+{
+    TString uniforms;
+
+    for (ReferencedSymbols::const_iterator uniformIt = referencedUniforms.begin();
+         uniformIt != referencedUniforms.end(); uniformIt++)
+    {
+        const TIntermSymbol &amp;uniform = *uniformIt-&gt;second;
+        const TType &amp;type = uniform.getType();
+        const TString &amp;name = uniform.getSymbol();
+
+        unsigned int registerIndex = declareUniformAndAssignRegister(type, name);
+
+        if (outputType == SH_HLSL11_OUTPUT &amp;&amp; IsSampler(type.getBasicType()))   // Also declare the texture
+        {
+            uniforms += &quot;uniform &quot; + SamplerString(type) + &quot; sampler_&quot; + DecorateUniform(name, type) + ArrayString(type) +
+                        &quot; : register(s&quot; + str(registerIndex) + &quot;);\n&quot;;
+
+            uniforms += &quot;uniform &quot; + TextureString(type) + &quot; texture_&quot; + DecorateUniform(name, type) + ArrayString(type) +
+                        &quot; : register(t&quot; + str(registerIndex) + &quot;);\n&quot;;
+        }
+        else
+        {
+            const TStructure *structure = type.getStruct();
+            // If this is a nameless struct, we need to use its full definition, rather than its (empty) name.
+            // TypeString() will invoke defineNameless in this case; qualifier prefixes are unnecessary for 
+            // nameless structs in ES, as nameless structs cannot be used anywhere that layout qualifiers are
+            // permitted.
+            const TString &amp;typeName = ((structure &amp;&amp; !structure-&gt;name().empty()) ?
+                                        QualifiedStructNameString(*structure, false, false) : TypeString(type));
+
+            const TString &amp;registerString = TString(&quot;register(&quot;) + UniformRegisterPrefix(type) + str(registerIndex) + &quot;)&quot;;
+
+            uniforms += &quot;uniform &quot; + typeName + &quot; &quot; + DecorateUniform(name, type) + ArrayString(type) + &quot; : &quot; + registerString + &quot;;\n&quot;;
+        }
+    }
+
+    return (uniforms.empty() ? &quot;&quot; : (&quot;// Uniforms\n\n&quot; + uniforms));
+}
+
+TString UniformHLSL::interfaceBlocksHeader(const ReferencedSymbols &amp;referencedInterfaceBlocks)
+{
+    TString interfaceBlocks;
+
+    for (ReferencedSymbols::const_iterator interfaceBlockIt = referencedInterfaceBlocks.begin();
+         interfaceBlockIt != referencedInterfaceBlocks.end(); interfaceBlockIt++)
+    {
+        const TType &amp;nodeType = interfaceBlockIt-&gt;second-&gt;getType();
+        const TInterfaceBlock &amp;interfaceBlock = *nodeType.getInterfaceBlock();
+
+        unsigned int arraySize = static_cast&lt;unsigned int&gt;(interfaceBlock.arraySize());
+        unsigned int activeRegister = mInterfaceBlockRegister;
+
+        mInterfaceBlockRegisterMap[interfaceBlock.name().c_str()] = activeRegister;
+        mInterfaceBlockRegister += std::max(1u, arraySize);
+
+        // FIXME: interface block field names
+
+        if (interfaceBlock.hasInstanceName())
+        {
+            interfaceBlocks += interfaceBlockStructString(interfaceBlock);
+        }
+
+        if (arraySize &gt; 0)
+        {
+            for (unsigned int arrayIndex = 0; arrayIndex &lt; arraySize; arrayIndex++)
+            {
+                interfaceBlocks += interfaceBlockString(interfaceBlock, activeRegister + arrayIndex, arrayIndex);
+            }
+        }
+        else
+        {
+            interfaceBlocks += interfaceBlockString(interfaceBlock, activeRegister, GL_INVALID_INDEX);
+        }
+    }
+
+    return (interfaceBlocks.empty() ? &quot;&quot; : (&quot;// Interface Blocks\n\n&quot; + interfaceBlocks));
+}
+
+TString UniformHLSL::interfaceBlockString(const TInterfaceBlock &amp;interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex)
+{
+    const TString &amp;arrayIndexString =  (arrayIndex != GL_INVALID_INDEX ? Decorate(str(arrayIndex)) : &quot;&quot;);
+    const TString &amp;blockName = interfaceBlock.name() + arrayIndexString;
+    TString hlsl;
+
+    hlsl += &quot;cbuffer &quot; + blockName + &quot; : register(b&quot; + str(registerIndex) + &quot;)\n&quot;
+            &quot;{\n&quot;;
+
+    if (interfaceBlock.hasInstanceName())
+    {
+        hlsl += &quot;    &quot; + InterfaceBlockStructName(interfaceBlock) + &quot; &quot; +
+                interfaceBlockInstanceString(interfaceBlock, arrayIndex) + &quot;;\n&quot;;
+    }
+    else
+    {
+        const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+        hlsl += interfaceBlockMembersString(interfaceBlock, blockStorage);
+    }
+
+    hlsl += &quot;};\n\n&quot;;
+
+    return hlsl;
+}
+
+TString UniformHLSL::interfaceBlockInstanceString(const TInterfaceBlock&amp; interfaceBlock, unsigned int arrayIndex)
+{
+    if (!interfaceBlock.hasInstanceName())
+    {
+        return &quot;&quot;;
+    }
+    else if (interfaceBlock.isArray())
+    {
+        return DecoratePrivate(interfaceBlock.instanceName()) + &quot;_&quot; + str(arrayIndex);
+    }
+    else
+    {
+        return Decorate(interfaceBlock.instanceName());
+    }
+}
+
+TString UniformHLSL::interfaceBlockMembersString(const TInterfaceBlock &amp;interfaceBlock, TLayoutBlockStorage blockStorage)
+{
+    TString hlsl;
+
+    Std140PaddingHelper padHelper = mStructureHLSL-&gt;getPaddingHelper();
+
+    for (unsigned int typeIndex = 0; typeIndex &lt; interfaceBlock.fields().size(); typeIndex++)
+    {
+        const TField &amp;field = *interfaceBlock.fields()[typeIndex];
+        const TType &amp;fieldType = *field.type();
+
+        if (blockStorage == EbsStd140)
+        {
+            // 2 and 3 component vector types in some cases need pre-padding
+            hlsl += padHelper.prePaddingString(fieldType);
+        }
+
+        hlsl += &quot;    &quot; + InterfaceBlockFieldTypeString(field, blockStorage) +
+                &quot; &quot; + Decorate(field.name()) + ArrayString(fieldType) + &quot;;\n&quot;;
+
+        // must pad out after matrices and arrays, where HLSL usually allows itself room to pack stuff
+        if (blockStorage == EbsStd140)
+        {
+            const bool useHLSLRowMajorPacking = (fieldType.getLayoutQualifier().matrixPacking == EmpColumnMajor);
+            hlsl += padHelper.postPaddingString(fieldType, useHLSLRowMajorPacking);
+        }
+    }
+
+    return hlsl;
+}
+
+TString UniformHLSL::interfaceBlockStructString(const TInterfaceBlock &amp;interfaceBlock)
+{
+    const TLayoutBlockStorage blockStorage = interfaceBlock.blockStorage();
+
+    return &quot;struct &quot; + InterfaceBlockStructName(interfaceBlock) + &quot;\n&quot;
+           &quot;{\n&quot; +
+           interfaceBlockMembersString(interfaceBlock, blockStorage) +
+           &quot;};\n\n&quot;;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUniformHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UniformHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// UniformHLSL.h:
+//   Methods for GLSL to HLSL translation for uniforms and interface blocks.
+//
+
+#ifndef COMPILER_TRANSLATOR_UNIFORMHLSL_H_
+#define COMPILER_TRANSLATOR_UNIFORMHLSL_H_
+
+#include &quot;compiler/translator/OutputHLSL.h&quot;
+
+namespace sh
+{
+class StructureHLSL;
+
+class UniformHLSL : angle::NonCopyable
+{
+  public:
+    UniformHLSL(StructureHLSL *structureHLSL, ShShaderOutput outputType, const std::vector&lt;Uniform&gt; &amp;uniforms);
+
+    void reserveUniformRegisters(unsigned int registerCount);
+    void reserveInterfaceBlockRegisters(unsigned int registerCount);
+    TString uniformsHeader(ShShaderOutput outputType, const ReferencedSymbols &amp;referencedUniforms);
+    TString interfaceBlocksHeader(const ReferencedSymbols &amp;referencedInterfaceBlocks);
+
+    // Used for direct index references
+    static TString interfaceBlockInstanceString(const TInterfaceBlock&amp; interfaceBlock, unsigned int arrayIndex);
+
+    const std::map&lt;std::string, unsigned int&gt; &amp;getInterfaceBlockRegisterMap() const
+    {
+        return mInterfaceBlockRegisterMap;
+    }
+    const std::map&lt;std::string, unsigned int&gt; &amp;getUniformRegisterMap() const
+    {
+        return mUniformRegisterMap;
+    }
+
+  private:
+    TString interfaceBlockString(const TInterfaceBlock &amp;interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex);
+    TString interfaceBlockMembersString(const TInterfaceBlock &amp;interfaceBlock, TLayoutBlockStorage blockStorage);
+    TString interfaceBlockStructString(const TInterfaceBlock &amp;interfaceBlock);
+    const Uniform *findUniformByName(const TString &amp;name) const;
+
+    // Returns the uniform's register index
+    unsigned int declareUniformAndAssignRegister(const TType &amp;type, const TString &amp;name);
+
+    unsigned int mUniformRegister;
+    unsigned int mInterfaceBlockRegister;
+    unsigned int mSamplerRegister;
+    StructureHLSL *mStructureHLSL;
+    ShShaderOutput mOutputType;
+
+    const std::vector&lt;Uniform&gt; &amp;mUniforms;
+    std::map&lt;std::string, unsigned int&gt; mInterfaceBlockRegisterMap;
+    std::map&lt;std::string, unsigned int&gt; mUniformRegisterMap;
+};
+
+}
+
+#endif // COMPILER_TRANSLATOR_UNIFORMHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUtilsHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,250 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// UtilsHLSL.cpp:
+//   Utility methods for GLSL to HLSL translation.
+//
+
+#include &quot;compiler/translator/UtilsHLSL.h&quot;
+#include &quot;compiler/translator/StructureHLSL.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
+
+namespace sh
+{
+
+TString SamplerString(const TType &amp;type)
+{
+    if (IsShadowSampler(type.getBasicType()))
+    {
+        return &quot;SamplerComparisonState&quot;;
+    }
+    else
+    {
+        return &quot;SamplerState&quot;;
+    }
+}
+
+TString TextureString(const TType &amp;type)
+{
+    switch (type.getBasicType())
+    {
+      case EbtSampler2D:            return &quot;Texture2D&quot;;
+      case EbtSamplerCube:          return &quot;TextureCube&quot;;
+      case EbtSamplerExternalOES:   return &quot;Texture2D&quot;;
+      case EbtSampler2DArray:       return &quot;Texture2DArray&quot;;
+      case EbtSampler3D:            return &quot;Texture3D&quot;;
+      case EbtISampler2D:           return &quot;Texture2D&lt;int4&gt;&quot;;
+      case EbtISampler3D:           return &quot;Texture3D&lt;int4&gt;&quot;;
+      case EbtISamplerCube:         return &quot;Texture2DArray&lt;int4&gt;&quot;;
+      case EbtISampler2DArray:      return &quot;Texture2DArray&lt;int4&gt;&quot;;
+      case EbtUSampler2D:           return &quot;Texture2D&lt;uint4&gt;&quot;;
+      case EbtUSampler3D:           return &quot;Texture3D&lt;uint4&gt;&quot;;
+      case EbtUSamplerCube:         return &quot;Texture2DArray&lt;uint4&gt;&quot;;
+      case EbtUSampler2DArray:      return &quot;Texture2DArray&lt;uint4&gt;&quot;;
+      case EbtSampler2DShadow:      return &quot;Texture2D&quot;;
+      case EbtSamplerCubeShadow:    return &quot;TextureCube&quot;;
+      case EbtSampler2DArrayShadow: return &quot;Texture2DArray&quot;;
+      default: UNREACHABLE();
+    }
+
+    return &quot;&lt;unknown texture type&gt;&quot;;
+}
+
+TString DecorateUniform(const TString &amp;string, const TType &amp;type)
+{
+    if (type.getBasicType() == EbtSamplerExternalOES)
+    {
+        return &quot;ex_&quot; + string;
+    }
+
+    return Decorate(string);
+}
+
+TString DecorateField(const TString &amp;string, const TStructure &amp;structure)
+{
+    if (structure.name().compare(0, 3, &quot;gl_&quot;) != 0)
+    {
+        return Decorate(string);
+    }
+
+    return string;
+}
+
+TString DecoratePrivate(const TString &amp;privateText)
+{
+    return &quot;dx_&quot; + privateText;
+}
+
+TString Decorate(const TString &amp;string)
+{
+    if (string.compare(0, 3, &quot;gl_&quot;) != 0)
+    {
+        return &quot;_&quot; + string;
+    }
+
+    return string;
+}
+
+TString TypeString(const TType &amp;type)
+{
+    const TStructure* structure = type.getStruct();
+    if (structure)
+    {
+        const TString&amp; typeName = structure-&gt;name();
+        if (typeName != &quot;&quot;)
+        {
+            return StructNameString(*structure);
+        }
+        else   // Nameless structure, define in place
+        {
+            return StructureHLSL::defineNameless(*structure);
+        }
+    }
+    else if (type.isMatrix())
+    {
+        int cols = type.getCols();
+        int rows = type.getRows();
+        return &quot;float&quot; + str(cols) + &quot;x&quot; + str(rows);
+    }
+    else
+    {
+        switch (type.getBasicType())
+        {
+          case EbtFloat:
+            switch (type.getNominalSize())
+            {
+              case 1: return &quot;float&quot;;
+              case 2: return &quot;float2&quot;;
+              case 3: return &quot;float3&quot;;
+              case 4: return &quot;float4&quot;;
+            }
+          case EbtInt:
+            switch (type.getNominalSize())
+            {
+              case 1: return &quot;int&quot;;
+              case 2: return &quot;int2&quot;;
+              case 3: return &quot;int3&quot;;
+              case 4: return &quot;int4&quot;;
+            }
+          case EbtUInt:
+            switch (type.getNominalSize())
+            {
+              case 1: return &quot;uint&quot;;
+              case 2: return &quot;uint2&quot;;
+              case 3: return &quot;uint3&quot;;
+              case 4: return &quot;uint4&quot;;
+            }
+          case EbtBool:
+            switch (type.getNominalSize())
+            {
+              case 1: return &quot;bool&quot;;
+              case 2: return &quot;bool2&quot;;
+              case 3: return &quot;bool3&quot;;
+              case 4: return &quot;bool4&quot;;
+            }
+          case EbtVoid:
+            return &quot;void&quot;;
+          case EbtSampler2D:
+          case EbtISampler2D:
+          case EbtUSampler2D:
+          case EbtSampler2DArray:
+          case EbtISampler2DArray:
+          case EbtUSampler2DArray:
+            return &quot;sampler2D&quot;;
+          case EbtSamplerCube:
+          case EbtISamplerCube:
+          case EbtUSamplerCube:
+            return &quot;samplerCUBE&quot;;
+          case EbtSamplerExternalOES:
+            return &quot;sampler2D&quot;;
+          default:
+            break;
+        }
+    }
+
+    UNREACHABLE();
+    return &quot;&lt;unknown type&gt;&quot;;
+}
+
+TString StructNameString(const TStructure &amp;structure)
+{
+    if (structure.name().empty())
+    {
+        return &quot;&quot;;
+    }
+
+    // For structures at global scope we use a consistent
+    // translation so that we can link between shader stages.
+    if (structure.atGlobalScope())
+    {
+        return Decorate(structure.name());
+    }
+
+    return &quot;ss&quot; + str(structure.uniqueId()) + &quot;_&quot; + structure.name();
+}
+
+TString QualifiedStructNameString(const TStructure &amp;structure, bool useHLSLRowMajorPacking,
+                                  bool useStd140Packing)
+{
+    if (structure.name() == &quot;&quot;)
+    {
+        return &quot;&quot;;
+    }
+
+    TString prefix = &quot;&quot;;
+
+    // Structs packed with row-major matrices in HLSL are prefixed with &quot;rm&quot;
+    // GLSL column-major maps to HLSL row-major, and the converse is true
+
+    if (useStd140Packing)
+    {
+        prefix += &quot;std_&quot;;
+    }
+
+    if (useHLSLRowMajorPacking)
+    {
+        prefix += &quot;rm_&quot;;
+    }
+
+    return prefix + StructNameString(structure);
+}
+
+TString InterpolationString(TQualifier qualifier)
+{
+    switch (qualifier)
+    {
+      case EvqVaryingIn:           return &quot;&quot;;
+      case EvqFragmentIn:          return &quot;&quot;;
+      case EvqInvariantVaryingIn:  return &quot;&quot;;
+      case EvqSmoothIn:            return &quot;linear&quot;;
+      case EvqFlatIn:              return &quot;nointerpolation&quot;;
+      case EvqCentroidIn:          return &quot;centroid&quot;;
+      case EvqVaryingOut:          return &quot;&quot;;
+      case EvqVertexOut:           return &quot;&quot;;
+      case EvqInvariantVaryingOut: return &quot;&quot;;
+      case EvqSmoothOut:           return &quot;linear&quot;;
+      case EvqFlatOut:             return &quot;nointerpolation&quot;;
+      case EvqCentroidOut:         return &quot;centroid&quot;;
+      default: UNREACHABLE();
+    }
+
+    return &quot;&quot;;
+}
+
+TString QualifierString(TQualifier qualifier)
+{
+    switch (qualifier)
+    {
+      case EvqIn:            return &quot;in&quot;;
+      case EvqOut:           return &quot;inout&quot;; // 'out' results in an HLSL error if not all fields are written, for GLSL it's undefined
+      case EvqInOut:         return &quot;inout&quot;;
+      case EvqConstReadOnly: return &quot;const&quot;;
+      default: UNREACHABLE();
+    }
+
+    return &quot;&quot;;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorUtilsHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/UtilsHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// UtilsHLSL.h:
+//   Utility methods for GLSL to HLSL translation.
+//
+
+#ifndef COMPILER_TRANSLATOR_UTILSHLSL_H_
+#define COMPILER_TRANSLATOR_UTILSHLSL_H_
+
+#include &lt;vector&gt;
+#include &quot;compiler/translator/Types.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+namespace sh
+{
+
+TString TextureString(const TType &amp;type);
+TString SamplerString(const TType &amp;type);
+// Prepends an underscore to avoid naming clashes
+TString Decorate(const TString &amp;string);
+TString DecorateUniform(const TString &amp;string, const TType &amp;type);
+TString DecorateField(const TString &amp;string, const TStructure &amp;structure);
+TString DecoratePrivate(const TString &amp;privateText);
+TString TypeString(const TType &amp;type);
+TString StructNameString(const TStructure &amp;structure);
+TString QualifiedStructNameString(const TStructure &amp;structure, bool useHLSLRowMajorPacking,
+                                  bool useStd140Packing);
+TString InterpolationString(TQualifier qualifier);
+TString QualifierString(TQualifier qualifier);
+
+}
+
+#endif // COMPILER_TRANSLATOR_UTILSHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateLimitationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -8,6 +8,7 @@
</span><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/InitializeParseContext.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace
</span><span class="cx"> {
</span><span class="lines">@@ -48,7 +49,7 @@
</span><span class="cx"> 
</span><span class="cx"> }  // namespace anonymous
</span><span class="cx"> 
</span><del>-ValidateLimitations::ValidateLimitations(ShShaderType shaderType,
</del><ins>+ValidateLimitations::ValidateLimitations(sh::GLenum shaderType,
</ins><span class="cx">                                          TInfoSinkBase &amp;sink)
</span><span class="cx">     : mShaderType(shaderType),
</span><span class="cx">       mSink(sink),
</span><span class="lines">@@ -185,13 +186,13 @@
</span><span class="cx">         return -1;
</span><span class="cx">     }
</span><span class="cx">     // To keep things simple do not allow declaration list.
</span><del>-    TIntermSequence &amp;declSeq = decl-&gt;getSequence();
-    if (declSeq.size() != 1)
</del><ins>+    TIntermSequence *declSeq = decl-&gt;getSequence();
+    if (declSeq-&gt;size() != 1)
</ins><span class="cx">     {
</span><span class="cx">         error(decl-&gt;getLine(), &quot;Invalid init declaration&quot;, &quot;for&quot;);
</span><span class="cx">         return -1;
</span><span class="cx">     }
</span><del>-    TIntermBinary *declInit = declSeq[0]-&gt;getAsBinaryNode();
</del><ins>+    TIntermBinary *declInit = (*declSeq)[0]-&gt;getAsBinaryNode();
</ins><span class="cx">     if ((declInit == NULL) || (declInit-&gt;getOp() != EOpInitialize))
</span><span class="cx">     {
</span><span class="cx">         error(decl-&gt;getLine(), &quot;Invalid init declaration&quot;, &quot;for&quot;);
</span><span class="lines">@@ -267,7 +268,7 @@
</span><span class="cx">       default:
</span><span class="cx">         error(binOp-&gt;getLine(),
</span><span class="cx">               &quot;Invalid relational operator&quot;,
</span><del>-              getOperatorString(binOp-&gt;getOp()));
</del><ins>+              GetOperatorString(binOp-&gt;getOp()));
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     // Loop index must be compared with a constant.
</span><span class="lines">@@ -344,7 +345,7 @@
</span><span class="cx">         ASSERT((unOp == NULL) &amp;&amp; (binOp != NULL));
</span><span class="cx">         break;
</span><span class="cx">       default:
</span><del>-        error(expr-&gt;getLine(), &quot;Invalid operator&quot;, getOperatorString(op));
</del><ins>+        error(expr-&gt;getLine(), &quot;Invalid operator&quot;, GetOperatorString(op));
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -374,10 +375,10 @@
</span><span class="cx">     // List of param indices for which loop indices are used as argument.
</span><span class="cx">     typedef std::vector&lt;size_t&gt; ParamIndex;
</span><span class="cx">     ParamIndex pIndex;
</span><del>-    TIntermSequence&amp; params = node-&gt;getSequence();
-    for (TIntermSequence::size_type i = 0; i &lt; params.size(); ++i)
</del><ins>+    TIntermSequence *params = node-&gt;getSequence();
+    for (TIntermSequence::size_type i = 0; i &lt; params-&gt;size(); ++i)
</ins><span class="cx">     {
</span><del>-        TIntermSymbol *symbol = params[i]-&gt;getAsSymbolNode();
</del><ins>+        TIntermSymbol *symbol = (*params)[i]-&gt;getAsSymbolNode();
</ins><span class="cx">         if (symbol &amp;&amp; isLoopIndex(symbol))
</span><span class="cx">             pIndex.push_back(i);
</span><span class="cx">     }
</span><span class="lines">@@ -398,9 +399,9 @@
</span><span class="cx">         TQualifier qual = param.type-&gt;getQualifier();
</span><span class="cx">         if ((qual == EvqOut) || (qual == EvqInOut))
</span><span class="cx">         {
</span><del>-            error(params[*i]-&gt;getLine(),
</del><ins>+            error((*params)[*i]-&gt;getLine(),
</ins><span class="cx">                   &quot;Loop index cannot be used as argument to a function out or inout parameter&quot;,
</span><del>-                  params[*i]-&gt;getAsSymbolNode()-&gt;getSymbol().c_str());
</del><ins>+                  (*params)[*i]-&gt;getAsSymbolNode()-&gt;getSymbol().c_str());
</ins><span class="cx">             valid = false;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -457,7 +458,7 @@
</span><span class="cx">     // The index expession must be a constant-index-expression unless
</span><span class="cx">     // the operand is a uniform in a vertex shader.
</span><span class="cx">     TIntermTyped *operand = node-&gt;getLeft();
</span><del>-    bool skip = (mShaderType == SH_VERTEX_SHADER) &amp;&amp;
</del><ins>+    bool skip = (mShaderType == GL_VERTEX_SHADER) &amp;&amp;
</ins><span class="cx">                 (operand-&gt;getQualifier() == EvqUniform);
</span><span class="cx">     if (!skip &amp;&amp; !isConstIndexExpr(index))
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateLimitationsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateLimitations.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,7 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#ifndef COMPILER_TRANSLATOR_VALIDATELIMITATIONS_H_
+#define COMPILER_TRANSLATOR_VALIDATELIMITATIONS_H_
+
+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/LoopInfo.h&quot;
</span><span class="cx"> 
</span><span class="cx"> class TInfoSinkBase;
</span><span class="lines">@@ -14,7 +17,7 @@
</span><span class="cx"> class ValidateLimitations : public TIntermTraverser
</span><span class="cx"> {
</span><span class="cx">   public:
</span><del>-    ValidateLimitations(ShShaderType shaderType, TInfoSinkBase &amp;sink);
</del><ins>+    ValidateLimitations(sh::GLenum shaderType, TInfoSinkBase &amp;sink);
</ins><span class="cx"> 
</span><span class="cx">     int numErrors() const { return mNumErrors; }
</span><span class="cx"> 
</span><span class="lines">@@ -47,9 +50,10 @@
</span><span class="cx">     bool isConstIndexExpr(TIntermNode *node);
</span><span class="cx">     bool validateIndexing(TIntermBinary *node);
</span><span class="cx"> 
</span><del>-    ShShaderType mShaderType;
</del><ins>+    sh::GLenum mShaderType;
</ins><span class="cx">     TInfoSinkBase &amp;mSink;
</span><span class="cx">     int mNumErrors;
</span><span class="cx">     TLoopStack mLoopStack;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+#endif // COMPILER_TRANSLATOR_VALIDATELIMITATIONS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateOutputsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateOutputs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,8 +4,11 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#ifndef COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_
+#define COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_
</ins><span class="cx"> 
</span><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
+
</ins><span class="cx"> #include &lt;set&gt;
</span><span class="cx"> 
</span><span class="cx"> class TInfoSinkBase;
</span><span class="lines">@@ -31,3 +34,5 @@
</span><span class="cx"> 
</span><span class="cx">     void error(TSourceLoc loc, const char *reason, const char* token);
</span><span class="cx"> };
</span><ins>+
+#endif // COMPILER_TRANSLATOR_VALIDATEOUTPUTS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateSwitchcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,200 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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 &quot;compiler/translator/ValidateSwitch.h&quot;
+
+#include &quot;compiler/translator/ParseContext.h&quot;
+
+bool ValidateSwitch::validate(TBasicType switchType, TParseContext *context,
+    TIntermAggregate *statementList, const TSourceLoc &amp;loc)
+{
+    ValidateSwitch validate(switchType, context);
+    ASSERT(statementList);
+    statementList-&gt;traverse(&amp;validate);
+    return validate.validateInternal(loc);
+}
+
+ValidateSwitch::ValidateSwitch(TBasicType switchType, TParseContext *context)
+    : TIntermTraverser(true, false, true),
+      mSwitchType(switchType),
+      mContext(context),
+      mCaseTypeMismatch(false),
+      mFirstCaseFound(false),
+      mStatementBeforeCase(false),
+      mLastStatementWasCase(false),
+      mControlFlowDepth(0),
+      mCaseInsideControlFlow(false),
+      mDefaultCount(0),
+      mDuplicateCases(false)
+{}
+
+void ValidateSwitch::visitSymbol(TIntermSymbol *)
+{
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+}
+
+void ValidateSwitch::visitConstantUnion(TIntermConstantUnion *)
+{
+    // Conditions of case labels are not traversed, so this is some other constant
+    // Could be just a statement like &quot;0;&quot;
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+}
+
+bool ValidateSwitch::visitBinary(Visit, TIntermBinary *)
+{
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+    return true;
+}
+
+bool ValidateSwitch::visitUnary(Visit, TIntermUnary *)
+{
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+    return true;
+}
+
+bool ValidateSwitch::visitSelection(Visit visit, TIntermSelection *)
+{
+    if (visit == PreVisit)
+        ++mControlFlowDepth;
+    if (visit == PostVisit)
+        --mControlFlowDepth;
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+    return true;
+}
+
+bool ValidateSwitch::visitSwitch(Visit, TIntermSwitch *)
+{
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+    // Don't go into nested switch statements
+    return false;
+}
+
+bool ValidateSwitch::visitCase(Visit, TIntermCase *node)
+{
+    const char *nodeStr = node-&gt;hasCondition() ? &quot;case&quot; : &quot;default&quot;;
+    if (mControlFlowDepth &gt; 0)
+    {
+        mContext-&gt;error(node-&gt;getLine(), &quot;label statement nested inside control flow&quot;, nodeStr);
+        mCaseInsideControlFlow = true;
+    }
+    mFirstCaseFound = true;
+    mLastStatementWasCase = true;
+    if (!node-&gt;hasCondition())
+    {
+        ++mDefaultCount;
+        if (mDefaultCount &gt; 1)
+        {
+            mContext-&gt;error(node-&gt;getLine(), &quot;duplicate default label&quot;, nodeStr);
+        }
+    }
+    else
+    {
+        TIntermConstantUnion *condition = node-&gt;getCondition()-&gt;getAsConstantUnion();
+        if (condition == nullptr)
+        {
+            // This can happen in error cases.
+            return false;
+        }
+        TBasicType conditionType = condition-&gt;getBasicType();
+        if (conditionType != mSwitchType)
+        {
+            mContext-&gt;error(condition-&gt;getLine(),
+                &quot;case label type does not match switch init-expression type&quot;, nodeStr);
+            mCaseTypeMismatch = true;
+        }
+
+        if (conditionType == EbtInt)
+        {
+            int iConst = condition-&gt;getIConst(0);
+            if (mCasesSigned.find(iConst) != mCasesSigned.end())
+            {
+                mContext-&gt;error(condition-&gt;getLine(), &quot;duplicate case label&quot;, nodeStr);
+                mDuplicateCases = true;
+            }
+            else
+            {
+                mCasesSigned.insert(iConst);
+            }
+        }
+        else if (conditionType == EbtUInt)
+        {
+            unsigned int uConst = condition-&gt;getUConst(0);
+            if (mCasesUnsigned.find(uConst) != mCasesUnsigned.end())
+            {
+                mContext-&gt;error(condition-&gt;getLine(), &quot;duplicate case label&quot;, nodeStr);
+                mDuplicateCases = true;
+            }
+            else
+            {
+                mCasesUnsigned.insert(uConst);
+            }
+        }
+        // Other types are possible only in error cases, where the error has already been generated
+        // when parsing the case statement.
+    }
+    // Don't traverse the condition of the case statement
+    return false;
+}
+
+bool ValidateSwitch::visitAggregate(Visit visit, TIntermAggregate *)
+{
+    if (getParentNode() != nullptr)
+    {
+        // This is not the statementList node, but some other node.
+        if (!mFirstCaseFound)
+            mStatementBeforeCase = true;
+        mLastStatementWasCase = false;
+    }
+    return true;
+}
+
+bool ValidateSwitch::visitLoop(Visit visit, TIntermLoop *)
+{
+    if (visit == PreVisit)
+        ++mControlFlowDepth;
+    if (visit == PostVisit)
+        --mControlFlowDepth;
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+    return true;
+}
+
+bool ValidateSwitch::visitBranch(Visit, TIntermBranch *)
+{
+    if (!mFirstCaseFound)
+        mStatementBeforeCase = true;
+    mLastStatementWasCase = false;
+    return true;
+}
+
+bool ValidateSwitch::validateInternal(const TSourceLoc &amp;loc)
+{
+    if (mStatementBeforeCase)
+    {
+        mContext-&gt;error(loc,
+            &quot;statement before the first label&quot;, &quot;switch&quot;);
+    }
+    if (mLastStatementWasCase)
+    {
+        mContext-&gt;error(loc,
+            &quot;no statement between the last label and the end of the switch statement&quot;, &quot;switch&quot;);
+    }
+    return !mStatementBeforeCase &amp;&amp; !mLastStatementWasCase &amp;&amp; !mCaseInsideControlFlow &amp;&amp;
+        !mCaseTypeMismatch &amp;&amp; mDefaultCount &lt;= 1 &amp;&amp; !mDuplicateCases;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorValidateSwitchh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ValidateSwitch.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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_TRANSLATOR_VALIDATESWITCH_H_
+#define COMPILER_TRANSLATOR_VALIDATESWITCH_H_
+
+#include &quot;compiler/translator/IntermNode.h&quot;
+
+struct TParseContext;
+
+class ValidateSwitch : public TIntermTraverser
+{
+  public:
+    // Check for errors and output messages any remaining errors on the context.
+    // Returns true if there are no errors.
+    static bool validate(TBasicType switchType, TParseContext *context,
+        TIntermAggregate *statementList, const TSourceLoc &amp;loc);
+
+    void visitSymbol(TIntermSymbol *) override;
+    void visitConstantUnion(TIntermConstantUnion *) override;
+    bool visitBinary(Visit, TIntermBinary *) override;
+    bool visitUnary(Visit, TIntermUnary *) override;
+    bool visitSelection(Visit visit, TIntermSelection *) override;
+    bool visitSwitch(Visit, TIntermSwitch *) override;
+    bool visitCase(Visit, TIntermCase *node) override;
+    bool visitAggregate(Visit, TIntermAggregate *) override;
+    bool visitLoop(Visit visit, TIntermLoop *) override;
+    bool visitBranch(Visit, TIntermBranch *) override;
+
+  private:
+    ValidateSwitch(TBasicType switchType, TParseContext *context);
+
+    bool validateInternal(const TSourceLoc &amp;loc);
+
+    TBasicType mSwitchType;
+    TParseContext *mContext;
+    bool mCaseTypeMismatch;
+    bool mFirstCaseFound;
+    bool mStatementBeforeCase;
+    bool mLastStatementWasCase;
+    int mControlFlowDepth;
+    bool mCaseInsideControlFlow;
+    int mDefaultCount;
+    std::set&lt;int&gt; mCasesSigned;
+    std::set&lt;unsigned int&gt; mCasesUnsigned;
+    bool mDuplicateCases;
+};
+
+#endif // COMPILER_TRANSLATOR_VALIDATESWITCH_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVariableInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,244 +4,151 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><ins>+#include &quot;angle_gl.h&quot;
+#include &quot;compiler/translator/SymbolTable.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/VariableInfo.h&quot;
</span><ins>+#include &quot;compiler/translator/util.h&quot;
+#include &quot;common/utilities.h&quot;
</ins><span class="cx"> 
</span><del>-namespace {
</del><ins>+namespace sh
+{
</ins><span class="cx"> 
</span><del>-TString arrayBrackets(int index)
</del><ins>+namespace
</ins><span class="cx"> {
</span><del>-    TStringStream stream;
-    stream &lt;&lt; &quot;[&quot; &lt;&lt; index &lt;&lt; &quot;]&quot;;
-    return stream.str();
</del><ins>+
+TString InterfaceBlockFieldName(const TInterfaceBlock &amp;interfaceBlock, const TField &amp;field)
+{
+    if (interfaceBlock.hasInstanceName())
+    {
+        return interfaceBlock.name() + &quot;.&quot; + field.name();
+    }
+    else
+    {
+        return field.name();
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Returns the data type for an attribute, uniform, or varying.
-ShDataType getVariableDataType(const TType&amp; type)
</del><ins>+BlockLayoutType GetBlockLayoutType(TLayoutBlockStorage blockStorage)
</ins><span class="cx"> {
</span><del>-    switch (type.getBasicType()) {
-      case EbtFloat:
-          if (type.isMatrix()) {
-              switch (type.getCols())
-              {
-                case 2:
-                  switch (type.getRows())
-                  {
-                    case 2: return SH_FLOAT_MAT2;
-                    case 3: return SH_FLOAT_MAT2x3;
-                    case 4: return SH_FLOAT_MAT2x4;
-                    default: UNREACHABLE();
-                  }
-                case 3:
-                  switch (type.getRows())
-                  {
-                    case 2: return SH_FLOAT_MAT3x2;
-                    case 3: return SH_FLOAT_MAT3;
-                    case 4: return SH_FLOAT_MAT3x4;
-                    default: UNREACHABLE();
-                  }
-                case 4:
-                  switch (type.getRows())
-                  {
-                    case 2: return SH_FLOAT_MAT4x2;
-                    case 3: return SH_FLOAT_MAT4x3;
-                    case 4: return SH_FLOAT_MAT4;
-                    default: UNREACHABLE();
-                  }
-              }
-          } else if (type.isVector()) {
-              switch (type.getNominalSize()) {
-                case 2: return SH_FLOAT_VEC2;
-                case 3: return SH_FLOAT_VEC3;
-                case 4: return SH_FLOAT_VEC4;
-                default: UNREACHABLE();
-              }
-          } else {
-              return SH_FLOAT;
-          }
-      case EbtInt:
-          if (type.isMatrix()) {
-              UNREACHABLE();
-          } else if (type.isVector()) {
-              switch (type.getNominalSize()) {
-                case 2: return SH_INT_VEC2;
-                case 3: return SH_INT_VEC3;
-                case 4: return SH_INT_VEC4;
-                default: UNREACHABLE();
-              }
-          } else {
-              return SH_INT;
-          }
-      case EbtUInt:
-          if (type.isMatrix()) {
-              UNREACHABLE();
-          } else if (type.isVector()) {
-              switch (type.getNominalSize()) {
-                case 2: return SH_UNSIGNED_INT_VEC2;
-                case 3: return SH_UNSIGNED_INT_VEC3;
-                case 4: return SH_UNSIGNED_INT_VEC4;
-                default: UNREACHABLE();
-              }
-          } else {
-              return SH_UNSIGNED_INT;
-          }
-      case EbtBool:
-          if (type.isMatrix()) {
-              UNREACHABLE();
-          } else if (type.isVector()) {
-              switch (type.getNominalSize()) {
-                case 2: return SH_BOOL_VEC2;
-                case 3: return SH_BOOL_VEC3;
-                case 4: return SH_BOOL_VEC4;
-                default: UNREACHABLE();
-              }
-          } else {
-              return SH_BOOL;
-          }
-      case EbtSampler2D: return SH_SAMPLER_2D;
-      case EbtSampler3D: return SH_SAMPLER_3D;
-      case EbtSamplerCube: return SH_SAMPLER_CUBE;
-      case EbtSamplerExternalOES: return SH_SAMPLER_EXTERNAL_OES;
-      case EbtSampler2DRect: return SH_SAMPLER_2D_RECT_ARB;
-      case EbtSampler2DArray: return SH_SAMPLER_2D_ARRAY;
-      case EbtISampler2D: return SH_INT_SAMPLER_2D;
-      case EbtISampler3D: return SH_INT_SAMPLER_3D;
-      case EbtISamplerCube: return SH_INT_SAMPLER_CUBE;
-      case EbtISampler2DArray: return SH_INT_SAMPLER_2D_ARRAY;
-      case EbtUSampler2D: return SH_UNSIGNED_INT_SAMPLER_2D;
-      case EbtUSampler3D: return SH_UNSIGNED_INT_SAMPLER_3D;
-      case EbtUSamplerCube: return SH_UNSIGNED_INT_SAMPLER_CUBE;
-      case EbtUSampler2DArray: return SH_UNSIGNED_INT_SAMPLER_2D_ARRAY;
-      case EbtSampler2DShadow: return SH_SAMPLER_2D_SHADOW;
-      case EbtSamplerCubeShadow: return SH_SAMPLER_CUBE_SHADOW;
-      case EbtSampler2DArrayShadow: return SH_SAMPLER_2D_ARRAY_SHADOW;
-      default: UNREACHABLE();
</del><ins>+    switch (blockStorage)
+    {
+      case EbsPacked:         return BLOCKLAYOUT_PACKED;
+      case EbsShared:         return BLOCKLAYOUT_SHARED;
+      case EbsStd140:         return BLOCKLAYOUT_STANDARD;
+      default: UNREACHABLE(); return BLOCKLAYOUT_SHARED;
</ins><span class="cx">     }
</span><del>-    return SH_NONE;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void getBuiltInVariableInfo(const TType&amp; type,
-                            const TString&amp; name,
-                            const TString&amp; mappedName,
-                            TVariableInfoList&amp; infoList);
-void getUserDefinedVariableInfo(const TType&amp; type,
-                                const TString&amp; name,
-                                const TString&amp; mappedName,
-                                TVariableInfoList&amp; infoList,
-                                ShHashFunction64 hashFunction);
</del><ins>+void ExpandUserDefinedVariable(const ShaderVariable &amp;variable,
+                               const std::string &amp;name,
+                               const std::string &amp;mappedName,
+                               bool markStaticUse,
+                               std::vector&lt;ShaderVariable&gt; *expanded);
</ins><span class="cx"> 
</span><del>-// Returns info for an attribute, uniform, or varying.
-void getVariableInfo(const TType&amp; type,
-                     const TString&amp; name,
-                     const TString&amp; mappedName,
-                     TVariableInfoList&amp; infoList,
-                     ShHashFunction64 hashFunction)
</del><ins>+void ExpandVariable(const ShaderVariable &amp;variable,
+                    const std::string &amp;name,
+                    const std::string &amp;mappedName,
+                    bool markStaticUse,
+                    std::vector&lt;ShaderVariable&gt; *expanded)
</ins><span class="cx"> {
</span><del>-    if (type.getBasicType() == EbtStruct) {
-        if (type.isArray()) {
-            for (int i = 0; i &lt; type.getArraySize(); ++i) {
-                TString lname = name + arrayBrackets(i);
-                TString lmappedName = mappedName + arrayBrackets(i);
-                getUserDefinedVariableInfo(type, lname, lmappedName, infoList, hashFunction);
</del><ins>+    if (variable.isStruct())
+    {
+        if (variable.isArray())
+        {
+            for (unsigned int elementIndex = 0; elementIndex &lt; variable.elementCount(); elementIndex++)
+            {
+                std::string lname = name + ::ArrayString(elementIndex);
+                std::string lmappedName = mappedName + ::ArrayString(elementIndex);
+                ExpandUserDefinedVariable(variable, lname, lmappedName, markStaticUse, expanded);
</ins><span class="cx">             }
</span><del>-        } else {
-            getUserDefinedVariableInfo(type, name, mappedName, infoList, hashFunction);
</del><span class="cx">         }
</span><del>-    } else {
-        getBuiltInVariableInfo(type, name, mappedName, infoList);
</del><ins>+        else
+        {
+            ExpandUserDefinedVariable(variable, name, mappedName, markStaticUse, expanded);
+        }
</ins><span class="cx">     }
</span><del>-}
</del><ins>+    else
+    {
+        ShaderVariable expandedVar = variable;
</ins><span class="cx"> 
</span><del>-void getBuiltInVariableInfo(const TType&amp; type,
-                            const TString&amp; name,
-                            const TString&amp; mappedName,
-                            TVariableInfoList&amp; infoList)
-{
-    ASSERT(type.getBasicType() != EbtStruct);
</del><ins>+        expandedVar.name = name;
+        expandedVar.mappedName = mappedName;
</ins><span class="cx"> 
</span><del>-    TVariableInfo varInfo;
-    if (type.isArray()) {
-        varInfo.name = (name + &quot;[0]&quot;).c_str();
-        varInfo.mappedName = (mappedName + &quot;[0]&quot;).c_str();
-        varInfo.size = type.getArraySize();
-        varInfo.isArray = true;
-    } else {
-        varInfo.name = name.c_str();
-        varInfo.mappedName = mappedName.c_str();
-        varInfo.size = 1;
-        varInfo.isArray = false;
</del><ins>+        // Mark all expanded fields as used if the parent is used
+        if (markStaticUse)
+        {
+            expandedVar.staticUse = true;
+        }
+
+        if (expandedVar.isArray())
+        {
+            expandedVar.name += &quot;[0]&quot;;
+            expandedVar.mappedName += &quot;[0]&quot;;
+        }
+
+        expanded-&gt;push_back(expandedVar);
</ins><span class="cx">     }
</span><del>-    varInfo.precision = type.getPrecision();
-    varInfo.type = getVariableDataType(type);
-    infoList.push_back(varInfo);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void getUserDefinedVariableInfo(const TType&amp; type,
-                                const TString&amp; name,
-                                const TString&amp; mappedName,
-                                TVariableInfoList&amp; infoList,
-                                ShHashFunction64 hashFunction)
</del><ins>+void ExpandUserDefinedVariable(const ShaderVariable &amp;variable,
+                               const std::string &amp;name,
+                               const std::string &amp;mappedName,
+                               bool markStaticUse,
+                               std::vector&lt;ShaderVariable&gt; *expanded)
</ins><span class="cx"> {
</span><del>-    ASSERT(type.getBasicType() == EbtStruct || type.isInterfaceBlock());
</del><ins>+    ASSERT(variable.isStruct());
</ins><span class="cx"> 
</span><del>-    const TFieldList&amp; fields = type.getStruct()-&gt;fields();
-    for (size_t i = 0; i &lt; fields.size(); ++i) {
-        const TType&amp; fieldType = *(fields[i]-&gt;type());
-        const TString&amp; fieldName = fields[i]-&gt;name();
-        getVariableInfo(fieldType,
-                        name + &quot;.&quot; + fieldName,
-                        mappedName + &quot;.&quot; + TIntermTraverser::hash(fieldName, hashFunction),
-                        infoList,
-                        hashFunction);
</del><ins>+    const std::vector&lt;ShaderVariable&gt; &amp;fields = variable.fields;
+
+    for (size_t fieldIndex = 0; fieldIndex &lt; fields.size(); fieldIndex++)
+    {
+        const ShaderVariable &amp;field = fields[fieldIndex];
+        ExpandVariable(field,
+                       name + &quot;.&quot; + field.name,
+                       mappedName + &quot;.&quot; + field.mappedName,
+                       markStaticUse,
+                       expanded);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-TVariableInfo* findVariable(const TType&amp; type,
-                            const TString&amp; name,
-                            TVariableInfoList&amp; infoList)
</del><ins>+template &lt;class VarT&gt;
+VarT *FindVariable(const TString &amp;name,
+                  std::vector&lt;VarT&gt; *infoList)
</ins><span class="cx"> {
</span><span class="cx">     // TODO(zmo): optimize this function.
</span><del>-    TString myName = name;
-    if (type.isArray())
-        myName += &quot;[0]&quot;;
-    for (size_t ii = 0; ii &lt; infoList.size(); ++ii)
</del><ins>+    for (size_t ii = 0; ii &lt; infoList-&gt;size(); ++ii)
</ins><span class="cx">     {
</span><del>-        if (infoList[ii].name.c_str() == myName)
-            return &amp;(infoList[ii]);
</del><ins>+        if ((*infoList)[ii].name.c_str() == name)
+            return &amp;((*infoList)[ii]);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     return NULL;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-}  // namespace anonymous
-
-TVariableInfo::TVariableInfo()
-    : type(SH_NONE),
-      size(0),
-      isArray(false),
-      precision(EbpUndefined),
-      staticUse(false)
-{
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-TVariableInfo::TVariableInfo(ShDataType type, int size)
-    : type(type),
-      size(size),
-      isArray(false),
-      precision(EbpUndefined),
-      staticUse(false)
-{
-}
-
-CollectVariables::CollectVariables(TVariableInfoList&amp; attribs,
-                                   TVariableInfoList&amp; uniforms,
-                                   TVariableInfoList&amp; varyings,
-                                   ShHashFunction64 hashFunction)
</del><ins>+CollectVariables::CollectVariables(std::vector&lt;sh::Attribute&gt; *attribs,
+                                   std::vector&lt;sh::Attribute&gt; *outputVariables,
+                                   std::vector&lt;sh::Uniform&gt; *uniforms,
+                                   std::vector&lt;sh::Varying&gt; *varyings,
+                                   std::vector&lt;sh::InterfaceBlock&gt; *interfaceBlocks,
+                                   ShHashFunction64 hashFunction,
+                                   const TSymbolTable &amp;symbolTable)
</ins><span class="cx">     : mAttribs(attribs),
</span><ins>+      mOutputVariables(outputVariables),
</ins><span class="cx">       mUniforms(uniforms),
</span><span class="cx">       mVaryings(varyings),
</span><ins>+      mInterfaceBlocks(interfaceBlocks),
+      mDepthRangeAdded(false),
</ins><span class="cx">       mPointCoordAdded(false),
</span><span class="cx">       mFrontFacingAdded(false),
</span><span class="cx">       mFragCoordAdded(false),
</span><del>-      mHashFunction(hashFunction)
</del><ins>+      mInstanceIDAdded(false),
+      mPositionAdded(false),
+      mPointSizeAdded(false),
+      mLastFragDataAdded(false),
+      mHashFunction(hashFunction),
+      mSymbolTable(symbolTable)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -250,124 +157,405 @@
</span><span class="cx"> // Also, gl_FragCoord, gl_PointCoord, and gl_FrontFacing count
</span><span class="cx"> // toward varying counting if they are statically used in a fragment
</span><span class="cx"> // shader.
</span><del>-void CollectVariables::visitSymbol(TIntermSymbol* symbol)
</del><ins>+void CollectVariables::visitSymbol(TIntermSymbol *symbol)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(symbol != NULL);
</span><del>-    TVariableInfo* var = NULL;
-    switch (symbol-&gt;getQualifier())
</del><ins>+    ShaderVariable *var = NULL;
+    const TString &amp;symbolName = symbol-&gt;getSymbol();
+
+    if (IsVarying(symbol-&gt;getQualifier()))
</ins><span class="cx">     {
</span><del>-    case EvqVaryingOut:
-    case EvqInvariantVaryingOut:
-    case EvqVaryingIn:
-    case EvqInvariantVaryingIn:
-        var = findVariable(symbol-&gt;getType(), symbol-&gt;getSymbol(), mVaryings);
-        break;
-    case EvqUniform:
-        var = findVariable(symbol-&gt;getType(), symbol-&gt;getSymbol(), mUniforms);
-        break;
-    case EvqFragCoord:
-        if (!mFragCoordAdded) {
-            TVariableInfo info;
-            info.name = &quot;gl_FragCoord&quot;;
-            info.mappedName = &quot;gl_FragCoord&quot;;
-            info.type = SH_FLOAT_VEC4;
-            info.size = 1;
-            info.precision = EbpMedium;  // Use mediump as it doesn't really matter.
</del><ins>+        var = FindVariable(symbolName, mVaryings);
+    }
+    else if (symbol-&gt;getType().getBasicType() == EbtInterfaceBlock)
+    {
+        UNREACHABLE();
+    }
+    else if (symbolName == &quot;gl_DepthRange&quot;)
+    {
+        ASSERT(symbol-&gt;getQualifier() == EvqUniform);
+
+        if (!mDepthRangeAdded)
+        {
+            Uniform info;
+            const char kName[] = &quot;gl_DepthRange&quot;;
+            info.name = kName;
+            info.mappedName = kName;
+            info.type = GL_STRUCT_ANGLEX;
+            info.arraySize = 0;
+            info.precision = GL_NONE;
</ins><span class="cx">             info.staticUse = true;
</span><del>-            mVaryings.push_back(info);
-            mFragCoordAdded = true;
</del><ins>+
+            ShaderVariable nearInfo;
+            const char kNearName[] = &quot;near&quot;;
+            nearInfo.name = kNearName;
+            nearInfo.mappedName = kNearName;
+            nearInfo.type = GL_FLOAT;
+            nearInfo.arraySize = 0;
+            nearInfo.precision = GL_HIGH_FLOAT;
+            nearInfo.staticUse = true;
+
+            ShaderVariable farInfo;
+            const char kFarName[] = &quot;far&quot;;
+            farInfo.name = kFarName;
+            farInfo.mappedName = kFarName;
+            farInfo.type = GL_FLOAT;
+            farInfo.arraySize = 0;
+            farInfo.precision = GL_HIGH_FLOAT;
+            farInfo.staticUse = true;
+
+            ShaderVariable diffInfo;
+            const char kDiffName[] = &quot;diff&quot;;
+            diffInfo.name = kDiffName;
+            diffInfo.mappedName = kDiffName;
+            diffInfo.type = GL_FLOAT;
+            diffInfo.arraySize = 0;
+            diffInfo.precision = GL_HIGH_FLOAT;
+            diffInfo.staticUse = true;
+
+            info.fields.push_back(nearInfo);
+            info.fields.push_back(farInfo);
+            info.fields.push_back(diffInfo);
+
+            mUniforms-&gt;push_back(info);
+            mDepthRangeAdded = true;
</ins><span class="cx">         }
</span><del>-        return;
-    case EvqFrontFacing:
-        if (!mFrontFacingAdded) {
-            TVariableInfo info;
-            info.name = &quot;gl_FrontFacing&quot;;
-            info.mappedName = &quot;gl_FrontFacing&quot;;
-            info.type = SH_BOOL;
-            info.size = 1;
-            info.precision = EbpUndefined;
-            info.staticUse = true;
-            mVaryings.push_back(info);
-            mFrontFacingAdded = true;
</del><ins>+    }
+    else
+    {
+        switch (symbol-&gt;getQualifier())
+        {
+          case EvqAttribute:
+          case EvqVertexIn:
+            var = FindVariable(symbolName, mAttribs);
+            break;
+          case EvqFragmentOut:
+            var = FindVariable(symbolName, mOutputVariables);
+            break;
+          case EvqUniform:
+            {
+                const TInterfaceBlock *interfaceBlock = symbol-&gt;getType().getInterfaceBlock();
+                if (interfaceBlock)
+                {
+                    InterfaceBlock *namedBlock = FindVariable(interfaceBlock-&gt;name(), mInterfaceBlocks);
+                    ASSERT(namedBlock);
+                    var = FindVariable(symbolName, &amp;namedBlock-&gt;fields);
+
+                    // Set static use on the parent interface block here
+                    namedBlock-&gt;staticUse = true;
+                }
+                else
+                {
+                    var = FindVariable(symbolName, mUniforms);
+                }
+
+                // It's an internal error to reference an undefined user uniform
+                ASSERT(symbolName.compare(0, 3, &quot;gl_&quot;) != 0 || var);
+            }
+            break;
+          case EvqFragCoord:
+            if (!mFragCoordAdded)
+            {
+                Varying info;
+                const char kName[] = &quot;gl_FragCoord&quot;;
+                info.name = kName;
+                info.mappedName = kName;
+                info.type = GL_FLOAT_VEC4;
+                info.arraySize = 0;
+                info.precision = GL_MEDIUM_FLOAT;  // Defined by spec.
+                info.staticUse = true;
+                info.isInvariant = mSymbolTable.isVaryingInvariant(kName);
+                mVaryings-&gt;push_back(info);
+                mFragCoordAdded = true;
+            }
+            return;
+          case EvqFrontFacing:
+            if (!mFrontFacingAdded)
+            {
+                Varying info;
+                const char kName[] = &quot;gl_FrontFacing&quot;;
+                info.name = kName;
+                info.mappedName = kName;
+                info.type = GL_BOOL;
+                info.arraySize = 0;
+                info.precision = GL_NONE;
+                info.staticUse = true;
+                info.isInvariant = mSymbolTable.isVaryingInvariant(kName);
+                mVaryings-&gt;push_back(info);
+                mFrontFacingAdded = true;
+            }
+            return;
+          case EvqPointCoord:
+            if (!mPointCoordAdded)
+            {
+                Varying info;
+                const char kName[] = &quot;gl_PointCoord&quot;;
+                info.name = kName;
+                info.mappedName = kName;
+                info.type = GL_FLOAT_VEC2;
+                info.arraySize = 0;
+                info.precision = GL_MEDIUM_FLOAT;  // Defined by spec.
+                info.staticUse = true;
+                info.isInvariant = mSymbolTable.isVaryingInvariant(kName);
+                mVaryings-&gt;push_back(info);
+                mPointCoordAdded = true;
+            }
+            return;
+          case EvqInstanceID:
+            if (!mInstanceIDAdded)
+            {
+                Attribute info;
+                const char kName[] = &quot;gl_InstanceID&quot;;
+                info.name = kName;
+                info.mappedName = kName;
+                info.type = GL_INT;
+                info.arraySize = 0;
+                info.precision = GL_HIGH_INT;  // Defined by spec.
+                info.staticUse = true;
+                info.location = -1;
+                mAttribs-&gt;push_back(info);
+                mInstanceIDAdded = true;
+            }
+            return;
+          case EvqPosition:
+            if (!mPositionAdded)
+            {
+                Varying info;
+                const char kName[] = &quot;gl_Position&quot;;
+                info.name = kName;
+                info.mappedName = kName;
+                info.type = GL_FLOAT_VEC4;
+                info.arraySize = 0;
+                info.precision = GL_HIGH_FLOAT;  // Defined by spec.
+                info.staticUse = true;
+                info.isInvariant = mSymbolTable.isVaryingInvariant(kName);
+                mVaryings-&gt;push_back(info);
+                mPositionAdded = true;
+            }
+            return;
+          case EvqPointSize:
+            if (!mPointSizeAdded)
+            {
+                Varying info;
+                const char kName[] = &quot;gl_PointSize&quot;;
+                info.name = kName;
+                info.mappedName = kName;
+                info.type = GL_FLOAT;
+                info.arraySize = 0;
+                info.precision = GL_MEDIUM_FLOAT;  // Defined by spec.
+                info.staticUse = true;
+                info.isInvariant = mSymbolTable.isVaryingInvariant(kName);
+                mVaryings-&gt;push_back(info);
+                mPointSizeAdded = true;
+            }
+            return;
+          case EvqLastFragData:
+            if (!mLastFragDataAdded)
+            {
+                Varying info;
+                const char kName[] = &quot;gl_LastFragData&quot;;
+                info.name = kName;
+                info.mappedName = kName;
+                info.type = GL_FLOAT_VEC4;
+                info.arraySize = static_cast&lt;const TVariable*&gt;(mSymbolTable.findBuiltIn(&quot;gl_MaxDrawBuffers&quot;, 100))-&gt;getConstPointer()-&gt;getIConst();
+                info.precision = GL_MEDIUM_FLOAT;  // Defined by spec.
+                info.staticUse = true;
+                info.isInvariant = mSymbolTable.isVaryingInvariant(kName);
+                mVaryings-&gt;push_back(info);
+                mLastFragDataAdded = true;
+            }
+            return;
+          default:
+            break;
</ins><span class="cx">         }
</span><del>-        return;
-    case EvqPointCoord:
-        if (!mPointCoordAdded) {
-            TVariableInfo info;
-            info.name = &quot;gl_PointCoord&quot;;
-            info.mappedName = &quot;gl_PointCoord&quot;;
-            info.type = SH_FLOAT_VEC2;
-            info.size = 1;
-            info.precision = EbpMedium;  // Use mediump as it doesn't really matter.
-            info.staticUse = true;
-            mVaryings.push_back(info);
-            mPointCoordAdded = true;
-        }
-        return;
-    default:
-        break;
</del><span class="cx">     }
</span><span class="cx">     if (var)
</span><ins>+    {
</ins><span class="cx">         var-&gt;staticUse = true;
</span><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool CollectVariables::visitAggregate(Visit, TIntermAggregate* node)
</del><ins>+class NameHashingTraverser : public GetVariableTraverser
</ins><span class="cx"> {
</span><ins>+  public:
+    NameHashingTraverser(ShHashFunction64 hashFunction,
+                         const TSymbolTable &amp;symbolTable)
+        : GetVariableTraverser(symbolTable),
+          mHashFunction(hashFunction)
+    {}
+
+  private:
+    virtual void visitVariable(ShaderVariable *variable)
+    {
+        TString stringName = TString(variable-&gt;name.c_str());
+        variable-&gt;mappedName = TIntermTraverser::hash(stringName, mHashFunction).c_str();
+    }
+
+    ShHashFunction64 mHashFunction;
+};
+
+// Attributes, which cannot have struct fields, are a special case
+template &lt;&gt;
+void CollectVariables::visitVariable(const TIntermSymbol *variable,
+                                     std::vector&lt;Attribute&gt; *infoList) const
+{
+    ASSERT(variable);
+    const TType &amp;type = variable-&gt;getType();
+    ASSERT(!type.getStruct());
+
+    Attribute attribute;
+
+    attribute.type = GLVariableType(type);
+    attribute.precision = GLVariablePrecision(type);
+    attribute.name = variable-&gt;getSymbol().c_str();
+    attribute.arraySize = static_cast&lt;unsigned int&gt;(type.getArraySize());
+    attribute.mappedName = TIntermTraverser::hash(variable-&gt;getSymbol(), mHashFunction).c_str();
+    attribute.location = variable-&gt;getType().getLayoutQualifier().location;
+
+    infoList-&gt;push_back(attribute);
+}
+
+template &lt;&gt;
+void CollectVariables::visitVariable(const TIntermSymbol *variable,
+                                     std::vector&lt;InterfaceBlock&gt; *infoList) const
+{
+    InterfaceBlock interfaceBlock;
+    const TInterfaceBlock *blockType = variable-&gt;getType().getInterfaceBlock();
+    ASSERT(blockType);
+
+    interfaceBlock.name = blockType-&gt;name().c_str();
+    interfaceBlock.mappedName = TIntermTraverser::hash(variable-&gt;getSymbol(), mHashFunction).c_str();
+    interfaceBlock.instanceName = (blockType-&gt;hasInstanceName() ? blockType-&gt;instanceName().c_str() : &quot;&quot;);
+    interfaceBlock.arraySize = variable-&gt;getArraySize();
+    interfaceBlock.isRowMajorLayout = (blockType-&gt;matrixPacking() == EmpRowMajor);
+    interfaceBlock.layout = GetBlockLayoutType(blockType-&gt;blockStorage());
+
+    // Gather field information
+    const TFieldList &amp;fieldList = blockType-&gt;fields();
+
+    for (size_t fieldIndex = 0; fieldIndex &lt; fieldList.size(); ++fieldIndex)
+    {
+        const TField &amp;field = *fieldList[fieldIndex];
+        const TString &amp;fullFieldName = InterfaceBlockFieldName(*blockType, field);
+        const TType &amp;fieldType = *field.type();
+
+        GetVariableTraverser traverser(mSymbolTable);
+        traverser.traverse(fieldType, fullFieldName, &amp;interfaceBlock.fields);
+
+        interfaceBlock.fields.back().isRowMajorLayout = (fieldType.getLayoutQualifier().matrixPacking == EmpRowMajor);
+    }
+
+    infoList-&gt;push_back(interfaceBlock);
+}
+
+template &lt;typename VarT&gt;
+void CollectVariables::visitVariable(const TIntermSymbol *variable,
+                                     std::vector&lt;VarT&gt; *infoList) const
+{
+    NameHashingTraverser traverser(mHashFunction, mSymbolTable);
+    traverser.traverse(variable-&gt;getType(), variable-&gt;getSymbol(), infoList);
+}
+
+template &lt;typename VarT&gt;
+void CollectVariables::visitInfoList(const TIntermSequence &amp;sequence,
+                                     std::vector&lt;VarT&gt; *infoList) const
+{
+    for (size_t seqIndex = 0; seqIndex &lt; sequence.size(); seqIndex++)
+    {
+        const TIntermSymbol *variable = sequence[seqIndex]-&gt;getAsSymbolNode();
+        // The only case in which the sequence will not contain a
+        // TIntermSymbol node is initialization. It will contain a
+        // TInterBinary node in that case. Since attributes, uniforms,
+        // and varyings cannot be initialized in a shader, we must have
+        // only TIntermSymbol nodes in the sequence.
+        ASSERT(variable != NULL);
+        visitVariable(variable, infoList);
+    }
+}
+
+bool CollectVariables::visitAggregate(Visit, TIntermAggregate *node)
+{
</ins><span class="cx">     bool visitChildren = true;
</span><span class="cx"> 
</span><span class="cx">     switch (node-&gt;getOp())
</span><span class="cx">     {
</span><del>-    case EOpDeclaration: {
-        const TIntermSequence&amp; sequence = node-&gt;getSequence();
-        TQualifier qualifier = sequence.front()-&gt;getAsTyped()-&gt;getQualifier();
-        if (qualifier == EvqAttribute || qualifier == EvqVertexIn || qualifier == EvqUniform ||
-            qualifier == EvqVaryingIn || qualifier == EvqVaryingOut ||
-            qualifier == EvqInvariantVaryingIn || qualifier == EvqInvariantVaryingOut)
</del><ins>+      case EOpDeclaration:
</ins><span class="cx">         {
</span><del>-            TVariableInfoList *infoList = NULL;
</del><ins>+            const TIntermSequence &amp;sequence = *(node-&gt;getSequence());
+            ASSERT(!sequence.empty());
</ins><span class="cx"> 
</span><del>-            switch (qualifier)
</del><ins>+            const TIntermTyped &amp;typedNode = *(sequence.front()-&gt;getAsTyped());
+            TQualifier qualifier = typedNode.getQualifier();
+
+            if (typedNode.getBasicType() == EbtInterfaceBlock)
</ins><span class="cx">             {
</span><del>-              case EvqAttribute:
-              case EvqVertexIn:
-                infoList = &amp;mAttribs;
-                break;
-              case EvqUniform:
-                infoList = &amp;mUniforms;
-                break;
-              default:
-                infoList = &amp;mVaryings;
-                break;
</del><ins>+                visitInfoList(sequence, mInterfaceBlocks);
+                visitChildren = false;
</ins><span class="cx">             }
</span><ins>+            else if (qualifier == EvqAttribute || qualifier == EvqVertexIn ||
+                     qualifier == EvqFragmentOut || qualifier == EvqUniform ||
+                     IsVarying(qualifier))
+            {
+                switch (qualifier)
+                {
+                  case EvqAttribute:
+                  case EvqVertexIn:
+                    visitInfoList(sequence, mAttribs);
+                    break;
+                  case EvqFragmentOut:
+                    visitInfoList(sequence, mOutputVariables);
+                    break;
+                  case EvqUniform:
+                    visitInfoList(sequence, mUniforms);
+                    break;
+                  default:
+                    visitInfoList(sequence, mVaryings);
+                    break;
+                }
</ins><span class="cx"> 
</span><del>-            for (TIntermSequence::const_iterator i = sequence.begin();
-                 i != sequence.end(); ++i)
-            {
-                const TIntermSymbol* variable = (*i)-&gt;getAsSymbolNode();
-                // The only case in which the sequence will not contain a
-                // TIntermSymbol node is initialization. It will contain a
-                // TInterBinary node in that case. Since attributes, uniforms,
-                // and varyings 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-&gt;getSymbol();
-                else
-                    processedSymbol = TIntermTraverser::hash(variable-&gt;getSymbol(), mHashFunction);
-                getVariableInfo(variable-&gt;getType(),
-                                variable-&gt;getSymbol(),
-                                processedSymbol,
-                                *infoList,
-                                mHashFunction);
</del><span class="cx">                 visitChildren = false;
</span><span class="cx">             }
</span><ins>+            break;
</ins><span class="cx">         }
</span><del>-        break;
</del><ins>+      default: break;
</ins><span class="cx">     }
</span><del>-    default: break;
-    }
</del><span class="cx"> 
</span><span class="cx">     return visitChildren;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool CollectVariables::visitBinary(Visit, TIntermBinary *binaryNode)
+{
+    if (binaryNode-&gt;getOp() == EOpIndexDirectInterfaceBlock)
+    {
+        // NOTE: we do not determine static use for individual blocks of an array
+        TIntermTyped *blockNode = binaryNode-&gt;getLeft()-&gt;getAsTyped();
+        ASSERT(blockNode);
+
+        TIntermConstantUnion *constantUnion = binaryNode-&gt;getRight()-&gt;getAsConstantUnion();
+        ASSERT(constantUnion);
+
+        const TInterfaceBlock *interfaceBlock = blockNode-&gt;getType().getInterfaceBlock();
+        InterfaceBlock *namedBlock = FindVariable(interfaceBlock-&gt;name(), mInterfaceBlocks);
+        ASSERT(namedBlock);
+        namedBlock-&gt;staticUse = true;
+
+        unsigned int fieldIndex = constantUnion-&gt;getUConst(0);
+        ASSERT(fieldIndex &lt; namedBlock-&gt;fields.size());
+        namedBlock-&gt;fields[fieldIndex].staticUse = true;
+        return false;
+    }
+
+    return true;
+}
+
+void ExpandUniforms(const std::vector&lt;Uniform&gt; &amp;compact,
+                    std::vector&lt;ShaderVariable&gt; *expanded)
+{
+    for (size_t variableIndex = 0; variableIndex &lt; compact.size(); variableIndex++)
+    {
+        const ShaderVariable &amp;variable = compact[variableIndex];
+        ExpandVariable(variable, variable.name, variable.mappedName, variable.staticUse, expanded);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVariableInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariableInfo.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,48 +4,68 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_VARIABLE_INFO_H_
-#define COMPILER_VARIABLE_INFO_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_VARIABLEINFO_H_
+#define COMPILER_TRANSLATOR_VARIABLEINFO_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &lt;GLSLANG/ShaderLang.h&gt;
</ins><span class="cx"> 
</span><del>-// 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();
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><del>-    TPersistString name;
-    TPersistString mappedName;
-    ShDataType type;
-    int size;
-    bool isArray;
-    TPrecision precision;
-    bool staticUse;
-};
-typedef std::vector&lt;TVariableInfo&gt; TVariableInfoList;
</del><ins>+class TSymbolTable;
</ins><span class="cx"> 
</span><ins>+namespace sh
+{
+
</ins><span class="cx"> // Traverses intermediate tree to collect all attributes, uniforms, varyings.
</span><del>-class CollectVariables : public TIntermTraverser {
-public:
-    CollectVariables(TVariableInfoList&amp; attribs,
-                     TVariableInfoList&amp; uniforms,
-                     TVariableInfoList&amp; varyings,
-                     ShHashFunction64 hashFunction);
</del><ins>+class CollectVariables : public TIntermTraverser
+{
+  public:
+    CollectVariables(std::vector&lt;Attribute&gt; *attribs,
+                     std::vector&lt;Attribute&gt; *outputVariables,
+                     std::vector&lt;Uniform&gt; *uniforms,
+                     std::vector&lt;Varying&gt; *varyings,
+                     std::vector&lt;InterfaceBlock&gt; *interfaceBlocks,
+                     ShHashFunction64 hashFunction,
+                     const TSymbolTable &amp;symbolTable);
</ins><span class="cx"> 
</span><del>-    virtual void visitSymbol(TIntermSymbol*);
-    virtual bool visitAggregate(Visit, TIntermAggregate*);
</del><ins>+    virtual void visitSymbol(TIntermSymbol *symbol);
+    virtual bool visitAggregate(Visit, TIntermAggregate *node);
+    virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
</ins><span class="cx"> 
</span><del>-private:
-    TVariableInfoList&amp; mAttribs;
-    TVariableInfoList&amp; mUniforms;
-    TVariableInfoList&amp; mVaryings;
</del><ins>+  private:
+    template &lt;typename VarT&gt;
+    void visitVariable(const TIntermSymbol *variable, std::vector&lt;VarT&gt; *infoList) const;
</ins><span class="cx"> 
</span><ins>+    template &lt;typename VarT&gt;
+    void visitInfoList(const TIntermSequence &amp;sequence, std::vector&lt;VarT&gt; *infoList) const;
+
+    std::vector&lt;Attribute&gt; *mAttribs;
+    std::vector&lt;Attribute&gt; *mOutputVariables;
+    std::vector&lt;Uniform&gt; *mUniforms;
+    std::vector&lt;Varying&gt; *mVaryings;
+    std::vector&lt;InterfaceBlock&gt; *mInterfaceBlocks;
+
+    std::map&lt;std::string, InterfaceBlockField *&gt; mInterfaceBlockFields;
+
+    bool mDepthRangeAdded;
</ins><span class="cx">     bool mPointCoordAdded;
</span><span class="cx">     bool mFrontFacingAdded;
</span><span class="cx">     bool mFragCoordAdded;
</span><span class="cx"> 
</span><ins>+    bool mInstanceIDAdded;
+    bool mPositionAdded;
+    bool mPointSizeAdded;
+    bool mLastFragDataAdded;
+
</ins><span class="cx">     ShHashFunction64 mHashFunction;
</span><ins>+
+    const TSymbolTable &amp;mSymbolTable;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_VARIABLE_INFO_H_
</del><ins>+// Expand struct uniforms to flattened lists of split variables
+void ExpandUniforms(const std::vector&lt;Uniform&gt; &amp;compact,
+                    std::vector&lt;ShaderVariable&gt; *expanded);
+
+}
+
+#endif  // COMPILER_TRANSLATOR_VARIABLEINFO_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVariablePackercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -3,140 +3,81 @@
</span><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><del>-#include &quot;compiler/translator/VariablePacker.h&quot;
</del><span class="cx"> 
</span><span class="cx"> #include &lt;algorithm&gt;
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
</del><span class="cx"> 
</span><del>-namespace {
-int GetSortOrder(ShDataType type)
-{
-    switch (type) {
-        case SH_FLOAT_MAT4:
-        case SH_FLOAT_MAT2x4:
-        case SH_FLOAT_MAT3x4:
-        case SH_FLOAT_MAT4x2:
-        case SH_FLOAT_MAT4x3:
-            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:
-        case SH_FLOAT_MAT2x3:
-        case SH_FLOAT_MAT3x2:
-            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
</del><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> 
</span><del>-int VariablePacker::GetNumComponentsPerRow(ShDataType type)
</del><ins>+#include &quot;compiler/translator/VariablePacker.h&quot;
+#include &quot;common/utilities.h&quot;
+
+int VariablePacker::GetNumComponentsPerRow(sh::GLenum type)
</ins><span class="cx"> {
</span><del>-    switch (type) {
-        case SH_FLOAT_MAT4:
-        case SH_FLOAT_MAT2:
-        case SH_FLOAT_MAT2x4:
-        case SH_FLOAT_MAT3x4:
-        case SH_FLOAT_MAT4x2:
-        case SH_FLOAT_MAT4x3:
-        case SH_FLOAT_VEC4:
-        case SH_INT_VEC4:
-        case SH_BOOL_VEC4:
-            return 4;
-        case SH_FLOAT_MAT3:
-        case SH_FLOAT_MAT2x3:
-        case SH_FLOAT_MAT3x2:
-        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;
</del><ins>+    switch (type)
+    {
+      case GL_FLOAT_MAT4:
+      case GL_FLOAT_MAT2:
+      case GL_FLOAT_MAT2x4:
+      case GL_FLOAT_MAT3x4:
+      case GL_FLOAT_MAT4x2:
+      case GL_FLOAT_MAT4x3:
+      case GL_FLOAT_VEC4:
+      case GL_INT_VEC4:
+      case GL_BOOL_VEC4:
+      case GL_UNSIGNED_INT_VEC4:
+        return 4;
+      case GL_FLOAT_MAT3:
+      case GL_FLOAT_MAT2x3:
+      case GL_FLOAT_MAT3x2:
+      case GL_FLOAT_VEC3:
+      case GL_INT_VEC3:
+      case GL_BOOL_VEC3:
+      case GL_UNSIGNED_INT_VEC3:
+        return 3;
+      case GL_FLOAT_VEC2:
+      case GL_INT_VEC2:
+      case GL_BOOL_VEC2:
+      case GL_UNSIGNED_INT_VEC2:
+        return 2;
+      default:
+        ASSERT(gl::VariableComponentCount(type) == 1);
+        return 1;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int VariablePacker::GetNumRows(ShDataType type)
</del><ins>+int VariablePacker::GetNumRows(sh::GLenum type)
</ins><span class="cx"> {
</span><del>-    switch (type) {
-        case SH_FLOAT_MAT4:
-        case SH_FLOAT_MAT2x4:
-        case SH_FLOAT_MAT3x4:
-        case SH_FLOAT_MAT4x3:
-        case SH_FLOAT_MAT4x2:
-            return 4;
-        case SH_FLOAT_MAT3:
-        case SH_FLOAT_MAT2x3:
-        case SH_FLOAT_MAT3x2:
-            return 3;
-        case SH_FLOAT_MAT2:
-            return 2;
-        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;
</del><ins>+    switch (type)
+    {
+      case GL_FLOAT_MAT4:
+      case GL_FLOAT_MAT2x4:
+      case GL_FLOAT_MAT3x4:
+      case GL_FLOAT_MAT4x3:
+      case GL_FLOAT_MAT4x2:
+        return 4;
+      case GL_FLOAT_MAT3:
+      case GL_FLOAT_MAT2x3:
+      case GL_FLOAT_MAT3x2:
+        return 3;
+      case GL_FLOAT_MAT2:
+        return 2;
+      default:
+        ASSERT(gl::VariableRowCount(type) == 1);
+        return 1;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-struct TVariableInfoComparer {
-    bool operator()(const TVariableInfo&amp; lhs, const TVariableInfo&amp; rhs) const
</del><ins>+struct TVariableInfoComparer
+{
+    bool operator()(const sh::ShaderVariable &amp;lhs, const sh::ShaderVariable &amp;rhs) const
</ins><span class="cx">     {
</span><del>-        int lhsSortOrder = GetSortOrder(lhs.type);
-        int rhsSortOrder = GetSortOrder(rhs.type);
</del><ins>+        int lhsSortOrder = gl::VariableSortOrder(lhs.type);
+        int rhsSortOrder = gl::VariableSortOrder(rhs.type);
</ins><span class="cx">         if (lhsSortOrder != rhsSortOrder) {
</span><span class="cx">             return lhsSortOrder &lt; rhsSortOrder;
</span><span class="cx">         }
</span><span class="cx">         // Sort by largest first.
</span><del>-        return lhs.size &gt; rhs.size;
</del><ins>+        return lhs.arraySize &gt; rhs.arraySize;
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -207,18 +148,20 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool VariablePacker::CheckVariablesWithinPackingLimits(int maxVectors, const TVariableInfoList&amp; in_variables)
</del><ins>+template &lt;typename VarT&gt;
+bool VariablePacker::CheckVariablesWithinPackingLimits(unsigned int maxVectors,
+                                                       const std::vector&lt;VarT&gt; &amp;in_variables)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(maxVectors &gt; 0);
</span><span class="cx">     maxRows_ = maxVectors;
</span><span class="cx">     topNonFullRow_ = 0;
</span><span class="cx">     bottomNonFullRow_ = maxRows_ - 1;
</span><del>-    TVariableInfoList variables(in_variables);
</del><ins>+    std::vector&lt;VarT&gt; variables(in_variables);
</ins><span class="cx"> 
</span><span class="cx">     // Check whether each variable fits in the available vectors.
</span><span class="cx">     for (size_t i = 0; i &lt; variables.size(); i++) {
</span><del>-        const TVariableInfo&amp; variable = variables[i];
-        if (variable.size &gt; maxVectors / GetNumRows(variable.type)) {
</del><ins>+        const sh::ShaderVariable &amp;variable = variables[i];
+        if (variable.elementCount() &gt; maxVectors / GetNumRows(variable.type)) {
</ins><span class="cx">             return false;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -232,11 +175,11 @@
</span><span class="cx">     // Packs the 4 column variables.
</span><span class="cx">     size_t ii = 0;
</span><span class="cx">     for (; ii &lt; variables.size(); ++ii) {
</span><del>-        const TVariableInfo&amp; variable = variables[ii];
</del><ins>+        const sh::ShaderVariable &amp;variable = variables[ii];
</ins><span class="cx">         if (GetNumComponentsPerRow(variable.type) != 4) {
</span><span class="cx">             break;
</span><span class="cx">         }
</span><del>-        topNonFullRow_ += GetNumRows(variable.type) * variable.size;
</del><ins>+        topNonFullRow_ += GetNumRows(variable.type) * variable.elementCount();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (topNonFullRow_ &gt; maxRows_) {
</span><span class="lines">@@ -246,11 +189,11 @@
</span><span class="cx">     // Packs the 3 column variables.
</span><span class="cx">     int num3ColumnRows = 0;
</span><span class="cx">     for (; ii &lt; variables.size(); ++ii) {
</span><del>-        const TVariableInfo&amp; variable = variables[ii];
</del><ins>+        const sh::ShaderVariable &amp;variable = variables[ii];
</ins><span class="cx">         if (GetNumComponentsPerRow(variable.type) != 3) {
</span><span class="cx">             break;
</span><span class="cx">         }
</span><del>-        num3ColumnRows += GetNumRows(variable.type) * variable.size;
</del><ins>+        num3ColumnRows += GetNumRows(variable.type) * variable.elementCount();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (topNonFullRow_ + num3ColumnRows &gt; maxRows_) {
</span><span class="lines">@@ -265,11 +208,11 @@
</span><span class="cx">     int rowsAvailableInColumns01 = twoColumnRowsAvailable;
</span><span class="cx">     int rowsAvailableInColumns23 = twoColumnRowsAvailable;
</span><span class="cx">     for (; ii &lt; variables.size(); ++ii) {
</span><del>-        const TVariableInfo&amp; variable = variables[ii];
</del><ins>+        const sh::ShaderVariable &amp;variable = variables[ii];
</ins><span class="cx">         if (GetNumComponentsPerRow(variable.type) != 2) {
</span><span class="cx">             break;
</span><span class="cx">         }
</span><del>-        int numRows = GetNumRows(variable.type) * variable.size;
</del><ins>+        int numRows = GetNumRows(variable.type) * variable.elementCount();
</ins><span class="cx">         if (numRows &lt;= rowsAvailableInColumns01) {
</span><span class="cx">             rowsAvailableInColumns01 -= numRows;
</span><span class="cx">         } else if (numRows &lt;= rowsAvailableInColumns23) {
</span><span class="lines">@@ -289,9 +232,9 @@
</span><span class="cx"> 
</span><span class="cx">     // Packs the 1 column variables.
</span><span class="cx">     for (; ii &lt; variables.size(); ++ii) {
</span><del>-        const TVariableInfo&amp; variable = variables[ii];
</del><ins>+        const sh::ShaderVariable &amp;variable = variables[ii];
</ins><span class="cx">         ASSERT(1 == GetNumComponentsPerRow(variable.type));
</span><del>-        int numRows = GetNumRows(variable.type) * variable.size;
</del><ins>+        int numRows = GetNumRows(variable.type) * variable.elementCount();
</ins><span class="cx">         int smallestColumn = -1;
</span><span class="cx">         int smallestSize = maxRows_ + 1;
</span><span class="cx">         int topRow = -1;
</span><span class="lines">@@ -319,5 +262,8 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-
</del><ins>+// Instantiate all possible variable packings
+template bool VariablePacker::CheckVariablesWithinPackingLimits(unsigned int, const std::vector&lt;sh::ShaderVariable&gt; &amp;);
+template bool VariablePacker::CheckVariablesWithinPackingLimits(unsigned int, const std::vector&lt;sh::Attribute&gt; &amp;);
+template bool VariablePacker::CheckVariablesWithinPackingLimits(unsigned int, const std::vector&lt;sh::Uniform&gt; &amp;);
+template bool VariablePacker::CheckVariablesWithinPackingLimits(unsigned int, const std::vector&lt;sh::Varying&gt; &amp;);
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVariablePackerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VariablePacker.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,27 +4,27 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef _VARIABLEPACKER_INCLUDED_
-#define _VARIABLEPACKER_INCLUDED_
</del><ins>+#ifndef COMPILER_TRANSLATOR_VARIABLEPACKER_H_
+#define COMPILER_TRANSLATOR_VARIABLEPACKER_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;vector&gt;
</span><del>-#include &quot;compiler/translator/ShHandle.h&quot;
</del><ins>+#include &quot;compiler/translator/VariableInfo.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> class VariablePacker {
</span><span class="cx">  public:
</span><span class="cx">     // Returns true if the passed in variables pack in maxVectors following
</span><span class="cx">     // the packing rules from the GLSL 1.017 spec, Appendix A, section 7.
</span><del>-    bool CheckVariablesWithinPackingLimits(
-        int maxVectors,
-        const TVariableInfoList&amp; in_variables);
</del><ins>+    template &lt;typename VarT&gt;
+    bool CheckVariablesWithinPackingLimits(unsigned int maxVectors,
+                                           const std::vector&lt;VarT&gt; &amp;in_variables);
</ins><span class="cx"> 
</span><span class="cx">     // Gets how many components in a row a data type takes.
</span><del>-    static int GetNumComponentsPerRow(ShDataType type);
</del><ins>+    static int GetNumComponentsPerRow(sh::GLenum type);
</ins><span class="cx"> 
</span><span class="cx">     // Gets how many rows a data type takes.
</span><del>-    static int GetNumRows(ShDataType type);
</del><ins>+    static int GetNumRows(sh::GLenum type);
</ins><span class="cx"> 
</span><del>- private:
</del><ins>+  private:
</ins><span class="cx">     static const int kNumColumns = 4;
</span><span class="cx">     static const unsigned kColumnMask = (1 &lt;&lt; kNumColumns) - 1;
</span><span class="cx"> 
</span><span class="lines">@@ -38,4 +38,4 @@
</span><span class="cx">     std::vector&lt;unsigned&gt; rows_;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // _VARIABLEPACKER_INCLUDED_
</del><ins>+#endif // COMPILER_TRANSLATOR_VARIABLEPACKER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVersionGLSLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -8,6 +8,9 @@
</span><span class="cx"> 
</span><span class="cx"> static const int GLSL_VERSION_110 = 110;
</span><span class="cx"> static const int GLSL_VERSION_120 = 120;
</span><ins>+static const int GLSL_VERSION_130 = 130;
+static const int GLSL_VERSION_410 = 410;
+static const int GLSL_VERSION_420 = 420;
</ins><span class="cx"> 
</span><span class="cx"> // We need to scan for the following:
</span><span class="cx"> // 1. &quot;invariant&quot; keyword: This can occur in both - vertex and fragment shaders
</span><span class="lines">@@ -26,113 +29,105 @@
</span><span class="cx"> //    GLSL 1.2 relaxed the restriction on arrays, section 5.8: &quot;Variables that
</span><span class="cx"> //    are built-in types, entire structures or arrays... are all l-values.&quot;
</span><span class="cx"> //
</span><del>-// TODO(alokp): The following two cases of invariant decalaration get lost
-// during parsing - they do not get carried over to the intermediate tree.
-// Handle these cases:
-// 1. When a pragma is used to force all output variables to be invariant:
-//    - #pragma STDGL invariant(all)
-// 2. When a previously decalared or built-in variable is marked invariant:
-//    - invariant gl_Position;
-//    - varying vec3 color; invariant color;
-//
-TVersionGLSL::TVersionGLSL(ShShaderType type)
-    : mShaderType(type),
-      mVersion(GLSL_VERSION_110)
</del><ins>+TVersionGLSL::TVersionGLSL(sh::GLenum type,
+                           const TPragma &amp;pragma,
+                           ShShaderOutput output)
</ins><span class="cx"> {
</span><ins>+    if (output == SH_GLSL_130_OUTPUT)
+    {
+        mVersion = GLSL_VERSION_130;
+    }
+    else if (output == SH_GLSL_410_CORE_OUTPUT)
+    {
+        mVersion = GLSL_VERSION_410;
+    }
+    else if (output == SH_GLSL_420_CORE_OUTPUT)
+    {
+        mVersion = GLSL_VERSION_420;
+    }
+    else
+    {
+      ASSERT(output == SH_GLSL_COMPATIBILITY_OUTPUT);
+      if (pragma.stdgl.invariantAll)
+          mVersion = GLSL_VERSION_120;
+      else
+          mVersion = GLSL_VERSION_110;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TVersionGLSL::visitSymbol(TIntermSymbol* node)
</del><ins>+void TVersionGLSL::visitSymbol(TIntermSymbol *node)
</ins><span class="cx"> {
</span><span class="cx">     if (node-&gt;getSymbol() == &quot;gl_PointCoord&quot;)
</span><span class="cx">         updateVersion(GLSL_VERSION_120);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TVersionGLSL::visitConstantUnion(TIntermConstantUnion*)
</del><ins>+bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node)
</ins><span class="cx"> {
</span><del>-}
-
-bool TVersionGLSL::visitBinary(Visit, TIntermBinary*)
-{
-    return true;
-}
-
-bool TVersionGLSL::visitUnary(Visit, TIntermUnary*)
-{
-    return true;
-}
-
-bool TVersionGLSL::visitSelection(Visit, TIntermSelection*)
-{
-    return true;
-}
-
-bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate* node)
-{
</del><span class="cx">     bool visitChildren = true;
</span><span class="cx"> 
</span><del>-    switch (node-&gt;getOp()) {
</del><ins>+    switch (node-&gt;getOp())
+    {
</ins><span class="cx">       case EOpSequence:
</span><span class="cx">         // We need to visit sequence children to get to global or inner scope.
</span><span class="cx">         visitChildren = true;
</span><span class="cx">         break;
</span><del>-      case EOpDeclaration: {
-        const TIntermSequence&amp; sequence = node-&gt;getSequence();
-        TQualifier qualifier = sequence.front()-&gt;getAsTyped()-&gt;getQualifier();
-        if ((qualifier == EvqInvariantVaryingIn) ||
-            (qualifier == EvqInvariantVaryingOut)) {
-            updateVersion(GLSL_VERSION_120);
</del><ins>+      case EOpDeclaration:
+        {
+            const TIntermSequence &amp;sequence = *(node-&gt;getSequence());
+            TQualifier qualifier = sequence.front()-&gt;getAsTyped()-&gt;getQualifier();
+            if ((qualifier == EvqInvariantVaryingIn) ||
+                (qualifier == EvqInvariantVaryingOut))
+            {
+                updateVersion(GLSL_VERSION_120);
+            }
+            break;
</ins><span class="cx">         }
</span><ins>+      case EOpInvariantDeclaration:
+        updateVersion(GLSL_VERSION_120);
</ins><span class="cx">         break;
</span><del>-      }
-      case EOpParameters: {
-        const TIntermSequence&amp; params = node-&gt;getSequence();
-        for (TIntermSequence::const_iterator iter = params.begin();
-             iter != params.end(); ++iter)
</del><ins>+      case EOpParameters:
</ins><span class="cx">         {
</span><del>-            const TIntermTyped* param = (*iter)-&gt;getAsTyped();
-            if (param-&gt;isArray())
</del><ins>+            const TIntermSequence &amp;params = *(node-&gt;getSequence());
+            for (TIntermSequence::const_iterator iter = params.begin();
+                 iter != params.end(); ++iter)
</ins><span class="cx">             {
</span><del>-                TQualifier qualifier = param-&gt;getQualifier();
-                if ((qualifier == EvqOut) || (qualifier ==  EvqInOut))
</del><ins>+                const TIntermTyped *param = (*iter)-&gt;getAsTyped();
+                if (param-&gt;isArray())
</ins><span class="cx">                 {
</span><del>-                    updateVersion(GLSL_VERSION_120);
-                    break;
</del><ins>+                    TQualifier qualifier = param-&gt;getQualifier();
+                    if ((qualifier == EvqOut) || (qualifier ==  EvqInOut))
+                    {
+                        updateVersion(GLSL_VERSION_120);
+                        break;
+                    }
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><ins>+            // Fully processed. No need to visit children.
+            visitChildren = false;
+            break;
</ins><span class="cx">         }
</span><del>-        // Fully processed. No need to visit children.
-        visitChildren = false;
-        break;
-      }
</del><span class="cx">       case EOpConstructMat2:
</span><span class="cx">       case EOpConstructMat3:
</span><del>-      case EOpConstructMat4: {
-        const TIntermSequence&amp; sequence = node-&gt;getSequence();
-        if (sequence.size() == 1) {
-          TIntermTyped* typed = sequence.front()-&gt;getAsTyped();
-          if (typed &amp;&amp; typed-&gt;isMatrix()) {
-            updateVersion(GLSL_VERSION_120);
-          }
</del><ins>+      case EOpConstructMat4:
+        {
+            const TIntermSequence &amp;sequence = *(node-&gt;getSequence());
+            if (sequence.size() == 1)
+            {
+                TIntermTyped *typed = sequence.front()-&gt;getAsTyped();
+                if (typed &amp;&amp; typed-&gt;isMatrix())
+                {
+                    updateVersion(GLSL_VERSION_120);
+                }
+            }
+            break;
</ins><span class="cx">         }
</span><ins>+      default:
</ins><span class="cx">         break;
</span><del>-      }
-
-      default: break;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return visitChildren;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TVersionGLSL::visitLoop(Visit, TIntermLoop*)
-{
-    return true;
-}
-
-bool TVersionGLSL::visitBranch(Visit, TIntermBranch*)
-{
-    return true;
-}
-
</del><span class="cx"> void TVersionGLSL::updateVersion(int version)
</span><span class="cx"> {
</span><span class="cx">     mVersion = std::max(version, mVersion);
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorVersionGLSLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/VersionGLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,11 +4,13 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_VERSIONGLSL_H_
-#define COMPILER_VERSIONGLSL_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_VERSIONGLSL_H_
+#define COMPILER_TRANSLATOR_VERSIONGLSL_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><ins>+#include &quot;compiler/translator/Pragma.h&quot;
+
</ins><span class="cx"> // Traverses the intermediate tree to return the minimum GLSL version
</span><span class="cx"> // required to legally access all built-in features used in the shader.
</span><span class="cx"> // GLSL 1.1 which is mandated by OpenGL 2.0 provides:
</span><span class="lines">@@ -24,33 +26,29 @@
</span><span class="cx"> //   - array as &quot;out&quot; function parameters
</span><span class="cx"> //
</span><span class="cx"> // TODO: ES3 equivalent versions of GLSL
</span><del>-class TVersionGLSL : public TIntermTraverser {
-public:
-    TVersionGLSL(ShShaderType type);
</del><ins>+class TVersionGLSL : public TIntermTraverser
+{
+  public:
+    TVersionGLSL(sh::GLenum type, const TPragma &amp;pragma, ShShaderOutput output);
</ins><span class="cx"> 
</span><del>-    // Returns 120 if the following is used the shader:
-    // - &quot;invariant&quot;,
-    // - &quot;gl_PointCoord&quot;,
-    // - matrix/matrix constructors
-    // - array &quot;out&quot; parameters
-    // Else 110 is returned.
</del><ins>+    // If output is core profile, returns 150.
+    // If output is legacy profile,
+    //   Returns 120 if the following is used the shader:
+    //   - &quot;invariant&quot;,
+    //   - &quot;gl_PointCoord&quot;,
+    //   - matrix/matrix constructors
+    //   - array &quot;out&quot; parameters
+    //   Else 110 is returned.
</ins><span class="cx">     int getVersion() { return mVersion; }
</span><span class="cx"> 
</span><del>-    virtual void visitSymbol(TIntermSymbol*);
-    virtual void visitConstantUnion(TIntermConstantUnion*);
-    virtual bool visitBinary(Visit, TIntermBinary*);
-    virtual bool visitUnary(Visit, TIntermUnary*);
-    virtual bool visitSelection(Visit, TIntermSelection*);
-    virtual bool visitAggregate(Visit, TIntermAggregate*);
-    virtual bool visitLoop(Visit, TIntermLoop*);
-    virtual bool visitBranch(Visit, TIntermBranch*);
</del><ins>+    virtual void visitSymbol(TIntermSymbol *);
+    virtual bool visitAggregate(Visit, TIntermAggregate *);
</ins><span class="cx"> 
</span><del>-protected:
</del><ins>+  protected:
</ins><span class="cx">     void updateVersion(int version);
</span><span class="cx"> 
</span><del>-private:
-    ShShaderType mShaderType;
</del><ins>+  private:
</ins><span class="cx">     int mVersion;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_VERSIONGLSL_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_VERSIONGLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayoutcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,123 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+// blocklayout.cpp:
+//   Implementation for block layout classes and methods.
+//
+
+#include &quot;compiler/translator/blocklayout.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace sh
+{
+
+BlockLayoutEncoder::BlockLayoutEncoder()
+    : mCurrentOffset(0)
+{
+}
+
+BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
+{
+    int arrayStride;
+    int matrixStride;
+
+    getBlockLayoutInfo(type, arraySize, isRowMajorMatrix, &amp;arrayStride, &amp;matrixStride);
+
+    const BlockMemberInfo memberInfo(static_cast&lt;int&gt;(mCurrentOffset * BytesPerComponent), arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
+
+    advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);
+
+    return memberInfo;
+}
+
+// static
+size_t BlockLayoutEncoder::getBlockRegister(const BlockMemberInfo &amp;info)
+{
+    return (info.offset / BytesPerComponent) / ComponentsPerRegister;
+}
+
+// static
+size_t BlockLayoutEncoder::getBlockRegisterElement(const BlockMemberInfo &amp;info)
+{
+    return (info.offset / BytesPerComponent) % ComponentsPerRegister;
+}
+
+void BlockLayoutEncoder::nextRegister()
+{
+    mCurrentOffset = rx::roundUp&lt;size_t&gt;(mCurrentOffset, ComponentsPerRegister);
+}
+
+Std140BlockEncoder::Std140BlockEncoder()
+{
+}
+
+void Std140BlockEncoder::enterAggregateType()
+{
+    nextRegister();
+}
+
+void Std140BlockEncoder::exitAggregateType()
+{
+    nextRegister();
+}
+
+void Std140BlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
+{
+    // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
+    ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == BytesPerComponent);
+
+    size_t baseAlignment = 0;
+    int matrixStride = 0;
+    int arrayStride = 0;
+
+    if (gl::IsMatrixType(type))
+    {
+        baseAlignment = ComponentsPerRegister;
+        matrixStride = ComponentsPerRegister;
+
+        if (arraySize &gt; 0)
+        {
+            const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+            arrayStride = ComponentsPerRegister * numRegisters;
+        }
+    }
+    else if (arraySize &gt; 0)
+    {
+        baseAlignment = ComponentsPerRegister;
+        arrayStride = ComponentsPerRegister;
+    }
+    else
+    {
+        const int numComponents = gl::VariableComponentCount(type);
+        baseAlignment = (numComponents == 3 ? 4u : static_cast&lt;size_t&gt;(numComponents));
+    }
+
+    mCurrentOffset = rx::roundUp(mCurrentOffset, baseAlignment);
+
+    *matrixStrideOut = matrixStride;
+    *arrayStrideOut = arrayStride;
+}
+
+void Std140BlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
+{
+    if (arraySize &gt; 0)
+    {
+        mCurrentOffset += arrayStride * arraySize;
+    }
+    else if (gl::IsMatrixType(type))
+    {
+        ASSERT(matrixStride == ComponentsPerRegister);
+        const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+        mCurrentOffset += ComponentsPerRegister * numRegisters;
+    }
+    else
+    {
+        mCurrentOffset += gl::VariableComponentCount(type);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayouth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayout.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+// blocklayout.h:
+//   Methods and classes related to uniform layout and packing in GLSL and HLSL.
+//
+
+#ifndef COMMON_BLOCKLAYOUT_H_
+#define COMMON_BLOCKLAYOUT_H_
+
+#include &lt;cstddef&gt;
+#include &lt;vector&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &lt;GLSLANG/ShaderLang.h&gt;
+
+namespace sh
+{
+struct ShaderVariable;
+struct InterfaceBlockField;
+struct Uniform;
+struct Varying;
+struct InterfaceBlock;
+
+struct COMPILER_EXPORT BlockMemberInfo
+{
+    BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
+        : offset(offset),
+          arrayStride(arrayStride),
+          matrixStride(matrixStride),
+          isRowMajorMatrix(isRowMajorMatrix)
+    {}
+
+    static BlockMemberInfo getDefaultBlockInfo()
+    {
+        return BlockMemberInfo(-1, -1, -1, false);
+    }
+
+    int offset;
+    int arrayStride;
+    int matrixStride;
+    bool isRowMajorMatrix;
+};
+
+class COMPILER_EXPORT BlockLayoutEncoder
+{
+  public:
+    BlockLayoutEncoder();
+
+    BlockMemberInfo encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
+
+    size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
+    size_t getCurrentRegister() const { return mCurrentOffset / ComponentsPerRegister; }
+    size_t getCurrentElement() const { return mCurrentOffset % ComponentsPerRegister; }
+
+    virtual void enterAggregateType() = 0;
+    virtual void exitAggregateType() = 0;
+
+    static const size_t BytesPerComponent = 4u;
+    static const unsigned int ComponentsPerRegister = 4u;
+
+    static size_t getBlockRegister(const BlockMemberInfo &amp;info);
+    static size_t getBlockRegisterElement(const BlockMemberInfo &amp;info);
+
+  protected:
+    size_t mCurrentOffset;
+
+    void nextRegister();
+
+    virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut) = 0;
+    virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride) = 0;
+};
+
+// Block layout according to the std140 block layout
+// See &quot;Standard Uniform Block Layout&quot; in Section 2.11.6 of the OpenGL ES 3.0 specification
+
+class COMPILER_EXPORT Std140BlockEncoder : public BlockLayoutEncoder
+{
+  public:
+    Std140BlockEncoder();
+
+    virtual void enterAggregateType();
+    virtual void exitAggregateType();
+
+  protected:
+    virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
+    virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
+};
+
+}
+
+#endif // COMMON_BLOCKLAYOUT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayoutHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,165 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+// blocklayout.cpp:
+//   Implementation for block layout classes and methods.
+//
+
+#include &quot;compiler/translator/blocklayoutHLSL.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace sh
+{
+
+HLSLBlockEncoder::HLSLBlockEncoder(HLSLBlockEncoderStrategy strategy)
+    : mEncoderStrategy(strategy),
+      mTransposeMatrices(false)
+{
+}
+
+void HLSLBlockEncoder::enterAggregateType()
+{
+    nextRegister();
+}
+
+void HLSLBlockEncoder::exitAggregateType()
+{
+}
+
+void HLSLBlockEncoder::getBlockLayoutInfo(GLenum typeIn, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
+{
+    GLenum type = (mTransposeMatrices ? gl::TransposeMatrixType(typeIn) : typeIn);
+
+    // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
+    ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == BytesPerComponent);
+
+    int matrixStride = 0;
+    int arrayStride = 0;
+
+    // if variables are not to be packed, or we're about to
+    // pack a matrix or array, skip to the start of the next
+    // register
+    if (!isPacked() ||
+        gl::IsMatrixType(type) ||
+        arraySize &gt; 0)
+    {
+        nextRegister();
+    }
+
+    if (gl::IsMatrixType(type))
+    {
+        matrixStride = ComponentsPerRegister;
+
+        if (arraySize &gt; 0)
+        {
+            const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+            arrayStride = ComponentsPerRegister * numRegisters;
+        }
+    }
+    else if (arraySize &gt; 0)
+    {
+        arrayStride = ComponentsPerRegister;
+    }
+    else if (isPacked())
+    {
+        int numComponents = gl::VariableComponentCount(type);
+        if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) &gt; ComponentsPerRegister)
+        {
+            nextRegister();
+        }
+    }
+
+    *matrixStrideOut = matrixStride;
+    *arrayStrideOut = arrayStride;
+}
+
+void HLSLBlockEncoder::advanceOffset(GLenum typeIn, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
+{
+    GLenum type = (mTransposeMatrices ? gl::TransposeMatrixType(typeIn) : typeIn);
+
+    if (arraySize &gt; 0)
+    {
+        mCurrentOffset += arrayStride * (arraySize - 1);
+    }
+
+    if (gl::IsMatrixType(type))
+    {
+        ASSERT(matrixStride == ComponentsPerRegister);
+        const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
+        const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
+        mCurrentOffset += ComponentsPerRegister * (numRegisters - 1);
+        mCurrentOffset += numComponents;
+    }
+    else if (isPacked())
+    {
+        mCurrentOffset += gl::VariableComponentCount(type);
+    }
+    else
+    {
+        mCurrentOffset += ComponentsPerRegister;
+    }
+}
+
+void HLSLBlockEncoder::skipRegisters(unsigned int numRegisters)
+{
+    mCurrentOffset += (numRegisters * ComponentsPerRegister);
+}
+
+HLSLBlockEncoder::HLSLBlockEncoderStrategy HLSLBlockEncoder::GetStrategyFor(ShShaderOutput outputType)
+{
+    switch (outputType)
+    {
+      case SH_HLSL9_OUTPUT: return ENCODE_LOOSE;
+      case SH_HLSL11_OUTPUT: return ENCODE_PACKED;
+      default: UNREACHABLE(); return ENCODE_PACKED;
+    }
+}
+
+template &lt;class ShaderVarType&gt;
+void HLSLVariableRegisterCount(const ShaderVarType &amp;variable, HLSLBlockEncoder *encoder)
+{
+    if (variable.isStruct())
+    {
+        for (size_t arrayElement = 0; arrayElement &lt; variable.elementCount(); arrayElement++)
+        {
+            encoder-&gt;enterAggregateType();
+
+            for (size_t fieldIndex = 0; fieldIndex &lt; variable.fields.size(); fieldIndex++)
+            {
+                HLSLVariableRegisterCount(variable.fields[fieldIndex], encoder);
+            }
+
+            encoder-&gt;exitAggregateType();
+        }
+    }
+    else
+    {
+        // We operate only on varyings and uniforms, which do not have matrix layout qualifiers
+        encoder-&gt;encodeType(variable.type, variable.arraySize, false);
+    }
+}
+
+unsigned int HLSLVariableRegisterCount(const Varying &amp;variable, bool transposeMatrices)
+{
+    HLSLBlockEncoder encoder(HLSLBlockEncoder::ENCODE_PACKED);
+    encoder.setTransposeMatrices(transposeMatrices);
+    HLSLVariableRegisterCount(variable, &amp;encoder);
+
+    const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
+    return static_cast&lt;unsigned int&gt;(rx::roundUp&lt;size_t&gt;(encoder.getBlockSize(), registerBytes) / registerBytes);
+}
+
+unsigned int HLSLVariableRegisterCount(const Uniform &amp;variable, ShShaderOutput outputType)
+{
+    HLSLBlockEncoder encoder(HLSLBlockEncoder::GetStrategyFor(outputType));
+    HLSLVariableRegisterCount(variable, &amp;encoder);
+
+    const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
+    return static_cast&lt;unsigned int&gt;(rx::roundUp&lt;size_t&gt;(encoder.getBlockSize(), registerBytes) / registerBytes);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorblocklayoutHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/blocklayoutHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+// blocklayout.h:
+//   Methods and classes related to uniform layout and packing in GLSL and HLSL.
+//
+
+#ifndef COMMON_BLOCKLAYOUTHLSL_H_
+#define COMMON_BLOCKLAYOUTHLSL_H_
+
+#include &lt;cstddef&gt;
+#include &lt;vector&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &quot;blocklayout.h&quot;
+#include &lt;GLSLANG/ShaderLang.h&gt;
+
+namespace sh
+{
+// Block layout packed according to the D3D9 or default D3D10+ register packing rules
+// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb509632(v=vs.85).aspx
+// The strategy should be ENCODE_LOOSE for D3D9 constant blocks, and ENCODE_PACKED
+// for everything else (D3D10+ constant blocks and all attributes/varyings).
+
+class COMPILER_EXPORT HLSLBlockEncoder : public BlockLayoutEncoder
+{
+  public:
+    enum HLSLBlockEncoderStrategy
+    {
+        ENCODE_PACKED,
+        ENCODE_LOOSE
+    };
+
+    HLSLBlockEncoder(HLSLBlockEncoderStrategy strategy);
+
+    virtual void enterAggregateType();
+    virtual void exitAggregateType();
+    void skipRegisters(unsigned int numRegisters);
+
+    bool isPacked() const { return mEncoderStrategy == ENCODE_PACKED; }
+    void setTransposeMatrices(bool enabled) { mTransposeMatrices = enabled; }
+
+    static HLSLBlockEncoderStrategy GetStrategyFor(ShShaderOutput outputType);
+
+  protected:
+    virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
+    virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
+
+    HLSLBlockEncoderStrategy mEncoderStrategy;
+    bool mTransposeMatrices;
+};
+
+// This method returns the number of used registers for a ShaderVariable. It is dependent on the HLSLBlockEncoder
+// class to count the number of used registers in a struct (which are individually packed according to the same rules).
+COMPILER_EXPORT unsigned int HLSLVariableRegisterCount(const Varying &amp;variable, bool transposeMatrices);
+COMPILER_EXPORT unsigned int HLSLVariableRegisterCount(const Uniform &amp;variable, ShShaderOutput outputType);
+
+}
+
+#endif // COMMON_BLOCKLAYOUTHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorcompilerdebugcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,37 +0,0 @@
</span><del>-//
-// 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.
-//
-
-// debug.cpp: Debugging utilities.
-
-#include &quot;compiler/translator/compilerdebug.h&quot;
-
-#include &lt;stdarg.h&gt;
-#include &lt;stdio.h&gt;
-
-#include &quot;compiler/translator/InitializeParseContext.h&quot;
-#include &quot;compiler/translator/ParseContext.h&quot;
-
-#ifdef TRACE_ENABLED
-static const int kTraceBufferLen = 1024;
-
-extern &quot;C&quot; {
-void Trace(const char *format, ...) {
-    if (!format) return;
-
-    TParseContext* parseContext = GetGlobalParseContext();
-    if (parseContext) {
-        char buf[kTraceBufferLen];
-        va_list args;
-        va_start(args, format);
-        vsnprintf(buf, kTraceBufferLen, format, args);
-        va_end(args);
-
-        parseContext-&gt;trace(buf);
-    }
-}
-}  // extern &quot;C&quot;
-#endif  // TRACE_ENABLED
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorcompilerdebugh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/compilerdebug.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,53 +0,0 @@
</span><del>-//
-// 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.
-//
-
-// debug.h: Debugging utilities.
-
-#ifndef COMPILER_DEBUG_H_
-#define COMPILER_DEBUG_H_
-
-#include &lt;assert.h&gt;
-
-#ifdef _DEBUG
-#define TRACE_ENABLED  // define to enable debug message tracing
-#endif  // _DEBUG
-
-// Outputs text to the debug log
-#ifdef TRACE_ENABLED
-
-#ifdef  __cplusplus
-extern &quot;C&quot; {
-#endif  // __cplusplus
-void Trace(const char* format, ...);
-#ifdef  __cplusplus
-}
-#endif  // __cplusplus
-
-#else   // TRACE_ENABLED
-
-#define Trace(...) ((void)0)
-
-#endif  // TRACE_ENABLED
-
-// A macro asserting a condition and outputting failures to the debug log
-#define ASSERT(expression) do { \
-    if(!(expression)) \
-        Trace(&quot;Assert failed: %s(%d): &quot;#expression&quot;\n&quot;, __FUNCTION__, __LINE__); \
-    assert(expression); \
-} while(0)
-
-#define UNIMPLEMENTED() do { \
-    Trace(&quot;Unimplemented invoked: %s(%d)\n&quot;, __FUNCTION__, __LINE__); \
-    assert(false); \
-} while(0)
-
-#define UNREACHABLE() do { \
-    Trace(&quot;Unreachable reached: %s(%d)\n&quot;, __FUNCTION__, __LINE__); \
-    assert(false); \
-} while(0)
-
-#endif   // COMPILER_DEBUG_H_
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraph.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraph.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraph.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
-#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_H
</del><ins>+#ifndef COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPH_H_
+#define COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPH_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;set&gt;
</span><span class="cx"> #include &lt;stack&gt;
</span><span class="lines">@@ -186,7 +186,7 @@
</span><span class="cx"> //
</span><span class="cx"> // When using this, just fill in the methods for nodes you want visited.
</span><span class="cx"> //
</span><del>-class TDependencyGraphTraverser {
</del><ins>+class TDependencyGraphTraverser : angle::NonCopyable {
</ins><span class="cx"> public:
</span><span class="cx">     TDependencyGraphTraverser() : mDepth(0) {}
</span><span class="cx"> 
</span><span class="lines">@@ -209,4 +209,4 @@
</span><span class="cx">     TGraphNodeSet mVisited;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPH_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -6,24 +6,32 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/depgraph/DependencyGraphBuilder.h&quot;
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::build(TIntermNode* node, TDependencyGraph* graph)
</del><ins>+void TDependencyGraphBuilder::build(TIntermNode *node, TDependencyGraph *graph)
</ins><span class="cx"> {
</span><span class="cx">     TDependencyGraphBuilder builder(graph);
</span><span class="cx">     builder.build(node);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TDependencyGraphBuilder::visitAggregate(Visit visit, TIntermAggregate* intermAggregate)
</del><ins>+bool TDependencyGraphBuilder::visitAggregate(
+    Visit visit, TIntermAggregate *intermAggregate)
</ins><span class="cx"> {
</span><del>-    switch (intermAggregate-&gt;getOp()) {
-        case EOpFunction: visitFunctionDefinition(intermAggregate); break;
-        case EOpFunctionCall: visitFunctionCall(intermAggregate); break;
-        default: visitAggregateChildren(intermAggregate); break;
</del><ins>+    switch (intermAggregate-&gt;getOp())
+    {
+      case EOpFunction:
+        visitFunctionDefinition(intermAggregate);
+        break;
+      case EOpFunctionCall:
+        visitFunctionCall(intermAggregate);
+        break;
+      default:
+        visitAggregateChildren(intermAggregate);
+        break;
</ins><span class="cx">     }
</span><del>-
</del><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::visitFunctionDefinition(TIntermAggregate* intermAggregate)
</del><ins>+void TDependencyGraphBuilder::visitFunctionDefinition(
+    TIntermAggregate *intermAggregate)
</ins><span class="cx"> {
</span><span class="cx">     // Currently, we do not support user defined functions.
</span><span class="cx">     if (intermAggregate-&gt;getName() != &quot;main(&quot;)
</span><span class="lines">@@ -34,64 +42,71 @@
</span><span class="cx"> 
</span><span class="cx"> // Takes an expression like &quot;f(x)&quot; and creates a dependency graph like
</span><span class="cx"> // &quot;x -&gt; argument 0 -&gt; function call&quot;.
</span><del>-void TDependencyGraphBuilder::visitFunctionCall(TIntermAggregate* intermFunctionCall)
</del><ins>+void TDependencyGraphBuilder::visitFunctionCall(
+    TIntermAggregate *intermFunctionCall)
</ins><span class="cx"> {
</span><del>-    TGraphFunctionCall* functionCall = mGraph-&gt;createFunctionCall(intermFunctionCall);
</del><ins>+    TGraphFunctionCall *functionCall =
+        mGraph-&gt;createFunctionCall(intermFunctionCall);
</ins><span class="cx"> 
</span><span class="cx">     // Run through the function call arguments.
</span><span class="cx">     int argumentNumber = 0;
</span><del>-    TIntermSequence&amp; intermArguments = intermFunctionCall-&gt;getSequence();
-    for (TIntermSequence::const_iterator iter = intermArguments.begin();
-         iter != intermArguments.end();
</del><ins>+    TIntermSequence *intermArguments = intermFunctionCall-&gt;getSequence();
+    for (TIntermSequence::const_iterator iter = intermArguments-&gt;begin();
+         iter != intermArguments-&gt;end();
</ins><span class="cx">          ++iter, ++argumentNumber)
</span><span class="cx">     {
</span><span class="cx">         TNodeSetMaintainer nodeSetMaintainer(this);
</span><span class="cx"> 
</span><del>-        TIntermNode* intermArgument = *iter;
</del><ins>+        TIntermNode *intermArgument = *iter;
</ins><span class="cx">         intermArgument-&gt;traverse(this);
</span><span class="cx"> 
</span><del>-        if (TParentNodeSet* argumentNodes = mNodeSets.getTopSet()) {
-            TGraphArgument* argument = mGraph-&gt;createArgument(intermFunctionCall, argumentNumber);
</del><ins>+        if (TParentNodeSet *argumentNodes = mNodeSets.getTopSet())
+        {
+            TGraphArgument *argument = mGraph-&gt;createArgument(
+                intermFunctionCall, argumentNumber);
</ins><span class="cx">             connectMultipleNodesToSingleNode(argumentNodes, argument);
</span><span class="cx">             argument-&gt;addDependentNode(functionCall);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Push the leftmost symbol of this function call into the current set of dependent symbols to
-    // represent the result of this function call.
</del><ins>+    // Push the leftmost symbol of this function call into the current set of
+    // dependent symbols to represent the result of this function call.
</ins><span class="cx">     // Thus, an expression like &quot;y = f(x)&quot; will yield a dependency graph like
</span><span class="cx">     // &quot;x -&gt; argument 0 -&gt; function call -&gt; y&quot;.
</span><del>-    // This line essentially passes the function call node back up to an earlier visitAssignment
-    // call, which will create the connection &quot;function call -&gt; y&quot;.
</del><ins>+    // This line essentially passes the function call node back up to an earlier
+    // visitAssignment call, which will create the connection &quot;function call -&gt; y&quot;.
</ins><span class="cx">     mNodeSets.insertIntoTopSet(functionCall);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::visitAggregateChildren(TIntermAggregate* intermAggregate)
</del><ins>+void TDependencyGraphBuilder::visitAggregateChildren(
+    TIntermAggregate *intermAggregate)
</ins><span class="cx"> {
</span><del>-    TIntermSequence&amp; sequence = intermAggregate-&gt;getSequence();
-    for(TIntermSequence::const_iterator iter = sequence.begin(); iter != sequence.end(); ++iter)
</del><ins>+    TIntermSequence *sequence = intermAggregate-&gt;getSequence();
+    for (TIntermSequence::const_iterator iter = sequence-&gt;begin();
+         iter != sequence-&gt;end(); ++iter)
</ins><span class="cx">     {
</span><del>-        TIntermNode* intermChild = *iter;
</del><ins>+        TIntermNode *intermChild = *iter;
</ins><span class="cx">         intermChild-&gt;traverse(this);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::visitSymbol(TIntermSymbol* intermSymbol)
</del><ins>+void TDependencyGraphBuilder::visitSymbol(TIntermSymbol *intermSymbol)
</ins><span class="cx"> {
</span><del>-    // Push this symbol into the set of dependent symbols for the current assignment or condition
-    // that we are traversing.
-    TGraphSymbol* symbol = mGraph-&gt;getOrCreateSymbol(intermSymbol);
</del><ins>+    // Push this symbol into the set of dependent symbols for the current
+    // assignment or condition that we are traversing.
+    TGraphSymbol *symbol = mGraph-&gt;getOrCreateSymbol(intermSymbol);
</ins><span class="cx">     mNodeSets.insertIntoTopSet(symbol);
</span><span class="cx"> 
</span><del>-    // If this symbol is the current leftmost symbol under an assignment, replace the previous
-    // leftmost symbol with this symbol.
-    if (!mLeftmostSymbols.empty() &amp;&amp; mLeftmostSymbols.top() != &amp;mRightSubtree) {
</del><ins>+    // If this symbol is the current leftmost symbol under an assignment, replace
+    // the previous leftmost symbol with this symbol.
+    if (!mLeftmostSymbols.empty() &amp;&amp; mLeftmostSymbols.top() != &amp;mRightSubtree)
+    {
</ins><span class="cx">         mLeftmostSymbols.pop();
</span><span class="cx">         mLeftmostSymbols.push(symbol);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TDependencyGraphBuilder::visitBinary(Visit visit, TIntermBinary* intermBinary)
</del><ins>+bool TDependencyGraphBuilder::visitBinary(Visit visit, TIntermBinary *intermBinary)
</ins><span class="cx"> {
</span><span class="cx">     TOperator op = intermBinary-&gt;getOp();
</span><span class="cx">     if (op == EOpInitialize || intermBinary-&gt;isAssignment())
</span><span class="lines">@@ -104,13 +119,13 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::visitAssignment(TIntermBinary* intermAssignment)
</del><ins>+void TDependencyGraphBuilder::visitAssignment(TIntermBinary *intermAssignment)
</ins><span class="cx"> {
</span><del>-    TIntermTyped* intermLeft = intermAssignment-&gt;getLeft();
</del><ins>+    TIntermTyped *intermLeft = intermAssignment-&gt;getLeft();
</ins><span class="cx">     if (!intermLeft)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    TGraphSymbol* leftmostSymbol = NULL;
</del><ins>+    TGraphSymbol *leftmostSymbol = NULL;
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TNodeSetMaintainer nodeSetMaintainer(this);
</span><span class="lines">@@ -120,88 +135,100 @@
</span><span class="cx">             intermLeft-&gt;traverse(this);
</span><span class="cx">             leftmostSymbol = mLeftmostSymbols.top();
</span><span class="cx"> 
</span><del>-            // After traversing the left subtree of this assignment, we should have found a real
-            // leftmost symbol, and the leftmost symbol should not be a placeholder.
</del><ins>+            // After traversing the left subtree of this assignment, we should
+            // have found a real leftmost symbol, and the leftmost symbol should
+            // not be a placeholder.
</ins><span class="cx">             ASSERT(leftmostSymbol != &amp;mLeftSubtree);
</span><span class="cx">             ASSERT(leftmostSymbol != &amp;mRightSubtree);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (TIntermTyped* intermRight = intermAssignment-&gt;getRight()) {
</del><ins>+        if (TIntermTyped *intermRight = intermAssignment-&gt;getRight())
+        {
</ins><span class="cx">             TLeftmostSymbolMaintainer leftmostSymbolMaintainer(this, mRightSubtree);
</span><span class="cx">             intermRight-&gt;traverse(this);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (TParentNodeSet* assignmentNodes = mNodeSets.getTopSet())
</del><ins>+        if (TParentNodeSet *assignmentNodes = mNodeSets.getTopSet())
</ins><span class="cx">             connectMultipleNodesToSingleNode(assignmentNodes, leftmostSymbol);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Push the leftmost symbol of this assignment into the current set of dependent symbols to
-    // represent the result of this assignment.
-    // An expression like &quot;a = (b = c)&quot; will yield a dependency graph like &quot;c -&gt; b -&gt; a&quot;.
-    // This line essentially passes the leftmost symbol of the nested assignment (&quot;b&quot; in this
-    // example) back up to the earlier visitAssignment call for the outer assignment, which will
-    // create the connection &quot;b -&gt; a&quot;.
</del><ins>+    // Push the leftmost symbol of this assignment into the current set of dependent
+    // symbols to represent the result of this assignment.
+    // An expression like &quot;a = (b = c)&quot; will yield a dependency graph like
+    // &quot;c -&gt; b -&gt; a&quot;.
+    // This line essentially passes the leftmost symbol of the nested assignment
+    // (&quot;b&quot; in this example) back up to the earlier visitAssignment call for the
+    // outer assignment, which will create the connection &quot;b -&gt; a&quot;.
</ins><span class="cx">     mNodeSets.insertIntoTopSet(leftmostSymbol);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::visitLogicalOp(TIntermBinary* intermLogicalOp)
</del><ins>+void TDependencyGraphBuilder::visitLogicalOp(TIntermBinary *intermLogicalOp)
</ins><span class="cx"> {
</span><del>-    if (TIntermTyped* intermLeft = intermLogicalOp-&gt;getLeft()) {
</del><ins>+    if (TIntermTyped *intermLeft = intermLogicalOp-&gt;getLeft())
+    {
</ins><span class="cx">         TNodeSetPropagatingMaintainer nodeSetMaintainer(this);
</span><span class="cx"> 
</span><span class="cx">         intermLeft-&gt;traverse(this);
</span><del>-        if (TParentNodeSet* leftNodes = mNodeSets.getTopSet()) {
-            TGraphLogicalOp* logicalOp = mGraph-&gt;createLogicalOp(intermLogicalOp);
</del><ins>+        if (TParentNodeSet *leftNodes = mNodeSets.getTopSet())
+        {
+            TGraphLogicalOp *logicalOp = mGraph-&gt;createLogicalOp(intermLogicalOp);
</ins><span class="cx">             connectMultipleNodesToSingleNode(leftNodes, logicalOp);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (TIntermTyped* intermRight = intermLogicalOp-&gt;getRight()) {
</del><ins>+    if (TIntermTyped *intermRight = intermLogicalOp-&gt;getRight())
+    {
</ins><span class="cx">         TLeftmostSymbolMaintainer leftmostSymbolMaintainer(this, mRightSubtree);
</span><span class="cx">         intermRight-&gt;traverse(this);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::visitBinaryChildren(TIntermBinary* intermBinary)
</del><ins>+void TDependencyGraphBuilder::visitBinaryChildren(TIntermBinary *intermBinary)
</ins><span class="cx"> {
</span><del>-    if (TIntermTyped* intermLeft = intermBinary-&gt;getLeft())
</del><ins>+    if (TIntermTyped *intermLeft = intermBinary-&gt;getLeft())
</ins><span class="cx">         intermLeft-&gt;traverse(this);
</span><span class="cx"> 
</span><del>-    if (TIntermTyped* intermRight = intermBinary-&gt;getRight()) {
</del><ins>+    if (TIntermTyped *intermRight = intermBinary-&gt;getRight())
+    {
</ins><span class="cx">         TLeftmostSymbolMaintainer leftmostSymbolMaintainer(this, mRightSubtree);
</span><span class="cx">         intermRight-&gt;traverse(this);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TDependencyGraphBuilder::visitSelection(Visit visit, TIntermSelection* intermSelection)
</del><ins>+bool TDependencyGraphBuilder::visitSelection(
+    Visit visit, TIntermSelection *intermSelection)
</ins><span class="cx"> {
</span><del>-    if (TIntermNode* intermCondition = intermSelection-&gt;getCondition()) {
</del><ins>+    if (TIntermNode *intermCondition = intermSelection-&gt;getCondition())
+    {
</ins><span class="cx">         TNodeSetMaintainer nodeSetMaintainer(this);
</span><span class="cx"> 
</span><span class="cx">         intermCondition-&gt;traverse(this);
</span><del>-        if (TParentNodeSet* conditionNodes = mNodeSets.getTopSet()) {
-            TGraphSelection* selection = mGraph-&gt;createSelection(intermSelection);
</del><ins>+        if (TParentNodeSet *conditionNodes = mNodeSets.getTopSet())
+        {
+            TGraphSelection *selection = mGraph-&gt;createSelection(intermSelection);
</ins><span class="cx">             connectMultipleNodesToSingleNode(conditionNodes, selection);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (TIntermNode* intermTrueBlock = intermSelection-&gt;getTrueBlock())
</del><ins>+    if (TIntermNode *intermTrueBlock = intermSelection-&gt;getTrueBlock())
</ins><span class="cx">         intermTrueBlock-&gt;traverse(this);
</span><span class="cx"> 
</span><del>-    if (TIntermNode* intermFalseBlock = intermSelection-&gt;getFalseBlock())
</del><ins>+    if (TIntermNode *intermFalseBlock = intermSelection-&gt;getFalseBlock())
</ins><span class="cx">         intermFalseBlock-&gt;traverse(this);
</span><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TDependencyGraphBuilder::visitLoop(Visit visit, TIntermLoop* intermLoop)
</del><ins>+bool TDependencyGraphBuilder::visitLoop(Visit visit, TIntermLoop *intermLoop)
</ins><span class="cx"> {
</span><del>-    if (TIntermTyped* intermCondition = intermLoop-&gt;getCondition()) {
</del><ins>+    if (TIntermTyped *intermCondition = intermLoop-&gt;getCondition())
+    {
</ins><span class="cx">         TNodeSetMaintainer nodeSetMaintainer(this);
</span><span class="cx"> 
</span><span class="cx">         intermCondition-&gt;traverse(this);
</span><del>-        if (TParentNodeSet* conditionNodes = mNodeSets.getTopSet()) {
-            TGraphLoop* loop = mGraph-&gt;createLoop(intermLoop);
</del><ins>+        if (TParentNodeSet *conditionNodes = mNodeSets.getTopSet())
+        {
+            TGraphLoop *loop = mGraph-&gt;createLoop(intermLoop);
</ins><span class="cx">             connectMultipleNodesToSingleNode(conditionNodes, loop);
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -209,19 +236,20 @@
</span><span class="cx">     if (TIntermNode* intermBody = intermLoop-&gt;getBody())
</span><span class="cx">         intermBody-&gt;traverse(this);
</span><span class="cx"> 
</span><del>-    if (TIntermTyped* intermExpression = intermLoop-&gt;getExpression())
</del><ins>+    if (TIntermTyped *intermExpression = intermLoop-&gt;getExpression())
</ins><span class="cx">         intermExpression-&gt;traverse(this);
</span><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-void TDependencyGraphBuilder::connectMultipleNodesToSingleNode(TParentNodeSet* nodes,
-                                                               TGraphNode* node) const
</del><ins>+void TDependencyGraphBuilder::connectMultipleNodesToSingleNode(
+    TParentNodeSet *nodes, TGraphNode *node) const
</ins><span class="cx"> {
</span><del>-    for (TParentNodeSet::const_iterator iter = nodes-&gt;begin(); iter != nodes-&gt;end(); ++iter)
</del><ins>+    for (TParentNodeSet::const_iterator iter = nodes-&gt;begin();
+         iter != nodes-&gt;end(); ++iter)
</ins><span class="cx">     {
</span><del>-        TGraphParentNode* currentNode = *iter;
</del><ins>+        TGraphParentNode *currentNode = *iter;
</ins><span class="cx">         currentNode-&gt;addDependentNode(node);
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphBuilderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,55 +4,58 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
-#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
</del><ins>+#ifndef COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHBUILDER_H_
+#define COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHBUILDER_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/depgraph/DependencyGraph.h&quot;
</span><span class="cx"> 
</span><span class="cx"> //
</span><del>-// Creates a dependency graph of symbols, function calls, conditions etc. by traversing a
-// intermediate tree.
</del><ins>+// Creates a dependency graph of symbols, function calls, conditions etc. by
+// traversing a intermediate tree.
</ins><span class="cx"> //
</span><del>-class TDependencyGraphBuilder : public TIntermTraverser {
-public:
-    static void build(TIntermNode* node, TDependencyGraph* graph);
</del><ins>+class TDependencyGraphBuilder : public TIntermTraverser
+{
+  public:
+    static void build(TIntermNode *node, TDependencyGraph *graph);
</ins><span class="cx"> 
</span><del>-    virtual void visitSymbol(TIntermSymbol*);
-    virtual bool visitBinary(Visit visit, TIntermBinary*);
-    virtual bool visitSelection(Visit visit, TIntermSelection*);
-    virtual bool visitAggregate(Visit visit, TIntermAggregate*);
-    virtual bool visitLoop(Visit visit, TIntermLoop*);
</del><ins>+    virtual void visitSymbol(TIntermSymbol *);
+    virtual bool visitBinary(Visit visit, TIntermBinary *);
+    virtual bool visitSelection(Visit visit, TIntermSelection *);
+    virtual bool visitAggregate(Visit visit, TIntermAggregate *);
+    virtual bool visitLoop(Visit visit, TIntermLoop *);
</ins><span class="cx"> 
</span><del>-private:
-    typedef std::stack&lt;TGraphSymbol*&gt; TSymbolStack;
-    typedef std::set&lt;TGraphParentNode*&gt; TParentNodeSet;
</del><ins>+  private:
+    typedef std::stack&lt;TGraphSymbol *&gt; TSymbolStack;
+    typedef std::set&lt;TGraphParentNode *&gt; TParentNodeSet;
</ins><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // For collecting the dependent nodes of assignments, conditions, etc.
</span><span class="cx">     // while traversing the intermediate tree.
</span><span class="cx">     //
</span><del>-    // This data structure is stack of sets. Each set contains dependency graph parent nodes.
</del><ins>+    // This data structure is stack of sets. Each set contains dependency graph
+    // parent nodes.
</ins><span class="cx">     //
</span><del>-    class TNodeSetStack {
-    public:
</del><ins>+    class TNodeSetStack
+    {
+      public:
</ins><span class="cx">         TNodeSetStack() {};
</span><span class="cx">         ~TNodeSetStack() { clear(); }
</span><span class="cx"> 
</span><span class="cx">         // This should only be called after a pushSet.
</span><span class="cx">         // Returns NULL if the top set is empty.
</span><del>-        TParentNodeSet* getTopSet() const
</del><ins>+        TParentNodeSet *getTopSet() const
</ins><span class="cx">         {
</span><del>-            ASSERT(!nodeSets.empty());
-            TParentNodeSet* topSet = nodeSets.top();
</del><ins>+            ASSERT(!mNodeSets.empty());
+            TParentNodeSet *topSet = mNodeSets.top();
</ins><span class="cx">             return !topSet-&gt;empty() ? topSet : NULL;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        void pushSet() { nodeSets.push(new TParentNodeSet()); }
</del><ins>+        void pushSet() { mNodeSets.push(new TParentNodeSet()); }
</ins><span class="cx">         void popSet()
</span><span class="cx">         {
</span><del>-            ASSERT(!nodeSets.empty());
-            delete nodeSets.top();
-            nodeSets.pop();
</del><ins>+            ASSERT(!mNodeSets.empty());
+            delete mNodeSets.top();
+            mNodeSets.pop();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Pops the top set and adds its contents to the new top set.
</span><span class="lines">@@ -60,12 +63,13 @@
</span><span class="cx">         // If there is no set below the top set, the top set is just deleted.
</span><span class="cx">         void popSetIntoNext()
</span><span class="cx">         {
</span><del>-            ASSERT(!nodeSets.empty());
-            TParentNodeSet* oldTopSet = nodeSets.top();
-            nodeSets.pop();
</del><ins>+            ASSERT(!mNodeSets.empty());
+            TParentNodeSet *oldTopSet = mNodeSets.top();
+            mNodeSets.pop();
</ins><span class="cx"> 
</span><del>-            if (!nodeSets.empty()) {
-                TParentNodeSet* newTopSet = nodeSets.top();
</del><ins>+            if (!mNodeSets.empty())
+            {
+                TParentNodeSet *newTopSet = mNodeSets.top();
</ins><span class="cx">                 newTopSet-&gt;insert(oldTopSet-&gt;begin(), oldTopSet-&gt;end());
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="lines">@@ -76,106 +80,120 @@
</span><span class="cx">         // This can be called when there is no top set if we are visiting
</span><span class="cx">         // symbols that are not under an assignment or condition.
</span><span class="cx">         // We don't need to track those symbols.
</span><del>-        void insertIntoTopSet(TGraphParentNode* node)
</del><ins>+        void insertIntoTopSet(TGraphParentNode *node)
</ins><span class="cx">         {
</span><del>-            if (nodeSets.empty())
</del><ins>+            if (mNodeSets.empty())
</ins><span class="cx">                 return;
</span><span class="cx"> 
</span><del>-            nodeSets.top()-&gt;insert(node);
</del><ins>+            mNodeSets.top()-&gt;insert(node);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         void clear()
</span><span class="cx">         {
</span><del>-            while (!nodeSets.empty())
</del><ins>+            while (!mNodeSets.empty())
</ins><span class="cx">                 popSet();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-    private:
-        typedef std::stack&lt;TParentNodeSet*&gt; TParentNodeSetStack;
</del><ins>+      private:
+        typedef std::stack&lt;TParentNodeSet *&gt; TParentNodeSetStack;
</ins><span class="cx"> 
</span><del>-        TParentNodeSetStack nodeSets;
</del><ins>+        TParentNodeSetStack mNodeSets;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // An instance of this class pushes a new node set when instantiated.
</span><span class="cx">     // When the instance goes out of scope, it and pops the node set.
</span><span class="cx">     //
</span><del>-    class TNodeSetMaintainer {
-    public:
-        TNodeSetMaintainer(TDependencyGraphBuilder* factory)
-            : sets(factory-&gt;mNodeSets) { sets.pushSet(); }
-        ~TNodeSetMaintainer() { sets.popSet(); }
-    protected:
-        TNodeSetStack&amp; sets;
</del><ins>+    class TNodeSetMaintainer : angle::NonCopyable
+    {
+      public:
+        TNodeSetMaintainer(TDependencyGraphBuilder *factory)
+            : mSets(factory-&gt;mNodeSets)
+        {
+            mSets.pushSet();
+        }
+        ~TNodeSetMaintainer() { mSets.popSet(); }
+      protected:
+        TNodeSetStack &amp;mSets;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     //
</span><span class="cx">     // An instance of this class pushes a new node set when instantiated.
</span><del>-    // When the instance goes out of scope, it and pops the top node set and adds its contents to
-    // the new top node set.
</del><ins>+    // When the instance goes out of scope, it and pops the top node set and adds
+    // its contents to the new top node set.
</ins><span class="cx">     //
</span><del>-    class TNodeSetPropagatingMaintainer {
-    public:
-        TNodeSetPropagatingMaintainer(TDependencyGraphBuilder* factory)
-            : sets(factory-&gt;mNodeSets) { sets.pushSet(); }
-        ~TNodeSetPropagatingMaintainer() { sets.popSetIntoNext(); }
-    protected:
-        TNodeSetStack&amp; sets;
</del><ins>+    class TNodeSetPropagatingMaintainer : angle::NonCopyable
+    {
+      public:
+        TNodeSetPropagatingMaintainer(TDependencyGraphBuilder *factory)
+            : mSets(factory-&gt;mNodeSets)
+        {
+            mSets.pushSet();
+        }
+        ~TNodeSetPropagatingMaintainer() { mSets.popSetIntoNext(); }
+      protected:
+        TNodeSetStack &amp;mSets;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     //
</span><del>-    // An instance of this class keeps track of the leftmost symbol while we're exploring an
-    // assignment.
-    // It will push the placeholder symbol kLeftSubtree when instantiated under a left subtree,
-    // and kRightSubtree under a right subtree.
-    // When it goes out of scope, it will pop the leftmost symbol at the top of the scope.
-    // During traversal, the TDependencyGraphBuilder will replace kLeftSubtree with a real symbol.
-    // kRightSubtree will never be replaced by a real symbol because we are tracking the leftmost
-    // symbol.
</del><ins>+    // An instance of this class keeps track of the leftmost symbol while we're
+    // exploring an assignment.
+    // It will push the placeholder symbol kLeftSubtree when instantiated under a
+    // left subtree, and kRightSubtree under a right subtree.
+    // When it goes out of scope, it will pop the leftmost symbol at the top of the
+    // scope.
+    // During traversal, the TDependencyGraphBuilder will replace kLeftSubtree with
+    // a real symbol.
+    // kRightSubtree will never be replaced by a real symbol because we are tracking
+    // the leftmost symbol.
</ins><span class="cx">     //
</span><del>-    class TLeftmostSymbolMaintainer {
-    public:
-        TLeftmostSymbolMaintainer(TDependencyGraphBuilder* factory, TGraphSymbol&amp; subtree)
-            : leftmostSymbols(factory-&gt;mLeftmostSymbols)
</del><ins>+    class TLeftmostSymbolMaintainer : angle::NonCopyable
+    {
+      public:
+        TLeftmostSymbolMaintainer(
+            TDependencyGraphBuilder *factory, TGraphSymbol &amp;subtree)
+            : mLeftmostSymbols(factory-&gt;mLeftmostSymbols)
</ins><span class="cx">         {
</span><del>-            needsPlaceholderSymbol = leftmostSymbols.empty() || leftmostSymbols.top() != &amp;subtree;
-            if (needsPlaceholderSymbol)
-                leftmostSymbols.push(&amp;subtree);
</del><ins>+            mNeedsPlaceholderSymbol =
+                mLeftmostSymbols.empty() || mLeftmostSymbols.top() != &amp;subtree;
+            if (mNeedsPlaceholderSymbol)
+                mLeftmostSymbols.push(&amp;subtree);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         ~TLeftmostSymbolMaintainer()
</span><span class="cx">         {
</span><del>-            if (needsPlaceholderSymbol)
-                leftmostSymbols.pop();
</del><ins>+            if (mNeedsPlaceholderSymbol)
+                mLeftmostSymbols.pop();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-    protected:
-        TSymbolStack&amp; leftmostSymbols;
-        bool needsPlaceholderSymbol;
</del><ins>+      protected:
+        TSymbolStack&amp; mLeftmostSymbols;
+        bool mNeedsPlaceholderSymbol;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><del>-    TDependencyGraphBuilder(TDependencyGraph* graph)
-        : TIntermTraverser(true, false, false)
-        , mLeftSubtree(NULL)
-        , mRightSubtree(NULL)
-        , mGraph(graph) {}
-    void build(TIntermNode* intermNode) { intermNode-&gt;traverse(this); }
</del><ins>+    TDependencyGraphBuilder(TDependencyGraph *graph)
+        : TIntermTraverser(true, false, false),
+          mLeftSubtree(NULL),
+          mRightSubtree(NULL),
+          mGraph(graph) {}
+    void build(TIntermNode *intermNode) { intermNode-&gt;traverse(this); }
</ins><span class="cx"> 
</span><del>-    void connectMultipleNodesToSingleNode(TParentNodeSet* nodes, TGraphNode* node) const;
</del><ins>+    void connectMultipleNodesToSingleNode(
+        TParentNodeSet *nodes, TGraphNode *node) const;
</ins><span class="cx"> 
</span><del>-    void visitAssignment(TIntermBinary*);
-    void visitLogicalOp(TIntermBinary*);
-    void visitBinaryChildren(TIntermBinary*);
-    void visitFunctionDefinition(TIntermAggregate*);
-    void visitFunctionCall(TIntermAggregate* intermFunctionCall);
-    void visitAggregateChildren(TIntermAggregate*);
</del><ins>+    void visitAssignment(TIntermBinary *);
+    void visitLogicalOp(TIntermBinary *);
+    void visitBinaryChildren(TIntermBinary *);
+    void visitFunctionDefinition(TIntermAggregate *);
+    void visitFunctionCall(TIntermAggregate *intermFunctionCall);
+    void visitAggregateChildren(TIntermAggregate *);
</ins><span class="cx"> 
</span><span class="cx">     TGraphSymbol mLeftSubtree;
</span><span class="cx">     TGraphSymbol mRightSubtree;
</span><span class="cx"> 
</span><del>-    TDependencyGraph* mGraph;
</del><ins>+    TDependencyGraph *mGraph;
</ins><span class="cx">     TNodeSetStack mNodeSets;
</span><span class="cx">     TSymbolStack mLeftmostSymbols;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_BUILDER_H
</del><ins>+#endif  // COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHBUILDER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatordepgraphDependencyGraphOutputh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphOutput.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphOutput.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/depgraph/DependencyGraphOutput.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,27 +4,28 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
-#define COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
</del><ins>+#ifndef COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHOUTPUT_H_
+#define COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHOUTPUT_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/depgraph/DependencyGraph.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><span class="cx"> 
</span><del>-class TDependencyGraphOutput : public TDependencyGraphTraverser {
-public:
</del><ins>+class TDependencyGraphOutput : public TDependencyGraphTraverser
+{
+  public:
</ins><span class="cx">     TDependencyGraphOutput(TInfoSinkBase&amp; sink) : mSink(sink) {}
</span><del>-    virtual void visitSymbol(TGraphSymbol* symbol);
-    virtual void visitArgument(TGraphArgument* parameter);
-    virtual void visitFunctionCall(TGraphFunctionCall* functionCall);
-    virtual void visitSelection(TGraphSelection* selection);
-    virtual void visitLoop(TGraphLoop* loop);
-    virtual void visitLogicalOp(TGraphLogicalOp* logicalOp);
</del><ins>+    void visitSymbol(TGraphSymbol* symbol) override;
+    void visitArgument(TGraphArgument* parameter) override;
+    void visitFunctionCall(TGraphFunctionCall* functionCall) override;
+    void visitSelection(TGraphSelection* selection) override;
+    void visitLoop(TGraphLoop* loop) override;
+    void visitLogicalOp(TGraphLogicalOp* logicalOp) override;
</ins><span class="cx"> 
</span><span class="cx">     void outputAllSpanningTrees(TDependencyGraph&amp; graph);
</span><del>-private:
</del><ins>+  private:
</ins><span class="cx">     void outputIndentation();
</span><span class="cx"> 
</span><span class="cx">     TInfoSinkBase&amp; mSink;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_DEPGRAPH_DEPENDENCY_GRAPH_OUTPUT_H
</del><ins>+#endif  // COMPILER_TRANSLATOR_DEPGRAPH_DEPENDENCYGRAPHOUTPUT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslangh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,6 +4,9 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><ins>+#ifndef COMPILER_TRANSLATOR_GLSLANG_H_
+#define COMPILER_TRANSLATOR_GLSLANG_H_
+
</ins><span class="cx"> struct TParseContext;
</span><span class="cx"> extern int glslang_initialize(TParseContext* context);
</span><span class="cx"> extern int glslang_finalize(TParseContext* context);
</span><span class="lines">@@ -14,3 +17,4 @@
</span><span class="cx">                         TParseContext* context);
</span><span class="cx"> extern int glslang_parse(TParseContext* context);
</span><span class="cx"> 
</span><ins>+#endif // COMPILER_TRANSLATOR_GLSLANG_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslangl"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.l        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -28,16 +28,14 @@
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wunused-variable&quot;
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wswitch-enum&quot;
</span><span class="cx"> #elif defined(_MSC_VER)
</span><ins>+#pragma warning(disable: 4005)
</ins><span class="cx"> #pragma warning(disable: 4065)
</span><span class="cx"> #pragma warning(disable: 4189)
</span><ins>+#pragma warning(disable: 4244)
</ins><span class="cx"> #pragma warning(disable: 4505)
</span><span class="cx"> #pragma warning(disable: 4701)
</span><ins>+#pragma warning(disable: 4702)
</ins><span class="cx"> #endif
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> %{
</span><span class="lines">@@ -53,6 +51,13 @@
</span><span class="cx"> #pragma warning(disable : 4102)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus &gt; 199711L
+#define register
+#endif
+#endif
+
</ins><span class="cx"> #define YY_USER_ACTION                                 \
</span><span class="cx">     yylloc-&gt;first_file = yylloc-&gt;last_file = yycolumn; \
</span><span class="cx">     yylloc-&gt;first_line = yylloc-&gt;last_line = yylineno;
</span><span class="lines">@@ -75,6 +80,7 @@
</span><span class="cx"> %option noyywrap nounput never-interactive
</span><span class="cx"> %option yylineno reentrant bison-bridge bison-locations
</span><span class="cx"> %option extra-type=&quot;TParseContext*&quot;
</span><ins>+%x FIELDS
</ins><span class="cx"> 
</span><span class="cx"> D           [0-9]
</span><span class="cx"> L           [a-zA-Z_]
</span><span class="lines">@@ -363,7 +369,7 @@
</span><span class="cx"> &quot;)&quot;             { return RIGHT_PAREN; }
</span><span class="cx"> (&quot;[&quot;|&quot;&lt;:&quot;)      { return LEFT_BRACKET; }
</span><span class="cx"> (&quot;]&quot;|&quot;:&gt;&quot;)      { return RIGHT_BRACKET; }
</span><del>-&quot;.&quot;             { return DOT; }
</del><ins>+&quot;.&quot;             { BEGIN(FIELDS); return DOT; }
</ins><span class="cx"> &quot;!&quot;             { return BANG; }
</span><span class="cx"> &quot;-&quot;             { return DASH; }
</span><span class="cx"> &quot;~&quot;             { return TILDE; }
</span><span class="lines">@@ -378,16 +384,19 @@
</span><span class="cx"> &quot;&amp;&quot;             { return AMPERSAND; }
</span><span class="cx"> &quot;?&quot;             { return QUESTION; }
</span><span class="cx"> 
</span><ins>+&lt;FIELDS&gt;{L}({L}|{D})* {
+    BEGIN(INITIAL);
+    yylval-&gt;lex.string = NewPoolTString(yytext);
+    return FIELD_SELECTION;
+}
+&lt;FIELDS&gt;[ \t\v\f\r] {}
+
</ins><span class="cx"> [ \t\v\n\f\r] { }
</span><del>-&lt;&lt;EOF&gt;&gt;       { yyterminate(); }
-.             { assert(false); return 0; }
</del><ins>+&lt;*&gt;&lt;&lt;EOF&gt;&gt;    { yyterminate(); }
+&lt;*&gt;.          { assert(false); return 0; }
</ins><span class="cx"> 
</span><span class="cx"> %%
</span><span class="cx"> 
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
</del><span class="cx"> yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
</span><span class="cx">     pp::Token token;
</span><span class="cx">     yyget_extra(yyscanner)-&gt;preprocessor.lex(&amp;token);
</span><span class="lines">@@ -501,8 +510,8 @@
</span><span class="cx">     return(FLOATCONSTANT);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) {
-    context-&gt;error(*lloc, reason, yyget_text(context-&gt;scanner));
</del><ins>+void yyerror(YYLTYPE* lloc, TParseContext* context, void *scanner, const char* reason) {
+    context-&gt;error(*lloc, reason, yyget_text(scanner));
</ins><span class="cx">     context-&gt;recover();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslangy"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.y (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.y        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang.y        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -30,22 +30,24 @@
</span><span class="cx"> #elif defined(_MSC_VER)
</span><span class="cx"> #pragma warning(disable: 4065)
</span><span class="cx"> #pragma warning(disable: 4189)
</span><ins>+#pragma warning(disable: 4244)
</ins><span class="cx"> #pragma warning(disable: 4505)
</span><span class="cx"> #pragma warning(disable: 4701)
</span><ins>+#pragma warning(disable: 4702)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/SymbolTable.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><span class="cx"> #include &quot;GLSLANG/ShaderLang.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #define YYENABLE_NLS 0
</span><span class="cx"> 
</span><del>-#define YYLEX_PARAM context-&gt;scanner
-
</del><span class="cx"> %}
</span><span class="cx"> %expect 1 /* One shift reduce conflict because of if | else */
</span><del>-%pure-parser
</del><span class="cx"> %parse-param {TParseContext* context}
</span><ins>+%param   {void *scanner}
+%define api.pure full
</ins><span class="cx"> %locations
</span><span class="cx"> 
</span><span class="cx"> %code requires {
</span><span class="lines">@@ -71,6 +73,8 @@
</span><span class="cx">             TIntermNodePair nodePair;
</span><span class="cx">             TIntermTyped* intermTypedNode;
</span><span class="cx">             TIntermAggregate* intermAggregate;
</span><ins>+            TIntermSwitch* intermSwitch;
+            TIntermCase* intermCase;
</ins><span class="cx">         };
</span><span class="cx">         union {
</span><span class="cx">             TPublicType type;
</span><span class="lines">@@ -87,11 +91,11 @@
</span><span class="cx"> 
</span><span class="cx"> %{
</span><span class="cx"> extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
</span><del>-extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason);
</del><ins>+extern void yyerror(YYLTYPE* yylloc, TParseContext* context, void *scanner, const char* reason);
</ins><span class="cx"> 
</span><span class="cx"> #define YYLLOC_DEFAULT(Current, Rhs, N)                      \
</span><span class="cx">   do {                                                       \
</span><del>-      if (YYID(N)) {                                         \
</del><ins>+      if (N) {                                         \
</ins><span class="cx">         (Current).first_file = YYRHSLOC(Rhs, 1).first_file;  \
</span><span class="cx">         (Current).first_line = YYRHSLOC(Rhs, 1).first_line;  \
</span><span class="cx">         (Current).last_file = YYRHSLOC(Rhs, N).last_file;    \
</span><span class="lines">@@ -106,14 +110,14 @@
</span><span class="cx">   } while (0)
</span><span class="cx"> 
</span><span class="cx"> #define VERTEX_ONLY(S, L) {  \
</span><del>-    if (context-&gt;shaderType != SH_VERTEX_SHADER) {  \
</del><ins>+    if (context-&gt;shaderType != GL_VERTEX_SHADER) {  \
</ins><span class="cx">         context-&gt;error(L, &quot; supported in vertex shaders only &quot;, S);  \
</span><span class="cx">         context-&gt;recover();  \
</span><span class="cx">     }  \
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #define FRAG_ONLY(S, L) {  \
</span><del>-    if (context-&gt;shaderType != SH_FRAGMENT_SHADER) {  \
</del><ins>+    if (context-&gt;shaderType != GL_FRAGMENT_SHADER) {  \
</ins><span class="cx">         context-&gt;error(L, &quot; supported in fragment shaders only &quot;, S);  \
</span><span class="cx">         context-&gt;recover();  \
</span><span class="cx">     }  \
</span><span class="lines">@@ -178,6 +182,8 @@
</span><span class="cx"> %type &lt;interm.intermNode&gt; declaration external_declaration
</span><span class="cx"> %type &lt;interm.intermNode&gt; for_init_statement compound_statement_no_new_scope
</span><span class="cx"> %type &lt;interm.nodePair&gt; selection_rest_statement for_rest_statement
</span><ins>+%type &lt;interm.intermSwitch&gt; switch_statement
+%type &lt;interm.intermCase&gt; case_label
</ins><span class="cx"> %type &lt;interm.intermNode&gt; iteration_statement jump_statement statement_no_new_scope statement_with_scope
</span><span class="cx"> %type &lt;interm&gt; single_declaration init_declarator_list
</span><span class="cx"> 
</span><span class="lines">@@ -208,42 +214,11 @@
</span><span class="cx"> variable_identifier
</span><span class="cx">     : IDENTIFIER {
</span><span class="cx">         // The symbol table search was done in the lexical phase
</span><del>-        const TSymbol *symbol = $1.symbol;
-        const TVariable *variable = 0;
</del><ins>+        const TVariable *variable = context-&gt;getNamedVariable(@1, $1.string, $1.symbol);
</ins><span class="cx"> 
</span><del>-        if (!symbol)
-        {
-            context-&gt;error(@1, &quot;undeclared identifier&quot;, $1.string-&gt;c_str());
-            context-&gt;recover();
-        }
-        else if (!symbol-&gt;isVariable())
-        {
-            context-&gt;error(@1, &quot;variable expected&quot;, $1.string-&gt;c_str());
-            context-&gt;recover();
-        }
-        else
-        {
-            variable = static_cast&lt;const TVariable*&gt;(symbol);
-
-            if (context-&gt;symbolTable.findBuiltIn(variable-&gt;getName(), context-&gt;shaderVersion) &amp;&amp;
-                !variable-&gt;getExtension().empty() &amp;&amp;
-                context-&gt;extensionErrorCheck(@1, variable-&gt;getExtension()))
-            {
-                context-&gt;recover();
-            }
-        }
-
-        if (!variable)
-        {
-            TType type(EbtFloat, EbpUndefined);
-            TVariable *fakeVariable = new TVariable($1.string, type);
-            context-&gt;symbolTable.declare(*fakeVariable);
-            variable = fakeVariable;
-        }
-
</del><span class="cx">         if (variable-&gt;getType().getQualifier() == EvqConst)
</span><span class="cx">         {
</span><del>-            ConstantUnion* constArray = variable-&gt;getConstPointer();
</del><ins>+            TConstantUnion* constArray = variable-&gt;getConstPointer();
</ins><span class="cx">             TType t(variable-&gt;getType());
</span><span class="cx">             $$ = context-&gt;intermediate.addConstantUnion(constArray, t, @1);
</span><span class="cx">         }
</span><span class="lines">@@ -265,22 +240,22 @@
</span><span class="cx">         $$ = $1;
</span><span class="cx">     }
</span><span class="cx">     | INTCONSTANT {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">         unionArray-&gt;setIConst($1.i);
</span><span class="cx">         $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), @1);
</span><span class="cx">     }
</span><span class="cx">     | UINTCONSTANT {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">         unionArray-&gt;setUConst($1.u);
</span><span class="cx">         $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), @1);
</span><span class="cx">     }
</span><span class="cx">     | FLOATCONSTANT {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">         unionArray-&gt;setFConst($1.f);
</span><span class="cx">         $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), @1);
</span><span class="cx">     }
</span><span class="cx">     | BOOLCONSTANT {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
</ins><span class="cx">         unionArray-&gt;setBConst($1.b);
</span><span class="cx">         $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @1);
</span><span class="cx">     }
</span><span class="lines">@@ -299,28 +274,14 @@
</span><span class="cx">     | function_call {
</span><span class="cx">         $$ = $1;
</span><span class="cx">     }
</span><del>-    | postfix_expression DOT identifier {
</del><ins>+    | postfix_expression DOT FIELD_SELECTION {
</ins><span class="cx">         $$ = context-&gt;addFieldSelectionExpression($1, @2, *$3.string, @3);
</span><span class="cx">     }
</span><span class="cx">     | postfix_expression INC_OP {
</span><del>-        if (context-&gt;lValueErrorCheck(@2, &quot;++&quot;, $1))
-            context-&gt;recover();
-        $$ = context-&gt;intermediate.addUnaryMath(EOpPostIncrement, $1, @2);
-        if ($$ == 0) {
-            context-&gt;unaryOpError(@2, &quot;++&quot;, $1-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $1;
-        }
</del><ins>+        $$ = context-&gt;addUnaryMathLValue(EOpPostIncrement, $1, @2);
</ins><span class="cx">     }
</span><span class="cx">     | postfix_expression DEC_OP {
</span><del>-        if (context-&gt;lValueErrorCheck(@2, &quot;--&quot;, $1))
-            context-&gt;recover();
-        $$ = context-&gt;intermediate.addUnaryMath(EOpPostDecrement, $1, @2);
-        if ($$ == 0) {
-            context-&gt;unaryOpError(@2, &quot;--&quot;, $1-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $1;
-        }
</del><ins>+        $$ = context-&gt;addUnaryMathLValue(EOpPostDecrement, $1, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -334,112 +295,24 @@
</span><span class="cx"> 
</span><span class="cx"> function_call
</span><span class="cx">     : function_call_or_method {
</span><del>-        TFunction* fnCall = $1.function;
-        TOperator op = fnCall-&gt;getBuiltInOp();
-
-        if (op != EOpNull)
</del><ins>+        bool fatalError = false;
+        $$ = context-&gt;addFunctionCallOrMethod($1.function, $1.nodePair.node1, $1.nodePair.node2, @1, &amp;fatalError);
+        if (fatalError)
</ins><span class="cx">         {
</span><del>-            //
-            // Then this should be a constructor.
-            // Don't go through the symbol table for constructors.
-            // Their parameters will be verified algorithmically.
-            //
-            TType type(EbtVoid, EbpUndefined);  // use this to get the type back
-            if (context-&gt;constructorErrorCheck(@1, $1.intermNode, *fnCall, op, &amp;type)) {
-                $$ = 0;
-            } else {
-                //
-                // It's a constructor, of type 'type'.
-                //
-                $$ = context-&gt;addConstructor($1.intermNode, &amp;type, op, fnCall, @1);
-            }
-
-            if ($$ == 0) {
-                context-&gt;recover();
-                $$ = context-&gt;intermediate.setAggregateOperator(0, op, @1);
-            }
-            $$-&gt;setType(type);
-        } else {
-            //
-            // Not a constructor.  Find it in the symbol table.
-            //
-            const TFunction* fnCandidate;
-            bool builtIn;
-            fnCandidate = context-&gt;findFunction(@1, fnCall, context-&gt;shaderVersion, &amp;builtIn);
-            if (fnCandidate) {
-                //
-                // A declared function.
-                //
-                if (builtIn &amp;&amp; !fnCandidate-&gt;getExtension().empty() &amp;&amp;
-                    context-&gt;extensionErrorCheck(@1, fnCandidate-&gt;getExtension())) {
-                    context-&gt;recover();
-                }
-                op = fnCandidate-&gt;getBuiltInOp();
-                if (builtIn &amp;&amp; op != EOpNull) {
-                    //
-                    // A function call mapped to a built-in operation.
-                    //
-                    if (fnCandidate-&gt;getParamCount() == 1) {
-                        //
-                        // Treat it like a built-in unary operator.
-                        //
-                        $$ = context-&gt;intermediate.addUnaryMath(op, $1.intermNode, @1);
-                        if ($$ == 0)  {
-                            std::stringstream extraInfoStream;
-                            extraInfoStream &lt;&lt; &quot;built in unary operator function.  Type: &quot; &lt;&lt; static_cast&lt;TIntermTyped*&gt;($1.intermNode)-&gt;getCompleteString();
-                            std::string extraInfo = extraInfoStream.str();
-                            context-&gt;error($1.intermNode-&gt;getLine(), &quot; wrong operand type&quot;, &quot;Internal Error&quot;, extraInfo.c_str());
-                            YYERROR;
-                        }
-                    } else {
-                        $$ = context-&gt;intermediate.setAggregateOperator($1.intermAggregate, op, @1);
-                    }
-                } else {
-                    // This is a real function call
-
-                    $$ = context-&gt;intermediate.setAggregateOperator($1.intermAggregate, EOpFunctionCall, @1);
-                    $$-&gt;setType(fnCandidate-&gt;getReturnType());
-
-                    // this is how we know whether the given function is a builtIn function or a user defined function
-                    // if builtIn == false, it's a userDefined -&gt; could be an overloaded builtIn function also
-                    // if builtIn == true, it's definitely a builtIn function with EOpNull
-                    if (!builtIn)
-                        $$-&gt;getAsAggregate()-&gt;setUserDefined();
-                    $$-&gt;getAsAggregate()-&gt;setName(fnCandidate-&gt;getMangledName());
-
-                    TQualifier qual;
-                    for (size_t i = 0; i &lt; fnCandidate-&gt;getParamCount(); ++i) {
-                        qual = fnCandidate-&gt;getParam(i).type-&gt;getQualifier();
-                        if (qual == EvqOut || qual == EvqInOut) {
-                            if (context-&gt;lValueErrorCheck($$-&gt;getLine(), &quot;assign&quot;, $$-&gt;getAsAggregate()-&gt;getSequence()[i]-&gt;getAsTyped())) {
-                                context-&gt;error($1.intermNode-&gt;getLine(), &quot;Constant value cannot be passed for 'out' or 'inout' parameters.&quot;, &quot;Error&quot;);
-                                context-&gt;recover();
-                            }
-                        }
-                    }
-                }
-                $$-&gt;setType(fnCandidate-&gt;getReturnType());
-            } else {
-                // error message was put out by PaFindFunction()
-                // Put on a dummy node for error recovery
-                ConstantUnion *unionArray = new ConstantUnion[1];
-                unionArray-&gt;setFConst(0.0f);
-                $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), @1);
-                context-&gt;recover();
-            }
</del><ins>+            YYERROR;
</ins><span class="cx">         }
</span><del>-        delete fnCall;
</del><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> function_call_or_method
</span><span class="cx">     : function_call_generic {
</span><span class="cx">         $$ = $1;
</span><ins>+        $$.nodePair.node2 = nullptr;
</ins><span class="cx">     }
</span><span class="cx">     | postfix_expression DOT function_call_generic {
</span><del>-        context-&gt;error(@3, &quot;methods are not supported&quot;, &quot;&quot;);
-        context-&gt;recover();
</del><ins>+        ES3_ONLY(&quot;&quot;, @3, &quot;methods&quot;);
</ins><span class="cx">         $$ = $3;
</span><ins>+        $$.nodePair.node2 = $1;
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -455,11 +328,11 @@
</span><span class="cx"> function_call_header_no_parameters
</span><span class="cx">     : function_call_header VOID_TYPE {
</span><span class="cx">         $$.function = $1;
</span><del>-        $$.intermNode = 0;
</del><ins>+        $$.nodePair.node1 = nullptr;
</ins><span class="cx">     }
</span><span class="cx">     | function_call_header {
</span><span class="cx">         $$.function = $1;
</span><del>-        $$.intermNode = 0;
</del><ins>+        $$.nodePair.node1 = nullptr;
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -468,13 +341,13 @@
</span><span class="cx">         TParameter param = { 0, new TType($2-&gt;getType()) };
</span><span class="cx">         $1-&gt;addParameter(param);
</span><span class="cx">         $$.function = $1;
</span><del>-        $$.intermNode = $2;
</del><ins>+        $$.nodePair.node1 = $2;
</ins><span class="cx">     }
</span><span class="cx">     | function_call_header_with_parameters COMMA assignment_expression {
</span><span class="cx">         TParameter param = { 0, new TType($3-&gt;getType()) };
</span><span class="cx">         $1.function-&gt;addParameter(param);
</span><span class="cx">         $$.function = $1.function;
</span><del>-        $$.intermNode = context-&gt;intermediate.growAggregate($1.intermNode, $3, @2);
</del><ins>+        $$.nodePair.node1 = context-&gt;intermediate.growAggregate($1.intermNode, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -487,7 +360,10 @@
</span><span class="cx"> // Grammar Note:  Constructors look like functions, but are recognized as types.
</span><span class="cx"> 
</span><span class="cx"> function_identifier
</span><del>-    : type_specifier_nonarray {
</del><ins>+    : type_specifier_no_prec {
+        if ($1.array) {
+            ES3_ONLY(&quot;[]&quot;, @1, &quot;array constructor&quot;);
+        }
</ins><span class="cx">         $$ = context-&gt;addConstructorFunc($1);
</span><span class="cx">     }
</span><span class="cx">     | IDENTIFIER {
</span><span class="lines">@@ -497,6 +373,13 @@
</span><span class="cx">         TFunction *function = new TFunction($1.string, type);
</span><span class="cx">         $$ = function;
</span><span class="cx">     }
</span><ins>+    | FIELD_SELECTION {
+        if (context-&gt;reservedErrorCheck(@1, *$1.string))
+            context-&gt;recover();
+        TType type(EbtVoid, EbpUndefined);
+        TFunction *function = new TFunction($1.string, type);
+        $$ = function;
+    }
</ins><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> unary_expression
</span><span class="lines">@@ -504,39 +387,14 @@
</span><span class="cx">         $$ = $1;
</span><span class="cx">     }
</span><span class="cx">     | INC_OP unary_expression {
</span><del>-        if (context-&gt;lValueErrorCheck(@1, &quot;++&quot;, $2))
-            context-&gt;recover();
-        $$ = context-&gt;intermediate.addUnaryMath(EOpPreIncrement, $2, @1);
-        if ($$ == 0) {
-            context-&gt;unaryOpError(@1, &quot;++&quot;, $2-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $2;
-        }
</del><ins>+        $$ = context-&gt;addUnaryMathLValue(EOpPreIncrement, $2, @1);
</ins><span class="cx">     }
</span><span class="cx">     | DEC_OP unary_expression {
</span><del>-        if (context-&gt;lValueErrorCheck(@1, &quot;--&quot;, $2))
-            context-&gt;recover();
-        $$ = context-&gt;intermediate.addUnaryMath(EOpPreDecrement, $2, @1);
-        if ($$ == 0) {
-            context-&gt;unaryOpError(@1, &quot;--&quot;, $2-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $2;
-        }
</del><ins>+        $$ = context-&gt;addUnaryMathLValue(EOpPreDecrement, $2, @1);
</ins><span class="cx">     }
</span><span class="cx">     | unary_operator unary_expression {
</span><span class="cx">         if ($1.op != EOpNull) {
</span><del>-            $$ = context-&gt;intermediate.addUnaryMath($1.op, $2, @1);
-            if ($$ == 0) {
-                const char* errorOp = &quot;&quot;;
-                switch($1.op) {
-                case EOpNegative:   errorOp = &quot;-&quot;; break;
-                case EOpLogicalNot: errorOp = &quot;!&quot;; break;
-                default: break;
-                }
-                context-&gt;unaryOpError(@1, errorOp, $2-&gt;getCompleteString());
-                context-&gt;recover();
-                $$ = $2;
-            }
</del><ins>+            $$ = context-&gt;addUnaryMath($1.op, $2, @1);
</ins><span class="cx">         } else
</span><span class="cx">             $$ = $2;
</span><span class="cx">     }
</span><span class="lines">@@ -544,193 +402,127 @@
</span><span class="cx"> // Grammar Note:  No traditional style type casts.
</span><span class="cx"> 
</span><span class="cx"> unary_operator
</span><del>-    : PLUS  { $$.op = EOpNull; }
</del><ins>+    : PLUS  { $$.op = EOpPositive; }
</ins><span class="cx">     | DASH  { $$.op = EOpNegative; }
</span><span class="cx">     | BANG  { $$.op = EOpLogicalNot; }
</span><ins>+    | TILDE {
+        ES3_ONLY(&quot;~&quot;, @$, &quot;bit-wise operator&quot;);
+        $$.op = EOpBitwiseNot;
+    }
</ins><span class="cx">     ;
</span><span class="cx"> // Grammar Note:  No '*' or '&amp;' unary ops.  Pointers are not supported.
</span><span class="cx"> 
</span><span class="cx"> multiplicative_expression
</span><span class="cx">     : unary_expression { $$ = $1; }
</span><span class="cx">     | multiplicative_expression STAR unary_expression {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpMul, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;*&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $1;
-        }
</del><ins>+        $$ = context-&gt;addBinaryMath(EOpMul, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     | multiplicative_expression SLASH unary_expression {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpDiv, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;/&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $1;
-        }
</del><ins>+        $$ = context-&gt;addBinaryMath(EOpDiv, $1, $3, @2);
</ins><span class="cx">     }
</span><ins>+    | multiplicative_expression PERCENT unary_expression {
+        ES3_ONLY(&quot;%&quot;, @2, &quot;integer modulus operator&quot;);
+        $$ = context-&gt;addBinaryMath(EOpIMod, $1, $3, @2);
+    }
</ins><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> additive_expression
</span><span class="cx">     : multiplicative_expression { $$ = $1; }
</span><span class="cx">     | additive_expression PLUS multiplicative_expression {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpAdd, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;+&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $1;
-        }
</del><ins>+        $$ = context-&gt;addBinaryMath(EOpAdd, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     | additive_expression DASH multiplicative_expression {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpSub, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;-&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $1;
-        }
</del><ins>+        $$ = context-&gt;addBinaryMath(EOpSub, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> shift_expression
</span><span class="cx">     : additive_expression { $$ = $1; }
</span><ins>+    | shift_expression LEFT_OP additive_expression {
+        ES3_ONLY(&quot;&lt;&lt;&quot;, @2, &quot;bit-wise operator&quot;);
+        $$ = context-&gt;addBinaryMath(EOpBitShiftLeft, $1, $3, @2);
+    }
+    | shift_expression RIGHT_OP additive_expression {
+        ES3_ONLY(&quot;&gt;&gt;&quot;, @2, &quot;bit-wise operator&quot;);
+        $$ = context-&gt;addBinaryMath(EOpBitShiftRight, $1, $3, @2);
+    }
</ins><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> relational_expression
</span><span class="cx">     : shift_expression { $$ = $1; }
</span><span class="cx">     | relational_expression LEFT_ANGLE shift_expression {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpLessThan, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;&lt;&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpLessThan, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     | relational_expression RIGHT_ANGLE shift_expression  {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpGreaterThan, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;&gt;&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpGreaterThan, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     | relational_expression LE_OP shift_expression  {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpLessThanEqual, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;&lt;=&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpLessThanEqual, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     | relational_expression GE_OP shift_expression  {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpGreaterThanEqual, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;&gt;=&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpGreaterThanEqual, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> equality_expression
</span><span class="cx">     : relational_expression { $$ = $1; }
</span><span class="cx">     | equality_expression EQ_OP relational_expression  {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpEqual, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;==&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpEqual, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     | equality_expression NE_OP relational_expression {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpNotEqual, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;!=&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpNotEqual, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> and_expression
</span><span class="cx">     : equality_expression { $$ = $1; }
</span><ins>+    | and_expression AMPERSAND equality_expression {
+        ES3_ONLY(&quot;&amp;&quot;, @2, &quot;bit-wise operator&quot;);
+        $$ = context-&gt;addBinaryMath(EOpBitwiseAnd, $1, $3, @2);
+    }
</ins><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> exclusive_or_expression
</span><span class="cx">     : and_expression { $$ = $1; }
</span><ins>+    | exclusive_or_expression CARET and_expression {
+        ES3_ONLY(&quot;^&quot;, @2, &quot;bit-wise operator&quot;);
+        $$ = context-&gt;addBinaryMath(EOpBitwiseXor, $1, $3, @2);
+    }
</ins><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> inclusive_or_expression
</span><span class="cx">     : exclusive_or_expression { $$ = $1; }
</span><ins>+    | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
+        ES3_ONLY(&quot;|&quot;, @2, &quot;bit-wise operator&quot;);
+        $$ = context-&gt;addBinaryMath(EOpBitwiseOr, $1, $3, @2);
+    }
</ins><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> logical_and_expression
</span><span class="cx">     : inclusive_or_expression { $$ = $1; }
</span><span class="cx">     | logical_and_expression AND_OP inclusive_or_expression {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpLogicalAnd, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;&amp;&amp;&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpLogicalAnd, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> logical_xor_expression
</span><span class="cx">     : logical_and_expression { $$ = $1; }
</span><span class="cx">     | logical_xor_expression XOR_OP logical_and_expression  {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpLogicalXor, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;^^&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpLogicalXor, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> logical_or_expression
</span><span class="cx">     : logical_xor_expression { $$ = $1; }
</span><span class="cx">     | logical_or_expression OR_OP logical_xor_expression  {
</span><del>-        $$ = context-&gt;intermediate.addBinaryMath(EOpLogicalOr, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;||&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            $$ = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), @2);
-        }
</del><ins>+        $$ = context-&gt;addBinaryMathBooleanResult(EOpLogicalOr, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> conditional_expression
</span><span class="cx">     : logical_or_expression { $$ = $1; }
</span><span class="cx">     | logical_or_expression QUESTION expression COLON assignment_expression {
</span><del>-       if (context-&gt;boolErrorCheck(@2, $1))
-            context-&gt;recover();
-
-        $$ = context-&gt;intermediate.addSelection($1, $3, $5, @2);
-        if ($3-&gt;getType() != $5-&gt;getType())
-            $$ = 0;
-
-        if ($$ == 0) {
-            context-&gt;binaryOpError(@2, &quot;:&quot;, $3-&gt;getCompleteString(), $5-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $5;
-        }
</del><ins>+        $$ = context-&gt;addTernarySelection($1, $3, $5, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -739,12 +531,7 @@
</span><span class="cx">     | unary_expression assignment_operator assignment_expression {
</span><span class="cx">         if (context-&gt;lValueErrorCheck(@2, &quot;assign&quot;, $1))
</span><span class="cx">             context-&gt;recover();
</span><del>-        $$ = context-&gt;intermediate.addAssign($2.op, $1, $3, @2);
-        if ($$ == 0) {
-            context-&gt;assignError(@2, &quot;assign&quot;, $1-&gt;getCompleteString(), $3-&gt;getCompleteString());
-            context-&gt;recover();
-            $$ = $1;
-        }
</del><ins>+        $$ = context-&gt;addAssign($2.op, $1, $3, @2);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -752,8 +539,32 @@
</span><span class="cx">     : EQUAL        { $$.op = EOpAssign; }
</span><span class="cx">     | MUL_ASSIGN   { $$.op = EOpMulAssign; }
</span><span class="cx">     | DIV_ASSIGN   { $$.op = EOpDivAssign; }
</span><ins>+    | MOD_ASSIGN   {
+        ES3_ONLY(&quot;%=&quot;, @$, &quot;integer modulus operator&quot;);
+        $$.op = EOpIModAssign;
+    }
</ins><span class="cx">     | ADD_ASSIGN   { $$.op = EOpAddAssign; }
</span><span class="cx">     | SUB_ASSIGN   { $$.op = EOpSubAssign; }
</span><ins>+    | LEFT_ASSIGN {
+        ES3_ONLY(&quot;&lt;&lt;=&quot;, @$, &quot;bit-wise operator&quot;);
+        $$.op = EOpBitShiftLeftAssign;
+    }
+    | RIGHT_ASSIGN {
+        ES3_ONLY(&quot;&gt;&gt;=&quot;, @$, &quot;bit-wise operator&quot;);
+        $$.op = EOpBitShiftRightAssign;
+    }
+    | AND_ASSIGN {
+        ES3_ONLY(&quot;&amp;=&quot;, @$, &quot;bit-wise operator&quot;);
+        $$.op = EOpBitwiseAndAssign;
+    }
+    | XOR_ASSIGN {
+        ES3_ONLY(&quot;^=&quot;, @$, &quot;bit-wise operator&quot;);
+        $$.op = EOpBitwiseXorAssign;
+    }
+    | OR_ASSIGN {
+        ES3_ONLY(&quot;|=&quot;, @$, &quot;bit-wise operator&quot;);
+        $$.op = EOpBitwiseOrAssign;
+    }
</ins><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> expression
</span><span class="lines">@@ -792,7 +603,8 @@
</span><span class="cx">         
</span><span class="cx">         TIntermAggregate *prototype = new TIntermAggregate;
</span><span class="cx">         prototype-&gt;setType(function.getReturnType());
</span><del>-        prototype-&gt;setName(function.getName());
</del><ins>+        prototype-&gt;setName(function.getMangledName());
+        prototype-&gt;setFunctionId(function.getUniqueId());
</ins><span class="cx">         
</span><span class="cx">         for (size_t i = 0; i &lt; function.getParamCount(); i++)
</span><span class="cx">         {
</span><span class="lines">@@ -815,12 +627,13 @@
</span><span class="cx">         context-&gt;symbolTable.pop();
</span><span class="cx">     }
</span><span class="cx">     | init_declarator_list SEMICOLON {
</span><del>-        if ($1.intermAggregate)
-            $1.intermAggregate-&gt;setOp(EOpDeclaration);
-        $$ = $1.intermAggregate;
</del><ins>+        TIntermAggregate *aggNode = $1.intermAggregate;
+        if (aggNode &amp;&amp; aggNode-&gt;getOp() == EOpNull)
+            aggNode-&gt;setOp(EOpDeclaration);
+        $$ = aggNode;
</ins><span class="cx">     }
</span><span class="cx">     | PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
</span><del>-        if (($2 == EbpHigh) &amp;&amp; (context-&gt;shaderType == SH_FRAGMENT_SHADER) &amp;&amp; !context-&gt;fragmentPrecisionHigh) {
</del><ins>+        if (($2 == EbpHigh) &amp;&amp; (context-&gt;shaderType == GL_FRAGMENT_SHADER) &amp;&amp; !context-&gt;fragmentPrecisionHigh) {
</ins><span class="cx">             context-&gt;error(@1, &quot;precision is not supported in fragment shader&quot;, &quot;highp&quot;);
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="lines">@@ -887,7 +700,8 @@
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="cx">             // Insert the unmangled name to detect potential future redefinition as a variable.
</span><del>-            context-&gt;symbolTable.getOuterLevel()-&gt;insert($1-&gt;getName(), *$1);
</del><ins>+            TFunction *function = new TFunction(NewPoolTString($1-&gt;getName().c_str()), $1-&gt;getReturnType());
+            context-&gt;symbolTable.getOuterLevel()-&gt;insertUnmangled(function);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         //
</span><span class="lines">@@ -899,7 +713,7 @@
</span><span class="cx"> 
</span><span class="cx">         // We're at the inner scope level of the function's arguments and body statement.
</span><span class="cx">         // Add the function prototype to the surrounding scope instead.
</span><del>-        context-&gt;symbolTable.getOuterLevel()-&gt;insert(*$$.function);
</del><ins>+        context-&gt;symbolTable.getOuterLevel()-&gt;insert($$.function);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -949,7 +763,7 @@
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         // make sure a sampler is not involved as well...
</span><del>-        if (context-&gt;structQualifierErrorCheck(@2, $1))
</del><ins>+        if (context-&gt;samplerErrorCheck(@2, $1, &quot;samplers can't be function return values&quot;))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><span class="cx">         // Add the function as a prototype after parsing it (we do not support recursion)
</span><span class="lines">@@ -985,7 +799,7 @@
</span><span class="cx">         int size;
</span><span class="cx">         if (context-&gt;arraySizeErrorCheck(@3, $4, size))
</span><span class="cx">             context-&gt;recover();
</span><del>-        $1.setArray(true, size);
</del><ins>+        $1.setArraySize(size);
</ins><span class="cx"> 
</span><span class="cx">         TType* type = new TType($1);
</span><span class="cx">         TParameter param = { $2.string, type };
</span><span class="lines">@@ -1059,16 +873,22 @@
</span><span class="cx">     }
</span><span class="cx">     | init_declarator_list COMMA identifier {
</span><span class="cx">         $$ = $1;
</span><del>-        $$.intermAggregate = context-&gt;parseDeclarator($$.type, $1.intermAggregate, $3.symbol, @3, *$3.string);
</del><ins>+        $$.intermAggregate = context-&gt;parseDeclarator($$.type, $1.intermAggregate, @3, *$3.string);
</ins><span class="cx">     }
</span><del>-    | init_declarator_list COMMA identifier LEFT_BRACKET RIGHT_BRACKET {
</del><ins>+    | init_declarator_list COMMA identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
</ins><span class="cx">         $$ = $1;
</span><del>-        context-&gt;parseArrayDeclarator($$.type, @3, *$3.string, @4, NULL, NULL);
</del><ins>+        $$.intermAggregate = context-&gt;parseArrayDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
</ins><span class="cx">     }
</span><del>-    | init_declarator_list COMMA identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
</del><ins>+    | init_declarator_list COMMA identifier LEFT_BRACKET RIGHT_BRACKET EQUAL initializer {
+        ES3_ONLY(&quot;[]&quot;, @3, &quot;implicitly sized array&quot;);
</ins><span class="cx">         $$ = $1;
</span><del>-        $$.intermAggregate = context-&gt;parseArrayDeclarator($$.type, @3, *$3.string, @4, $1.intermNode, $5);
</del><ins>+        $$.intermAggregate = context-&gt;parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, nullptr, @6, $7);
</ins><span class="cx">     }
</span><ins>+    | init_declarator_list COMMA identifier LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer {
+        ES3_ONLY(&quot;=&quot;, @7, &quot;first-class arrays (array initializer)&quot;);
+        $$ = $1;
+        $$.intermAggregate = context-&gt;parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5, @7, $8);
+    }
</ins><span class="cx">     | init_declarator_list COMMA identifier EQUAL initializer {
</span><span class="cx">         $$ = $1;
</span><span class="cx">         $$.intermAggregate = context-&gt;parseInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
</span><span class="lines">@@ -1084,38 +904,27 @@
</span><span class="cx">         $$.type = $1;
</span><span class="cx">         $$.intermAggregate = context-&gt;parseSingleDeclaration($$.type, @2, *$2.string);
</span><span class="cx">     }
</span><del>-    | fully_specified_type identifier LEFT_BRACKET RIGHT_BRACKET {
-        context-&gt;error(@2, &quot;unsized array declarations not supported&quot;, $2.string-&gt;c_str());
-        context-&gt;recover();
-
-        $$.type = $1;
-        $$.intermAggregate = context-&gt;parseSingleDeclaration($$.type, @2, *$2.string);
-    }
</del><span class="cx">     | fully_specified_type identifier LEFT_BRACKET constant_expression RIGHT_BRACKET {
</span><span class="cx">         $$.type = $1;
</span><span class="cx">         $$.intermAggregate = context-&gt;parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, $4);
</span><span class="cx">     }
</span><ins>+    | fully_specified_type identifier LEFT_BRACKET RIGHT_BRACKET EQUAL initializer {
+        ES3_ONLY(&quot;[]&quot;, @3, &quot;implicitly sized array&quot;);
+        $$.type = $1;
+        $$.intermAggregate = context-&gt;parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, nullptr, @5, $6);
+    }
+    | fully_specified_type identifier LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer {
+        ES3_ONLY(&quot;=&quot;, @6, &quot;first-class arrays (array initializer)&quot;);
+        $$.type = $1;
+        $$.intermAggregate = context-&gt;parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, $4, @6, $7);
+    }
</ins><span class="cx">     | fully_specified_type identifier EQUAL initializer {
</span><span class="cx">         $$.type = $1;
</span><span class="cx">         $$.intermAggregate = context-&gt;parseSingleInitDeclaration($$.type, @2, *$2.string, @3, $4);
</span><span class="cx">     }
</span><span class="cx">     | INVARIANT IDENTIFIER {
</span><del>-        VERTEX_ONLY(&quot;invariant declaration&quot;, @1);
-        if (context-&gt;globalErrorCheck(@1, context-&gt;symbolTable.atGlobalLevel(), &quot;invariant varying&quot;))
-            context-&gt;recover();
-        $$.type.setBasic(EbtInvariant, EvqInvariantVaryingOut, @2);
-        if (!$2.symbol)
-        {
-            context-&gt;error(@2, &quot;undeclared identifier declared as invariant&quot;, $2.string-&gt;c_str());
-            context-&gt;recover();
-            
-            $$.intermAggregate = 0;
-        }
-        else
-        {
-            TIntermSymbol *symbol = context-&gt;intermediate.addSymbol(0, *$2.string, TType($$.type), @2);
-            $$.intermAggregate = context-&gt;intermediate.makeAggregate(symbol, @2);
-        }
</del><ins>+        // $$.type is not used in invariant declarations.
+        $$.intermAggregate = context-&gt;parseInvariantDeclaration(@1, @2, $2.string, $2.symbol);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -1124,9 +933,10 @@
</span><span class="cx">         $$ = $1;
</span><span class="cx"> 
</span><span class="cx">         if ($1.array) {
</span><del>-            context-&gt;error(@1, &quot;not supported&quot;, &quot;first-class array&quot;);
-            context-&gt;recover();
-            $1.setArray(false);
</del><ins>+            ES3_ONLY(&quot;[]&quot;, @1, &quot;first-class-array&quot;);
+            if (context-&gt;shaderVersion != 300) {
+                $1.clearArrayness();
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     | type_qualifier type_specifier  {
</span><span class="lines">@@ -1161,7 +971,7 @@
</span><span class="cx">         ES2_ONLY(&quot;varying&quot;, @1);
</span><span class="cx">         if (context-&gt;globalErrorCheck(@1, context-&gt;symbolTable.atGlobalLevel(), &quot;varying&quot;))
</span><span class="cx">             context-&gt;recover();
</span><del>-        if (context-&gt;shaderType == SH_VERTEX_SHADER)
</del><ins>+        if (context-&gt;shaderType == GL_VERTEX_SHADER)
</ins><span class="cx">             $$.setBasic(EbtVoid, EvqVaryingOut, @1);
</span><span class="cx">         else
</span><span class="cx">             $$.setBasic(EbtVoid, EvqVaryingIn, @1);
</span><span class="lines">@@ -1170,7 +980,7 @@
</span><span class="cx">         ES2_ONLY(&quot;varying&quot;, @1);
</span><span class="cx">         if (context-&gt;globalErrorCheck(@1, context-&gt;symbolTable.atGlobalLevel(), &quot;invariant varying&quot;))
</span><span class="cx">             context-&gt;recover();
</span><del>-        if (context-&gt;shaderType == SH_VERTEX_SHADER)
</del><ins>+        if (context-&gt;shaderType == GL_VERTEX_SHADER)
</ins><span class="cx">             $$.setBasic(EbtVoid, EvqInvariantVaryingOut, @1);
</span><span class="cx">         else
</span><span class="cx">             $$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
</span><span class="lines">@@ -1209,29 +1019,29 @@
</span><span class="cx">     }
</span><span class="cx">     | IN_QUAL {
</span><span class="cx">         ES3_ONLY(&quot;in&quot;, @1, &quot;storage qualifier&quot;);
</span><del>-        $$.qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
</del><ins>+        $$.qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
</ins><span class="cx">     }
</span><span class="cx">     | OUT_QUAL {
</span><span class="cx">         ES3_ONLY(&quot;out&quot;, @1, &quot;storage qualifier&quot;);
</span><del>-        $$.qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
</del><ins>+        $$.qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
</ins><span class="cx">     }
</span><span class="cx">     | CENTROID IN_QUAL {
</span><span class="cx">         ES3_ONLY(&quot;centroid in&quot;, @1, &quot;storage qualifier&quot;);
</span><del>-        if (context-&gt;shaderType == SH_VERTEX_SHADER)
</del><ins>+        if (context-&gt;shaderType == GL_VERTEX_SHADER)
</ins><span class="cx">         {
</span><span class="cx">             context-&gt;error(@1, &quot;invalid storage qualifier&quot;, &quot;it is an error to use 'centroid in' in the vertex shader&quot;);
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><del>-        $$.qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
</del><ins>+        $$.qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
</ins><span class="cx">     }
</span><span class="cx">     | CENTROID OUT_QUAL {
</span><span class="cx">         ES3_ONLY(&quot;centroid out&quot;, @1, &quot;storage qualifier&quot;);
</span><del>-        if (context-&gt;shaderType == SH_FRAGMENT_SHADER)
</del><ins>+        if (context-&gt;shaderType == GL_FRAGMENT_SHADER)
</ins><span class="cx">         {
</span><span class="cx">             context-&gt;error(@1, &quot;invalid storage qualifier&quot;, &quot;it is an error to use 'centroid out' in the fragment shader&quot;);
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><del>-        $$.qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
</del><ins>+        $$.qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
</ins><span class="cx">     }
</span><span class="cx">     | UNIFORM {
</span><span class="cx">         if (context-&gt;globalErrorCheck(@1, context-&gt;symbolTable.atGlobalLevel(), &quot;uniform&quot;))
</span><span class="lines">@@ -1254,6 +1064,11 @@
</span><span class="cx">     | precision_qualifier type_specifier_no_prec {
</span><span class="cx">         $$ = $2;
</span><span class="cx">         $$.precision = $1;
</span><ins>+
+        if (!SupportsPrecision($2.type)) {
+            context-&gt;error(@1, &quot;illegal type for precision qualifier&quot;, getBasicString($2.type));
+            context-&gt;recover();
+        }
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -1301,6 +1116,11 @@
</span><span class="cx">     : type_specifier_nonarray {
</span><span class="cx">         $$ = $1;
</span><span class="cx">     }
</span><ins>+    | type_specifier_nonarray LEFT_BRACKET RIGHT_BRACKET {
+        ES3_ONLY(&quot;[]&quot;, @2, &quot;implicitly sized array&quot;);
+        $$ = $1;
+        $$.setArraySize(0);
+    }
</ins><span class="cx">     | type_specifier_nonarray LEFT_BRACKET constant_expression RIGHT_BRACKET {
</span><span class="cx">         $$ = $1;
</span><span class="cx"> 
</span><span class="lines">@@ -1310,7 +1130,7 @@
</span><span class="cx">             int size;
</span><span class="cx">             if (context-&gt;arraySizeErrorCheck(@2, $3, size))
</span><span class="cx">                 context-&gt;recover();
</span><del>-            $$.setArray(true, size);
</del><ins>+            $$.setArraySize(size);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     ;
</span><span class="lines">@@ -1618,12 +1438,14 @@
</span><span class="cx">     | simple_statement    { $$ = $1; }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><del>-// Grammar Note:  No labeled statements; 'goto' is not supported.
</del><ins>+// Grammar Note:  Labeled statements for SWITCH only; 'goto' is not supported.
</ins><span class="cx"> 
</span><span class="cx"> simple_statement
</span><span class="cx">     : declaration_statement { $$ = $1; }
</span><span class="cx">     | expression_statement  { $$ = $1; }
</span><span class="cx">     | selection_statement   { $$ = $1; }
</span><ins>+    | switch_statement      { $$ = $1; }
+    | case_label            { $$ = $1; }
</ins><span class="cx">     | iteration_statement   { $$ = $1; }
</span><span class="cx">     | jump_statement        { $$ = $1; }
</span><span class="cx">     ;
</span><span class="lines">@@ -1696,8 +1518,22 @@
</span><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><del>-// Grammar Note:  No 'switch'.  Switch statements not supported.
</del><ins>+switch_statement
+    : SWITCH LEFT_PAREN expression RIGHT_PAREN { ++context-&gt;mSwitchNestingLevel; } compound_statement {
+        $$ = context-&gt;addSwitch($3, $6, @1);
+        --context-&gt;mSwitchNestingLevel;
+    }
+    ;
</ins><span class="cx"> 
</span><ins>+case_label
+    : CASE constant_expression COLON {
+        $$ = context-&gt;addCase($2, @1);
+    }
+    | DEFAULT COLON {
+        $$ = context-&gt;addDefault(@1);
+    }
+    ;
+
</ins><span class="cx"> condition
</span><span class="cx">     // In 1996 c++ draft, conditions can include single declarations
</span><span class="cx">     : expression {
</span><span class="lines">@@ -1706,13 +1542,11 @@
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">     }
</span><span class="cx">     | fully_specified_type identifier EQUAL initializer {
</span><del>-        TIntermNode* intermNode;
-        if (context-&gt;structQualifierErrorCheck(@2, $1))
-            context-&gt;recover();
</del><ins>+        TIntermNode *intermNode;
</ins><span class="cx">         if (context-&gt;boolErrorCheck(@2, $1))
</span><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><del>-        if (!context-&gt;executeInitializer(@2, *$2.string, $1, $4, intermNode))
</del><ins>+        if (!context-&gt;executeInitializer(@2, *$2.string, $1, $4, &amp;intermNode))
</ins><span class="cx">             $$ = $4;
</span><span class="cx">         else {
</span><span class="cx">             context-&gt;recover();
</span><span class="lines">@@ -1722,22 +1556,22 @@
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> iteration_statement
</span><del>-    : WHILE LEFT_PAREN { context-&gt;symbolTable.push(); ++context-&gt;loopNestingLevel; } condition RIGHT_PAREN statement_no_new_scope {
</del><ins>+    : WHILE LEFT_PAREN { context-&gt;symbolTable.push(); ++context-&gt;mLoopNestingLevel; } condition RIGHT_PAREN statement_no_new_scope {
</ins><span class="cx">         context-&gt;symbolTable.pop();
</span><span class="cx">         $$ = context-&gt;intermediate.addLoop(ELoopWhile, 0, $4, 0, $6, @1);
</span><del>-        --context-&gt;loopNestingLevel;
</del><ins>+        --context-&gt;mLoopNestingLevel;
</ins><span class="cx">     }
</span><del>-    | DO { ++context-&gt;loopNestingLevel; } statement_with_scope WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
</del><ins>+    | DO { ++context-&gt;mLoopNestingLevel; } statement_with_scope WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
</ins><span class="cx">         if (context-&gt;boolErrorCheck(@8, $6))
</span><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><span class="cx">         $$ = context-&gt;intermediate.addLoop(ELoopDoWhile, 0, $6, 0, $3, @4);
</span><del>-        --context-&gt;loopNestingLevel;
</del><ins>+        --context-&gt;mLoopNestingLevel;
</ins><span class="cx">     }
</span><del>-    | FOR LEFT_PAREN { context-&gt;symbolTable.push(); ++context-&gt;loopNestingLevel; } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
</del><ins>+    | FOR LEFT_PAREN { context-&gt;symbolTable.push(); ++context-&gt;mLoopNestingLevel; } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
</ins><span class="cx">         context-&gt;symbolTable.pop();
</span><span class="cx">         $$ = context-&gt;intermediate.addLoop(ELoopFor, $4, reinterpret_cast&lt;TIntermTyped*&gt;($5.node1), reinterpret_cast&lt;TIntermTyped*&gt;($5.node2), $7, @1);
</span><del>-        --context-&gt;loopNestingLevel;
</del><ins>+        --context-&gt;mLoopNestingLevel;
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -1772,40 +1606,20 @@
</span><span class="cx"> 
</span><span class="cx"> jump_statement
</span><span class="cx">     : CONTINUE SEMICOLON {
</span><del>-        if (context-&gt;loopNestingLevel &lt;= 0) {
-            context-&gt;error(@1, &quot;continue statement only allowed in loops&quot;, &quot;&quot;);
-            context-&gt;recover();
-        }
-        $$ = context-&gt;intermediate.addBranch(EOpContinue, @1);
</del><ins>+        $$ = context-&gt;addBranch(EOpContinue, @1);
</ins><span class="cx">     }
</span><span class="cx">     | BREAK SEMICOLON {
</span><del>-        if (context-&gt;loopNestingLevel &lt;= 0) {
-            context-&gt;error(@1, &quot;break statement only allowed in loops&quot;, &quot;&quot;);
-            context-&gt;recover();
-        }
-        $$ = context-&gt;intermediate.addBranch(EOpBreak, @1);
</del><ins>+        $$ = context-&gt;addBranch(EOpBreak, @1);
</ins><span class="cx">     }
</span><span class="cx">     | RETURN SEMICOLON {
</span><del>-        $$ = context-&gt;intermediate.addBranch(EOpReturn, @1);
-        if (context-&gt;currentFunctionType-&gt;getBasicType() != EbtVoid) {
-            context-&gt;error(@1, &quot;non-void function must return a value&quot;, &quot;return&quot;);
-            context-&gt;recover();
-        }
</del><ins>+        $$ = context-&gt;addBranch(EOpReturn, @1);
</ins><span class="cx">     }
</span><span class="cx">     | RETURN expression SEMICOLON {
</span><del>-        $$ = context-&gt;intermediate.addBranch(EOpReturn, $2, @1);
-        context-&gt;functionReturnsValue = true;
-        if (context-&gt;currentFunctionType-&gt;getBasicType() == EbtVoid) {
-            context-&gt;error(@1, &quot;void function cannot return a value&quot;, &quot;return&quot;);
-            context-&gt;recover();
-        } else if (*(context-&gt;currentFunctionType) != $2-&gt;getType()) {
-            context-&gt;error(@1, &quot;function return is not matching type:&quot;, &quot;return&quot;);
-            context-&gt;recover();
-        }
</del><ins>+        $$ = context-&gt;addBranch(EOpReturn, $2, @1);
</ins><span class="cx">     }
</span><span class="cx">     | DISCARD SEMICOLON {
</span><span class="cx">         FRAG_ONLY(&quot;discard&quot;, @1);
</span><del>-        $$ = context-&gt;intermediate.addBranch(EOpKill, @1);
</del><ins>+        $$ = context-&gt;addBranch(EOpKill, @1);
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -1857,6 +1671,12 @@
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         prevDec-&gt;setDefined();
</span><ins>+        //
+        // Overload the unique ID of the definition to be the same unique ID as the declaration.
+        // Eventually we will probably want to have only a single definition and just swap the
+        // arguments to be the definition's arguments.
+        //
+        function-&gt;setUniqueId(prevDec-&gt;getUniqueId());
</ins><span class="cx"> 
</span><span class="cx">         //
</span><span class="cx">         // Raise error message if main function takes any parameters or return anything other than void
</span><span class="lines">@@ -1876,7 +1696,7 @@
</span><span class="cx">         // Remember the return type for later checking for RETURN statements.
</span><span class="cx">         //
</span><span class="cx">         context-&gt;currentFunctionType = &amp;(prevDec-&gt;getReturnType());
</span><del>-        context-&gt;functionReturnsValue = false;
</del><ins>+        context-&gt;mFunctionReturnsValue = false;
</ins><span class="cx"> 
</span><span class="cx">         //
</span><span class="cx">         // Insert parameters into the symbol table.
</span><span class="lines">@@ -1894,7 +1714,7 @@
</span><span class="cx">                 //
</span><span class="cx">                 // Insert the parameters with name in the symbol table.
</span><span class="cx">                 //
</span><del>-                if (! context-&gt;symbolTable.declare(*variable)) {
</del><ins>+                if (! context-&gt;symbolTable.declare(variable)) {
</ins><span class="cx">                     context-&gt;error(@1, &quot;redefinition&quot;, variable-&gt;getName().c_str());
</span><span class="cx">                     context-&gt;recover();
</span><span class="cx">                     delete variable;
</span><span class="lines">@@ -1915,12 +1735,12 @@
</span><span class="cx">         }
</span><span class="cx">         context-&gt;intermediate.setAggregateOperator(paramNodes, EOpParameters, @1);
</span><span class="cx">         $1.intermAggregate = paramNodes;
</span><del>-        context-&gt;loopNestingLevel = 0;
</del><ins>+        context-&gt;mLoopNestingLevel = 0;
</ins><span class="cx">     }
</span><span class="cx">     compound_statement_no_new_scope {
</span><span class="cx">         //?? Check that all paths return a value if return type != void ?
</span><span class="cx">         //   May be best done as post process phase on intermediate code
</span><del>-        if (context-&gt;currentFunctionType-&gt;getBasicType() != EbtVoid &amp;&amp; ! context-&gt;functionReturnsValue) {
</del><ins>+        if (context-&gt;currentFunctionType-&gt;getBasicType() != EbtVoid &amp;&amp; ! context-&gt;mFunctionReturnsValue) {
</ins><span class="cx">             context-&gt;error(@1, &quot;function does not return a value:&quot;, &quot;&quot;, $1.function-&gt;getName().c_str());
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="lines">@@ -1929,6 +1749,7 @@
</span><span class="cx">         context-&gt;intermediate.setAggregateOperator($$, EOpFunction, @1);
</span><span class="cx">         $$-&gt;getAsAggregate()-&gt;setName($1.function-&gt;getMangledName().c_str());
</span><span class="cx">         $$-&gt;getAsAggregate()-&gt;setType($1.function-&gt;getReturnType());
</span><ins>+        $$-&gt;getAsAggregate()-&gt;setFunctionId($1.function-&gt;getUniqueId());
</ins><span class="cx"> 
</span><span class="cx">         // store the pragma information for debug and optimize and other vendor specific
</span><span class="cx">         // information. This information can be queried from the parse tree
</span><span class="lines">@@ -1942,5 +1763,5 @@
</span><span class="cx"> %%
</span><span class="cx"> 
</span><span class="cx"> int glslang_parse(TParseContext* context) {
</span><del>-    return yyparse(context);
</del><ins>+    return yyparse(context, context-&gt;scanner);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_lexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_lex.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -13,19 +13,19 @@
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wunused-variable&quot;
</span><span class="cx"> #pragma GCC diagnostic ignored &quot;-Wswitch-enum&quot;
</span><span class="cx"> #elif defined(_MSC_VER)
</span><ins>+#pragma warning(disable: 4005)
</ins><span class="cx"> #pragma warning(disable: 4065)
</span><span class="cx"> #pragma warning(disable: 4189)
</span><ins>+#pragma warning(disable: 4244)
</ins><span class="cx"> #pragma warning(disable: 4505)
</span><span class="cx"> #pragma warning(disable: 4701)
</span><ins>+#pragma warning(disable: 4702)
</ins><span class="cx"> #endif
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wunknown-pragmas&quot;
-#pragma clang diagnostic ignored &quot;-Wdeprecated-register&quot;
-#endif
</del><span class="cx"> 
</span><del>-#line 25 &quot;./glslang_lex.cpp&quot;
</del><span class="cx"> 
</span><ins>+
+#line 28 &quot;./glslang_lex.cpp&quot;
+
</ins><span class="cx"> #define  YY_INT_ALIGNED short int
</span><span class="cx"> 
</span><span class="cx"> /* A lexical scanner generated by flex */
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> #define FLEX_SCANNER
</span><span class="cx"> #define YY_FLEX_MAJOR_VERSION 2
</span><span class="cx"> #define YY_FLEX_MINOR_VERSION 5
</span><del>-#define YY_FLEX_SUBMINOR_VERSION 37
</del><ins>+#define YY_FLEX_SUBMINOR_VERSION 39
</ins><span class="cx"> #if YY_FLEX_SUBMINOR_VERSION &gt; 0
</span><span class="cx"> #define FLEX_BETA
</span><span class="cx"> #endif
</span><span class="lines">@@ -224,6 +224,13 @@
</span><span class="cx">                     if ( yytext[yyl] == '\n' )\
</span><span class="cx">                         --yylineno;\
</span><span class="cx">             }while(0)
</span><ins>+    #define YY_LINENO_REWIND_TO(dst) \
+            do {\
+                const char *p;\
+                for ( p = yy_cp-1; p &gt;= (dst); --p)\
+                    if ( *p == '\n' )\
+                        --yylineno;\
+            }while(0)
</ins><span class="cx">     
</span><span class="cx"> /* Return all but the first &quot;n&quot; matched characters back to the input stream. */
</span><span class="cx"> #define yyless(n) \
</span><span class="lines">@@ -393,8 +400,8 @@
</span><span class="cx">         *yy_cp = '\0'; \
</span><span class="cx">         yyg-&gt;yy_c_buf_p = yy_cp;
</span><span class="cx"> 
</span><del>-#define YY_NUM_RULES 237
-#define YY_END_OF_BUFFER 238
</del><ins>+#define YY_NUM_RULES 239
+#define YY_END_OF_BUFFER 240
</ins><span class="cx"> /* This struct is not used in this scanner,
</span><span class="cx">    but its presence is necessary. */
</span><span class="cx"> struct yy_trans_info
</span><span class="lines">@@ -402,98 +409,98 @@
</span><span class="cx">         flex_int32_t yy_verify;
</span><span class="cx">         flex_int32_t yy_nxt;
</span><span class="cx">         };
</span><del>-static yyconst flex_int16_t yy_accept[813] =
</del><ins>+static yyconst flex_int16_t yy_accept[819] =
</ins><span class="cx">     {   0,
</span><del>-        0,    0,  238,  236,  235,  235,  222,  228,  233,  217,
-      218,  226,  225,  214,  223,  221,  227,  180,  180,  215,
-      211,  229,  216,  230,  234,  177,  219,  220,  232,  177,
</del><ins>+        0,    0,    0,    0,  240,  238,  237,  237,  222,  228,
+      233,  217,  218,  226,  225,  214,  223,  221,  227,  180,
+      180,  215,  211,  229,  216,  230,  234,  177,  219,  220,
+      232,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</ins><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><del>-      177,  177,  177,  177,  177,  177,  177,  177,  177,  212,
-      231,  213,  224,  208,  194,  213,  202,  197,  192,  200,
-      190,  201,  191,  186,  193,  185,  179,  180,    0,  183,
-        0,  220,  212,  219,  209,  205,  207,  206,  210,  177,
-      198,  204,  177,  177,  177,  177,  177,  177,  177,  177,
-      177,  177,  177,  177,   12,  177,  177,  177,  177,  177,
</del><ins>+      177,  212,  231,  213,  224,  236,  239,  235,  208,  194,
+      213,  202,  197,  192,  200,  190,  201,  191,  186,  193,
+      185,  179,  180,    0,  183,    0,  220,  212,  219,  209,
+      205,  207,  206,  210,  177,  198,  204,  177,  177,  177,
+      177,  177,  177,  177,  177,  177,  177,  177,  177,   12,
</ins><span class="cx"> 
</span><del>-      177,  177,  177,  177,  177,  177,  177,  177,   15,  177,
-      177,   23,  177,  177,  177,  177,  177,  177,  177,  177,
</del><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><ins>+      177,  177,  177,   15,  177,  177,   23,  177,  177,  177,
</ins><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><del>-      177,  177,  177,  177,  177,  199,  203,    0,  189,  185,
-        0,  188,  182,    0,  184,  178,  195,  196,  177,  136,
</del><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><del>-      177,  177,  177,   13,  177,  177,  177,  177,  177,  177,
-      177,  177,  177,  177,   27,  177,  177,  177,  177,  177,
</del><ins>+      199,  203,  235,    0,  189,  185,    0,  188,  182,    0,
+      184,  178,  195,  196,  177,  136,  177,  177,  177,  177,
+      177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,  177,  177,  177,  177,  177,   13,
+      177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</ins><span class="cx"> 
</span><del>-      177,  177,  177,  177,  177,  177,   24,  177,  177,  177,
</del><ins>+       27,  177,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,   24,  177,  177,  177,  177,  177,  177,  177,
</ins><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><ins>+      177,  177,  177,  177,  177,  177,  177,    0,  186,    0,
+      185,  187,  181,  177,  177,  177,   30,  177,  177,   18,
+      174,  177,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,   16,  139,  177,  177,  177,  177,   21,  177,  177,
+      143,  155,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,  152,    4,   35,   36,   37,  177,
+
</ins><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><del>-      177,    0,  186,    0,  185,  187,  181,  177,  177,  177,
-       30,  177,  177,   18,  174,  177,  177,  177,  177,  177,
-      177,  177,  177,  177,  177,   16,  139,  177,  177,  177,
-      177,   21,  177,  177,  143,  155,  177,  177,  177,  177,
-      177,  177,  177,  177,  177,  177,  177,  177,  152,    4,
-       35,   36,   37,  177,  177,  177,  177,  177,  177,  177,
</del><ins>+      177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  142,   31,  177,  177,   28,  177,  177,
+      177,  177,  177,  177,  177,   47,   48,   49,   29,  177,
+      177,  177,  177,  177,  177,   10,   53,   54,   55,  177,
+      137,  177,  177,    7,  177,  177,  177,  177,  164,  165,
+      166,  177,   32,  177,  156,   26,  167,  168,  169,    2,
+      161,  162,  163,  177,  177,  177,   25,  159,  177,  177,
+      177,   50,   51,   52,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,  177,   86,  177,  177,  177,  177,
</ins><span class="cx"> 
</span><ins>+      177,  177,  177,  153,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,  177,  138,  177,  177,  176,   56,
+       57,   58,  177,  177,   14,  177,   91,  177,  177,  177,
+      177,   89,  177,  177,  177,  154,  149,   92,  177,  177,
+      177,  177,  177,  177,  144,  177,  177,  177,   78,   38,
+       41,   43,   42,   39,   45,   44,   46,   40,  177,  177,
+      177,  177,  160,  135,  177,  177,  147,  177,  177,  177,
+       34,   87,  173,   22,  148,   77,  177,  158,   17,  177,
</ins><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><del>-      177,  177,  177,  177,  177,  177,  177,  142,   31,  177,
-      177,   28,  177,  177,  177,  177,  177,  177,  177,   47,
-       48,   49,   29,  177,  177,  177,  177,  177,  177,   10,
-       53,   54,   55,  177,  137,  177,  177,    7,  177,  177,
-      177,  177,  164,  165,  166,  177,   32,  177,  156,   26,
-      167,  168,  169,    2,  161,  162,  163,  177,  177,  177,
-       25,  159,  177,  177,  177,   50,   51,   52,  177,  177,
-      177,  177,  177,  177,  177,  177,  177,  177,  177,   86,
-      177,  177,  177,  177,  177,  177,  177,  153,  177,  177,
</del><ins>+      177,  177,  177,   19,   33,  177,  177,  177,  177,  177,
</ins><span class="cx"> 
</span><del>-      177,  177,  177,  177,  177,  177,  177,  177,  177,  138,
-      177,  177,  176,   56,   57,   58,  177,  177,   14,  177,
-       91,  177,  177,  177,  177,   89,  177,  177,  177,  154,
-      149,   92,  177,  177,  177,  177,  177,  177,  144,  177,
-      177,  177,   78,   38,   41,   43,   42,   39,   45,   44,
-       46,   40,  177,  177,  177,  177,  160,  135,  177,  177,
-      147,  177,  177,  177,   34,   87,  173,   22,  148,   77,
-      177,  158,   17,  177,  177,  177,  177,  177,  177,  177,
-      177,  177,  177,  177,  177,  177,  177,   19,   33,  177,
-      177,  177,  177,  177,  177,   93,   94,   95,  177,  177,
-
-      177,  177,  177,    3,  177,  177,  177,  177,  177,  177,
-      177,  177,  177,  177,  177,  140,  177,  177,  177,  177,
-      177,    8,  177,  177,    9,  177,  177,  177,  177,   20,
-       79,   11,  150,   97,   98,   99,  177,  177,  177,  177,
-      177,  177,  177,  177,  177,  177,  177,  177,  145,  177,
-      177,  177,   81,   83,   80,  177,  177,  177,  177,  177,
-      177,  177,  141,  101,  102,  103,  177,  177,  157,  177,
-      146,  177,  177,    6,  177,  177,  177,  177,  177,  177,
-      177,  177,  177,   96,  151,    1,  177,  177,  177,  177,
-      177,  175,  177,   90,    5,  170,   59,   62,  177,  177,
-
</del><ins>+      177,   93,   94,   95,  177,  177,  177,  177,  177,    3,
</ins><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><del>-      177,   82,  177,  177,  177,  177,  100,  177,  177,  177,
-      177,  177,  120,   66,   67,  177,  177,  177,  177,  177,
-      177,  177,  177,  177,  177,  177,  177,  177,   88,  177,
-      177,  177,  104,  122,   70,   71,  177,  177,   84,  177,
-      177,  177,  177,  177,  177,  177,  115,  177,  177,  177,
-      177,  177,  177,  177,  177,  177,  177,  129,  177,  177,
-      177,  177,   60,  177,  177,  177,  177,  177,  177,  177,
-      177,  177,  177,  177,  177,  116,  105,  177,  106,  177,
-      177,  177,  130,  177,  177,   68,  177,  177,  177,  177,
</del><ins>+      177,  140,  177,  177,  177,  177,  177,    8,  177,  177,
+        9,  177,  177,  177,  177,   20,   79,   11,  150,   97,
+       98,   99,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,  145,  177,  177,  177,   81,   83,
+       80,  177,  177,  177,  177,  177,  177,  177,  141,  101,
+      102,  103,  177,  177,  157,  177,  146,  177,  177,    6,
+      177,  177,  177,  177,  177,  177,  177,  177,  177,   96,
+      151,    1,  177,  177,  177,  177,  177,  175,  177,   90,
</ins><span class="cx"> 
</span><del>-      177,  177,  177,  177,  177,  177,  177,  177,  177,  117,
-      177,  177,  131,  177,  177,   72,  107,  108,  177,  111,
-      177,  112,  177,  177,  177,  177,  177,   85,  177,  177,
-      177,  177,   64,  177,   63,  126,  177,  177,  109,  110,
</del><ins>+        5,  170,   59,   62,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,  177,  177,  177,   82,  177,  177,
+      177,  177,  100,  177,  177,  177,  177,  177,  120,   66,
+       67,  177,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,   88,  177,  177,  177,  104,  122,
+       70,   71,  177,  177,   84,  177,  177,  177,  177,  177,
+      177,  177,  115,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  129,  177,  177,  177,  177,   60,  177,
</ins><span class="cx">       177,  177,  177,  177,  177,  177,  177,  177,  177,  177,
</span><del>-      124,  127,  118,  177,   65,  177,  177,  177,  177,  177,
-      177,  177,  177,  125,  128,  177,  177,  121,   69,  177,
-      177,  171,  177,  177,  177,   74,  177,  177,  123,   73,
-      177,  177,  177,  177,  177,  177,  132,  177,  177,  177,
-      177,  177,  177,  133,  177,  177,  177,   75,  177,  134,
</del><ins>+      177,  116,  105,  177,  106,  177,  177,  177,  130,  177,
</ins><span class="cx"> 
</span><del>-      113,  114,  177,  177,  177,   61,  177,  177,  172,  119,
-       76,    0
</del><ins>+      177,   68,  177,  177,  177,  177,  177,  177,  177,  177,
+      177,  177,  177,  177,  177,  117,  177,  177,  131,  177,
+      177,   72,  107,  108,  177,  111,  177,  112,  177,  177,
+      177,  177,  177,   85,  177,  177,  177,  177,   64,  177,
+       63,  126,  177,  177,  109,  110,  177,  177,  177,  177,
+      177,  177,  177,  177,  177,  177,  124,  127,  118,  177,
+       65,  177,  177,  177,  177,  177,  177,  177,  177,  125,
+      128,  177,  177,  121,   69,  177,  177,  171,  177,  177,
+      177,   74,  177,  177,  123,   73,  177,  177,  177,  177,
+      177,  177,  132,  177,  177,  177,  177,  177,  177,  133,
+
+      177,  177,  177,   75,  177,  134,  113,  114,  177,  177,
+      177,   61,  177,  177,  172,  119,   76,    0
</ins><span class="cx">     } ;
</span><span class="cx"> 
</span><span class="cx"> static yyconst flex_int32_t yy_ec[256] =
</span><span class="lines">@@ -540,311 +547,320 @@
</span><span class="cx">         1,    1
</span><span class="cx">     } ;
</span><span class="cx"> 
</span><del>-static yyconst flex_int16_t yy_base[817] =
</del><ins>+static yyconst flex_int16_t yy_base[824] =
</ins><span class="cx">     {   0,
</span><del>-        0,    0,  941,  942,  942,  942,  915,   48,   69,  942,
-      942,  914,   66,  942,   65,   63,  913,   82,  136,  911,
-      942,   82,  911,   60,  942,    0,  942,  942,   67,   58,
-       51,   68,   75,   61,  105,  877,  114,   79,   67,   44,
-       89,  871,  101,  884,  121,  127,  136,  143,   36,  942,
-      112,  942,  942,  942,  942,  942,  942,  942,  942,  942,
-      942,  942,  942,  158,  942,  163,  163,    0,  199,  942,
-        0,  942,  942,  942,  907,  942,  942,  942,  906,    0,
-      942,  942,  868,  873,   80,  870,  878,  877,  864,  867,
-      878,  171,  872,  860,  857,  870,  857,  854,  854,  860,
</del><ins>+        0,    0,   72,    0, 1016, 1017, 1017, 1017,  990,  120,
+      141, 1017, 1017,  989,  138, 1017,  137,  135,  988,  154,
+      208,  986, 1017,  154,  986,  132, 1017,    0, 1017, 1017,
+      139,  130,  123,  140,  147,  133,  177,  952,  186,  151,
+      139,  116,  161,  946,  173,  959,  193,  199,  208,  215,
+      108, 1017,  184, 1017, 1017, 1017, 1017,    0, 1017, 1017,
+     1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017,  230, 1017,
+      235,  235,    0,  271, 1017,    0, 1017, 1017, 1017,  982,
+     1017, 1017, 1017,  981,    0, 1017, 1017,  943,  948,  152,
+      945,  953,  952,  939,  942,  953,  243,  947,  935,  932,
</ins><span class="cx"> 
</span><del>-       75,  176,  854,  864,  850,  856,  859,  860,    0,  852,
-      862,  177,  861,  856,  837,  105,  841,  854,  845,  112,
-      838,  178,  850,  852,  185,  841,  838,  827,  836,  177,
-      185,  840,  836,  838,  827,  830,  124,  145,  197,  839,
-      827,  839,  190,  832,  831,  942,  942,  239,  942,  220,
-      256,  942,  942,  263,  270,  185,  942,  942,  830,    0,
-      826,  821,  825,  834,  831,  243,  815,  815,  826,  818,
-      143,  828,  825,  825,  823,  820,  812,  818,  805,  803,
-      815,  801,  817,    0,  814,  802,  809,  806,  810,  811,
-      804,  801,  790,  789,  802,  805,  793,  801,  789,  795,
</del><ins>+      945,  932,  929,  929,  935,  147,  248,  929,  939,  925,
+      931,  934,  935,    0,  927,  937,  249,  936,  931,  912,
+      177,  916,  929,  920,  184,  913,  250,  925,  927,  257,
+      916,  913,  902,  911,  249,  257,  915,  911,  913,  902,
+      905,  196,  217,  269,  914,  902,  914,  262,  907,  906,
+     1017, 1017,    0,  311, 1017,  292,  328, 1017, 1017,  335,
+      342,  257, 1017, 1017,  905,    0,  901,  896,  900,  909,
+      906,  315,  890,  890,  901,  893,  215,  903,  900,  900,
+      898,  895,  887,  893,  880,  878,  890,  876,  892,    0,
+      889,  877,  884,  881,  885,  886,  879,  876,  865,  864,
</ins><span class="cx"> 
</span><del>-      786,  244,  791,  794,  785,  792,  781,  785,  776,  790,
-      789,  780,  786,  235,  770,  773,  771,  781,  771,  766,
-      764,  766,  776,  762,  764,  761,  772,  771,  774,  756,
-      244,  764,  760,  758,  767,  746,  281,  764,  766,  755,
-      747,  291,  298,  306,  317,  942,  942,  744,  754,  753,
-        0,  751,  311,    0,    0,  744,  742,  742,  743,  738,
-      746,  735,  752,  741,  322,    0,    0,  735,  745,  744,
-      744,    0,  729,  325,    0,    0,  731,  328,  738,  739,
-      730,  724,  723,  724,  723,  723,  334,  718,    0,    0,
-      714,  713,  712,  714,  715,  720,  714,  710,  723,  718,
</del><ins>+      877,  880,  868,  876,  864,  870,  861,  316,  866,  869,
+      860,  867,  856,  860,  851,  865,  864,  855,  861,  307,
+      845,  848,  846,  856,  846,  841,  839,  841,  851,  837,
+      839,  836,  847,  846,  849,  831,  316,  839,  835,  833,
+      842,  821,  353,  839,  841,  830,  822,  363,  370,  378,
+      389, 1017, 1017,  819,  829,  828,    0,  826,  383,    0,
+        0,  819,  817,  817,  818,  813,  821,  810,  827,  816,
+      394,    0,    0,  810,  820,  819,  819,    0,  804,  397,
+        0,    0,  806,  400,  813,  814,  805,  799,  798,  799,
+      798,  798,  406,  793,    0,    0,  789,  788,  787,  789,
</ins><span class="cx"> 
</span><del>-      718,  716,  715,  709,  703,  705,  704,  708,  700,  703,
-      698,  706,  711,  699,  696,  708,  699,    0,    0,  705,
-      701,    0,  693,  693,  698,  689,  696,  337,  693,    0,
-        0,    0,    0,  683,  695,  694,  693,  694,  694,    0,
-        0,    0,    0,  681,    0,  689,  680,    0,  679,  680,
-      674,  684,    0,    0,    0,  675,    0,  671,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  681,  341,  680,
-        0,    0,  678,  674,  671,    0,    0,    0,  663,  343,
-      346,  355,  668,  664,  669,  660,  658,  671,  656,    0,
-      656,  669,  658,  654,  660,  655,  662,    0,  660,  657,
</del><ins>+      790,  795,  789,  785,  798,  793,  793,  791,  790,  784,
+      778,  780,  779,  783,  775,  778,  773,  781,  786,  774,
+      771,  783,  774,    0,    0,  780,  776,    0,  768,  768,
+      773,  764,  771,  409,  768,    0,    0,    0,    0,  758,
+      770,  769,  768,  769,  769,    0,    0,    0,    0,  756,
+        0,  764,  755,    0,  754,  755,  749,  759,    0,    0,
+        0,  750,    0,  746,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,  756,  413,  755,    0,    0,  753,  749,
+      746,    0,    0,    0,  738,  415,  418,  427,  743,  739,
+      744,  735,  733,  746,  731,    0,  731,  744,  733,  729,
</ins><span class="cx"> 
</span><del>-      661,  645,  643,  646,  652,  658,  653,  652,  640,    0,
-      642,  643,    0,    0,    0,    0,  640,  643,    0,  637,
-        0,  650,  630,  639,  634,    0,  627,  627,  640,    0,
-      642,    0,  359,  655,  654,  653,  620,  619,    0,  636,
-      635,  630,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  619,  632,  619,  616,    0,    0,  621,  620,
-        0,  617,  624,  623,    0,  609,    0,    0,    0,    0,
-      606,    0,    0,  605,  616,  362,  609,  615,  614,  611,
-      606,  603,  596,  596,  609,  594,  606,    0,    0,  599,
-      622,  621,  620,  587,  586,  355,  356,    0,  598,  601,
</del><ins>+      735,  730,  737,    0,  735,  732,  736,  720,  718,  721,
+      727,  733,  728,  727,  715,    0,  717,  718,    0,    0,
+        0,    0,  715,  718,    0,  712,    0,  725,  705,  714,
+      709,    0,  702,  702,  715,    0,  717,    0,  431,  730,
+      729,  728,  695,  694,    0,  711,  710,  705,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,  694,  707,
+      694,  691,    0,    0,  696,  695,    0,  692,  699,  698,
+        0,  684,    0,    0,    0,    0,  681,    0,    0,  680,
+      691,  434,  684,  690,  689,  686,  681,  678,  671,  671,
+      684,  669,  681,    0,    0,  674,  697,  696,  695,  662,
</ins><span class="cx"> 
</span><del>-      599,  588,  584,    0,  596,  593,  592,  582,  581,  571,
-      588,  574,  369,  582,  585,    0,  602,  601,  600,  567,
-      566,    0,  580,  567,    0,  577,  570,  571,  574,    0,
-        0,    0,    0,  594,  593,    0,  570,  573,  558,  565,
-      556,  563,  564,  564,  563,  549,  379,  561,    0,  562,
-      551,  550,    0,    0,    0,  575,  574,  573,  540,  539,
-      535,  543,    0,  571,  570,    0,  547,  550,    0,  386,
-        0,  528,  537,    0,  533,  532,  541,  541,  529,  543,
-      527,  541,  536,    0,    0,    0,  553,  552,  551,  518,
-      517,    0,  517,    0,    0,  362,  382,  541,  527,  530,
</del><ins>+      661,  427,  428,    0,  673,  676,  674,  663,  659,    0,
+      671,  668,  667,  657,  656,  646,  663,  649,  441,  657,
+      660,    0,  677,  676,  675,  642,  641,    0,  655,  642,
+        0,  652,  645,  646,  649,    0,    0,    0,    0,  669,
+      668,    0,  645,  648,  633,  640,  631,  638,  639,  639,
+      638,  624,  451,  636,    0,  637,  626,  625,    0,    0,
+        0,  650,  649,  648,  615,  614,  610,  618,    0,  646,
+      645,    0,  622,  625,    0,  458,    0,  603,  612,    0,
+      608,  607,  616,  616,  604,  618,  602,  616,  611,    0,
+        0,    0,  628,  627,  626,  593,  592,    0,  592,    0,
</ins><span class="cx"> 
</span><del>-      513,  525,  513,  512,  521,  521,  538,  537,  536,  503,
-      502,    0,  502,  503,  502,  512,    0,  515,  511,  513,
-      509,  496,  527,  377,    0,  504,  507,  499,  491,  498,
-      489,  510,  498,  494,  496,  494,  494,  493,    0,  481,
-      480,  490,    0,  510,  390,    0,  487,  490,    0,  490,
-      489,  473,  465,  473,  463,  471,    0,  468,  467,  488,
-      476,  474,  474,  458,  461,  475,  459,  490,  470,  471,
-      468,  465,  475,  452,  466,  465,  449,  448,  447,  468,
-      456,  454,  454,  435,  434,    0,  462,  434,  460,  432,
-      436,  435,  466,  446,  443,    0,  442,  445,  441,  443,
</del><ins>+        0,  434,  454,  616,  602,  605,  588,  600,  588,  587,
+      596,  596,  613,  612,  611,  578,  577,    0,  577,  578,
+      577,  587,    0,  590,  586,  588,  584,  571,  602,  449,
+        0,  579,  582,  574,  566,  573,  564,  585,  573,  569,
+      571,  569,  569,  568,    0,  556,  555,  565,    0,  585,
+      462,    0,  562,  565,    0,  565,  564,  548,  540,  548,
+      538,  546,    0,  543,  542,  563,  551,  549,  549,  533,
+      536,  550,  534,  565,  545,  546,  543,  540,  550,  527,
+      541,  540,  524,  523,  522,  543,  531,  529,  529,  510,
+      509,    0,  537,  509,  535,  507,  511,  510,  541,  521,
</ins><span class="cx"> 
</span><del>-      427,  424,  437,  422,  423,  430,  424,  413,  412,    0,
-      418,  417,  448,  428,  425,    0,    0,    0,  421,    0,
-      420,    0,  426,  425,  409,  406,  407,    0,  399,  407,
-      397,  403,  424,  403,    0,    0,  415,  414,    0,    0,
-      413,  412,  396,  393,  394,  408,  407,  384,  383,  389,
-        0,    0,  410,  382,  408,  400,  392,  378,   60,   89,
-      105,  143,  173,    0,    0,  216,  217,    0,    0,  222,
-      243,    0,  244,  234,  259,    0,  291,  330,    0,    0,
-      323,  311,  323,  315,  361,  362,    0,  363,  348,  389,
-      355,  358,  359,    0,  378,  380,  371,    0,  392,    0,
</del><ins>+      518,    0,  517,  520,  516,  518,  502,  499,  512,  497,
+      498,  505,  499,  488,  487,    0,  493,  492,  523,  503,
+      500,    0,    0,    0,  496,    0,  495,    0,  501,  500,
+      484,  481,  482,    0,  474,  482,  472,  478,  499,  478,
+        0,    0,  490,  489,    0,    0,  488,  487,  471,  468,
+      469,  483,  482,  459,  458,  464,    0,    0,  485,  457,
+      483,  475,  467,  453,  132,  161,  177,  215,  245,    0,
+        0,  288,  289,    0,    0,  294,  315,    0,  316,  306,
+      331,    0,  363,  402,    0,    0,  395,  383,  395,  387,
+      433,  434,    0,  435,  420,  461,  427,  430,  431,    0,
</ins><span class="cx"> 
</span><del>-        0,    0,  373,  374,  368,    0,  369,  370,    0,    0,
-        0,  942,  434,  437,  438,  439
</del><ins>+      450,  452,  443,    0,  464,    0,    0,    0,  445,  446,
+      440,    0,  441,  442,    0,    0,    0, 1017,  506,  509,
+      512,  513,  514
</ins><span class="cx">     } ;
</span><span class="cx"> 
</span><del>-static yyconst flex_int16_t yy_def[817] =
</del><ins>+static yyconst flex_int16_t yy_def[824] =
</ins><span class="cx">     {   0,
</span><del>-      812,    1,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  813,  812,  812,  812,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  814,  812,  815,   18,   19,  812,  812,
-      816,  812,  812,  812,  812,  812,  812,  812,  812,  813,
-      812,  812,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      818,    1,  818,    3,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  819,  818,  818,
+      818,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  818,  818,  818,  818,  818,  818,  820,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  821,  818,
+      822,   20,   21,  818,  818,  823,  818,  818,  818,  818,
+      818,  818,  818,  818,  819,  818,  818,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  812,  812,  812,  812,  815,
-      812,  812,  812,  812,  812,  816,  812,  812,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      818,  818,  820,  818,  818,  822,  818,  818,  818,  818,
+      818,  823,  818,  818,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  812,  812,  812,  812,  812,  812,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  818,  818,  818,
+      818,  818,  818,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
</ins><span class="cx"> 
</span><del>-      813,  813,  813,  813,  813,  813,  813,  813,  813,  813,
-      813,    0,  812,  812,  812,  812
</del><ins>+      819,  819,  819,  819,  819,  819,  819,  819,  819,  819,
+      819,  819,  819,  819,  819,  819,  819,    0,  818,  818,
+      818,  818,  818
</ins><span class="cx">     } ;
</span><span class="cx"> 
</span><del>-static yyconst flex_int16_t yy_nxt[1015] =
</del><ins>+static yyconst flex_int16_t yy_nxt[1090] =
</ins><span class="cx">     {   0,
</span><del>-        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-       14,   15,   16,   17,   18,   19,   19,   19,   19,   19,
-       19,   20,   21,   22,   23,   24,   25,   26,   26,   26,
-       26,   26,   26,   26,   26,   26,   26,   26,   26,   26,
-       27,   28,   29,   26,   30,   31,   32,   33,   34,   35,
-       36,   37,   38,   26,   39,   40,   41,   42,   43,   44,
-       45,   46,   47,   48,   49,   26,   26,   26,   50,   51,
-       52,   53,   55,   56,   57,   60,   62,   64,   64,   64,
-       64,   64,   64,   64,   78,   79,   73,  144,  117,   63,
-       61,   81,  118,   58,   66,  145,   67,   67,   67,   67,
</del><ins>+        6,    7,    8,    9,   10,   11,   12,   13,   14,   15,
+       16,   17,   18,   19,   20,   21,   21,   21,   21,   21,
+       21,   22,   23,   24,   25,   26,   27,   28,   28,   28,
+       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
+       29,   30,   31,   28,   32,   33,   34,   35,   36,   37,
+       38,   39,   40,   28,   41,   42,   43,   44,   45,   46,
+       47,   48,   49,   50,   51,   28,   28,   28,   52,   53,
+       54,   55,    6,   56,   57,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    6,    6,   58,
</ins><span class="cx"> 
</span><del>-       67,   67,   68,   74,   83,   75,   76,  777,   86,   82,
-       87,  115,   89,   69,   88,   97,   90,   98,   84,   85,
-       70,   71,   91,   93,  116,   92,   99,   94,  109,  180,
-       69,  110,   95,  119,  111,  112,  146,  161,   96,  113,
-      181,  162,  114,  778,   70,  122,  120,   71,   66,  100,
-       68,   68,   68,   68,   68,   68,   68,  101,  106,  102,
-      123,  200,  103,  124,  205,  126,  107,   69,  104,  201,
-      206,  779,  127,  128,   70,  133,  129,  108,  134,  229,
-      230,  147,  130,  131,   69,  132,  135,  141,  137,  148,
-      149,  142,  138,  136,  151,  152,  139,  231,   70,  140,
</del><ins>+       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,
+       58,   58,    6,    6,    6,   58,   58,   58,   58,   58,
+       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,
+       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,
+        6,    6,    6,    6,   60,   61,   62,   65,   67,   69,
+       69,   69,   69,   69,   69,   69,   83,   84,   78,  149,
+      122,   68,   66,   86,  123,   63,   71,  150,   72,   72,
+       72,   72,   72,   72,   73,   79,   88,   80,   81,  783,
+       91,   87,   92,  120,   94,   74,   93,  102,   95,  103,
+       89,   90,   75,   76,   96,   98,  121,   97,  104,   99,
</ins><span class="cx"> 
</span><del>-      143,  153,  812,  260,  261,  232,  148,  149,  154,  780,
-      154,  151,  152,  155,  155,  155,  155,  155,  155,  155,
-      182,  220,  169,  247,  208,  153,  170,  171,  812,  213,
-      222,  192,  781,  183,  193,  194,  221,  209,  195,  210,
-      196,  233,  238,  223,  239,  214,  215,  247,  242,  234,
-      242,  151,  152,  243,  243,  243,  243,  243,  243,  243,
-      291,  292,  293,  782,  783,  244,  784,  244,  151,  152,
-      245,  245,  245,  245,  245,  245,  245,  155,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  254,  305,  323,  785,  786,  306,  330,  331,  332,
</del><ins>+      114,  186,   74,  115,  100,  124,  116,  117,  151,  167,
+      101,  118,  187,  168,  119,  784,   75,  127,  125,   76,
+       71,  105,   73,   73,   73,   73,   73,   73,   73,  106,
+      111,  107,  128,  206,  108,  129,  211,  131,  112,   74,
+      109,  207,  212,  785,  132,  133,   75,  138,  134,  113,
+      139,  235,  236,  152,  135,  136,   74,  137,  140,  146,
+      142,  154,  155,  147,  143,  141,  157,  158,  144,  237,
+       75,  145,  148,  159,  818,  266,  267,  238,  154,  155,
+      160,  786,  160,  157,  158,  161,  161,  161,  161,  161,
+      161,  161,  188,  226,  175,  253,  214,  159,  176,  177,
</ins><span class="cx"> 
</span><del>-      787,  324,  246,  788,  255,  243,  243,  243,  243,  243,
-      243,  243,  243,  243,  243,  243,  243,  243,  243,  246,
-      245,  245,  245,  245,  245,  245,  245,  341,  342,  343,
-      149,  245,  245,  245,  245,  245,  245,  245,  353,  354,
-      355,  361,  362,  363,  365,  366,  367,  149,  789,  152,
-      376,  377,  378,  414,  415,  416,  434,  435,  436,  444,
-      445,  446,  447,  448,  449,  790,  152,  791,  792,  437,
-      438,  450,  451,  452,  491,  492,  493,  517,  518,  519,
-      793,  794,  539,  541,  556,  557,  558,  494,  495,  629,
-      520,  521,  540,  542,  587,  588,  589,  559,  560,  630,
</del><ins>+      818,  219,  228,  198,  787,  189,  199,  200,  227,  215,
+      201,  216,  202,  239,  244,  229,  245,  220,  221,  253,
+      248,  240,  248,  157,  158,  249,  249,  249,  249,  249,
+      249,  249,  297,  298,  299,  788,  789,  250,  790,  250,
+      157,  158,  251,  251,  251,  251,  251,  251,  251,  161,
+      161,  161,  161,  161,  161,  161,  161,  161,  161,  161,
+      161,  161,  161,  260,  311,  329,  791,  792,  312,  336,
+      337,  338,  793,  330,  252,  794,  261,  249,  249,  249,
+      249,  249,  249,  249,  249,  249,  249,  249,  249,  249,
+      249,  252,  251,  251,  251,  251,  251,  251,  251,  347,
</ins><span class="cx"> 
</span><del>-      561,  607,  608,  609,  659,  795,  796,  590,  591,  631,
-      797,  660,  798,  661,  610,  611,  632,  679,  633,  634,
-      799,  800,  801,  802,  680,  803,  681,  804,  805,  806,
-      807,  808,  809,  810,  811,   80,   80,   80,   64,  150,
-      156,  156,  776,  775,  774,  773,  772,  771,  770,  769,
-      768,  767,  766,  765,  764,  763,  762,  761,  760,  759,
-      758,  757,  756,  755,  754,  753,  752,  751,  750,  749,
-      748,  747,  746,  745,  744,  743,  742,  741,  740,  739,
-      738,  737,  736,  735,  734,  733,  732,  731,  730,  729,
-      728,  727,  726,  725,  724,  723,  722,  721,  720,  719,
</del><ins>+      348,  349,  155,  251,  251,  251,  251,  251,  251,  251,
+      359,  360,  361,  367,  368,  369,  371,  372,  373,  155,
+      795,  158,  382,  383,  384,  420,  421,  422,  440,  441,
+      442,  450,  451,  452,  453,  454,  455,  796,  158,  797,
+      798,  443,  444,  456,  457,  458,  497,  498,  499,  523,
+      524,  525,  799,  800,  545,  547,  562,  563,  564,  500,
+      501,  635,  526,  527,  546,  548,  593,  594,  595,  565,
+      566,  636,  567,  613,  614,  615,  665,  801,  802,  596,
+      597,  637,  803,  666,  804,  667,  616,  617,  638,  685,
+      639,  640,  805,  806,  807,  808,  686,  809,  687,  810,
</ins><span class="cx"> 
</span><del>-      718,  717,  716,  715,  714,  713,  712,  711,  710,  709,
-      708,  707,  706,  705,  704,  703,  702,  701,  700,  699,
-      698,  697,  696,  695,  694,  693,  692,  691,  690,  689,
-      688,  687,  686,  685,  684,  683,  682,  678,  677,  676,
-      675,  674,  673,  672,  671,  670,  669,  668,  667,  666,
-      665,  664,  663,  662,  658,  657,  656,  655,  654,  653,
-      652,  651,  650,  649,  648,  647,  646,  645,  644,  643,
-      642,  641,  640,  639,  638,  637,  636,  635,  628,  627,
-      626,  625,  624,  623,  622,  621,  620,  619,  618,  617,
-      616,  615,  614,  613,  612,  606,  605,  604,  603,  602,
</del><ins>+      811,  812,  813,  814,  815,  816,  817,   85,   85,   85,
+      153,  153,  153,   69,  156,  162,  162,  782,  781,  780,
+      779,  778,  777,  776,  775,  774,  773,  772,  771,  770,
+      769,  768,  767,  766,  765,  764,  763,  762,  761,  760,
+      759,  758,  757,  756,  755,  754,  753,  752,  751,  750,
+      749,  748,  747,  746,  745,  744,  743,  742,  741,  740,
+      739,  738,  737,  736,  735,  734,  733,  732,  731,  730,
+      729,  728,  727,  726,  725,  724,  723,  722,  721,  720,
+      719,  718,  717,  716,  715,  714,  713,  712,  711,  710,
+      709,  708,  707,  706,  705,  704,  703,  702,  701,  700,
</ins><span class="cx"> 
</span><del>-      601,  600,  599,  598,  597,  596,  595,  594,  593,  592,
-      586,  585,  584,  583,  582,  581,  580,  579,  578,  577,
-      576,  575,  574,  573,  572,  571,  570,  569,  568,  567,
-      566,  565,  564,  563,  562,  555,  554,  553,  552,  551,
-      550,  549,  548,  547,  546,  545,  544,  543,  538,  537,
-      536,  535,  534,  533,  532,  531,  530,  529,  528,  527,
-      526,  525,  524,  523,  522,  516,  515,  514,  513,  512,
-      511,  510,  509,  508,  507,  506,  505,  504,  503,  502,
-      501,  500,  499,  498,  497,  496,  490,  489,  488,  487,
-      486,  485,  484,  483,  482,  481,  480,  479,  478,  477,
</del><ins>+      699,  698,  697,  696,  695,  694,  693,  692,  691,  690,
+      689,  688,  684,  683,  682,  681,  680,  679,  678,  677,
+      676,  675,  674,  673,  672,  671,  670,  669,  668,  664,
+      663,  662,  661,  660,  659,  658,  657,  656,  655,  654,
+      653,  652,  651,  650,  649,  648,  647,  646,  645,  644,
+      643,  642,  641,  634,  633,  632,  631,  630,  629,  628,
+      627,  626,  625,  624,  623,  622,  621,  620,  619,  618,
+      612,  611,  610,  609,  608,  607,  606,  605,  604,  603,
+      602,  601,  600,  599,  598,  592,  591,  590,  589,  588,
+      587,  586,  585,  584,  583,  582,  581,  580,  579,  578,
</ins><span class="cx"> 
</span><del>-      476,  475,  474,  473,  472,  471,  470,  469,  468,  467,
-      466,  465,  464,  463,  462,  461,  460,  459,  458,  457,
-      456,  455,  454,  453,  443,  442,  441,  440,  439,  433,
-      432,  431,  430,  429,  428,  427,  426,  425,  424,  423,
-      422,  421,  420,  419,  418,  417,  413,  412,  411,  410,
-      409,  408,  407,  406,  405,  404,  403,  402,  401,  400,
-      399,  398,  397,  396,  395,  394,  393,  392,  391,  390,
-      389,  388,  387,  386,  385,  384,  383,  382,  381,  380,
-      379,  375,  374,  373,  372,  371,  370,  369,  368,  364,
-      360,  359,  358,  357,  356,  352,  351,  350,  349,  348,
</del><ins>+      577,  576,  575,  574,  573,  572,  571,  570,  569,  568,
+      561,  560,  559,  558,  557,  556,  555,  554,  553,  552,
+      551,  550,  549,  544,  543,  542,  541,  540,  539,  538,
+      537,  536,  535,  534,  533,  532,  531,  530,  529,  528,
+      522,  521,  520,  519,  518,  517,  516,  515,  514,  513,
+      512,  511,  510,  509,  508,  507,  506,  505,  504,  503,
+      502,  496,  495,  494,  493,  492,  491,  490,  489,  488,
+      487,  486,  485,  484,  483,  482,  481,  480,  479,  478,
+      477,  476,  475,  474,  473,  472,  471,  470,  469,  468,
+      467,  466,  465,  464,  463,  462,  461,  460,  459,  449,
</ins><span class="cx"> 
</span><del>-      347,  346,  345,  344,  340,  339,  338,  337,  336,  335,
-      334,  333,  329,  328,  327,  326,  325,  322,  321,  320,
-      319,  318,  317,  316,  315,  314,  313,  312,  311,  310,
-      309,  308,  307,  304,  303,  302,  301,  300,  299,  298,
-      297,  296,  295,  294,  290,  289,  288,  287,  286,  285,
-      284,  283,  282,  281,  280,  279,  278,  277,  276,  275,
-      274,  273,  272,  271,  270,  269,  268,  267,  266,  265,
-      264,  263,  262,  259,  258,  257,  256,  253,  252,  251,
-      250,  249,  248,  241,  240,  237,  236,  235,  228,  227,
-      226,  225,  224,  219,  218,  217,  216,  212,  211,  207,
</del><ins>+      448,  447,  446,  445,  439,  438,  437,  436,  435,  434,
+      433,  432,  431,  430,  429,  428,  427,  426,  425,  424,
+      423,  419,  418,  417,  416,  415,  414,  413,  412,  411,
+      410,  409,  408,  407,  406,  405,  404,  403,  402,  401,
+      400,  399,  398,  397,  396,  395,  394,  393,  392,  391,
+      390,  389,  388,  387,  386,  385,  381,  380,  379,  378,
+      377,  376,  375,  374,  370,  366,  365,  364,  363,  362,
+      358,  357,  356,  355,  354,  353,  352,  351,  350,  346,
+      345,  344,  343,  342,  341,  340,  339,  335,  334,  333,
+      332,  331,  328,  327,  326,  325,  324,  323,  322,  321,
</ins><span class="cx"> 
</span><del>-      204,  203,  202,  199,  198,  197,  191,  190,  189,  188,
-      187,  186,  185,  184,  179,  178,  177,  176,  175,  174,
-      173,  172,  168,  167,  166,  165,  164,  163,  160,  159,
-      158,  157,  125,  121,  105,   77,   72,   65,   59,   54,
-      812,    3,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
</del><ins>+      320,  319,  318,  317,  316,  315,  314,  313,  310,  309,
+      308,  307,  306,  305,  304,  303,  302,  301,  300,  296,
+      295,  294,  293,  292,  291,  290,  289,  288,  287,  286,
+      285,  284,  283,  282,  281,  280,  279,  278,  277,  276,
+      275,  274,  273,  272,  271,  270,  269,  268,  265,  264,
+      263,  262,  259,  258,  257,  256,  255,  254,  247,  246,
+      243,  242,  241,  234,  233,  232,  231,  230,  225,  224,
+      223,  222,  218,  217,  213,  210,  209,  208,  205,  204,
+      203,  197,  196,  195,  194,  193,  192,  191,  190,  185,
+      184,  183,  182,  181,  180,  179,  178,  174,  173,  172,
</ins><span class="cx"> 
</span><del>-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812
</del><ins>+      171,  170,  169,  166,  165,  164,  163,  130,  126,  110,
+       82,   77,   70,   64,   59,  818,    5,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818
</ins><span class="cx">     } ;
</span><span class="cx"> 
</span><del>-static yyconst flex_int16_t yy_chk[1015] =
</del><ins>+static yyconst flex_int16_t yy_chk[1090] =
</ins><span class="cx">     {   0,
</span><span class="cx">         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
</span><span class="cx">         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
</span><span class="lines">@@ -853,115 +869,122 @@
</span><span class="cx">         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
</span><span class="cx">         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
</span><span class="cx">         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
</span><del>-        1,    1,    8,    8,    9,   13,   15,   16,   16,   16,
-       16,   16,   16,   16,   24,   24,   22,   49,   40,   15,
-       13,   29,   40,    9,   18,   49,   18,   18,   18,   18,
</del><ins>+        1,    1,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
</ins><span class="cx"> 
</span><del>-       18,   18,   18,   22,   30,   22,   22,  759,   31,   29,
-       31,   39,   32,   18,   31,   34,   32,   34,   30,   30,
-       18,   18,   32,   33,   39,   32,   34,   33,   38,  101,
-       18,   38,   33,   41,   38,   38,   51,   85,   33,   38,
-      101,   85,   38,  760,   18,   43,   41,   18,   19,   35,
-       19,   19,   19,   19,   19,   19,   19,   35,   37,   35,
-       43,  116,   35,   43,  120,   45,   37,   19,   35,  116,
-      120,  761,   45,   45,   19,   46,   45,   37,   46,  137,
-      137,   51,   45,   45,   19,   45,   46,   48,   47,   64,
-       64,   48,   47,   46,   66,   66,   47,  138,   19,   47,
</del><ins>+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
+        3,    3,    3,    3,   10,   10,   11,   15,   17,   18,
+       18,   18,   18,   18,   18,   18,   26,   26,   24,   51,
+       42,   17,   15,   31,   42,   11,   20,   51,   20,   20,
+       20,   20,   20,   20,   20,   24,   32,   24,   24,  765,
+       33,   31,   33,   41,   34,   20,   33,   36,   34,   36,
+       32,   32,   20,   20,   34,   35,   41,   34,   36,   35,
</ins><span class="cx"> 
</span><del>-       48,   67,   67,  171,  171,  138,   64,   64,   69,  762,
-       69,   66,   66,   69,   69,   69,   69,   69,   69,   69,
-      102,  130,   92,  156,  122,   67,   92,   92,   67,  125,
-      131,  112,  763,  102,  112,  112,  130,  122,  112,  122,
-      112,  139,  143,  131,  143,  125,  125,  156,  148,  139,
-      148,  150,  150,  148,  148,  148,  148,  148,  148,  148,
-      202,  202,  202,  766,  767,  151,  770,  151,  150,  150,
-      151,  151,  151,  151,  151,  151,  151,  154,  154,  154,
-      154,  154,  154,  154,  155,  155,  155,  155,  155,  155,
-      155,  166,  214,  231,  771,  773,  214,  237,  237,  237,
</del><ins>+       40,  106,   20,   40,   35,   43,   40,   40,   53,   90,
+       35,   40,  106,   90,   40,  766,   20,   45,   43,   20,
+       21,   37,   21,   21,   21,   21,   21,   21,   21,   37,
+       39,   37,   45,  121,   37,   45,  125,   47,   39,   21,
+       37,  121,  125,  767,   47,   47,   21,   48,   47,   39,
+       48,  142,  142,   53,   47,   47,   21,   47,   48,   50,
+       49,   69,   69,   50,   49,   48,   71,   71,   49,  143,
+       21,   49,   50,   72,   72,  177,  177,  143,   69,   69,
+       74,  768,   74,   71,   71,   74,   74,   74,   74,   74,
+       74,   74,  107,  135,   97,  162,  127,   72,   97,   97,
</ins><span class="cx"> 
</span><del>-      774,  231,  155,  775,  166,  242,  242,  242,  242,  242,
-      242,  242,  243,  243,  243,  243,  243,  243,  243,  155,
-      244,  244,  244,  244,  244,  244,  244,  253,  253,  253,
-      243,  245,  245,  245,  245,  245,  245,  245,  265,  265,
-      265,  274,  274,  274,  278,  278,  278,  243,  777,  245,
-      287,  287,  287,  328,  328,  328,  369,  369,  369,  380,
-      380,  380,  381,  381,  381,  778,  245,  781,  782,  369,
-      369,  382,  382,  382,  433,  433,  433,  476,  476,  476,
-      783,  784,  496,  497,  513,  513,  513,  433,  433,  596,
-      476,  476,  496,  497,  547,  547,  547,  513,  513,  596,
</del><ins>+       72,  130,  136,  117,  769,  107,  117,  117,  135,  127,
+      117,  127,  117,  144,  148,  136,  148,  130,  130,  162,
+      154,  144,  154,  156,  156,  154,  154,  154,  154,  154,
+      154,  154,  208,  208,  208,  772,  773,  157,  776,  157,
+      156,  156,  157,  157,  157,  157,  157,  157,  157,  160,
+      160,  160,  160,  160,  160,  160,  161,  161,  161,  161,
+      161,  161,  161,  172,  220,  237,  777,  779,  220,  243,
+      243,  243,  780,  237,  161,  781,  172,  248,  248,  248,
+      248,  248,  248,  248,  249,  249,  249,  249,  249,  249,
+      249,  161,  250,  250,  250,  250,  250,  250,  250,  259,
</ins><span class="cx"> 
</span><del>-      513,  570,  570,  570,  624,  785,  786,  547,  547,  597,
-      788,  624,  789,  624,  570,  570,  597,  645,  597,  597,
-      790,  791,  792,  793,  645,  795,  645,  796,  797,  799,
-      803,  804,  805,  807,  808,  813,  813,  813,  814,  815,
-      816,  816,  758,  757,  756,  755,  754,  753,  750,  749,
-      748,  747,  746,  745,  744,  743,  742,  741,  738,  737,
-      734,  733,  732,  731,  730,  729,  727,  726,  725,  724,
-      723,  721,  719,  715,  714,  713,  712,  711,  709,  708,
-      707,  706,  705,  704,  703,  702,  701,  700,  699,  698,
-      697,  695,  694,  693,  692,  691,  690,  689,  688,  687,
</del><ins>+      259,  259,  249,  251,  251,  251,  251,  251,  251,  251,
+      271,  271,  271,  280,  280,  280,  284,  284,  284,  249,
+      783,  251,  293,  293,  293,  334,  334,  334,  375,  375,
+      375,  386,  386,  386,  387,  387,  387,  784,  251,  787,
+      788,  375,  375,  388,  388,  388,  439,  439,  439,  482,
+      482,  482,  789,  790,  502,  503,  519,  519,  519,  439,
+      439,  602,  482,  482,  502,  503,  553,  553,  553,  519,
+      519,  602,  519,  576,  576,  576,  630,  791,  792,  553,
+      553,  603,  794,  630,  795,  630,  576,  576,  603,  651,
+      603,  603,  796,  797,  798,  799,  651,  801,  651,  802,
</ins><span class="cx"> 
</span><del>-      685,  684,  683,  682,  681,  680,  679,  678,  677,  676,
-      675,  674,  673,  672,  671,  670,  669,  668,  667,  666,
-      665,  664,  663,  662,  661,  660,  659,  658,  656,  655,
-      654,  653,  652,  651,  650,  648,  647,  644,  642,  641,
-      640,  638,  637,  636,  635,  634,  633,  632,  631,  630,
-      629,  628,  627,  626,  623,  622,  621,  620,  619,  618,
-      616,  615,  614,  613,  611,  610,  609,  608,  607,  606,
-      605,  604,  603,  602,  601,  600,  599,  598,  593,  591,
-      590,  589,  588,  587,  583,  582,  581,  580,  579,  578,
-      577,  576,  575,  573,  572,  568,  567,  565,  564,  562,
</del><ins>+      803,  805,  809,  810,  811,  813,  814,  819,  819,  819,
+      820,  820,  820,  821,  822,  823,  823,  764,  763,  762,
+      761,  760,  759,  756,  755,  754,  753,  752,  751,  750,
+      749,  748,  747,  744,  743,  740,  739,  738,  737,  736,
+      735,  733,  732,  731,  730,  729,  727,  725,  721,  720,
+      719,  718,  717,  715,  714,  713,  712,  711,  710,  709,
+      708,  707,  706,  705,  704,  703,  701,  700,  699,  698,
+      697,  696,  695,  694,  693,  691,  690,  689,  688,  687,
+      686,  685,  684,  683,  682,  681,  680,  679,  678,  677,
+      676,  675,  674,  673,  672,  671,  670,  669,  668,  667,
</ins><span class="cx"> 
</span><del>-      561,  560,  559,  558,  557,  556,  552,  551,  550,  548,
-      546,  545,  544,  543,  542,  541,  540,  539,  538,  537,
-      535,  534,  529,  528,  527,  526,  524,  523,  521,  520,
-      519,  518,  517,  515,  514,  512,  511,  510,  509,  508,
-      507,  506,  505,  503,  502,  501,  500,  499,  495,  494,
-      493,  492,  491,  490,  487,  486,  485,  484,  483,  482,
-      481,  480,  479,  478,  477,  475,  474,  471,  466,  464,
-      463,  462,  460,  459,  456,  455,  454,  453,  442,  441,
-      440,  438,  437,  436,  435,  434,  431,  429,  428,  427,
-      425,  424,  423,  422,  420,  418,  417,  412,  411,  409,
</del><ins>+      666,  665,  664,  662,  661,  660,  659,  658,  657,  656,
+      654,  653,  650,  648,  647,  646,  644,  643,  642,  641,
+      640,  639,  638,  637,  636,  635,  634,  633,  632,  629,
+      628,  627,  626,  625,  624,  622,  621,  620,  619,  617,
+      616,  615,  614,  613,  612,  611,  610,  609,  608,  607,
+      606,  605,  604,  599,  597,  596,  595,  594,  593,  589,
+      588,  587,  586,  585,  584,  583,  582,  581,  579,  578,
+      574,  573,  571,  570,  568,  567,  566,  565,  564,  563,
+      562,  558,  557,  556,  554,  552,  551,  550,  549,  548,
+      547,  546,  545,  544,  543,  541,  540,  535,  534,  533,
</ins><span class="cx"> 
</span><del>-      408,  407,  406,  405,  404,  403,  402,  401,  400,  399,
-      397,  396,  395,  394,  393,  392,  391,  389,  388,  387,
-      386,  385,  384,  383,  379,  375,  374,  373,  370,  368,
-      358,  356,  352,  351,  350,  349,  347,  346,  344,  339,
-      338,  337,  336,  335,  334,  329,  327,  326,  325,  324,
-      323,  321,  320,  317,  316,  315,  314,  313,  312,  311,
-      310,  309,  308,  307,  306,  305,  304,  303,  302,  301,
-      300,  299,  298,  297,  296,  295,  294,  293,  292,  291,
-      288,  286,  285,  284,  283,  282,  281,  280,  279,  277,
-      273,  271,  270,  269,  268,  264,  263,  262,  261,  260,
</del><ins>+      532,  530,  529,  527,  526,  525,  524,  523,  521,  520,
+      518,  517,  516,  515,  514,  513,  512,  511,  509,  508,
+      507,  506,  505,  501,  500,  499,  498,  497,  496,  493,
+      492,  491,  490,  489,  488,  487,  486,  485,  484,  483,
+      481,  480,  477,  472,  470,  469,  468,  466,  465,  462,
+      461,  460,  459,  448,  447,  446,  444,  443,  442,  441,
+      440,  437,  435,  434,  433,  431,  430,  429,  428,  426,
+      424,  423,  418,  417,  415,  414,  413,  412,  411,  410,
+      409,  408,  407,  406,  405,  403,  402,  401,  400,  399,
+      398,  397,  395,  394,  393,  392,  391,  390,  389,  385,
</ins><span class="cx"> 
</span><del>-      259,  258,  257,  256,  252,  250,  249,  248,  241,  240,
-      239,  238,  236,  235,  234,  233,  232,  230,  229,  228,
-      227,  226,  225,  224,  223,  222,  221,  220,  219,  218,
-      217,  216,  215,  213,  212,  211,  210,  209,  208,  207,
-      206,  205,  204,  203,  201,  200,  199,  198,  197,  196,
-      195,  194,  193,  192,  191,  190,  189,  188,  187,  186,
-      185,  183,  182,  181,  180,  179,  178,  177,  176,  175,
-      174,  173,  172,  170,  169,  168,  167,  165,  164,  163,
-      162,  161,  159,  145,  144,  142,  141,  140,  136,  135,
-      134,  133,  132,  129,  128,  127,  126,  124,  123,  121,
</del><ins>+      381,  380,  379,  376,  374,  364,  362,  358,  357,  356,
+      355,  353,  352,  350,  345,  344,  343,  342,  341,  340,
+      335,  333,  332,  331,  330,  329,  327,  326,  323,  322,
+      321,  320,  319,  318,  317,  316,  315,  314,  313,  312,
+      311,  310,  309,  308,  307,  306,  305,  304,  303,  302,
+      301,  300,  299,  298,  297,  294,  292,  291,  290,  289,
+      288,  287,  286,  285,  283,  279,  277,  276,  275,  274,
+      270,  269,  268,  267,  266,  265,  264,  263,  262,  258,
+      256,  255,  254,  247,  246,  245,  244,  242,  241,  240,
+      239,  238,  236,  235,  234,  233,  232,  231,  230,  229,
</ins><span class="cx"> 
</span><del>-      119,  118,  117,  115,  114,  113,  111,  110,  108,  107,
-      106,  105,  104,  103,  100,   99,   98,   97,   96,   95,
-       94,   93,   91,   90,   89,   88,   87,   86,   84,   83,
-       79,   75,   44,   42,   36,   23,   20,   17,   12,    7,
-        3,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
</del><ins>+      228,  227,  226,  225,  224,  223,  222,  221,  219,  218,
+      217,  216,  215,  214,  213,  212,  211,  210,  209,  207,
+      206,  205,  204,  203,  202,  201,  200,  199,  198,  197,
+      196,  195,  194,  193,  192,  191,  189,  188,  187,  186,
+      185,  184,  183,  182,  181,  180,  179,  178,  176,  175,
+      174,  173,  171,  170,  169,  168,  167,  165,  150,  149,
+      147,  146,  145,  141,  140,  139,  138,  137,  134,  133,
+      132,  131,  129,  128,  126,  124,  123,  122,  120,  119,
+      118,  116,  115,  113,  112,  111,  110,  109,  108,  105,
+      104,  103,  102,  101,  100,   99,   98,   96,   95,   94,
</ins><span class="cx"> 
</span><del>-      812,  812,  812,  812,  812,  812,  812,  812,  812,  812,
-      812,  812,  812,  812
</del><ins>+       93,   92,   91,   89,   88,   84,   80,   46,   44,   38,
+       25,   22,   19,   14,    9,    5,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818,  818,
+      818,  818,  818,  818,  818,  818,  818,  818,  818
</ins><span class="cx">     } ;
</span><span class="cx"> 
</span><span class="cx"> /* Table of booleans, true if rule could match eol. */
</span><del>-static yyconst flex_int32_t yy_rule_can_match_eol[238] =
</del><ins>+static yyconst flex_int32_t yy_rule_can_match_eol[240] =
</ins><span class="cx">     {   0,
</span><span class="cx"> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
</span><span class="cx">     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
</span><span class="lines">@@ -974,7 +997,8 @@
</span><span class="cx">     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
</span><span class="cx">     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
</span><span class="cx">     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
</span><del>-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,     };
</del><ins>+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 
+        };
</ins><span class="cx"> 
</span><span class="cx"> /* The intent behind this definition is that it'll catch
</span><span class="cx">  * any uses of REJECT which flex missed.
</span><span class="lines">@@ -1010,6 +1034,13 @@
</span><span class="cx"> #pragma warning(disable : 4102)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+// Workaround for flex using the register keyword, deprecated in C++11.
+#ifdef __cplusplus
+#if __cplusplus &gt; 199711L
+#define register
+#endif
+#endif
+
</ins><span class="cx"> #define YY_USER_ACTION                                 \
</span><span class="cx">     yylloc-&gt;first_file = yylloc-&gt;last_file = yycolumn; \
</span><span class="cx">     yylloc-&gt;first_line = yylloc-&gt;last_line = yylineno;
</span><span class="lines">@@ -1029,6 +1060,7 @@
</span><span class="cx"> static int floatsuffix_check(TParseContext* context);
</span><span class="cx"> 
</span><span class="cx"> #define INITIAL 0
</span><ins>+#define FIELDS 1
</ins><span class="cx"> 
</span><span class="cx"> #define YY_EXTRA_TYPE TParseContext*
</span><span class="cx"> 
</span><span class="lines">@@ -1259,8 +1291,6 @@
</span><span class="cx">         register int yy_act;
</span><span class="cx">     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
</span><span class="cx"> 
</span><del>-    TParseContext* context = yyextra;
-
</del><span class="cx">     yylval = yylval_param;
</span><span class="cx"> 
</span><span class="cx">     yylloc = yylloc_param;
</span><span class="lines">@@ -1291,6 +1321,10 @@
</span><span class="cx">                 yy_load_buffer_state(yyscanner );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><ins>+        {
+
+    TParseContext* context = yyextra;
+
</ins><span class="cx">         while ( 1 )                /* loops until end-of-file is reached */
</span><span class="cx">                 {
</span><span class="cx">                 yy_cp = yyg-&gt;yy_c_buf_p;
</span><span class="lines">@@ -1307,7 +1341,7 @@
</span><span class="cx"> yy_match:
</span><span class="cx">                 do
</span><span class="cx">                         {
</span><del>-                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
</del><ins>+                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
</ins><span class="cx">                         if ( yy_accept[yy_current_state] )
</span><span class="cx">                                 {
</span><span class="cx">                                 yyg-&gt;yy_last_accepting_state = yy_current_state;
</span><span class="lines">@@ -1316,13 +1350,13 @@
</span><span class="cx">                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
</span><span class="cx">                                 {
</span><span class="cx">                                 yy_current_state = (int) yy_def[yy_current_state];
</span><del>-                                if ( yy_current_state &gt;= 813 )
</del><ins>+                                if ( yy_current_state &gt;= 819 )
</ins><span class="cx">                                         yy_c = yy_meta[(unsigned int) yy_c];
</span><span class="cx">                                 }
</span><span class="cx">                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
</span><span class="cx">                         ++yy_cp;
</span><span class="cx">                         }
</span><del>-                while ( yy_current_state != 812 );
</del><ins>+                while ( yy_current_state != 818 );
</ins><span class="cx">                 yy_cp = yyg-&gt;yy_last_accepting_cpos;
</span><span class="cx">                 yy_current_state = yyg-&gt;yy_last_accepting_state;
</span><span class="cx"> 
</span><span class="lines">@@ -1971,7 +2005,7 @@
</span><span class="cx">         YY_BREAK
</span><span class="cx"> case 221:
</span><span class="cx"> YY_RULE_SETUP
</span><del>-{ return DOT; }
</del><ins>+{ BEGIN(FIELDS); return DOT; }
</ins><span class="cx">         YY_BREAK
</span><span class="cx"> case 222:
</span><span class="cx"> YY_RULE_SETUP
</span><span class="lines">@@ -2026,18 +2060,31 @@
</span><span class="cx"> { return QUESTION; }
</span><span class="cx">         YY_BREAK
</span><span class="cx"> case 235:
</span><del>-/* rule 235 can match eol */
</del><span class="cx"> YY_RULE_SETUP
</span><ins>+{
+    BEGIN(INITIAL);
+    yylval-&gt;lex.string = NewPoolTString(yytext);
+    return FIELD_SELECTION;
+}
+        YY_BREAK
+case 236:
+YY_RULE_SETUP
+{}
+        YY_BREAK
+case 237:
+/* rule 237 can match eol */
+YY_RULE_SETUP
</ins><span class="cx"> { }
</span><span class="cx">         YY_BREAK
</span><span class="cx"> case YY_STATE_EOF(INITIAL):
</span><ins>+case YY_STATE_EOF(FIELDS):
</ins><span class="cx"> { yyterminate(); }
</span><span class="cx">         YY_BREAK
</span><del>-case 236:
</del><ins>+case 238:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> { assert(false); return 0; }
</span><span class="cx">         YY_BREAK
</span><del>-case 237:
</del><ins>+case 239:
</ins><span class="cx"> YY_RULE_SETUP
</span><span class="cx"> ECHO;
</span><span class="cx">         YY_BREAK
</span><span class="lines">@@ -2170,6 +2217,7 @@
</span><span class="cx">                         &quot;fatal flex scanner internal error--no action found&quot; );
</span><span class="cx">         } /* end of action switch */
</span><span class="cx">                 } /* end of scanning one token */
</span><ins>+        } /* end of user's declarations */
</ins><span class="cx"> } /* end of yylex */
</span><span class="cx"> 
</span><span class="cx"> /* yy_get_next_buffer - try to read in a new buffer
</span><span class="lines">@@ -2333,7 +2381,7 @@
</span><span class="cx">                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
</span><span class="cx">                         {
</span><span class="cx">                         yy_current_state = (int) yy_def[yy_current_state];
</span><del>-                        if ( yy_current_state &gt;= 813 )
</del><ins>+                        if ( yy_current_state &gt;= 819 )
</ins><span class="cx">                                 yy_c = yy_meta[(unsigned int) yy_c];
</span><span class="cx">                         }
</span><span class="cx">                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
</span><span class="lines">@@ -2362,11 +2410,11 @@
</span><span class="cx">         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
</span><span class="cx">                 {
</span><span class="cx">                 yy_current_state = (int) yy_def[yy_current_state];
</span><del>-                if ( yy_current_state &gt;= 813 )
</del><ins>+                if ( yy_current_state &gt;= 819 )
</ins><span class="cx">                         yy_c = yy_meta[(unsigned int) yy_c];
</span><span class="cx">                 }
</span><span class="cx">         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
</span><del>-        yy_is_jam = (yy_current_state == 812);
</del><ins>+        yy_is_jam = (yy_current_state == 818);
</ins><span class="cx"> 
</span><span class="cx">         (void)yyg;
</span><span class="cx">         return yy_is_jam ? 0 : yy_current_state;
</span><span class="lines">@@ -3184,10 +3232,6 @@
</span><span class="cx"> 
</span><span class="cx"> #define YYTABLES_NAME &quot;yytables&quot;
</span><span class="cx"> 
</span><del>-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
</del><span class="cx"> yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
</span><span class="cx">     pp::Token token;
</span><span class="cx">     yyget_extra(yyscanner)-&gt;preprocessor.lex(&amp;token);
</span><span class="lines">@@ -3301,8 +3345,8 @@
</span><span class="cx">     return(FLOATCONSTANT);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason) {
-    context-&gt;error(*lloc, reason, yyget_text(context-&gt;scanner));
</del><ins>+void yyerror(YYLTYPE* lloc, TParseContext* context, void *scanner, const char* reason) {
+    context-&gt;error(*lloc, reason, yyget_text(scanner));
</ins><span class="cx">     context-&gt;recover();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_tabcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,21 +1,21 @@
</span><del>-/* A Bison parser, made by GNU Bison 2.7.1.  */
</del><ins>+/* A Bison parser, made by GNU Bison 3.0.4.  */
</ins><span class="cx"> 
</span><del>-/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */
</del><ins>+/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */ 
</ins><span class="cx"> 
</span><span class="cx"> /* Bison implementation for Yacc-like parsers in C
</span><del>-   
-      Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-   
</del><ins>+
+   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
</ins><span class="cx">    This program is free software: you can redistribute it and/or modify
</span><span class="cx">    it under the terms of the GNU General Public License as published by
</span><span class="cx">    the Free Software Foundation, either version 3 of the License, or
</span><span class="cx">    (at your option) any later version.
</span><del>-   
</del><ins>+
</ins><span class="cx">    This program is distributed in the hope that it will be useful,
</span><span class="cx">    but WITHOUT ANY WARRANTY; without even the implied warranty of
</span><span class="cx">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
</span><span class="cx">    GNU General Public License for more details.
</span><del>-   
</del><ins>+
</ins><span class="cx">    You should have received a copy of the GNU General Public License
</span><span class="cx">    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.  */
</span><span class="cx"> 
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">    special exception, which will cause the skeleton and the resulting
</span><span class="cx">    Bison output files to be licensed under the GNU General Public
</span><span class="cx">    License without this special exception.
</span><del>-   
</del><ins>+
</ins><span class="cx">    This special exception was added by the Free Software Foundation in
</span><span class="cx">    version 2.2 of Bison.  */
</span><span class="cx"> 
</span><span class="lines">@@ -46,13 +46,13 @@
</span><span class="cx"> #define YYBISON 1
</span><span class="cx"> 
</span><span class="cx"> /* Bison version.  */
</span><del>-#define YYBISON_VERSION &quot;2.7.1&quot;
</del><ins>+#define YYBISON_VERSION &quot;3.0.4&quot;
</ins><span class="cx"> 
</span><span class="cx"> /* Skeleton name.  */
</span><span class="cx"> #define YYSKELETON_NAME &quot;yacc.c&quot;
</span><span class="cx"> 
</span><span class="cx"> /* Pure parsers.  */
</span><del>-#define YYPURE 1
</del><ins>+#define YYPURE 2
</ins><span class="cx"> 
</span><span class="cx"> /* Push parsers.  */
</span><span class="cx"> #define YYPUSH 0
</span><span class="lines">@@ -82,26 +82,27 @@
</span><span class="cx"> #elif defined(_MSC_VER)
</span><span class="cx"> #pragma warning(disable: 4065)
</span><span class="cx"> #pragma warning(disable: 4189)
</span><ins>+#pragma warning(disable: 4244)
</ins><span class="cx"> #pragma warning(disable: 4505)
</span><span class="cx"> #pragma warning(disable: 4701)
</span><ins>+#pragma warning(disable: 4702)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#include &quot;angle_gl.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/SymbolTable.h&quot;
</span><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><span class="cx"> #include &quot;GLSLANG/ShaderLang.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #define YYENABLE_NLS 0
</span><span class="cx"> 
</span><del>-#define YYLEX_PARAM context-&gt;scanner
</del><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-# ifndef YY_NULL
</del><ins>+# ifndef YY_NULLPTR
</ins><span class="cx"> #  if defined __cplusplus &amp;&amp; 201103L &lt;= __cplusplus
</span><del>-#   define YY_NULL nullptr
</del><ins>+#   define YY_NULLPTR nullptr
</ins><span class="cx"> #  else
</span><del>-#   define YY_NULL 0
</del><ins>+#   define YY_NULLPTR 0
</ins><span class="cx"> #  endif
</span><span class="cx"> # endif
</span><span class="cx"> 
</span><span class="lines">@@ -117,7 +118,7 @@
</span><span class="cx">    by #include &quot;glslang_tab.h&quot;.  */
</span><span class="cx"> #ifndef YY_YY_GLSLANG_TAB_H_INCLUDED
</span><span class="cx"> # define YY_YY_GLSLANG_TAB_H_INCLUDED
</span><del>-/* Enabling traces.  */
</del><ins>+/* Debug traces.  */
</ins><span class="cx"> #ifndef YYDEBUG
</span><span class="cx"> # define YYDEBUG 0
</span><span class="cx"> #endif
</span><span class="lines">@@ -132,144 +133,143 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-/* Tokens.  */
</del><ins>+/* Token type.  */
</ins><span class="cx"> #ifndef YYTOKENTYPE
</span><span class="cx"> # define YYTOKENTYPE
</span><del>-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     INVARIANT = 258,
-     HIGH_PRECISION = 259,
-     MEDIUM_PRECISION = 260,
-     LOW_PRECISION = 261,
-     PRECISION = 262,
-     ATTRIBUTE = 263,
-     CONST_QUAL = 264,
-     BOOL_TYPE = 265,
-     FLOAT_TYPE = 266,
-     INT_TYPE = 267,
-     UINT_TYPE = 268,
-     BREAK = 269,
-     CONTINUE = 270,
-     DO = 271,
-     ELSE = 272,
-     FOR = 273,
-     IF = 274,
-     DISCARD = 275,
-     RETURN = 276,
-     SWITCH = 277,
-     CASE = 278,
-     DEFAULT = 279,
-     BVEC2 = 280,
-     BVEC3 = 281,
-     BVEC4 = 282,
-     IVEC2 = 283,
-     IVEC3 = 284,
-     IVEC4 = 285,
-     VEC2 = 286,
-     VEC3 = 287,
-     VEC4 = 288,
-     UVEC2 = 289,
-     UVEC3 = 290,
-     UVEC4 = 291,
-     MATRIX2 = 292,
-     MATRIX3 = 293,
-     MATRIX4 = 294,
-     IN_QUAL = 295,
-     OUT_QUAL = 296,
-     INOUT_QUAL = 297,
-     UNIFORM = 298,
-     VARYING = 299,
-     MATRIX2x3 = 300,
-     MATRIX3x2 = 301,
-     MATRIX2x4 = 302,
-     MATRIX4x2 = 303,
-     MATRIX3x4 = 304,
-     MATRIX4x3 = 305,
-     CENTROID = 306,
-     FLAT = 307,
-     SMOOTH = 308,
-     STRUCT = 309,
-     VOID_TYPE = 310,
-     WHILE = 311,
-     SAMPLER2D = 312,
-     SAMPLERCUBE = 313,
-     SAMPLER_EXTERNAL_OES = 314,
-     SAMPLER2DRECT = 315,
-     SAMPLER2DARRAY = 316,
-     ISAMPLER2D = 317,
-     ISAMPLER3D = 318,
-     ISAMPLERCUBE = 319,
-     ISAMPLER2DARRAY = 320,
-     USAMPLER2D = 321,
-     USAMPLER3D = 322,
-     USAMPLERCUBE = 323,
-     USAMPLER2DARRAY = 324,
-     SAMPLER3D = 325,
-     SAMPLER3DRECT = 326,
-     SAMPLER2DSHADOW = 327,
-     SAMPLERCUBESHADOW = 328,
-     SAMPLER2DARRAYSHADOW = 329,
-     LAYOUT = 330,
-     IDENTIFIER = 331,
-     TYPE_NAME = 332,
-     FLOATCONSTANT = 333,
-     INTCONSTANT = 334,
-     UINTCONSTANT = 335,
-     BOOLCONSTANT = 336,
-     FIELD_SELECTION = 337,
-     LEFT_OP = 338,
-     RIGHT_OP = 339,
-     INC_OP = 340,
-     DEC_OP = 341,
-     LE_OP = 342,
-     GE_OP = 343,
-     EQ_OP = 344,
-     NE_OP = 345,
-     AND_OP = 346,
-     OR_OP = 347,
-     XOR_OP = 348,
-     MUL_ASSIGN = 349,
-     DIV_ASSIGN = 350,
-     ADD_ASSIGN = 351,
-     MOD_ASSIGN = 352,
-     LEFT_ASSIGN = 353,
-     RIGHT_ASSIGN = 354,
-     AND_ASSIGN = 355,
-     XOR_ASSIGN = 356,
-     OR_ASSIGN = 357,
-     SUB_ASSIGN = 358,
-     LEFT_PAREN = 359,
-     RIGHT_PAREN = 360,
-     LEFT_BRACKET = 361,
-     RIGHT_BRACKET = 362,
-     LEFT_BRACE = 363,
-     RIGHT_BRACE = 364,
-     DOT = 365,
-     COMMA = 366,
-     COLON = 367,
-     EQUAL = 368,
-     SEMICOLON = 369,
-     BANG = 370,
-     DASH = 371,
-     TILDE = 372,
-     PLUS = 373,
-     STAR = 374,
-     SLASH = 375,
-     PERCENT = 376,
-     LEFT_ANGLE = 377,
-     RIGHT_ANGLE = 378,
-     VERTICAL_BAR = 379,
-     CARET = 380,
-     AMPERSAND = 381,
-     QUESTION = 382
-   };
</del><ins>+  enum yytokentype
+  {
+    INVARIANT = 258,
+    HIGH_PRECISION = 259,
+    MEDIUM_PRECISION = 260,
+    LOW_PRECISION = 261,
+    PRECISION = 262,
+    ATTRIBUTE = 263,
+    CONST_QUAL = 264,
+    BOOL_TYPE = 265,
+    FLOAT_TYPE = 266,
+    INT_TYPE = 267,
+    UINT_TYPE = 268,
+    BREAK = 269,
+    CONTINUE = 270,
+    DO = 271,
+    ELSE = 272,
+    FOR = 273,
+    IF = 274,
+    DISCARD = 275,
+    RETURN = 276,
+    SWITCH = 277,
+    CASE = 278,
+    DEFAULT = 279,
+    BVEC2 = 280,
+    BVEC3 = 281,
+    BVEC4 = 282,
+    IVEC2 = 283,
+    IVEC3 = 284,
+    IVEC4 = 285,
+    VEC2 = 286,
+    VEC3 = 287,
+    VEC4 = 288,
+    UVEC2 = 289,
+    UVEC3 = 290,
+    UVEC4 = 291,
+    MATRIX2 = 292,
+    MATRIX3 = 293,
+    MATRIX4 = 294,
+    IN_QUAL = 295,
+    OUT_QUAL = 296,
+    INOUT_QUAL = 297,
+    UNIFORM = 298,
+    VARYING = 299,
+    MATRIX2x3 = 300,
+    MATRIX3x2 = 301,
+    MATRIX2x4 = 302,
+    MATRIX4x2 = 303,
+    MATRIX3x4 = 304,
+    MATRIX4x3 = 305,
+    CENTROID = 306,
+    FLAT = 307,
+    SMOOTH = 308,
+    STRUCT = 309,
+    VOID_TYPE = 310,
+    WHILE = 311,
+    SAMPLER2D = 312,
+    SAMPLERCUBE = 313,
+    SAMPLER_EXTERNAL_OES = 314,
+    SAMPLER2DRECT = 315,
+    SAMPLER2DARRAY = 316,
+    ISAMPLER2D = 317,
+    ISAMPLER3D = 318,
+    ISAMPLERCUBE = 319,
+    ISAMPLER2DARRAY = 320,
+    USAMPLER2D = 321,
+    USAMPLER3D = 322,
+    USAMPLERCUBE = 323,
+    USAMPLER2DARRAY = 324,
+    SAMPLER3D = 325,
+    SAMPLER3DRECT = 326,
+    SAMPLER2DSHADOW = 327,
+    SAMPLERCUBESHADOW = 328,
+    SAMPLER2DARRAYSHADOW = 329,
+    LAYOUT = 330,
+    IDENTIFIER = 331,
+    TYPE_NAME = 332,
+    FLOATCONSTANT = 333,
+    INTCONSTANT = 334,
+    UINTCONSTANT = 335,
+    BOOLCONSTANT = 336,
+    FIELD_SELECTION = 337,
+    LEFT_OP = 338,
+    RIGHT_OP = 339,
+    INC_OP = 340,
+    DEC_OP = 341,
+    LE_OP = 342,
+    GE_OP = 343,
+    EQ_OP = 344,
+    NE_OP = 345,
+    AND_OP = 346,
+    OR_OP = 347,
+    XOR_OP = 348,
+    MUL_ASSIGN = 349,
+    DIV_ASSIGN = 350,
+    ADD_ASSIGN = 351,
+    MOD_ASSIGN = 352,
+    LEFT_ASSIGN = 353,
+    RIGHT_ASSIGN = 354,
+    AND_ASSIGN = 355,
+    XOR_ASSIGN = 356,
+    OR_ASSIGN = 357,
+    SUB_ASSIGN = 358,
+    LEFT_PAREN = 359,
+    RIGHT_PAREN = 360,
+    LEFT_BRACKET = 361,
+    RIGHT_BRACKET = 362,
+    LEFT_BRACE = 363,
+    RIGHT_BRACE = 364,
+    DOT = 365,
+    COMMA = 366,
+    COLON = 367,
+    EQUAL = 368,
+    SEMICOLON = 369,
+    BANG = 370,
+    DASH = 371,
+    TILDE = 372,
+    PLUS = 373,
+    STAR = 374,
+    SLASH = 375,
+    PERCENT = 376,
+    LEFT_ANGLE = 377,
+    RIGHT_ANGLE = 378,
+    VERTICAL_BAR = 379,
+    CARET = 380,
+    AMPERSAND = 381,
+    QUESTION = 382
+  };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-
</del><ins>+/* Value type.  */
</ins><span class="cx"> #if ! defined YYSTYPE &amp;&amp; ! defined YYSTYPE_IS_DECLARED
</span><del>-typedef union YYSTYPE
</del><ins>+
+union YYSTYPE
</ins><span class="cx"> {
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -290,6 +290,8 @@
</span><span class="cx">             TIntermNodePair nodePair;
</span><span class="cx">             TIntermTyped* intermTypedNode;
</span><span class="cx">             TIntermAggregate* intermAggregate;
</span><ins>+            TIntermSwitch* intermSwitch;
+            TIntermCase* intermCase;
</ins><span class="cx">         };
</span><span class="cx">         union {
</span><span class="cx">             TPublicType type;
</span><span class="lines">@@ -304,52 +306,42 @@
</span><span class="cx">     } interm;
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+};
</ins><span class="cx"> 
</span><del>-} YYSTYPE;
</del><ins>+typedef union YYSTYPE YYSTYPE;
</ins><span class="cx"> # define YYSTYPE_IS_TRIVIAL 1
</span><del>-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
</del><span class="cx"> # define YYSTYPE_IS_DECLARED 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+/* Location type.  */
</ins><span class="cx"> #if ! defined YYLTYPE &amp;&amp; ! defined YYLTYPE_IS_DECLARED
</span><del>-typedef struct YYLTYPE
</del><ins>+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
</ins><span class="cx"> {
</span><span class="cx">   int first_line;
</span><span class="cx">   int first_column;
</span><span class="cx">   int last_line;
</span><span class="cx">   int last_column;
</span><del>-} YYLTYPE;
-# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
</del><ins>+};
</ins><span class="cx"> # define YYLTYPE_IS_DECLARED 1
</span><span class="cx"> # define YYLTYPE_IS_TRIVIAL 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (TParseContext* context);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
</del><span class="cx"> 
</span><ins>+int yyparse (TParseContext* context, void *scanner);
+
</ins><span class="cx"> #endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED  */
</span><span class="cx"> 
</span><span class="cx"> /* Copy the second part of user declarations.  */
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
</span><del>-extern void yyerror(YYLTYPE* yylloc, TParseContext* context, const char* reason);
</del><ins>+extern void yyerror(YYLTYPE* yylloc, TParseContext* context, void *scanner, const char* reason);
</ins><span class="cx"> 
</span><span class="cx"> #define YYLLOC_DEFAULT(Current, Rhs, N)                      \
</span><span class="cx">   do {                                                       \
</span><del>-      if (YYID(N)) {                                         \
</del><ins>+      if (N) {                                         \
</ins><span class="cx">         (Current).first_file = YYRHSLOC(Rhs, 1).first_file;  \
</span><span class="cx">         (Current).first_line = YYRHSLOC(Rhs, 1).first_line;  \
</span><span class="cx">         (Current).last_file = YYRHSLOC(Rhs, N).last_file;    \
</span><span class="lines">@@ -364,14 +356,14 @@
</span><span class="cx">   } while (0)
</span><span class="cx"> 
</span><span class="cx"> #define VERTEX_ONLY(S, L) {  \
</span><del>-    if (context-&gt;shaderType != SH_VERTEX_SHADER) {  \
</del><ins>+    if (context-&gt;shaderType != GL_VERTEX_SHADER) {  \
</ins><span class="cx">         context-&gt;error(L, &quot; supported in vertex shaders only &quot;, S);  \
</span><span class="cx">         context-&gt;recover();  \
</span><span class="cx">     }  \
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #define FRAG_ONLY(S, L) {  \
</span><del>-    if (context-&gt;shaderType != SH_FRAGMENT_SHADER) {  \
</del><ins>+    if (context-&gt;shaderType != GL_FRAGMENT_SHADER) {  \
</ins><span class="cx">         context-&gt;error(L, &quot; supported in fragment shaders only &quot;, S);  \
</span><span class="cx">         context-&gt;recover();  \
</span><span class="cx">     }  \
</span><span class="lines">@@ -405,11 +397,8 @@
</span><span class="cx"> 
</span><span class="cx"> #ifdef YYTYPE_INT8
</span><span class="cx"> typedef YYTYPE_INT8 yytype_int8;
</span><del>-#elif (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
</del><span class="cx"> #else
</span><del>-typedef short int yytype_int8;
</del><ins>+typedef signed char yytype_int8;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #ifdef YYTYPE_UINT16
</span><span class="lines">@@ -429,8 +418,7 @@
</span><span class="cx"> #  define YYSIZE_T __SIZE_TYPE__
</span><span class="cx"> # elif defined size_t
</span><span class="cx"> #  define YYSIZE_T size_t
</span><del>-# elif ! defined YYSIZE_T &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+# elif ! defined YYSIZE_T
</ins><span class="cx"> #  include &lt;stddef.h&gt; /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #  define YYSIZE_T size_t
</span><span class="cx"> # else
</span><span class="lines">@@ -452,14 +440,33 @@
</span><span class="cx"> # endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if (! defined __GNUC__ || __GNUC__ &lt; 2 \
-      || (__GNUC__ == 2 &amp;&amp; __GNUC_MINOR__ &lt; 5))
-#  define __attribute__(Spec) /* empty */
</del><ins>+#ifndef YY_ATTRIBUTE
+# if (defined __GNUC__                                               \
+      &amp;&amp; (2 &lt; __GNUC__ || (__GNUC__ == 2 &amp;&amp; 96 &lt;= __GNUC_MINOR__)))  \
+     || defined __SUNPRO_C &amp;&amp; 0x5110 &lt;= __SUNPRO_C
+#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+# else
+#  define YY_ATTRIBUTE(Spec) /* empty */
</ins><span class="cx"> # endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#ifndef YY_ATTRIBUTE_PURE
+# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+#endif
+
+#if !defined _Noreturn \
+     &amp;&amp; (!defined __STDC_VERSION__ || __STDC_VERSION__ &lt; 201112)
+# if defined _MSC_VER &amp;&amp; 1200 &lt;= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# endif
+#endif
+
</ins><span class="cx"> /* Suppress unused-variable warnings by &quot;using&quot; E.  */
</span><span class="cx"> #if ! defined lint || defined __GNUC__
</span><span class="cx"> # define YYUSE(E) ((void) (E))
</span><span class="lines">@@ -467,25 +474,26 @@
</span><span class="cx"> # define YYUSE(E) /* empty */
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-
-/* Identity function, used to suppress warnings about constant conditions.  */
-#ifndef lint
-# define YYID(N) (N)
</del><ins>+#if defined __GNUC__ &amp;&amp; 407 &lt;= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+    _Pragma (&quot;GCC diagnostic push&quot;) \
+    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wuninitialized\&quot;&quot;)\
+    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wmaybe-uninitialized\&quot;&quot;)
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+    _Pragma (&quot;GCC diagnostic pop&quot;)
</ins><span class="cx"> #else
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
-    int yyi;
</del><ins>+# define YY_INITIAL_VALUE(Value) Value
</ins><span class="cx"> #endif
</span><del>-{
-  return yyi;
-}
</del><ins>+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
</ins><span class="cx"> #endif
</span><ins>+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> #if ! defined yyoverflow || YYERROR_VERBOSE
</span><span class="cx"> 
</span><span class="cx"> /* The parser invokes alloca or malloc; define the necessary symbols.  */
</span><span class="lines">@@ -503,8 +511,7 @@
</span><span class="cx"> #    define alloca _alloca
</span><span class="cx"> #   else
</span><span class="cx"> #    define YYSTACK_ALLOC alloca
</span><del>-#    if ! defined _ALLOCA_H &amp;&amp; ! defined EXIT_SUCCESS &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+#    if ! defined _ALLOCA_H &amp;&amp; ! defined EXIT_SUCCESS
</ins><span class="cx"> #     include &lt;stdlib.h&gt; /* INFRINGES ON USER NAME SPACE */
</span><span class="cx">       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
</span><span class="cx"> #     ifndef EXIT_SUCCESS
</span><span class="lines">@@ -516,8 +523,8 @@
</span><span class="cx"> # endif
</span><span class="cx"> 
</span><span class="cx"> # ifdef YYSTACK_ALLOC
</span><del>-   /* Pacify GCC's `empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
</del><ins>+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
</ins><span class="cx"> #  ifndef YYSTACK_ALLOC_MAXIMUM
</span><span class="cx">     /* The OS might guarantee only one guard page at the bottom of the stack,
</span><span class="cx">        and a page size can be as small as 4096 bytes.  So we cannot safely
</span><span class="lines">@@ -533,7 +540,7 @@
</span><span class="cx"> #  endif
</span><span class="cx"> #  if (defined __cplusplus &amp;&amp; ! defined EXIT_SUCCESS \
</span><span class="cx">        &amp;&amp; ! ((defined YYMALLOC || defined malloc) \
</span><del>-             &amp;&amp; (defined YYFREE || defined free)))
</del><ins>+             &amp;&amp; (defined YYFREE || defined free)))
</ins><span class="cx"> #   include &lt;stdlib.h&gt; /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #   ifndef EXIT_SUCCESS
</span><span class="cx"> #    define EXIT_SUCCESS 0
</span><span class="lines">@@ -541,15 +548,13 @@
</span><span class="cx"> #  endif
</span><span class="cx"> #  ifndef YYMALLOC
</span><span class="cx"> #   define YYMALLOC malloc
</span><del>-#   if ! defined malloc &amp;&amp; ! defined EXIT_SUCCESS &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+#   if ! defined malloc &amp;&amp; ! defined EXIT_SUCCESS
</ins><span class="cx"> void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #   endif
</span><span class="cx"> #  endif
</span><span class="cx"> #  ifndef YYFREE
</span><span class="cx"> #   define YYFREE free
</span><del>-#   if ! defined free &amp;&amp; ! defined EXIT_SUCCESS &amp;&amp; (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+#   if ! defined free &amp;&amp; ! defined EXIT_SUCCESS
</ins><span class="cx"> void free (void *); /* INFRINGES ON USER NAME SPACE */
</span><span class="cx"> #   endif
</span><span class="cx"> #  endif
</span><span class="lines">@@ -559,8 +564,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if (! defined yyoverflow \
</span><span class="cx">      &amp;&amp; (! defined __cplusplus \
</span><del>-         || (defined YYLTYPE_IS_TRIVIAL &amp;&amp; YYLTYPE_IS_TRIVIAL \
-             &amp;&amp; defined YYSTYPE_IS_TRIVIAL &amp;&amp; YYSTYPE_IS_TRIVIAL)))
</del><ins>+         || (defined YYLTYPE_IS_TRIVIAL &amp;&amp; YYLTYPE_IS_TRIVIAL \
+             &amp;&amp; defined YYSTYPE_IS_TRIVIAL &amp;&amp; YYSTYPE_IS_TRIVIAL)))
</ins><span class="cx"> 
</span><span class="cx"> /* A type that is properly aligned for any stack member.  */
</span><span class="cx"> union yyalloc
</span><span class="lines">@@ -586,16 +591,16 @@
</span><span class="cx">    elements in the stack, and YYPTR gives the new location of the
</span><span class="cx">    stack.  Advance YYPTR to a properly aligned location for the next
</span><span class="cx">    stack.  */
</span><del>-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                                \
-    do                                                                        \
-      {                                                                        \
-        YYSIZE_T yynewbytes;                                                \
-        YYCOPY (&amp;yyptr-&gt;Stack_alloc, Stack, yysize);                        \
-        Stack = &amp;yyptr-&gt;Stack_alloc;                                        \
-        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / sizeof (*yyptr);                                \
-      }                                                                        \
-    while (YYID (0))
</del><ins>+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYSIZE_T yynewbytes;                                            \
+        YYCOPY (&amp;yyptr-&gt;Stack_alloc, Stack, yysize);                    \
+        Stack = &amp;yyptr-&gt;Stack_alloc;                                    \
+        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                 \
+    while (0)
</ins><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -614,7 +619,7 @@
</span><span class="cx">           for (yyi = 0; yyi &lt; (Count); yyi++)   \
</span><span class="cx">             (Dst)[yyi] = (Src)[yyi];            \
</span><span class="cx">         }                                       \
</span><del>-      while (YYID (0))
</del><ins>+      while (0)
</ins><span class="cx"> #  endif
</span><span class="cx"> # endif
</span><span class="cx"> #endif /* !YYCOPY_NEEDED */
</span><span class="lines">@@ -622,25 +627,27 @@
</span><span class="cx"> /* YYFINAL -- State number of the termination state.  */
</span><span class="cx"> #define YYFINAL  114
</span><span class="cx"> /* YYLAST -- Last index in YYTABLE.  */
</span><del>-#define YYLAST   2375
</del><ins>+#define YYLAST   2523
</ins><span class="cx"> 
</span><span class="cx"> /* YYNTOKENS -- Number of terminals.  */
</span><span class="cx"> #define YYNTOKENS  128
</span><span class="cx"> /* YYNNTS -- Number of nonterminals.  */
</span><del>-#define YYNNTS  91
</del><ins>+#define YYNNTS  94
</ins><span class="cx"> /* YYNRULES -- Number of rules.  */
</span><del>-#define YYNRULES  250
-/* YYNRULES -- Number of states.  */
-#define YYNSTATES  373
</del><ins>+#define YYNRULES  273
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  414
</ins><span class="cx"> 
</span><del>-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
</del><ins>+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+   by yylex, with out-of-bounds checking.  */
</ins><span class="cx"> #define YYUNDEFTOK  2
</span><span class="cx"> #define YYMAXUTOK   382
</span><span class="cx"> 
</span><del>-#define YYTRANSLATE(YYX)                                                \
</del><ins>+#define YYTRANSLATE(YYX)                                                \
</ins><span class="cx">   ((unsigned int) (YYX) &lt;= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
</span><span class="cx"> 
</span><del>-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
</del><ins>+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, without out-of-bounds checking.  */
</ins><span class="cx"> static const yytype_uint8 yytranslate[] =
</span><span class="cx"> {
</span><span class="cx">        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
</span><span class="lines">@@ -685,143 +692,37 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #if YYDEBUG
</span><del>-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const yytype_uint16 yyprhs[] =
-{
-       0,     0,     3,     5,     7,     9,    11,    13,    15,    17,
-      19,    23,    25,    30,    32,    36,    39,    42,    44,    46,
-      48,    52,    55,    58,    61,    63,    66,    70,    73,    75,
-      77,    79,    82,    85,    88,    90,    92,    94,    96,   100,
-     104,   106,   110,   114,   116,   118,   122,   126,   130,   134,
-     136,   140,   144,   146,   148,   150,   152,   156,   158,   162,
-     164,   168,   170,   176,   178,   182,   184,   186,   188,   190,
-     192,   194,   198,   200,   203,   206,   209,   214,   220,   227,
-     237,   240,   243,   245,   247,   250,   254,   258,   261,   267,
-     271,   274,   278,   281,   282,   284,   286,   288,   290,   292,
-     296,   302,   309,   315,   317,   320,   325,   331,   336,   339,
-     341,   344,   346,   348,   350,   352,   354,   357,   359,   362,
-     364,   366,   369,   371,   373,   375,   378,   381,   383,   385,
-     388,   390,   392,   394,   399,   401,   405,   407,   411,   415,
-     417,   422,   424,   426,   428,   430,   432,   434,   436,   438,
-     440,   442,   444,   446,   448,   450,   452,   454,   456,   458,
-     460,   462,   464,   466,   468,   470,   472,   474,   476,   478,
-     480,   482,   484,   486,   488,   490,   492,   494,   496,   498,
-     500,   502,   504,   506,   508,   510,   512,   513,   520,   521,
-     527,   529,   532,   536,   541,   543,   547,   549,   554,   556,
-     558,   560,   562,   564,   566,   568,   570,   572,   575,   576,
-     577,   583,   585,   587,   588,   591,   592,   595,   598,   602,
-     604,   607,   609,   612,   618,   622,   624,   626,   631,   632,
-     639,   640,   649,   650,   658,   660,   662,   664,   665,   668,
-     672,   675,   678,   681,   685,   688,   690,   693,   695,   697,
-     698
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int16 yyrhs[] =
-{
-     215,     0,    -1,    76,    -1,    77,    -1,    76,    -1,   130,
-      -1,    79,    -1,    80,    -1,    78,    -1,    81,    -1,   104,
-     157,   105,    -1,   131,    -1,   132,   106,   133,   107,    -1,
-     134,    -1,   132,   110,   129,    -1,   132,    85,    -1,   132,
-      86,    -1,   157,    -1,   135,    -1,   136,    -1,   132,   110,
-     136,    -1,   138,   105,    -1,   137,   105,    -1,   139,    55,
-      -1,   139,    -1,   139,   155,    -1,   138,   111,   155,    -1,
-     140,   104,    -1,   182,    -1,    76,    -1,   132,    -1,    85,
-     141,    -1,    86,   141,    -1,   142,   141,    -1,   118,    -1,
-     116,    -1,   115,    -1,   141,    -1,   143,   119,   141,    -1,
-     143,   120,   141,    -1,   143,    -1,   144,   118,   143,    -1,
-     144,   116,   143,    -1,   144,    -1,   145,    -1,   146,   122,
-     145,    -1,   146,   123,   145,    -1,   146,    87,   145,    -1,
-     146,    88,   145,    -1,   146,    -1,   147,    89,   146,    -1,
-     147,    90,   146,    -1,   147,    -1,   148,    -1,   149,    -1,
-     150,    -1,   151,    91,   150,    -1,   151,    -1,   152,    93,
-     151,    -1,   152,    -1,   153,    92,   152,    -1,   153,    -1,
-     153,   127,   157,   112,   155,    -1,   154,    -1,   141,   156,
-     155,    -1,   113,    -1,    94,    -1,    95,    -1,    96,    -1,
-     103,    -1,   155,    -1,   157,   111,   155,    -1,   154,    -1,
-      76,   108,    -1,   161,   114,    -1,   169,   114,    -1,     7,
-     177,   181,   114,    -1,   174,   159,   186,   109,   114,    -1,
-     174,   159,   186,   109,    76,   114,    -1,   174,   159,   186,
-     109,    76,   106,   158,   107,   114,    -1,   174,   114,    -1,
-     162,   105,    -1,   164,    -1,   163,    -1,   164,   166,    -1,
-     163,   111,   166,    -1,   171,    76,   104,    -1,   176,   129,
-      -1,   176,   129,   106,   158,   107,    -1,   173,   167,   165,
-      -1,   167,   165,    -1,   173,   167,   168,    -1,   167,   168,
-      -1,    -1,    40,    -1,    41,    -1,    42,    -1,   176,    -1,
-     170,    -1,   169,   111,   129,    -1,   169,   111,   129,   106,
-     107,    -1,   169,   111,   129,   106,   158,   107,    -1,   169,
-     111,   129,   113,   190,    -1,   171,    -1,   171,   129,    -1,
-     171,   129,   106,   107,    -1,   171,   129,   106,   158,   107,
-      -1,   171,   129,   113,   190,    -1,     3,    76,    -1,   176,
-      -1,   174,   176,    -1,    53,    -1,    52,    -1,     9,    -1,
-       8,    -1,    44,    -1,     3,    44,    -1,   175,    -1,   172,
-     175,    -1,   172,    -1,   178,    -1,   178,   175,    -1,     9,
-      -1,    40,    -1,    41,    -1,    51,    40,    -1,    51,    41,
-      -1,    43,    -1,   181,    -1,   177,   181,    -1,     4,    -1,
-       5,    -1,     6,    -1,    75,   104,   179,   105,    -1,   180,
-      -1,   179,   111,   180,    -1,    76,    -1,    76,   113,    79,
-      -1,    76,   113,    80,    -1,   182,    -1,   182,   106,   158,
-     107,    -1,    55,    -1,    11,    -1,    12,    -1,    13,    -1,
-      10,    -1,    31,    -1,    32,    -1,    33,    -1,    25,    -1,
-      26,    -1,    27,    -1,    28,    -1,    29,    -1,    30,    -1,
-      34,    -1,    35,    -1,    36,    -1,    37,    -1,    38,    -1,
-      39,    -1,    45,    -1,    46,    -1,    47,    -1,    48,    -1,
-      49,    -1,    50,    -1,    57,    -1,    70,    -1,    58,    -1,
-      61,    -1,    62,    -1,    63,    -1,    64,    -1,    65,    -1,
-      66,    -1,    67,    -1,    68,    -1,    69,    -1,    72,    -1,
-      73,    -1,    74,    -1,    59,    -1,    60,    -1,   183,    -1,
-      77,    -1,    -1,    54,   129,   108,   184,   186,   109,    -1,
-      -1,    54,   108,   185,   186,   109,    -1,   187,    -1,   186,
-     187,    -1,   176,   188,   114,    -1,   174,   176,   188,   114,
-      -1,   189,    -1,   188,   111,   189,    -1,   129,    -1,   129,
-     106,   158,   107,    -1,   155,    -1,   160,    -1,   194,    -1,
-     193,    -1,   191,    -1,   203,    -1,   204,    -1,   207,    -1,
-     214,    -1,   108,   109,    -1,    -1,    -1,   108,   195,   202,
-     196,   109,    -1,   201,    -1,   193,    -1,    -1,   199,   201,
-      -1,    -1,   200,   193,    -1,   108,   109,    -1,   108,   202,
-     109,    -1,   192,    -1,   202,   192,    -1,   114,    -1,   157,
-     114,    -1,    19,   104,   157,   105,   205,    -1,   198,    17,
-     198,    -1,   198,    -1,   157,    -1,   171,   129,   113,   190,
-      -1,    -1,    56,   104,   208,   206,   105,   197,    -1,    -1,
-      16,   209,   198,    56,   104,   157,   105,   114,    -1,    -1,
-      18,   104,   210,   211,   213,   105,   197,    -1,   203,    -1,
-     191,    -1,   206,    -1,    -1,   212,   114,    -1,   212,   114,
-     157,    -1,    15,   114,    -1,    14,   114,    -1,    21,   114,
-      -1,    21,   157,   114,    -1,    20,   114,    -1,   216,    -1,
-     215,   216,    -1,   217,    -1,   160,    -1,    -1,   161,   218,
-     201,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
</del><ins>+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
</ins><span class="cx"> static const yytype_uint16 yyrline[] =
</span><span class="cx"> {
</span><del>-       0,   205,   205,   206,   209,   264,   267,   272,   277,   282,
-     287,   293,   296,   299,   302,   305,   315,   328,   336,   436,
-     439,   447,   450,   456,   460,   467,   473,   482,   490,   493,
-     503,   506,   516,   526,   547,   548,   549,   554,   555,   563,
-     574,   575,   583,   594,   598,   599,   609,   619,   629,   642,
-     643,   653,   666,   670,   674,   678,   679,   692,   693,   706,
-     707,   720,   721,   738,   739,   752,   753,   754,   755,   756,
-     760,   763,   774,   782,   790,   817,   822,   833,   837,   841,
-     845,   852,   907,   910,   917,   925,   946,   967,   977,  1005,
-    1010,  1020,  1025,  1035,  1038,  1041,  1044,  1050,  1057,  1060,
-    1064,  1068,  1072,  1079,  1083,  1087,  1094,  1098,  1102,  1123,
-    1132,  1138,  1141,  1147,  1153,  1160,  1169,  1178,  1186,  1189,
-    1196,  1200,  1207,  1210,  1214,  1218,  1227,  1236,  1244,  1254,
-    1261,  1264,  1267,  1273,  1280,  1283,  1289,  1292,  1295,  1301,
-    1304,  1319,  1323,  1327,  1331,  1335,  1339,  1344,  1349,  1354,
-    1359,  1364,  1369,  1374,  1379,  1384,  1389,  1394,  1399,  1404,
-    1409,  1414,  1419,  1424,  1429,  1434,  1439,  1444,  1448,  1452,
-    1456,  1460,  1464,  1468,  1472,  1476,  1480,  1484,  1488,  1492,
-    1496,  1500,  1504,  1512,  1520,  1524,  1537,  1537,  1540,  1540,
-    1546,  1549,  1565,  1568,  1577,  1581,  1587,  1594,  1609,  1613,
-    1617,  1618,  1624,  1625,  1626,  1627,  1628,  1632,  1633,  1633,
-    1633,  1643,  1644,  1648,  1648,  1649,  1649,  1654,  1657,  1667,
-    1670,  1676,  1677,  1681,  1689,  1693,  1703,  1708,  1725,  1725,
-    1730,  1730,  1737,  1737,  1745,  1748,  1754,  1757,  1763,  1767,
-    1774,  1781,  1788,  1795,  1806,  1815,  1819,  1826,  1829,  1835,
-    1835
</del><ins>+       0,   211,   211,   212,   215,   239,   242,   247,   252,   257,
+     262,   268,   271,   274,   277,   280,   283,   289,   297,   308,
+     312,   320,   323,   329,   333,   340,   346,   355,   363,   369,
+     376,   386,   389,   392,   395,   405,   406,   407,   408,   416,
+     417,   420,   423,   430,   431,   434,   440,   441,   445,   452,
+     453,   456,   459,   462,   468,   469,   472,   478,   479,   486,
+     487,   494,   495,   502,   503,   509,   510,   516,   517,   523,
+     524,   530,   531,   539,   540,   541,   542,   546,   547,   548,
+     552,   556,   560,   564,   571,   574,   585,   593,   601,   629,
+     635,   646,   650,   654,   658,   665,   721,   724,   731,   739,
+     760,   781,   791,   819,   824,   834,   839,   849,   852,   855,
+     858,   864,   871,   874,   878,   882,   887,   892,   899,   903,
+     907,   911,   916,   921,   925,   932,   942,   948,   951,   957,
+     963,   970,   979,   988,   996,   999,  1006,  1010,  1017,  1020,
+    1024,  1028,  1037,  1046,  1054,  1064,  1076,  1079,  1082,  1088,
+    1095,  1098,  1104,  1107,  1110,  1116,  1119,  1124,  1139,  1143,
+    1147,  1151,  1155,  1159,  1164,  1169,  1174,  1179,  1184,  1189,
+    1194,  1199,  1204,  1209,  1214,  1219,  1224,  1229,  1234,  1239,
+    1244,  1249,  1254,  1259,  1264,  1268,  1272,  1276,  1280,  1284,
+    1288,  1292,  1296,  1300,  1304,  1308,  1312,  1316,  1320,  1324,
+    1332,  1340,  1344,  1357,  1357,  1360,  1360,  1366,  1369,  1385,
+    1388,  1397,  1401,  1407,  1414,  1429,  1433,  1437,  1438,  1444,
+    1445,  1446,  1447,  1448,  1449,  1450,  1454,  1455,  1455,  1455,
+    1465,  1466,  1470,  1470,  1471,  1471,  1476,  1479,  1489,  1492,
+    1498,  1499,  1503,  1511,  1515,  1522,  1522,  1529,  1532,  1539,
+    1544,  1559,  1559,  1564,  1564,  1571,  1571,  1579,  1582,  1588,
+    1591,  1597,  1601,  1608,  1611,  1614,  1617,  1620,  1629,  1633,
+    1640,  1643,  1649,  1649
</ins><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -881,16 +782,17 @@
</span><span class="cx">   &quot;compound_statement&quot;, &quot;$@3&quot;, &quot;$@4&quot;, &quot;statement_no_new_scope&quot;,
</span><span class="cx">   &quot;statement_with_scope&quot;, &quot;$@5&quot;, &quot;$@6&quot;, &quot;compound_statement_no_new_scope&quot;,
</span><span class="cx">   &quot;statement_list&quot;, &quot;expression_statement&quot;, &quot;selection_statement&quot;,
</span><del>-  &quot;selection_rest_statement&quot;, &quot;condition&quot;, &quot;iteration_statement&quot;, &quot;$@7&quot;,
-  &quot;$@8&quot;, &quot;$@9&quot;, &quot;for_init_statement&quot;, &quot;conditionopt&quot;, &quot;for_rest_statement&quot;,
</del><ins>+  &quot;selection_rest_statement&quot;, &quot;switch_statement&quot;, &quot;$@7&quot;, &quot;case_label&quot;,
+  &quot;condition&quot;, &quot;iteration_statement&quot;, &quot;$@8&quot;, &quot;$@9&quot;, &quot;$@10&quot;,
+  &quot;for_init_statement&quot;, &quot;conditionopt&quot;, &quot;for_rest_statement&quot;,
</ins><span class="cx">   &quot;jump_statement&quot;, &quot;translation_unit&quot;, &quot;external_declaration&quot;,
</span><del>-  &quot;function_definition&quot;, &quot;$@10&quot;, YY_NULL
</del><ins>+  &quot;function_definition&quot;, &quot;$@11&quot;, YY_NULLPTR
</ins><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> # ifdef YYPRINT
</span><del>-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
</del><ins>+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
</ins><span class="cx"> static const yytype_uint16 yytoknum[] =
</span><span class="cx"> {
</span><span class="cx">        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
</span><span class="lines">@@ -909,289 +811,248 @@
</span><span class="cx"> };
</span><span class="cx"> # endif
</span><span class="cx"> 
</span><del>-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
</del><ins>+#define YYPACT_NINF -347
+
+#define yypact_value_is_default(Yystate) \
+  (!!((Yystate) == (-347)))
+
+#define YYTABLE_NINF -233
+
+#define yytable_value_is_error(Yytable_value) \
+  0
+
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
+static const yytype_int16 yypact[] =
</ins><span class="cx"> {
</span><del>-       0,   128,   129,   129,   130,   131,   131,   131,   131,   131,
-     131,   132,   132,   132,   132,   132,   132,   133,   134,   135,
-     135,   136,   136,   137,   137,   138,   138,   139,   140,   140,
-     141,   141,   141,   141,   142,   142,   142,   143,   143,   143,
-     144,   144,   144,   145,   146,   146,   146,   146,   146,   147,
-     147,   147,   148,   149,   150,   151,   151,   152,   152,   153,
-     153,   154,   154,   155,   155,   156,   156,   156,   156,   156,
-     157,   157,   158,   159,   160,   160,   160,   160,   160,   160,
-     160,   161,   162,   162,   163,   163,   164,   165,   165,   166,
-     166,   166,   166,   167,   167,   167,   167,   168,   169,   169,
-     169,   169,   169,   170,   170,   170,   170,   170,   170,   171,
-     171,   172,   172,   173,   174,   174,   174,   174,   174,   174,
-     174,   174,   175,   175,   175,   175,   175,   175,   176,   176,
-     177,   177,   177,   178,   179,   179,   180,   180,   180,   181,
-     181,   182,   182,   182,   182,   182,   182,   182,   182,   182,
-     182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
-     182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
-     182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
-     182,   182,   182,   182,   182,   182,   184,   183,   185,   183,
-     186,   186,   187,   187,   188,   188,   189,   189,   190,   191,
-     192,   192,   193,   193,   193,   193,   193,   194,   195,   196,
-     194,   197,   197,   199,   198,   200,   198,   201,   201,   202,
-     202,   203,   203,   204,   205,   205,   206,   206,   208,   207,
-     209,   207,   210,   207,   211,   211,   212,   212,   213,   213,
-     214,   214,   214,   214,   214,   215,   215,   216,   216,   218,
-     217
</del><ins>+    2161,    -4,  -347,  -347,  -347,   142,  -347,  -347,  -347,  -347,
+    -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,
+    -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,
+    -347,  -347,  -347,  -347,  -347,  -347,  -347,    -3,  -347,  -347,
+     -58,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,
+    -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,   -57,
+    -347,  -347,   -38,   -63,   -55,     3,   -50,  -347,    84,    11,
+    1180,  -347,  -347,  2446,    11,  -347,   -40,  -347,  2086,  -347,
+    -347,  -347,  -347,  2446,  -347,  -347,  -347,  -347,  -347,   -23,
+      31,  -347,    35,  -347,    78,  -347,  -347,  -347,  -347,  -347,
+    2310,   132,   106,  -347,     7,   -27,  -347,    60,  -347,  2236,
+    -347,  -347,  -347,  1250,  -347,  -347,   -33,  2236,  -347,    17,
+     -72,  -347,   408,  -347,  -347,  -347,  -347,   106,  2310,   -24,
+    -347,  1348,  1639,  -347,    79,  2310,   106,  1831,  -347,    71,
+    -347,  -347,  -347,  -347,  -347,  1639,  1639,  1639,  -347,  -347,
+    -347,  -347,  -347,  -347,  -347,    19,  -347,  -347,  -347,    73,
+     -21,  1734,    89,  -347,  1639,    66,    72,   108,   -64,    50,
+      81,    74,    87,   114,   123,   -62,  -347,   110,  -347,  -347,
+    1916,  2236,   116,  -347,    31,   104,   105,  -347,   117,   118,
+     109,  1446,   120,  1639,   113,   122,   111,  -347,  -347,    56,
+    -347,  -347,   -13,  -347,   -38,   125,  -347,  -347,  -347,  -347,
+     524,  -347,  -347,  -347,  -347,  -347,  -347,   124,  -347,  -347,
+    1541,  1639,   119,   127,  -347,  -347,   106,   129,    -8,  -347,
+     -66,  -347,  -347,  -347,    -9,  -347,  -347,  1639,  2378,  -347,
+    -347,  1639,   131,  -347,  -347,  -347,  1639,  1639,  1639,  1639,
+    1639,  1639,  1639,  1639,  1639,  1639,  1639,  1639,  1639,  1639,
+    1639,  1639,  1639,  1639,  1639,  1639,  -347,  -347,  2001,  -347,
+    -347,  -347,  -347,  -347,   133,  -347,  1639,  -347,  -347,    20,
+    1639,   128,  -347,  -347,  -347,   640,  -347,  -347,  -347,  -347,
+    -347,  -347,  -347,  -347,  -347,  -347,  -347,  1639,  1639,  -347,
+    -347,  -347,  1639,   126,   135,  -347,  1639,   130,    22,  1639,
+     106,  -347,   -78,  -347,  -347,   138,   136,  -347,   145,  -347,
+    -347,  -347,  -347,  -347,    66,    66,    72,    72,   108,   108,
+     108,   108,   -64,   -64,    50,    81,    74,    87,   114,   123,
+      86,  -347,   190,    35,   872,   988,     5,  -347,    10,  -347,
+    1085,   640,  -347,  -347,   143,  1639,   139,  -347,  1639,  -347,
+     144,  -347,  1639,  -347,  -347,  1639,   149,  -347,  -347,  -347,
+    -347,  1085,   133,  -347,   136,   106,  2310,   152,   150,  -347,
+    -347,  1639,  -347,  -347,   151,  -347,  1639,  -347,   146,   157,
+     246,  -347,   156,   154,   756,  -347,  -347,   155,    21,  1639,
+     756,   133,  -347,  1639,  -347,  -347,  -347,  -347,   158,   136,
+    -347,  -347,  -347,  -347
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
</del><ins>+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
+static const yytype_uint16 yydefact[] =
</ins><span class="cx"> {
</span><del>-       0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
-       3,     1,     4,     1,     3,     2,     2,     1,     1,     1,
-       3,     2,     2,     2,     1,     2,     3,     2,     1,     1,
-       1,     2,     2,     2,     1,     1,     1,     1,     3,     3,
-       1,     3,     3,     1,     1,     3,     3,     3,     3,     1,
-       3,     3,     1,     1,     1,     1,     3,     1,     3,     1,
-       3,     1,     5,     1,     3,     1,     1,     1,     1,     1,
-       1,     3,     1,     2,     2,     2,     4,     5,     6,     9,
-       2,     2,     1,     1,     2,     3,     3,     2,     5,     3,
-       2,     3,     2,     0,     1,     1,     1,     1,     1,     3,
-       5,     6,     5,     1,     2,     4,     5,     4,     2,     1,
-       2,     1,     1,     1,     1,     1,     2,     1,     2,     1,
-       1,     2,     1,     1,     1,     2,     2,     1,     1,     2,
-       1,     1,     1,     4,     1,     3,     1,     3,     3,     1,
-       4,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     0,     6,     0,     5,
-       1,     2,     3,     4,     1,     3,     1,     4,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     2,     0,     0,
-       5,     1,     1,     0,     2,     0,     2,     2,     3,     1,
-       2,     1,     2,     5,     3,     1,     1,     4,     0,     6,
-       0,     8,     0,     7,     1,     1,     1,     0,     2,     3,
-       2,     2,     2,     3,     2,     1,     2,     1,     1,     0,
-       3
</del><ins>+       0,     0,   146,   147,   148,     0,   130,   138,   162,   159,
+     160,   161,   166,   167,   168,   169,   170,   171,   163,   164,
+     165,   172,   173,   174,   175,   176,   177,   139,   140,   143,
+     131,   178,   179,   180,   181,   182,   183,     0,   128,   127,
+       0,   158,   184,   186,   199,   200,   187,   188,   189,   190,
+     191,   192,   193,   194,   195,   185,   196,   197,   198,     0,
+     202,   271,   272,     0,    97,   107,     0,   112,   118,   135,
+       0,   133,   125,     0,   136,   144,   155,   201,     0,   268,
+     270,   132,   124,     0,   141,   142,     2,     3,   205,     0,
+       0,    88,     0,    95,   107,   129,   108,   109,   110,    98,
+       0,   107,     0,    89,     2,   119,   134,     0,    94,     0,
+     126,   145,   137,     0,     1,   269,     0,     0,   203,   152,
+       0,   150,     0,   273,    99,   104,   106,   111,     0,   113,
+     100,     0,     0,    87,     0,     0,     0,     0,   207,     4,
+       8,     6,     7,     9,    30,     0,     0,     0,   156,    37,
+      36,    38,    35,     5,    11,    31,    13,    18,    19,     0,
+       0,    24,     0,    39,     0,    43,    46,    49,    54,    57,
+      59,    61,    63,    65,    67,    69,    86,     0,    28,    90,
+       0,     0,     0,   149,     0,     0,     0,   253,     0,     0,
+       0,     0,     0,     0,     0,     0,   227,   236,   240,    39,
+      71,    84,     0,   216,     0,   144,   219,   238,   218,   217,
+       0,   220,   221,   222,   223,   224,   225,   101,   103,   105,
+       0,     0,     0,     0,   215,   123,     0,   213,     0,   211,
+       0,   208,    32,    33,     0,    15,    16,     0,     0,    22,
+      21,     0,   158,    25,    27,    34,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,   157,   206,     0,   153,
+     154,   151,   264,   263,   234,   255,     0,   267,   265,     0,
+       0,     0,   248,   251,   226,     0,    74,    75,    77,    76,
+      79,    80,    81,    82,    83,    78,    73,     0,     0,   241,
+     237,   239,     0,     0,     0,   117,     0,   120,     0,     0,
+       0,   209,     0,    91,    10,     0,    17,    29,    14,    20,
+      26,    40,    41,    42,    45,    44,    47,    48,    52,    53,
+      50,    51,    55,    56,    58,    60,    62,    64,    66,    68,
+       0,   204,     0,     0,     0,     0,     0,   266,     0,   247,
+       0,   228,    72,    85,     0,     0,   114,   121,     0,   210,
+       0,   212,     0,    92,    12,     0,     0,   233,   235,   258,
+     257,   260,   234,   245,   249,     0,     0,     0,     0,   102,
+     115,     0,   122,   214,     0,    70,     0,   259,     0,     0,
+     244,   242,     0,     0,     0,   229,   116,     0,     0,   261,
+       0,   234,   246,     0,   231,   252,   230,    93,     0,   262,
+     256,   243,   250,   254
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_uint8 yydefact[] =
</del><ins>+  /* YYPGOTO[NTERM-NUM].  */
+static const yytype_int16 yypgoto[] =
</ins><span class="cx"> {
</span><del>-       0,     0,   130,   131,   132,     0,   114,   122,   145,   142,
-     143,   144,   149,   150,   151,   152,   153,   154,   146,   147,
-     148,   155,   156,   157,   158,   159,   160,   123,   124,   127,
-     115,   161,   162,   163,   164,   165,   166,     0,   112,   111,
-       0,   141,   167,   169,   182,   183,   170,   171,   172,   173,
-     174,   175,   176,   177,   178,   168,   179,   180,   181,     0,
-     185,   248,   249,     0,    83,    93,     0,    98,   103,   119,
-       0,   117,   109,     0,   120,   128,   139,   184,     0,   245,
-     247,   116,   108,     0,   125,   126,     2,     3,   188,     0,
-       0,    74,     0,    81,    93,   113,    94,    95,    96,    84,
-       0,    93,     0,    75,     2,   104,   118,     0,    80,     0,
-     110,   129,   121,     0,     1,   246,     0,     0,   186,   136,
-       0,   134,     0,   250,    85,    90,    92,    97,     0,    99,
-      86,     0,     0,    73,     0,     0,     0,     0,   190,     4,
-       8,     6,     7,     9,     0,     0,     0,    36,    35,    34,
-       5,    11,    30,    13,    18,    19,     0,     0,    24,     0,
-      37,     0,    40,    43,    44,    49,    52,    53,    54,    55,
-      57,    59,    61,    72,     0,    28,    76,     0,     0,     0,
-     133,     0,     0,     0,   230,     0,     0,     0,     0,     0,
-     208,   217,   221,    37,    63,    70,     0,   199,     0,   139,
-     202,   219,   201,   200,     0,   203,   204,   205,   206,    87,
-      89,    91,     0,     0,   105,     0,   198,   107,     0,   196,
-       0,   194,     0,   191,    31,    32,     0,    15,    16,     0,
-       0,    22,    21,     0,    23,    25,    27,    33,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   140,   189,     0,   137,   138,   135,   241,   240,
-     215,   232,     0,   244,   242,     0,   228,   207,     0,    66,
-      67,    68,    69,    65,     0,     0,   222,   218,   220,     0,
-     100,     0,   102,   106,     0,     0,     0,   192,     0,    77,
-      10,     0,    17,     2,     3,    14,    20,    26,    38,    39,
-      42,    41,    47,    48,    45,    46,    50,    51,    56,    58,
-      60,     0,   187,     0,     0,     0,     0,     0,   243,     0,
-     209,    64,    71,     0,   101,   193,     0,   195,     0,    78,
-      12,     0,     0,   214,   216,   235,   234,   237,   215,   226,
-       0,     0,     0,     0,    88,   197,     0,    62,     0,   236,
-       0,     0,   225,   223,     0,     0,   210,     0,     0,   238,
-       0,   215,     0,   212,   229,   211,    79,     0,   239,   233,
-     224,   227,   231
</del><ins>+    -347,   -39,  -347,  -347,  -347,  -347,  -347,  -347,    32,  -347,
+    -347,  -347,  -347,    63,  -347,   -48,   -37,   -90,   -54,    12,
+      14,    16,    18,    23,     9,  -347,   -96,  -127,  -347,  -138,
+    -125,  -347,    13,    15,  -347,  -347,  -347,   147,   184,   178,
+     153,  -347,  -347,  -325,  -347,  -347,  -106,   -47,   -68,   277,
+    -347,  -347,   100,     0,  -347,  -347,  -347,  -347,  -101,  -123,
+      61,   -22,  -214,   -56,  -202,  -323,  -102,  -347,  -347,  -109,
+    -346,  -347,  -347,   -88,     8,   -53,  -347,  -347,  -347,  -347,
+    -347,   -77,  -347,  -347,  -347,  -347,  -347,  -347,  -347,  -347,
+    -347,   217,  -347,  -347
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYDEFGOTO[NTERM-NUM].  */
</del><ins>+  /* YYDEFGOTO[NTERM-NUM].  */
</ins><span class="cx"> static const yytype_int16 yydefgoto[] =
</span><span class="cx"> {
</span><del>-      -1,   219,   150,   151,   152,   291,   153,   154,   155,   156,
-     157,   158,   159,   193,   161,   162,   163,   164,   165,   166,
-     167,   168,   169,   170,   171,   172,   194,   195,   274,   196,
-     174,   109,   197,   198,    63,    64,    65,   125,    99,   100,
</del><ins>+      -1,   227,   153,   154,   155,   315,   156,   157,   158,   159,
+     160,   161,   162,   199,   164,   165,   166,   167,   168,   169,
+     170,   171,   172,   173,   174,   175,   200,   201,   297,   202,
+     177,   109,   203,   204,    63,    64,    65,   125,    99,   100,
</ins><span class="cx">      126,    66,    67,    68,    69,   101,    70,    71,    72,    73,
</span><del>-      74,   120,   121,    75,   175,    77,   178,   117,   137,   138,
-     220,   221,   217,   200,   201,   202,   203,   268,   343,   364,
-     313,   314,   315,   365,   204,   205,   206,   353,   342,   207,
-     319,   260,   316,   337,   350,   351,   208,    78,    79,    80,
-      92
</del><ins>+      74,   120,   121,   178,    76,    77,   181,   117,   137,   138,
+     228,   229,   225,   206,   207,   208,   209,   285,   378,   405,
+     342,   343,   344,   406,   210,   211,   212,   391,   213,   392,
+     214,   377,   215,   350,   274,   345,   371,   388,   389,   216,
+      78,    79,    80,    92
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -309
-static const yytype_int16 yypact[] =
-{
-    2013,   -27,  -309,  -309,  -309,   154,  -309,  -309,  -309,  -309,
-    -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,
-    -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,
-    -309,  -309,  -309,  -309,  -309,  -309,  -309,    98,  -309,  -309,
-     -40,  -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,
-    -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,   -46,
-    -309,  -309,   -42,   -23,     8,     5,   -87,  -309,    91,    14,
-    1130,  -309,  -309,  2298,    14,  -309,    -1,  -309,  1938,  -309,
-    -309,  -309,  -309,  2298,  -309,  -309,  -309,  -309,  -309,    13,
-      47,  -309,    43,  -309,    39,  -309,  -309,  -309,  -309,  -309,
-    2162,   124,    94,  -309,    51,   -14,  -309,    66,  -309,  2088,
-    -309,  -309,  -309,  1491,  -309,  -309,    62,  2088,  -309,    48,
-     -83,  -309,   358,  -309,  -309,  -309,  -309,    94,  2162,    -9,
-    -309,  1200,  1491,  -309,   148,  2162,    94,  1683,  -309,    89,
-    -309,  -309,  -309,  -309,  1491,  1491,  1491,  -309,  -309,  -309,
-    -309,  -309,    10,  -309,  -309,  -309,    92,    20,  1586,    96,
-    -309,  1491,    53,   -76,  -309,   -62,    90,  -309,  -309,  -309,
-     104,   101,   -61,  -309,    95,  -309,  -309,  1768,  2088,   103,
-    -309,    47,    82,    84,  -309,    97,    99,    93,  1298,   105,
-     102,  -309,  -309,   -10,  -309,  -309,   -13,  -309,   -42,     2,
-    -309,  -309,  -309,  -309,   474,  -309,  -309,  -309,  -309,   106,
-    -309,  -309,  1393,  1491,  -309,   107,  -309,  -309,    94,   109,
-       4,  -309,   -58,  -309,  -309,  -309,    22,  -309,  -309,  1491,
-    2230,  -309,  -309,  1491,   112,  -309,  -309,  -309,  1491,  1491,
-    1491,  1491,  1491,  1491,  1491,  1491,  1491,  1491,  1491,  1491,
-    1491,  1491,  -309,  -309,  1853,  -309,  -309,  -309,  -309,  -309,
-     100,  -309,  1491,  -309,  -309,    36,  -309,  -309,   590,  -309,
-    -309,  -309,  -309,  -309,  1491,  1491,  -309,  -309,  -309,  1491,
-    -309,   113,  -309,  -309,    42,  1491,    94,  -309,   -73,  -309,
-    -309,   115,   108,    89,   119,  -309,  -309,  -309,  -309,  -309,
-      53,    53,  -309,  -309,  -309,  -309,   -62,   -62,  -309,   104,
-     101,    73,  -309,   169,    43,   822,   938,    25,  -309,  1035,
-     590,  -309,  -309,   120,  -309,  -309,   121,  -309,  1491,  -309,
-    -309,  1491,   122,  -309,  -309,  -309,  -309,  1035,   100,   108,
-      94,  2162,   125,   123,  -309,  -309,   126,  -309,  1491,  -309,
-     117,   129,   212,  -309,   139,   706,  -309,   141,    29,  1491,
-     706,   100,  1491,  -309,  -309,  -309,  -309,   142,   108,  -309,
-    -309,  -309,  -309
-};
-
-/* YYPGOTO[NTERM-NUM].  */
-static const yytype_int16 yypgoto[] =
-{
-    -309,   -39,  -309,  -309,  -309,  -309,  -309,  -309,     7,  -309,
-    -309,  -309,  -309,     1,  -309,   -54,  -309,  -101,   -57,  -309,
-    -309,  -309,     9,   -11,     3,  -309,  -110,  -126,  -309,  -138,
-    -122,  -309,    11,    16,  -309,  -309,  -309,   130,   165,   159,
-     133,  -309,  -309,  -299,  -309,  -309,  -102,   -30,   -66,   257,
-    -309,  -309,    83,    -6,     0,  -309,  -309,  -309,  -104,  -125,
-      45,   -21,  -208,   -50,  -194,  -296,  -309,  -309,  -309,   -93,
-    -308,  -309,  -309,   -90,     6,   -47,  -309,  -309,   -67,  -309,
-    -309,  -309,  -309,  -309,  -309,  -309,  -309,  -309,   193,  -309,
-    -309
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -214
</del><ins>+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
</ins><span class="cx"> static const yytype_int16 yytable[] =
</span><span class="cx"> {
</span><del>-      76,    89,   123,   173,   110,   282,   216,   135,   226,   215,
-     278,    61,   223,   177,    95,   135,    62,    81,   288,   334,
-     340,   173,   180,     7,   102,   242,   243,   103,   181,   105,
-     352,   250,   235,   328,   127,   135,    86,    87,   340,   106,
-     240,   329,   241,   136,   112,    96,    97,    98,    95,    82,
-     265,   136,   223,   370,    27,    28,   289,    29,    90,   363,
-     244,   245,   127,   129,   363,    37,   251,   111,    88,   218,
-      76,   136,    91,    76,   254,   135,   135,   116,    76,    96,
-      97,    98,    93,    76,   269,   270,   271,   216,   209,    61,
-     281,   292,   131,   272,    62,   227,   228,   212,   275,   132,
-      76,   276,   173,   273,   213,   113,   -28,   297,   113,    76,
-     -82,   136,   136,   311,   160,   286,   229,    76,   287,    94,
-     230,   118,   199,   119,   317,   232,   278,   290,    76,   223,
-     338,   233,   160,   275,   367,    76,   275,    76,    84,    85,
-     275,   302,   303,   304,   305,   224,   225,   275,   321,   322,
-     318,   122,   135,   286,   371,   130,   325,   323,     2,     3,
-       4,   179,   237,   326,    96,    97,    98,   104,    87,   173,
-      86,    87,   238,   239,   133,   173,   176,    76,    76,   246,
-     247,   339,   255,   256,   275,   331,   300,   301,   136,   306,
-     307,   295,    81,   -29,   249,   248,   258,   231,   259,   339,
-     236,   261,   252,   262,   199,   347,   346,   263,  -213,   266,
-     358,   267,   279,   160,   283,   285,  -141,   341,   173,   275,
-     324,   368,   330,  -185,   333,   332,   348,   344,   345,   361,
-     355,   359,   356,   357,   360,   341,   216,   296,   309,   298,
-     299,   160,   160,   160,   160,   160,   160,   160,   160,   160,
-     160,   160,   362,   310,    76,   366,   372,   308,   210,   124,
-     128,   211,    83,   284,   257,   327,   335,   369,   199,   336,
-     349,   115,     0,     0,   320,   110,     0,     0,     0,     0,
-     160,     0,     0,     0,     0,     0,   160,     0,     0,     0,
</del><ins>+      75,    89,   110,   135,   123,   224,   223,   305,   301,   234,
+     312,   135,    95,    61,   231,    62,   180,   176,    86,    87,
+       7,   368,   106,   253,   254,   375,   390,   112,   362,   105,
+     264,   135,   127,   183,   243,   176,   363,    84,    85,   184,
+      81,   136,    93,    96,    97,    98,   375,    90,   313,   136,
+      88,    27,    28,   279,    29,   411,    94,   231,   255,   256,
+     127,   102,    37,   129,   103,   265,   113,   226,   281,   136,
+      75,   404,    82,   111,   135,   135,    91,   404,    75,   131,
+     268,   179,   220,   116,   240,   118,   132,    95,   217,   221,
+     241,    61,   357,    62,   224,   304,   314,   176,   298,   316,
+      75,   299,   298,   310,   235,   236,   311,   119,   -96,    75,
+     372,   130,   136,   136,   320,   373,   298,    75,    96,    97,
+      98,   298,   205,    81,   176,   237,   408,   340,    75,   238,
+     182,   298,   298,   310,   347,    75,   359,    75,   346,   257,
+     258,   380,   348,   122,   382,   231,     2,     3,     4,   301,
+     286,   287,   288,   289,   290,   291,   292,   293,   294,   295,
+     104,    87,   135,   328,   329,   330,   331,   396,   133,   296,
+     352,   353,    96,    97,    98,   -29,   163,   354,   239,   224,
+      75,    75,    86,    87,   360,   246,   247,   248,   249,   412,
+     250,   251,   252,   244,   163,   269,   270,   298,   365,   260,
+     136,   324,   325,   332,   333,   262,   176,   259,   232,   233,
+     205,   261,   374,   176,   326,   327,   263,   266,   272,   273,
+     284,   275,   276,   277,   280,   282,   283,   245,   224,   -28,
+     302,   224,   306,   374,   307,   309,   -23,   384,   385,   355,
+     349,  -232,   356,   358,   376,   364,   366,   298,   398,   -30,
+     379,   383,   381,   386,   224,   367,   163,   394,   397,   395,
+     399,   409,   400,   401,   196,   376,   176,   403,    75,   407,
+     319,   334,   413,   339,   335,   218,   224,   336,   124,   128,
+     337,   219,    83,   163,   271,   205,   338,   308,   361,   369,
+     402,   410,   370,   351,   387,   115,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,   110,   321,
+     322,   323,   163,   163,   163,   163,   163,   163,   163,   163,
+     163,   163,   163,   163,   163,   163,   163,   163,     0,     0,
+       0,     0,     0,     0,     0,     0,   393,     0,     0,     0,
+       0,     0,     0,     0,   205,   205,     0,     0,     0,     0,
+     205,   205,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   163,     0,     0,     0,     0,
+       0,   205,   163,     0,     0,     0,    75,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,   354,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,   199,   199,     0,     0,   199,
-     199,     0,     0,     0,     0,     0,     0,     0,     0,   160,
-       0,     0,     0,     0,     0,     0,     0,   199,     0,     0,
-       0,    76,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,   199,     0,     0,     0,     0,
-     199,     1,     2,     3,     4,     5,     6,     7,     8,     9,
-      10,    11,   182,   183,   184,     0,   185,   186,   187,   188,
-       0,     0,     0,    12,    13,    14,    15,    16,    17,    18,
</del><ins>+       0,     0,     0,     0,   205,     0,     0,     0,     0,     0,
+     205,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     1,     2,     3,     4,     5,     6,     7,     8,     9,
+      10,    11,   185,   186,   187,   163,   188,   189,   190,   191,
+     192,   193,   194,    12,    13,    14,    15,    16,    17,    18,
</ins><span class="cx">       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
</span><span class="cx">        0,    29,    30,    31,    32,    33,    34,    35,    36,    37,
</span><del>-      38,    39,    40,    41,   189,    42,    43,    44,    45,    46,
</del><ins>+      38,    39,    40,    41,   195,    42,    43,    44,    45,    46,
</ins><span class="cx">       47,    48,    49,    50,    51,    52,    53,    54,    55,     0,
</span><span class="cx">       56,    57,    58,    59,   139,    60,   140,   141,   142,   143,
</span><del>-       0,     0,     0,   144,   145,     0,     0,     0,     0,     0,
</del><ins>+     144,     0,     0,   145,   146,     0,     0,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,     0,   146,     0,     0,     0,   190,   191,     0,     0,
-       0,     0,   192,   147,   148,     0,   149,     1,     2,     3,
-       4,     5,     6,     7,     8,     9,    10,    11,   182,   183,
-     184,     0,   185,   186,   187,   188,     0,     0,     0,    12,
</del><ins>+       0,     0,   147,     0,     0,     0,   196,   197,     0,     0,
+       0,     0,   198,   149,   150,   151,   152,     1,     2,     3,
+       4,     5,     6,     7,     8,     9,    10,    11,   185,   186,
+     187,     0,   188,   189,   190,   191,   192,   193,   194,    12,
</ins><span class="cx">       13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
</span><span class="cx">       23,    24,    25,    26,    27,    28,     0,    29,    30,    31,
</span><span class="cx">       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
</span><del>-     189,    42,    43,    44,    45,    46,    47,    48,    49,    50,
</del><ins>+     195,    42,    43,    44,    45,    46,    47,    48,    49,    50,
</ins><span class="cx">       51,    52,    53,    54,    55,     0,    56,    57,    58,    59,
</span><del>-     139,    60,   140,   141,   142,   143,     0,     0,     0,   144,
-     145,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   146,     0,
-       0,     0,   190,   277,     0,     0,     0,     0,   192,   147,
-     148,     0,   149,     1,     2,     3,     4,     5,     6,     7,
-       8,     9,    10,    11,   182,   183,   184,     0,   185,   186,
-     187,   188,     0,     0,     0,    12,    13,    14,    15,    16,
</del><ins>+     139,    60,   140,   141,   142,   143,   144,     0,     0,   145,
+     146,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,   147,     0,
+       0,     0,   196,   300,     0,     0,     0,     0,   198,   149,
+     150,   151,   152,     1,     2,     3,     4,     5,     6,     7,
+       8,     9,    10,    11,   185,   186,   187,     0,   188,   189,
+     190,   191,   192,   193,   194,    12,    13,    14,    15,    16,
</ins><span class="cx">       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
</span><span class="cx">       27,    28,     0,    29,    30,    31,    32,    33,    34,    35,
</span><del>-      36,    37,    38,    39,    40,    41,   189,    42,    43,    44,
</del><ins>+      36,    37,    38,    39,    40,    41,   195,    42,    43,    44,
</ins><span class="cx">       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
</span><span class="cx">       55,     0,    56,    57,    58,    59,   139,    60,   140,   141,
</span><del>-     142,   143,     0,     0,     0,   144,   145,     0,     0,     0,
</del><ins>+     142,   143,   144,     0,     0,   145,   146,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,     0,     0,     0,   146,     0,     0,     0,   190,     0,
-       0,     0,     0,     0,   192,   147,   148,     0,   149,     1,
</del><ins>+       0,     0,     0,     0,   147,     0,     0,     0,   196,     0,
+       0,     0,     0,     0,   198,   149,   150,   151,   152,     1,
</ins><span class="cx">        2,     3,     4,     5,     6,     7,     8,     9,    10,    11,
</span><del>-     182,   183,   184,     0,   185,   186,   187,   188,     0,     0,
-       0,    12,    13,    14,    15,    16,    17,    18,    19,    20,
</del><ins>+     185,   186,   187,     0,   188,   189,   190,   191,   192,   193,
+     194,    12,    13,    14,    15,    16,    17,    18,    19,    20,
</ins><span class="cx">       21,    22,    23,    24,    25,    26,    27,    28,     0,    29,
</span><span class="cx">       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
</span><del>-      40,    41,   189,    42,    43,    44,    45,    46,    47,    48,
</del><ins>+      40,    41,   195,    42,    43,    44,    45,    46,    47,    48,
</ins><span class="cx">       49,    50,    51,    52,    53,    54,    55,     0,    56,    57,
</span><del>-      58,    59,   139,    60,   140,   141,   142,   143,     0,     0,
-       0,   144,   145,     0,     0,     0,     0,     0,     0,     0,
</del><ins>+      58,    59,   139,    60,   140,   141,   142,   143,   144,     0,
+       0,   145,   146,     0,     0,     0,     0,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-     146,     0,     0,     0,   122,     0,     0,     0,     0,     0,
-     192,   147,   148,     0,   149,     1,     2,     3,     4,     5,
-       6,     7,     8,     9,    10,    11,   182,   183,   184,     0,
-     185,   186,   187,   188,     0,     0,     0,    12,    13,    14,
</del><ins>+     147,     0,     0,     0,   122,     0,     0,     0,     0,     0,
+     198,   149,   150,   151,   152,     1,     2,     3,     4,     5,
+       6,     7,     8,     9,    10,    11,   185,   186,   187,     0,
+     188,   189,   190,   191,   192,   193,   194,    12,    13,    14,
</ins><span class="cx">       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
</span><span class="cx">       25,    26,    27,    28,     0,    29,    30,    31,    32,    33,
</span><del>-      34,    35,    36,    37,    38,    39,    40,    41,   189,    42,
</del><ins>+      34,    35,    36,    37,    38,    39,    40,    41,   195,    42,
</ins><span class="cx">       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
</span><span class="cx">       53,    54,    55,     0,    56,    57,    58,    59,   139,    60,
</span><del>-     140,   141,   142,   143,     0,     0,     0,   144,   145,     0,
</del><ins>+     140,   141,   142,   143,   144,     0,     0,   145,   146,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,     0,     0,     0,     0,     0,   146,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   192,   147,   148,     0,
-     149,     1,     2,     3,     4,     5,     6,     7,     8,     9,
</del><ins>+       0,     0,     0,     0,     0,     0,   147,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,   198,   149,   150,   151,
+     152,     1,     2,     3,     4,     5,     6,     7,     8,     9,
</ins><span class="cx">       10,    11,     0,     0,     0,     0,     0,     0,     0,     0,
</span><span class="cx">        0,     0,     0,    12,    13,    14,    15,    16,    17,    18,
</span><span class="cx">       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
</span><span class="lines">@@ -1199,20 +1060,20 @@
</span><span class="cx">       38,    39,    40,    41,     0,    42,    43,    44,    45,    46,
</span><span class="cx">       47,    48,    49,    50,    51,    52,    53,    54,    55,     0,
</span><span class="cx">       56,    57,    58,    59,   139,    60,   140,   141,   142,   143,
</span><del>-       0,     0,     0,   144,   145,     0,     0,     0,     0,     0,
</del><ins>+     144,     0,     0,   145,   146,     0,     0,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,   134,     2,
</span><del>-       3,     4,   146,     6,     7,     8,     9,    10,    11,     0,
-       0,     0,   192,   147,   148,     0,   149,     0,     0,     0,
</del><ins>+       3,     4,   147,     6,     7,     8,     9,    10,    11,     0,
+       0,     0,   198,   149,   150,   151,   152,     0,     0,     0,
</ins><span class="cx">       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
</span><span class="cx">       22,    23,    24,    25,    26,    27,    28,     0,    29,    30,
</span><span class="cx">       31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
</span><span class="cx">       41,     0,    42,    43,    44,    45,    46,    47,    48,    49,
</span><span class="cx">       50,    51,    52,    53,    54,    55,     0,    56,    57,    58,
</span><del>-      59,   139,    60,   140,   141,   142,   143,     0,     0,     0,
-     144,   145,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     2,     3,     4,     0,     0,   146,
</del><ins>+      59,   139,    60,   140,   141,   142,   143,   144,     0,     0,
+     145,   146,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     2,     3,     4,     0,     0,   147,
</ins><span class="cx">        8,     9,    10,    11,     0,     0,     0,     0,     0,     0,
</span><del>-     147,   148,     0,   149,     0,    12,    13,    14,    15,    16,
</del><ins>+     149,   150,   151,   152,     0,    12,    13,    14,    15,    16,
</ins><span class="cx">       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
</span><span class="cx">        0,     0,     0,     0,     0,    31,    32,    33,    34,    35,
</span><span class="cx">       36,     0,     0,     0,    40,    41,     0,    42,    43,    44,
</span><span class="lines">@@ -1225,220 +1086,229 @@
</span><span class="cx">       36,     0,     0,     0,    40,    41,     0,    42,    43,    44,
</span><span class="cx">       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
</span><span class="cx">       55,     0,    56,    57,    58,     0,   139,    60,   140,   141,
</span><del>-     142,   143,     0,     0,     0,   144,   145,     0,     0,     0,
</del><ins>+     142,   143,   144,     0,     0,   145,   146,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,     0,     0,     0,   146,     0,     0,   214,     8,     9,
-      10,    11,     0,     0,     0,   147,   148,     0,   149,     0,
</del><ins>+       0,     0,     0,     0,   147,     0,     0,   148,     8,     9,
+      10,    11,     0,     0,     0,   149,   150,   151,   152,     0,
</ins><span class="cx">        0,     0,     0,    12,    13,    14,    15,    16,    17,    18,
</span><span class="cx">       19,    20,    21,    22,    23,    24,    25,    26,     0,     0,
</span><span class="cx">        0,     0,     0,    31,    32,    33,    34,    35,    36,     0,
</span><span class="cx">        0,     0,    40,    41,     0,    42,    43,    44,    45,    46,
</span><span class="cx">       47,    48,    49,    50,    51,    52,    53,    54,    55,     0,
</span><span class="cx">       56,    57,    58,     0,   139,    60,   140,   141,   142,   143,
</span><del>-       0,     0,     0,   144,   145,     0,     0,     0,     0,     0,
</del><ins>+     144,     0,     0,   145,   146,     0,     0,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,     0,   146,     8,     9,    10,    11,     0,     0,     0,
-       0,     0,   264,   147,   148,     0,   149,     0,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,     0,     0,     0,     0,     0,    31,    32,
-      33,    34,    35,    36,     0,     0,     0,    40,    41,     0,
-      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,     0,    56,    57,    58,     0,   139,
-      60,   140,   141,   142,   143,     0,     0,     0,   144,   145,
</del><ins>+       0,     0,   147,     0,     0,   222,     8,     9,    10,    11,
+       0,     0,     0,   149,   150,   151,   152,     0,     0,     0,
+       0,    12,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,     0,     0,     0,     0,
+       0,    31,    32,    33,    34,    35,    36,     0,     0,     0,
+      40,    41,     0,    42,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,     0,    56,    57,
+      58,     0,   139,    60,   140,   141,   142,   143,   144,     0,
+       0,   145,   146,     0,     0,     0,     0,     0,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,     0,     0,     0,     0,     0,     0,   146,     0,     0,
-     280,     8,     9,    10,    11,     0,     0,     0,   147,   148,
-       0,   149,     0,     0,     0,     0,    12,    13,    14,    15,
</del><ins>+     147,     8,     9,    10,    11,     0,     0,     0,     0,     0,
+     278,   149,   150,   151,   152,     0,    12,    13,    14,    15,
</ins><span class="cx">       16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
</span><span class="cx">       26,     0,     0,     0,     0,     0,    31,    32,    33,    34,
</span><span class="cx">       35,    36,     0,     0,     0,    40,    41,     0,    42,    43,
</span><span class="cx">       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
</span><span class="cx">       54,    55,     0,    56,    57,    58,     0,   139,    60,   140,
</span><del>-     141,   142,   143,     0,     0,     0,   144,   145,     0,     0,
</del><ins>+     141,   142,   143,   144,     0,     0,   145,   146,     0,     0,
</ins><span class="cx">        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</span><del>-       0,     0,     0,     0,     0,   146,     8,     9,    10,    11,
-       0,     0,     0,     0,     0,     0,   147,   148,     0,   149,
</del><ins>+       0,     0,     0,     0,     0,   147,     0,     0,   303,     8,
+       9,    10,    11,     0,     0,     0,   149,   150,   151,   152,
+       0,     0,     0,     0,    12,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,    25,    26,     0,
+       0,     0,     0,     0,    31,    32,    33,    34,    35,    36,
+       0,     0,     0,    40,    41,     0,    42,    43,    44,    45,
+      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
+       0,    56,    57,    58,     0,   139,    60,   140,   141,   142,
+     143,   144,     0,     0,   145,   146,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,   147,     8,     9,    10,    11,     0,     0,
+       0,     0,     0,     0,   149,   150,   151,   152,     0,    12,
+      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
+      23,    24,    25,    26,     0,     0,     0,     0,     0,    31,
+      32,    33,    34,    35,    36,     0,     0,     0,    40,   242,
+       0,    42,    43,    44,    45,    46,    47,    48,    49,    50,
+      51,    52,    53,    54,    55,     0,    56,    57,    58,     0,
+     139,    60,   140,   141,   142,   143,   144,     0,     0,   145,
+     146,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   134,     2,     3,     4,   147,     6,
+       7,     8,     9,    10,    11,     0,     0,     0,     0,   149,
+     150,   151,   152,     0,     0,     0,    12,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,     0,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,     0,    42,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,     0,    56,    57,    58,    59,     0,    60,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   134,
+       2,     3,     4,     0,     6,     7,     8,     9,    10,    11,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     230,    12,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,     0,    29,
+      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+      40,    41,     0,    42,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,     0,    56,    57,
+      58,    59,     0,    60,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   134,     2,     3,     4,     0,     6,
+       7,     8,     9,    10,    11,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   267,    12,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,     0,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,     0,    42,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,     0,    56,    57,    58,    59,     0,    60,     0,
+       0,     0,     0,     0,     0,     0,   114,     0,     0,     1,
+       2,     3,     4,     5,     6,     7,     8,     9,    10,    11,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     341,    12,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,     0,    29,
+      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+      40,    41,     0,    42,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,     0,    56,    57,
+      58,    59,     0,    60,     1,     2,     3,     4,     5,     6,
+       7,     8,     9,    10,    11,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    12,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+      26,    27,    28,     0,    29,    30,    31,    32,    33,    34,
+      35,    36,    37,    38,    39,    40,    41,     0,    42,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,     0,    56,    57,    58,    59,     0,    60,   134,
+       2,     3,     4,     0,     6,     7,     8,     9,    10,    11,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
</ins><span class="cx">        0,    12,    13,    14,    15,    16,    17,    18,    19,    20,
</span><del>-      21,    22,    23,    24,    25,    26,     0,     0,     0,     0,
-       0,    31,    32,    33,    34,    35,    36,     0,     0,     0,
-      40,   234,     0,    42,    43,    44,    45,    46,    47,    48,
</del><ins>+      21,    22,    23,    24,    25,    26,    27,    28,     0,    29,
+      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+      40,    41,     0,    42,    43,    44,    45,    46,    47,    48,
</ins><span class="cx">       49,    50,    51,    52,    53,    54,    55,     0,    56,    57,
</span><del>-      58,     0,   139,    60,   140,   141,   142,   143,     0,     0,
-       0,   144,   145,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   134,     2,     3,     4,
-     146,     6,     7,     8,     9,    10,    11,     0,     0,     0,
-       0,   147,   148,     0,   149,     0,     0,     0,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,     0,    29,    30,    31,    32,
-      33,    34,    35,    36,    37,    38,    39,    40,    41,     0,
-      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,     0,    56,    57,    58,    59,     0,
-      60,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,   134,     2,     3,     4,     0,     6,     7,     8,     9,
-      10,    11,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   222,    12,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
-       0,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    40,    41,     0,    42,    43,    44,    45,    46,
-      47,    48,    49,    50,    51,    52,    53,    54,    55,     0,
-      56,    57,    58,    59,     0,    60,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   134,     2,     3,     4,
-       0,     6,     7,     8,     9,    10,    11,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,   253,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,     0,    29,    30,    31,    32,
-      33,    34,    35,    36,    37,    38,    39,    40,    41,     0,
-      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,     0,    56,    57,    58,    59,     0,
-      60,     0,     0,     0,     0,     0,     0,     0,   114,     0,
-       0,     1,     2,     3,     4,     5,     6,     7,     8,     9,
-      10,    11,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,   312,    12,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
-       0,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    40,    41,     0,    42,    43,    44,    45,    46,
-      47,    48,    49,    50,    51,    52,    53,    54,    55,     0,
-      56,    57,    58,    59,     0,    60,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    12,    13,
-      14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
-      24,    25,    26,    27,    28,     0,    29,    30,    31,    32,
-      33,    34,    35,    36,    37,    38,    39,    40,    41,     0,
-      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,     0,    56,    57,    58,    59,     0,
-      60,   134,     2,     3,     4,     0,     6,     7,     8,     9,
-      10,    11,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    12,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
-       0,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    40,    41,     0,    42,    43,    44,    45,    46,
-      47,    48,    49,    50,    51,    52,    53,    54,    55,     0,
-      56,    57,    58,    59,     0,    60,     2,     3,     4,     0,
-       0,     0,     8,     9,    10,    11,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,     0,     0,     0,     0,     0,    31,    32,    33,
-      34,    35,    36,     0,     0,     0,    40,    41,     0,    42,
-      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
-      53,    54,    55,     0,    56,    57,    58,     0,     0,    60,
</del><ins>+      58,    59,     0,    60,     2,     3,     4,     0,     0,     0,
</ins><span class="cx">        8,     9,    10,    11,     0,     0,     0,     0,     0,     0,
</span><span class="cx">        0,     0,     0,     0,     0,    12,    13,    14,    15,    16,
</span><span class="cx">       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
</span><span class="cx">        0,     0,     0,     0,     0,    31,    32,    33,    34,    35,
</span><span class="cx">       36,     0,     0,     0,    40,    41,     0,    42,    43,    44,
</span><span class="cx">       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
</span><del>-      55,     0,    56,    57,    58,     0,   293,   294,     8,     9,
</del><ins>+      55,     0,    56,    57,    58,     0,     0,    60,     8,     9,
</ins><span class="cx">       10,    11,     0,     0,     0,     0,     0,     0,     0,     0,
</span><span class="cx">        0,     0,     0,    12,    13,    14,    15,    16,    17,    18,
</span><span class="cx">       19,    20,    21,    22,    23,    24,    25,    26,     0,     0,
</span><span class="cx">        0,     0,     0,    31,    32,    33,    34,    35,    36,     0,
</span><span class="cx">        0,     0,    40,    41,     0,    42,    43,    44,    45,    46,
</span><span class="cx">       47,    48,    49,    50,    51,    52,    53,    54,    55,     0,
</span><del>-      56,    57,    58,     0,     0,    60
</del><ins>+      56,    57,    58,     0,   317,    60,     8,     9,    10,    11,
+     318,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    12,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,     0,     0,     0,     0,
+       0,    31,    32,    33,    34,    35,    36,     0,     0,     0,
+      40,    41,     0,    42,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,     0,    56,    57,
+      58,     0,     0,    60
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-309)))
-
-#define yytable_value_is_error(Yytable_value) \
-  YYID (0)
-
</del><span class="cx"> static const yytype_int16 yycheck[] =
</span><span class="cx"> {
</span><del>-       0,    40,    92,   113,    70,   213,   132,   109,   146,   131,
-     204,     0,   137,   117,     9,   117,     0,    44,    76,   315,
-     319,   131,   105,     9,   111,    87,    88,   114,   111,    68,
-     338,    92,   158,   106,   100,   137,    76,    77,   337,    69,
-     116,   114,   118,   109,    74,    40,    41,    42,     9,    76,
-     188,   117,   177,   361,    40,    41,   114,    43,   104,   355,
-     122,   123,   128,   102,   360,    51,   127,    73,   108,   135,
-      70,   137,   114,    73,   178,   177,   178,    83,    78,    40,
-      41,    42,   105,    83,    94,    95,    96,   213,   127,    78,
-     212,   229,   106,   103,    78,    85,    86,   106,   111,   113,
-     100,   114,   212,   113,   113,   106,   104,   233,   106,   109,
-     105,   177,   178,   251,   113,   111,   106,   117,   114,   111,
-     110,   108,   122,    76,   262,   105,   320,   105,   128,   254,
-     105,   111,   131,   111,   105,   135,   111,   137,    40,    41,
-     111,   242,   243,   244,   245,   144,   145,   111,   274,   275,
-     114,   108,   254,   111,   362,   104,   114,   279,     4,     5,
-       6,   113,   161,   285,    40,    41,    42,    76,    77,   279,
-      76,    77,   119,   120,   108,   285,   114,   177,   178,    89,
-      90,   319,    79,    80,   111,   112,   240,   241,   254,   246,
-     247,   230,    44,   104,    93,    91,   114,   105,   114,   337,
-     104,   104,   107,   104,   204,   331,   328,   114,   108,   104,
-     348,   109,   106,   212,   107,   106,   104,   319,   328,   111,
-     107,   359,   107,   104,   314,    56,   104,   107,   107,    17,
-     105,   114,   109,   107,   105,   337,   362,   230,   249,   238,
-     239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
-     249,   250,   113,   250,   254,   114,   114,   248,   128,    94,
-     101,   128,     5,   218,   181,   286,   316,   360,   268,   316,
-     337,    78,    -1,    -1,   268,   341,    -1,    -1,    -1,    -1,
-     279,    -1,    -1,    -1,    -1,    -1,   285,    -1,    -1,    -1,
</del><ins>+       0,    40,    70,   109,    92,   132,   131,   221,   210,   147,
+      76,   117,     9,     0,   137,     0,   117,   113,    76,    77,
+       9,   344,    69,    87,    88,   350,   372,    74,   106,    68,
+      92,   137,   100,   105,   161,   131,   114,    40,    41,   111,
+      44,   109,   105,    40,    41,    42,   371,   104,   114,   117,
+     108,    40,    41,   191,    43,   401,   111,   180,   122,   123,
+     128,   111,    51,   102,   114,   127,   106,   135,   193,   137,
+      70,   394,    76,    73,   180,   181,   114,   400,    78,   106,
+     181,   114,   106,    83,   105,   108,   113,     9,   127,   113,
+     111,    78,   306,    78,   221,   220,   105,   193,   111,   237,
+     100,   114,   111,   111,    85,    86,   114,    76,   105,   109,
+     105,   104,   180,   181,   241,   105,   111,   117,    40,    41,
+      42,   111,   122,    44,   220,   106,   105,   265,   128,   110,
+     113,   111,   111,   111,   114,   135,   114,   137,   276,    89,
+      90,   355,   280,   108,   358,   268,     4,     5,     6,   351,
+      94,    95,    96,    97,    98,    99,   100,   101,   102,   103,
+      76,    77,   268,   253,   254,   255,   256,   381,   108,   113,
+     297,   298,    40,    41,    42,   104,   113,   302,   105,   306,
+     180,   181,    76,    77,   309,   119,   120,   121,   116,   403,
+     118,    83,    84,   104,   131,    79,    80,   111,   112,   125,
+     268,   249,   250,   257,   258,    91,   302,   126,   145,   146,
+     210,   124,   350,   309,   251,   252,    93,   107,   114,   114,
+     109,   104,   104,   114,   104,   112,   104,   164,   355,   104,
+     106,   358,   113,   371,   107,   106,   105,   362,   365,   113,
+     112,   108,   107,   113,   350,   107,    56,   111,   386,   104,
+     107,   107,   113,   104,   381,   343,   193,   105,   107,   109,
+     114,   399,   105,    17,   108,   371,   362,   113,   268,   114,
+     238,   259,   114,   264,   260,   128,   403,   261,    94,   101,
+     262,   128,     5,   220,   184,   285,   263,   226,   310,   345,
+     392,   400,   345,   285,   371,    78,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   376,   246,
+     247,   248,   249,   250,   251,   252,   253,   254,   255,   256,
+     257,   258,   259,   260,   261,   262,   263,   264,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   375,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   344,   345,    -1,    -1,    -1,    -1,
+     350,   351,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   302,    -1,    -1,    -1,    -1,
+      -1,   371,   309,    -1,    -1,    -1,   376,    -1,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><del>-      -1,   340,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   315,   316,    -1,    -1,   319,
-     320,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   328,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   337,    -1,    -1,
-      -1,   341,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   355,    -1,    -1,    -1,    -1,
-     360,     3,     4,     5,     6,     7,     8,     9,    10,    11,
-      12,    13,    14,    15,    16,    -1,    18,    19,    20,    21,
-      -1,    -1,    -1,    25,    26,    27,    28,    29,    30,    31,
</del><ins>+      -1,    -1,    -1,    -1,   394,    -1,    -1,    -1,    -1,    -1,
+     400,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,     3,     4,     5,     6,     7,     8,     9,    10,    11,
+      12,    13,    14,    15,    16,   362,    18,    19,    20,    21,
+      22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
</ins><span class="cx">       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
</span><span class="cx">       -1,    43,    44,    45,    46,    47,    48,    49,    50,    51,
</span><span class="cx">       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
</span><span class="cx">       62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
</span><span class="cx">       72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
</span><del>-      -1,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
</del><ins>+      82,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,   104,    -1,    -1,    -1,   108,   109,    -1,    -1,
</span><del>-      -1,    -1,   114,   115,   116,    -1,   118,     3,     4,     5,
</del><ins>+      -1,    -1,   114,   115,   116,   117,   118,     3,     4,     5,
</ins><span class="cx">        6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
</span><del>-      16,    -1,    18,    19,    20,    21,    -1,    -1,    -1,    25,
</del><ins>+      16,    -1,    18,    19,    20,    21,    22,    23,    24,    25,
</ins><span class="cx">       26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
</span><span class="cx">       36,    37,    38,    39,    40,    41,    -1,    43,    44,    45,
</span><span class="cx">       46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
</span><span class="cx">       56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
</span><span class="cx">       66,    67,    68,    69,    70,    -1,    72,    73,    74,    75,
</span><del>-      76,    77,    78,    79,    80,    81,    -1,    -1,    -1,    85,
</del><ins>+      76,    77,    78,    79,    80,    81,    82,    -1,    -1,    85,
</ins><span class="cx">       86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,    -1,
</span><span class="cx">       -1,    -1,   108,   109,    -1,    -1,    -1,    -1,   114,   115,
</span><del>-     116,    -1,   118,     3,     4,     5,     6,     7,     8,     9,
</del><ins>+     116,   117,   118,     3,     4,     5,     6,     7,     8,     9,
</ins><span class="cx">       10,    11,    12,    13,    14,    15,    16,    -1,    18,    19,
</span><del>-      20,    21,    -1,    -1,    -1,    25,    26,    27,    28,    29,
</del><ins>+      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
</ins><span class="cx">       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
</span><span class="cx">       40,    41,    -1,    43,    44,    45,    46,    47,    48,    49,
</span><span class="cx">       50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
</span><span class="cx">       60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
</span><span class="cx">       70,    -1,    72,    73,    74,    75,    76,    77,    78,    79,
</span><del>-      80,    81,    -1,    -1,    -1,    85,    86,    -1,    -1,    -1,
</del><ins>+      80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    -1,   104,    -1,    -1,    -1,   108,    -1,
</span><del>-      -1,    -1,    -1,    -1,   114,   115,   116,    -1,   118,     3,
</del><ins>+      -1,    -1,    -1,    -1,   114,   115,   116,   117,   118,     3,
</ins><span class="cx">        4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
</span><del>-      14,    15,    16,    -1,    18,    19,    20,    21,    -1,    -1,
-      -1,    25,    26,    27,    28,    29,    30,    31,    32,    33,
</del><ins>+      14,    15,    16,    -1,    18,    19,    20,    21,    22,    23,
+      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
</ins><span class="cx">       34,    35,    36,    37,    38,    39,    40,    41,    -1,    43,
</span><span class="cx">       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
</span><span class="cx">       54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
</span><span class="cx">       64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
</span><del>-      74,    75,    76,    77,    78,    79,    80,    81,    -1,    -1,
</del><ins>+      74,    75,    76,    77,    78,    79,    80,    81,    82,    -1,
</ins><span class="cx">       -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">      104,    -1,    -1,    -1,   108,    -1,    -1,    -1,    -1,    -1,
</span><del>-     114,   115,   116,    -1,   118,     3,     4,     5,     6,     7,
</del><ins>+     114,   115,   116,   117,   118,     3,     4,     5,     6,     7,
</ins><span class="cx">        8,     9,    10,    11,    12,    13,    14,    15,    16,    -1,
</span><del>-      18,    19,    20,    21,    -1,    -1,    -1,    25,    26,    27,
</del><ins>+      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
</ins><span class="cx">       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
</span><span class="cx">       38,    39,    40,    41,    -1,    43,    44,    45,    46,    47,
</span><span class="cx">       48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
</span><span class="cx">       58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
</span><span class="cx">       68,    69,    70,    -1,    72,    73,    74,    75,    76,    77,
</span><del>-      78,    79,    80,    81,    -1,    -1,    -1,    85,    86,    -1,
</del><ins>+      78,    79,    80,    81,    82,    -1,    -1,    85,    86,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,   104,    -1,    -1,    -1,
</span><del>-      -1,    -1,    -1,    -1,    -1,    -1,   114,   115,   116,    -1,
</del><ins>+      -1,    -1,    -1,    -1,    -1,    -1,   114,   115,   116,   117,
</ins><span class="cx">      118,     3,     4,     5,     6,     7,     8,     9,    10,    11,
</span><span class="cx">       12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    25,    26,    27,    28,    29,    30,    31,
</span><span class="lines">@@ -1447,20 +1317,20 @@
</span><span class="cx">       52,    53,    54,    55,    -1,    57,    58,    59,    60,    61,
</span><span class="cx">       62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
</span><span class="cx">       72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
</span><del>-      -1,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
</del><ins>+      82,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     3,     4,
</span><span class="cx">        5,     6,   104,     8,     9,    10,    11,    12,    13,    -1,
</span><del>-      -1,    -1,   114,   115,   116,    -1,   118,    -1,    -1,    -1,
</del><ins>+      -1,    -1,   114,   115,   116,   117,   118,    -1,    -1,    -1,
</ins><span class="cx">       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
</span><span class="cx">       35,    36,    37,    38,    39,    40,    41,    -1,    43,    44,
</span><span class="cx">       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
</span><span class="cx">       55,    -1,    57,    58,    59,    60,    61,    62,    63,    64,
</span><span class="cx">       65,    66,    67,    68,    69,    70,    -1,    72,    73,    74,
</span><del>-      75,    76,    77,    78,    79,    80,    81,    -1,    -1,    -1,
</del><ins>+      75,    76,    77,    78,    79,    80,    81,    82,    -1,    -1,
</ins><span class="cx">       85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    -1,     4,     5,     6,    -1,    -1,   104,
</span><span class="cx">       10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,
</span><del>-     115,   116,    -1,   118,    -1,    25,    26,    27,    28,    29,
</del><ins>+     115,   116,   117,   118,    -1,    25,    26,    27,    28,    29,
</ins><span class="cx">       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
</span><span class="cx">       -1,    -1,    -1,    -1,    -1,    45,    46,    47,    48,    49,
</span><span class="cx">       50,    -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,
</span><span class="lines">@@ -1473,120 +1343,130 @@
</span><span class="cx">       50,    -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,
</span><span class="cx">       60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
</span><span class="cx">       70,    -1,    72,    73,    74,    -1,    76,    77,    78,    79,
</span><del>-      80,    81,    -1,    -1,    -1,    85,    86,    -1,    -1,    -1,
</del><ins>+      80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    -1,   104,    -1,    -1,   107,    10,    11,
</span><del>-      12,    13,    -1,    -1,    -1,   115,   116,    -1,   118,    -1,
</del><ins>+      12,    13,    -1,    -1,    -1,   115,   116,   117,   118,    -1,
</ins><span class="cx">       -1,    -1,    -1,    25,    26,    27,    28,    29,    30,    31,
</span><span class="cx">       32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    45,    46,    47,    48,    49,    50,    -1,
</span><span class="cx">       -1,    -1,    54,    55,    -1,    57,    58,    59,    60,    61,
</span><span class="cx">       62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
</span><span class="cx">       72,    73,    74,    -1,    76,    77,    78,    79,    80,    81,
</span><del>-      -1,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
</del><ins>+      82,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><del>-      -1,    -1,   104,    10,    11,    12,    13,    -1,    -1,    -1,
-      -1,    -1,   114,   115,   116,    -1,   118,    -1,    25,    26,
-      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
-      37,    38,    39,    -1,    -1,    -1,    -1,    -1,    45,    46,
-      47,    48,    49,    50,    -1,    -1,    -1,    54,    55,    -1,
-      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    -1,    72,    73,    74,    -1,    76,
-      77,    78,    79,    80,    81,    -1,    -1,    -1,    85,    86,
</del><ins>+      -1,    -1,   104,    -1,    -1,   107,    10,    11,    12,    13,
+      -1,    -1,    -1,   115,   116,   117,   118,    -1,    -1,    -1,
+      -1,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    35,    36,    37,    38,    39,    -1,    -1,    -1,    -1,
+      -1,    45,    46,    47,    48,    49,    50,    -1,    -1,    -1,
+      54,    55,    -1,    57,    58,    59,    60,    61,    62,    63,
+      64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
+      74,    -1,    76,    77,    78,    79,    80,    81,    82,    -1,
+      -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><del>-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   104,    -1,    -1,
-     107,    10,    11,    12,    13,    -1,    -1,    -1,   115,   116,
-      -1,   118,    -1,    -1,    -1,    -1,    25,    26,    27,    28,
</del><ins>+     104,    10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,
+     114,   115,   116,   117,   118,    -1,    25,    26,    27,    28,
</ins><span class="cx">       29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
</span><span class="cx">       39,    -1,    -1,    -1,    -1,    -1,    45,    46,    47,    48,
</span><span class="cx">       49,    50,    -1,    -1,    -1,    54,    55,    -1,    57,    58,
</span><span class="cx">       59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
</span><span class="cx">       69,    70,    -1,    72,    73,    74,    -1,    76,    77,    78,
</span><del>-      79,    80,    81,    -1,    -1,    -1,    85,    86,    -1,    -1,
</del><ins>+      79,    80,    81,    82,    -1,    -1,    85,    86,    -1,    -1,
</ins><span class="cx">       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><del>-      -1,    -1,    -1,    -1,    -1,   104,    10,    11,    12,    13,
-      -1,    -1,    -1,    -1,    -1,    -1,   115,   116,    -1,   118,
</del><ins>+      -1,    -1,    -1,    -1,    -1,   104,    -1,    -1,   107,    10,
+      11,    12,    13,    -1,    -1,    -1,   115,   116,   117,   118,
+      -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,    34,    35,    36,    37,    38,    39,    -1,
+      -1,    -1,    -1,    -1,    45,    46,    47,    48,    49,    50,
+      -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,    60,
+      61,    62,    63,    64,    65,    66,    67,    68,    69,    70,
+      -1,    72,    73,    74,    -1,    76,    77,    78,    79,    80,
+      81,    82,    -1,    -1,    85,    86,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,   104,    10,    11,    12,    13,    -1,    -1,
+      -1,    -1,    -1,    -1,   115,   116,   117,   118,    -1,    25,
+      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
+      36,    37,    38,    39,    -1,    -1,    -1,    -1,    -1,    45,
+      46,    47,    48,    49,    50,    -1,    -1,    -1,    54,    55,
+      -1,    57,    58,    59,    60,    61,    62,    63,    64,    65,
+      66,    67,    68,    69,    70,    -1,    72,    73,    74,    -1,
+      76,    77,    78,    79,    80,    81,    82,    -1,    -1,    85,
+      86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,     3,     4,     5,     6,   104,     8,
+       9,    10,    11,    12,    13,    -1,    -1,    -1,    -1,   115,
+     116,   117,   118,    -1,    -1,    -1,    25,    26,    27,    28,
+      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
+      39,    40,    41,    -1,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    -1,    72,    73,    74,    75,    -1,    77,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     3,
+       4,     5,     6,    -1,     8,     9,    10,    11,    12,    13,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     109,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    35,    36,    37,    38,    39,    40,    41,    -1,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    -1,    57,    58,    59,    60,    61,    62,    63,
+      64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
+      74,    75,    -1,    77,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,     3,     4,     5,     6,    -1,     8,
+       9,    10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   109,    25,    26,    27,    28,
+      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
+      39,    40,    41,    -1,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    -1,    72,    73,    74,    75,    -1,    77,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,     0,    -1,    -1,     3,
+       4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     109,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    35,    36,    37,    38,    39,    40,    41,    -1,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
+      54,    55,    -1,    57,    58,    59,    60,    61,    62,    63,
+      64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
+      74,    75,    -1,    77,     3,     4,     5,     6,     7,     8,
+       9,    10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    25,    26,    27,    28,
+      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
+      39,    40,    41,    -1,    43,    44,    45,    46,    47,    48,
+      49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
+      69,    70,    -1,    72,    73,    74,    75,    -1,    77,     3,
+       4,     5,     6,    -1,     8,     9,    10,    11,    12,    13,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</ins><span class="cx">       -1,    25,    26,    27,    28,    29,    30,    31,    32,    33,
</span><del>-      34,    35,    36,    37,    38,    39,    -1,    -1,    -1,    -1,
-      -1,    45,    46,    47,    48,    49,    50,    -1,    -1,    -1,
</del><ins>+      34,    35,    36,    37,    38,    39,    40,    41,    -1,    43,
+      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
</ins><span class="cx">       54,    55,    -1,    57,    58,    59,    60,    61,    62,    63,
</span><span class="cx">       64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
</span><del>-      74,    -1,    76,    77,    78,    79,    80,    81,    -1,    -1,
-      -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,     3,     4,     5,     6,
-     104,     8,     9,    10,    11,    12,    13,    -1,    -1,    -1,
-      -1,   115,   116,    -1,   118,    -1,    -1,    -1,    25,    26,
-      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
-      37,    38,    39,    40,    41,    -1,    43,    44,    45,    46,
-      47,    48,    49,    50,    51,    52,    53,    54,    55,    -1,
-      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    -1,    72,    73,    74,    75,    -1,
-      77,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,     3,     4,     5,     6,    -1,     8,     9,    10,    11,
-      12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,   109,    25,    26,    27,    28,    29,    30,    31,
-      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
-      -1,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,    -1,    57,    58,    59,    60,    61,
-      62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
-      72,    73,    74,    75,    -1,    77,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,     3,     4,     5,     6,
-      -1,     8,     9,    10,    11,    12,    13,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   109,    25,    26,
-      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
-      37,    38,    39,    40,    41,    -1,    43,    44,    45,    46,
-      47,    48,    49,    50,    51,    52,    53,    54,    55,    -1,
-      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    -1,    72,    73,    74,    75,    -1,
-      77,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     0,    -1,
-      -1,     3,     4,     5,     6,     7,     8,     9,    10,    11,
-      12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,   109,    25,    26,    27,    28,    29,    30,    31,
-      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
-      -1,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,    -1,    57,    58,    59,    60,    61,
-      62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
-      72,    73,    74,    75,    -1,    77,     3,     4,     5,     6,
-       7,     8,     9,    10,    11,    12,    13,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,    26,
-      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
-      37,    38,    39,    40,    41,    -1,    43,    44,    45,    46,
-      47,    48,    49,    50,    51,    52,    53,    54,    55,    -1,
-      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
-      67,    68,    69,    70,    -1,    72,    73,    74,    75,    -1,
-      77,     3,     4,     5,     6,    -1,     8,     9,    10,    11,
-      12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    25,    26,    27,    28,    29,    30,    31,
-      32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
-      -1,    43,    44,    45,    46,    47,    48,    49,    50,    51,
-      52,    53,    54,    55,    -1,    57,    58,    59,    60,    61,
-      62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
-      72,    73,    74,    75,    -1,    77,     4,     5,     6,    -1,
-      -1,    -1,    10,    11,    12,    13,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,    26,    27,
-      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
-      38,    39,    -1,    -1,    -1,    -1,    -1,    45,    46,    47,
-      48,    49,    50,    -1,    -1,    -1,    54,    55,    -1,    57,
-      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
-      68,    69,    70,    -1,    72,    73,    74,    -1,    -1,    77,
</del><ins>+      74,    75,    -1,    77,     4,     5,     6,    -1,    -1,    -1,
</ins><span class="cx">       10,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    -1,    -1,    25,    26,    27,    28,    29,
</span><span class="cx">       30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
</span><span class="cx">       -1,    -1,    -1,    -1,    -1,    45,    46,    47,    48,    49,
</span><span class="cx">       50,    -1,    -1,    -1,    54,    55,    -1,    57,    58,    59,
</span><span class="cx">       60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
</span><del>-      70,    -1,    72,    73,    74,    -1,    76,    77,    10,    11,
</del><ins>+      70,    -1,    72,    73,    74,    -1,    -1,    77,    10,    11,
</ins><span class="cx">       12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    25,    26,    27,    28,    29,    30,    31,
</span><span class="cx">       32,    33,    34,    35,    36,    37,    38,    39,    -1,    -1,
</span><span class="cx">       -1,    -1,    -1,    45,    46,    47,    48,    49,    50,    -1,
</span><span class="cx">       -1,    -1,    54,    55,    -1,    57,    58,    59,    60,    61,
</span><span class="cx">       62,    63,    64,    65,    66,    67,    68,    69,    70,    -1,
</span><del>-      72,    73,    74,    -1,    -1,    77
</del><ins>+      72,    73,    74,    -1,    76,    77,    10,    11,    12,    13,
+      82,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+      34,    35,    36,    37,    38,    39,    -1,    -1,    -1,    -1,
+      -1,    45,    46,    47,    48,    49,    50,    -1,    -1,    -1,
+      54,    55,    -1,    57,    58,    59,    60,    61,    62,    63,
+      64,    65,    66,    67,    68,    69,    70,    -1,    72,    73,
+      74,    -1,    -1,    77
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
</del><ins>+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
</ins><span class="cx"> static const yytype_uint8 yystos[] =
</span><span class="cx"> {
</span><span class="cx">        0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
</span><span class="lines">@@ -1596,64 +1476,120 @@
</span><span class="cx">       54,    55,    57,    58,    59,    60,    61,    62,    63,    64,
</span><span class="cx">       65,    66,    67,    68,    69,    70,    72,    73,    74,    75,
</span><span class="cx">       77,   160,   161,   162,   163,   164,   169,   170,   171,   172,
</span><del>-     174,   175,   176,   177,   178,   181,   182,   183,   215,   216,
-     217,    44,    76,   177,    40,    41,    76,    77,   108,   129,
-     104,   114,   218,   105,   111,     9,    40,    41,    42,   166,
</del><ins>+     174,   175,   176,   177,   178,   181,   182,   183,   218,   219,
+     220,    44,    76,   177,    40,    41,    76,    77,   108,   129,
+     104,   114,   221,   105,   111,     9,    40,    41,    42,   166,
</ins><span class="cx">      167,   173,   111,   114,    76,   129,   175,    76,   114,   159,
</span><del>-     176,   181,   175,   106,     0,   216,   181,   185,   108,    76,
</del><ins>+     176,   181,   175,   106,     0,   219,   181,   185,   108,    76,
</ins><span class="cx">      179,   180,   108,   201,   166,   165,   168,   176,   167,   129,
</span><span class="cx">      104,   106,   113,   108,     3,   174,   176,   186,   187,    76,
</span><del>-      78,    79,    80,    81,    85,    86,   104,   115,   116,   118,
-     130,   131,   132,   134,   135,   136,   137,   138,   139,   140,
-     141,   142,   143,   144,   145,   146,   147,   148,   149,   150,
-     151,   152,   153,   154,   158,   182,   114,   186,   184,   113,
-     105,   111,    14,    15,    16,    18,    19,    20,    21,    56,
-     108,   109,   114,   141,   154,   155,   157,   160,   161,   182,
-     191,   192,   193,   194,   202,   203,   204,   207,   214,   129,
-     165,   168,   106,   113,   107,   158,   155,   190,   176,   129,
-     188,   189,   109,   187,   141,   141,   157,    85,    86,   106,
-     110,   105,   105,   111,    55,   155,   104,   141,   119,   120,
-     116,   118,    87,    88,   122,   123,    89,    90,    91,    93,
-      92,   127,   107,   109,   186,    79,    80,   180,   114,   114,
-     209,   104,   104,   114,   114,   157,   104,   109,   195,    94,
-      95,    96,   103,   113,   156,   111,   114,   109,   192,   106,
-     107,   158,   190,   107,   188,   106,   111,   114,    76,   114,
-     105,   133,   157,    76,    77,   129,   136,   155,   141,   141,
-     143,   143,   145,   145,   145,   145,   146,   146,   150,   151,
-     152,   157,   109,   198,   199,   200,   210,   157,   114,   208,
-     202,   155,   155,   158,   107,   114,   158,   189,   106,   114,
-     107,   112,    56,   201,   193,   191,   203,   211,   105,   157,
-     171,   174,   206,   196,   107,   107,   158,   155,   104,   206,
-     212,   213,   198,   205,   129,   105,   109,   107,   157,   114,
-     105,    17,   113,   193,   197,   201,   114,   105,   157,   197,
-     198,   190,   114
</del><ins>+      78,    79,    80,    81,    82,    85,    86,   104,   107,   115,
+     116,   117,   118,   130,   131,   132,   134,   135,   136,   137,
+     138,   139,   140,   141,   142,   143,   144,   145,   146,   147,
+     148,   149,   150,   151,   152,   153,   154,   158,   181,   114,
+     186,   184,   113,   105,   111,    14,    15,    16,    18,    19,
+      20,    21,    22,    23,    24,    56,   108,   109,   114,   141,
+     154,   155,   157,   160,   161,   181,   191,   192,   193,   194,
+     202,   203,   204,   206,   208,   210,   217,   129,   165,   168,
+     106,   113,   107,   158,   155,   190,   176,   129,   188,   189,
+     109,   187,   141,   141,   157,    85,    86,   106,   110,   105,
+     105,   111,    55,   155,   104,   141,   119,   120,   121,   116,
+     118,    83,    84,    87,    88,   122,   123,    89,    90,   126,
+     125,   124,    91,    93,    92,   127,   107,   109,   186,    79,
+      80,   180,   114,   114,   212,   104,   104,   114,   114,   157,
+     104,   158,   112,   104,   109,   195,    94,    95,    96,    97,
+      98,    99,   100,   101,   102,   103,   113,   156,   111,   114,
+     109,   192,   106,   107,   158,   190,   113,   107,   188,   106,
+     111,   114,    76,   114,   105,   133,   157,    76,    82,   136,
+     155,   141,   141,   141,   143,   143,   144,   144,   145,   145,
+     145,   145,   146,   146,   147,   148,   149,   150,   151,   152,
+     157,   109,   198,   199,   200,   213,   157,   114,   157,   112,
+     211,   202,   155,   155,   158,   113,   107,   190,   113,   114,
+     158,   189,   106,   114,   107,   112,    56,   201,   193,   191,
+     203,   214,   105,   105,   157,   171,   174,   209,   196,   107,
+     190,   113,   190,   107,   158,   155,   104,   209,   215,   216,
+     198,   205,   207,   129,   105,   109,   190,   107,   157,   114,
+     105,    17,   194,   113,   193,   197,   201,   114,   105,   157,
+     197,   198,   190,   114
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#define yyerrok                (yyerrstatus = 0)
-#define yyclearin        (yychar = YYEMPTY)
-#define YYEMPTY                (-2)
-#define YYEOF                0
</del><ins>+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,   128,   129,   129,   130,   131,   131,   131,   131,   131,
+     131,   132,   132,   132,   132,   132,   132,   133,   134,   135,
+     135,   136,   136,   137,   137,   138,   138,   139,   140,   140,
+     140,   141,   141,   141,   141,   142,   142,   142,   142,   143,
+     143,   143,   143,   144,   144,   144,   145,   145,   145,   146,
+     146,   146,   146,   146,   147,   147,   147,   148,   148,   149,
+     149,   150,   150,   151,   151,   152,   152,   153,   153,   154,
+     154,   155,   155,   156,   156,   156,   156,   156,   156,   156,
+     156,   156,   156,   156,   157,   157,   158,   159,   160,   160,
+     160,   160,   160,   160,   160,   161,   162,   162,   163,   163,
+     164,   165,   165,   166,   166,   166,   166,   167,   167,   167,
+     167,   168,   169,   169,   169,   169,   169,   169,   170,   170,
+     170,   170,   170,   170,   170,   171,   171,   172,   172,   173,
+     174,   174,   174,   174,   174,   174,   174,   174,   175,   175,
+     175,   175,   175,   175,   176,   176,   177,   177,   177,   178,
+     179,   179,   180,   180,   180,   181,   181,   181,   182,   182,
+     182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
+     182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
+     182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
+     182,   182,   182,   182,   182,   182,   182,   182,   182,   182,
+     182,   182,   182,   184,   183,   185,   183,   186,   186,   187,
+     187,   188,   188,   189,   189,   190,   191,   192,   192,   193,
+     193,   193,   193,   193,   193,   193,   194,   195,   196,   194,
+     197,   197,   199,   198,   200,   198,   201,   201,   202,   202,
+     203,   203,   204,   205,   205,   207,   206,   208,   208,   209,
+     209,   211,   210,   212,   210,   213,   210,   214,   214,   215,
+     215,   216,   216,   217,   217,   217,   217,   217,   218,   218,
+     219,   219,   221,   220
+};
</ins><span class="cx"> 
</span><del>-#define YYACCEPT        goto yyacceptlab
-#define YYABORT                goto yyabortlab
-#define YYERROR                goto yyerrorlab
</del><ins>+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
+{
+       0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
+       3,     1,     4,     1,     3,     2,     2,     1,     1,     1,
+       3,     2,     2,     2,     1,     2,     3,     2,     1,     1,
+       1,     1,     2,     2,     2,     1,     1,     1,     1,     1,
+       3,     3,     3,     1,     3,     3,     1,     3,     3,     1,
+       3,     3,     3,     3,     1,     3,     3,     1,     3,     1,
+       3,     1,     3,     1,     3,     1,     3,     1,     3,     1,
+       5,     1,     3,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     3,     1,     2,     2,     2,
+       4,     5,     6,     9,     2,     2,     1,     1,     2,     3,
+       3,     2,     5,     3,     2,     3,     2,     0,     1,     1,
+       1,     1,     1,     3,     6,     7,     8,     5,     1,     2,
+       5,     6,     7,     4,     2,     1,     2,     1,     1,     1,
+       1,     1,     2,     1,     2,     1,     1,     2,     1,     1,
+       1,     2,     2,     1,     1,     2,     1,     1,     1,     4,
+       1,     3,     1,     3,     3,     1,     3,     4,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     0,     6,     0,     5,     1,     2,     3,
+       4,     1,     3,     1,     4,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     1,     1,     2,     0,     0,     5,
+       1,     1,     0,     2,     0,     2,     2,     3,     1,     2,
+       1,     2,     5,     3,     1,     0,     6,     3,     2,     1,
+       4,     0,     6,     0,     8,     0,     7,     1,     1,     1,
+       0,     2,     3,     2,     2,     2,     3,     2,     1,     2,
+       1,     1,     0,     3
+};
</ins><span class="cx"> 
</span><span class="cx"> 
</span><del>-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  However,
-   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
-   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
-   discussed.  */
</del><ins>+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+#define YYEMPTY         (-2)
+#define YYEOF           0
</ins><span class="cx"> 
</span><del>-#define YYFAIL                goto yyerrlab
-#if defined YYFAIL
-  /* This is here to suppress warnings from the GCC cpp's
-     -Wunused-macros.  Normally we don't worry about that warning, but
-     some users do, and we want to make it easy for users to remove
-     YYFAIL uses, which will produce warnings from Bison 2.5.  */
-#endif
</del><ins>+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> #define YYRECOVERING()  (!!yyerrstatus)
</span><span class="cx"> 
</span><span class="cx"> #define YYBACKUP(Token, Value)                                  \
</span><span class="lines">@@ -1668,14 +1604,14 @@
</span><span class="cx">     }                                                           \
</span><span class="cx">   else                                                          \
</span><span class="cx">     {                                                           \
</span><del>-      yyerror (&amp;yylloc, context, YY_(&quot;syntax error: cannot back up&quot;)); \
-      YYERROR;                                                        \
-    }                                                                \
-while (YYID (0))
</del><ins>+      yyerror (&amp;yylloc, context, scanner, YY_(&quot;syntax error: cannot back up&quot;)); \
+      YYERROR;                                                  \
+    }                                                           \
+while (0)
</ins><span class="cx"> 
</span><span class="cx"> /* Error token number */
</span><del>-#define YYTERROR        1
-#define YYERRCODE        256
</del><ins>+#define YYTERROR        1
+#define YYERRCODE       256
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
</span><span class="lines">@@ -1685,7 +1621,7 @@
</span><span class="cx"> #ifndef YYLLOC_DEFAULT
</span><span class="cx"> # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
</span><span class="cx">     do                                                                  \
</span><del>-      if (YYID (N))                                                     \
</del><ins>+      if (N)                                                            \
</ins><span class="cx">         {                                                               \
</span><span class="cx">           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
</span><span class="cx">           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
</span><span class="lines">@@ -1699,12 +1635,27 @@
</span><span class="cx">           (Current).first_column = (Current).last_column =              \
</span><span class="cx">             YYRHSLOC (Rhs, 0).last_column;                              \
</span><span class="cx">         }                                                               \
</span><del>-    while (YYID (0))
</del><ins>+    while (0)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #define YYRHSLOC(Rhs, K) ((Rhs)[K])
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+/* Enable debugging if requested.  */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+#  include &lt;stdio.h&gt; /* INFRINGES ON USER NAME SPACE */
+#  define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args)                        \
+do {                                            \
+  if (yydebug)                                  \
+    YYFPRINTF Args;                             \
+} while (0)
+
+
</ins><span class="cx"> /* YY_LOCATION_PRINT -- Print the location on the stream.
</span><span class="cx">    This macro was not mandated originally: define only if we know
</span><span class="cx">    we won't break user code: when these are the locations we know.  */
</span><span class="lines">@@ -1714,36 +1665,28 @@
</span><span class="cx"> 
</span><span class="cx"> /* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
</span><span class="cx"> 
</span><del>-__attribute__((__unused__))
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><ins>+YY_ATTRIBUTE_UNUSED
</ins><span class="cx"> static unsigned
</span><span class="cx"> yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
</span><del>-#else
-static unsigned
-yy_location_print_ (yyo, yylocp)
-    FILE *yyo;
-    YYLTYPE const * const yylocp;
-#endif
</del><span class="cx"> {
</span><span class="cx">   unsigned res = 0;
</span><span class="cx">   int end_col = 0 != yylocp-&gt;last_column ? yylocp-&gt;last_column - 1 : 0;
</span><span class="cx">   if (0 &lt;= yylocp-&gt;first_line)
</span><span class="cx">     {
</span><del>-      res += fprintf (yyo, &quot;%d&quot;, yylocp-&gt;first_line);
</del><ins>+      res += YYFPRINTF (yyo, &quot;%d&quot;, yylocp-&gt;first_line);
</ins><span class="cx">       if (0 &lt;= yylocp-&gt;first_column)
</span><del>-        res += fprintf (yyo, &quot;.%d&quot;, yylocp-&gt;first_column);
</del><ins>+        res += YYFPRINTF (yyo, &quot;.%d&quot;, yylocp-&gt;first_column);
</ins><span class="cx">     }
</span><span class="cx">   if (0 &lt;= yylocp-&gt;last_line)
</span><span class="cx">     {
</span><span class="cx">       if (yylocp-&gt;first_line &lt; yylocp-&gt;last_line)
</span><span class="cx">         {
</span><del>-          res += fprintf (yyo, &quot;-%d&quot;, yylocp-&gt;last_line);
</del><ins>+          res += YYFPRINTF (yyo, &quot;-%d&quot;, yylocp-&gt;last_line);
</ins><span class="cx">           if (0 &lt;= end_col)
</span><del>-            res += fprintf (yyo, &quot;.%d&quot;, end_col);
</del><ins>+            res += YYFPRINTF (yyo, &quot;.%d&quot;, end_col);
</ins><span class="cx">         }
</span><span class="cx">       else if (0 &lt;= end_col &amp;&amp; yylocp-&gt;first_column &lt; end_col)
</span><del>-        res += fprintf (yyo, &quot;-%d&quot;, end_col);
</del><ins>+        res += YYFPRINTF (yyo, &quot;-%d&quot;, end_col);
</ins><span class="cx">     }
</span><span class="cx">   return res;
</span><span class="cx">  }
</span><span class="lines">@@ -1757,69 +1700,35 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-/* YYLEX -- calling `yylex' with the right arguments.  */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&amp;yylval, &amp;yylloc, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&amp;yylval, &amp;yylloc)
-#endif
</del><ins>+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, &quot;%s &quot;, Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Type, Value, Location, context, scanner); \
+      YYFPRINTF (stderr, &quot;\n&quot;);                                           \
+    }                                                                     \
+} while (0)
</ins><span class="cx"> 
</span><del>-/* Enable debugging if requested.  */
-#if YYDEBUG
</del><span class="cx"> 
</span><del>-# ifndef YYFPRINTF
-#  include &lt;stdio.h&gt; /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
</del><ins>+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT.  |
+`----------------------------------------*/
</ins><span class="cx"> 
</span><del>-# define YYDPRINTF(Args)                        \
-do {                                                \
-  if (yydebug)                                        \
-    YYFPRINTF Args;                                \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                          \
-do {                                                                          \
-  if (yydebug)                                                                  \
-    {                                                                          \
-      YYFPRINTF (stderr, &quot;%s &quot;, Title);                                          \
-      yy_symbol_print (stderr,                                                  \
-                  Type, Value, Location, context); \
-      YYFPRINTF (stderr, &quot;\n&quot;);                                                  \
-    }                                                                          \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><del>-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    YYLTYPE const * const yylocationp;
-    TParseContext* context;
-#endif
</del><ins>+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context, void *scanner)
</ins><span class="cx"> {
</span><span class="cx">   FILE *yyo = yyoutput;
</span><span class="cx">   YYUSE (yyo);
</span><del>-  if (!yyvaluep)
-    return;
</del><span class="cx">   YYUSE (yylocationp);
</span><span class="cx">   YYUSE (context);
</span><ins>+  YYUSE (scanner);
+  if (!yyvaluep)
+    return;
</ins><span class="cx"> # ifdef YYPRINT
</span><span class="cx">   if (yytype &lt; YYNTOKENS)
</span><span class="cx">     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
</span><del>-# else
-  YYUSE (yyoutput);
</del><span class="cx"> # endif
</span><span class="cx">   YYUSE (yytype);
</span><span class="cx"> }
</span><span class="lines">@@ -1829,28 +1738,15 @@
</span><span class="cx"> | Print this symbol on YYOUTPUT.  |
</span><span class="cx"> `--------------------------------*/
</span><span class="cx"> 
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><del>-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, context)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-    YYLTYPE const * const yylocationp;
-    TParseContext* context;
-#endif
</del><ins>+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context, void *scanner)
</ins><span class="cx"> {
</span><del>-  if (yytype &lt; YYNTOKENS)
-    YYFPRINTF (yyoutput, &quot;token %s (&quot;, yytname[yytype]);
-  else
-    YYFPRINTF (yyoutput, &quot;nterm %s (&quot;, yytname[yytype]);
</del><ins>+  YYFPRINTF (yyoutput, &quot;%s %s (&quot;,
+             yytype &lt; YYNTOKENS ? &quot;token&quot; : &quot;nterm&quot;, yytname[yytype]);
</ins><span class="cx"> 
</span><span class="cx">   YY_LOCATION_PRINT (yyoutput, *yylocationp);
</span><span class="cx">   YYFPRINTF (yyoutput, &quot;: &quot;);
</span><del>-  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context);
</del><ins>+  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context, scanner);
</ins><span class="cx">   YYFPRINTF (yyoutput, &quot;)&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1859,16 +1755,8 @@
</span><span class="cx"> | TOP (included).                                                   |
</span><span class="cx"> `------------------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><span class="cx"> yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
</span><del>-#else
-static void
-yy_stack_print (yybottom, yytop)
-    yytype_int16 *yybottom;
-    yytype_int16 *yytop;
-#endif
</del><span class="cx"> {
</span><span class="cx">   YYFPRINTF (stderr, &quot;Stack now&quot;);
</span><span class="cx">   for (; yybottom &lt;= yytop; yybottom++)
</span><span class="lines">@@ -1879,51 +1767,42 @@
</span><span class="cx">   YYFPRINTF (stderr, &quot;\n&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-# define YY_STACK_PRINT(Bottom, Top)                                \
-do {                                                                \
-  if (yydebug)                                                        \
-    yy_stack_print ((Bottom), (Top));                                \
-} while (YYID (0))
</del><ins>+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> /*------------------------------------------------.
</span><span class="cx"> | Report that the YYRULE is going to be reduced.  |
</span><span class="cx"> `------------------------------------------------*/
</span><span class="cx"> 
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><del>-yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context)
-#else
-static void
-yy_reduce_print (yyvsp, yylsp, yyrule, context)
-    YYSTYPE *yyvsp;
-    YYLTYPE *yylsp;
-    int yyrule;
-    TParseContext* context;
-#endif
</del><ins>+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context, void *scanner)
</ins><span class="cx"> {
</span><ins>+  unsigned long int yylno = yyrline[yyrule];
</ins><span class="cx">   int yynrhs = yyr2[yyrule];
</span><span class="cx">   int yyi;
</span><del>-  unsigned long int yylno = yyrline[yyrule];
</del><span class="cx">   YYFPRINTF (stderr, &quot;Reducing stack by rule %d (line %lu):\n&quot;,
</span><del>-             yyrule - 1, yylno);
</del><ins>+             yyrule - 1, yylno);
</ins><span class="cx">   /* The symbols being reduced.  */
</span><span class="cx">   for (yyi = 0; yyi &lt; yynrhs; yyi++)
</span><span class="cx">     {
</span><span class="cx">       YYFPRINTF (stderr, &quot;   $%d = &quot;, yyi + 1);
</span><del>-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-                       &amp;(yyvsp[(yyi + 1) - (yynrhs)])
-                       , &amp;(yylsp[(yyi + 1) - (yynrhs)])                       , context);
</del><ins>+      yy_symbol_print (stderr,
+                       yystos[yyssp[yyi + 1 - yynrhs]],
+                       &amp;(yyvsp[(yyi + 1) - (yynrhs)])
+                       , &amp;(yylsp[(yyi + 1) - (yynrhs)])                       , context, scanner);
</ins><span class="cx">       YYFPRINTF (stderr, &quot;\n&quot;);
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-# define YY_REDUCE_PRINT(Rule)                \
-do {                                        \
-  if (yydebug)                                \
-    yy_reduce_print (yyvsp, yylsp, Rule, context); \
-} while (YYID (0))
</del><ins>+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, context, scanner); \
+} while (0)
</ins><span class="cx"> 
</span><span class="cx"> /* Nonzero means print parse trace.  It is left uninitialized so that
</span><span class="cx">    multiple parsers can coexist.  */
</span><span class="lines">@@ -1937,7 +1816,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> /* YYINITDEPTH -- initial size of the parser's stacks.  */
</span><del>-#ifndef        YYINITDEPTH
</del><ins>+#ifndef YYINITDEPTH
</ins><span class="cx"> # define YYINITDEPTH 200
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -1960,15 +1839,8 @@
</span><span class="cx"> #   define yystrlen strlen
</span><span class="cx"> #  else
</span><span class="cx"> /* Return the length of YYSTR.  */
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static YYSIZE_T
</span><span class="cx"> yystrlen (const char *yystr)
</span><del>-#else
-static YYSIZE_T
-yystrlen (yystr)
-    const char *yystr;
-#endif
</del><span class="cx"> {
</span><span class="cx">   YYSIZE_T yylen;
</span><span class="cx">   for (yylen = 0; yystr[yylen]; yylen++)
</span><span class="lines">@@ -1984,16 +1856,8 @@
</span><span class="cx"> #  else
</span><span class="cx"> /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
</span><span class="cx">    YYDEST.  */
</span><del>-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static char *
</span><span class="cx"> yystpcpy (char *yydest, const char *yysrc)
</span><del>-#else
-static char *
-yystpcpy (yydest, yysrc)
-    char *yydest;
-    const char *yysrc;
-#endif
</del><span class="cx"> {
</span><span class="cx">   char *yyd = yydest;
</span><span class="cx">   const char *yys = yysrc;
</span><span class="lines">@@ -2023,27 +1887,27 @@
</span><span class="cx">       char const *yyp = yystr;
</span><span class="cx"> 
</span><span class="cx">       for (;;)
</span><del>-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
</del><ins>+        switch (*++yyp)
+          {
+          case '\'':
+          case ',':
+            goto do_not_strip_quotes;
</ins><span class="cx"> 
</span><del>-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            /* Fall through.  */
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
</del><ins>+          case '\\':
+            if (*++yyp != '\\')
+              goto do_not_strip_quotes;
+            /* Fall through.  */
+          default:
+            if (yyres)
+              yyres[yyn] = *yyp;
+            yyn++;
+            break;
</ins><span class="cx"> 
</span><del>-          case '&quot;':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
</del><ins>+          case '&quot;':
+            if (yyres)
+              yyres[yyn] = '\0';
+            return yyn;
+          }
</ins><span class="cx">     do_not_strip_quotes: ;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -2066,11 +1930,11 @@
</span><span class="cx"> yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
</span><span class="cx">                 yytype_int16 *yyssp, int yytoken)
</span><span class="cx"> {
</span><del>-  YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
</del><ins>+  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
</ins><span class="cx">   YYSIZE_T yysize = yysize0;
</span><span class="cx">   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
</span><span class="cx">   /* Internationalized format string. */
</span><del>-  const char *yyformat = YY_NULL;
</del><ins>+  const char *yyformat = YY_NULLPTR;
</ins><span class="cx">   /* Arguments of yyformat. */
</span><span class="cx">   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
</span><span class="cx">   /* Number of reported tokens (one for the &quot;unexpected&quot;, one per
</span><span class="lines">@@ -2078,10 +1942,6 @@
</span><span class="cx">   int yycount = 0;
</span><span class="cx"> 
</span><span class="cx">   /* There are many possibilities here to consider:
</span><del>-     - Assume YYFAIL is not used.  It's too flawed to consider.  See
-       &lt;http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html&gt;
-       for details.  YYERROR is fine as it does not invoke this
-       function.
</del><span class="cx">      - If this state is a consistent state with a default action, then
</span><span class="cx">        the only way this function was invoked is if the default action
</span><span class="cx">        is an error action.  In that case, don't check for expected
</span><span class="lines">@@ -2131,7 +1991,7 @@
</span><span class="cx">                   }
</span><span class="cx">                 yyarg[yycount++] = yytname[yyx];
</span><span class="cx">                 {
</span><del>-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
</del><ins>+                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
</ins><span class="cx">                   if (! (yysize &lt;= yysize1
</span><span class="cx">                          &amp;&amp; yysize1 &lt;= YYSTACK_ALLOC_MAXIMUM))
</span><span class="cx">                     return 2;
</span><span class="lines">@@ -2198,30 +2058,20 @@
</span><span class="cx"> | Release the memory associated to this symbol.  |
</span><span class="cx"> `-----------------------------------------------*/
</span><span class="cx"> 
</span><del>-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> static void
</span><del>-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-    YYLTYPE *yylocationp;
-    TParseContext* context;
-#endif
</del><ins>+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context, void *scanner)
</ins><span class="cx"> {
</span><span class="cx">   YYUSE (yyvaluep);
</span><span class="cx">   YYUSE (yylocationp);
</span><span class="cx">   YYUSE (context);
</span><del>-
</del><ins>+  YYUSE (scanner);
</ins><span class="cx">   if (!yymsg)
</span><span class="cx">     yymsg = &quot;Deleting&quot;;
</span><span class="cx">   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
</span><span class="cx"> 
</span><ins>+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
</ins><span class="cx">   YYUSE (yytype);
</span><ins>+  YY_IGNORE_MAYBE_UNINITIALIZED_END
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -2231,66 +2081,27 @@
</span><span class="cx"> | yyparse.  |
</span><span class="cx"> `----------*/
</span><span class="cx"> 
</span><del>-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
</del><span class="cx"> int
</span><del>-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (TParseContext* context)
-#else
-int
-yyparse (context)
-    TParseContext* context;
-#endif
-#endif
</del><ins>+yyparse (TParseContext* context, void *scanner)
</ins><span class="cx"> {
</span><span class="cx"> /* The lookahead symbol.  */
</span><span class="cx"> int yychar;
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-#if defined __GNUC__ &amp;&amp; 407 &lt;= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma (&quot;GCC diagnostic push&quot;) \
-    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wuninitialized\&quot;&quot;)\
-    _Pragma (&quot;GCC diagnostic ignored \&quot;-Wmaybe-uninitialized\&quot;&quot;)
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
-    _Pragma (&quot;GCC diagnostic pop&quot;)
-#else
</del><ins>+/* The semantic value of the lookahead symbol.  */
</ins><span class="cx"> /* Default value used for initialization, for pacifying older GCCs
</span><span class="cx">    or non-GCC compilers.  */
</span><del>-static YYSTYPE yyval_default;
-# define YY_INITIAL_VALUE(Value) = Value
-#endif
</del><ins>+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
+
+/* Location data for the lookahead symbol.  */
</ins><span class="cx"> static YYLTYPE yyloc_default
</span><span class="cx"> # if defined YYLTYPE_IS_TRIVIAL &amp;&amp; YYLTYPE_IS_TRIVIAL
</span><span class="cx">   = { 1, 1, 1, 1 }
</span><span class="cx"> # endif
</span><span class="cx"> ;
</span><del>-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
-
-/* Location data for the lookahead symbol.  */
</del><span class="cx"> YYLTYPE yylloc = yyloc_default;
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     /* Number of syntax errors so far.  */
</span><span class="cx">     int yynerrs;
</span><span class="cx"> 
</span><span class="lines">@@ -2299,9 +2110,9 @@
</span><span class="cx">     int yyerrstatus;
</span><span class="cx"> 
</span><span class="cx">     /* The stacks and their tools:
</span><del>-       `yyss': related to states.
-       `yyvs': related to semantic values.
-       `yyls': related to locations.
</del><ins>+       'yyss': related to states.
+       'yyvs': related to semantic values.
+       'yyls': related to locations.
</ins><span class="cx"> 
</span><span class="cx">        Refer to the stacks through separate pointers, to allow yyoverflow
</span><span class="cx">        to reallocate them elsewhere.  */
</span><span class="lines">@@ -2380,26 +2191,26 @@
</span><span class="cx"> 
</span><span class="cx"> #ifdef yyoverflow
</span><span class="cx">       {
</span><del>-        /* Give user a chance to reallocate the stack.  Use copies of
-           these so that the &amp;'s don't force the real ones into
-           memory.  */
-        YYSTYPE *yyvs1 = yyvs;
-        yytype_int16 *yyss1 = yyss;
-        YYLTYPE *yyls1 = yyls;
</del><ins>+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &amp;'s don't force the real ones into
+           memory.  */
+        YYSTYPE *yyvs1 = yyvs;
+        yytype_int16 *yyss1 = yyss;
+        YYLTYPE *yyls1 = yyls;
</ins><span class="cx"> 
</span><del>-        /* Each stack pointer address is followed by the size of the
-           data in use in that stack, in bytes.  This used to be a
-           conditional around just the two extra args, but that might
-           be undefined if yyoverflow is a macro.  */
-        yyoverflow (YY_(&quot;memory exhausted&quot;),
-                    &amp;yyss1, yysize * sizeof (*yyssp),
-                    &amp;yyvs1, yysize * sizeof (*yyvsp),
-                    &amp;yyls1, yysize * sizeof (*yylsp),
-                    &amp;yystacksize);
</del><ins>+        /* Each stack pointer address is followed by the size of the
+           data in use in that stack, in bytes.  This used to be a
+           conditional around just the two extra args, but that might
+           be undefined if yyoverflow is a macro.  */
+        yyoverflow (YY_(&quot;memory exhausted&quot;),
+                    &amp;yyss1, yysize * sizeof (*yyssp),
+                    &amp;yyvs1, yysize * sizeof (*yyvsp),
+                    &amp;yyls1, yysize * sizeof (*yylsp),
+                    &amp;yystacksize);
</ins><span class="cx"> 
</span><del>-        yyls = yyls1;
-        yyss = yyss1;
-        yyvs = yyvs1;
</del><ins>+        yyls = yyls1;
+        yyss = yyss1;
+        yyvs = yyvs1;
</ins><span class="cx">       }
</span><span class="cx"> #else /* no yyoverflow */
</span><span class="cx"> # ifndef YYSTACK_RELOCATE
</span><span class="lines">@@ -2407,23 +2218,23 @@
</span><span class="cx"> # else
</span><span class="cx">       /* Extend the stack our own way.  */
</span><span class="cx">       if (YYMAXDEPTH &lt;= yystacksize)
</span><del>-        goto yyexhaustedlab;
</del><ins>+        goto yyexhaustedlab;
</ins><span class="cx">       yystacksize *= 2;
</span><span class="cx">       if (YYMAXDEPTH &lt; yystacksize)
</span><del>-        yystacksize = YYMAXDEPTH;
</del><ins>+        yystacksize = YYMAXDEPTH;
</ins><span class="cx"> 
</span><span class="cx">       {
</span><del>-        yytype_int16 *yyss1 = yyss;
-        union yyalloc *yyptr =
-          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-        if (! yyptr)
-          goto yyexhaustedlab;
-        YYSTACK_RELOCATE (yyss_alloc, yyss);
-        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-        YYSTACK_RELOCATE (yyls_alloc, yyls);
</del><ins>+        yytype_int16 *yyss1 = yyss;
+        union yyalloc *yyptr =
+          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+        YYSTACK_RELOCATE (yyls_alloc, yyls);
</ins><span class="cx"> #  undef YYSTACK_RELOCATE
</span><del>-        if (yyss1 != yyssa)
-          YYSTACK_FREE (yyss1);
</del><ins>+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
</ins><span class="cx">       }
</span><span class="cx"> # endif
</span><span class="cx"> #endif /* no yyoverflow */
</span><span class="lines">@@ -2433,10 +2244,10 @@
</span><span class="cx">       yylsp = yyls + yysize - 1;
</span><span class="cx"> 
</span><span class="cx">       YYDPRINTF ((stderr, &quot;Stack size increased to %lu\n&quot;,
</span><del>-                  (unsigned long int) yystacksize));
</del><ins>+                  (unsigned long int) yystacksize));
</ins><span class="cx"> 
</span><span class="cx">       if (yyss + yystacksize - 1 &lt;= yyssp)
</span><del>-        YYABORT;
</del><ins>+        YYABORT;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   YYDPRINTF ((stderr, &quot;Entering state %d\n&quot;, yystate));
</span><span class="lines">@@ -2465,7 +2276,7 @@
</span><span class="cx">   if (yychar == YYEMPTY)
</span><span class="cx">     {
</span><span class="cx">       YYDPRINTF ((stderr, &quot;Reading a token: &quot;));
</span><del>-      yychar = YYLEX;
</del><ins>+      yychar = yylex (&amp;yylval, &amp;yylloc, scanner);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   if (yychar &lt;= YYEOF)
</span><span class="lines">@@ -2530,7 +2341,7 @@
</span><span class="cx">   yylen = yyr2[yyn];
</span><span class="cx"> 
</span><span class="cx">   /* If YYLEN is nonzero, implement the default value of the action:
</span><del>-     `$$ = $1'.
</del><ins>+     '$$ = $1'.
</ins><span class="cx"> 
</span><span class="cx">      Otherwise, the following line sets YYVAL to garbage.
</span><span class="cx">      This behavior is undocumented and Bison
</span><span class="lines">@@ -2548,777 +2359,723 @@
</span><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         // The symbol table search was done in the lexical phase
</span><del>-        const TSymbol *symbol = (yyvsp[(1) - (1)].lex).symbol;
-        const TVariable *variable = 0;
</del><ins>+        const TVariable *variable = context-&gt;getNamedVariable((yylsp[0]), (yyvsp[0].lex).string, (yyvsp[0].lex).symbol);
</ins><span class="cx"> 
</span><del>-        if (!symbol)
-        {
-            context-&gt;error((yylsp[(1) - (1)]), &quot;undeclared identifier&quot;, (yyvsp[(1) - (1)].lex).string-&gt;c_str());
-            context-&gt;recover();
-        }
-        else if (!symbol-&gt;isVariable())
-        {
-            context-&gt;error((yylsp[(1) - (1)]), &quot;variable expected&quot;, (yyvsp[(1) - (1)].lex).string-&gt;c_str());
-            context-&gt;recover();
-        }
-        else
-        {
-            variable = static_cast&lt;const TVariable*&gt;(symbol);
-
-            if (context-&gt;symbolTable.findBuiltIn(variable-&gt;getName(), context-&gt;shaderVersion) &amp;&amp;
-                !variable-&gt;getExtension().empty() &amp;&amp;
-                context-&gt;extensionErrorCheck((yylsp[(1) - (1)]), variable-&gt;getExtension()))
-            {
-                context-&gt;recover();
-            }
-        }
-
-        if (!variable)
-        {
-            TType type(EbtFloat, EbpUndefined);
-            TVariable *fakeVariable = new TVariable((yyvsp[(1) - (1)].lex).string, type);
-            context-&gt;symbolTable.declare(*fakeVariable);
-            variable = fakeVariable;
-        }
-
</del><span class="cx">         if (variable-&gt;getType().getQualifier() == EvqConst)
</span><span class="cx">         {
</span><del>-            ConstantUnion* constArray = variable-&gt;getConstPointer();
</del><ins>+            TConstantUnion* constArray = variable-&gt;getConstPointer();
</ins><span class="cx">             TType t(variable-&gt;getType());
</span><del>-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(constArray, t, (yylsp[(1) - (1)]));
</del><ins>+            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(constArray, t, (yylsp[0]));
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="cx">             (yyval.interm.intermTypedNode) = context-&gt;intermediate.addSymbol(variable-&gt;getUniqueId(),
</span><span class="cx">                                                  variable-&gt;getName(),
</span><span class="cx">                                                  variable-&gt;getType(),
</span><del>-                                                 (yylsp[(1) - (1)]));
</del><ins>+                                                 (yylsp[0]));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // don't delete $1.string, it's used by error recovery, and the pool
</span><span class="cx">         // pop will reclaim the memory
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 5:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 6:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
-        unionArray-&gt;setIConst((yyvsp[(1) - (1)].lex).i);
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
+        unionArray-&gt;setIConst((yyvsp[0].lex).i);
+        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 7:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
-        unionArray-&gt;setUConst((yyvsp[(1) - (1)].lex).u);
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
+        unionArray-&gt;setUConst((yyvsp[0].lex).u);
+        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConst), (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 8:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
-        unionArray-&gt;setFConst((yyvsp[(1) - (1)].lex).f);
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
+        unionArray-&gt;setFConst((yyvsp[0].lex).f);
+        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 9:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ConstantUnion *unionArray = new ConstantUnion[1];
-        unionArray-&gt;setBConst((yyvsp[(1) - (1)].lex).b);
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
</del><ins>+        TConstantUnion *unionArray = new TConstantUnion[1];
+        unionArray-&gt;setBConst((yyvsp[0].lex).b);
+        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 10:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(2) - (3)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 11:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 12:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;addIndexExpression((yyvsp[(1) - (4)].interm.intermTypedNode), (yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode));
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addIndexExpression((yyvsp[-3].interm.intermTypedNode), (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 13:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 14:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;addFieldSelectionExpression((yyvsp[(1) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yylsp[(3) - (3)]));
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addFieldSelectionExpression((yyvsp[-2].interm.intermTypedNode), (yylsp[-1]), *(yyvsp[0].lex).string, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 15:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;lValueErrorCheck((yylsp[(2) - (2)]), &quot;++&quot;, (yyvsp[(1) - (2)].interm.intermTypedNode)))
-            context-&gt;recover();
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addUnaryMath(EOpPostIncrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;unaryOpError((yylsp[(2) - (2)]), &quot;++&quot;, (yyvsp[(1) - (2)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addUnaryMathLValue(EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 16:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;lValueErrorCheck((yylsp[(2) - (2)]), &quot;--&quot;, (yyvsp[(1) - (2)].interm.intermTypedNode)))
-            context-&gt;recover();
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addUnaryMath(EOpPostDecrement, (yyvsp[(1) - (2)].interm.intermTypedNode), (yylsp[(2) - (2)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;unaryOpError((yylsp[(2) - (2)]), &quot;--&quot;, (yyvsp[(1) - (2)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(1) - (2)].interm.intermTypedNode);
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addUnaryMathLValue(EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 17:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;integerErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode), &quot;[]&quot;))
</del><ins>+        if (context-&gt;integerErrorCheck((yyvsp[0].interm.intermTypedNode), &quot;[]&quot;))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 18:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        TFunction* fnCall = (yyvsp[(1) - (1)].interm).function;
-        TOperator op = fnCall-&gt;getBuiltInOp();
-
-        if (op != EOpNull)
</del><ins>+        bool fatalError = false;
+        (yyval.interm.intermTypedNode) = context-&gt;addFunctionCallOrMethod((yyvsp[0].interm).function, (yyvsp[0].interm).nodePair.node1, (yyvsp[0].interm).nodePair.node2, (yylsp[0]), &amp;fatalError);
+        if (fatalError)
</ins><span class="cx">         {
</span><del>-            //
-            // Then this should be a constructor.
-            // Don't go through the symbol table for constructors.
-            // Their parameters will be verified algorithmically.
-            //
-            TType type(EbtVoid, EbpUndefined);  // use this to get the type back
-            if (context-&gt;constructorErrorCheck((yylsp[(1) - (1)]), (yyvsp[(1) - (1)].interm).intermNode, *fnCall, op, &amp;type)) {
-                (yyval.interm.intermTypedNode) = 0;
-            } else {
-                //
-                // It's a constructor, of type 'type'.
-                //
-                (yyval.interm.intermTypedNode) = context-&gt;addConstructor((yyvsp[(1) - (1)].interm).intermNode, &amp;type, op, fnCall, (yylsp[(1) - (1)]));
-            }
-
-            if ((yyval.interm.intermTypedNode) == 0) {
-                context-&gt;recover();
-                (yyval.interm.intermTypedNode) = context-&gt;intermediate.setAggregateOperator(0, op, (yylsp[(1) - (1)]));
-            }
-            (yyval.interm.intermTypedNode)-&gt;setType(type);
-        } else {
-            //
-            // Not a constructor.  Find it in the symbol table.
-            //
-            const TFunction* fnCandidate;
-            bool builtIn;
-            fnCandidate = context-&gt;findFunction((yylsp[(1) - (1)]), fnCall, context-&gt;shaderVersion, &amp;builtIn);
-            if (fnCandidate) {
-                //
-                // A declared function.
-                //
-                if (builtIn &amp;&amp; !fnCandidate-&gt;getExtension().empty() &amp;&amp;
-                    context-&gt;extensionErrorCheck((yylsp[(1) - (1)]), fnCandidate-&gt;getExtension())) {
-                    context-&gt;recover();
-                }
-                op = fnCandidate-&gt;getBuiltInOp();
-                if (builtIn &amp;&amp; op != EOpNull) {
-                    //
-                    // A function call mapped to a built-in operation.
-                    //
-                    if (fnCandidate-&gt;getParamCount() == 1) {
-                        //
-                        // Treat it like a built-in unary operator.
-                        //
-                        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addUnaryMath(op, (yyvsp[(1) - (1)].interm).intermNode, (yylsp[(1) - (1)]));
-                        if ((yyval.interm.intermTypedNode) == 0)  {
-                            std::stringstream extraInfoStream;
-                            extraInfoStream &lt;&lt; &quot;built in unary operator function.  Type: &quot; &lt;&lt; static_cast&lt;TIntermTyped*&gt;((yyvsp[(1) - (1)].interm).intermNode)-&gt;getCompleteString();
-                            std::string extraInfo = extraInfoStream.str();
-                            context-&gt;error((yyvsp[(1) - (1)].interm).intermNode-&gt;getLine(), &quot; wrong operand type&quot;, &quot;Internal Error&quot;, extraInfo.c_str());
-                            YYERROR;
-                        }
-                    } else {
-                        (yyval.interm.intermTypedNode) = context-&gt;intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, op, (yylsp[(1) - (1)]));
-                    }
-                } else {
-                    // This is a real function call
-
-                    (yyval.interm.intermTypedNode) = context-&gt;intermediate.setAggregateOperator((yyvsp[(1) - (1)].interm).intermAggregate, EOpFunctionCall, (yylsp[(1) - (1)]));
-                    (yyval.interm.intermTypedNode)-&gt;setType(fnCandidate-&gt;getReturnType());
-
-                    // this is how we know whether the given function is a builtIn function or a user defined function
-                    // if builtIn == false, it's a userDefined -&gt; could be an overloaded builtIn function also
-                    // if builtIn == true, it's definitely a builtIn function with EOpNull
-                    if (!builtIn)
-                        (yyval.interm.intermTypedNode)-&gt;getAsAggregate()-&gt;setUserDefined();
-                    (yyval.interm.intermTypedNode)-&gt;getAsAggregate()-&gt;setName(fnCandidate-&gt;getMangledName());
-
-                    TQualifier qual;
-                    for (size_t i = 0; i &lt; fnCandidate-&gt;getParamCount(); ++i) {
-                        qual = fnCandidate-&gt;getParam(i).type-&gt;getQualifier();
-                        if (qual == EvqOut || qual == EvqInOut) {
-                            if (context-&gt;lValueErrorCheck((yyval.interm.intermTypedNode)-&gt;getLine(), &quot;assign&quot;, (yyval.interm.intermTypedNode)-&gt;getAsAggregate()-&gt;getSequence()[i]-&gt;getAsTyped())) {
-                                context-&gt;error((yyvsp[(1) - (1)].interm).intermNode-&gt;getLine(), &quot;Constant value cannot be passed for 'out' or 'inout' parameters.&quot;, &quot;Error&quot;);
-                                context-&gt;recover();
-                            }
-                        }
-                    }
-                }
-                (yyval.interm.intermTypedNode)-&gt;setType(fnCandidate-&gt;getReturnType());
-            } else {
-                // error message was put out by PaFindFunction()
-                // Put on a dummy node for error recovery
-                ConstantUnion *unionArray = new ConstantUnion[1];
-                unionArray-&gt;setFConst(0.0f);
-                (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConst), (yylsp[(1) - (1)]));
-                context-&gt;recover();
-            }
</del><ins>+            YYERROR;
</ins><span class="cx">         }
</span><del>-        delete fnCall;
</del><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 19:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (1)].interm);
</del><ins>+        (yyval.interm) = (yyvsp[0].interm);
+        (yyval.interm).nodePair.node2 = nullptr;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 20:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        context-&gt;error((yylsp[(3) - (3)]), &quot;methods are not supported&quot;, &quot;&quot;);
-        context-&gt;recover();
-        (yyval.interm) = (yyvsp[(3) - (3)].interm);
</del><ins>+        ES3_ONLY(&quot;&quot;, (yylsp[0]), &quot;methods&quot;);
+        (yyval.interm) = (yyvsp[0].interm);
+        (yyval.interm).nodePair.node2 = (yyvsp[-2].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 21:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (2)].interm);
</del><ins>+        (yyval.interm) = (yyvsp[-1].interm);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 22:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (2)].interm);
</del><ins>+        (yyval.interm) = (yyvsp[-1].interm);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 23:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
-        (yyval.interm).intermNode = 0;
</del><ins>+        (yyval.interm).function = (yyvsp[-1].interm.function);
+        (yyval.interm).nodePair.node1 = nullptr;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 24:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm).function = (yyvsp[(1) - (1)].interm.function);
-        (yyval.interm).intermNode = 0;
</del><ins>+        (yyval.interm).function = (yyvsp[0].interm.function);
+        (yyval.interm).nodePair.node1 = nullptr;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 25:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        TParameter param = { 0, new TType((yyvsp[(2) - (2)].interm.intermTypedNode)-&gt;getType()) };
-        (yyvsp[(1) - (2)].interm.function)-&gt;addParameter(param);
-        (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
-        (yyval.interm).intermNode = (yyvsp[(2) - (2)].interm.intermTypedNode);
</del><ins>+        TParameter param = { 0, new TType((yyvsp[0].interm.intermTypedNode)-&gt;getType()) };
+        (yyvsp[-1].interm.function)-&gt;addParameter(param);
+        (yyval.interm).function = (yyvsp[-1].interm.function);
+        (yyval.interm).nodePair.node1 = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 26:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        TParameter param = { 0, new TType((yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getType()) };
-        (yyvsp[(1) - (3)].interm).function-&gt;addParameter(param);
-        (yyval.interm).function = (yyvsp[(1) - (3)].interm).function;
-        (yyval.interm).intermNode = context-&gt;intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermNode, (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</del><ins>+        TParameter param = { 0, new TType((yyvsp[0].interm.intermTypedNode)-&gt;getType()) };
+        (yyvsp[-2].interm).function-&gt;addParameter(param);
+        (yyval.interm).function = (yyvsp[-2].interm).function;
+        (yyval.interm).nodePair.node1 = context-&gt;intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 27:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
</del><ins>+        (yyval.interm.function) = (yyvsp[-1].interm.function);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 28:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.function) = context-&gt;addConstructorFunc((yyvsp[(1) - (1)].interm.type));
</del><ins>+        if ((yyvsp[0].interm.type).array) {
+            ES3_ONLY(&quot;[]&quot;, (yylsp[0]), &quot;array constructor&quot;);
+        }
+        (yyval.interm.function) = context-&gt;addConstructorFunc((yyvsp[0].interm.type));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 29:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
</del><ins>+        if (context-&gt;reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         TType type(EbtVoid, EbpUndefined);
</span><del>-        TFunction *function = new TFunction((yyvsp[(1) - (1)].lex).string, type);
</del><ins>+        TFunction *function = new TFunction((yyvsp[0].lex).string, type);
</ins><span class="cx">         (yyval.interm.function) = function;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 30:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        if (context-&gt;reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
+            context-&gt;recover();
+        TType type(EbtVoid, EbpUndefined);
+        TFunction *function = new TFunction((yyvsp[0].lex).string, type);
+        (yyval.interm.function) = function;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 31:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;lValueErrorCheck((yylsp[(1) - (2)]), &quot;++&quot;, (yyvsp[(2) - (2)].interm.intermTypedNode)))
-            context-&gt;recover();
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addUnaryMath(EOpPreIncrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;unaryOpError((yylsp[(1) - (2)]), &quot;++&quot;, (yyvsp[(2) - (2)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 32:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;lValueErrorCheck((yylsp[(1) - (2)]), &quot;--&quot;, (yyvsp[(2) - (2)].interm.intermTypedNode)))
-            context-&gt;recover();
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addUnaryMath(EOpPreDecrement, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;unaryOpError((yylsp[(1) - (2)]), &quot;--&quot;, (yyvsp[(2) - (2)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addUnaryMathLValue(EOpPreIncrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 33:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(1) - (2)].interm).op != EOpNull) {
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addUnaryMath((yyvsp[(1) - (2)].interm).op, (yyvsp[(2) - (2)].interm.intermTypedNode), (yylsp[(1) - (2)]));
-            if ((yyval.interm.intermTypedNode) == 0) {
-                const char* errorOp = &quot;&quot;;
-                switch((yyvsp[(1) - (2)].interm).op) {
-                case EOpNegative:   errorOp = &quot;-&quot;; break;
-                case EOpLogicalNot: errorOp = &quot;!&quot;; break;
-                default: break;
-                }
-                context-&gt;unaryOpError((yylsp[(1) - (2)]), errorOp, (yyvsp[(2) - (2)].interm.intermTypedNode)-&gt;getCompleteString());
-                context-&gt;recover();
-                (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
-            }
-        } else
-            (yyval.interm.intermTypedNode) = (yyvsp[(2) - (2)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addUnaryMathLValue(EOpPreDecrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 34:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpNull; }
</del><ins>+    {
+        if ((yyvsp[-1].interm).op != EOpNull) {
+            (yyval.interm.intermTypedNode) = context-&gt;addUnaryMath((yyvsp[-1].interm).op, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+        } else
+            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 35:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpNegative; }
</del><ins>+    { (yyval.interm).op = EOpPositive; }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 36:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpLogicalNot; }
</del><ins>+    { (yyval.interm).op = EOpNegative; }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 37:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm).op = EOpLogicalNot; }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 38:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpMul, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;*&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
-        }
</del><ins>+        ES3_ONLY(&quot;~&quot;, (yyloc), &quot;bit-wise operator&quot;);
+        (yyval.interm).op = EOpBitwiseNot;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 39:
</span><span class="cx"> 
</span><del>-    {
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpDiv, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;/&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
-        }
-    }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 40:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    {
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 41:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpAdd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;+&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 42:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpSub, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;-&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
-        }
</del><ins>+        ES3_ONLY(&quot;%&quot;, (yylsp[-1]), &quot;integer modulus operator&quot;);
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpIMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 43:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 44:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    {
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 45:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpLessThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;&lt;&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 46:
</span><span class="cx"> 
</span><del>-    {
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpGreaterThan, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;&gt;&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
-    }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 47:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpLessThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;&lt;=&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        ES3_ONLY(&quot;&lt;&lt;&quot;, (yylsp[-1]), &quot;bit-wise operator&quot;);
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpBitShiftLeft, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 48:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpGreaterThanEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;&gt;=&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        ES3_ONLY(&quot;&gt;&gt;&quot;, (yylsp[-1]), &quot;bit-wise operator&quot;);
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpBitShiftRight, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 49:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 50:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;==&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 51:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpNotEqual, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;!=&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 52:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    {
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 53:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    {
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 54:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 55:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    {
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 56:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpLogicalAnd, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;&amp;&amp;&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpNotEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 57:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 58:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpLogicalXor, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;^^&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        ES3_ONLY(&quot;&amp;&quot;, (yylsp[-1]), &quot;bit-wise operator&quot;);
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpBitwiseAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 59:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 60:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addBinaryMath(EOpLogicalOr, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;||&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            ConstantUnion *unionArray = new ConstantUnion[1];
-            unionArray-&gt;setBConst(false);
-            (yyval.interm.intermTypedNode) = context-&gt;intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), (yylsp[(2) - (3)]));
-        }
</del><ins>+        ES3_ONLY(&quot;^&quot;, (yylsp[-1]), &quot;bit-wise operator&quot;);
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpBitwiseXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 61:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 62:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-       if (context-&gt;boolErrorCheck((yylsp[(2) - (5)]), (yyvsp[(1) - (5)].interm.intermTypedNode)))
-            context-&gt;recover();
-
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addSelection((yyvsp[(1) - (5)].interm.intermTypedNode), (yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.intermTypedNode), (yylsp[(2) - (5)]));
-        if ((yyvsp[(3) - (5)].interm.intermTypedNode)-&gt;getType() != (yyvsp[(5) - (5)].interm.intermTypedNode)-&gt;getType())
-            (yyval.interm.intermTypedNode) = 0;
-
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;binaryOpError((yylsp[(2) - (5)]), &quot;:&quot;, (yyvsp[(3) - (5)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(5) - (5)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(5) - (5)].interm.intermTypedNode);
-        }
</del><ins>+        ES3_ONLY(&quot;|&quot;, (yylsp[-1]), &quot;bit-wise operator&quot;);
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMath(EOpBitwiseOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 63:
</span><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 64:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;lValueErrorCheck((yylsp[(2) - (3)]), &quot;assign&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)))
-            context-&gt;recover();
-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addAssign((yyvsp[(2) - (3)].interm).op, (yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
-        if ((yyval.interm.intermTypedNode) == 0) {
-            context-&gt;assignError((yylsp[(2) - (3)]), &quot;assign&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
-            context-&gt;recover();
-            (yyval.interm.intermTypedNode) = (yyvsp[(1) - (3)].interm.intermTypedNode);
-        }
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 65:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpAssign; }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 66:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpMulAssign; }
</del><ins>+    {
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 67:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpDivAssign; }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 68:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpAddAssign; }
</del><ins>+    {
+        (yyval.interm.intermTypedNode) = context-&gt;addBinaryMathBooleanResult(EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 69:
</span><span class="cx"> 
</span><del>-    { (yyval.interm).op = EOpSubAssign; }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 70:
</span><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = context-&gt;addTernarySelection((yyvsp[-4].interm.intermTypedNode), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-3]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx">   case 71:
</span><span class="cx"> 
</span><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
+    break;
+
+  case 72:
+
</ins><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addComma((yyvsp[(1) - (3)].interm.intermTypedNode), (yyvsp[(3) - (3)].interm.intermTypedNode), (yylsp[(2) - (3)]));
</del><ins>+        if (context-&gt;lValueErrorCheck((yylsp[-1]), &quot;assign&quot;, (yyvsp[-2].interm.intermTypedNode)))
+            context-&gt;recover();
+        (yyval.interm.intermTypedNode) = context-&gt;addAssign((yyvsp[-1].interm).op, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
+    }
+
+    break;
+
+  case 73:
+
+    { (yyval.interm).op = EOpAssign; }
+
+    break;
+
+  case 74:
+
+    { (yyval.interm).op = EOpMulAssign; }
+
+    break;
+
+  case 75:
+
+    { (yyval.interm).op = EOpDivAssign; }
+
+    break;
+
+  case 76:
+
+    {
+        ES3_ONLY(&quot;%=&quot;, (yyloc), &quot;integer modulus operator&quot;);
+        (yyval.interm).op = EOpIModAssign;
+    }
+
+    break;
+
+  case 77:
+
+    { (yyval.interm).op = EOpAddAssign; }
+
+    break;
+
+  case 78:
+
+    { (yyval.interm).op = EOpSubAssign; }
+
+    break;
+
+  case 79:
+
+    {
+        ES3_ONLY(&quot;&lt;&lt;=&quot;, (yyloc), &quot;bit-wise operator&quot;);
+        (yyval.interm).op = EOpBitShiftLeftAssign;
+    }
+
+    break;
+
+  case 80:
+
+    {
+        ES3_ONLY(&quot;&gt;&gt;=&quot;, (yyloc), &quot;bit-wise operator&quot;);
+        (yyval.interm).op = EOpBitShiftRightAssign;
+    }
+
+    break;
+
+  case 81:
+
+    {
+        ES3_ONLY(&quot;&amp;=&quot;, (yyloc), &quot;bit-wise operator&quot;);
+        (yyval.interm).op = EOpBitwiseAndAssign;
+    }
+
+    break;
+
+  case 82:
+
+    {
+        ES3_ONLY(&quot;^=&quot;, (yyloc), &quot;bit-wise operator&quot;);
+        (yyval.interm).op = EOpBitwiseXorAssign;
+    }
+
+    break;
+
+  case 83:
+
+    {
+        ES3_ONLY(&quot;|=&quot;, (yyloc), &quot;bit-wise operator&quot;);
+        (yyval.interm).op = EOpBitwiseOrAssign;
+    }
+
+    break;
+
+  case 84:
+
+    {
+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+    }
+
+    break;
+
+  case 85:
+
+    {
+        (yyval.interm.intermTypedNode) = context-&gt;intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
</ins><span class="cx">         if ((yyval.interm.intermTypedNode) == 0) {
</span><del>-            context-&gt;binaryOpError((yylsp[(2) - (3)]), &quot;,&quot;, (yyvsp[(1) - (3)].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[(3) - (3)].interm.intermTypedNode)-&gt;getCompleteString());
</del><ins>+            context-&gt;binaryOpError((yylsp[-1]), &quot;,&quot;, (yyvsp[-2].interm.intermTypedNode)-&gt;getCompleteString(), (yyvsp[0].interm.intermTypedNode)-&gt;getCompleteString());
</ins><span class="cx">             context-&gt;recover();
</span><del>-            (yyval.interm.intermTypedNode) = (yyvsp[(3) - (3)].interm.intermTypedNode);
</del><ins>+            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 72:
</del><ins>+  case 86:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;constErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)))
</del><ins>+        if (context-&gt;constErrorCheck((yyvsp[0].interm.intermTypedNode)))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 73:
</del><ins>+  case 87:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;enterStructDeclaration((yylsp[(1) - (2)]), *(yyvsp[(1) - (2)].lex).string))
</del><ins>+        if (context-&gt;enterStructDeclaration((yylsp[-1]), *(yyvsp[-1].lex).string))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        (yyval.lex) = (yyvsp[(1) - (2)].lex);
</del><ins>+        (yyval.lex) = (yyvsp[-1].lex);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 74:
</del><ins>+  case 88:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        TFunction &amp;function = *((yyvsp[(1) - (2)].interm).function);
</del><ins>+        TFunction &amp;function = *((yyvsp[-1].interm).function);
</ins><span class="cx">         
</span><span class="cx">         TIntermAggregate *prototype = new TIntermAggregate;
</span><span class="cx">         prototype-&gt;setType(function.getReturnType());
</span><del>-        prototype-&gt;setName(function.getName());
</del><ins>+        prototype-&gt;setName(function.getMangledName());
+        prototype-&gt;setFunctionId(function.getUniqueId());
</ins><span class="cx">         
</span><span class="cx">         for (size_t i = 0; i &lt; function.getParamCount(); i++)
</span><span class="cx">         {
</span><span class="lines">@@ -3327,11 +3084,11 @@
</span><span class="cx">             {
</span><span class="cx">                 TVariable variable(param.name, *param.type);
</span><span class="cx">                 
</span><del>-                prototype = context-&gt;intermediate.growAggregate(prototype, context-&gt;intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), (yylsp[(1) - (2)])), (yylsp[(1) - (2)]));
</del><ins>+                prototype = context-&gt;intermediate.growAggregate(prototype, context-&gt;intermediate.addSymbol(variable.getUniqueId(), variable.getName(), variable.getType(), (yylsp[-1])), (yylsp[-1]));
</ins><span class="cx">             }
</span><span class="cx">             else
</span><span class="cx">             {
</span><del>-                prototype = context-&gt;intermediate.growAggregate(prototype, context-&gt;intermediate.addSymbol(0, &quot;&quot;, *param.type, (yylsp[(1) - (2)])), (yylsp[(1) - (2)]));
</del><ins>+                prototype = context-&gt;intermediate.growAggregate(prototype, context-&gt;intermediate.addSymbol(0, &quot;&quot;, *param.type, (yylsp[-1])), (yylsp[-1]));
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -3340,65 +3097,73 @@
</span><span class="cx"> 
</span><span class="cx">         context-&gt;symbolTable.pop();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 75:
</del><ins>+  case 89:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(1) - (2)].interm).intermAggregate)
-            (yyvsp[(1) - (2)].interm).intermAggregate-&gt;setOp(EOpDeclaration);
-        (yyval.interm.intermNode) = (yyvsp[(1) - (2)].interm).intermAggregate;
</del><ins>+        TIntermAggregate *aggNode = (yyvsp[-1].interm).intermAggregate;
+        if (aggNode &amp;&amp; aggNode-&gt;getOp() == EOpNull)
+            aggNode-&gt;setOp(EOpDeclaration);
+        (yyval.interm.intermNode) = aggNode;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 76:
</del><ins>+  case 90:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (((yyvsp[(2) - (4)].interm.precision) == EbpHigh) &amp;&amp; (context-&gt;shaderType == SH_FRAGMENT_SHADER) &amp;&amp; !context-&gt;fragmentPrecisionHigh) {
-            context-&gt;error((yylsp[(1) - (4)]), &quot;precision is not supported in fragment shader&quot;, &quot;highp&quot;);
</del><ins>+        if (((yyvsp[-2].interm.precision) == EbpHigh) &amp;&amp; (context-&gt;shaderType == GL_FRAGMENT_SHADER) &amp;&amp; !context-&gt;fragmentPrecisionHigh) {
+            context-&gt;error((yylsp[-3]), &quot;precision is not supported in fragment shader&quot;, &quot;highp&quot;);
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><del>-        if (!context-&gt;symbolTable.setDefaultPrecision( (yyvsp[(3) - (4)].interm.type), (yyvsp[(2) - (4)].interm.precision) )) {
-            context-&gt;error((yylsp[(1) - (4)]), &quot;illegal type argument for default precision qualifier&quot;, getBasicString((yyvsp[(3) - (4)].interm.type).type));
</del><ins>+        if (!context-&gt;symbolTable.setDefaultPrecision( (yyvsp[-1].interm.type), (yyvsp[-2].interm.precision) )) {
+            context-&gt;error((yylsp[-3]), &quot;illegal type argument for default precision qualifier&quot;, getBasicString((yyvsp[-1].interm.type).type));
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         (yyval.interm.intermNode) = 0;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 77:
</del><ins>+  case 91:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(getQualifierString((yyvsp[(1) - (5)].interm.type).qualifier), (yylsp[(1) - (5)]), &quot;interface blocks&quot;);
-        (yyval.interm.intermNode) = context-&gt;addInterfaceBlock((yyvsp[(1) - (5)].interm.type), (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yyvsp[(3) - (5)].interm.fieldList), NULL, (yyloc), NULL, (yyloc));
</del><ins>+        ES3_ONLY(getQualifierString((yyvsp[-4].interm.type).qualifier), (yylsp[-4]), &quot;interface blocks&quot;);
+        (yyval.interm.intermNode) = context-&gt;addInterfaceBlock((yyvsp[-4].interm.type), (yylsp[-3]), *(yyvsp[-3].lex).string, (yyvsp[-2].interm.fieldList), NULL, (yyloc), NULL, (yyloc));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 78:
</del><ins>+  case 92:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(getQualifierString((yyvsp[(1) - (6)].interm.type).qualifier), (yylsp[(1) - (6)]), &quot;interface blocks&quot;);
-        (yyval.interm.intermNode) = context-&gt;addInterfaceBlock((yyvsp[(1) - (6)].interm.type), (yylsp[(2) - (6)]), *(yyvsp[(2) - (6)].lex).string, (yyvsp[(3) - (6)].interm.fieldList), (yyvsp[(5) - (6)].lex).string, (yylsp[(5) - (6)]), NULL, (yyloc));
</del><ins>+        ES3_ONLY(getQualifierString((yyvsp[-5].interm.type).qualifier), (yylsp[-5]), &quot;interface blocks&quot;);
+        (yyval.interm.intermNode) = context-&gt;addInterfaceBlock((yyvsp[-5].interm.type), (yylsp[-4]), *(yyvsp[-4].lex).string, (yyvsp[-3].interm.fieldList), (yyvsp[-1].lex).string, (yylsp[-1]), NULL, (yyloc));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 79:
</del><ins>+  case 93:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(getQualifierString((yyvsp[(1) - (9)].interm.type).qualifier), (yylsp[(1) - (9)]), &quot;interface blocks&quot;);
-        (yyval.interm.intermNode) = context-&gt;addInterfaceBlock((yyvsp[(1) - (9)].interm.type), (yylsp[(2) - (9)]), *(yyvsp[(2) - (9)].lex).string, (yyvsp[(3) - (9)].interm.fieldList), (yyvsp[(5) - (9)].lex).string, (yylsp[(5) - (9)]), (yyvsp[(7) - (9)].interm.intermTypedNode), (yylsp[(6) - (9)]));
</del><ins>+        ES3_ONLY(getQualifierString((yyvsp[-8].interm.type).qualifier), (yylsp[-8]), &quot;interface blocks&quot;);
+        (yyval.interm.intermNode) = context-&gt;addInterfaceBlock((yyvsp[-8].interm.type), (yylsp[-7]), *(yyvsp[-7].lex).string, (yyvsp[-6].interm.fieldList), (yyvsp[-4].lex).string, (yylsp[-4]), (yyvsp[-2].interm.intermTypedNode), (yylsp[-3]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 80:
</del><ins>+  case 94:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        context-&gt;parseGlobalLayoutQualifier((yyvsp[(1) - (2)].interm.type));
</del><ins>+        context-&gt;parseGlobalLayoutQualifier((yyvsp[-1].interm.type));
</ins><span class="cx">         (yyval.interm.intermNode) = 0;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 81:
</del><ins>+  case 95:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         //
</span><span class="lines">@@ -3409,15 +3174,15 @@
</span><span class="cx">         //
</span><span class="cx">         // Redeclarations are allowed.  But, return types and parameter qualifiers must match.
</span><span class="cx">         //
</span><del>-        TFunction* prevDec = static_cast&lt;TFunction*&gt;(context-&gt;symbolTable.find((yyvsp[(1) - (2)].interm.function)-&gt;getMangledName(), context-&gt;shaderVersion));
</del><ins>+        TFunction* prevDec = static_cast&lt;TFunction*&gt;(context-&gt;symbolTable.find((yyvsp[-1].interm.function)-&gt;getMangledName(), context-&gt;shaderVersion));
</ins><span class="cx">         if (prevDec) {
</span><del>-            if (prevDec-&gt;getReturnType() != (yyvsp[(1) - (2)].interm.function)-&gt;getReturnType()) {
-                context-&gt;error((yylsp[(2) - (2)]), &quot;overloaded functions must have the same return type&quot;, (yyvsp[(1) - (2)].interm.function)-&gt;getReturnType().getBasicString());
</del><ins>+            if (prevDec-&gt;getReturnType() != (yyvsp[-1].interm.function)-&gt;getReturnType()) {
+                context-&gt;error((yylsp[0]), &quot;overloaded functions must have the same return type&quot;, (yyvsp[-1].interm.function)-&gt;getReturnType().getBasicString());
</ins><span class="cx">                 context-&gt;recover();
</span><span class="cx">             }
</span><span class="cx">             for (size_t i = 0; i &lt; prevDec-&gt;getParamCount(); ++i) {
</span><del>-                if (prevDec-&gt;getParam(i).type-&gt;getQualifier() != (yyvsp[(1) - (2)].interm.function)-&gt;getParam(i).type-&gt;getQualifier()) {
-                    context-&gt;error((yylsp[(2) - (2)]), &quot;overloaded functions must have the same parameter qualifiers&quot;, (yyvsp[(1) - (2)].interm.function)-&gt;getParam(i).type-&gt;getQualifierString());
</del><ins>+                if (prevDec-&gt;getParam(i).type-&gt;getQualifier() != (yyvsp[-1].interm.function)-&gt;getParam(i).type-&gt;getQualifier()) {
+                    context-&gt;error((yylsp[0]), &quot;overloaded functions must have the same parameter qualifiers&quot;, (yyvsp[-1].interm.function)-&gt;getParam(i).type-&gt;getQualifierString());
</ins><span class="cx">                     context-&gt;recover();
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -3426,19 +3191,20 @@
</span><span class="cx">         //
</span><span class="cx">         // Check for previously declared variables using the same name.
</span><span class="cx">         //
</span><del>-        TSymbol *prevSym = context-&gt;symbolTable.find((yyvsp[(1) - (2)].interm.function)-&gt;getName(), context-&gt;shaderVersion);
</del><ins>+        TSymbol *prevSym = context-&gt;symbolTable.find((yyvsp[-1].interm.function)-&gt;getName(), context-&gt;shaderVersion);
</ins><span class="cx">         if (prevSym)
</span><span class="cx">         {
</span><span class="cx">             if (!prevSym-&gt;isFunction())
</span><span class="cx">             {
</span><del>-                context-&gt;error((yylsp[(2) - (2)]), &quot;redefinition&quot;, (yyvsp[(1) - (2)].interm.function)-&gt;getName().c_str(), &quot;function&quot;);
</del><ins>+                context-&gt;error((yylsp[0]), &quot;redefinition&quot;, (yyvsp[-1].interm.function)-&gt;getName().c_str(), &quot;function&quot;);
</ins><span class="cx">                 context-&gt;recover();
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="cx">             // Insert the unmangled name to detect potential future redefinition as a variable.
</span><del>-            context-&gt;symbolTable.getOuterLevel()-&gt;insert((yyvsp[(1) - (2)].interm.function)-&gt;getName(), *(yyvsp[(1) - (2)].interm.function));
</del><ins>+            TFunction *function = new TFunction(NewPoolTString((yyvsp[-1].interm.function)-&gt;getName().c_str()), (yyvsp[-1].interm.function)-&gt;getReturnType());
+            context-&gt;symbolTable.getOuterLevel()-&gt;insertUnmangled(function);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         //
</span><span class="lines">@@ -3446,1470 +3212,1680 @@
</span><span class="cx">         // in which case, we want to use the variable names from this one, and not the one that's
</span><span class="cx">         // being redeclared.  So, pass back up this declaration, not the one in the symbol table.
</span><span class="cx">         //
</span><del>-        (yyval.interm).function = (yyvsp[(1) - (2)].interm.function);
</del><ins>+        (yyval.interm).function = (yyvsp[-1].interm.function);
</ins><span class="cx"> 
</span><span class="cx">         // We're at the inner scope level of the function's arguments and body statement.
</span><span class="cx">         // Add the function prototype to the surrounding scope instead.
</span><del>-        context-&gt;symbolTable.getOuterLevel()-&gt;insert(*(yyval.interm).function);
</del><ins>+        context-&gt;symbolTable.getOuterLevel()-&gt;insert((yyval.interm).function);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 82:
</del><ins>+  case 96:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
</del><ins>+        (yyval.interm.function) = (yyvsp[0].interm.function);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 83:
</del><ins>+  case 97:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.function) = (yyvsp[(1) - (1)].interm.function);
</del><ins>+        (yyval.interm.function) = (yyvsp[0].interm.function);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 84:
</del><ins>+  case 98:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         // Add the parameter
</span><del>-        (yyval.interm.function) = (yyvsp[(1) - (2)].interm.function);
-        if ((yyvsp[(2) - (2)].interm).param.type-&gt;getBasicType() != EbtVoid)
-            (yyvsp[(1) - (2)].interm.function)-&gt;addParameter((yyvsp[(2) - (2)].interm).param);
</del><ins>+        (yyval.interm.function) = (yyvsp[-1].interm.function);
+        if ((yyvsp[0].interm).param.type-&gt;getBasicType() != EbtVoid)
+            (yyvsp[-1].interm.function)-&gt;addParameter((yyvsp[0].interm).param);
</ins><span class="cx">         else
</span><del>-            delete (yyvsp[(2) - (2)].interm).param.type;
</del><ins>+            delete (yyvsp[0].interm).param.type;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 85:
</del><ins>+  case 99:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         //
</span><span class="cx">         // Only first parameter of one-parameter functions can be void
</span><span class="cx">         // The check for named parameters not being void is done in parameter_declarator
</span><span class="cx">         //
</span><del>-        if ((yyvsp[(3) - (3)].interm).param.type-&gt;getBasicType() == EbtVoid) {
</del><ins>+        if ((yyvsp[0].interm).param.type-&gt;getBasicType() == EbtVoid) {
</ins><span class="cx">             //
</span><span class="cx">             // This parameter &gt; first is void
</span><span class="cx">             //
</span><del>-            context-&gt;error((yylsp[(2) - (3)]), &quot;cannot be an argument type except for '(void)'&quot;, &quot;void&quot;);
</del><ins>+            context-&gt;error((yylsp[-1]), &quot;cannot be an argument type except for '(void)'&quot;, &quot;void&quot;);
</ins><span class="cx">             context-&gt;recover();
</span><del>-            delete (yyvsp[(3) - (3)].interm).param.type;
</del><ins>+            delete (yyvsp[0].interm).param.type;
</ins><span class="cx">         } else {
</span><span class="cx">             // Add the parameter
</span><del>-            (yyval.interm.function) = (yyvsp[(1) - (3)].interm.function);
-            (yyvsp[(1) - (3)].interm.function)-&gt;addParameter((yyvsp[(3) - (3)].interm).param);
</del><ins>+            (yyval.interm.function) = (yyvsp[-2].interm.function);
+            (yyvsp[-2].interm.function)-&gt;addParameter((yyvsp[0].interm).param);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 86:
</del><ins>+  case 100:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(1) - (3)].interm.type).qualifier != EvqGlobal &amp;&amp; (yyvsp[(1) - (3)].interm.type).qualifier != EvqTemporary) {
-            context-&gt;error((yylsp[(2) - (3)]), &quot;no qualifiers allowed for function return&quot;, getQualifierString((yyvsp[(1) - (3)].interm.type).qualifier));
</del><ins>+        if ((yyvsp[-2].interm.type).qualifier != EvqGlobal &amp;&amp; (yyvsp[-2].interm.type).qualifier != EvqTemporary) {
+            context-&gt;error((yylsp[-1]), &quot;no qualifiers allowed for function return&quot;, getQualifierString((yyvsp[-2].interm.type).qualifier));
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         // make sure a sampler is not involved as well...
</span><del>-        if (context-&gt;structQualifierErrorCheck((yylsp[(2) - (3)]), (yyvsp[(1) - (3)].interm.type)))
</del><ins>+        if (context-&gt;samplerErrorCheck((yylsp[-1]), (yyvsp[-2].interm.type), &quot;samplers can't be function return values&quot;))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><span class="cx">         // Add the function as a prototype after parsing it (we do not support recursion)
</span><span class="cx">         TFunction *function;
</span><del>-        TType type((yyvsp[(1) - (3)].interm.type));
-        function = new TFunction((yyvsp[(2) - (3)].lex).string, type);
</del><ins>+        TType type((yyvsp[-2].interm.type));
+        function = new TFunction((yyvsp[-1].lex).string, type);
</ins><span class="cx">         (yyval.interm.function) = function;
</span><span class="cx">         
</span><span class="cx">         context-&gt;symbolTable.push();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 87:
</del><ins>+  case 101:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(1) - (2)].interm.type).type == EbtVoid) {
-            context-&gt;error((yylsp[(2) - (2)]), &quot;illegal use of type 'void'&quot;, (yyvsp[(2) - (2)].lex).string-&gt;c_str());
</del><ins>+        if ((yyvsp[-1].interm.type).type == EbtVoid) {
+            context-&gt;error((yylsp[0]), &quot;illegal use of type 'void'&quot;, (yyvsp[0].lex).string-&gt;c_str());
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><del>-        if (context-&gt;reservedErrorCheck((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string))
</del><ins>+        if (context-&gt;reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        TParameter param = {(yyvsp[(2) - (2)].lex).string, new TType((yyvsp[(1) - (2)].interm.type))};
</del><ins>+        TParameter param = {(yyvsp[0].lex).string, new TType((yyvsp[-1].interm.type))};
</ins><span class="cx">         (yyval.interm).param = param;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 88:
</del><ins>+  case 102:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         // Check that we can make an array out of this type
</span><del>-        if (context-&gt;arrayTypeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(1) - (5)].interm.type)))
</del><ins>+        if (context-&gt;arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-4].interm.type)))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><del>-        if (context-&gt;reservedErrorCheck((yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string))
</del><ins>+        if (context-&gt;reservedErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><span class="cx">         int size;
</span><del>-        if (context-&gt;arraySizeErrorCheck((yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode), size))
</del><ins>+        if (context-&gt;arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        (yyvsp[(1) - (5)].interm.type).setArray(true, size);
</del><ins>+        (yyvsp[-4].interm.type).setArraySize(size);
</ins><span class="cx"> 
</span><del>-        TType* type = new TType((yyvsp[(1) - (5)].interm.type));
-        TParameter param = { (yyvsp[(2) - (5)].lex).string, type };
</del><ins>+        TType* type = new TType((yyvsp[-4].interm.type));
+        TParameter param = { (yyvsp[-3].lex).string, type };
</ins><span class="cx">         (yyval.interm).param = param;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 89:
</del><ins>+  case 103:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(3) - (3)].interm);
-        if (context-&gt;paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
</del><ins>+        (yyval.interm) = (yyvsp[0].interm);
+        if (context-&gt;paramErrorCheck((yylsp[0]), (yyvsp[-2].interm.qualifier), (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 90:
</del><ins>+  case 104:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(2) - (2)].interm);
-        if (context-&gt;parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
</del><ins>+        (yyval.interm) = (yyvsp[0].interm);
+        if (context-&gt;parameterSamplerErrorCheck((yylsp[0]), (yyvsp[-1].interm.qualifier), *(yyvsp[0].interm).param.type))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        if (context-&gt;paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
</del><ins>+        if (context-&gt;paramErrorCheck((yylsp[0]), EvqTemporary, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 91:
</del><ins>+  case 105:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(3) - (3)].interm);
-        if (context-&gt;paramErrorCheck((yylsp[(3) - (3)]), (yyvsp[(1) - (3)].interm.qualifier), (yyvsp[(2) - (3)].interm.qualifier), (yyval.interm).param.type))
</del><ins>+        (yyval.interm) = (yyvsp[0].interm);
+        if (context-&gt;paramErrorCheck((yylsp[0]), (yyvsp[-2].interm.qualifier), (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 92:
</del><ins>+  case 106:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(2) - (2)].interm);
-        if (context-&gt;parameterSamplerErrorCheck((yylsp[(2) - (2)]), (yyvsp[(1) - (2)].interm.qualifier), *(yyvsp[(2) - (2)].interm).param.type))
</del><ins>+        (yyval.interm) = (yyvsp[0].interm);
+        if (context-&gt;parameterSamplerErrorCheck((yylsp[0]), (yyvsp[-1].interm.qualifier), *(yyvsp[0].interm).param.type))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        if (context-&gt;paramErrorCheck((yylsp[(2) - (2)]), EvqTemporary, (yyvsp[(1) - (2)].interm.qualifier), (yyval.interm).param.type))
</del><ins>+        if (context-&gt;paramErrorCheck((yylsp[0]), EvqTemporary, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 93:
</del><ins>+  case 107:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.qualifier) = EvqIn;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 94:
</del><ins>+  case 108:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.qualifier) = EvqIn;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 95:
</del><ins>+  case 109:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.qualifier) = EvqOut;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 96:
</del><ins>+  case 110:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.qualifier) = EvqInOut;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 97:
</del><ins>+  case 111:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        TParameter param = { 0, new TType((yyvsp[(1) - (1)].interm.type)) };
</del><ins>+        TParameter param = { 0, new TType((yyvsp[0].interm.type)) };
</ins><span class="cx">         (yyval.interm).param = param;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 98:
</del><ins>+  case 112:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (1)].interm);
</del><ins>+        (yyval.interm) = (yyvsp[0].interm);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 99:
</del><ins>+  case 113:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (3)].interm);
-        (yyval.interm).intermAggregate = context-&gt;parseDeclarator((yyval.interm).type, (yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].lex).symbol, (yylsp[(3) - (3)]), *(yyvsp[(3) - (3)].lex).string);
</del><ins>+        (yyval.interm) = (yyvsp[-2].interm);
+        (yyval.interm).intermAggregate = context-&gt;parseDeclarator((yyval.interm).type, (yyvsp[-2].interm).intermAggregate, (yylsp[0]), *(yyvsp[0].lex).string);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 100:
</del><ins>+  case 114:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (5)].interm);
-        context-&gt;parseArrayDeclarator((yyval.interm).type, (yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yylsp[(4) - (5)]), NULL, NULL);
</del><ins>+        (yyval.interm) = (yyvsp[-5].interm);
+        (yyval.interm).intermAggregate = context-&gt;parseArrayDeclarator((yyval.interm).type, (yyvsp[-5].interm).intermAggregate, (yylsp[-3]), *(yyvsp[-3].lex).string, (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 101:
</del><ins>+  case 115:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (6)].interm);
-        (yyval.interm).intermAggregate = context-&gt;parseArrayDeclarator((yyval.interm).type, (yylsp[(3) - (6)]), *(yyvsp[(3) - (6)].lex).string, (yylsp[(4) - (6)]), (yyvsp[(1) - (6)].interm).intermNode, (yyvsp[(5) - (6)].interm.intermTypedNode));
</del><ins>+        ES3_ONLY(&quot;[]&quot;, (yylsp[-4]), &quot;implicitly sized array&quot;);
+        (yyval.interm) = (yyvsp[-6].interm);
+        (yyval.interm).intermAggregate = context-&gt;parseArrayInitDeclarator((yyval.interm).type, (yyvsp[-6].interm).intermAggregate, (yylsp[-4]), *(yyvsp[-4].lex).string, (yylsp[-3]), nullptr, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 102:
</del><ins>+  case 116:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm) = (yyvsp[(1) - (5)].interm);
-        (yyval.interm).intermAggregate = context-&gt;parseInitDeclarator((yyval.interm).type, (yyvsp[(1) - (5)].interm).intermAggregate, (yylsp[(3) - (5)]), *(yyvsp[(3) - (5)].lex).string, (yylsp[(4) - (5)]), (yyvsp[(5) - (5)].interm.intermTypedNode));
</del><ins>+        ES3_ONLY(&quot;=&quot;, (yylsp[-1]), &quot;first-class arrays (array initializer)&quot;);
+        (yyval.interm) = (yyvsp[-7].interm);
+        (yyval.interm).intermAggregate = context-&gt;parseArrayInitDeclarator((yyval.interm).type, (yyvsp[-7].interm).intermAggregate, (yylsp[-5]), *(yyvsp[-5].lex).string, (yylsp[-4]), (yyvsp[-3].interm.intermTypedNode), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 103:
</del><ins>+  case 117:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm).type = (yyvsp[(1) - (1)].interm.type);
-        (yyval.interm).intermAggregate = context-&gt;parseSingleDeclaration((yyval.interm).type, (yylsp[(1) - (1)]), &quot;&quot;);
</del><ins>+        (yyval.interm) = (yyvsp[-4].interm);
+        (yyval.interm).intermAggregate = context-&gt;parseInitDeclarator((yyval.interm).type, (yyvsp[-4].interm).intermAggregate, (yylsp[-2]), *(yyvsp[-2].lex).string, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 104:
</del><ins>+  case 118:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm).type = (yyvsp[(1) - (2)].interm.type);
-        (yyval.interm).intermAggregate = context-&gt;parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string);
</del><ins>+        (yyval.interm).type = (yyvsp[0].interm.type);
+        (yyval.interm).intermAggregate = context-&gt;parseSingleDeclaration((yyval.interm).type, (yylsp[0]), &quot;&quot;);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 105:
</del><ins>+  case 119:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        context-&gt;error((yylsp[(2) - (4)]), &quot;unsized array declarations not supported&quot;, (yyvsp[(2) - (4)].lex).string-&gt;c_str());
-        context-&gt;recover();
</del><ins>+        (yyval.interm).type = (yyvsp[-1].interm.type);
+        (yyval.interm).intermAggregate = context-&gt;parseSingleDeclaration((yyval.interm).type, (yylsp[0]), *(yyvsp[0].lex).string);
+    }
</ins><span class="cx"> 
</span><del>-        (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
-        (yyval.interm).intermAggregate = context-&gt;parseSingleDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string);
</del><ins>+    break;
+
+  case 120:
+
+    {
+        (yyval.interm).type = (yyvsp[-4].interm.type);
+        (yyval.interm).intermAggregate = context-&gt;parseSingleArrayDeclaration((yyval.interm).type, (yylsp[-3]), *(yyvsp[-3].lex).string, (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 106:
</del><ins>+  case 121:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm).type = (yyvsp[(1) - (5)].interm.type);
-        (yyval.interm).intermAggregate = context-&gt;parseSingleArrayDeclaration((yyval.interm).type, (yylsp[(2) - (5)]), *(yyvsp[(2) - (5)].lex).string, (yylsp[(3) - (5)]), (yyvsp[(4) - (5)].interm.intermTypedNode));
</del><ins>+        ES3_ONLY(&quot;[]&quot;, (yylsp[-3]), &quot;implicitly sized array&quot;);
+        (yyval.interm).type = (yyvsp[-5].interm.type);
+        (yyval.interm).intermAggregate = context-&gt;parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[-4]), *(yyvsp[-4].lex).string, (yylsp[-3]), nullptr, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 107:
</del><ins>+  case 122:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm).type = (yyvsp[(1) - (4)].interm.type);
-        (yyval.interm).intermAggregate = context-&gt;parseSingleInitDeclaration((yyval.interm).type, (yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yylsp[(3) - (4)]), (yyvsp[(4) - (4)].interm.intermTypedNode));
</del><ins>+        ES3_ONLY(&quot;=&quot;, (yylsp[-1]), &quot;first-class arrays (array initializer)&quot;);
+        (yyval.interm).type = (yyvsp[-6].interm.type);
+        (yyval.interm).intermAggregate = context-&gt;parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[-5]), *(yyvsp[-5].lex).string, (yylsp[-4]), (yyvsp[-3].interm.intermTypedNode), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 108:
</del><ins>+  case 123:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        VERTEX_ONLY(&quot;invariant declaration&quot;, (yylsp[(1) - (2)]));
-        if (context-&gt;globalErrorCheck((yylsp[(1) - (2)]), context-&gt;symbolTable.atGlobalLevel(), &quot;invariant varying&quot;))
-            context-&gt;recover();
-        (yyval.interm).type.setBasic(EbtInvariant, EvqInvariantVaryingOut, (yylsp[(2) - (2)]));
-        if (!(yyvsp[(2) - (2)].lex).symbol)
-        {
-            context-&gt;error((yylsp[(2) - (2)]), &quot;undeclared identifier declared as invariant&quot;, (yyvsp[(2) - (2)].lex).string-&gt;c_str());
-            context-&gt;recover();
-            
-            (yyval.interm).intermAggregate = 0;
-        }
-        else
-        {
-            TIntermSymbol *symbol = context-&gt;intermediate.addSymbol(0, *(yyvsp[(2) - (2)].lex).string, TType((yyval.interm).type), (yylsp[(2) - (2)]));
-            (yyval.interm).intermAggregate = context-&gt;intermediate.makeAggregate(symbol, (yylsp[(2) - (2)]));
-        }
</del><ins>+        (yyval.interm).type = (yyvsp[-3].interm.type);
+        (yyval.interm).intermAggregate = context-&gt;parseSingleInitDeclaration((yyval.interm).type, (yylsp[-2]), *(yyvsp[-2].lex).string, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 109:
</del><ins>+  case 124:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</del><ins>+        // $$.type is not used in invariant declarations.
+        (yyval.interm).intermAggregate = context-&gt;parseInvariantDeclaration((yylsp[-1]), (yylsp[0]), (yyvsp[0].lex).string, (yyvsp[0].lex).symbol);
+    }
</ins><span class="cx"> 
</span><del>-        if ((yyvsp[(1) - (1)].interm.type).array) {
-            context-&gt;error((yylsp[(1) - (1)]), &quot;not supported&quot;, &quot;first-class array&quot;);
-            context-&gt;recover();
-            (yyvsp[(1) - (1)].interm.type).setArray(false);
</del><ins>+    break;
+
+  case 125:
+
+    {
+        (yyval.interm.type) = (yyvsp[0].interm.type);
+
+        if ((yyvsp[0].interm.type).array) {
+            ES3_ONLY(&quot;[]&quot;, (yylsp[0]), &quot;first-class-array&quot;);
+            if (context-&gt;shaderVersion != 300) {
+                (yyvsp[0].interm.type).clearArrayness();
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 110:
</del><ins>+  case 126:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = context-&gt;addFullySpecifiedType((yyvsp[(1) - (2)].interm.type).qualifier, (yyvsp[(1) - (2)].interm.type).layoutQualifier, (yyvsp[(2) - (2)].interm.type));
</del><ins>+        (yyval.interm.type) = context-&gt;addFullySpecifiedType((yyvsp[-1].interm.type).qualifier, (yyvsp[-1].interm.type).layoutQualifier, (yyvsp[0].interm.type));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 111:
</del><ins>+  case 127:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.type).qualifier = EvqSmooth;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 112:
</del><ins>+  case 128:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.type).qualifier = EvqFlat;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 113:
</del><ins>+  case 129:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.qualifier) = EvqConst;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 114:
</del><ins>+  case 130:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        VERTEX_ONLY(&quot;attribute&quot;, (yylsp[(1) - (1)]));
-        ES2_ONLY(&quot;attribute&quot;, (yylsp[(1) - (1)]));
-        if (context-&gt;globalErrorCheck((yylsp[(1) - (1)]), context-&gt;symbolTable.atGlobalLevel(), &quot;attribute&quot;))
</del><ins>+        VERTEX_ONLY(&quot;attribute&quot;, (yylsp[0]));
+        ES2_ONLY(&quot;attribute&quot;, (yylsp[0]));
+        if (context-&gt;globalErrorCheck((yylsp[0]), context-&gt;symbolTable.atGlobalLevel(), &quot;attribute&quot;))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 115:
</del><ins>+  case 131:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES2_ONLY(&quot;varying&quot;, (yylsp[(1) - (1)]));
-        if (context-&gt;globalErrorCheck((yylsp[(1) - (1)]), context-&gt;symbolTable.atGlobalLevel(), &quot;varying&quot;))
</del><ins>+        ES2_ONLY(&quot;varying&quot;, (yylsp[0]));
+        if (context-&gt;globalErrorCheck((yylsp[0]), context-&gt;symbolTable.atGlobalLevel(), &quot;varying&quot;))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        if (context-&gt;shaderType == SH_VERTEX_SHADER)
-            (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[(1) - (1)]));
</del><ins>+        if (context-&gt;shaderType == GL_VERTEX_SHADER)
+            (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[0]));
</ins><span class="cx">         else
</span><del>-            (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[(1) - (1)]));
</del><ins>+            (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 116:
</del><ins>+  case 132:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES2_ONLY(&quot;varying&quot;, (yylsp[(1) - (2)]));
-        if (context-&gt;globalErrorCheck((yylsp[(1) - (2)]), context-&gt;symbolTable.atGlobalLevel(), &quot;invariant varying&quot;))
</del><ins>+        ES2_ONLY(&quot;varying&quot;, (yylsp[-1]));
+        if (context-&gt;globalErrorCheck((yylsp[-1]), context-&gt;symbolTable.atGlobalLevel(), &quot;invariant varying&quot;))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        if (context-&gt;shaderType == SH_VERTEX_SHADER)
-            (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[(1) - (2)]));
</del><ins>+        if (context-&gt;shaderType == GL_VERTEX_SHADER)
+            (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[-1]));
</ins><span class="cx">         else
</span><del>-            (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[(1) - (2)]));
</del><ins>+            (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 117:
</del><ins>+  case 133:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(1) - (1)].interm.type).qualifier != EvqConst &amp;&amp; !context-&gt;symbolTable.atGlobalLevel()) {
-            context-&gt;error((yylsp[(1) - (1)]), &quot;Local variables can only use the const storage qualifier.&quot;, getQualifierString((yyvsp[(1) - (1)].interm.type).qualifier));
</del><ins>+        if ((yyvsp[0].interm.type).qualifier != EvqConst &amp;&amp; !context-&gt;symbolTable.atGlobalLevel()) {
+            context-&gt;error((yylsp[0]), &quot;Local variables can only use the const storage qualifier.&quot;, getQualifierString((yyvsp[0].interm.type).qualifier));
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         } else {
</span><del>-            (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(1) - (1)].interm.type).qualifier, (yylsp[(1) - (1)]));
</del><ins>+            (yyval.interm.type).setBasic(EbtVoid, (yyvsp[0].interm.type).qualifier, (yylsp[0]));
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 118:
</del><ins>+  case 134:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = context-&gt;joinInterpolationQualifiers((yylsp[(1) - (2)]), (yyvsp[(1) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]), (yyvsp[(2) - (2)].interm.type).qualifier);
</del><ins>+        (yyval.interm.type) = context-&gt;joinInterpolationQualifiers((yylsp[-1]), (yyvsp[-1].interm.type).qualifier, (yylsp[0]), (yyvsp[0].interm.type).qualifier);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 119:
</del><ins>+  case 135:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        context-&gt;error((yylsp[(1) - (1)]), &quot;interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier&quot;, getInterpolationString((yyvsp[(1) - (1)].interm.type).qualifier));
</del><ins>+        context-&gt;error((yylsp[0]), &quot;interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier&quot;, getInterpolationString((yyvsp[0].interm.type).qualifier));
</ins><span class="cx">         context-&gt;recover();
</span><span class="cx">         
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 120:
</del><ins>+  case 136:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.type).qualifier = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (1)].interm.layoutQualifier);
</del><ins>+        (yyval.interm.type).layoutQualifier = (yyvsp[0].interm.layoutQualifier);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 121:
</del><ins>+  case 137:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type).setBasic(EbtVoid, (yyvsp[(2) - (2)].interm.type).qualifier, (yylsp[(2) - (2)]));
-        (yyval.interm.type).layoutQualifier = (yyvsp[(1) - (2)].interm.layoutQualifier);
</del><ins>+        (yyval.interm.type).setBasic(EbtVoid, (yyvsp[0].interm.type).qualifier, (yylsp[0]));
+        (yyval.interm.type).layoutQualifier = (yyvsp[-1].interm.layoutQualifier);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 122:
</del><ins>+  case 138:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.type).qualifier = EvqConst;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 123:
</del><ins>+  case 139:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(&quot;in&quot;, (yylsp[(1) - (1)]), &quot;storage qualifier&quot;);
-        (yyval.interm.type).qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
</del><ins>+        ES3_ONLY(&quot;in&quot;, (yylsp[0]), &quot;storage qualifier&quot;);
+        (yyval.interm.type).qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 124:
</del><ins>+  case 140:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(&quot;out&quot;, (yylsp[(1) - (1)]), &quot;storage qualifier&quot;);
-        (yyval.interm.type).qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
</del><ins>+        ES3_ONLY(&quot;out&quot;, (yylsp[0]), &quot;storage qualifier&quot;);
+        (yyval.interm.type).qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 125:
</del><ins>+  case 141:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(&quot;centroid in&quot;, (yylsp[(1) - (2)]), &quot;storage qualifier&quot;);
-        if (context-&gt;shaderType == SH_VERTEX_SHADER)
</del><ins>+        ES3_ONLY(&quot;centroid in&quot;, (yylsp[-1]), &quot;storage qualifier&quot;);
+        if (context-&gt;shaderType == GL_VERTEX_SHADER)
</ins><span class="cx">         {
</span><del>-            context-&gt;error((yylsp[(1) - (2)]), &quot;invalid storage qualifier&quot;, &quot;it is an error to use 'centroid in' in the vertex shader&quot;);
</del><ins>+            context-&gt;error((yylsp[-1]), &quot;invalid storage qualifier&quot;, &quot;it is an error to use 'centroid in' in the vertex shader&quot;);
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><del>-        (yyval.interm.type).qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
</del><ins>+        (yyval.interm.type).qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 126:
</del><ins>+  case 142:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(&quot;centroid out&quot;, (yylsp[(1) - (2)]), &quot;storage qualifier&quot;);
-        if (context-&gt;shaderType == SH_FRAGMENT_SHADER)
</del><ins>+        ES3_ONLY(&quot;centroid out&quot;, (yylsp[-1]), &quot;storage qualifier&quot;);
+        if (context-&gt;shaderType == GL_FRAGMENT_SHADER)
</ins><span class="cx">         {
</span><del>-            context-&gt;error((yylsp[(1) - (2)]), &quot;invalid storage qualifier&quot;, &quot;it is an error to use 'centroid out' in the fragment shader&quot;);
</del><ins>+            context-&gt;error((yylsp[-1]), &quot;invalid storage qualifier&quot;, &quot;it is an error to use 'centroid out' in the fragment shader&quot;);
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><del>-        (yyval.interm.type).qualifier = (context-&gt;shaderType == SH_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
</del><ins>+        (yyval.interm.type).qualifier = (context-&gt;shaderType == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 127:
</del><ins>+  case 143:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;globalErrorCheck((yylsp[(1) - (1)]), context-&gt;symbolTable.atGlobalLevel(), &quot;uniform&quot;))
</del><ins>+        if (context-&gt;globalErrorCheck((yylsp[0]), context-&gt;symbolTable.atGlobalLevel(), &quot;uniform&quot;))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         (yyval.interm.type).qualifier = EvqUniform;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 128:
</del><ins>+  case 144:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</del><ins>+        (yyval.interm.type) = (yyvsp[0].interm.type);
</ins><span class="cx"> 
</span><span class="cx">         if ((yyval.interm.type).precision == EbpUndefined) {
</span><del>-            (yyval.interm.type).precision = context-&gt;symbolTable.getDefaultPrecision((yyvsp[(1) - (1)].interm.type).type);
-            if (context-&gt;precisionErrorCheck((yylsp[(1) - (1)]), (yyval.interm.type).precision, (yyvsp[(1) - (1)].interm.type).type)) {
</del><ins>+            (yyval.interm.type).precision = context-&gt;symbolTable.getDefaultPrecision((yyvsp[0].interm.type).type);
+            if (context-&gt;precisionErrorCheck((yylsp[0]), (yyval.interm.type).precision, (yyvsp[0].interm.type).type)) {
</ins><span class="cx">                 context-&gt;recover();
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 129:
</del><ins>+  case 145:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = (yyvsp[(2) - (2)].interm.type);
-        (yyval.interm.type).precision = (yyvsp[(1) - (2)].interm.precision);
</del><ins>+        (yyval.interm.type) = (yyvsp[0].interm.type);
+        (yyval.interm.type).precision = (yyvsp[-1].interm.precision);
+
+        if (!SupportsPrecision((yyvsp[0].interm.type).type)) {
+            context-&gt;error((yylsp[-1]), &quot;illegal type for precision qualifier&quot;, getBasicString((yyvsp[0].interm.type).type));
+            context-&gt;recover();
+        }
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 130:
</del><ins>+  case 146:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.precision) = EbpHigh;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 131:
</del><ins>+  case 147:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.precision) = EbpMedium;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 132:
</del><ins>+  case 148:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.precision) = EbpLow;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 133:
</del><ins>+  case 149:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        ES3_ONLY(&quot;layout&quot;, (yylsp[(1) - (4)]), &quot;qualifier&quot;);
-        (yyval.interm.layoutQualifier) = (yyvsp[(3) - (4)].interm.layoutQualifier);
</del><ins>+        ES3_ONLY(&quot;layout&quot;, (yylsp[-3]), &quot;qualifier&quot;);
+        (yyval.interm.layoutQualifier) = (yyvsp[-1].interm.layoutQualifier);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 134:
</del><ins>+  case 150:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.layoutQualifier) = (yyvsp[(1) - (1)].interm.layoutQualifier);
</del><ins>+        (yyval.interm.layoutQualifier) = (yyvsp[0].interm.layoutQualifier);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 135:
</del><ins>+  case 151:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.layoutQualifier) = context-&gt;joinLayoutQualifiers((yyvsp[(1) - (3)].interm.layoutQualifier), (yyvsp[(3) - (3)].interm.layoutQualifier));
</del><ins>+        (yyval.interm.layoutQualifier) = context-&gt;joinLayoutQualifiers((yyvsp[-2].interm.layoutQualifier), (yyvsp[0].interm.layoutQualifier));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 136:
</del><ins>+  case 152:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.layoutQualifier) = context-&gt;parseLayoutQualifier(*(yyvsp[(1) - (1)].lex).string, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.layoutQualifier) = context-&gt;parseLayoutQualifier(*(yyvsp[0].lex).string, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 137:
</del><ins>+  case 153:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.layoutQualifier) = context-&gt;parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
</del><ins>+        (yyval.interm.layoutQualifier) = context-&gt;parseLayoutQualifier(*(yyvsp[-2].lex).string, (yylsp[-2]), *(yyvsp[0].lex).string, (yyvsp[0].lex).i, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 138:
</del><ins>+  case 154:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.layoutQualifier) = context-&gt;parseLayoutQualifier(*(yyvsp[(1) - (3)].lex).string, (yylsp[(1) - (3)]), *(yyvsp[(3) - (3)].lex).string, (yyvsp[(3) - (3)].lex).i, (yylsp[(3) - (3)]));
</del><ins>+        (yyval.interm.layoutQualifier) = context-&gt;parseLayoutQualifier(*(yyvsp[-2].lex).string, (yylsp[-2]), *(yyvsp[0].lex).string, (yyvsp[0].lex).i, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 139:
</del><ins>+  case 155:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</del><ins>+        (yyval.interm.type) = (yyvsp[0].interm.type);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 140:
</del><ins>+  case 156:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = (yyvsp[(1) - (4)].interm.type);
</del><ins>+        ES3_ONLY(&quot;[]&quot;, (yylsp[-1]), &quot;implicitly sized array&quot;);
+        (yyval.interm.type) = (yyvsp[-2].interm.type);
+        (yyval.interm.type).setArraySize(0);
+    }
</ins><span class="cx"> 
</span><del>-        if (context-&gt;arrayTypeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
</del><ins>+    break;
+
+  case 157:
+
+    {
+        (yyval.interm.type) = (yyvsp[-3].interm.type);
+
+        if (context-&gt;arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         else {
</span><span class="cx">             int size;
</span><del>-            if (context-&gt;arraySizeErrorCheck((yylsp[(2) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
</del><ins>+            if (context-&gt;arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
</ins><span class="cx">                 context-&gt;recover();
</span><del>-            (yyval.interm.type).setArray(true, size);
</del><ins>+            (yyval.interm.type).setArraySize(size);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 141:
</del><ins>+  case 158:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 142:
</del><ins>+  case 159:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 143:
</del><ins>+  case 160:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 144:
</del><ins>+  case 161:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 145:
</del><ins>+  case 162:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 146:
</del><ins>+  case 163:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(2);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 147:
</del><ins>+  case 164:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(3);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 148:
</del><ins>+  case 165:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(4);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 149:
</del><ins>+  case 166:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(2);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 150:
</del><ins>+  case 167:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(3);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 151:
</del><ins>+  case 168:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(4);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 152:
</del><ins>+  case 169:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(2);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 153:
</del><ins>+  case 170:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(3);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 154:
</del><ins>+  case 171:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(4);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 155:
</del><ins>+  case 172:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(2);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 156:
</del><ins>+  case 173:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(3);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 157:
</del><ins>+  case 174:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setAggregate(4);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 158:
</del><ins>+  case 175:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(2, 2);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 159:
</del><ins>+  case 176:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(3, 3);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 160:
</del><ins>+  case 177:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(4, 4);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 161:
</del><ins>+  case 178:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(2, 3);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 162:
</del><ins>+  case 179:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(3, 2);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 163:
</del><ins>+  case 180:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(2, 4);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 164:
</del><ins>+  case 181:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(4, 2);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 165:
</del><ins>+  case 182:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(3, 4);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 166:
</del><ins>+  case 183:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).setMatrix(4, 3);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 167:
</del><ins>+  case 184:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 168:
</del><ins>+  case 185:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSampler3D, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSampler3D, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 169:
</del><ins>+  case 186:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 170:
</del><ins>+  case 187:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 171:
</del><ins>+  case 188:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtISampler2D, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtISampler2D, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 172:
</del><ins>+  case 189:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtISampler3D, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtISampler3D, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 173:
</del><ins>+  case 190:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 174:
</del><ins>+  case 191:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 175:
</del><ins>+  case 192:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 176:
</del><ins>+  case 193:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 177:
</del><ins>+  case 194:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 178:
</del><ins>+  case 195:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 179:
</del><ins>+  case 196:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 180:
</del><ins>+  case 197:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 181:
</del><ins>+  case 198:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 182:
</del><ins>+  case 199:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         if (!context-&gt;supportsExtension(&quot;GL_OES_EGL_image_external&quot;)) {
</span><del>-            context-&gt;error((yylsp[(1) - (1)]), &quot;unsupported type&quot;, &quot;samplerExternalOES&quot;);
</del><ins>+            context-&gt;error((yylsp[0]), &quot;unsupported type&quot;, &quot;samplerExternalOES&quot;);
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 183:
</del><ins>+  case 200:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         if (!context-&gt;supportsExtension(&quot;GL_ARB_texture_rectangle&quot;)) {
</span><del>-            context-&gt;error((yylsp[(1) - (1)]), &quot;unsupported type&quot;, &quot;sampler2DRect&quot;);
</del><ins>+            context-&gt;error((yylsp[0]), &quot;unsupported type&quot;, &quot;sampler2DRect&quot;);
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 184:
</del><ins>+  case 201:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = (yyvsp[(1) - (1)].interm.type);
</del><ins>+        (yyval.interm.type) = (yyvsp[0].interm.type);
</ins><span class="cx">         (yyval.interm.type).qualifier = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 185:
</del><ins>+  case 202:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         //
</span><span class="cx">         // This is for user defined type names.  The lexical phase looked up the
</span><span class="cx">         // type.
</span><span class="cx">         //
</span><del>-        TType&amp; structure = static_cast&lt;TVariable*&gt;((yyvsp[(1) - (1)].lex).symbol)-&gt;getType();
</del><ins>+        TType&amp; structure = static_cast&lt;TVariable*&gt;((yyvsp[0].lex).symbol)-&gt;getType();
</ins><span class="cx">         TQualifier qual = context-&gt;symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
</span><del>-        (yyval.interm.type).setBasic(EbtStruct, qual, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.type).setBasic(EbtStruct, qual, (yylsp[0]));
</ins><span class="cx">         (yyval.interm.type).userDef = &amp;structure;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 186:
</del><ins>+  case 203:
</ins><span class="cx"> 
</span><del>-    { if (context-&gt;enterStructDeclaration((yylsp[(2) - (3)]), *(yyvsp[(2) - (3)].lex).string)) context-&gt;recover(); }
</del><ins>+    { if (context-&gt;enterStructDeclaration((yylsp[-1]), *(yyvsp[-1].lex).string)) context-&gt;recover(); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 187:
</del><ins>+  case 204:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = context-&gt;addStructure((yylsp[(1) - (6)]), (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].lex).string, (yyvsp[(5) - (6)].interm.fieldList));
</del><ins>+        (yyval.interm.type) = context-&gt;addStructure((yylsp[-5]), (yylsp[-4]), (yyvsp[-4].lex).string, (yyvsp[-1].interm.fieldList));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 188:
</del><ins>+  case 205:
</ins><span class="cx"> 
</span><del>-    { if (context-&gt;enterStructDeclaration((yylsp[(2) - (2)]), *(yyvsp[(2) - (2)].lex).string)) context-&gt;recover(); }
</del><ins>+    { if (context-&gt;enterStructDeclaration((yylsp[0]), *(yyvsp[0].lex).string)) context-&gt;recover(); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 189:
</del><ins>+  case 206:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.type) = context-&gt;addStructure((yylsp[(1) - (5)]), (yyloc), NewPoolTString(&quot;&quot;), (yyvsp[(4) - (5)].interm.fieldList));
</del><ins>+        (yyval.interm.type) = context-&gt;addStructure((yylsp[-4]), (yyloc), NewPoolTString(&quot;&quot;), (yyvsp[-1].interm.fieldList));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 190:
</del><ins>+  case 207:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.fieldList) = (yyvsp[(1) - (1)].interm.fieldList);
</del><ins>+        (yyval.interm.fieldList) = (yyvsp[0].interm.fieldList);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 191:
</del><ins>+  case 208:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.fieldList) = (yyvsp[(1) - (2)].interm.fieldList);
-        for (size_t i = 0; i &lt; (yyvsp[(2) - (2)].interm.fieldList)-&gt;size(); ++i) {
-            TField* field = (*(yyvsp[(2) - (2)].interm.fieldList))[i];
</del><ins>+        (yyval.interm.fieldList) = (yyvsp[-1].interm.fieldList);
+        for (size_t i = 0; i &lt; (yyvsp[0].interm.fieldList)-&gt;size(); ++i) {
+            TField* field = (*(yyvsp[0].interm.fieldList))[i];
</ins><span class="cx">             for (size_t j = 0; j &lt; (yyval.interm.fieldList)-&gt;size(); ++j) {
</span><span class="cx">                 if ((*(yyval.interm.fieldList))[j]-&gt;name() == field-&gt;name()) {
</span><del>-                    context-&gt;error((yylsp[(2) - (2)]), &quot;duplicate field name in structure:&quot;, &quot;struct&quot;, field-&gt;name().c_str());
</del><ins>+                    context-&gt;error((yylsp[0]), &quot;duplicate field name in structure:&quot;, &quot;struct&quot;, field-&gt;name().c_str());
</ins><span class="cx">                     context-&gt;recover();
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">             (yyval.interm.fieldList)-&gt;push_back(field);
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 192:
</del><ins>+  case 209:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.fieldList) = context-&gt;addStructDeclaratorList((yyvsp[(1) - (3)].interm.type), (yyvsp[(2) - (3)].interm.fieldList));
</del><ins>+        (yyval.interm.fieldList) = context-&gt;addStructDeclaratorList((yyvsp[-2].interm.type), (yyvsp[-1].interm.fieldList));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 193:
</del><ins>+  case 210:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         // ES3 Only, but errors should be handled elsewhere
</span><del>-        (yyvsp[(2) - (4)].interm.type).qualifier = (yyvsp[(1) - (4)].interm.type).qualifier;
-        (yyvsp[(2) - (4)].interm.type).layoutQualifier = (yyvsp[(1) - (4)].interm.type).layoutQualifier;
-        (yyval.interm.fieldList) = context-&gt;addStructDeclaratorList((yyvsp[(2) - (4)].interm.type), (yyvsp[(3) - (4)].interm.fieldList));
</del><ins>+        (yyvsp[-2].interm.type).qualifier = (yyvsp[-3].interm.type).qualifier;
+        (yyvsp[-2].interm.type).layoutQualifier = (yyvsp[-3].interm.type).layoutQualifier;
+        (yyval.interm.fieldList) = context-&gt;addStructDeclaratorList((yyvsp[-2].interm.type), (yyvsp[-1].interm.fieldList));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 194:
</del><ins>+  case 211:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.fieldList) = NewPoolTFieldList();
</span><del>-        (yyval.interm.fieldList)-&gt;push_back((yyvsp[(1) - (1)].interm.field));
</del><ins>+        (yyval.interm.fieldList)-&gt;push_back((yyvsp[0].interm.field));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 195:
</del><ins>+  case 212:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.fieldList)-&gt;push_back((yyvsp[(3) - (3)].interm.field));
</del><ins>+        (yyval.interm.fieldList)-&gt;push_back((yyvsp[0].interm.field));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 196:
</del><ins>+  case 213:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;reservedErrorCheck((yylsp[(1) - (1)]), *(yyvsp[(1) - (1)].lex).string))
</del><ins>+        if (context-&gt;reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><span class="cx">         TType* type = new TType(EbtVoid, EbpUndefined);
</span><del>-        (yyval.interm.field) = new TField(type, (yyvsp[(1) - (1)].lex).string, (yylsp[(1) - (1)]));
</del><ins>+        (yyval.interm.field) = new TField(type, (yyvsp[0].lex).string, (yylsp[0]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 197:
</del><ins>+  case 214:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;reservedErrorCheck((yylsp[(1) - (4)]), *(yyvsp[(1) - (4)].lex).string))
</del><ins>+        if (context-&gt;reservedErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><span class="cx">         TType* type = new TType(EbtVoid, EbpUndefined);
</span><span class="cx">         int size;
</span><del>-        if (context-&gt;arraySizeErrorCheck((yylsp[(3) - (4)]), (yyvsp[(3) - (4)].interm.intermTypedNode), size))
</del><ins>+        if (context-&gt;arraySizeErrorCheck((yylsp[-1]), (yyvsp[-1].interm.intermTypedNode), size))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         type-&gt;setArraySize(size);
</span><span class="cx"> 
</span><del>-        (yyval.interm.field) = new TField(type, (yyvsp[(1) - (4)].lex).string, (yylsp[(1) - (4)]));
</del><ins>+        (yyval.interm.field) = new TField(type, (yyvsp[-3].lex).string, (yylsp[-3]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 198:
</del><ins>+  case 215:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode); }
</del><ins>+    { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 199:
</del><ins>+  case 216:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 200:
</del><ins>+  case 217:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermAggregate); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermAggregate); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 201:
</del><ins>+  case 218:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 202:
</del><ins>+  case 219:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 203:
</del><ins>+  case 220:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 204:
</del><ins>+  case 221:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 205:
</del><ins>+  case 222:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermSwitch); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 206:
</del><ins>+  case 223:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermCase); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 207:
</del><ins>+  case 224:
</ins><span class="cx"> 
</span><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+    break;
+
+  case 225:
+
+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
+    break;
+
+  case 226:
+
</ins><span class="cx">     { (yyval.interm.intermAggregate) = 0; }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 208:
</del><ins>+  case 227:
</ins><span class="cx"> 
</span><span class="cx">     { context-&gt;symbolTable.push(); }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 209:
</del><ins>+  case 228:
</ins><span class="cx"> 
</span><span class="cx">     { context-&gt;symbolTable.pop(); }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 210:
</del><ins>+  case 229:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(3) - (5)].interm.intermAggregate) != 0) {
-            (yyvsp[(3) - (5)].interm.intermAggregate)-&gt;setOp(EOpSequence);
-            (yyvsp[(3) - (5)].interm.intermAggregate)-&gt;setLine((yyloc));
</del><ins>+        if ((yyvsp[-2].interm.intermAggregate) != 0) {
+            (yyvsp[-2].interm.intermAggregate)-&gt;setOp(EOpSequence);
+            (yyvsp[-2].interm.intermAggregate)-&gt;setLine((yyloc));
</ins><span class="cx">         }
</span><del>-        (yyval.interm.intermAggregate) = (yyvsp[(3) - (5)].interm.intermAggregate);
</del><ins>+        (yyval.interm.intermAggregate) = (yyvsp[-2].interm.intermAggregate);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 211:
</del><ins>+  case 230:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 212:
</del><ins>+  case 231:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode); }
</del><ins>+    { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 213:
</del><ins>+  case 232:
</ins><span class="cx"> 
</span><span class="cx">     { context-&gt;symbolTable.push(); }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 214:
</del><ins>+  case 233:
</ins><span class="cx"> 
</span><del>-    { context-&gt;symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
</del><ins>+    { context-&gt;symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 215:
</del><ins>+  case 234:
</ins><span class="cx"> 
</span><span class="cx">     { context-&gt;symbolTable.push(); }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 216:
</del><ins>+  case 235:
</ins><span class="cx"> 
</span><del>-    { context-&gt;symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[(2) - (2)].interm.intermNode); }
</del><ins>+    { context-&gt;symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 217:
</del><ins>+  case 236:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.intermNode) = 0;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 218:
</del><ins>+  case 237:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if ((yyvsp[(2) - (3)].interm.intermAggregate)) {
-            (yyvsp[(2) - (3)].interm.intermAggregate)-&gt;setOp(EOpSequence);
-            (yyvsp[(2) - (3)].interm.intermAggregate)-&gt;setLine((yyloc));
</del><ins>+        if ((yyvsp[-1].interm.intermAggregate)) {
+            (yyvsp[-1].interm.intermAggregate)-&gt;setOp(EOpSequence);
+            (yyvsp[-1].interm.intermAggregate)-&gt;setLine((yyloc));
</ins><span class="cx">         }
</span><del>-        (yyval.interm.intermNode) = (yyvsp[(2) - (3)].interm.intermAggregate);
</del><ins>+        (yyval.interm.intermNode) = (yyvsp[-1].interm.intermAggregate);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 219:
</del><ins>+  case 238:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermAggregate) = context-&gt;intermediate.makeAggregate((yyvsp[(1) - (1)].interm.intermNode), (yyloc));
</del><ins>+        (yyval.interm.intermAggregate) = context-&gt;intermediate.makeAggregate((yyvsp[0].interm.intermNode), (yyloc));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 220:
</del><ins>+  case 239:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermAggregate) = context-&gt;intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermAggregate), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
</del><ins>+        (yyval.interm.intermAggregate) = context-&gt;intermediate.growAggregate((yyvsp[-1].interm.intermAggregate), (yyvsp[0].interm.intermNode), (yyloc));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 221:
</del><ins>+  case 240:
</ins><span class="cx"> 
</span><span class="cx">     { (yyval.interm.intermNode) = 0; }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 222:
</del><ins>+  case 241:
</ins><span class="cx"> 
</span><del>-    { (yyval.interm.intermNode) = static_cast&lt;TIntermNode*&gt;((yyvsp[(1) - (2)].interm.intermTypedNode)); }
</del><ins>+    { (yyval.interm.intermNode) = static_cast&lt;TIntermNode*&gt;((yyvsp[-1].interm.intermTypedNode)); }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 223:
</del><ins>+  case 242:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;boolErrorCheck((yylsp[(1) - (5)]), (yyvsp[(3) - (5)].interm.intermTypedNode)))
</del><ins>+        if (context-&gt;boolErrorCheck((yylsp[-4]), (yyvsp[-2].interm.intermTypedNode)))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.addSelection((yyvsp[(3) - (5)].interm.intermTypedNode), (yyvsp[(5) - (5)].interm.nodePair), (yylsp[(1) - (5)]));
</del><ins>+        (yyval.interm.intermNode) = context-&gt;intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yylsp[-4]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 224:
</del><ins>+  case 243:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermNode);
-        (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermNode);
</del><ins>+        (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode);
+        (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 225:
</del><ins>+  case 244:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.nodePair).node1 = (yyvsp[(1) - (1)].interm.intermNode);
</del><ins>+        (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode);
</ins><span class="cx">         (yyval.interm.nodePair).node2 = 0;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 226:
</del><ins>+  case 245:
</ins><span class="cx"> 
</span><ins>+    { ++context-&gt;mSwitchNestingLevel; }
+
+    break;
+
+  case 246:
+
</ins><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
-        if (context-&gt;boolErrorCheck((yyvsp[(1) - (1)].interm.intermTypedNode)-&gt;getLine(), (yyvsp[(1) - (1)].interm.intermTypedNode)))
</del><ins>+        (yyval.interm.intermSwitch) = context-&gt;addSwitch((yyvsp[-3].interm.intermTypedNode), (yyvsp[0].interm.intermAggregate), (yylsp[-5]));
+        --context-&gt;mSwitchNestingLevel;
+    }
+
+    break;
+
+  case 247:
+
+    {
+        (yyval.interm.intermCase) = context-&gt;addCase((yyvsp[-1].interm.intermTypedNode), (yylsp[-2]));
+    }
+
+    break;
+
+  case 248:
+
+    {
+        (yyval.interm.intermCase) = context-&gt;addDefault((yylsp[-1]));
+    }
+
+    break;
+
+  case 249:
+
+    {
+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
+        if (context-&gt;boolErrorCheck((yyvsp[0].interm.intermTypedNode)-&gt;getLine(), (yyvsp[0].interm.intermTypedNode)))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 227:
</del><ins>+  case 250:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        TIntermNode* intermNode;
-        if (context-&gt;structQualifierErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
</del><ins>+        TIntermNode *intermNode;
+        if (context-&gt;boolErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
</ins><span class="cx">             context-&gt;recover();
</span><del>-        if (context-&gt;boolErrorCheck((yylsp[(2) - (4)]), (yyvsp[(1) - (4)].interm.type)))
-            context-&gt;recover();
</del><span class="cx"> 
</span><del>-        if (!context-&gt;executeInitializer((yylsp[(2) - (4)]), *(yyvsp[(2) - (4)].lex).string, (yyvsp[(1) - (4)].interm.type), (yyvsp[(4) - (4)].interm.intermTypedNode), intermNode))
-            (yyval.interm.intermTypedNode) = (yyvsp[(4) - (4)].interm.intermTypedNode);
</del><ins>+        if (!context-&gt;executeInitializer((yylsp[-2]), *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), (yyvsp[0].interm.intermTypedNode), &amp;intermNode))
+            (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">         else {
</span><span class="cx">             context-&gt;recover();
</span><span class="cx">             (yyval.interm.intermTypedNode) = 0;
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 228:
</del><ins>+  case 251:
</ins><span class="cx"> 
</span><del>-    { context-&gt;symbolTable.push(); ++context-&gt;loopNestingLevel; }
</del><ins>+    { context-&gt;symbolTable.push(); ++context-&gt;mLoopNestingLevel; }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 229:
</del><ins>+  case 252:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         context-&gt;symbolTable.pop();
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.addLoop(ELoopWhile, 0, (yyvsp[(4) - (6)].interm.intermTypedNode), 0, (yyvsp[(6) - (6)].interm.intermNode), (yylsp[(1) - (6)]));
-        --context-&gt;loopNestingLevel;
</del><ins>+        (yyval.interm.intermNode) = context-&gt;intermediate.addLoop(ELoopWhile, 0, (yyvsp[-2].interm.intermTypedNode), 0, (yyvsp[0].interm.intermNode), (yylsp[-5]));
+        --context-&gt;mLoopNestingLevel;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 230:
</del><ins>+  case 253:
</ins><span class="cx"> 
</span><del>-    { ++context-&gt;loopNestingLevel; }
</del><ins>+    { ++context-&gt;mLoopNestingLevel; }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 231:
</del><ins>+  case 254:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;boolErrorCheck((yylsp[(8) - (8)]), (yyvsp[(6) - (8)].interm.intermTypedNode)))
</del><ins>+        if (context-&gt;boolErrorCheck((yylsp[0]), (yyvsp[-2].interm.intermTypedNode)))
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx"> 
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[(6) - (8)].interm.intermTypedNode), 0, (yyvsp[(3) - (8)].interm.intermNode), (yylsp[(4) - (8)]));
-        --context-&gt;loopNestingLevel;
</del><ins>+        (yyval.interm.intermNode) = context-&gt;intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[-2].interm.intermTypedNode), 0, (yyvsp[-5].interm.intermNode), (yylsp[-4]));
+        --context-&gt;mLoopNestingLevel;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 232:
</del><ins>+  case 255:
</ins><span class="cx"> 
</span><del>-    { context-&gt;symbolTable.push(); ++context-&gt;loopNestingLevel; }
</del><ins>+    { context-&gt;symbolTable.push(); ++context-&gt;mLoopNestingLevel; }
+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 233:
</del><ins>+  case 256:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         context-&gt;symbolTable.pop();
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.addLoop(ELoopFor, (yyvsp[(4) - (7)].interm.intermNode), reinterpret_cast&lt;TIntermTyped*&gt;((yyvsp[(5) - (7)].interm.nodePair).node1), reinterpret_cast&lt;TIntermTyped*&gt;((yyvsp[(5) - (7)].interm.nodePair).node2), (yyvsp[(7) - (7)].interm.intermNode), (yylsp[(1) - (7)]));
-        --context-&gt;loopNestingLevel;
</del><ins>+        (yyval.interm.intermNode) = context-&gt;intermediate.addLoop(ELoopFor, (yyvsp[-3].interm.intermNode), reinterpret_cast&lt;TIntermTyped*&gt;((yyvsp[-2].interm.nodePair).node1), reinterpret_cast&lt;TIntermTyped*&gt;((yyvsp[-2].interm.nodePair).node2), (yyvsp[0].interm.intermNode), (yylsp[-6]));
+        --context-&gt;mLoopNestingLevel;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 234:
</del><ins>+  case 257:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</del><ins>+        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 235:
</del><ins>+  case 258:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</del><ins>+        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 236:
</del><ins>+  case 259:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermTypedNode) = (yyvsp[(1) - (1)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 237:
</del><ins>+  case 260:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         (yyval.interm.intermTypedNode) = 0;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 238:
</del><ins>+  case 261:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.nodePair).node1 = (yyvsp[(1) - (2)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode);
</ins><span class="cx">         (yyval.interm.nodePair).node2 = 0;
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 239:
</del><ins>+  case 262:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.nodePair).node1 = (yyvsp[(1) - (3)].interm.intermTypedNode);
-        (yyval.interm.nodePair).node2 = (yyvsp[(3) - (3)].interm.intermTypedNode);
</del><ins>+        (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode);
+        (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 240:
</del><ins>+  case 263:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;loopNestingLevel &lt;= 0) {
-            context-&gt;error((yylsp[(1) - (2)]), &quot;continue statement only allowed in loops&quot;, &quot;&quot;);
-            context-&gt;recover();
-        }
-        (yyval.interm.intermNode) = context-&gt;intermediate.addBranch(EOpContinue, (yylsp[(1) - (2)]));
</del><ins>+        (yyval.interm.intermNode) = context-&gt;addBranch(EOpContinue, (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 241:
</del><ins>+  case 264:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        if (context-&gt;loopNestingLevel &lt;= 0) {
-            context-&gt;error((yylsp[(1) - (2)]), &quot;break statement only allowed in loops&quot;, &quot;&quot;);
-            context-&gt;recover();
-        }
-        (yyval.interm.intermNode) = context-&gt;intermediate.addBranch(EOpBreak, (yylsp[(1) - (2)]));
</del><ins>+        (yyval.interm.intermNode) = context-&gt;addBranch(EOpBreak, (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 242:
</del><ins>+  case 265:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.addBranch(EOpReturn, (yylsp[(1) - (2)]));
-        if (context-&gt;currentFunctionType-&gt;getBasicType() != EbtVoid) {
-            context-&gt;error((yylsp[(1) - (2)]), &quot;non-void function must return a value&quot;, &quot;return&quot;);
-            context-&gt;recover();
-        }
</del><ins>+        (yyval.interm.intermNode) = context-&gt;addBranch(EOpReturn, (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 243:
</del><ins>+  case 266:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.addBranch(EOpReturn, (yyvsp[(2) - (3)].interm.intermTypedNode), (yylsp[(1) - (3)]));
-        context-&gt;functionReturnsValue = true;
-        if (context-&gt;currentFunctionType-&gt;getBasicType() == EbtVoid) {
-            context-&gt;error((yylsp[(1) - (3)]), &quot;void function cannot return a value&quot;, &quot;return&quot;);
-            context-&gt;recover();
-        } else if (*(context-&gt;currentFunctionType) != (yyvsp[(2) - (3)].interm.intermTypedNode)-&gt;getType()) {
-            context-&gt;error((yylsp[(1) - (3)]), &quot;function return is not matching type:&quot;, &quot;return&quot;);
-            context-&gt;recover();
-        }
</del><ins>+        (yyval.interm.intermNode) = context-&gt;addBranch(EOpReturn, (yyvsp[-1].interm.intermTypedNode), (yylsp[-2]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 244:
</del><ins>+  case 267:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        FRAG_ONLY(&quot;discard&quot;, (yylsp[(1) - (2)]));
-        (yyval.interm.intermNode) = context-&gt;intermediate.addBranch(EOpKill, (yylsp[(1) - (2)]));
</del><ins>+        FRAG_ONLY(&quot;discard&quot;, (yylsp[-1]));
+        (yyval.interm.intermNode) = context-&gt;addBranch(EOpKill, (yylsp[-1]));
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 245:
</del><ins>+  case 268:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</del><ins>+        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
</ins><span class="cx">         context-&gt;treeRoot = (yyval.interm.intermNode);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 246:
</del><ins>+  case 269:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.growAggregate((yyvsp[(1) - (2)].interm.intermNode), (yyvsp[(2) - (2)].interm.intermNode), (yyloc));
</del><ins>+        (yyval.interm.intermNode) = context-&gt;intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode), (yyloc));
</ins><span class="cx">         context-&gt;treeRoot = (yyval.interm.intermNode);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 247:
</del><ins>+  case 270:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</del><ins>+        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 248:
</del><ins>+  case 271:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        (yyval.interm.intermNode) = (yyvsp[(1) - (1)].interm.intermNode);
</del><ins>+        (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 249:
</del><ins>+  case 272:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><del>-        TFunction* function = (yyvsp[(1) - (1)].interm).function;
</del><ins>+        TFunction* function = (yyvsp[0].interm).function;
</ins><span class="cx">         
</span><span class="cx">         const TSymbol *builtIn = context-&gt;symbolTable.findBuiltIn(function-&gt;getMangledName(), context-&gt;shaderVersion);
</span><span class="cx">         
</span><span class="cx">         if (builtIn)
</span><span class="cx">         {
</span><del>-            context-&gt;error((yylsp[(1) - (1)]), &quot;built-in functions cannot be redefined&quot;, function-&gt;getName().c_str());
</del><ins>+            context-&gt;error((yylsp[0]), &quot;built-in functions cannot be redefined&quot;, function-&gt;getName().c_str());
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="lines">@@ -4923,21 +4899,27 @@
</span><span class="cx">             //
</span><span class="cx">             // Then this function already has a body.
</span><span class="cx">             //
</span><del>-            context-&gt;error((yylsp[(1) - (1)]), &quot;function already has a body&quot;, function-&gt;getName().c_str());
</del><ins>+            context-&gt;error((yylsp[0]), &quot;function already has a body&quot;, function-&gt;getName().c_str());
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         prevDec-&gt;setDefined();
</span><ins>+        //
+        // Overload the unique ID of the definition to be the same unique ID as the declaration.
+        // Eventually we will probably want to have only a single definition and just swap the
+        // arguments to be the definition's arguments.
+        //
+        function-&gt;setUniqueId(prevDec-&gt;getUniqueId());
</ins><span class="cx"> 
</span><span class="cx">         //
</span><span class="cx">         // Raise error message if main function takes any parameters or return anything other than void
</span><span class="cx">         //
</span><span class="cx">         if (function-&gt;getName() == &quot;main&quot;) {
</span><span class="cx">             if (function-&gt;getParamCount() &gt; 0) {
</span><del>-                context-&gt;error((yylsp[(1) - (1)]), &quot;function cannot take any parameter(s)&quot;, function-&gt;getName().c_str());
</del><ins>+                context-&gt;error((yylsp[0]), &quot;function cannot take any parameter(s)&quot;, function-&gt;getName().c_str());
</ins><span class="cx">                 context-&gt;recover();
</span><span class="cx">             }
</span><span class="cx">             if (function-&gt;getReturnType().getBasicType() != EbtVoid) {
</span><del>-                context-&gt;error((yylsp[(1) - (1)]), &quot;&quot;, function-&gt;getReturnType().getBasicString(), &quot;main function cannot return a value&quot;);
</del><ins>+                context-&gt;error((yylsp[0]), &quot;&quot;, function-&gt;getReturnType().getBasicString(), &quot;main function cannot return a value&quot;);
</ins><span class="cx">                 context-&gt;recover();
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -4946,7 +4928,7 @@
</span><span class="cx">         // Remember the return type for later checking for RETURN statements.
</span><span class="cx">         //
</span><span class="cx">         context-&gt;currentFunctionType = &amp;(prevDec-&gt;getReturnType());
</span><del>-        context-&gt;functionReturnsValue = false;
</del><ins>+        context-&gt;mFunctionReturnsValue = false;
</ins><span class="cx"> 
</span><span class="cx">         //
</span><span class="cx">         // Insert parameters into the symbol table.
</span><span class="lines">@@ -4964,8 +4946,8 @@
</span><span class="cx">                 //
</span><span class="cx">                 // Insert the parameters with name in the symbol table.
</span><span class="cx">                 //
</span><del>-                if (! context-&gt;symbolTable.declare(*variable)) {
-                    context-&gt;error((yylsp[(1) - (1)]), &quot;redefinition&quot;, variable-&gt;getName().c_str());
</del><ins>+                if (! context-&gt;symbolTable.declare(variable)) {
+                    context-&gt;error((yylsp[0]), &quot;redefinition&quot;, variable-&gt;getName().c_str());
</ins><span class="cx">                     context-&gt;recover();
</span><span class="cx">                     delete variable;
</span><span class="cx">                 }
</span><span class="lines">@@ -4977,32 +4959,34 @@
</span><span class="cx">                                                paramNodes,
</span><span class="cx">                                                context-&gt;intermediate.addSymbol(variable-&gt;getUniqueId(),
</span><span class="cx">                                                                        variable-&gt;getName(),
</span><del>-                                                                       variable-&gt;getType(), (yylsp[(1) - (1)])),
-                                               (yylsp[(1) - (1)]));
</del><ins>+                                                                       variable-&gt;getType(), (yylsp[0])),
+                                               (yylsp[0]));
</ins><span class="cx">             } else {
</span><del>-                paramNodes = context-&gt;intermediate.growAggregate(paramNodes, context-&gt;intermediate.addSymbol(0, &quot;&quot;, *param.type, (yylsp[(1) - (1)])), (yylsp[(1) - (1)]));
</del><ins>+                paramNodes = context-&gt;intermediate.growAggregate(paramNodes, context-&gt;intermediate.addSymbol(0, &quot;&quot;, *param.type, (yylsp[0])), (yylsp[0]));
</ins><span class="cx">             }
</span><span class="cx">         }
</span><del>-        context-&gt;intermediate.setAggregateOperator(paramNodes, EOpParameters, (yylsp[(1) - (1)]));
-        (yyvsp[(1) - (1)].interm).intermAggregate = paramNodes;
-        context-&gt;loopNestingLevel = 0;
</del><ins>+        context-&gt;intermediate.setAggregateOperator(paramNodes, EOpParameters, (yylsp[0]));
+        (yyvsp[0].interm).intermAggregate = paramNodes;
+        context-&gt;mLoopNestingLevel = 0;
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><del>-  case 250:
</del><ins>+  case 273:
</ins><span class="cx"> 
</span><span class="cx">     {
</span><span class="cx">         //?? Check that all paths return a value if return type != void ?
</span><span class="cx">         //   May be best done as post process phase on intermediate code
</span><del>-        if (context-&gt;currentFunctionType-&gt;getBasicType() != EbtVoid &amp;&amp; ! context-&gt;functionReturnsValue) {
-            context-&gt;error((yylsp[(1) - (3)]), &quot;function does not return a value:&quot;, &quot;&quot;, (yyvsp[(1) - (3)].interm).function-&gt;getName().c_str());
</del><ins>+        if (context-&gt;currentFunctionType-&gt;getBasicType() != EbtVoid &amp;&amp; ! context-&gt;mFunctionReturnsValue) {
+            context-&gt;error((yylsp[-2]), &quot;function does not return a value:&quot;, &quot;&quot;, (yyvsp[-2].interm).function-&gt;getName().c_str());
</ins><span class="cx">             context-&gt;recover();
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        (yyval.interm.intermNode) = context-&gt;intermediate.growAggregate((yyvsp[(1) - (3)].interm).intermAggregate, (yyvsp[(3) - (3)].interm.intermNode), (yyloc));
-        context-&gt;intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yylsp[(1) - (3)]));
-        (yyval.interm.intermNode)-&gt;getAsAggregate()-&gt;setName((yyvsp[(1) - (3)].interm).function-&gt;getMangledName().c_str());
-        (yyval.interm.intermNode)-&gt;getAsAggregate()-&gt;setType((yyvsp[(1) - (3)].interm).function-&gt;getReturnType());
</del><ins>+        (yyval.interm.intermNode) = context-&gt;intermediate.growAggregate((yyvsp[-2].interm).intermAggregate, (yyvsp[0].interm.intermNode), (yyloc));
+        context-&gt;intermediate.setAggregateOperator((yyval.interm.intermNode), EOpFunction, (yylsp[-2]));
+        (yyval.interm.intermNode)-&gt;getAsAggregate()-&gt;setName((yyvsp[-2].interm).function-&gt;getMangledName().c_str());
+        (yyval.interm.intermNode)-&gt;getAsAggregate()-&gt;setType((yyvsp[-2].interm).function-&gt;getReturnType());
+        (yyval.interm.intermNode)-&gt;getAsAggregate()-&gt;setFunctionId((yyvsp[-2].interm).function-&gt;getUniqueId());
</ins><span class="cx"> 
</span><span class="cx">         // store the pragma information for debug and optimize and other vendor specific
</span><span class="cx">         // information. This information can be queried from the parse tree
</span><span class="lines">@@ -5011,6 +4995,7 @@
</span><span class="cx"> 
</span><span class="cx">         context-&gt;symbolTable.pop();
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     break;
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -5037,7 +5022,7 @@
</span><span class="cx">   *++yyvsp = yyval;
</span><span class="cx">   *++yylsp = yyloc;
</span><span class="cx"> 
</span><del>-  /* Now `shift' the result of the reduction.  Determine what state
</del><ins>+  /* Now 'shift' the result of the reduction.  Determine what state
</ins><span class="cx">      that goes to, based on the state we popped back to and the rule
</span><span class="cx">      number reduced by.  */
</span><span class="cx"> 
</span><span class="lines">@@ -5052,9 +5037,9 @@
</span><span class="cx">   goto yynewstate;
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
</del><ins>+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
</ins><span class="cx"> yyerrlab:
</span><span class="cx">   /* Make sure we have latest lookahead translation.  See comments at
</span><span class="cx">      user semantic actions for why this is necessary.  */
</span><span class="lines">@@ -5065,7 +5050,7 @@
</span><span class="cx">     {
</span><span class="cx">       ++yynerrs;
</span><span class="cx"> #if ! YYERROR_VERBOSE
</span><del>-      yyerror (&amp;yylloc, context, YY_(&quot;syntax error&quot;));
</del><ins>+      yyerror (&amp;yylloc, context, scanner, YY_(&quot;syntax error&quot;));
</ins><span class="cx"> #else
</span><span class="cx"> # define YYSYNTAX_ERROR yysyntax_error (&amp;yymsg_alloc, &amp;yymsg, \
</span><span class="cx">                                         yyssp, yytoken)
</span><span class="lines">@@ -5092,7 +5077,7 @@
</span><span class="cx">                 yymsgp = yymsg;
</span><span class="cx">               }
</span><span class="cx">           }
</span><del>-        yyerror (&amp;yylloc, context, yymsgp);
</del><ins>+        yyerror (&amp;yylloc, context, scanner, yymsgp);
</ins><span class="cx">         if (yysyntax_error_status == 2)
</span><span class="cx">           goto yyexhaustedlab;
</span><span class="cx">       }
</span><span class="lines">@@ -5105,20 +5090,20 @@
</span><span class="cx">   if (yyerrstatus == 3)
</span><span class="cx">     {
</span><span class="cx">       /* If just tried and failed to reuse lookahead token after an
</span><del>-         error, discard it.  */
</del><ins>+         error, discard it.  */
</ins><span class="cx"> 
</span><span class="cx">       if (yychar &lt;= YYEOF)
</span><del>-        {
-          /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
-            YYABORT;
-        }
</del><ins>+        {
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
+        }
</ins><span class="cx">       else
</span><del>-        {
-          yydestruct (&quot;Error: discarding&quot;,
-                      yytoken, &amp;yylval, &amp;yylloc, context);
-          yychar = YYEMPTY;
-        }
</del><ins>+        {
+          yydestruct (&quot;Error: discarding&quot;,
+                      yytoken, &amp;yylval, &amp;yylloc, context, scanner);
+          yychar = YYEMPTY;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">   /* Else will try to reuse lookahead token after shifting the error
</span><span class="lines">@@ -5138,7 +5123,7 @@
</span><span class="cx">      goto yyerrorlab;
</span><span class="cx"> 
</span><span class="cx">   yyerror_range[1] = yylsp[1-yylen];
</span><del>-  /* Do not reclaim the symbols of the rule which action triggered
</del><ins>+  /* Do not reclaim the symbols of the rule whose action triggered
</ins><span class="cx">      this YYERROR.  */
</span><span class="cx">   YYPOPSTACK (yylen);
</span><span class="cx">   yylen = 0;
</span><span class="lines">@@ -5151,29 +5136,29 @@
</span><span class="cx"> | yyerrlab1 -- common code for both syntax error and YYERROR.  |
</span><span class="cx"> `-------------------------------------------------------------*/
</span><span class="cx"> yyerrlab1:
</span><del>-  yyerrstatus = 3;        /* Each real token shifted decrements this.  */
</del><ins>+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
</ins><span class="cx"> 
</span><span class="cx">   for (;;)
</span><span class="cx">     {
</span><span class="cx">       yyn = yypact[yystate];
</span><span class="cx">       if (!yypact_value_is_default (yyn))
</span><del>-        {
-          yyn += YYTERROR;
-          if (0 &lt;= yyn &amp;&amp; yyn &lt;= YYLAST &amp;&amp; yycheck[yyn] == YYTERROR)
-            {
-              yyn = yytable[yyn];
-              if (0 &lt; yyn)
-                break;
-            }
-        }
</del><ins>+        {
+          yyn += YYTERROR;
+          if (0 &lt;= yyn &amp;&amp; yyn &lt;= YYLAST &amp;&amp; yycheck[yyn] == YYTERROR)
+            {
+              yyn = yytable[yyn];
+              if (0 &lt; yyn)
+                break;
+            }
+        }
</ins><span class="cx"> 
</span><span class="cx">       /* Pop the current state because it cannot handle the error token.  */
</span><span class="cx">       if (yyssp == yyss)
</span><del>-        YYABORT;
</del><ins>+        YYABORT;
</ins><span class="cx"> 
</span><span class="cx">       yyerror_range[1] = *yylsp;
</span><span class="cx">       yydestruct (&quot;Error: popping&quot;,
</span><del>-                  yystos[yystate], yyvsp, yylsp, context);
</del><ins>+                  yystos[yystate], yyvsp, yylsp, context, scanner);
</ins><span class="cx">       YYPOPSTACK (1);
</span><span class="cx">       yystate = *yyssp;
</span><span class="cx">       YY_STACK_PRINT (yyss, yyssp);
</span><span class="lines">@@ -5215,7 +5200,7 @@
</span><span class="cx"> | yyexhaustedlab -- memory exhaustion comes here.  |
</span><span class="cx"> `-------------------------------------------------*/
</span><span class="cx"> yyexhaustedlab:
</span><del>-  yyerror (&amp;yylloc, context, YY_(&quot;memory exhausted&quot;));
</del><ins>+  yyerror (&amp;yylloc, context, scanner, YY_(&quot;memory exhausted&quot;));
</ins><span class="cx">   yyresult = 2;
</span><span class="cx">   /* Fall through.  */
</span><span class="cx"> #endif
</span><span class="lines">@@ -5227,16 +5212,16 @@
</span><span class="cx">          user semantic actions for why this is necessary.  */
</span><span class="cx">       yytoken = YYTRANSLATE (yychar);
</span><span class="cx">       yydestruct (&quot;Cleanup: discarding lookahead&quot;,
</span><del>-                  yytoken, &amp;yylval, &amp;yylloc, context);
</del><ins>+                  yytoken, &amp;yylval, &amp;yylloc, context, scanner);
</ins><span class="cx">     }
</span><del>-  /* Do not reclaim the symbols of the rule which action triggered
</del><ins>+  /* Do not reclaim the symbols of the rule whose action triggered
</ins><span class="cx">      this YYABORT or YYACCEPT.  */
</span><span class="cx">   YYPOPSTACK (yylen);
</span><span class="cx">   YY_STACK_PRINT (yyss, yyssp);
</span><span class="cx">   while (yyssp != yyss)
</span><span class="cx">     {
</span><span class="cx">       yydestruct (&quot;Cleanup: popping&quot;,
</span><del>-                  yystos[*yyssp], yyvsp, yylsp, context);
</del><ins>+                  yystos[*yyssp], yyvsp, yylsp, context, scanner);
</ins><span class="cx">       YYPOPSTACK (1);
</span><span class="cx">     }
</span><span class="cx"> #ifndef yyoverflow
</span><span class="lines">@@ -5247,14 +5232,11 @@
</span><span class="cx">   if (yymsg != yymsgbuf)
</span><span class="cx">     YYSTACK_FREE (yymsg);
</span><span class="cx"> #endif
</span><del>-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
</del><ins>+  return yyresult;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-
</del><span class="cx"> int glslang_parse(TParseContext* context) {
</span><del>-    return yyparse(context);
</del><ins>+    return yyparse(context, context-&gt;scanner);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorglslang_tabh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,21 +1,19 @@
</span><del>-/* A Bison parser, made by GNU Bison 2.7.1.  */
</del><ins>+/* A Bison parser, made by GNU Bison 3.0.4.  */
</ins><span class="cx"> 
</span><del>-/* Apple Note: For the avoidance of doubt, Apple elects to distribute this file under the terms of the BSD license. */
-
</del><span class="cx"> /* Bison interface for Yacc-like parsers in C
</span><del>-   
-      Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-   
</del><ins>+
+   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+
</ins><span class="cx">    This program is free software: you can redistribute it and/or modify
</span><span class="cx">    it under the terms of the GNU General Public License as published by
</span><span class="cx">    the Free Software Foundation, either version 3 of the License, or
</span><span class="cx">    (at your option) any later version.
</span><del>-   
</del><ins>+
</ins><span class="cx">    This program is distributed in the hope that it will be useful,
</span><span class="cx">    but WITHOUT ANY WARRANTY; without even the implied warranty of
</span><span class="cx">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
</span><span class="cx">    GNU General Public License for more details.
</span><del>-   
</del><ins>+
</ins><span class="cx">    You should have received a copy of the GNU General Public License
</span><span class="cx">    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.  */
</span><span class="cx"> 
</span><span class="lines">@@ -28,13 +26,13 @@
</span><span class="cx">    special exception, which will cause the skeleton and the resulting
</span><span class="cx">    Bison output files to be licensed under the GNU General Public
</span><span class="cx">    License without this special exception.
</span><del>-   
</del><ins>+
</ins><span class="cx">    This special exception was added by the Free Software Foundation in
</span><span class="cx">    version 2.2 of Bison.  */
</span><span class="cx"> 
</span><span class="cx"> #ifndef YY_YY_GLSLANG_TAB_H_INCLUDED
</span><span class="cx"> # define YY_YY_GLSLANG_TAB_H_INCLUDED
</span><del>-/* Enabling traces.  */
</del><ins>+/* Debug traces.  */
</ins><span class="cx"> #ifndef YYDEBUG
</span><span class="cx"> # define YYDEBUG 0
</span><span class="cx"> #endif
</span><span class="lines">@@ -49,144 +47,143 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-
-/* Tokens.  */
</del><ins>+/* Token type.  */
</ins><span class="cx"> #ifndef YYTOKENTYPE
</span><span class="cx"> # define YYTOKENTYPE
</span><del>-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     INVARIANT = 258,
-     HIGH_PRECISION = 259,
-     MEDIUM_PRECISION = 260,
-     LOW_PRECISION = 261,
-     PRECISION = 262,
-     ATTRIBUTE = 263,
-     CONST_QUAL = 264,
-     BOOL_TYPE = 265,
-     FLOAT_TYPE = 266,
-     INT_TYPE = 267,
-     UINT_TYPE = 268,
-     BREAK = 269,
-     CONTINUE = 270,
-     DO = 271,
-     ELSE = 272,
-     FOR = 273,
-     IF = 274,
-     DISCARD = 275,
-     RETURN = 276,
-     SWITCH = 277,
-     CASE = 278,
-     DEFAULT = 279,
-     BVEC2 = 280,
-     BVEC3 = 281,
-     BVEC4 = 282,
-     IVEC2 = 283,
-     IVEC3 = 284,
-     IVEC4 = 285,
-     VEC2 = 286,
-     VEC3 = 287,
-     VEC4 = 288,
-     UVEC2 = 289,
-     UVEC3 = 290,
-     UVEC4 = 291,
-     MATRIX2 = 292,
-     MATRIX3 = 293,
-     MATRIX4 = 294,
-     IN_QUAL = 295,
-     OUT_QUAL = 296,
-     INOUT_QUAL = 297,
-     UNIFORM = 298,
-     VARYING = 299,
-     MATRIX2x3 = 300,
-     MATRIX3x2 = 301,
-     MATRIX2x4 = 302,
-     MATRIX4x2 = 303,
-     MATRIX3x4 = 304,
-     MATRIX4x3 = 305,
-     CENTROID = 306,
-     FLAT = 307,
-     SMOOTH = 308,
-     STRUCT = 309,
-     VOID_TYPE = 310,
-     WHILE = 311,
-     SAMPLER2D = 312,
-     SAMPLERCUBE = 313,
-     SAMPLER_EXTERNAL_OES = 314,
-     SAMPLER2DRECT = 315,
-     SAMPLER2DARRAY = 316,
-     ISAMPLER2D = 317,
-     ISAMPLER3D = 318,
-     ISAMPLERCUBE = 319,
-     ISAMPLER2DARRAY = 320,
-     USAMPLER2D = 321,
-     USAMPLER3D = 322,
-     USAMPLERCUBE = 323,
-     USAMPLER2DARRAY = 324,
-     SAMPLER3D = 325,
-     SAMPLER3DRECT = 326,
-     SAMPLER2DSHADOW = 327,
-     SAMPLERCUBESHADOW = 328,
-     SAMPLER2DARRAYSHADOW = 329,
-     LAYOUT = 330,
-     IDENTIFIER = 331,
-     TYPE_NAME = 332,
-     FLOATCONSTANT = 333,
-     INTCONSTANT = 334,
-     UINTCONSTANT = 335,
-     BOOLCONSTANT = 336,
-     FIELD_SELECTION = 337,
-     LEFT_OP = 338,
-     RIGHT_OP = 339,
-     INC_OP = 340,
-     DEC_OP = 341,
-     LE_OP = 342,
-     GE_OP = 343,
-     EQ_OP = 344,
-     NE_OP = 345,
-     AND_OP = 346,
-     OR_OP = 347,
-     XOR_OP = 348,
-     MUL_ASSIGN = 349,
-     DIV_ASSIGN = 350,
-     ADD_ASSIGN = 351,
-     MOD_ASSIGN = 352,
-     LEFT_ASSIGN = 353,
-     RIGHT_ASSIGN = 354,
-     AND_ASSIGN = 355,
-     XOR_ASSIGN = 356,
-     OR_ASSIGN = 357,
-     SUB_ASSIGN = 358,
-     LEFT_PAREN = 359,
-     RIGHT_PAREN = 360,
-     LEFT_BRACKET = 361,
-     RIGHT_BRACKET = 362,
-     LEFT_BRACE = 363,
-     RIGHT_BRACE = 364,
-     DOT = 365,
-     COMMA = 366,
-     COLON = 367,
-     EQUAL = 368,
-     SEMICOLON = 369,
-     BANG = 370,
-     DASH = 371,
-     TILDE = 372,
-     PLUS = 373,
-     STAR = 374,
-     SLASH = 375,
-     PERCENT = 376,
-     LEFT_ANGLE = 377,
-     RIGHT_ANGLE = 378,
-     VERTICAL_BAR = 379,
-     CARET = 380,
-     AMPERSAND = 381,
-     QUESTION = 382
-   };
</del><ins>+  enum yytokentype
+  {
+    INVARIANT = 258,
+    HIGH_PRECISION = 259,
+    MEDIUM_PRECISION = 260,
+    LOW_PRECISION = 261,
+    PRECISION = 262,
+    ATTRIBUTE = 263,
+    CONST_QUAL = 264,
+    BOOL_TYPE = 265,
+    FLOAT_TYPE = 266,
+    INT_TYPE = 267,
+    UINT_TYPE = 268,
+    BREAK = 269,
+    CONTINUE = 270,
+    DO = 271,
+    ELSE = 272,
+    FOR = 273,
+    IF = 274,
+    DISCARD = 275,
+    RETURN = 276,
+    SWITCH = 277,
+    CASE = 278,
+    DEFAULT = 279,
+    BVEC2 = 280,
+    BVEC3 = 281,
+    BVEC4 = 282,
+    IVEC2 = 283,
+    IVEC3 = 284,
+    IVEC4 = 285,
+    VEC2 = 286,
+    VEC3 = 287,
+    VEC4 = 288,
+    UVEC2 = 289,
+    UVEC3 = 290,
+    UVEC4 = 291,
+    MATRIX2 = 292,
+    MATRIX3 = 293,
+    MATRIX4 = 294,
+    IN_QUAL = 295,
+    OUT_QUAL = 296,
+    INOUT_QUAL = 297,
+    UNIFORM = 298,
+    VARYING = 299,
+    MATRIX2x3 = 300,
+    MATRIX3x2 = 301,
+    MATRIX2x4 = 302,
+    MATRIX4x2 = 303,
+    MATRIX3x4 = 304,
+    MATRIX4x3 = 305,
+    CENTROID = 306,
+    FLAT = 307,
+    SMOOTH = 308,
+    STRUCT = 309,
+    VOID_TYPE = 310,
+    WHILE = 311,
+    SAMPLER2D = 312,
+    SAMPLERCUBE = 313,
+    SAMPLER_EXTERNAL_OES = 314,
+    SAMPLER2DRECT = 315,
+    SAMPLER2DARRAY = 316,
+    ISAMPLER2D = 317,
+    ISAMPLER3D = 318,
+    ISAMPLERCUBE = 319,
+    ISAMPLER2DARRAY = 320,
+    USAMPLER2D = 321,
+    USAMPLER3D = 322,
+    USAMPLERCUBE = 323,
+    USAMPLER2DARRAY = 324,
+    SAMPLER3D = 325,
+    SAMPLER3DRECT = 326,
+    SAMPLER2DSHADOW = 327,
+    SAMPLERCUBESHADOW = 328,
+    SAMPLER2DARRAYSHADOW = 329,
+    LAYOUT = 330,
+    IDENTIFIER = 331,
+    TYPE_NAME = 332,
+    FLOATCONSTANT = 333,
+    INTCONSTANT = 334,
+    UINTCONSTANT = 335,
+    BOOLCONSTANT = 336,
+    FIELD_SELECTION = 337,
+    LEFT_OP = 338,
+    RIGHT_OP = 339,
+    INC_OP = 340,
+    DEC_OP = 341,
+    LE_OP = 342,
+    GE_OP = 343,
+    EQ_OP = 344,
+    NE_OP = 345,
+    AND_OP = 346,
+    OR_OP = 347,
+    XOR_OP = 348,
+    MUL_ASSIGN = 349,
+    DIV_ASSIGN = 350,
+    ADD_ASSIGN = 351,
+    MOD_ASSIGN = 352,
+    LEFT_ASSIGN = 353,
+    RIGHT_ASSIGN = 354,
+    AND_ASSIGN = 355,
+    XOR_ASSIGN = 356,
+    OR_ASSIGN = 357,
+    SUB_ASSIGN = 358,
+    LEFT_PAREN = 359,
+    RIGHT_PAREN = 360,
+    LEFT_BRACKET = 361,
+    RIGHT_BRACKET = 362,
+    LEFT_BRACE = 363,
+    RIGHT_BRACE = 364,
+    DOT = 365,
+    COMMA = 366,
+    COLON = 367,
+    EQUAL = 368,
+    SEMICOLON = 369,
+    BANG = 370,
+    DASH = 371,
+    TILDE = 372,
+    PLUS = 373,
+    STAR = 374,
+    SLASH = 375,
+    PERCENT = 376,
+    LEFT_ANGLE = 377,
+    RIGHT_ANGLE = 378,
+    VERTICAL_BAR = 379,
+    CARET = 380,
+    AMPERSAND = 381,
+    QUESTION = 382
+  };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-
</del><ins>+/* Value type.  */
</ins><span class="cx"> #if ! defined YYSTYPE &amp;&amp; ! defined YYSTYPE_IS_DECLARED
</span><del>-typedef union YYSTYPE
</del><ins>+
+union YYSTYPE
</ins><span class="cx"> {
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -207,6 +204,8 @@
</span><span class="cx">             TIntermNodePair nodePair;
</span><span class="cx">             TIntermTyped* intermTypedNode;
</span><span class="cx">             TIntermAggregate* intermAggregate;
</span><ins>+            TIntermSwitch* intermSwitch;
+            TIntermCase* intermCase;
</ins><span class="cx">         };
</span><span class="cx">         union {
</span><span class="cx">             TPublicType type;
</span><span class="lines">@@ -221,39 +220,29 @@
</span><span class="cx">     } interm;
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+};
</ins><span class="cx"> 
</span><del>-} YYSTYPE;
</del><ins>+typedef union YYSTYPE YYSTYPE;
</ins><span class="cx"> # define YYSTYPE_IS_TRIVIAL 1
</span><del>-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
</del><span class="cx"> # define YYSTYPE_IS_DECLARED 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+/* Location type.  */
</ins><span class="cx"> #if ! defined YYLTYPE &amp;&amp; ! defined YYLTYPE_IS_DECLARED
</span><del>-typedef struct YYLTYPE
</del><ins>+typedef struct YYLTYPE YYLTYPE;
+struct YYLTYPE
</ins><span class="cx"> {
</span><span class="cx">   int first_line;
</span><span class="cx">   int first_column;
</span><span class="cx">   int last_line;
</span><span class="cx">   int last_column;
</span><del>-} YYLTYPE;
-# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
</del><ins>+};
</ins><span class="cx"> # define YYLTYPE_IS_DECLARED 1
</span><span class="cx"> # define YYLTYPE_IS_TRIVIAL 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (TParseContext* context);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
</del><span class="cx"> 
</span><ins>+int yyparse (TParseContext* context, void *scanner);
+
</ins><span class="cx"> #endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED  */
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorintermOutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermOut.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,12 +1,15 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#include &quot;compiler/translator/localintermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/intermediate.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/SymbolTable.h&quot;
</span><span class="cx"> 
</span><ins>+namespace
+{
+
</ins><span class="cx"> //
</span><span class="cx"> // Two purposes:
</span><span class="cx"> // 1.  Show an example of how to iterate tree.  Functions can
</span><span class="lines">@@ -20,28 +23,48 @@
</span><span class="cx"> // Use this class to carry along data from node to node in
</span><span class="cx"> // the traversal
</span><span class="cx"> //
</span><del>-class TOutputTraverser : public TIntermTraverser {
-public:
-    TOutputTraverser(TInfoSinkBase&amp; i) : sink(i) { }
</del><ins>+class TOutputTraverser : public TIntermTraverser
+{
+  public:
+    TOutputTraverser(TInfoSinkBase &amp;i)
+        : sink(i) { }
</ins><span class="cx">     TInfoSinkBase&amp; sink;
</span><span class="cx"> 
</span><del>-protected:
-    void visitSymbol(TIntermSymbol*);
-    void visitConstantUnion(TIntermConstantUnion*);
-    bool visitBinary(Visit visit, TIntermBinary*);
-    bool visitUnary(Visit visit, TIntermUnary*);
-    bool visitSelection(Visit visit, TIntermSelection*);
-    bool visitAggregate(Visit visit, TIntermAggregate*);
-    bool visitLoop(Visit visit, TIntermLoop*);
-    bool visitBranch(Visit visit, TIntermBranch*);
</del><ins>+  protected:
+    void visitSymbol(TIntermSymbol *);
+    void visitConstantUnion(TIntermConstantUnion *);
+    bool visitBinary(Visit visit, TIntermBinary *);
+    bool visitUnary(Visit visit, TIntermUnary *);
+    bool visitSelection(Visit visit, TIntermSelection *);
+    bool visitAggregate(Visit visit, TIntermAggregate *);
+    bool visitLoop(Visit visit, TIntermLoop *);
+    bool visitBranch(Visit visit, TIntermBranch *);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><ins>+//
+// Helper functions for printing, not part of traversing.
+//
+void OutputTreeText(TInfoSinkBase &amp;sink, TIntermNode *node, const int depth)
+{
+    int i;
+
+    sink.location(node-&gt;getLine());
+
+    for (i = 0; i &lt; depth; ++i)
+        sink &lt;&lt; &quot;  &quot;;
+}
+
+}  // namespace anonymous
+
+
</ins><span class="cx"> TString TType::getCompleteString() const
</span><span class="cx"> {
</span><span class="cx">     TStringStream stream;
</span><span class="cx"> 
</span><span class="cx">     if (qualifier != EvqTemporary &amp;&amp; qualifier != EvqGlobal)
</span><del>-        stream &lt;&lt; getQualifierString() &lt;&lt; &quot; &quot; &lt;&lt; getPrecisionString() &lt;&lt; &quot; &quot;;
</del><ins>+        stream &lt;&lt; getQualifierString() &lt;&lt; &quot; &quot;;
+    if (precision != EbpUndefined)
+        stream &lt;&lt; getPrecisionString() &lt;&lt; &quot; &quot;;
</ins><span class="cx">     if (array)
</span><span class="cx">         stream &lt;&lt; &quot;array[&quot; &lt;&lt; getArraySize() &lt;&lt; &quot;] of &quot;;
</span><span class="cx">     if (isMatrix())
</span><span class="lines">@@ -54,20 +77,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> //
</span><del>-// Helper functions for printing, not part of traversing.
-//
-
-void OutputTreeText(TInfoSinkBase&amp; sink, TIntermNode* node, const int depth)
-{
-    int i;
-
-    sink.location(node-&gt;getLine());
-
-    for (i = 0; i &lt; depth; ++i)
-        sink &lt;&lt; &quot;  &quot;;
-}
-
-//
</del><span class="cx"> // The rest of the file are the traversal functions.  The last one
</span><span class="cx"> // is the one that starts the traversal.
</span><span class="cx"> //
</span><span class="lines">@@ -76,129 +85,285 @@
</span><span class="cx"> // return false.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-void TOutputTraverser::visitSymbol(TIntermSymbol* node)
</del><ins>+void TOutputTraverser::visitSymbol(TIntermSymbol *node)
</ins><span class="cx"> {
</span><del>-    OutputTreeText(sink, node, depth);
</del><ins>+    OutputTreeText(sink, node, mDepth);
</ins><span class="cx"> 
</span><span class="cx">     sink &lt;&lt; &quot;'&quot; &lt;&lt; node-&gt;getSymbol() &lt;&lt; &quot;' &quot;;
</span><span class="cx">     sink &lt;&lt; &quot;(&quot; &lt;&lt; node-&gt;getCompleteString() &lt;&lt; &quot;)\n&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
</del><ins>+bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node)
</ins><span class="cx"> {
</span><span class="cx">     TInfoSinkBase&amp; out = sink;
</span><span class="cx"> 
</span><del>-    OutputTreeText(out, node, depth);
</del><ins>+    OutputTreeText(out, node, mDepth);
</ins><span class="cx"> 
</span><del>-    switch (node-&gt;getOp()) {
-        case EOpAssign:                   out &lt;&lt; &quot;move second child to first child&quot;;           break;
-        case EOpInitialize:               out &lt;&lt; &quot;initialize first child with second child&quot;;   break;
-        case EOpAddAssign:                out &lt;&lt; &quot;add second child into first child&quot;;          break;
-        case EOpSubAssign:                out &lt;&lt; &quot;subtract second child into first child&quot;;     break;
-        case EOpMulAssign:                out &lt;&lt; &quot;multiply second child into first child&quot;;     break;
-        case EOpVectorTimesMatrixAssign:  out &lt;&lt; &quot;matrix mult second child into first child&quot;;  break;
-        case EOpVectorTimesScalarAssign:  out &lt;&lt; &quot;vector scale second child into first child&quot;; break;
-        case EOpMatrixTimesScalarAssign:  out &lt;&lt; &quot;matrix scale second child into first child&quot;; break;
-        case EOpMatrixTimesMatrixAssign:  out &lt;&lt; &quot;matrix mult second child into first child&quot;; break;
-        case EOpDivAssign:                out &lt;&lt; &quot;divide second child into first child&quot;;       break;
-        case EOpIndexDirect:   out &lt;&lt; &quot;direct index&quot;;   break;
-        case EOpIndexIndirect: out &lt;&lt; &quot;indirect index&quot;; break;
-        case EOpIndexDirectStruct:   out &lt;&lt; &quot;direct index for structure&quot;;   break;
-        case EOpIndexDirectInterfaceBlock: out &lt;&lt; &quot;direct index for interface block&quot;; break;
-        case EOpVectorSwizzle: out &lt;&lt; &quot;vector swizzle&quot;; break;
</del><ins>+    switch (node-&gt;getOp())
+    {
+      case EOpAssign:
+        out &lt;&lt; &quot;move second child to first child&quot;;
+        break;
+      case EOpInitialize:
+        out &lt;&lt; &quot;initialize first child with second child&quot;;
+        break;
+      case EOpAddAssign:
+        out &lt;&lt; &quot;add second child into first child&quot;;
+        break;
+      case EOpSubAssign:
+        out &lt;&lt; &quot;subtract second child into first child&quot;;
+        break;
+      case EOpMulAssign:
+        out &lt;&lt; &quot;multiply second child into first child&quot;;
+        break;
+      case EOpVectorTimesMatrixAssign:
+        out &lt;&lt; &quot;matrix mult second child into first child&quot;;
+        break;
+      case EOpVectorTimesScalarAssign:
+        out &lt;&lt; &quot;vector scale second child into first child&quot;;
+        break;
+      case EOpMatrixTimesScalarAssign:
+        out &lt;&lt; &quot;matrix scale second child into first child&quot;;
+        break;
+      case EOpMatrixTimesMatrixAssign:
+        out &lt;&lt; &quot;matrix mult second child into first child&quot;;
+        break;
+      case EOpDivAssign:
+        out &lt;&lt; &quot;divide second child into first child&quot;;
+        break;
+      case EOpIModAssign:
+        out &lt;&lt; &quot;modulo second child into first child&quot;;
+        break;
+      case EOpBitShiftLeftAssign:
+        out &lt;&lt; &quot;bit-wise shift first child left by second child&quot;;
+        break;
+      case EOpBitShiftRightAssign:
+        out &lt;&lt; &quot;bit-wise shift first child right by second child&quot;;
+        break;
+      case EOpBitwiseAndAssign:
+        out &lt;&lt; &quot;bit-wise and second child into first child&quot;;
+        break;
+      case EOpBitwiseXorAssign:
+        out &lt;&lt; &quot;bit-wise xor second child into first child&quot;;
+        break;
+      case EOpBitwiseOrAssign:
+        out &lt;&lt; &quot;bit-wise or second child into first child&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpAdd:    out &lt;&lt; &quot;add&quot;;                     break;
-        case EOpSub:    out &lt;&lt; &quot;subtract&quot;;                break;
-        case EOpMul:    out &lt;&lt; &quot;component-wise multiply&quot;; break;
-        case EOpDiv:    out &lt;&lt; &quot;divide&quot;;                  break;
-        case EOpEqual:            out &lt;&lt; &quot;Compare Equal&quot;;                 break;
-        case EOpNotEqual:         out &lt;&lt; &quot;Compare Not Equal&quot;;             break;
-        case EOpLessThan:         out &lt;&lt; &quot;Compare Less Than&quot;;             break;
-        case EOpGreaterThan:      out &lt;&lt; &quot;Compare Greater Than&quot;;          break;
-        case EOpLessThanEqual:    out &lt;&lt; &quot;Compare Less Than or Equal&quot;;    break;
-        case EOpGreaterThanEqual: out &lt;&lt; &quot;Compare Greater Than or Equal&quot;; break;
</del><ins>+      case EOpIndexDirect:
+        out &lt;&lt; &quot;direct index&quot;;
+        break;
+      case EOpIndexIndirect:
+        out &lt;&lt; &quot;indirect index&quot;;
+        break;
+      case EOpIndexDirectStruct:
+        out &lt;&lt; &quot;direct index for structure&quot;;
+        break;
+      case EOpIndexDirectInterfaceBlock:
+        out &lt;&lt; &quot;direct index for interface block&quot;;
+        break;
+      case EOpVectorSwizzle:
+        out &lt;&lt; &quot;vector swizzle&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpVectorTimesScalar: out &lt;&lt; &quot;vector-scale&quot;;          break;
-        case EOpVectorTimesMatrix: out &lt;&lt; &quot;vector-times-matrix&quot;;   break;
-        case EOpMatrixTimesVector: out &lt;&lt; &quot;matrix-times-vector&quot;;   break;
-        case EOpMatrixTimesScalar: out &lt;&lt; &quot;matrix-scale&quot;;          break;
-        case EOpMatrixTimesMatrix: out &lt;&lt; &quot;matrix-multiply&quot;;       break;
</del><ins>+      case EOpAdd:
+        out &lt;&lt; &quot;add&quot;;
+        break;
+      case EOpSub:
+        out &lt;&lt; &quot;subtract&quot;;
+        break;
+      case EOpMul:
+        out &lt;&lt; &quot;component-wise multiply&quot;;
+        break;
+      case EOpDiv:
+        out &lt;&lt; &quot;divide&quot;;
+        break;
+      case EOpIMod:
+        out &lt;&lt; &quot;modulo&quot;;
+        break;
+      case EOpBitShiftLeft:
+        out &lt;&lt; &quot;bit-wise shift left&quot;;
+        break;
+      case EOpBitShiftRight:
+        out &lt;&lt; &quot;bit-wise shift right&quot;;
+        break;
+      case EOpBitwiseAnd:
+        out &lt;&lt; &quot;bit-wise and&quot;;
+        break;
+      case EOpBitwiseXor:
+        out &lt;&lt; &quot;bit-wise xor&quot;;
+        break;
+      case EOpBitwiseOr:
+        out &lt;&lt; &quot;bit-wise or&quot;;
+        break;
</ins><span class="cx"> 
</span><del>-        case EOpLogicalOr:  out &lt;&lt; &quot;logical-or&quot;;   break;
-        case EOpLogicalXor: out &lt;&lt; &quot;logical-xor&quot;; break;
-        case EOpLogicalAnd: out &lt;&lt; &quot;logical-and&quot;; break;
-        default: out &lt;&lt; &quot;&lt;unknown op&gt;&quot;;
</del><ins>+      case EOpEqual:
+        out &lt;&lt; &quot;Compare Equal&quot;;
+        break;
+      case EOpNotEqual:
+        out &lt;&lt; &quot;Compare Not Equal&quot;;
+        break;
+      case EOpLessThan:
+        out &lt;&lt; &quot;Compare Less Than&quot;;
+        break;
+      case EOpGreaterThan:
+        out &lt;&lt; &quot;Compare Greater Than&quot;;
+        break;
+      case EOpLessThanEqual:
+        out &lt;&lt; &quot;Compare Less Than or Equal&quot;;
+        break;
+      case EOpGreaterThanEqual:
+        out &lt;&lt; &quot;Compare Greater Than or Equal&quot;;
+        break;
+
+      case EOpVectorTimesScalar:
+        out &lt;&lt; &quot;vector-scale&quot;;
+        break;
+      case EOpVectorTimesMatrix:
+        out &lt;&lt; &quot;vector-times-matrix&quot;;
+        break;
+      case EOpMatrixTimesVector:
+        out &lt;&lt; &quot;matrix-times-vector&quot;;
+        break;
+      case EOpMatrixTimesScalar:
+        out &lt;&lt; &quot;matrix-scale&quot;;
+        break;
+      case EOpMatrixTimesMatrix:
+        out &lt;&lt; &quot;matrix-multiply&quot;;
+        break;
+
+      case EOpLogicalOr:
+        out &lt;&lt; &quot;logical-or&quot;;
+        break;
+      case EOpLogicalXor:
+        out &lt;&lt; &quot;logical-xor&quot;;
+        break;
+      case EOpLogicalAnd:
+        out &lt;&lt; &quot;logical-and&quot;;
+        break;
+      default:
+        out &lt;&lt; &quot;&lt;unknown op&gt;&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     out &lt;&lt; &quot; (&quot; &lt;&lt; node-&gt;getCompleteString() &lt;&lt; &quot;)&quot;;
</span><span class="cx"> 
</span><span class="cx">     out &lt;&lt; &quot;\n&quot;;
</span><span class="cx"> 
</span><ins>+    // Special handling for direct indexes. Because constant
+    // unions are not aware they are struct indexes, treat them
+    // here where we have that contextual knowledge.
+    if (node-&gt;getOp() == EOpIndexDirectStruct ||
+        node-&gt;getOp() == EOpIndexDirectInterfaceBlock)
+    {
+        mDepth++;
+        node-&gt;getLeft()-&gt;traverse(this);
+        mDepth--;
+
+        TIntermConstantUnion *intermConstantUnion = node-&gt;getRight()-&gt;getAsConstantUnion();
+        ASSERT(intermConstantUnion);
+
+        OutputTreeText(out, intermConstantUnion, mDepth + 1);
+
+        // The following code finds the field name from the constant union
+        const TConstantUnion *constantUnion = intermConstantUnion-&gt;getUnionArrayPointer();
+        const TStructure *structure = node-&gt;getLeft()-&gt;getType().getStruct();
+        const TInterfaceBlock *interfaceBlock = node-&gt;getLeft()-&gt;getType().getInterfaceBlock();
+        ASSERT(structure || interfaceBlock);
+
+        const TFieldList &amp;fields = structure ? structure-&gt;fields() : interfaceBlock-&gt;fields();
+
+        const TField *field = fields[constantUnion-&gt;getIConst()];
+
+        out &lt;&lt; constantUnion-&gt;getIConst() &lt;&lt; &quot; (field '&quot; &lt;&lt; field-&gt;name() &lt;&lt; &quot;')&quot;;
+
+        return false;
+    }
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
</del><ins>+bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary *node)
</ins><span class="cx"> {
</span><span class="cx">     TInfoSinkBase&amp; out = sink;
</span><span class="cx"> 
</span><del>-    OutputTreeText(out, node, depth);
</del><ins>+    OutputTreeText(out, node, mDepth);
</ins><span class="cx"> 
</span><del>-    switch (node-&gt;getOp()) {
-        case EOpNegative:       out &lt;&lt; &quot;Negate value&quot;;         break;
-        case EOpVectorLogicalNot:
-        case EOpLogicalNot:     out &lt;&lt; &quot;Negate conditional&quot;;   break;
</del><ins>+    switch (node-&gt;getOp())
+    {
+      case EOpNegative:       out &lt;&lt; &quot;Negate value&quot;;         break;
+      case EOpPositive:       out &lt;&lt; &quot;Positive sign&quot;;        break;
+      case EOpVectorLogicalNot:
+      case EOpLogicalNot:     out &lt;&lt; &quot;Negate conditional&quot;;   break;
+      case EOpBitwiseNot:     out &lt;&lt; &quot;bit-wise not&quot;;         break;
</ins><span class="cx"> 
</span><del>-        case EOpPostIncrement:  out &lt;&lt; &quot;Post-Increment&quot;;       break;
-        case EOpPostDecrement:  out &lt;&lt; &quot;Post-Decrement&quot;;       break;
-        case EOpPreIncrement:   out &lt;&lt; &quot;Pre-Increment&quot;;        break;
-        case EOpPreDecrement:   out &lt;&lt; &quot;Pre-Decrement&quot;;        break;
</del><ins>+      case EOpPostIncrement:  out &lt;&lt; &quot;Post-Increment&quot;;       break;
+      case EOpPostDecrement:  out &lt;&lt; &quot;Post-Decrement&quot;;       break;
+      case EOpPreIncrement:   out &lt;&lt; &quot;Pre-Increment&quot;;        break;
+      case EOpPreDecrement:   out &lt;&lt; &quot;Pre-Decrement&quot;;        break;
</ins><span class="cx"> 
</span><del>-        case EOpConvIntToBool:  out &lt;&lt; &quot;Convert int to bool&quot;;  break;
-        case EOpConvUIntToBool: out &lt;&lt; &quot;Convert uint to bool&quot;; break;
-        case EOpConvFloatToBool:out &lt;&lt; &quot;Convert float to bool&quot;;break;
-        case EOpConvBoolToFloat:out &lt;&lt; &quot;Convert bool to float&quot;;break;
-        case EOpConvIntToFloat: out &lt;&lt; &quot;Convert int to float&quot;; break;
-        case EOpConvUIntToFloat:out &lt;&lt; &quot;Convert uint to float&quot;;break;
-        case EOpConvFloatToInt: out &lt;&lt; &quot;Convert float to int&quot;; break;
-        case EOpConvBoolToInt:  out &lt;&lt; &quot;Convert bool to int&quot;;  break;
-        case EOpConvIntToUInt:  out &lt;&lt; &quot;Convert int to uint&quot;;  break;
-        case EOpConvFloatToUInt:out &lt;&lt; &quot;Convert float to uint&quot;;break;
-        case EOpConvBoolToUInt: out &lt;&lt; &quot;Convert bool to uint&quot;; break;
</del><ins>+      case EOpRadians:        out &lt;&lt; &quot;radians&quot;;              break;
+      case EOpDegrees:        out &lt;&lt; &quot;degrees&quot;;              break;
+      case EOpSin:            out &lt;&lt; &quot;sine&quot;;                 break;
+      case EOpCos:            out &lt;&lt; &quot;cosine&quot;;               break;
+      case EOpTan:            out &lt;&lt; &quot;tangent&quot;;              break;
+      case EOpAsin:           out &lt;&lt; &quot;arc sine&quot;;             break;
+      case EOpAcos:           out &lt;&lt; &quot;arc cosine&quot;;           break;
+      case EOpAtan:           out &lt;&lt; &quot;arc tangent&quot;;          break;
</ins><span class="cx"> 
</span><del>-        case EOpRadians:        out &lt;&lt; &quot;radians&quot;;              break;
-        case EOpDegrees:        out &lt;&lt; &quot;degrees&quot;;              break;
-        case EOpSin:            out &lt;&lt; &quot;sine&quot;;                 break;
-        case EOpCos:            out &lt;&lt; &quot;cosine&quot;;               break;
-        case EOpTan:            out &lt;&lt; &quot;tangent&quot;;              break;
-        case EOpAsin:           out &lt;&lt; &quot;arc sine&quot;;             break;
-        case EOpAcos:           out &lt;&lt; &quot;arc cosine&quot;;           break;
-        case EOpAtan:           out &lt;&lt; &quot;arc tangent&quot;;          break;
</del><ins>+      case EOpSinh:           out &lt;&lt; &quot;hyperbolic sine&quot;;      break;
+      case EOpCosh:           out &lt;&lt; &quot;hyperbolic cosine&quot;;    break;
+      case EOpTanh:           out &lt;&lt; &quot;hyperbolic tangent&quot;;   break;
+      case EOpAsinh:          out &lt;&lt; &quot;arc hyperbolic sine&quot;;  break;
+      case EOpAcosh:          out &lt;&lt; &quot;arc hyperbolic cosine&quot;; break;
+      case EOpAtanh:          out &lt;&lt; &quot;arc hyperbolic tangent&quot;; break;
</ins><span class="cx"> 
</span><del>-        case EOpExp:            out &lt;&lt; &quot;exp&quot;;                  break;
-        case EOpLog:            out &lt;&lt; &quot;log&quot;;                  break;
-        case EOpExp2:           out &lt;&lt; &quot;exp2&quot;;                 break;
-        case EOpLog2:           out &lt;&lt; &quot;log2&quot;;                 break;
-        case EOpSqrt:           out &lt;&lt; &quot;sqrt&quot;;                 break;
-        case EOpInverseSqrt:    out &lt;&lt; &quot;inverse sqrt&quot;;         break;
</del><ins>+      case EOpExp:            out &lt;&lt; &quot;exp&quot;;                  break;
+      case EOpLog:            out &lt;&lt; &quot;log&quot;;                  break;
+      case EOpExp2:           out &lt;&lt; &quot;exp2&quot;;                 break;
+      case EOpLog2:           out &lt;&lt; &quot;log2&quot;;                 break;
+      case EOpSqrt:           out &lt;&lt; &quot;sqrt&quot;;                 break;
+      case EOpInverseSqrt:    out &lt;&lt; &quot;inverse sqrt&quot;;         break;
</ins><span class="cx"> 
</span><del>-        case EOpAbs:            out &lt;&lt; &quot;Absolute value&quot;;       break;
-        case EOpSign:           out &lt;&lt; &quot;Sign&quot;;                 break;
-        case EOpFloor:          out &lt;&lt; &quot;Floor&quot;;                break;
-        case EOpCeil:           out &lt;&lt; &quot;Ceiling&quot;;              break;
-        case EOpFract:          out &lt;&lt; &quot;Fraction&quot;;             break;
</del><ins>+      case EOpAbs:            out &lt;&lt; &quot;Absolute value&quot;;       break;
+      case EOpSign:           out &lt;&lt; &quot;Sign&quot;;                 break;
+      case EOpFloor:          out &lt;&lt; &quot;Floor&quot;;                break;
+      case EOpTrunc:          out &lt;&lt; &quot;Truncate&quot;;             break;
+      case EOpRound:          out &lt;&lt; &quot;Round&quot;;                break;
+      case EOpRoundEven:      out &lt;&lt; &quot;Round half even&quot;;      break;
+      case EOpCeil:           out &lt;&lt; &quot;Ceiling&quot;;              break;
+      case EOpFract:          out &lt;&lt; &quot;Fraction&quot;;             break;
+      case EOpIsNan:          out &lt;&lt; &quot;Is not a number&quot;;      break;
+      case EOpIsInf:          out &lt;&lt; &quot;Is infinity&quot;;          break;
</ins><span class="cx"> 
</span><del>-        case EOpLength:         out &lt;&lt; &quot;length&quot;;               break;
-        case EOpNormalize:      out &lt;&lt; &quot;normalize&quot;;            break;
-            //        case EOpDPdx:           out &lt;&lt; &quot;dPdx&quot;;                 break;               
-            //        case EOpDPdy:           out &lt;&lt; &quot;dPdy&quot;;                 break;   
-            //        case EOpFwidth:         out &lt;&lt; &quot;fwidth&quot;;               break;                   
</del><ins>+      case EOpFloatBitsToInt: out &lt;&lt; &quot;float bits to int&quot;;    break;
+      case EOpFloatBitsToUint: out &lt;&lt; &quot;float bits to uint&quot;;  break;
+      case EOpIntBitsToFloat: out &lt;&lt; &quot;int bits to float&quot;;    break;
+      case EOpUintBitsToFloat: out &lt;&lt; &quot;uint bits to float&quot;;  break;
</ins><span class="cx"> 
</span><del>-        case EOpAny:            out &lt;&lt; &quot;any&quot;;                  break;
-        case EOpAll:            out &lt;&lt; &quot;all&quot;;                  break;
</del><ins>+      case EOpPackSnorm2x16:  out &lt;&lt; &quot;pack Snorm 2x16&quot;;      break;
+      case EOpPackUnorm2x16:  out &lt;&lt; &quot;pack Unorm 2x16&quot;;      break;
+      case EOpPackHalf2x16:   out &lt;&lt; &quot;pack half 2x16&quot;;       break;
</ins><span class="cx"> 
</span><del>-        default:
-            out.prefix(EPrefixError);
-            out &lt;&lt; &quot;Bad unary op&quot;;
</del><ins>+      case EOpUnpackSnorm2x16: out &lt;&lt; &quot;unpack Snorm 2x16&quot;;   break;
+      case EOpUnpackUnorm2x16: out &lt;&lt; &quot;unpack Unorm 2x16&quot;;   break;
+      case EOpUnpackHalf2x16:  out &lt;&lt; &quot;unpack half 2x16&quot;;    break;
+
+      case EOpLength:         out &lt;&lt; &quot;length&quot;;               break;
+      case EOpNormalize:      out &lt;&lt; &quot;normalize&quot;;            break;
+      // case EOpDPdx:           out &lt;&lt; &quot;dPdx&quot;;                 break;
+      // case EOpDPdy:           out &lt;&lt; &quot;dPdy&quot;;                 break;
+      // case EOpFwidth:         out &lt;&lt; &quot;fwidth&quot;;               break;
+
+      case EOpDeterminant:    out &lt;&lt; &quot;determinant&quot;;          break;
+      case EOpTranspose:      out &lt;&lt; &quot;transpose&quot;;            break;
+      case EOpInverse:        out &lt;&lt; &quot;inverse&quot;;              break;
+
+      case EOpAny:            out &lt;&lt; &quot;any&quot;;                  break;
+      case EOpAll:            out &lt;&lt; &quot;all&quot;;                  break;
+
+      default:
+        out.prefix(EPrefixError);
+        out &lt;&lt; &quot;Bad unary op&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     out &lt;&lt; &quot; (&quot; &lt;&lt; node-&gt;getCompleteString() &lt;&lt; &quot;)&quot;;
</span><span class="lines">@@ -208,78 +373,85 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
</del><ins>+bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = sink;
</del><ins>+    TInfoSinkBase &amp;out = sink;
</ins><span class="cx"> 
</span><del>-    if (node-&gt;getOp() == EOpNull) {
</del><ins>+    if (node-&gt;getOp() == EOpNull)
+    {
</ins><span class="cx">         out.prefix(EPrefixError);
</span><span class="cx">         out &lt;&lt; &quot;node is still EOpNull!&quot;;
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    OutputTreeText(out, node, depth);
</del><ins>+    OutputTreeText(out, node, mDepth);
</ins><span class="cx"> 
</span><del>-    switch (node-&gt;getOp()) {
-        case EOpSequence:      out &lt;&lt; &quot;Sequence\n&quot;; return true;
-        case EOpComma:         out &lt;&lt; &quot;Comma\n&quot;; return true;
-        case EOpFunction:      out &lt;&lt; &quot;Function Definition: &quot; &lt;&lt; node-&gt;getName(); break;
-        case EOpFunctionCall:  out &lt;&lt; &quot;Function Call: &quot; &lt;&lt; node-&gt;getName(); break;
-        case EOpParameters:    out &lt;&lt; &quot;Function Parameters: &quot;;              break;
</del><ins>+    switch (node-&gt;getOp())
+    {
+      case EOpSequence:      out &lt;&lt; &quot;Sequence\n&quot;; return true;
+      case EOpComma:         out &lt;&lt; &quot;Comma\n&quot;; return true;
+      case EOpFunction:      out &lt;&lt; &quot;Function Definition: &quot; &lt;&lt; node-&gt;getName(); break;
+      case EOpFunctionCall:  out &lt;&lt; &quot;Function Call: &quot; &lt;&lt; node-&gt;getName(); break;
+      case EOpParameters:    out &lt;&lt; &quot;Function Parameters: &quot;;              break;
+      case EOpPrototype:     out &lt;&lt; &quot;Function Prototype: &quot; &lt;&lt; node-&gt;getName(); break;
</ins><span class="cx"> 
</span><del>-        case EOpConstructFloat: out &lt;&lt; &quot;Construct float&quot;; break;
-        case EOpConstructVec2:  out &lt;&lt; &quot;Construct vec2&quot;;  break;
-        case EOpConstructVec3:  out &lt;&lt; &quot;Construct vec3&quot;;  break;
-        case EOpConstructVec4:  out &lt;&lt; &quot;Construct vec4&quot;;  break;
-        case EOpConstructBool:  out &lt;&lt; &quot;Construct bool&quot;;  break;
-        case EOpConstructBVec2: out &lt;&lt; &quot;Construct bvec2&quot;; break;
-        case EOpConstructBVec3: out &lt;&lt; &quot;Construct bvec3&quot;; break;
-        case EOpConstructBVec4: out &lt;&lt; &quot;Construct bvec4&quot;; break;
-        case EOpConstructInt:   out &lt;&lt; &quot;Construct int&quot;;   break;
-        case EOpConstructIVec2: out &lt;&lt; &quot;Construct ivec2&quot;; break;
-        case EOpConstructIVec3: out &lt;&lt; &quot;Construct ivec3&quot;; break;
-        case EOpConstructIVec4: out &lt;&lt; &quot;Construct ivec4&quot;; break;
-        case EOpConstructUInt:  out &lt;&lt; &quot;Construct uint&quot;;  break;
-        case EOpConstructUVec2: out &lt;&lt; &quot;Construct uvec2&quot;; break;
-        case EOpConstructUVec3: out &lt;&lt; &quot;Construct uvec3&quot;; break;
-        case EOpConstructUVec4: out &lt;&lt; &quot;Construct uvec4&quot;; break;
-        case EOpConstructMat2:  out &lt;&lt; &quot;Construct mat2&quot;;  break;
-        case EOpConstructMat3:  out &lt;&lt; &quot;Construct mat3&quot;;  break;
-        case EOpConstructMat4:  out &lt;&lt; &quot;Construct mat4&quot;;  break;
-        case EOpConstructStruct:  out &lt;&lt; &quot;Construct structure&quot;;  break;
</del><ins>+      case EOpConstructFloat: out &lt;&lt; &quot;Construct float&quot;; break;
+      case EOpConstructVec2:  out &lt;&lt; &quot;Construct vec2&quot;;  break;
+      case EOpConstructVec3:  out &lt;&lt; &quot;Construct vec3&quot;;  break;
+      case EOpConstructVec4:  out &lt;&lt; &quot;Construct vec4&quot;;  break;
+      case EOpConstructBool:  out &lt;&lt; &quot;Construct bool&quot;;  break;
+      case EOpConstructBVec2: out &lt;&lt; &quot;Construct bvec2&quot;; break;
+      case EOpConstructBVec3: out &lt;&lt; &quot;Construct bvec3&quot;; break;
+      case EOpConstructBVec4: out &lt;&lt; &quot;Construct bvec4&quot;; break;
+      case EOpConstructInt:   out &lt;&lt; &quot;Construct int&quot;;   break;
+      case EOpConstructIVec2: out &lt;&lt; &quot;Construct ivec2&quot;; break;
+      case EOpConstructIVec3: out &lt;&lt; &quot;Construct ivec3&quot;; break;
+      case EOpConstructIVec4: out &lt;&lt; &quot;Construct ivec4&quot;; break;
+      case EOpConstructUInt:  out &lt;&lt; &quot;Construct uint&quot;;  break;
+      case EOpConstructUVec2: out &lt;&lt; &quot;Construct uvec2&quot;; break;
+      case EOpConstructUVec3: out &lt;&lt; &quot;Construct uvec3&quot;; break;
+      case EOpConstructUVec4: out &lt;&lt; &quot;Construct uvec4&quot;; break;
+      case EOpConstructMat2:  out &lt;&lt; &quot;Construct mat2&quot;;  break;
+      case EOpConstructMat3:  out &lt;&lt; &quot;Construct mat3&quot;;  break;
+      case EOpConstructMat4:  out &lt;&lt; &quot;Construct mat4&quot;;  break;
+      case EOpConstructStruct:  out &lt;&lt; &quot;Construct structure&quot;;  break;
</ins><span class="cx"> 
</span><del>-        case EOpLessThan:         out &lt;&lt; &quot;Compare Less Than&quot;;             break;
-        case EOpGreaterThan:      out &lt;&lt; &quot;Compare Greater Than&quot;;          break;
-        case EOpLessThanEqual:    out &lt;&lt; &quot;Compare Less Than or Equal&quot;;    break;
-        case EOpGreaterThanEqual: out &lt;&lt; &quot;Compare Greater Than or Equal&quot;; break;
-        case EOpVectorEqual:      out &lt;&lt; &quot;Equal&quot;;                         break;
-        case EOpVectorNotEqual:   out &lt;&lt; &quot;NotEqual&quot;;                      break;
</del><ins>+      case EOpLessThan:         out &lt;&lt; &quot;Compare Less Than&quot;;             break;
+      case EOpGreaterThan:      out &lt;&lt; &quot;Compare Greater Than&quot;;          break;
+      case EOpLessThanEqual:    out &lt;&lt; &quot;Compare Less Than or Equal&quot;;    break;
+      case EOpGreaterThanEqual: out &lt;&lt; &quot;Compare Greater Than or Equal&quot;; break;
+      case EOpVectorEqual:      out &lt;&lt; &quot;Equal&quot;;                         break;
+      case EOpVectorNotEqual:   out &lt;&lt; &quot;NotEqual&quot;;                      break;
</ins><span class="cx"> 
</span><del>-        case EOpMod:           out &lt;&lt; &quot;mod&quot;;         break;
-        case EOpPow:           out &lt;&lt; &quot;pow&quot;;         break;
</del><ins>+      case EOpMod:           out &lt;&lt; &quot;mod&quot;;         break;
+      case EOpModf:          out &lt;&lt; &quot;modf&quot;;        break;
+      case EOpPow:           out &lt;&lt; &quot;pow&quot;;         break;
</ins><span class="cx"> 
</span><del>-        case EOpAtan:          out &lt;&lt; &quot;arc tangent&quot;; break;
</del><ins>+      case EOpAtan:          out &lt;&lt; &quot;arc tangent&quot;; break;
</ins><span class="cx"> 
</span><del>-        case EOpMin:           out &lt;&lt; &quot;min&quot;;         break;
-        case EOpMax:           out &lt;&lt; &quot;max&quot;;         break;
-        case EOpClamp:         out &lt;&lt; &quot;clamp&quot;;       break;
-        case EOpMix:           out &lt;&lt; &quot;mix&quot;;         break;
-        case EOpStep:          out &lt;&lt; &quot;step&quot;;        break;
-        case EOpSmoothStep:    out &lt;&lt; &quot;smoothstep&quot;;  break;
</del><ins>+      case EOpMin:           out &lt;&lt; &quot;min&quot;;         break;
+      case EOpMax:           out &lt;&lt; &quot;max&quot;;         break;
+      case EOpClamp:         out &lt;&lt; &quot;clamp&quot;;       break;
+      case EOpMix:           out &lt;&lt; &quot;mix&quot;;         break;
+      case EOpStep:          out &lt;&lt; &quot;step&quot;;        break;
+      case EOpSmoothStep:    out &lt;&lt; &quot;smoothstep&quot;;  break;
</ins><span class="cx"> 
</span><del>-        case EOpDistance:      out &lt;&lt; &quot;distance&quot;;                break;
-        case EOpDot:           out &lt;&lt; &quot;dot-product&quot;;             break;
-        case EOpCross:         out &lt;&lt; &quot;cross-product&quot;;           break;
-        case EOpFaceForward:   out &lt;&lt; &quot;face-forward&quot;;            break;
-        case EOpReflect:       out &lt;&lt; &quot;reflect&quot;;                 break;
-        case EOpRefract:       out &lt;&lt; &quot;refract&quot;;                 break;
-        case EOpMul:           out &lt;&lt; &quot;component-wise multiply&quot;; break;
</del><ins>+      case EOpDistance:      out &lt;&lt; &quot;distance&quot;;                break;
+      case EOpDot:           out &lt;&lt; &quot;dot-product&quot;;             break;
+      case EOpCross:         out &lt;&lt; &quot;cross-product&quot;;           break;
+      case EOpFaceForward:   out &lt;&lt; &quot;face-forward&quot;;            break;
+      case EOpReflect:       out &lt;&lt; &quot;reflect&quot;;                 break;
+      case EOpRefract:       out &lt;&lt; &quot;refract&quot;;                 break;
+      case EOpMul:           out &lt;&lt; &quot;component-wise multiply&quot;; break;
</ins><span class="cx"> 
</span><del>-        case EOpDeclaration:   out &lt;&lt; &quot;Declaration: &quot;;   break;
</del><ins>+      case EOpOuterProduct:  out &lt;&lt; &quot;outer product&quot;;   break;
</ins><span class="cx"> 
</span><del>-        default:
-            out.prefix(EPrefixError);
-            out &lt;&lt; &quot;Bad aggregation op&quot;;
</del><ins>+      case EOpDeclaration:   out &lt;&lt; &quot;Declaration: &quot;;   break;
+      case EOpInvariantDeclaration: out &lt;&lt; &quot;Invariant Declaration: &quot;; break;
+
+      default:
+        out.prefix(EPrefixError);
+        out &lt;&lt; &quot;Bad aggregation op&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (node-&gt;getOp() != EOpSequence &amp;&amp; node-&gt;getOp() != EOpParameters)
</span><span class="lines">@@ -290,135 +462,156 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection* node)
</del><ins>+bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection *node)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = sink;
</del><ins>+    TInfoSinkBase &amp;out = sink;
</ins><span class="cx"> 
</span><del>-    OutputTreeText(out, node, depth);
</del><ins>+    OutputTreeText(out, node, mDepth);
</ins><span class="cx"> 
</span><span class="cx">     out &lt;&lt; &quot;Test condition and select&quot;;
</span><span class="cx">     out &lt;&lt; &quot; (&quot; &lt;&lt; node-&gt;getCompleteString() &lt;&lt; &quot;)\n&quot;;
</span><span class="cx"> 
</span><del>-    ++depth;
</del><ins>+    ++mDepth;
</ins><span class="cx"> 
</span><del>-    OutputTreeText(sink, node, depth);
</del><ins>+    OutputTreeText(sink, node, mDepth);
</ins><span class="cx">     out &lt;&lt; &quot;Condition\n&quot;;
</span><span class="cx">     node-&gt;getCondition()-&gt;traverse(this);
</span><span class="cx"> 
</span><del>-    OutputTreeText(sink, node, depth);
-    if (node-&gt;getTrueBlock()) {
</del><ins>+    OutputTreeText(sink, node, mDepth);
+    if (node-&gt;getTrueBlock())
+    {
</ins><span class="cx">         out &lt;&lt; &quot;true case\n&quot;;
</span><span class="cx">         node-&gt;getTrueBlock()-&gt;traverse(this);
</span><del>-    } else
</del><ins>+    }
+    else
+    {
</ins><span class="cx">         out &lt;&lt; &quot;true case is null\n&quot;;
</span><ins>+    }
</ins><span class="cx"> 
</span><del>-    if (node-&gt;getFalseBlock()) {
-        OutputTreeText(sink, node, depth);
</del><ins>+    if (node-&gt;getFalseBlock())
+    {
+        OutputTreeText(sink, node, mDepth);
</ins><span class="cx">         out &lt;&lt; &quot;false case\n&quot;;
</span><span class="cx">         node-&gt;getFalseBlock()-&gt;traverse(this);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    --depth;
</del><ins>+    --mDepth;
</ins><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
</del><ins>+void TOutputTraverser::visitConstantUnion(TIntermConstantUnion *node)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = sink;
</del><ins>+    TInfoSinkBase &amp;out = sink;
</ins><span class="cx"> 
</span><span class="cx">     size_t size = node-&gt;getType().getObjectSize();
</span><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; size; i++) {
-        OutputTreeText(out, node, depth);
-        switch (node-&gt;getUnionArrayPointer()[i].getType()) {
-            case EbtBool:
-                if (node-&gt;getUnionArrayPointer()[i].getBConst())
-                    out &lt;&lt; &quot;true&quot;;
-                else
-                    out &lt;&lt; &quot;false&quot;;
</del><ins>+    for (size_t i = 0; i &lt; size; i++)
+    {
+        OutputTreeText(out, node, mDepth);
+        switch (node-&gt;getUnionArrayPointer()[i].getType())
+        {
+          case EbtBool:
+            if (node-&gt;getUnionArrayPointer()[i].getBConst())
+                out &lt;&lt; &quot;true&quot;;
+            else
+                out &lt;&lt; &quot;false&quot;;
</ins><span class="cx"> 
</span><del>-                out &lt;&lt; &quot; (&quot; &lt;&lt; &quot;const bool&quot; &lt;&lt; &quot;)&quot;;
-                out &lt;&lt; &quot;\n&quot;;
-                break;
-            case EbtFloat:
-                out &lt;&lt; node-&gt;getUnionArrayPointer()[i].getFConst();
-                out &lt;&lt; &quot; (const float)\n&quot;;
-                break;
-            case EbtInt:
-                out &lt;&lt; node-&gt;getUnionArrayPointer()[i].getIConst();
-                out &lt;&lt; &quot; (const int)\n&quot;;
-                break;
-            case EbtUInt:
-                out &lt;&lt; node-&gt;getUnionArrayPointer()[i].getUConst();
-                out &lt;&lt; &quot; (const uint)\n&quot;;
-                break;
-            default:
-                out.message(EPrefixInternalError, node-&gt;getLine(), &quot;Unknown constant&quot;);
-                break;
</del><ins>+            out &lt;&lt; &quot; (&quot; &lt;&lt; &quot;const bool&quot; &lt;&lt; &quot;)&quot;;
+            out &lt;&lt; &quot;\n&quot;;
+            break;
+          case EbtFloat:
+            out &lt;&lt; node-&gt;getUnionArrayPointer()[i].getFConst();
+            out &lt;&lt; &quot; (const float)\n&quot;;
+            break;
+          case EbtInt:
+            out &lt;&lt; node-&gt;getUnionArrayPointer()[i].getIConst();
+            out &lt;&lt; &quot; (const int)\n&quot;;
+            break;
+          case EbtUInt:
+            out &lt;&lt; node-&gt;getUnionArrayPointer()[i].getUConst();
+            out &lt;&lt; &quot; (const uint)\n&quot;;
+            break;
+          default:
+            out.message(EPrefixInternalError, node-&gt;getLine(), &quot;Unknown constant&quot;);
+            break;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop* node)
</del><ins>+bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop *node)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = sink;
</del><ins>+    TInfoSinkBase &amp;out = sink;
</ins><span class="cx"> 
</span><del>-    OutputTreeText(out, node, depth);
</del><ins>+    OutputTreeText(out, node, mDepth);
</ins><span class="cx"> 
</span><span class="cx">     out &lt;&lt; &quot;Loop with condition &quot;;
</span><span class="cx">     if (node-&gt;getType() == ELoopDoWhile)
</span><span class="cx">         out &lt;&lt; &quot;not &quot;;
</span><span class="cx">     out &lt;&lt; &quot;tested first\n&quot;;
</span><span class="cx"> 
</span><del>-    ++depth;
</del><ins>+    ++mDepth;
</ins><span class="cx"> 
</span><del>-    OutputTreeText(sink, node, depth);
-    if (node-&gt;getCondition()) {
</del><ins>+    OutputTreeText(sink, node, mDepth);
+    if (node-&gt;getCondition())
+    {
</ins><span class="cx">         out &lt;&lt; &quot;Loop Condition\n&quot;;
</span><span class="cx">         node-&gt;getCondition()-&gt;traverse(this);
</span><del>-    } else
</del><ins>+    }
+    else
+    {
</ins><span class="cx">         out &lt;&lt; &quot;No loop condition\n&quot;;
</span><ins>+    }
</ins><span class="cx"> 
</span><del>-    OutputTreeText(sink, node, depth);
-    if (node-&gt;getBody()) {
</del><ins>+    OutputTreeText(sink, node, mDepth);
+    if (node-&gt;getBody())
+    {
</ins><span class="cx">         out &lt;&lt; &quot;Loop Body\n&quot;;
</span><span class="cx">         node-&gt;getBody()-&gt;traverse(this);
</span><del>-    } else
</del><ins>+    }
+    else
+    {
</ins><span class="cx">         out &lt;&lt; &quot;No loop body\n&quot;;
</span><ins>+    }
</ins><span class="cx"> 
</span><del>-    if (node-&gt;getExpression()) {
-        OutputTreeText(sink, node, depth);
</del><ins>+    if (node-&gt;getExpression())
+    {
+        OutputTreeText(sink, node, mDepth);
</ins><span class="cx">         out &lt;&lt; &quot;Loop Terminal Expression\n&quot;;
</span><span class="cx">         node-&gt;getExpression()-&gt;traverse(this);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    --depth;
</del><ins>+    --mDepth;
</ins><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch* node)
</del><ins>+bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch *node)
</ins><span class="cx"> {
</span><del>-    TInfoSinkBase&amp; out = sink;
</del><ins>+    TInfoSinkBase &amp;out = sink;
</ins><span class="cx"> 
</span><del>-    OutputTreeText(out, node, depth);
</del><ins>+    OutputTreeText(out, node, mDepth);
</ins><span class="cx"> 
</span><del>-    switch (node-&gt;getFlowOp()) {
-        case EOpKill:      out &lt;&lt; &quot;Branch: Kill&quot;;           break;
-        case EOpBreak:     out &lt;&lt; &quot;Branch: Break&quot;;          break;
-        case EOpContinue:  out &lt;&lt; &quot;Branch: Continue&quot;;       break;
-        case EOpReturn:    out &lt;&lt; &quot;Branch: Return&quot;;         break;
-        default:           out &lt;&lt; &quot;Branch: Unknown Branch&quot;; break;
</del><ins>+    switch (node-&gt;getFlowOp())
+    {
+      case EOpKill:      out &lt;&lt; &quot;Branch: Kill&quot;;           break;
+      case EOpBreak:     out &lt;&lt; &quot;Branch: Break&quot;;          break;
+      case EOpContinue:  out &lt;&lt; &quot;Branch: Continue&quot;;       break;
+      case EOpReturn:    out &lt;&lt; &quot;Branch: Return&quot;;         break;
+      default:           out &lt;&lt; &quot;Branch: Unknown Branch&quot;; break;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (node-&gt;getExpression()) {
</del><ins>+    if (node-&gt;getExpression())
+    {
</ins><span class="cx">         out &lt;&lt; &quot; with expression\n&quot;;
</span><del>-        ++depth;
</del><ins>+        ++mDepth;
</ins><span class="cx">         node-&gt;getExpression()-&gt;traverse(this);
</span><del>-        --depth;
-    } else
</del><ins>+        --mDepth;
+    }
+    else
+    {
</ins><span class="cx">         out &lt;&lt; &quot;\n&quot;;
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="lines">@@ -426,14 +619,13 @@
</span><span class="cx"> //
</span><span class="cx"> // This function is the one to call externally to start the traversal.
</span><span class="cx"> // Individual functions can be initialized to 0 to skip processing of that
</span><del>-// type of node.  It's children will still be processed.
</del><ins>+// type of node. Its children will still be processed.
</ins><span class="cx"> //
</span><del>-void TIntermediate::outputTree(TIntermNode* root)
</del><ins>+void TIntermediate::outputTree(TIntermNode *root, TInfoSinkBase &amp;infoSink)
</ins><span class="cx"> {
</span><del>-    if (root == 0)
-        return;
</del><ins>+    TOutputTraverser it(infoSink);
</ins><span class="cx"> 
</span><del>-    TOutputTraverser it(infoSink.info);
</del><ins>+    ASSERT(root);
</ins><span class="cx"> 
</span><span class="cx">     root-&gt;traverse(&amp;it);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorintermediateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermediate.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermediate.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/intermediate.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,693 +1,72 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-//
-// Definition of the in-memory high-level intermediate representation
-// of shaders.  This is a tree that parser creates.
-//
-// Nodes in the tree are defined as a hierarchy of classes derived from 
-// TIntermNode. Each is a node in a tree.  There is no preset branching factor;
-// each node can have it's own type of list of children.
-//
</del><ins>+#ifndef COMPILER_TRANSLATOR_INTERMEDIATE_H_
+#define COMPILER_TRANSLATOR_INTERMEDIATE_H_
</ins><span class="cx"> 
</span><del>-#ifndef __INTERMEDIATE_H
-#define __INTERMEDIATE_H
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><del>-#include &quot;GLSLANG/ShaderLang.h&quot;
-
-#include &lt;algorithm&gt;
-#include &lt;queue&gt;
-#include &quot;compiler/translator/Common.h&quot;
-#include &quot;compiler/translator/Types.h&quot;
-#include &quot;compiler/translator/ConstantUnion.h&quot;
-
-//
-// Operators used by the high-level (parse tree) representation.
-//
-enum TOperator {
-    EOpNull,            // if in a node, should only mean a node is still being built
-    EOpSequence,        // denotes a list of statements, or parameters, etc.
-    EOpFunctionCall,    
-    EOpFunction,        // For function definition
-    EOpParameters,      // an aggregate listing the parameters to a function
-
-    EOpDeclaration,
-    EOpPrototype,
-
-    //
-    // Unary operators
-    //
-
-    EOpNegative,
-    EOpLogicalNot,
-    EOpVectorLogicalNot,
-
-    EOpPostIncrement,
-    EOpPostDecrement,
-    EOpPreIncrement,
-    EOpPreDecrement,
-
-    EOpConvIntToBool,
-    EOpConvUIntToBool,
-    EOpConvFloatToBool,
-    EOpConvBoolToFloat,
-    EOpConvIntToFloat,
-    EOpConvUIntToFloat,
-    EOpConvFloatToInt,
-    EOpConvBoolToInt,
-    EOpConvUIntToInt,
-    EOpConvIntToUInt,
-    EOpConvFloatToUInt,
-    EOpConvBoolToUInt,
-
-    //
-    // binary operations
-    //
-
-    EOpAdd,
-    EOpSub,
-    EOpMul,
-    EOpDiv,
-    EOpEqual,
-    EOpNotEqual,
-    EOpVectorEqual,
-    EOpVectorNotEqual,
-    EOpLessThan,
-    EOpGreaterThan,
-    EOpLessThanEqual,
-    EOpGreaterThanEqual,
-    EOpComma,
-
-    EOpVectorTimesScalar,
-    EOpVectorTimesMatrix,
-    EOpMatrixTimesVector,
-    EOpMatrixTimesScalar,
-
-    EOpLogicalOr,
-    EOpLogicalXor,
-    EOpLogicalAnd,
-
-    EOpIndexDirect,
-    EOpIndexIndirect,
-    EOpIndexDirectStruct,
-    EOpIndexDirectInterfaceBlock,
-
-    EOpVectorSwizzle,
-
-    //
-    // Built-in functions potentially mapped to operators
-    //
-
-    EOpRadians,
-    EOpDegrees,
-    EOpSin,
-    EOpCos,
-    EOpTan,
-    EOpAsin,
-    EOpAcos,
-    EOpAtan,
-
-    EOpPow,
-    EOpExp,
-    EOpLog,
-    EOpExp2,
-    EOpLog2,
-    EOpSqrt,
-    EOpInverseSqrt,
-
-    EOpAbs,
-    EOpSign,
-    EOpFloor,
-    EOpCeil,
-    EOpFract,
-    EOpMod,
-    EOpMin,
-    EOpMax,
-    EOpClamp,
-    EOpMix,
-    EOpStep,
-    EOpSmoothStep,
-
-    EOpLength,
-    EOpDistance,
-    EOpDot,
-    EOpCross,
-    EOpNormalize,
-    EOpFaceForward,
-    EOpReflect,
-    EOpRefract,
-
-    EOpDFdx,            // Fragment only, OES_standard_derivatives extension
-    EOpDFdy,            // Fragment only, OES_standard_derivatives extension
-    EOpFwidth,          // Fragment only, OES_standard_derivatives extension
-
-    EOpMatrixTimesMatrix,
-
-    EOpAny,
-    EOpAll,
-
-    //
-    // Branch
-    //
-
-    EOpKill,            // Fragment only
-    EOpReturn,
-    EOpBreak,
-    EOpContinue,
-
-    //
-    // Constructors
-    //
-
-    EOpConstructInt,
-    EOpConstructUInt,
-    EOpConstructBool,
-    EOpConstructFloat,
-    EOpConstructVec2,
-    EOpConstructVec3,
-    EOpConstructVec4,
-    EOpConstructBVec2,
-    EOpConstructBVec3,
-    EOpConstructBVec4,
-    EOpConstructIVec2,
-    EOpConstructIVec3,
-    EOpConstructIVec4,
-    EOpConstructUVec2,
-    EOpConstructUVec3,
-    EOpConstructUVec4,
-    EOpConstructMat2,
-    EOpConstructMat3,
-    EOpConstructMat4,
-    EOpConstructStruct,
-
-    //
-    // moves
-    //
-
-    EOpAssign,
-    EOpInitialize,
-    EOpAddAssign,
-    EOpSubAssign,
-    EOpMulAssign,
-    EOpVectorTimesMatrixAssign,
-    EOpVectorTimesScalarAssign,
-    EOpMatrixTimesScalarAssign,
-    EOpMatrixTimesMatrixAssign,
-    EOpDivAssign
-};
-
-extern const char* getOperatorString(TOperator op);
-
-class TIntermTraverser;
-class TIntermAggregate;
-class TIntermBinary;
-class TIntermUnary;
-class TIntermConstantUnion;
-class TIntermSelection;
-class TIntermTyped;
-class TIntermSymbol;
-class TIntermLoop;
-class TInfoSink;
-
-//
-// Base class for the tree nodes
-//
-class TIntermNode {
-public:
-    POOL_ALLOCATOR_NEW_DELETE();
-    TIntermNode() {
-        // TODO: Move this to TSourceLoc constructor
-        // after getting rid of TPublicType.
-        line.first_file = line.last_file = 0;
-        line.first_line = line.last_line = 0;
-    }
-    virtual ~TIntermNode() { }
-
-    const TSourceLoc&amp; getLine() const { return line; }
-    void setLine(const TSourceLoc&amp; l) { line = l; }
-
-    virtual void traverse(TIntermTraverser*) = 0;
-    virtual TIntermTyped* getAsTyped() { return 0; }
-    virtual TIntermConstantUnion* getAsConstantUnion() { return 0; }
-    virtual TIntermAggregate* getAsAggregate() { return 0; }
-    virtual TIntermBinary* getAsBinaryNode() { return 0; }
-    virtual TIntermUnary* getAsUnaryNode() { return 0; }
-    virtual TIntermSelection* getAsSelectionNode() { return 0; }
-    virtual TIntermSymbol* getAsSymbolNode() { return 0; }
-    virtual TIntermLoop* getAsLoopNode() { return 0; }
-
-    // Replace a child node. Return true if |original| is a child
-    // node and it is replaced; otherwise, return false.
-    virtual bool replaceChildNode(
-        TIntermNode *original, TIntermNode *replacement) = 0;
-
-    // For traversing a tree in no particular order, but using
-    // heap memory.
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const = 0;
-
-protected:
-    TSourceLoc line;
-};
-
-//
-// This is just to help yacc.
-//
-struct TIntermNodePair {
-    TIntermNode* node1;
-    TIntermNode* node2;
-};
-
-//
-// Intermediate class for nodes that have a type.
-//
-class TIntermTyped : public TIntermNode {
-public:
-    TIntermTyped(const TType&amp; t) : type(t)  { }
-    virtual TIntermTyped* getAsTyped() { return this; }
-
-    virtual bool hasSideEffects() const = 0;
-
-    void setType(const TType&amp; t) { type = t; }
-    const TType&amp; getType() const { return type; }
-    TType* getTypePointer() { return &amp;type; }
-
-    TBasicType getBasicType() const { return type.getBasicType(); }
-    TQualifier getQualifier() const { return type.getQualifier(); }
-    TPrecision getPrecision() const { return type.getPrecision(); }
-    int getCols() const { return type.getCols(); }
-    int getRows() const { return type.getRows(); }
-    int getNominalSize() const { return type.getNominalSize(); }
-    int getSecondarySize() const { return type.getSecondarySize(); }
-    
-    bool isInterfaceBlock() const { return type.isInterfaceBlock(); }
-    bool isMatrix() const { return type.isMatrix(); }
-    bool isArray()  const { return type.isArray(); }
-    bool isVector() const { return type.isVector(); }
-    bool isScalar() const { return type.isScalar(); }
-    bool isScalarInt() const { return type.isScalarInt(); }
-    const char* getBasicString() const { return type.getBasicString(); }
-    const char* getQualifierString() const { return type.getQualifierString(); }
-    TString getCompleteString() const { return type.getCompleteString(); }
-
-    int getArraySize() const { return type.getArraySize(); }
-
-protected:
-    TType type;
-};
-
-//
-// Handle for, do-while, and while loops.
-//
-enum TLoopType {
-    ELoopFor,
-    ELoopWhile,
-    ELoopDoWhile
-};
-
-class TIntermLoop : public TIntermNode {
-public:
-    TIntermLoop(TLoopType aType,
-                TIntermNode *aInit, TIntermTyped* aCond, TIntermTyped* aExpr,
-                TIntermNode* aBody) :
-            type(aType),
-            init(aInit),
-            cond(aCond),
-            expr(aExpr),
-            body(aBody),
-            unrollFlag(false) { }
-
-    virtual TIntermLoop* getAsLoopNode() { return this; }
-    virtual void traverse(TIntermTraverser*);
-    virtual bool replaceChildNode(
-        TIntermNode *original, TIntermNode *replacement);
-
-    TLoopType getType() const { return type; }
-    TIntermNode* getInit() { return init; }
-    TIntermTyped* getCondition() { return cond; }
-    TIntermTyped* getExpression() { return expr; }
-    TIntermNode* getBody() { return body; }
-
-    void setUnrollFlag(bool flag) { unrollFlag = flag; }
-    bool getUnrollFlag() { return unrollFlag; }
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const;
-
-protected:
-    TLoopType type;
-    TIntermNode* init;  // for-loop initialization
-    TIntermTyped* cond; // loop exit condition
-    TIntermTyped* expr; // for-loop expression
-    TIntermNode* body;  // loop body
-
-    bool unrollFlag; // Whether the loop should be unrolled or not.
-};
-
-//
-// Handle break, continue, return, and kill.
-//
-class TIntermBranch : public TIntermNode {
-public:
-    TIntermBranch(TOperator op, TIntermTyped* e) :
-            flowOp(op),
-            expression(e) { }
-
-    virtual void traverse(TIntermTraverser*);
-    virtual bool replaceChildNode(
-        TIntermNode *original, TIntermNode *replacement);
-
-    TOperator getFlowOp() { return flowOp; }
-    TIntermTyped* getExpression() { return expression; }
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const;
-
-protected:
-    TOperator flowOp;
-    TIntermTyped* expression;  // non-zero except for &quot;return exp;&quot; statements
-};
-
-//
-// Nodes that correspond to symbols or constants in the source code.
-//
-class TIntermSymbol : public TIntermTyped {
-public:
-    // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym. If sym comes from
-    // per process globalpoolallocator, then it causes increased memory usage per compile
-    // it is essential to use &quot;symbol = sym&quot; to assign to symbol
-    TIntermSymbol(int i, const TString&amp; sym, const TType&amp; t) : 
-        TIntermTyped(t), id(i)  { symbol = sym; }
-
-    virtual bool hasSideEffects() const { return false; }
-
-    int getId() const { return id; }
-    const TString&amp; getSymbol() const { return symbol; }
-
-    void setId(int newId) { id = newId; }
-
-    virtual void traverse(TIntermTraverser*);
-    virtual TIntermSymbol* getAsSymbolNode() { return this; }
-    virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const {}
-
-protected:
-    int id;
-    TString symbol;
-};
-
-class TIntermConstantUnion : public TIntermTyped {
-public:
-    TIntermConstantUnion(ConstantUnion *unionPointer, const TType&amp; t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
-
-    virtual bool hasSideEffects() const { return false; }
-
-    ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
-    
-    int getIConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
-    unsigned int getUConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getUConst() : 0; }
-    float getFConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
-    bool getBConst(size_t index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
-
-    virtual TIntermConstantUnion* getAsConstantUnion()  { return this; }
-    virtual void traverse(TIntermTraverser*);
-    virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
-
-    TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&amp;);
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const {}
-
-protected:
-    ConstantUnion *unionArrayPointer;
-};
-
-//
-// Intermediate class for node types that hold operators.
-//
-class TIntermOperator : public TIntermTyped {
-public:
-    TOperator getOp() const { return op; }
-    void setOp(TOperator o) { op = o; }
-
-    bool isAssignment() const;
-    bool isConstructor() const;
-
-    virtual bool hasSideEffects() const { return isAssignment(); }
-
-protected:
-    TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {}
-    TIntermOperator(TOperator o, const TType&amp; t) : TIntermTyped(t), op(o) {}
-    TOperator op;
-};
-
-//
-// Nodes for all the basic binary math operators.
-//
-class TIntermBinary : public TIntermOperator {
-public:
-    TIntermBinary(TOperator o) : TIntermOperator(o), addIndexClamp(false) {}
-
-    virtual TIntermBinary* getAsBinaryNode() { return this; }
-    virtual void traverse(TIntermTraverser*);
-    virtual bool replaceChildNode(
-        TIntermNode *original, TIntermNode *replacement);
-
-    virtual bool hasSideEffects() const { return (isAssignment() || left-&gt;hasSideEffects() || right-&gt;hasSideEffects()); }
-
-    void setLeft(TIntermTyped* n) { left = n; }
-    void setRight(TIntermTyped* n) { right = n; }
-    TIntermTyped* getLeft() const { return left; }
-    TIntermTyped* getRight() const { return right; }
-    bool promote(TInfoSink&amp;);
-
-    void setAddIndexClamp() { addIndexClamp = true; }
-    bool getAddIndexClamp() { return addIndexClamp; }
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const;
-
-protected:
-    TIntermTyped* left;
-    TIntermTyped* right;
-
-    // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
-    bool addIndexClamp;
-};
-
-//
-// Nodes for unary math operators.
-//
-class TIntermUnary : public TIntermOperator {
-public:
-    TIntermUnary(TOperator o, const TType&amp; t) : TIntermOperator(o, t), operand(0), useEmulatedFunction(false) {}
-    TIntermUnary(TOperator o) : TIntermOperator(o), operand(0), useEmulatedFunction(false) {}
-
-    virtual void traverse(TIntermTraverser*);
-    virtual TIntermUnary* getAsUnaryNode() { return this; }
-    virtual bool replaceChildNode(
-        TIntermNode *original, TIntermNode *replacement);
-
-    virtual bool hasSideEffects() const { return (isAssignment() || operand-&gt;hasSideEffects()); }
-
-    void setOperand(TIntermTyped* o) { operand = o; }
-    TIntermTyped* getOperand() { return operand; }    
-    bool promote(TInfoSink&amp;);
-
-    void setUseEmulatedFunction() { useEmulatedFunction = true; }
-    bool getUseEmulatedFunction() { return useEmulatedFunction; }
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const;
-
-protected:
-    TIntermTyped* operand;
-
-    // If set to true, replace the built-in function call with an emulated one
-    // to work around driver bugs.
-    bool useEmulatedFunction;
-};
-
-typedef TVector&lt;TIntermNode*&gt; TIntermSequence;
-typedef TVector&lt;int&gt; TQualifierList;
-
-//
-// Nodes that operate on an arbitrary sized set of children.
-//
-class TIntermAggregate : public TIntermOperator {
-public:
-    TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), useEmulatedFunction(false) { }
-    TIntermAggregate(TOperator o) : TIntermOperator(o), useEmulatedFunction(false) { }
-    ~TIntermAggregate() { }
-
-    virtual TIntermAggregate* getAsAggregate() { return this; }
-    virtual void traverse(TIntermTraverser*);
-    virtual bool replaceChildNode(
-        TIntermNode *original, TIntermNode *replacement);
-
-    // Conservatively assume function calls and other aggregate operators have side-effects
-    virtual bool hasSideEffects() const { return true; }
-
-    TIntermSequence&amp; getSequence() { return sequence; }
-
-    void setName(const TString&amp; n) { name = n; }
-    const TString&amp; getName() const { return name; }
-
-    void setUserDefined() { userDefined = true; }
-    bool isUserDefined() const { return userDefined; }
-
-    void setOptimize(bool o) { optimize = o; }
-    bool getOptimize() { return optimize; }
-    void setDebug(bool d) { debug = d; }
-    bool getDebug() { return debug; }
-
-    void setUseEmulatedFunction() { useEmulatedFunction = true; }
-    bool getUseEmulatedFunction() { return useEmulatedFunction; }
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const;
-
-protected:
-    TIntermAggregate(const TIntermAggregate&amp;); // disallow copy constructor
-    TIntermAggregate&amp; operator=(const TIntermAggregate&amp;); // disallow assignment operator
-    TIntermSequence sequence;
-    TString name;
-    bool userDefined; // used for user defined function names
-
-    bool optimize;
-    bool debug;
-
-    // If set to true, replace the built-in function call with an emulated one
-    // to work around driver bugs.
-    bool useEmulatedFunction;
-};
-
-//
-// For if tests.  Simplified since there is no switch statement.
-//
-class TIntermSelection : public TIntermTyped {
-public:
-    TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) :
-            TIntermTyped(TType(EbtVoid, EbpUndefined)), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
-    TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType&amp; type) :
-            TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
-
-    virtual void traverse(TIntermTraverser*);
-    virtual bool replaceChildNode(
-        TIntermNode *original, TIntermNode *replacement);
-
-    // Conservatively assume selections have side-effects
-    virtual bool hasSideEffects() const { return true; }
-
-    bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
-    TIntermNode* getCondition() const { return condition; }
-    TIntermNode* getTrueBlock() const { return trueBlock; }
-    TIntermNode* getFalseBlock() const { return falseBlock; }
-    TIntermSelection* getAsSelectionNode() { return this; }
-
-    virtual void enqueueChildren(std::queue&lt;TIntermNode*&gt; *nodeQueue) const;
-
-protected:
-    TIntermTyped* condition;
-    TIntermNode* trueBlock;
-    TIntermNode* falseBlock;
-};
-
-enum Visit
</del><ins>+struct TVectorFields
</ins><span class="cx"> {
</span><del>-    PreVisit,
-    InVisit,
-    PostVisit
</del><ins>+    int offsets[4];
+    int num;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> //
</span><del>-// For traversing the tree.  User should derive from this, 
-// put their traversal specific data in it, and then pass
-// it to a Traverse method.
</del><ins>+// Set of helper functions to help parse and build the tree.
</ins><span class="cx"> //
</span><del>-// When using this, just fill in the methods for nodes you want visited.
-// Return false from a pre-visit to skip visiting that node's subtree.
-//
-class TIntermTraverser
</del><ins>+class TInfoSink;
+class TIntermediate
</ins><span class="cx"> {
</span><del>-public:
</del><ins>+  public:
</ins><span class="cx">     POOL_ALLOCATOR_NEW_DELETE();
</span><del>-    TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) : 
-            preVisit(preVisit),
-            inVisit(inVisit),
-            postVisit(postVisit),
-            rightToLeft(rightToLeft),
-            depth(0),
-            maxDepth(0) {}
-    virtual ~TIntermTraverser() {}
</del><ins>+    TIntermediate(TInfoSink &amp;i)
+        : mInfoSink(i) { }
</ins><span class="cx"> 
</span><del>-    virtual void visitSymbol(TIntermSymbol*) {}
-    virtual void visitConstantUnion(TIntermConstantUnion*) {}
-    virtual bool visitBinary(Visit visit, TIntermBinary*) {return true;}
-    virtual bool visitUnary(Visit visit, TIntermUnary*) {return true;}
-    virtual bool visitSelection(Visit visit, TIntermSelection*) {return true;}
-    virtual bool visitAggregate(Visit visit, TIntermAggregate*) {return true;}
-    virtual bool visitLoop(Visit visit, TIntermLoop*) {return true;}
-    virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
</del><ins>+    TIntermSymbol *addSymbol(
+        int id, const TString &amp;, const TType &amp;, const TSourceLoc &amp;);
+    TIntermTyped *addBinaryMath(
+        TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &amp;);
+    TIntermTyped *addAssign(
+        TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &amp;);
+    TIntermTyped *addIndex(
+        TOperator op, TIntermTyped *base, TIntermTyped *index, const TSourceLoc &amp;);
+    TIntermTyped *addUnaryMath(
+        TOperator op, TIntermTyped *child, const TSourceLoc &amp;line, const TType *funcReturnType);
+    TIntermAggregate *growAggregate(
+        TIntermNode *left, TIntermNode *right, const TSourceLoc &amp;);
+    TIntermAggregate *makeAggregate(TIntermNode *node, const TSourceLoc &amp;);
+    TIntermAggregate *setAggregateOperator(TIntermNode *, TOperator, const TSourceLoc &amp;);
+    TIntermNode *addSelection(TIntermTyped *cond, TIntermNodePair code, const TSourceLoc &amp;);
+    TIntermTyped *addSelection(TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock,
+                               const TSourceLoc &amp;line);
+    TIntermSwitch *addSwitch(
+        TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &amp;line);
+    TIntermCase *addCase(
+        TIntermTyped *condition, const TSourceLoc &amp;line);
+    TIntermTyped *addComma(
+        TIntermTyped *left, TIntermTyped *right, const TSourceLoc &amp;);
+    TIntermConstantUnion *addConstantUnion(
+        TConstantUnion *constantUnion, const TType &amp;type, const TSourceLoc &amp;line);
+    // TODO(zmo): Get rid of default value.
+    bool parseConstTree(const TSourceLoc &amp;, TIntermNode *, TConstantUnion *,
+                        TOperator, TType, bool singleConstantParam = false);
+    TIntermNode *addLoop(TLoopType, TIntermNode *, TIntermTyped *, TIntermTyped *,
+                         TIntermNode *, const TSourceLoc &amp;);
+    TIntermBranch *addBranch(TOperator, const TSourceLoc &amp;);
+    TIntermBranch *addBranch(TOperator, TIntermTyped *, const TSourceLoc &amp;);
+    TIntermTyped *addSwizzle(TVectorFields &amp;, const TSourceLoc &amp;);
+    bool postProcess(TIntermNode *);
</ins><span class="cx"> 
</span><del>-    int getMaxDepth() const {return maxDepth;}
</del><ins>+    static void outputTree(TIntermNode *, TInfoSinkBase &amp;);
</ins><span class="cx"> 
</span><del>-    void incrementDepth(TIntermNode *current)
-    {
-        depth++;
-        maxDepth = std::max(maxDepth, depth);
-        path.push_back(current);
-    }
</del><ins>+  private:
+    void operator=(TIntermediate &amp;); // prevent assignments
</ins><span class="cx"> 
</span><del>-    void decrementDepth()
-    {
-        depth--;
-        path.pop_back();
-    }
-
-    TIntermNode *getParentNode()
-    {
-        return path.size() == 0 ? NULL : path.back();
-    }
-
-    // Return the original name if hash function pointer is NULL;
-    // otherwise return the hashed name.
-    static TString hash(const TString&amp; name, ShHashFunction64 hashFunction);
-
-    const bool preVisit;
-    const bool inVisit;
-    const bool postVisit;
-    const bool rightToLeft;
-
-protected:
-    int depth;
-    int maxDepth;
-
-    // All the nodes from root to the current node's parent during traversing.
-    TVector&lt;TIntermNode *&gt; path;
</del><ins>+    TInfoSink &amp; mInfoSink;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-//
-// For traversing the tree, and computing max depth.
-// Takes a maximum depth limit to prevent stack overflow.
-//
-class TMaxDepthTraverser : public TIntermTraverser
-{
-public:
-    POOL_ALLOCATOR_NEW_DELETE();
-    TMaxDepthTraverser(int depthLimit)
-      : TIntermTraverser(true, true, false, false),
-        depthLimit(depthLimit)
-    {}
-
-    virtual bool visitBinary(Visit visit, TIntermBinary*) { return depthCheck(); }
-    virtual bool visitUnary(Visit visit, TIntermUnary*) { return depthCheck(); }
-    virtual bool visitSelection(Visit visit, TIntermSelection*) { return depthCheck(); }
-    virtual bool visitAggregate(Visit visit, TIntermAggregate*) { return depthCheck(); }
-    virtual bool visitLoop(Visit visit, TIntermLoop*) { return depthCheck(); }
-    virtual bool visitBranch(Visit visit, TIntermBranch*) { return depthCheck(); }
-
-protected:
-    int depthLimit;
-
-    bool depthCheck() const { return maxDepth &lt; depthLimit; }
-};
-
-#endif // __INTERMEDIATE_H
</del><ins>+#endif  // COMPILER_TRANSLATOR_INTERMEDIATE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorlength_limitsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/length_limits.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -8,8 +8,8 @@
</span><span class="cx"> // length_limits.h
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#if !defined(__LENGTH_LIMITS_H)
-#define __LENGTH_LIMITS_H 1
</del><ins>+#ifndef COMPILER_TRANSLATOR_LENGTHLIMITS_H_
+#define COMPILER_TRANSLATOR_LENGTHLIMITS_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;GLSLANG/ShaderLang.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -18,4 +18,4 @@
</span><span class="cx"> 
</span><span class="cx"> size_t GetGlobalMaxTokenSize(ShShaderSpec spec);
</span><span class="cx"> 
</span><del>-#endif // !(defined(__LENGTH_LIMITS_H)
</del><ins>+#endif // COMPILER_TRANSLATOR_LENGTHLIMITS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorlocalintermediateh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/localintermediate.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,55 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-#ifndef _LOCAL_INTERMEDIATE_INCLUDED_
-#define _LOCAL_INTERMEDIATE_INCLUDED_
-
-#include &quot;compiler/translator/intermediate.h&quot;
-
-struct TVectorFields {
-    int offsets[4];
-    int num;
-};
-
-//
-// Set of helper functions to help parse and build the tree.
-//
-class TInfoSink;
-class TIntermediate {
-public:    
-    POOL_ALLOCATOR_NEW_DELETE();
-    TIntermediate(TInfoSink&amp; i) : infoSink(i) { }
-
-    TIntermSymbol* addSymbol(int Id, const TString&amp;, const TType&amp;, const TSourceLoc&amp;);
-    TIntermTyped* addConversion(TOperator, const TType&amp;, TIntermTyped*);
-    TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&amp;);
-    TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&amp;);
-    TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&amp;);
-    TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&amp;);
-    TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&amp;);
-    TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&amp;);
-    TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, const TSourceLoc&amp;);
-    TIntermNode*  addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&amp;);
-    TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&amp;);
-    TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&amp;);
-    TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&amp;, const TSourceLoc&amp;);
-    TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
-    bool parseConstTree(const TSourceLoc&amp;, TIntermNode*, ConstantUnion*, TOperator, TType, bool singleConstantParam = false);        
-    TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&amp;);
-    TIntermBranch* addBranch(TOperator, const TSourceLoc&amp;);
-    TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&amp;);
-    TIntermTyped* addSwizzle(TVectorFields&amp;, const TSourceLoc&amp;);
-    bool postProcess(TIntermNode*);
-        void remove(TIntermNode*);
-    void outputTree(TIntermNode*);
-
-private:
-    void operator=(TIntermediate&amp;); // prevent assignments
-
-    TInfoSink&amp; infoSink;
-};
-
-#endif // _LOCAL_INTERMEDIATE_INCLUDED_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorosincludeh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/osinclude.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/osinclude.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/osinclude.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,66 +0,0 @@
</span><del>-//
-// 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.
-//
-
-#ifndef __OSINCLUDE_H
-#define __OSINCLUDE_H
-
-//
-// This file contains contains os-specific datatypes and
-// declares any os-specific functions.
-//
-
-#if defined(_WIN32) || defined(_WIN64)
-#define ANGLE_OS_WIN
-#elif defined(__APPLE__) || defined(__linux__) || \
-      defined(__FreeBSD__) || defined(__OpenBSD__) || \
-      defined(__NetBSD__) || defined(__DragonFly__) || \
-      defined(__sun) || defined(ANDROID) || \
-      defined(__GLIBC__) || defined(__GNU__) || \
-      defined(__QNX__)
-#define ANGLE_OS_POSIX
-#else
-#error Unsupported platform.
-#endif
-
-#if defined(ANGLE_OS_WIN)
-#define STRICT
-#define VC_EXTRALEAN 1
-#include &lt;windows.h&gt;
-#elif defined(ANGLE_OS_POSIX)
-#include &lt;pthread.h&gt;
-#include &lt;semaphore.h&gt;
-#include &lt;errno.h&gt;
-#endif  // ANGLE_OS_WIN
-
-
-#include &quot;compiler/translator/compilerdebug.h&quot;
-
-//
-// Thread Local Storage Operations
-//
-#if defined(ANGLE_OS_WIN)
-typedef DWORD OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
-#elif defined(ANGLE_OS_POSIX)
-typedef pthread_key_t OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX (static_cast&lt;OS_TLSIndex&gt;(-1))
-#endif  // ANGLE_OS_WIN
-
-OS_TLSIndex OS_AllocTLSIndex();
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
-
-inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
-{
-    ASSERT(nIndex != OS_INVALID_TLS_INDEX);
-#if defined(ANGLE_OS_WIN)
-    return TlsGetValue(nIndex);
-#elif defined(ANGLE_OS_POSIX)
-    return pthread_getspecific(nIndex);
-#endif  // ANGLE_OS_WIN
-}
-
-#endif // __OSINCLUDE_H
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorossource_posixcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_posix.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_posix.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_posix.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-//
-// 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 posix specific functions
-//
-#include &quot;compiler/translator/osinclude.h&quot;
-
-#if !defined(ANGLE_OS_POSIX)
-#error Trying to build a posix specific file in a non-posix build.
-#endif
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
-    pthread_key_t pPoolIndex;
-
-    //
-    // Create global pool key.
-    //
-    if ((pthread_key_create(&amp;pPoolIndex, NULL)) != 0) {
-        assert(0 &amp;&amp; &quot;OS_AllocTLSIndex(): Unable to allocate Thread Local Storage&quot;);
-        return false;
-    }
-    else {
-        return pPoolIndex;
-    }
-}
-
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
-    if (nIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 &amp;&amp; &quot;OS_SetTLSValue(): Invalid TLS Index&quot;);
-        return false;
-    }
-
-    if (pthread_setspecific(nIndex, lpvValue) == 0)
-        return true;
-    else
-        return false;
-}
-
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
-    if (nIndex == OS_INVALID_TLS_INDEX) {
-        assert(0 &amp;&amp; &quot;OS_SetTLSValue(): Invalid TLS Index&quot;);
-        return false;
-    }
-
-    //
-    // Delete the global pool key.
-    //
-    if (pthread_key_delete(nIndex) == 0)
-        return true;
-    else
-        return false;
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorossource_wincpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/ossource_win.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,57 +0,0 @@
</span><del>-//
-// 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.
-//
-
-#include &quot;compiler/translator/osinclude.h&quot;
-//
-// This file contains contains the window's specific functions
-//
-
-#if !defined(ANGLE_OS_WIN)
-#error Trying to build a windows specific file in a non windows build.
-#endif
-
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
-        DWORD dwIndex = TlsAlloc();
-        if (dwIndex == TLS_OUT_OF_INDEXES) {
-                assert(0 &amp;&amp; &quot;OS_AllocTLSIndex(): Unable to allocate Thread Local Storage&quot;);
-                return OS_INVALID_TLS_INDEX;
-        }
-
-        return dwIndex;
-}
-
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
-        if (nIndex == OS_INVALID_TLS_INDEX) {
-                assert(0 &amp;&amp; &quot;OS_SetTLSValue(): Invalid TLS Index&quot;);
-                return false;
-        }
-
-        if (TlsSetValue(nIndex, lpvValue))
-                return true;
-        else
-                return false;
-}
-
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
-        if (nIndex == OS_INVALID_TLS_INDEX) {
-                assert(0 &amp;&amp; &quot;OS_SetTLSValue(): Invalid TLS Index&quot;);
-                return false;
-        }
-
-        if (TlsFree(nIndex))
-                return true;
-        else
-                return false;
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorparseConstcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/parseConst.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="lines">@@ -7,47 +7,50 @@
</span><span class="cx"> #include &quot;compiler/translator/ParseContext.h&quot;
</span><span class="cx"> 
</span><span class="cx"> //
</span><del>-// Use this class to carry along data from node to node in 
</del><ins>+// Use this class to carry along data from node to node in
</ins><span class="cx"> // the traversal
</span><span class="cx"> //
</span><del>-class TConstTraverser : public TIntermTraverser {
-public:
-    TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink&amp; sink, TType&amp; t)
</del><ins>+class TConstTraverser : public TIntermTraverser
+{
+  public:
+    TConstTraverser(TConstantUnion *cUnion, bool singleConstParam,
+                    TOperator constructType, TInfoSink &amp;sink, TType &amp;t)
</ins><span class="cx">         : error(false),
</span><del>-          index(0),
-          unionArray(cUnion),
-          type(t),
-          constructorType(constructType),
-          singleConstantParam(singleConstParam),
-          infoSink(sink),
-          size(0),
-          isDiagonalMatrixInit(false),
-          matrixCols(0),
-          matrixRows(0) {
</del><ins>+          mIndex(0),
+          mUnionArray(cUnion),
+          mType(t),
+          mConstructorType(constructType),
+          mSingleConstantParam(singleConstParam),
+          mInfoSink(sink),
+          mSize(0),
+          mIsDiagonalMatrixInit(false),
+          mMatrixCols(0),
+          mMatrixRows(0)
+    {
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool error;
</span><span class="cx"> 
</span><del>-protected:
-    void visitSymbol(TIntermSymbol*);
-    void visitConstantUnion(TIntermConstantUnion*);
-    bool visitBinary(Visit visit, TIntermBinary*);
-    bool visitUnary(Visit visit, TIntermUnary*);
-    bool visitSelection(Visit visit, TIntermSelection*);
-    bool visitAggregate(Visit visit, TIntermAggregate*);
-    bool visitLoop(Visit visit, TIntermLoop*);
-    bool visitBranch(Visit visit, TIntermBranch*);
</del><ins>+  protected:
+    void visitSymbol(TIntermSymbol *);
+    void visitConstantUnion(TIntermConstantUnion *);
+    bool visitBinary(Visit visit, TIntermBinary *);
+    bool visitUnary(Visit visit, TIntermUnary *);
+    bool visitSelection(Visit visit, TIntermSelection *);
+    bool visitAggregate(Visit visit, TIntermAggregate *);
+    bool visitLoop(Visit visit, TIntermLoop *);
+    bool visitBranch(Visit visit, TIntermBranch *);
</ins><span class="cx"> 
</span><del>-    size_t index;
-    ConstantUnion *unionArray;
-    TType type;
-    TOperator constructorType;
-    bool singleConstantParam;
-    TInfoSink&amp; infoSink;
-    size_t size; // size of the constructor ( 4 for vec4)
-    bool isDiagonalMatrixInit;
-    int matrixCols; // columns of the matrix
-    int matrixRows; // rows of the matrix
</del><ins>+    size_t mIndex;
+    TConstantUnion *mUnionArray;
+    TType mType;
+    TOperator mConstructorType;
+    bool mSingleConstantParam;
+    TInfoSink &amp;mInfoSink;
+    size_t mSize; // size of the constructor ( 4 for vec4)
+    bool mIsDiagonalMatrixInit;
+    int mMatrixCols; // columns of the matrix
+    int mMatrixRows; // rows of the matrix
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> //
</span><span class="lines">@@ -58,138 +61,144 @@
</span><span class="cx"> // continue on to children.  If you process children yourself,
</span><span class="cx"> // return false.
</span><span class="cx"> //
</span><del>-
-void TConstTraverser::visitSymbol(TIntermSymbol* node)
</del><ins>+void TConstTraverser::visitSymbol(TIntermSymbol *node)
</ins><span class="cx"> {
</span><del>-    infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Symbol Node found in constant constructor&quot;);
</del><ins>+    mInfoSink.info.message(EPrefixInternalError, node-&gt;getLine(),
+                           &quot;Symbol Node found in constant constructor&quot;);
</ins><span class="cx">     return;
</span><del>-
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TConstTraverser::visitBinary(Visit visit, TIntermBinary* node)
</del><ins>+bool TConstTraverser::visitBinary(Visit visit, TIntermBinary *node)
</ins><span class="cx"> {
</span><span class="cx">     TQualifier qualifier = node-&gt;getType().getQualifier();
</span><del>-    
-    if (qualifier != EvqConst) {
</del><ins>+
+    if (qualifier != EvqConst)
+    {
</ins><span class="cx">         TString buf;
</span><span class="cx">         buf.append(&quot;'constructor' : assigning non-constant to &quot;);
</span><del>-        buf.append(type.getCompleteString());
-        infoSink.info.message(EPrefixError, node-&gt;getLine(), buf.c_str());
</del><ins>+        buf.append(mType.getCompleteString());
+        mInfoSink.info.message(EPrefixError, node-&gt;getLine(), buf.c_str());
</ins><span class="cx">         error = true;
</span><del>-        return false;  
</del><ins>+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-   infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Binary Node found in constant constructor&quot;);
-    
</del><ins>+    mInfoSink.info.message(EPrefixInternalError, node-&gt;getLine(),
+                           &quot;Binary Node found in constant constructor&quot;);
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TConstTraverser::visitUnary(Visit visit, TIntermUnary* node)
</del><ins>+bool TConstTraverser::visitUnary(Visit visit, TIntermUnary *node)
</ins><span class="cx"> {
</span><span class="cx">     TString buf;
</span><span class="cx">     buf.append(&quot;'constructor' : assigning non-constant to &quot;);
</span><del>-    buf.append(type.getCompleteString());
-    infoSink.info.message(EPrefixError, node-&gt;getLine(), buf.c_str());
</del><ins>+    buf.append(mType.getCompleteString());
+    mInfoSink.info.message(EPrefixError, node-&gt;getLine(), buf.c_str());
</ins><span class="cx">     error = true;
</span><del>-    return false;  
</del><ins>+    return false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
</del><ins>+bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
</ins><span class="cx"> {
</span><del>-    if (!node-&gt;isConstructor() &amp;&amp; node-&gt;getOp() != EOpComma) {
</del><ins>+    if (!node-&gt;isConstructor() &amp;&amp; node-&gt;getOp() != EOpComma)
+    {
</ins><span class="cx">         TString buf;
</span><span class="cx">         buf.append(&quot;'constructor' : assigning non-constant to &quot;);
</span><del>-        buf.append(type.getCompleteString());
-        infoSink.info.message(EPrefixError, node-&gt;getLine(), buf.c_str());
</del><ins>+        buf.append(mType.getCompleteString());
+        mInfoSink.info.message(EPrefixError, node-&gt;getLine(), buf.c_str());
</ins><span class="cx">         error = true;
</span><del>-        return false;  
</del><ins>+        return false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (node-&gt;getSequence().size() == 0) {
</del><ins>+    if (node-&gt;getSequence()-&gt;size() == 0)
+    {
</ins><span class="cx">         error = true;
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool flag = node-&gt;getSequence().size() == 1 &amp;&amp; node-&gt;getSequence()[0]-&gt;getAsTyped()-&gt;getAsConstantUnion();
-    if (flag) 
</del><ins>+    bool flag = node-&gt;getSequence()-&gt;size() == 1 &amp;&amp;
+                (*node-&gt;getSequence())[0]-&gt;getAsTyped()-&gt;getAsConstantUnion();
+    if (flag)
</ins><span class="cx">     {
</span><del>-        singleConstantParam = true; 
-        constructorType = node-&gt;getOp();
-        size = node-&gt;getType().getObjectSize();
</del><ins>+        mSingleConstantParam = true;
+        mConstructorType = node-&gt;getOp();
+        mSize = node-&gt;getType().getObjectSize();
</ins><span class="cx"> 
</span><del>-        if (node-&gt;getType().isMatrix()) {
-            isDiagonalMatrixInit = true;
-            matrixCols = node-&gt;getType().getCols();
-            matrixRows = node-&gt;getType().getRows();
</del><ins>+        if (node-&gt;getType().isMatrix())
+        {
+            mIsDiagonalMatrixInit = true;
+            mMatrixCols = node-&gt;getType().getCols();
+            mMatrixRows = node-&gt;getType().getRows();
</ins><span class="cx">         }
</span><del>-    }       
</del><ins>+    }
</ins><span class="cx"> 
</span><del>-    for (TIntermSequence::iterator p = node-&gt;getSequence().begin(); 
-                                   p != node-&gt;getSequence().end(); p++) {
-
</del><ins>+    for (TIntermSequence::iterator p = node-&gt;getSequence()-&gt;begin();
+         p != node-&gt;getSequence()-&gt;end(); p++)
+    {
</ins><span class="cx">         if (node-&gt;getOp() == EOpComma)
</span><del>-            index = 0;           
-
</del><ins>+            mIndex = 0;
</ins><span class="cx">         (*p)-&gt;traverse(this);
</span><del>-    }   
-    if (flag) 
</del><ins>+    }
+    if (flag)
</ins><span class="cx">     {
</span><del>-        singleConstantParam = false;   
-        constructorType = EOpNull;
-        size = 0;
-        isDiagonalMatrixInit = false;
-        matrixCols = 0;
-        matrixRows = 0;
</del><ins>+        mSingleConstantParam = false;
+        mConstructorType = EOpNull;
+        mSize = 0;
+        mIsDiagonalMatrixInit = false;
+        mMatrixCols = 0;
+        mMatrixRows = 0;
</ins><span class="cx">     }
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
</del><ins>+bool TConstTraverser::visitSelection(Visit visit, TIntermSelection *node)
</ins><span class="cx"> {
</span><del>-    infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Selection Node found in constant constructor&quot;);
</del><ins>+    mInfoSink.info.message(EPrefixInternalError, node-&gt;getLine(),
+                           &quot;Selection Node found in constant constructor&quot;);
</ins><span class="cx">     error = true;
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
</del><ins>+void TConstTraverser::visitConstantUnion(TIntermConstantUnion *node)
</ins><span class="cx"> {
</span><span class="cx">     if (!node-&gt;getUnionArrayPointer())
</span><span class="cx">     {
</span><span class="cx">         // The constant was not initialized, this should already have been logged
</span><del>-        assert(infoSink.info.size() != 0);
</del><ins>+        ASSERT(mInfoSink.info.size() != 0);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ConstantUnion* leftUnionArray = unionArray;
-    size_t instanceSize = type.getObjectSize();
</del><ins>+    TConstantUnion *leftUnionArray = mUnionArray;
+    size_t instanceSize = mType.getObjectSize();
+    TBasicType basicType = mType.getBasicType();
</ins><span class="cx"> 
</span><del>-    if (index &gt;= instanceSize)
</del><ins>+    if (mIndex &gt;= instanceSize)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (!singleConstantParam) {
</del><ins>+    if (!mSingleConstantParam)
+    {
</ins><span class="cx">         size_t objectSize = node-&gt;getType().getObjectSize();
</span><del>-    
-        ConstantUnion *rightUnionArray = node-&gt;getUnionArrayPointer();
-        for (size_t i=0; i &lt; objectSize; i++) {
-            if (index &gt;= instanceSize)
</del><ins>+        const TConstantUnion *rightUnionArray = node-&gt;getUnionArrayPointer();
+        for (size_t i=0; i &lt; objectSize; i++)
+        {
+            if (mIndex &gt;= instanceSize)
</ins><span class="cx">                 return;
</span><del>-            leftUnionArray[index] = rightUnionArray[i];
-
-            (index)++;
</del><ins>+            leftUnionArray[mIndex].cast(basicType, rightUnionArray[i]);
+            mIndex++;
</ins><span class="cx">         }
</span><del>-    } else {
-        size_t totalSize = index + size;
-        ConstantUnion *rightUnionArray = node-&gt;getUnionArrayPointer();
-        if (!isDiagonalMatrixInit) {
</del><ins>+    }
+    else
+    {
+        size_t totalSize = mIndex + mSize;
+        const TConstantUnion *rightUnionArray = node-&gt;getUnionArrayPointer();
+        if (!mIsDiagonalMatrixInit)
+        {
</ins><span class="cx">             int count = 0;
</span><del>-            for (size_t i = index; i &lt; totalSize; i++) {
</del><ins>+            for (size_t i = mIndex; i &lt; totalSize; i++)
+            {
</ins><span class="cx">                 if (i &gt;= instanceSize)
</span><span class="cx">                     return;
</span><del>-
-                leftUnionArray[i] = rightUnionArray[count];
-
-                (index)++;
-                
</del><ins>+                leftUnionArray[i].cast(basicType, rightUnionArray[count]);
+                mIndex++;
</ins><span class="cx">                 if (node-&gt;getType().getObjectSize() &gt; 1)
</span><span class="cx">                     count++;
</span><span class="cx">             }
</span><span class="lines">@@ -197,36 +206,37 @@
</span><span class="cx">         else
</span><span class="cx">         {
</span><span class="cx">             // for matrix diagonal constructors from a single scalar
</span><del>-            for (int i = 0, col = 0; col &lt; matrixCols; col++)
</del><ins>+            for (int i = 0, col = 0; col &lt; mMatrixCols; col++)
</ins><span class="cx">             {
</span><del>-                for (int row = 0; row &lt; matrixRows; row++, i++)
</del><ins>+                for (int row = 0; row &lt; mMatrixRows; row++, i++)
</ins><span class="cx">                 {
</span><span class="cx">                     if (col == row)
</span><span class="cx">                     {
</span><del>-                        leftUnionArray[i] = rightUnionArray[0];
</del><ins>+                        leftUnionArray[i].cast(basicType, rightUnionArray[0]);
</ins><span class="cx">                     }
</span><span class="cx">                     else
</span><span class="cx">                     {
</span><span class="cx">                         leftUnionArray[i].setFConst(0.0f);
</span><span class="cx">                     }
</span><del>-
-                    (index)++;
</del><ins>+                    mIndex++;
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TConstTraverser::visitLoop(Visit visit, TIntermLoop* node)
</del><ins>+bool TConstTraverser::visitLoop(Visit visit, TIntermLoop *node)
</ins><span class="cx"> {
</span><del>-    infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Loop Node found in constant constructor&quot;);
</del><ins>+    mInfoSink.info.message(EPrefixInternalError, node-&gt;getLine(),
+                           &quot;Loop Node found in constant constructor&quot;);
</ins><span class="cx">     error = true;
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
</del><ins>+bool TConstTraverser::visitBranch(Visit visit, TIntermBranch *node)
</ins><span class="cx"> {
</span><del>-    infoSink.info.message(EPrefixInternalError, node-&gt;getLine(), &quot;Branch Node found in constant constructor&quot;);
</del><ins>+    mInfoSink.info.message(EPrefixInternalError, node-&gt;getLine(),
+                           &quot;Branch Node found in constant constructor&quot;);
</ins><span class="cx">     error = true;
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="lines">@@ -236,12 +246,15 @@
</span><span class="cx"> // Individual functions can be initialized to 0 to skip processing of that
</span><span class="cx"> // type of node.  It's children will still be processed.
</span><span class="cx"> //
</span><del>-bool TIntermediate::parseConstTree(const TSourceLoc&amp; line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TType t, bool singleConstantParam)
</del><ins>+bool TIntermediate::parseConstTree(
+    const TSourceLoc &amp;line, TIntermNode *root, TConstantUnion *unionArray,
+    TOperator constructorType, TType t, bool singleConstantParam)
</ins><span class="cx"> {
</span><span class="cx">     if (root == 0)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, t);
</del><ins>+    TConstTraverser it(unionArray, singleConstantParam, constructorType,
+                       mInfoSink, t);
</ins><span class="cx"> 
</span><span class="cx">     root-&gt;traverse(&amp;it);
</span><span class="cx">     if (it.error)
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictFragmentShaderTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictFragmentShaderTiming.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,35 +4,36 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
-#define COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_TIMING_RESTRICTFRAGMENTSHADERTIMING_H_
+#define COMPILER_TRANSLATOR_TIMING_RESTRICTFRAGMENTSHADERTIMING_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/depgraph/DependencyGraph.h&quot;
</span><span class="cx"> 
</span><span class="cx"> class TInfoSinkBase;
</span><span class="cx"> 
</span><del>-class RestrictFragmentShaderTiming : TDependencyGraphTraverser {
-public:
-    RestrictFragmentShaderTiming(TInfoSinkBase&amp; sink);
-    void enforceRestrictions(const TDependencyGraph&amp; graph);
</del><ins>+class RestrictFragmentShaderTiming : TDependencyGraphTraverser
+{
+  public:
+    RestrictFragmentShaderTiming(TInfoSinkBase &amp;sink);
+    void enforceRestrictions(const TDependencyGraph &amp;graph);
</ins><span class="cx">     int numErrors() const { return mNumErrors; }
</span><span class="cx"> 
</span><del>-    virtual void visitArgument(TGraphArgument* parameter);
-    virtual void visitSelection(TGraphSelection* selection);
-    virtual void visitLoop(TGraphLoop* loop);
-    virtual void visitLogicalOp(TGraphLogicalOp* logicalOp);
</del><ins>+    void visitArgument(TGraphArgument *parameter) override;
+    void visitSelection(TGraphSelection *selection) override;
+    void visitLoop(TGraphLoop *loop) override;
+    void visitLogicalOp(TGraphLogicalOp *logicalOp) override;
</ins><span class="cx"> 
</span><del>-private:
-    void beginError(const TIntermNode* node);
-    void validateUserDefinedFunctionCallUsage(const TDependencyGraph&amp; graph);
-    bool isSamplingOp(const TIntermAggregate* intermFunctionCall) const;
</del><ins>+  private:
+    void beginError(const TIntermNode *node);
+    void validateUserDefinedFunctionCallUsage(const TDependencyGraph &amp;graph);
+    bool isSamplingOp(const TIntermAggregate *intermFunctionCall) const;
</ins><span class="cx"> 
</span><del>-    TInfoSinkBase&amp; mSink;
</del><ins>+    TInfoSinkBase &amp;mSink;
</ins><span class="cx">     int mNumErrors;
</span><span class="cx"> 
</span><span class="cx">     typedef std::set&lt;TString&gt; StringSet;
</span><span class="cx">     StringSet mSamplingOps;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_TIMING_RESTRICT_FRAGMENT_SHADER_TIMING_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_TIMING_RESTRICTFRAGMENTSHADERTIMING_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatortimingRestrictVertexShaderTimingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/timing/RestrictVertexShaderTiming.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
-#define COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
</del><ins>+#ifndef COMPILER_TRANSLATOR_TIMING_RESTRICTVERTEXSHADERTIMING_H_
+#define COMPILER_TRANSLATOR_TIMING_RESTRICTVERTEXSHADERTIMING_H_
</ins><span class="cx"> 
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><span class="cx"> 
</span><span class="cx"> class TInfoSinkBase;
</span><span class="lines">@@ -28,4 +28,4 @@
</span><span class="cx">     int mNumErrors;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif  // COMPILER_TIMING_RESTRICT_VERTEX_SHADER_TIMING_H_
</del><ins>+#endif  // COMPILER_TRANSLATOR_TIMING_RESTRICTVERTEXSHADERTIMING_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorutilcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -9,6 +9,8 @@
</span><span class="cx"> #include &lt;limits&gt;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/preprocessor/numeric_lex.h&quot;
</span><ins>+#include &quot;compiler/translator/SymbolTable.h&quot;
+#include &quot;common/utilities.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> bool atof_clamp(const char *str, float *value)
</span><span class="cx"> {
</span><span class="lines">@@ -26,3 +28,337 @@
</span><span class="cx">     return success;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+namespace sh
+{
+
+GLenum GLVariableType(const TType &amp;type)
+{
+    if (type.getBasicType() == EbtFloat)
+    {
+        if (type.isScalar())
+        {
+            return GL_FLOAT;
+        }
+        else if (type.isVector())
+        {
+            switch (type.getNominalSize())
+            {
+              case 2: return GL_FLOAT_VEC2;
+              case 3: return GL_FLOAT_VEC3;
+              case 4: return GL_FLOAT_VEC4;
+              default: UNREACHABLE();
+            }
+        }
+        else if (type.isMatrix())
+        {
+            switch (type.getCols())
+            {
+              case 2:
+                switch (type.getRows())
+                {
+                  case 2: return GL_FLOAT_MAT2;
+                  case 3: return GL_FLOAT_MAT2x3;
+                  case 4: return GL_FLOAT_MAT2x4;
+                  default: UNREACHABLE();
+                }
+
+              case 3:
+                switch (type.getRows())
+                {
+                  case 2: return GL_FLOAT_MAT3x2;
+                  case 3: return GL_FLOAT_MAT3;
+                  case 4: return GL_FLOAT_MAT3x4;
+                  default: UNREACHABLE();
+                }
+
+              case 4:
+                switch (type.getRows())
+                {
+                  case 2: return GL_FLOAT_MAT4x2;
+                  case 3: return GL_FLOAT_MAT4x3;
+                  case 4: return GL_FLOAT_MAT4;
+                  default: UNREACHABLE();
+                }
+
+              default: UNREACHABLE();
+            }
+        }
+        else UNREACHABLE();
+    }
+    else if (type.getBasicType() == EbtInt)
+    {
+        if (type.isScalar())
+        {
+            return GL_INT;
+        }
+        else if (type.isVector())
+        {
+            switch (type.getNominalSize())
+            {
+              case 2: return GL_INT_VEC2;
+              case 3: return GL_INT_VEC3;
+              case 4: return GL_INT_VEC4;
+              default: UNREACHABLE();
+            }
+        }
+        else UNREACHABLE();
+    }
+    else if (type.getBasicType() == EbtUInt)
+    {
+        if (type.isScalar())
+        {
+            return GL_UNSIGNED_INT;
+        }
+        else if (type.isVector())
+        {
+            switch (type.getNominalSize())
+            {
+              case 2: return GL_UNSIGNED_INT_VEC2;
+              case 3: return GL_UNSIGNED_INT_VEC3;
+              case 4: return GL_UNSIGNED_INT_VEC4;
+              default: UNREACHABLE();
+            }
+        }
+        else UNREACHABLE();
+    }
+    else if (type.getBasicType() == EbtBool)
+    {
+        if (type.isScalar())
+        {
+            return GL_BOOL;
+        }
+        else if (type.isVector())
+        {
+            switch (type.getNominalSize())
+            {
+              case 2: return GL_BOOL_VEC2;
+              case 3: return GL_BOOL_VEC3;
+              case 4: return GL_BOOL_VEC4;
+              default: UNREACHABLE();
+            }
+        }
+        else UNREACHABLE();
+    }
+
+    switch (type.getBasicType())
+    {
+      case EbtSampler2D:            return GL_SAMPLER_2D;
+      case EbtSampler3D:            return GL_SAMPLER_3D;
+      case EbtSamplerCube:          return GL_SAMPLER_CUBE;
+      case EbtSamplerExternalOES:   return GL_SAMPLER_EXTERNAL_OES;
+      case EbtSampler2DRect:        return GL_SAMPLER_2D_RECT_ARB;
+      case EbtSampler2DArray:       return GL_SAMPLER_2D_ARRAY;
+      case EbtISampler2D:           return GL_INT_SAMPLER_2D;
+      case EbtISampler3D:           return GL_INT_SAMPLER_3D;
+      case EbtISamplerCube:         return GL_INT_SAMPLER_CUBE;
+      case EbtISampler2DArray:      return GL_INT_SAMPLER_2D_ARRAY;
+      case EbtUSampler2D:           return GL_UNSIGNED_INT_SAMPLER_2D;
+      case EbtUSampler3D:           return GL_UNSIGNED_INT_SAMPLER_3D;
+      case EbtUSamplerCube:         return GL_UNSIGNED_INT_SAMPLER_CUBE;
+      case EbtUSampler2DArray:      return GL_UNSIGNED_INT_SAMPLER_2D_ARRAY;
+      case EbtSampler2DShadow:      return GL_SAMPLER_2D_SHADOW;
+      case EbtSamplerCubeShadow:    return GL_SAMPLER_CUBE_SHADOW;
+      case EbtSampler2DArrayShadow: return GL_SAMPLER_2D_ARRAY_SHADOW;
+      default: UNREACHABLE();
+    }
+
+    return GL_NONE;
+}
+
+GLenum GLVariablePrecision(const TType &amp;type)
+{
+    if (type.getBasicType() == EbtFloat)
+    {
+        switch (type.getPrecision())
+        {
+          case EbpHigh:
+            return GL_HIGH_FLOAT;
+          case EbpMedium:
+            return GL_MEDIUM_FLOAT;
+          case EbpLow:
+            return GL_LOW_FLOAT;
+          case EbpUndefined:
+          // Should be defined as the default precision by the parser
+          default:
+            UNREACHABLE();
+        }
+    }
+    else if (type.getBasicType() == EbtInt || type.getBasicType() == EbtUInt)
+    {
+        switch (type.getPrecision())
+        {
+          case EbpHigh:
+            return GL_HIGH_INT;
+          case EbpMedium:
+            return GL_MEDIUM_INT;
+          case EbpLow:
+            return GL_LOW_INT;
+          case EbpUndefined:
+          // Should be defined as the default precision by the parser
+          default:
+            UNREACHABLE();
+        }
+    }
+
+    // Other types (boolean, sampler) don't have a precision
+    return GL_NONE;
+}
+
+TString ArrayString(const TType &amp;type)
+{
+    if (!type.isArray())
+    {
+        return &quot;&quot;;
+    }
+
+    return &quot;[&quot; + str(type.getArraySize()) + &quot;]&quot;;
+}
+
+bool IsVaryingOut(TQualifier qualifier)
+{
+    switch (qualifier)
+    {
+      case EvqVaryingOut:
+      case EvqInvariantVaryingOut:
+      case EvqSmoothOut:
+      case EvqFlatOut:
+      case EvqCentroidOut:
+      case EvqVertexOut:
+        return true;
+
+      default: break;
+    }
+
+    return false;
+}
+
+bool IsVaryingIn(TQualifier qualifier)
+{
+    switch (qualifier)
+    {
+      case EvqVaryingIn:
+      case EvqInvariantVaryingIn:
+      case EvqSmoothIn:
+      case EvqFlatIn:
+      case EvqCentroidIn:
+      case EvqFragmentIn:
+        return true;
+
+      default: break;
+    }
+
+    return false;
+}
+
+bool IsVarying(TQualifier qualifier)
+{
+    return IsVaryingIn(qualifier) || IsVaryingOut(qualifier);
+}
+
+InterpolationType GetInterpolationType(TQualifier qualifier)
+{
+    switch (qualifier)
+    {
+      case EvqFlatIn:
+      case EvqFlatOut:
+        return INTERPOLATION_FLAT;
+
+      case EvqSmoothIn:
+      case EvqSmoothOut:
+      case EvqVertexOut:
+      case EvqFragmentIn:
+      case EvqVaryingIn:
+      case EvqVaryingOut:
+      case EvqInvariantVaryingIn:
+      case EvqInvariantVaryingOut:
+        return INTERPOLATION_SMOOTH;
+
+      case EvqCentroidIn:
+      case EvqCentroidOut:
+        return INTERPOLATION_CENTROID;
+
+      default: UNREACHABLE();
+        return INTERPOLATION_SMOOTH;
+    }
+}
+
+GetVariableTraverser::GetVariableTraverser(const TSymbolTable &amp;symbolTable)
+    : mSymbolTable(symbolTable)
+{
+}
+
+template void GetVariableTraverser::setTypeSpecificInfo(
+    const TType &amp;type, const TString&amp; name, InterfaceBlockField *variable);
+template void GetVariableTraverser::setTypeSpecificInfo(
+    const TType &amp;type, const TString&amp; name, ShaderVariable *variable);
+template void GetVariableTraverser::setTypeSpecificInfo(
+    const TType &amp;type, const TString&amp; name, Uniform *variable);
+
+template&lt;&gt;
+void GetVariableTraverser::setTypeSpecificInfo(
+    const TType &amp;type, const TString&amp; name, Varying *variable)
+{
+    ASSERT(variable);
+    switch (type.getQualifier())
+    {
+      case EvqInvariantVaryingIn:
+      case EvqInvariantVaryingOut:
+        variable-&gt;isInvariant = true;
+        break;
+      case EvqVaryingIn:
+      case EvqVaryingOut:
+        if (mSymbolTable.isVaryingInvariant(std::string(name.c_str())))
+        {
+            variable-&gt;isInvariant = true;
+        }
+        break;
+      default:
+        break;
+    }
+
+    variable-&gt;interpolation = GetInterpolationType(type.getQualifier());
+}
+
+template &lt;typename VarT&gt;
+void GetVariableTraverser::traverse(const TType &amp;type,
+                                    const TString &amp;name,
+                                    std::vector&lt;VarT&gt; *output)
+{
+    const TStructure *structure = type.getStruct();
+
+    VarT variable;
+    variable.name = name.c_str();
+    variable.arraySize = static_cast&lt;unsigned int&gt;(type.getArraySize());
+
+    if (!structure)
+    {
+        variable.type = GLVariableType(type);
+        variable.precision = GLVariablePrecision(type);
+    }
+    else
+    {
+        // Note: this enum value is not exposed outside ANGLE
+        variable.type = GL_STRUCT_ANGLEX;
+        variable.structName = structure-&gt;name().c_str();
+
+        const TFieldList &amp;fields = structure-&gt;fields();
+
+        for (size_t fieldIndex = 0; fieldIndex &lt; fields.size(); fieldIndex++)
+        {
+            TField *field = fields[fieldIndex];
+            traverse(*field-&gt;type(), field-&gt;name(), &amp;variable.fields);
+        }
+    }
+    setTypeSpecificInfo(type, name, &amp;variable);
+    visitVariable(&amp;variable);
+
+    ASSERT(output);
+    output-&gt;push_back(variable);
+}
+
+template void GetVariableTraverser::traverse(const TType &amp;, const TString &amp;, std::vector&lt;InterfaceBlockField&gt; *);
+template void GetVariableTraverser::traverse(const TType &amp;, const TString &amp;, std::vector&lt;ShaderVariable&gt; *);
+template void GetVariableTraverser::traverse(const TType &amp;, const TString &amp;, std::vector&lt;Uniform&gt; *);
+template void GetVariableTraverser::traverse(const TType &amp;, const TString &amp;, std::vector&lt;Varying&gt; *);
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilertranslatorutilh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler/translator/util.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -4,9 +4,16 @@
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><del>-#ifndef COMPILER_UTIL_H
-#define COMPILER_UTIL_H
</del><ins>+#ifndef COMPILER_TRANSLATOR_UTIL_H_
+#define COMPILER_TRANSLATOR_UTIL_H_
</ins><span class="cx"> 
</span><ins>+#include &lt;stack&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &lt;GLSLANG/ShaderLang.h&gt;
+
+#include &quot;compiler/translator/Types.h&quot;
+
</ins><span class="cx"> // atof_clamp is like atof but
</span><span class="cx"> //   1. it forces C locale, i.e. forcing '.' as decimal point.
</span><span class="cx"> //   2. it clamps the value to -FLT_MAX or FLT_MAX if overflow happens.
</span><span class="lines">@@ -17,4 +24,41 @@
</span><span class="cx"> // Return false if overflow happens.
</span><span class="cx"> extern bool atoi_clamp(const char *str, int *value);
</span><span class="cx"> 
</span><del>-#endif // COMPILER_UTIL_H
</del><ins>+class TSymbolTable;
+
+namespace sh
+{
+
+GLenum GLVariableType(const TType &amp;type);
+GLenum GLVariablePrecision(const TType &amp;type);
+bool IsVaryingIn(TQualifier qualifier);
+bool IsVaryingOut(TQualifier qualifier);
+bool IsVarying(TQualifier qualifier);
+InterpolationType GetInterpolationType(TQualifier qualifier);
+TString ArrayString(const TType &amp;type);
+
+class GetVariableTraverser : angle::NonCopyable
+{
+  public:
+    GetVariableTraverser(const TSymbolTable &amp;symbolTable);
+
+    template &lt;typename VarT&gt;
+    void traverse(const TType &amp;type, const TString &amp;name, std::vector&lt;VarT&gt; *output);
+
+  protected:
+    // May be overloaded
+    virtual void visitVariable(ShaderVariable *newVar) {}
+
+  private:
+    // Helper function called by traverse() to fill specific fields
+    // for attributes/varyings/uniforms.
+    template &lt;typename VarT&gt;
+    void setTypeSpecificInfo(
+        const TType &amp;type, const TString &amp;name, VarT *variable) {}
+
+    const TSymbolTable &amp;mSymbolTable;
+};
+
+}
+
+#endif // COMPILER_TRANSLATOR_UTIL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccompilergypi"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/compiler.gypi (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/compiler.gypi                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/compiler.gypi        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,356 @@
</span><ins>+# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+    'variables':
+    {
+        # These file lists are shared with the GN build.
+        'angle_translator_lib_sources':
+        [
+            '../include/EGL/egl.h',
+            '../include/EGL/eglext.h',
+            '../include/EGL/eglplatform.h',
+            '../include/GLES2/gl2.h',
+            '../include/GLES2/gl2ext.h',
+            '../include/GLES2/gl2platform.h',
+            '../include/GLES3/gl3.h',
+            '../include/GLES3/gl3ext.h',
+            '../include/GLES3/gl3platform.h',
+            '../include/GLSLANG/ShaderLang.h',
+            '../include/GLSLANG/ShaderVars.h',
+            '../include/KHR/khrplatform.h',
+            '../include/angle_gl.h',
+            'compiler/translator/BaseTypes.h',
+            'compiler/translator/BuiltInFunctionEmulator.cpp',
+            'compiler/translator/BuiltInFunctionEmulator.h',
+            'compiler/translator/BuiltInFunctionEmulatorGLSL.cpp',
+            'compiler/translator/BuiltInFunctionEmulatorGLSL.h',
+            'compiler/translator/CallDAG.cpp',
+            'compiler/translator/CallDAG.h',
+            'compiler/translator/CodeGen.cpp',
+            'compiler/translator/Common.h',
+            'compiler/translator/Compiler.cpp',
+            'compiler/translator/Compiler.h',
+            'compiler/translator/ConstantUnion.h',
+            'compiler/translator/Diagnostics.cpp',
+            'compiler/translator/Diagnostics.h',
+            'compiler/translator/DirectiveHandler.cpp',
+            'compiler/translator/DirectiveHandler.h',
+            'compiler/translator/EmulatePrecision.cpp',
+            'compiler/translator/EmulatePrecision.h',
+            'compiler/translator/ExtensionBehavior.h',
+            'compiler/translator/FlagStd140Structs.cpp',
+            'compiler/translator/FlagStd140Structs.h',
+            'compiler/translator/ForLoopUnroll.cpp',
+            'compiler/translator/ForLoopUnroll.h',
+            'compiler/translator/HashNames.h',
+            'compiler/translator/InfoSink.cpp',
+            'compiler/translator/InfoSink.h',
+            'compiler/translator/Initialize.cpp',
+            'compiler/translator/Initialize.h',
+            'compiler/translator/InitializeDll.cpp',
+            'compiler/translator/InitializeDll.h',
+            'compiler/translator/InitializeGlobals.h',
+            'compiler/translator/InitializeParseContext.cpp',
+            'compiler/translator/InitializeParseContext.h',
+            'compiler/translator/InitializeVariables.cpp',
+            'compiler/translator/InitializeVariables.h',
+            'compiler/translator/IntermNode.h',
+            'compiler/translator/IntermNode.cpp',
+            'compiler/translator/IntermTraverse.cpp',
+            'compiler/translator/Intermediate.h',
+            'compiler/translator/Intermediate.cpp',
+            'compiler/translator/LoopInfo.cpp',
+            'compiler/translator/LoopInfo.h',
+            'compiler/translator/MMap.h',
+            'compiler/translator/NodeSearch.h',
+            'compiler/translator/Operator.cpp',
+            'compiler/translator/Operator.h',
+            'compiler/translator/OutputESSL.cpp',
+            'compiler/translator/OutputESSL.h',
+            'compiler/translator/OutputGLSL.cpp',
+            'compiler/translator/OutputGLSL.h',
+            'compiler/translator/OutputGLSLBase.cpp',
+            'compiler/translator/OutputGLSLBase.h',
+            'compiler/translator/ParseContext.cpp',
+            'compiler/translator/ParseContext.h',
+            'compiler/translator/PoolAlloc.cpp',
+            'compiler/translator/PoolAlloc.h',
+            'compiler/translator/Pragma.h',
+            'compiler/translator/PruneEmptyDeclarations.cpp',
+            'compiler/translator/PruneEmptyDeclarations.h',
+            'compiler/translator/QualifierAlive.cpp',
+            'compiler/translator/QualifierAlive.h',
+            'compiler/translator/RegenerateStructNames.cpp',
+            'compiler/translator/RegenerateStructNames.h',
+            'compiler/translator/RenameFunction.h',
+            'compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp',
+            'compiler/translator/ScalarizeVecAndMatConstructorArgs.h',
+            'compiler/translator/SearchSymbol.cpp',
+            'compiler/translator/SearchSymbol.h',
+            'compiler/translator/SymbolTable.cpp',
+            'compiler/translator/SymbolTable.h',
+            'compiler/translator/TranslatorESSL.cpp',
+            'compiler/translator/TranslatorESSL.h',
+            'compiler/translator/TranslatorGLSL.cpp',
+            'compiler/translator/TranslatorGLSL.h',
+            'compiler/translator/Types.cpp',
+            'compiler/translator/Types.h',
+            'compiler/translator/UnfoldShortCircuitAST.cpp',
+            'compiler/translator/UnfoldShortCircuitAST.h',
+            'compiler/translator/ValidateLimitations.cpp',
+            'compiler/translator/ValidateLimitations.h',
+            'compiler/translator/ValidateOutputs.cpp',
+            'compiler/translator/ValidateOutputs.h',
+            'compiler/translator/ValidateSwitch.cpp',
+            'compiler/translator/ValidateSwitch.h',
+            'compiler/translator/VariableInfo.cpp',
+            'compiler/translator/VariableInfo.h',
+            'compiler/translator/VariablePacker.cpp',
+            'compiler/translator/VariablePacker.h',
+            'compiler/translator/VersionGLSL.cpp',
+            'compiler/translator/VersionGLSL.h',
+            'compiler/translator/blocklayout.cpp',
+            'compiler/translator/blocklayout.h',
+            'compiler/translator/depgraph/DependencyGraph.cpp',
+            'compiler/translator/depgraph/DependencyGraph.h',
+            'compiler/translator/depgraph/DependencyGraphBuilder.cpp',
+            'compiler/translator/depgraph/DependencyGraphBuilder.h',
+            'compiler/translator/depgraph/DependencyGraphOutput.cpp',
+            'compiler/translator/depgraph/DependencyGraphOutput.h',
+            'compiler/translator/depgraph/DependencyGraphTraverse.cpp',
+            'compiler/translator/glslang.h',
+            'compiler/translator/glslang.l',
+            'compiler/translator/glslang.y',
+            'compiler/translator/glslang_lex.cpp',
+            'compiler/translator/glslang_tab.cpp',
+            'compiler/translator/glslang_tab.h',
+            'compiler/translator/intermOut.cpp',
+            'compiler/translator/intermediate.h',
+            'compiler/translator/length_limits.h',
+            'compiler/translator/parseConst.cpp',
+            'compiler/translator/timing/RestrictFragmentShaderTiming.cpp',
+            'compiler/translator/timing/RestrictFragmentShaderTiming.h',
+            'compiler/translator/timing/RestrictVertexShaderTiming.cpp',
+            'compiler/translator/timing/RestrictVertexShaderTiming.h',
+            'compiler/translator/util.cpp',
+            'compiler/translator/util.h',
+            'third_party/compiler/ArrayBoundsClamper.cpp',
+            'third_party/compiler/ArrayBoundsClamper.h',
+        ],
+        'angle_translator_lib_hlsl_sources':
+        [
+            'compiler/translator/ArrayReturnValueToOutParameter.cpp',
+            'compiler/translator/ArrayReturnValueToOutParameter.h',
+            'compiler/translator/ASTMetadataHLSL.cpp',
+            'compiler/translator/ASTMetadataHLSL.h',
+            'compiler/translator/blocklayoutHLSL.cpp',
+            'compiler/translator/blocklayoutHLSL.h',
+            'compiler/translator/BuiltInFunctionEmulatorHLSL.cpp',
+            'compiler/translator/BuiltInFunctionEmulatorHLSL.h',
+            'compiler/translator/OutputHLSL.cpp',
+            'compiler/translator/OutputHLSL.h',
+            'compiler/translator/RemoveSwitchFallThrough.cpp',
+            'compiler/translator/RemoveSwitchFallThrough.h',
+            'compiler/translator/RewriteElseBlocks.cpp',
+            'compiler/translator/RewriteElseBlocks.h',
+            'compiler/translator/SeparateArrayInitialization.cpp',
+            'compiler/translator/SeparateArrayInitialization.h',
+            'compiler/translator/SeparateDeclarations.cpp',
+            'compiler/translator/SeparateDeclarations.h',
+            'compiler/translator/SimplifyArrayAssignment.cpp',
+            'compiler/translator/SimplifyArrayAssignment.h',
+            'compiler/translator/StructureHLSL.cpp',
+            'compiler/translator/StructureHLSL.h',
+            'compiler/translator/TranslatorHLSL.cpp',
+            'compiler/translator/TranslatorHLSL.h',
+            'compiler/translator/UnfoldShortCircuit.cpp',
+            'compiler/translator/UnfoldShortCircuit.h',
+            'compiler/translator/UniformHLSL.cpp',
+            'compiler/translator/UniformHLSL.h',
+            'compiler/translator/UtilsHLSL.cpp',
+            'compiler/translator/UtilsHLSL.h',
+        ],
+        'angle_preprocessor_sources':
+        [
+            'compiler/preprocessor/DiagnosticsBase.cpp',
+            'compiler/preprocessor/DiagnosticsBase.h',
+            'compiler/preprocessor/DirectiveHandlerBase.cpp',
+            'compiler/preprocessor/DirectiveHandlerBase.h',
+            'compiler/preprocessor/DirectiveParser.cpp',
+            'compiler/preprocessor/DirectiveParser.h',
+            'compiler/preprocessor/ExpressionParser.cpp',
+            'compiler/preprocessor/ExpressionParser.h',
+            'compiler/preprocessor/ExpressionParser.y',
+            'compiler/preprocessor/Input.cpp',
+            'compiler/preprocessor/Input.h',
+            'compiler/preprocessor/Lexer.cpp',
+            'compiler/preprocessor/Lexer.h',
+            'compiler/preprocessor/Macro.cpp',
+            'compiler/preprocessor/Macro.h',
+            'compiler/preprocessor/MacroExpander.cpp',
+            'compiler/preprocessor/MacroExpander.h',
+            'compiler/preprocessor/Preprocessor.cpp',
+            'compiler/preprocessor/Preprocessor.h',
+            'compiler/preprocessor/SourceLocation.h',
+            'compiler/preprocessor/Token.cpp',
+            'compiler/preprocessor/Token.h',
+            'compiler/preprocessor/Tokenizer.cpp',
+            'compiler/preprocessor/Tokenizer.h',
+            'compiler/preprocessor/Tokenizer.l',
+            'compiler/preprocessor/numeric_lex.h',
+            'compiler/preprocessor/pp_utils.h',
+        ],
+    },
+    # Everything below this is duplicated in the GN build. If you change
+    # anything also change angle/BUILD.gn
+    'targets':
+    [
+        {
+            'target_name': 'preprocessor',
+            'type': 'static_library',
+            'includes': [ '../build/common_defines.gypi', ],
+            'sources': [ '&lt;@(angle_preprocessor_sources)', ],
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+            ],
+        },
+        {
+            'target_name': 'translator_lib',
+            'type': 'static_library',
+            'dependencies': [ 'preprocessor', 'angle_common' ],
+            'includes': [ '../build/common_defines.gypi', ],
+            'include_dirs':
+            [
+                '.',
+                '../include',
+            ],
+            'defines':
+            [
+                # define the static translator to indicate exported
+                # classes are (in fact) locally defined
+                'ANGLE_TRANSLATOR_STATIC',
+            ],
+            'sources':
+            [
+                '&lt;@(angle_translator_lib_sources)',
+            ],
+            'msvs_settings':
+            {
+              'VCLibrarianTool':
+              {
+                'AdditionalOptions': ['/ignore:4221']
+              },
+            },
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+                ['angle_enable_hlsl==1',
+                {
+                    'defines':
+                    [
+                        'ANGLE_ENABLE_HLSL',
+                    ],
+                    'direct_dependent_settings':
+                    {
+                        'defines':
+                        [
+                            'ANGLE_ENABLE_HLSL',
+                        ],
+                    },
+                    'sources':
+                    [
+                        '&lt;@(angle_translator_lib_hlsl_sources)',
+                    ],
+                }],
+            ],
+        },
+
+        {
+            'target_name': 'translator',
+            'type': '&lt;(component)',
+            'dependencies': [ 'translator_lib', 'angle_common' ],
+            'includes': [ '../build/common_defines.gypi', ],
+            'include_dirs':
+            [
+                '.',
+                '../include',
+            ],
+            'defines':
+            [
+                'ANGLE_TRANSLATOR_IMPLEMENTATION',
+            ],
+            'sources':
+            [
+                'compiler/translator/ShaderLang.cpp',
+                'compiler/translator/ShaderVars.cpp'
+            ],
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+            ],
+        },
+
+        {
+            'target_name': 'translator_static',
+            'type': 'static_library',
+            'dependencies': [ 'translator_lib' ],
+            'includes': [ '../build/common_defines.gypi', ],
+            'include_dirs':
+            [
+                '.',
+                '../include',
+            ],
+            'defines':
+            [
+                'ANGLE_TRANSLATOR_STATIC',
+            ],
+            'direct_dependent_settings':
+            {
+                'defines':
+                [
+                    'ANGLE_TRANSLATOR_STATIC',
+                ],
+            },
+            'sources':
+            [
+                'compiler/translator/ShaderLang.cpp',
+                'compiler/translator/ShaderVars.cpp'
+            ],
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+            ],
+        },
+    ],
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrccopy_compiler_dllbat"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/copy_compiler_dll.bat (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/copy_compiler_dll.bat                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/copy_compiler_dll.bat        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+@echo off
+set _arch=%1
+set _arch=%_arch:Win32=x86%
+copy %2&quot;\Redist\D3D\&quot;%_arch%&quot;\d3dcompiler_47.dll&quot; %3 &gt; NUL
+:: This is equivalent to `touch', see:
+:: https://technet.microsoft.com/en-us/library/bb490886.aspx
+:: This avoids rerunning because this batch file is also copied to the gen dir,
+:: so it's timestamp would otherwise be newer than the dll.
+copy /b %3\d3dcompiler_47.dll+,, %3\d3dcompiler_47.dll &gt; NUL
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEAttributeMapcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;libANGLE/AttributeMap.h&quot;
+
+namespace egl
+{
+
+AttributeMap::AttributeMap()
+{
+}
+
+AttributeMap::AttributeMap(const EGLint *attributes)
+{
+    if (attributes)
+    {
+        for (const EGLint *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib += 2)
+        {
+            insert(curAttrib[0], curAttrib[1]);
+        }
+    }
+}
+
+void AttributeMap::insert(EGLint key, EGLint value)
+{
+    mAttributes[key] = value;
+}
+
+bool AttributeMap::contains(EGLint key) const
+{
+    return (mAttributes.find(key) != mAttributes.end());
+}
+
+EGLint AttributeMap::get(EGLint key, EGLint defaultValue) const
+{
+    std::map&lt;EGLint, EGLint&gt;::const_iterator iter = mAttributes.find(key);
+    return (mAttributes.find(key) != mAttributes.end()) ? iter-&gt;second : defaultValue;
+}
+
+AttributeMap::const_iterator AttributeMap::begin() const
+{
+    return mAttributes.begin();
+}
+
+AttributeMap::const_iterator AttributeMap::end() const
+{
+    return mAttributes.end();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEAttributeMaph"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/AttributeMap.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+//
+// Copyright (c) 2014 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 LIBANGLE_ATTRIBUTEMAP_H_
+#define LIBANGLE_ATTRIBUTEMAP_H_
+
+
+#include &lt;EGL/egl.h&gt;
+
+#include &lt;map&gt;
+
+namespace egl
+{
+
+class AttributeMap
+{
+  public:
+    AttributeMap();
+    explicit AttributeMap(const EGLint *attributes);
+
+    virtual void insert(EGLint key, EGLint value);
+    virtual bool contains(EGLint key) const;
+    virtual EGLint get(EGLint key, EGLint defaultValue) const;
+
+    typedef std::map&lt;EGLint, EGLint&gt;::const_iterator const_iterator;
+
+    const_iterator begin() const;
+    const_iterator end() const;
+
+  private:
+    std::map&lt;EGLint, EGLint&gt; mAttributes;
+};
+
+}
+
+#endif   // LIBANGLE_ATTRIBUTEMAP_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEBinaryStreamh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/BinaryStream.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/BinaryStream.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/BinaryStream.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,218 @@
</span><ins>+//
+// 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.
+//
+
+// BinaryStream.h: Provides binary serialization of simple types.
+
+#ifndef LIBANGLE_BINARYSTREAM_H_
+#define LIBANGLE_BINARYSTREAM_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/mathutil.h&quot;
+
+#include &lt;cstddef&gt;
+#include &lt;string&gt;
+#include &lt;vector&gt;
+#include &lt;stdint.h&gt;
+
+template &lt;typename T&gt;
+void StaticAssertIsFundamental()
+{
+    // c++11 STL is not available on OSX or Android
+#if !defined(ANGLE_PLATFORM_APPLE) &amp;&amp; !defined(ANGLE_PLATFORM_ANDROID)
+    static_assert(std::is_fundamental&lt;T&gt;::value, &quot;T must be a fundamental type.&quot;);
+#else
+    union { T dummy; } dummy;
+    static_cast&lt;void&gt;(dummy);
+#endif
+}
+
+namespace gl
+{
+
+class BinaryInputStream : angle::NonCopyable
+{
+  public:
+    BinaryInputStream(const void *data, size_t length)
+    {
+        mError = false;
+        mOffset = 0;
+        mData = static_cast&lt;const uint8_t*&gt;(data);
+        mLength = length;
+    }
+
+    // readInt will generate an error for bool types
+    template &lt;class IntT&gt;
+    IntT readInt()
+    {
+        int value;
+        read(&amp;value);
+        return static_cast&lt;IntT&gt;(value);
+    }
+
+    template &lt;class IntT&gt;
+    void readInt(IntT *outValue)
+    {
+        *outValue = readInt&lt;IntT&gt;();
+    }
+
+    bool readBool()
+    {
+        int value;
+        read(&amp;value);
+        return (value &gt; 0);
+    }
+
+    void readBool(bool *outValue)
+    {
+        *outValue = readBool();
+    }
+
+    void readBytes(unsigned char outArray[], size_t count)
+    {
+        read&lt;unsigned char&gt;(outArray, count);
+    }
+
+    std::string readString()
+    {
+        std::string outString;
+        readString(&amp;outString);
+        return outString;
+    }
+
+    void readString(std::string *v)
+    {
+        size_t length;
+        readInt(&amp;length);
+
+        if (mError)
+        {
+            return;
+        }
+
+        if (mOffset + length &gt; mLength)
+        {
+            mError = true;
+            return;
+        }
+
+        v-&gt;assign(reinterpret_cast&lt;const char *&gt;(mData) + mOffset, length);
+        mOffset += length;
+    }
+
+    void skip(size_t length)
+    {
+        if (mOffset + length &gt; mLength)
+        {
+            mError = true;
+            return;
+        }
+
+        mOffset += length;
+    }
+
+    size_t offset() const
+    {
+        return mOffset;
+    }
+
+    bool error() const
+    {
+        return mError;
+    }
+
+    bool endOfStream() const
+    {
+        return mOffset == mLength;
+    }
+
+    const uint8_t *data()
+    {
+        return mData;
+    }
+
+  private:
+    bool mError;
+    size_t mOffset;
+    const uint8_t *mData;
+    size_t mLength;
+
+    template &lt;typename T&gt;
+    void read(T *v, size_t num)
+    {
+        StaticAssertIsFundamental&lt;T&gt;();
+
+        size_t length = num * sizeof(T);
+
+        if (mOffset + length &gt; mLength)
+        {
+            mError = true;
+            return;
+        }
+
+        memcpy(v, mData + mOffset, length);
+        mOffset += length;
+    }
+
+    template &lt;typename T&gt;
+    void read(T *v)
+    {
+        read(v, 1);
+    }
+
+};
+
+class BinaryOutputStream : angle::NonCopyable
+{
+  public:
+    BinaryOutputStream()
+    {
+    }
+
+    // writeInt also handles bool types
+    template &lt;class IntT&gt;
+    void writeInt(IntT param)
+    {
+        ASSERT(rx::IsIntegerCastSafe&lt;int&gt;(param));
+        int intValue = static_cast&lt;int&gt;(param);
+        write(&amp;intValue, 1);
+    }
+
+    void writeString(const std::string &amp;v)
+    {
+        writeInt(v.length());
+        write(v.c_str(), v.length());
+    }
+
+    void writeBytes(const unsigned char *bytes, size_t count)
+    {
+        write(bytes, count);
+    }
+
+    size_t length() const
+    {
+        return mData.size();
+    }
+
+    const void* data() const
+    {
+        return mData.size() ? &amp;mData[0] : NULL;
+    }
+
+  private:
+    std::vector&lt;char&gt; mData;
+
+    template &lt;typename T&gt;
+    void write(const T *v, size_t num)
+    {
+        StaticAssertIsFundamental&lt;T&gt;();
+        const char *asBytes = reinterpret_cast&lt;const char*&gt;(v);
+        mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
+    }
+
+};
+}
+
+#endif  // LIBANGLE_BINARYSTREAM_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEBuffercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,154 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/renderer/BufferImpl.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+namespace gl
+{
+
+Buffer::Buffer(rx::BufferImpl *impl, GLuint id)
+    : RefCountObject(id),
+      mBuffer(impl),
+      mUsage(GL_STATIC_DRAW),
+      mSize(0),
+      mAccessFlags(0),
+      mAccess(GL_WRITE_ONLY_OES),
+      mMapped(GL_FALSE),
+      mMapPointer(NULL),
+      mMapOffset(0),
+      mMapLength(0)
+{
+}
+
+Buffer::~Buffer()
+{
+    SafeDelete(mBuffer);
+}
+
+Error Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
+{
+    gl::Error error = mBuffer-&gt;setData(data, size, usage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mIndexRangeCache.clear();
+    mUsage = usage;
+    mSize = size;
+
+    return error;
+}
+
+Error Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
+{
+    gl::Error error = mBuffer-&gt;setSubData(data, size, offset);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mIndexRangeCache.invalidateRange(static_cast&lt;unsigned int&gt;(offset), static_cast&lt;unsigned int&gt;(size));
+
+    return error;
+}
+
+Error Buffer::copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
+{
+    gl::Error error = mBuffer-&gt;copySubData(source-&gt;getImplementation(), sourceOffset, destOffset, size);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mIndexRangeCache.invalidateRange(static_cast&lt;unsigned int&gt;(destOffset), static_cast&lt;unsigned int&gt;(size));
+
+    return error;
+}
+
+Error Buffer::map(GLenum access)
+{
+    ASSERT(!mMapped);
+
+    Error error = mBuffer-&gt;map(access, &amp;mMapPointer);
+    if (error.isError())
+    {
+        mMapPointer = NULL;
+        return error;
+    }
+
+    ASSERT(access == GL_WRITE_ONLY_OES);
+
+    mMapped = GL_TRUE;
+    mMapOffset = 0;
+    mMapLength = mSize;
+    mAccess = access;
+    mAccessFlags = GL_MAP_WRITE_BIT;
+
+    mIndexRangeCache.invalidateRange(0, static_cast&lt;unsigned int&gt;(mMapLength));
+
+    return error;
+}
+
+Error Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+    ASSERT(!mMapped);
+    ASSERT(offset + length &lt;= mSize);
+
+    Error error = mBuffer-&gt;mapRange(offset, length, access, &amp;mMapPointer);
+    if (error.isError())
+    {
+        mMapPointer = NULL;
+        return error;
+    }
+
+    mMapped = GL_TRUE;
+    mMapOffset = static_cast&lt;GLint64&gt;(offset);
+    mMapLength = static_cast&lt;GLint64&gt;(length);
+    mAccess = GL_WRITE_ONLY_OES;
+    mAccessFlags = access;
+
+    // The OES_mapbuffer extension states that GL_WRITE_ONLY_OES is the only valid
+    // value for GL_BUFFER_ACCESS_OES because it was written against ES2.  Since there is
+    // no update for ES3 and the GL_READ_ONLY and GL_READ_WRITE enums don't exist for ES,
+    // we cannot properly set GL_BUFFER_ACCESS_OES when glMapBufferRange is called.
+
+    if ((access &amp; GL_MAP_WRITE_BIT) &gt; 0)
+    {
+        mIndexRangeCache.invalidateRange(static_cast&lt;unsigned int&gt;(offset), static_cast&lt;unsigned int&gt;(length));
+    }
+
+    return error;
+}
+
+Error Buffer::unmap(GLboolean *result)
+{
+    ASSERT(mMapped);
+
+    Error error = mBuffer-&gt;unmap(result);
+    if (error.isError())
+    {
+        *result = GL_FALSE;
+        return error;
+    }
+
+    mMapped = GL_FALSE;
+    mMapPointer = NULL;
+    mMapOffset = 0;
+    mMapLength = 0;
+    mAccess = GL_WRITE_ONLY_OES;
+    mAccessFlags = 0;
+
+    return error;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEBufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Buffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 LIBANGLE_BUFFER_H_
+#define LIBANGLE_BUFFER_H_
+
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+#include &quot;libANGLE/renderer/IndexRangeCache.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+namespace rx
+{
+class BufferImpl;
+};
+
+namespace gl
+{
+
+class Buffer : public RefCountObject
+{
+  public:
+    Buffer(rx::BufferImpl *impl, GLuint id);
+
+    virtual ~Buffer();
+
+    Error bufferData(const void *data, GLsizeiptr size, GLenum usage);
+    Error bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
+    Error copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
+    Error map(GLenum access);
+    Error mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
+    Error unmap(GLboolean *result);
+
+    GLenum getUsage() const { return mUsage; }
+    GLbitfield getAccessFlags() const { return mAccessFlags; }
+    GLenum getAccess() const { return mAccess; }
+    GLboolean isMapped() const { return mMapped; }
+    GLvoid *getMapPointer() const { return mMapPointer; }
+    GLint64 getMapOffset() const { return mMapOffset; }
+    GLint64 getMapLength() const { return mMapLength; }
+    GLint64 getSize() const { return mSize; }
+
+    rx::BufferImpl *getImplementation() const { return mBuffer; }
+
+    rx::IndexRangeCache *getIndexRangeCache() { return &amp;mIndexRangeCache; }
+    const rx::IndexRangeCache *getIndexRangeCache() const { return &amp;mIndexRangeCache; }
+
+  private:
+    rx::BufferImpl *mBuffer;
+
+    GLenum mUsage;
+    GLint64 mSize;
+    GLbitfield mAccessFlags;
+    GLenum mAccess;
+    GLboolean mMapped;
+    GLvoid *mMapPointer;
+    GLint64 mMapOffset;
+    GLint64 mMapLength;
+
+    rx::IndexRangeCache mIndexRangeCache;
+};
+
+}
+
+#endif   // LIBANGLE_BUFFER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLECapscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,547 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;libANGLE/Caps.h&quot;
+#include &quot;common/debug.h&quot;
+#include &quot;common/angleutils.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;algorithm&gt;
+#include &lt;sstream&gt;
+
+static void InsertExtensionString(const std::string &amp;extension, bool supported, std::vector&lt;std::string&gt; *extensionVector)
+{
+    if (supported)
+    {
+        extensionVector-&gt;push_back(extension);
+    }
+}
+
+namespace gl
+{
+
+TextureCaps::TextureCaps()
+    : texturable(false),
+      filterable(false),
+      renderable(false),
+      sampleCounts()
+{
+}
+
+GLuint TextureCaps::getMaxSamples() const
+{
+    return !sampleCounts.empty() ? *sampleCounts.rbegin() : 0;
+}
+
+GLuint TextureCaps::getNearestSamples(GLuint requestedSamples) const
+{
+    if (requestedSamples == 0)
+    {
+        return 0;
+    }
+
+    for (SupportedSampleSet::const_iterator i = sampleCounts.begin(); i != sampleCounts.end(); i++)
+    {
+        GLuint samples = *i;
+        if (samples &gt;= requestedSamples)
+        {
+            return samples;
+        }
+    }
+
+    return 0;
+}
+
+void TextureCapsMap::insert(GLenum internalFormat, const TextureCaps &amp;caps)
+{
+    mCapsMap.insert(std::make_pair(internalFormat, caps));
+}
+
+void TextureCapsMap::remove(GLenum internalFormat)
+{
+    InternalFormatToCapsMap::iterator i = mCapsMap.find(internalFormat);
+    if (i != mCapsMap.end())
+    {
+        mCapsMap.erase(i);
+    }
+}
+
+const TextureCaps &amp;TextureCapsMap::get(GLenum internalFormat) const
+{
+    static TextureCaps defaultUnsupportedTexture;
+    InternalFormatToCapsMap::const_iterator iter = mCapsMap.find(internalFormat);
+    return (iter != mCapsMap.end()) ? iter-&gt;second : defaultUnsupportedTexture;
+}
+
+TextureCapsMap::const_iterator TextureCapsMap::begin() const
+{
+    return mCapsMap.begin();
+}
+
+TextureCapsMap::const_iterator TextureCapsMap::end() const
+{
+    return mCapsMap.end();
+}
+
+size_t TextureCapsMap::size() const
+{
+    return mCapsMap.size();
+}
+
+Extensions::Extensions()
+    : elementIndexUint(false),
+      packedDepthStencil(false),
+      getProgramBinary(false),
+      rgb8rgba8(false),
+      textureFormatBGRA8888(false),
+      readFormatBGRA(false),
+      pixelBufferObject(false),
+      mapBuffer(false),
+      mapBufferRange(false),
+      textureHalfFloat(false),
+      textureHalfFloatLinear(false),
+      textureFloat(false),
+      textureFloatLinear(false),
+      textureRG(false),
+      textureCompressionDXT1(false),
+      textureCompressionDXT3(false),
+      textureCompressionDXT5(false),
+      depthTextures(false),
+      textureNPOT(false),
+      drawBuffers(false),
+      textureStorage(false),
+      textureFilterAnisotropic(false),
+      maxTextureAnisotropy(false),
+      occlusionQueryBoolean(false),
+      fence(false),
+      timerQuery(false),
+      robustness(false),
+      blendMinMax(false),
+      framebufferBlit(false),
+      framebufferMultisample(false),
+      instancedArrays(false),
+      packReverseRowOrder(false),
+      standardDerivatives(false),
+      shaderTextureLOD(false),
+      shaderFramebufferFetch(false),
+      ARMshaderFramebufferFetch(false),
+      NVshaderFramebufferFetch(false),
+      fragDepth(false),
+      textureUsage(false),
+      translatedShaderSource(false),
+      fboRenderMipmap(false),
+      colorBufferFloat(false)
+{
+}
+
+std::vector&lt;std::string&gt; Extensions::getStrings() const
+{
+    std::vector&lt;std::string&gt; extensionStrings;
+
+    //                   | Extension name                     | Supported flag          | Output vector   |
+    InsertExtensionString(&quot;GL_OES_element_index_uint&quot;,         elementIndexUint,         &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_packed_depth_stencil&quot;,       packedDepthStencil,       &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_get_program_binary&quot;,         getProgramBinary,         &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_rgb8_rgba8&quot;,                 rgb8rgba8,                &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_texture_format_BGRA8888&quot;,    textureFormatBGRA8888,    &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_read_format_bgra&quot;,           readFormatBGRA,           &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_NV_pixel_buffer_object&quot;,         pixelBufferObject,        &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_mapbuffer&quot;,                  mapBuffer,                &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_map_buffer_range&quot;,           mapBufferRange,           &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_texture_half_float&quot;,         textureHalfFloat,         &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_texture_half_float_linear&quot;,  textureHalfFloatLinear,   &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_texture_float&quot;,              textureFloat,             &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_texture_float_linear&quot;,       textureFloatLinear,       &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_texture_rg&quot;,                 textureRG,                &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_texture_compression_dxt1&quot;,   textureCompressionDXT1,   &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_texture_compression_dxt3&quot;, textureCompressionDXT3,   &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_texture_compression_dxt5&quot;, textureCompressionDXT5,   &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_sRGB&quot;,                       sRGB,                     &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_depth_texture&quot;,            depthTextures,            &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_texture_storage&quot;,            textureStorage,           &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_texture_npot&quot;,               textureNPOT,              &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_draw_buffers&quot;,               drawBuffers,              &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_texture_filter_anisotropic&quot;, textureFilterAnisotropic, &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_occlusion_query_boolean&quot;,    occlusionQueryBoolean,    &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_NV_fence&quot;,                       fence,                    &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_timer_query&quot;,              timerQuery,               &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_robustness&quot;,                 robustness,               &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_blend_minmax&quot;,               blendMinMax,              &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_framebuffer_blit&quot;,         framebufferBlit,          &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_framebuffer_multisample&quot;,  framebufferMultisample,   &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_instanced_arrays&quot;,         instancedArrays,          &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_pack_reverse_row_order&quot;,   packReverseRowOrder,      &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_standard_derivatives&quot;,       standardDerivatives,      &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_shader_texture_lod&quot;,         shaderTextureLOD,         &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_NV_shader_framebuffer_fetch&quot;,    NVshaderFramebufferFetch, &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ARM_shader_framebuffer_fetch&quot;,   ARMshaderFramebufferFetch,&amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_shader_framebuffer_fetch&quot;,   shaderFramebufferFetch,   &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_frag_depth&quot;,                 fragDepth,                &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_texture_usage&quot;,            textureUsage,             &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_ANGLE_translated_shader_source&quot;, translatedShaderSource,   &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_OES_fbo_render_mipmap&quot;,          fboRenderMipmap,          &amp;extensionStrings);
+    InsertExtensionString(&quot;GL_EXT_color_buffer_float&quot;,         colorBufferFloat,         &amp;extensionStrings);
+
+    return extensionStrings;
+}
+
+static bool GetFormatSupport(const TextureCapsMap &amp;textureCaps, const std::vector&lt;GLenum&gt; &amp;requiredFormats,
+                             bool requiresTexturing, bool requiresFiltering, bool requiresRendering)
+{
+    for (size_t i = 0; i &lt; requiredFormats.size(); i++)
+    {
+        const TextureCaps &amp;cap = textureCaps.get(requiredFormats[i]);
+
+        if (requiresTexturing &amp;&amp; !cap.texturable)
+        {
+            return false;
+        }
+
+        if (requiresFiltering &amp;&amp; !cap.filterable)
+        {
+            return false;
+        }
+
+        if (requiresRendering &amp;&amp; !cap.renderable)
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+// Checks for GL_OES_rgb8_rgba8 support
+static bool DetermineRGB8AndRGBA8TextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_RGB8);
+    requiredFormats.push_back(GL_RGBA8);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
+}
+
+// Checks for GL_EXT_texture_format_BGRA8888 support
+static bool DetermineBGRA8TextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_BGRA8_EXT);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
+}
+
+// Checks for GL_OES_texture_half_float support
+static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_RGB16F);
+    requiredFormats.push_back(GL_RGBA16F);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
+}
+
+// Checks for GL_OES_texture_half_float_linear support
+static bool DetermineHalfFloatTextureFilteringSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_RGB16F);
+    requiredFormats.push_back(GL_RGBA16F);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
+}
+
+// Checks for GL_OES_texture_float support
+static bool DetermineFloatTextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_RGB32F);
+    requiredFormats.push_back(GL_RGBA32F);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
+}
+
+// Checks for GL_OES_texture_float_linear support
+static bool DetermineFloatTextureFilteringSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_RGB32F);
+    requiredFormats.push_back(GL_RGBA32F);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
+}
+
+// Checks for GL_EXT_texture_rg support
+static bool DetermineRGTextureSupport(const TextureCapsMap &amp;textureCaps, bool checkHalfFloatFormats, bool checkFloatFormats)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_R8);
+    requiredFormats.push_back(GL_RG8);
+    if (checkHalfFloatFormats)
+    {
+        requiredFormats.push_back(GL_R16F);
+        requiredFormats.push_back(GL_RG16F);
+    }
+    if (checkFloatFormats)
+    {
+        requiredFormats.push_back(GL_R32F);
+        requiredFormats.push_back(GL_RG32F);
+    }
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
+}
+
+// Check for GL_EXT_texture_compression_dxt1
+static bool DetermineDXT1TextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
+    requiredFormats.push_back(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
+}
+
+// Check for GL_ANGLE_texture_compression_dxt3
+static bool DetermineDXT3TextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
+}
+
+// Check for GL_ANGLE_texture_compression_dxt5
+static bool DetermineDXT5TextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, false);
+}
+
+// Check for GL_ANGLE_texture_compression_dxt5
+static bool DetermineSRGBTextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFilterFormats;
+    requiredFilterFormats.push_back(GL_SRGB8);
+    requiredFilterFormats.push_back(GL_SRGB8_ALPHA8);
+
+    std::vector&lt;GLenum&gt; requiredRenderFormats;
+    requiredRenderFormats.push_back(GL_SRGB8_ALPHA8);
+
+    return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false) &amp;&amp;
+           GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true);
+}
+
+// Check for GL_ANGLE_depth_texture
+static bool DetermineDepthTextureSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_DEPTH_COMPONENT16);
+    requiredFormats.push_back(GL_DEPTH_COMPONENT32_OES);
+    requiredFormats.push_back(GL_DEPTH24_STENCIL8_OES);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, true, true);
+}
+
+// Check for GL_EXT_color_buffer_float
+static bool DetermineColorBufferFloatSupport(const TextureCapsMap &amp;textureCaps)
+{
+    std::vector&lt;GLenum&gt; requiredFormats;
+    requiredFormats.push_back(GL_R16F);
+    requiredFormats.push_back(GL_RG16F);
+    requiredFormats.push_back(GL_RGBA16F);
+    requiredFormats.push_back(GL_R32F);
+    requiredFormats.push_back(GL_RG32F);
+    requiredFormats.push_back(GL_RGBA32F);
+    requiredFormats.push_back(GL_R11F_G11F_B10F);
+
+    return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
+}
+
+void Extensions::setTextureExtensionSupport(const TextureCapsMap &amp;textureCaps)
+{
+    rgb8rgba8 = DetermineRGB8AndRGBA8TextureSupport(textureCaps);
+    textureFormatBGRA8888 = DetermineBGRA8TextureSupport(textureCaps);
+    textureHalfFloat = DetermineHalfFloatTextureSupport(textureCaps);
+    textureHalfFloatLinear = DetermineHalfFloatTextureFilteringSupport(textureCaps);
+    textureFloat = DetermineFloatTextureSupport(textureCaps);
+    textureFloatLinear = DetermineFloatTextureFilteringSupport(textureCaps);
+    textureRG = DetermineRGTextureSupport(textureCaps, textureHalfFloat, textureFloat);
+    textureCompressionDXT1 = DetermineDXT1TextureSupport(textureCaps);
+    textureCompressionDXT3 = DetermineDXT3TextureSupport(textureCaps);
+    textureCompressionDXT5 = DetermineDXT5TextureSupport(textureCaps);
+    sRGB = DetermineSRGBTextureSupport(textureCaps);
+    depthTextures = DetermineDepthTextureSupport(textureCaps);
+    colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
+}
+
+TypePrecision::TypePrecision()
+{
+    range[0] = 0;
+    range[1] = 0;
+    precision = 0;
+}
+
+void TypePrecision::setIEEEFloat()
+{
+    range[0] = 127;
+    range[1] = 127;
+    precision = 23;
+}
+
+void TypePrecision::setTwosComplementInt(unsigned int bits)
+{
+    range[0] = GLint(bits) - 1;
+    range[1] = GLint(bits) - 2;
+    precision = 0;
+}
+
+void TypePrecision::setSimulatedInt(unsigned int r)
+{
+    range[0] = GLint(r);
+    range[1] = GLint(r);
+    precision = 0;
+}
+
+void TypePrecision::get(GLint *returnRange, GLint *returnPrecision) const
+{
+    returnRange[0] = range[0];
+    returnRange[1] = range[1];
+    *returnPrecision = precision;
+}
+
+Caps::Caps()
+    : maxElementIndex(0),
+      max3DTextureSize(0),
+      max2DTextureSize(0),
+      maxArrayTextureLayers(0),
+      maxLODBias(0),
+      maxCubeMapTextureSize(0),
+      maxRenderbufferSize(0),
+      maxDrawBuffers(0),
+      maxColorAttachments(0),
+      maxViewportWidth(0),
+      maxViewportHeight(0),
+      minAliasedPointSize(0),
+      maxAliasedPointSize(0),
+      minAliasedLineWidth(0),
+      // Table 6.29
+      maxElementsIndices(0),
+      maxElementsVertices(0),
+      maxServerWaitTimeout(0),
+      // Table 6.31
+      maxVertexAttributes(0),
+      maxVertexUniformComponents(0),
+      maxVertexUniformVectors(0),
+      maxVertexUniformBlocks(0),
+      maxVertexOutputComponents(0),
+      maxVertexTextureImageUnits(0),
+      // Table 6.32
+      maxFragmentUniformComponents(0),
+      maxFragmentUniformVectors(0),
+      maxFragmentUniformBlocks(0),
+      maxFragmentInputComponents(0),
+      maxTextureImageUnits(0),
+      minProgramTexelOffset(0),
+      maxProgramTexelOffset(0),
+      // Table 6.33
+      maxUniformBufferBindings(0),
+      maxUniformBlockSize(0),
+      uniformBufferOffsetAlignment(0),
+      maxCombinedUniformBlocks(0),
+      maxCombinedVertexUniformComponents(0),
+      maxCombinedFragmentUniformComponents(0),
+      maxVaryingComponents(0),
+      maxVaryingVectors(0),
+      maxCombinedTextureImageUnits(0),
+      // Table 6.34
+      maxTransformFeedbackInterleavedComponents(0),
+      maxTransformFeedbackSeparateAttributes(0),
+      maxTransformFeedbackSeparateComponents(0),
+      // Table 6.35
+      maxSamples(0)
+{
+}
+
+}
+
+namespace egl
+{
+
+Caps::Caps()
+    : textureNPOT(false)
+{
+}
+
+DisplayExtensions::DisplayExtensions()
+    : createContextRobustness(false),
+      d3dShareHandleClientBuffer(false),
+      surfaceD3DTexture2DShareHandle(false),
+      querySurfacePointer(false),
+      windowFixedSize(false),
+      postSubBuffer(false),
+      createContext(false),
+      deviceQuery(false)
+{
+}
+
+std::vector&lt;std::string&gt; DisplayExtensions::getStrings() const
+{
+    std::vector&lt;std::string&gt; extensionStrings;
+
+    //                   | Extension name                                 | Supported flag                | Output vector   |
+    InsertExtensionString(&quot;EGL_EXT_create_context_robustness&quot;,             createContextRobustness,        &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_ANGLE_d3d_share_handle_client_buffer&quot;,      d3dShareHandleClientBuffer,     &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_ANGLE_surface_d3d_texture_2d_share_handle&quot;, surfaceD3DTexture2DShareHandle, &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_ANGLE_query_surface_pointer&quot;,               querySurfacePointer,            &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_ANGLE_window_fixed_size&quot;,                   windowFixedSize,                &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_NV_post_sub_buffer&quot;,                        postSubBuffer,                  &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_KHR_create_context&quot;,                        createContext,                  &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_EXT_device_query&quot;,                          deviceQuery,                    &amp;extensionStrings);
+
+    return extensionStrings;
+}
+
+DeviceExtensions::DeviceExtensions()
+    : deviceD3D(false)
+{
+}
+
+std::vector&lt;std::string&gt; DeviceExtensions::getStrings() const
+{
+    std::vector&lt;std::string&gt; extensionStrings;
+
+    //                   | Extension name                                 | Supported flag                | Output vector   |
+    InsertExtensionString(&quot;EGL_ANGLE_device_d3d&quot;,                          deviceD3D,                      &amp;extensionStrings);
+
+    return extensionStrings;
+}
+
+ClientExtensions::ClientExtensions()
+    : clientExtensions(false),
+      platformBase(false),
+      platformANGLE(false),
+      platformANGLED3D(false),
+      platformANGLEOpenGL(false)
+{
+}
+
+std::vector&lt;std::string&gt; ClientExtensions::getStrings() const
+{
+    std::vector&lt;std::string&gt; extensionStrings;
+
+    //                   | Extension name                   | Supported flag     | Output vector   |
+    InsertExtensionString(&quot;EGL_EXT_client_extensions&quot;,       clientExtensions,    &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_EXT_platform_base&quot;,           platformBase,        &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_ANGLE_platform_angle&quot;,        platformANGLE,       &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_ANGLE_platform_angle_d3d&quot;,    platformANGLED3D,    &amp;extensionStrings);
+    InsertExtensionString(&quot;EGL_ANGLE_platform_angle_opengl&quot;, platformANGLEOpenGL, &amp;extensionStrings);
+
+    return extensionStrings;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLECapsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Caps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,394 @@
</span><ins>+//
+// Copyright (c) 2014 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 LIBANGLE_CAPS_H_
+#define LIBANGLE_CAPS_H_
+
+#include &quot;angle_gl.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &lt;map&gt;
+#include &lt;set&gt;
+#include &lt;string&gt;
+#include &lt;vector&gt;
+
+namespace gl
+{
+
+typedef std::set&lt;GLuint&gt; SupportedSampleSet;
+
+struct TextureCaps
+{
+    TextureCaps();
+
+    // Supports for basic texturing: glTexImage, glTexSubImage, etc
+    bool texturable;
+
+    // Support for linear or anisotropic filtering
+    bool filterable;
+
+    // Support for being used as a framebuffer attachment or renderbuffer format
+    bool renderable;
+
+    // Set of supported sample counts, only guaranteed to be valid in ES3.
+    SupportedSampleSet sampleCounts;
+
+    // Get the maximum number of samples supported
+    GLuint getMaxSamples() const;
+
+    // Get the number of supported samples that is at least as many as requested.  Returns 0 if
+    // there are no sample counts available
+    GLuint getNearestSamples(GLuint requestedSamples) const;
+};
+
+class TextureCapsMap
+{
+  public:
+    typedef std::map&lt;GLenum, TextureCaps&gt;::const_iterator const_iterator;
+
+    void insert(GLenum internalFormat, const TextureCaps &amp;caps);
+    void remove(GLenum internalFormat);
+
+    const TextureCaps &amp;get(GLenum internalFormat) const;
+
+    const_iterator begin() const;
+    const_iterator end() const;
+
+    size_t size() const;
+
+  private:
+    typedef std::map&lt;GLenum, TextureCaps&gt; InternalFormatToCapsMap;
+    InternalFormatToCapsMap mCapsMap;
+};
+
+struct Extensions
+{
+    Extensions();
+
+    // Generate a vector of supported extension strings
+    std::vector&lt;std::string&gt; getStrings() const;
+
+    // Set all texture related extension support based on the supported textures.
+    // Determines support for:
+    // GL_OES_rgb8_rgba8
+    // GL_EXT_texture_format_BGRA8888
+    // GL_OES_texture_half_float, GL_OES_texture_half_float_linear
+    // GL_OES_texture_float, GL_OES_texture_float_linear
+    // GL_EXT_texture_rg
+    // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3, GL_ANGLE_texture_compression_dxt5
+    // GL_EXT_sRGB
+    // GL_ANGLE_depth_texture
+    // GL_EXT_color_buffer_float
+    void setTextureExtensionSupport(const TextureCapsMap &amp;textureCaps);
+
+    // ES2 Extension support
+
+    // GL_OES_element_index_uint
+    bool elementIndexUint;
+
+    // GL_OES_packed_depth_stencil
+    bool packedDepthStencil;
+
+    // GL_OES_get_program_binary
+    bool getProgramBinary;
+
+    // GL_OES_rgb8_rgba8
+    // Implies that TextureCaps for GL_RGB8 and GL_RGBA8 exist
+    bool rgb8rgba8;
+
+    // GL_EXT_texture_format_BGRA8888
+    // Implies that TextureCaps for GL_BGRA8 exist
+    bool textureFormatBGRA8888;
+
+    // GL_EXT_read_format_bgra
+    bool readFormatBGRA;
+
+    // GL_NV_pixel_buffer_object
+    bool pixelBufferObject;
+
+    // GL_OES_mapbuffer and GL_EXT_map_buffer_range
+    bool mapBuffer;
+    bool mapBufferRange;
+
+    // GL_OES_texture_half_float and GL_OES_texture_half_float_linear
+    // Implies that TextureCaps for GL_RGB16F, GL_RGBA16F, GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT and
+    // GL_LUMINANCE_ALPHA32F_EXT exist
+    bool textureHalfFloat;
+    bool textureHalfFloatLinear;
+
+    // GL_OES_texture_float and GL_OES_texture_float_linear
+    // Implies that TextureCaps for GL_RGB32F, GL_RGBA32F, GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT and
+    // GL_LUMINANCE_ALPHA16F_EXT exist
+    bool textureFloat;
+    bool textureFloatLinear;
+
+    // GL_EXT_texture_rg
+    // Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if floating point extensions
+    // are also present) exist
+    bool textureRG;
+
+    // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and GL_ANGLE_texture_compression_dxt5
+    // Implies that TextureCaps for GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
+    // GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE and GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE
+    bool textureCompressionDXT1;
+    bool textureCompressionDXT3;
+    bool textureCompressionDXT5;
+
+    // GL_EXT_sRGB
+    // Implies that TextureCaps for GL_SRGB8_ALPHA8 and GL_SRGB8 exist
+    // TODO: Don't advertise this extension in ES3
+    bool sRGB;
+
+    // GL_ANGLE_depth_texture
+    bool depthTextures;
+
+    // GL_EXT_texture_storage
+    bool textureStorage;
+
+    // GL_OES_texture_npot
+    bool textureNPOT;
+
+    // GL_EXT_draw_buffers
+    bool drawBuffers;
+
+    // GL_EXT_texture_filter_anisotropic
+    bool textureFilterAnisotropic;
+    GLfloat maxTextureAnisotropy;
+
+    // GL_EXT_occlusion_query_boolean
+    bool occlusionQueryBoolean;
+
+    // GL_NV_fence
+    bool fence;
+
+    // GL_ANGLE_timer_query
+    bool timerQuery;
+
+    // GL_EXT_robustness
+    bool robustness;
+
+    // GL_EXT_blend_minmax
+    bool blendMinMax;
+
+    // GL_ANGLE_framebuffer_blit
+    bool framebufferBlit;
+
+    // GL_ANGLE_framebuffer_multisample
+    bool framebufferMultisample;
+
+    // GL_ANGLE_instanced_arrays
+    bool instancedArrays;
+
+    // GL_ANGLE_pack_reverse_row_order
+    bool packReverseRowOrder;
+
+    // GL_OES_standard_derivatives
+    bool standardDerivatives;
+
+    // GL_EXT_shader_texture_lod
+    bool shaderTextureLOD;
+
+    // GL_EXT_shader_framebuffer_fetch
+    bool shaderFramebufferFetch;
+
+    // GL_ARM_shader_framebuffer_fetch
+    bool ARMshaderFramebufferFetch;
+
+    // GL_NV_shader_framebuffer_fetch
+    bool NVshaderFramebufferFetch;
+
+    // GL_EXT_frag_depth
+    bool fragDepth;
+
+    // GL_ANGLE_texture_usage
+    bool textureUsage;
+
+    // GL_ANGLE_translated_shader_source
+    bool translatedShaderSource;
+
+    // GL_OES_fbo_render_mipmap
+    bool fboRenderMipmap;
+
+    // ES3 Extension support
+
+    // GL_EXT_color_buffer_float
+    bool colorBufferFloat;
+};
+
+struct TypePrecision
+{
+    TypePrecision();
+
+    void setIEEEFloat();
+    void setTwosComplementInt(unsigned int bits);
+    void setSimulatedInt(unsigned int range);
+
+    void get(GLint *returnRange, GLint *returnPrecision) const;
+
+    GLint range[2];
+    GLint precision;
+};
+
+struct Caps
+{
+    Caps();
+
+    // Table 6.28, implementation dependent values
+    GLuint64 maxElementIndex;
+    GLuint max3DTextureSize;
+    GLuint max2DTextureSize;
+    GLuint maxArrayTextureLayers;
+    GLfloat maxLODBias;
+    GLuint maxCubeMapTextureSize;
+    GLuint maxRenderbufferSize;
+    GLuint maxDrawBuffers;
+    GLuint maxColorAttachments;
+    GLuint maxViewportWidth;
+    GLuint maxViewportHeight;
+    GLfloat minAliasedPointSize;
+    GLfloat maxAliasedPointSize;
+    GLfloat minAliasedLineWidth;
+    GLfloat maxAliasedLineWidth;
+
+    // Table 6.29, implementation dependent values (cont.)
+    GLuint maxElementsIndices;
+    GLuint maxElementsVertices;
+    std::vector&lt;GLenum&gt; compressedTextureFormats;
+    std::vector&lt;GLenum&gt; programBinaryFormats;
+    std::vector&lt;GLenum&gt; shaderBinaryFormats;
+    TypePrecision vertexHighpFloat;
+    TypePrecision vertexMediumpFloat;
+    TypePrecision vertexLowpFloat;
+    TypePrecision vertexHighpInt;
+    TypePrecision vertexMediumpInt;
+    TypePrecision vertexLowpInt;
+    TypePrecision fragmentHighpFloat;
+    TypePrecision fragmentMediumpFloat;
+    TypePrecision fragmentLowpFloat;
+    TypePrecision fragmentHighpInt;
+    TypePrecision fragmentMediumpInt;
+    TypePrecision fragmentLowpInt;
+    GLuint64 maxServerWaitTimeout;
+
+    // Table 6.31, implementation dependent vertex shader limits
+    GLuint maxVertexAttributes;
+    GLuint maxVertexUniformComponents;
+    GLuint maxVertexUniformVectors;
+    GLuint maxVertexUniformBlocks;
+    GLuint maxVertexOutputComponents;
+    GLuint maxVertexTextureImageUnits;
+
+    // Table 6.32, implementation dependent fragment shader limits
+    GLuint maxFragmentUniformComponents;
+    GLuint maxFragmentUniformVectors;
+    GLuint maxFragmentUniformBlocks;
+    GLuint maxFragmentInputComponents;
+    GLuint maxTextureImageUnits;
+    GLint minProgramTexelOffset;
+    GLint maxProgramTexelOffset;
+
+    // Table 6.33, implementation dependent aggregate shader limits
+    GLuint maxUniformBufferBindings;
+    GLuint64 maxUniformBlockSize;
+    GLuint uniformBufferOffsetAlignment;
+    GLuint maxCombinedUniformBlocks;
+    GLuint64 maxCombinedVertexUniformComponents;
+    GLuint64 maxCombinedFragmentUniformComponents;
+    GLuint maxVaryingComponents;
+    GLuint maxVaryingVectors;
+    GLuint maxCombinedTextureImageUnits;
+
+    // Table 6.34, implementation dependent transform feedback limits
+    GLuint maxTransformFeedbackInterleavedComponents;
+    GLuint maxTransformFeedbackSeparateAttributes;
+    GLuint maxTransformFeedbackSeparateComponents;
+
+    // Table 6.35, Framebuffer Dependent Values
+    GLuint maxSamples;
+};
+
+}
+
+namespace egl
+{
+
+struct Caps
+{
+    Caps();
+
+    // Support for NPOT surfaces
+    bool textureNPOT;
+};
+
+struct DisplayExtensions
+{
+    DisplayExtensions();
+
+    // Generate a vector of supported extension strings
+    std::vector&lt;std::string&gt; getStrings() const;
+
+    // EGL_EXT_create_context_robustness
+    bool createContextRobustness;
+
+    // EGL_ANGLE_d3d_share_handle_client_buffer
+    bool d3dShareHandleClientBuffer;
+
+    // EGL_ANGLE_surface_d3d_texture_2d_share_handle
+    bool surfaceD3DTexture2DShareHandle;
+
+    // EGL_ANGLE_query_surface_pointer
+    bool querySurfacePointer;
+
+    // EGL_ANGLE_window_fixed_size
+    bool windowFixedSize;
+
+    // EGL_NV_post_sub_buffer
+    bool postSubBuffer;
+
+    // EGL_KHR_create_context
+    bool createContext;
+
+    // EGL_EXT_device_query
+    bool deviceQuery;
+};
+
+struct DeviceExtensions
+{
+    DeviceExtensions();
+
+    // Generate a vector of supported extension strings
+    std::vector&lt;std::string&gt; getStrings() const;
+
+    // EGL_ANGLE_device_d3d
+    bool deviceD3D;
+};
+
+struct ClientExtensions
+{
+    ClientExtensions();
+
+    // Generate a vector of supported extension strings
+    std::vector&lt;std::string&gt; getStrings() const;
+
+    // EGL_EXT_client_extensions
+    bool clientExtensions;
+
+    // EGL_EXT_platform_base
+    bool platformBase;
+
+    // EGL_ANGLE_platform_angle
+    bool platformANGLE;
+
+    // EGL_ANGLE_platform_angle_d3d
+    bool platformANGLED3D;
+
+    // EGL_ANGLE_platform_angle_opengl
+    bool platformANGLEOpenGL;
+};
+
+}
+
+#endif // LIBANGLE_CAPS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLECompilercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// Compiler.cpp: implements the gl::Compiler class.
+
+#include &quot;libANGLE/Compiler.h&quot;
+#include &quot;libANGLE/renderer/CompilerImpl.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace gl
+{
+
+Compiler::Compiler(rx::CompilerImpl *impl)
+    : mCompiler(impl)
+{
+    ASSERT(mCompiler);
+}
+
+Compiler::~Compiler()
+{
+    SafeDelete(mCompiler);
+}
+
+Error Compiler::release()
+{
+    return mCompiler-&gt;release();
+}
+
+rx::CompilerImpl *Compiler::getImplementation()
+{
+    return mCompiler;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLECompilerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Compiler.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// Compiler.h: Defines the gl::Compiler class, abstracting the ESSL compiler
+// that a GL context holds.
+
+#ifndef LIBANGLE_COMPILER_H_
+#define LIBANGLE_COMPILER_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+namespace rx
+{
+class CompilerImpl;
+}
+
+namespace gl
+{
+
+class Compiler final
+{
+  public:
+    explicit Compiler(rx::CompilerImpl *impl);
+    ~Compiler();
+
+    Error release();
+
+    rx::CompilerImpl *getImplementation();
+
+  private:
+    rx::CompilerImpl *mCompiler;
+};
+
+}
+
+#endif // LIBANGLE_COMPILER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEConfigcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,275 @@
</span><ins>+//
+// 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.5] section 3.4 page 19.
+
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/AttributeMap.h&quot;
+
+#include &lt;algorithm&gt;
+#include &lt;vector&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &lt;EGL/eglext.h&gt;
+
+#include &quot;common/debug.h&quot;
+
+namespace egl
+{
+
+Config::Config()
+    : renderTargetFormat(GL_NONE),
+      depthStencilFormat(GL_NONE),
+      bufferSize(0),
+      redSize(0),
+      greenSize(0),
+      blueSize(0),
+      luminanceSize(0),
+      alphaSize(0),
+      alphaMaskSize(0),
+      bindToTextureRGB(EGL_FALSE),
+      bindToTextureRGBA(EGL_FALSE),
+      colorBufferType(EGL_NONE),
+      configCaveat(EGL_NONE),
+      configID(0),
+      conformant(0),
+      depthSize(0),
+      level(0),
+      matchNativePixmap(EGL_FALSE),
+      maxPBufferWidth(0),
+      maxPBufferHeight(0),
+      maxPBufferPixels(0),
+      maxSwapInterval(0),
+      minSwapInterval(0),
+      nativeRenderable(EGL_FALSE),
+      nativeVisualID(0),
+      nativeVisualType(0),
+      renderableType(0),
+      sampleBuffers(0),
+      samples(0),
+      stencilSize(0),
+      surfaceType(0),
+      transparentType(EGL_NONE),
+      transparentRedValue(0),
+      transparentGreenValue(0),
+      transparentBlueValue(0)
+{
+}
+
+EGLint ConfigSet::add(const Config &amp;config)
+{
+    // Set the config's ID to a small number that starts at 1 ([EGL 1.5] section 3.4)
+    EGLint id = static_cast&lt;EGLint&gt;(mConfigs.size() + 1);
+
+    Config copyConfig(config);
+    copyConfig.configID = id;
+    mConfigs.insert(std::make_pair(id, copyConfig));
+
+    return id;
+}
+
+const Config &amp;ConfigSet::get(EGLint id) const
+{
+    ASSERT(mConfigs.find(id) != mConfigs.end());
+    return mConfigs.find(id)-&gt;second;
+}
+
+void ConfigSet::clear()
+{
+    mConfigs.clear();
+}
+
+size_t ConfigSet::size() const
+{
+    return mConfigs.size();
+}
+
+bool ConfigSet::contains(const Config *config) const
+{
+    for (auto i = mConfigs.begin(); i != mConfigs.end(); i++)
+    {
+        const Config &amp;item = i-&gt;second;
+        if (config == &amp;item)
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+// Function object used by STL sorting routines for ordering Configs according to [EGL 1.5] section 3.4.1.2 page 28.
+class ConfigSorter
+{
+  public:
+    explicit ConfigSorter(const AttributeMap &amp;attributeMap)
+        : mWantRed(false),
+          mWantGreen(false),
+          mWantBlue(false),
+          mWantAlpha(false),
+          mWantLuminance(false)
+    {
+        scanForWantedComponents(attributeMap);
+    }
+
+    bool operator()(const Config *x, const Config *y) const
+    {
+        return (*this)(*x, *y);
+    }
+
+    bool operator()(const Config &amp;x, const Config &amp;y) const
+    {
+        #define SORT(attribute)                        \
+            if (x.attribute != y.attribute)            \
+            {                                          \
+                return x.attribute &lt; y.attribute;      \
+            }
+
+        static_assert(EGL_NONE &lt; EGL_SLOW_CONFIG &amp;&amp; EGL_SLOW_CONFIG &lt; EGL_NON_CONFORMANT_CONFIG, &quot;Unexpected EGL enum value.&quot;);
+        SORT(configCaveat);
+
+        static_assert(EGL_RGB_BUFFER &lt; EGL_LUMINANCE_BUFFER, &quot;Unexpected EGL enum value.&quot;);
+        SORT(colorBufferType);
+
+        // By larger total number of color bits, only considering those that are requested to be &gt; 0.
+        EGLint xComponentsSize = wantedComponentsSize(x);
+        EGLint yComponentsSize = wantedComponentsSize(y);
+        if (xComponentsSize != yComponentsSize)
+        {
+            return xComponentsSize &gt; yComponentsSize;
+        }
+
+        SORT(bufferSize);
+        SORT(sampleBuffers);
+        SORT(samples);
+        SORT(depthSize);
+        SORT(stencilSize);
+        SORT(alphaMaskSize);
+        SORT(nativeVisualType);
+        SORT(configID);
+
+        #undef SORT
+
+        return false;
+    }
+
+  private:
+    void scanForWantedComponents(const AttributeMap &amp;attributeMap)
+    {
+        // [EGL 1.5] section 3.4.1.2 page 30
+        // Sorting rule #3: by larger total number of color bits, not considering
+        // components that are 0 or don't-care.
+        for (auto attribIter = attributeMap.begin(); attribIter != attributeMap.end(); attribIter++)
+        {
+            EGLint attributeKey = attribIter-&gt;first;
+            EGLint attributeValue = attribIter-&gt;second;
+            if (attributeKey != 0 &amp;&amp; attributeValue != EGL_DONT_CARE)
+            {
+                switch (attributeKey)
+                {
+                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 wantedComponentsSize(const Config &amp;config) const
+    {
+        EGLint total = 0;
+
+        if (mWantRed)       total += config.redSize;
+        if (mWantGreen)     total += config.greenSize;
+        if (mWantBlue)      total += config.blueSize;
+        if (mWantAlpha)     total += config.alphaSize;
+        if (mWantLuminance) total += config.luminanceSize;
+
+        return total;
+    }
+
+    bool mWantRed;
+    bool mWantGreen;
+    bool mWantBlue;
+    bool mWantAlpha;
+    bool mWantLuminance;
+};
+
+std::vector&lt;const Config*&gt; ConfigSet::filter(const AttributeMap &amp;attributeMap) const
+{
+    std::vector&lt;const Config*&gt; result;
+    result.reserve(mConfigs.size());
+
+    for (auto configIter = mConfigs.begin(); configIter != mConfigs.end(); configIter++)
+    {
+        const Config &amp;config = configIter-&gt;second;
+        bool match = true;
+
+        for (auto attribIter = attributeMap.begin(); attribIter != attributeMap.end(); attribIter++)
+        {
+            EGLint attributeKey = attribIter-&gt;first;
+            EGLint attributeValue = attribIter-&gt;second;
+
+            switch (attributeKey)
+            {
+              case EGL_BUFFER_SIZE:               match = config.bufferSize &gt;= attributeValue;                        break;
+              case EGL_ALPHA_SIZE:                match = config.alphaSize &gt;= attributeValue;                         break;
+              case EGL_BLUE_SIZE:                 match = config.blueSize &gt;= attributeValue;                          break;
+              case EGL_GREEN_SIZE:                match = config.greenSize &gt;= attributeValue;                         break;
+              case EGL_RED_SIZE:                  match = config.redSize &gt;= attributeValue;                           break;
+              case EGL_DEPTH_SIZE:                match = config.depthSize &gt;= attributeValue;                         break;
+              case EGL_STENCIL_SIZE:              match = config.stencilSize &gt;= attributeValue;                       break;
+              case EGL_CONFIG_CAVEAT:             match = config.configCaveat == (EGLenum)attributeValue;             break;
+              case EGL_CONFIG_ID:                 match = config.configID == attributeValue;                          break;
+              case EGL_LEVEL:                     match = config.level &gt;= attributeValue;                             break;
+              case EGL_NATIVE_RENDERABLE:         match = config.nativeRenderable == (EGLBoolean)attributeValue;      break;
+              case EGL_NATIVE_VISUAL_TYPE:        match = config.nativeVisualType == attributeValue;                  break;
+              case EGL_SAMPLES:                   match = config.samples &gt;= attributeValue;                           break;
+              case EGL_SAMPLE_BUFFERS:            match = config.sampleBuffers &gt;= attributeValue;                     break;
+              case EGL_SURFACE_TYPE:              match = (config.surfaceType &amp; attributeValue) == attributeValue;    break;
+              case EGL_TRANSPARENT_TYPE:          match = config.transparentType == (EGLenum)attributeValue;          break;
+              case EGL_TRANSPARENT_BLUE_VALUE:    match = config.transparentBlueValue == attributeValue;              break;
+              case EGL_TRANSPARENT_GREEN_VALUE:   match = config.transparentGreenValue == attributeValue;             break;
+              case EGL_TRANSPARENT_RED_VALUE:     match = config.transparentRedValue == attributeValue;               break;
+              case EGL_BIND_TO_TEXTURE_RGB:       match = config.bindToTextureRGB == (EGLBoolean)attributeValue;      break;
+              case EGL_BIND_TO_TEXTURE_RGBA:      match = config.bindToTextureRGBA == (EGLBoolean)attributeValue;     break;
+              case EGL_MIN_SWAP_INTERVAL:         match = config.minSwapInterval == attributeValue;                   break;
+              case EGL_MAX_SWAP_INTERVAL:         match = config.maxSwapInterval == attributeValue;                   break;
+              case EGL_LUMINANCE_SIZE:            match = config.luminanceSize &gt;= attributeValue;                     break;
+              case EGL_ALPHA_MASK_SIZE:           match = config.alphaMaskSize &gt;= attributeValue;                     break;
+              case EGL_COLOR_BUFFER_TYPE:         match = config.colorBufferType == (EGLenum)attributeValue;          break;
+              case EGL_RENDERABLE_TYPE:           match = (config.renderableType &amp; attributeValue) == attributeValue; break;
+              case EGL_MATCH_NATIVE_PIXMAP:       match = false; UNIMPLEMENTED();                                     break;
+              case EGL_CONFORMANT:                match = (config.conformant &amp; attributeValue) == attributeValue;     break;
+              case EGL_MAX_PBUFFER_WIDTH:         match = config.maxPBufferWidth &gt;= attributeValue;                   break;
+              case EGL_MAX_PBUFFER_HEIGHT:        match = config.maxPBufferHeight &gt;= attributeValue;                  break;
+              case EGL_MAX_PBUFFER_PIXELS:        match = config.maxPBufferPixels &gt;= attributeValue;                  break;
+              default: UNREACHABLE();
+            }
+
+            if (!match)
+            {
+                break;
+            }
+        }
+
+        if (match)
+        {
+            result.push_back(&amp;config);
+        }
+    }
+
+    // Sort the result
+    std::sort(result.begin(), result.end(), ConfigSorter(attributeMap));
+
+    return result;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEConfigh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+//
+// 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.5] section 3.4 page 19.
+
+#ifndef INCLUDE_CONFIG_H_
+#define INCLUDE_CONFIG_H_
+
+#include &quot;libANGLE/AttributeMap.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;EGL/egl.h&gt;
+#include &lt;GLES2/gl2.h&gt;
+
+#include &lt;map&gt;
+#include &lt;vector&gt;
+
+namespace egl
+{
+
+struct Config
+{
+    Config();
+
+    GLenum renderTargetFormat;      // TODO(geofflang): remove this
+    GLenum depthStencilFormat;      // TODO(geofflang): remove this
+
+    EGLint bufferSize;              // Depth of the color buffer
+    EGLint redSize;                 // Bits of Red in the color buffer
+    EGLint greenSize;               // Bits of Green in the color buffer
+    EGLint blueSize;                // Bits of Blue in the color buffer
+    EGLint luminanceSize;           // Bits of Luminance in the color buffer
+    EGLint alphaSize;               // Bits of Alpha in the color buffer
+    EGLint alphaMaskSize;           // Bits of Alpha Mask in the mask buffer
+    EGLBoolean bindToTextureRGB;    // True if bindable to RGB textures.
+    EGLBoolean bindToTextureRGBA;   // True if bindable to RGBA textures.
+    EGLenum colorBufferType;        // Color buffer type
+    EGLenum configCaveat;           // Any caveats for the configuration
+    EGLint configID;                // Unique EGLConfig identifier
+    EGLint conformant;              // Whether contexts created with this config are conformant
+    EGLint depthSize;               // Bits of Z in the depth buffer
+    EGLint level;                   // Frame buffer level
+    EGLBoolean matchNativePixmap;   // Match the native pixmap format
+    EGLint maxPBufferWidth;         // Maximum width of pbuffer
+    EGLint maxPBufferHeight;        // Maximum height of pbuffer
+    EGLint maxPBufferPixels;        // Maximum size of pbuffer
+    EGLint maxSwapInterval;         // Maximum swap interval
+    EGLint minSwapInterval;         // Minimum swap interval
+    EGLBoolean nativeRenderable;    // EGL_TRUE if native rendering APIs can render to surface
+    EGLint nativeVisualID;          // Handle of corresponding native visual
+    EGLint nativeVisualType;        // Native visual type of the associated visual
+    EGLint renderableType;          // Which client rendering APIs are supported.
+    EGLint sampleBuffers;           // Number of multisample buffers
+    EGLint samples;                 // Number of samples per pixel
+    EGLint stencilSize;             // Bits of Stencil in the stencil buffer
+    EGLint surfaceType;             // Which types of EGL surfaces are supported.
+    EGLenum transparentType;        // Type of transparency supported
+    EGLint transparentRedValue;     // Transparent red value
+    EGLint transparentGreenValue;   // Transparent green value
+    EGLint transparentBlueValue;    // Transparent blue value
+};
+
+class ConfigSet
+{
+  public:
+    EGLint add(const Config &amp;config);
+    const Config &amp;get(EGLint id) const;
+
+    void clear();
+
+    size_t size() const;
+
+    bool contains(const Config *config) const;
+
+    // Filter configurations based on the table in [EGL 1.5] section 3.4.1.2 page 29
+    std::vector&lt;const Config*&gt; filter(const AttributeMap &amp;attributeMap) const;
+
+  private:
+    typedef std::map&lt;EGLint, const Config&gt; ConfigMap;
+    ConfigMap mConfigs;
+};
+
+}
+
+#endif   // INCLUDE_CONFIG_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEConfig_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Config_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,220 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+#include &quot;libANGLE/AttributeMap.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+
+// Create a generic, valid EGL config that can be modified to test sorting and
+// filtering routines
+static egl::Config GenerateGenericConfig()
+{
+    egl::Config config;
+
+    config.bufferSize = 24;
+    config.redSize = 8;
+    config.greenSize = 8;
+    config.blueSize = 8;
+    config.luminanceSize = 0;
+    config.alphaSize = 8;
+    config.alphaMaskSize = 0;
+    config.bindToTextureRGB = EGL_TRUE;
+    config.bindToTextureRGBA = EGL_TRUE;
+    config.colorBufferType = EGL_RGB_BUFFER;
+    config.configCaveat = EGL_NONE;
+    config.configID = 0;
+    config.conformant = EGL_OPENGL_ES2_BIT;
+    config.depthSize = 24;
+    config.level = 0;
+    config.matchNativePixmap = EGL_NONE;
+    config.maxPBufferWidth = 1024;
+    config.maxPBufferHeight = 1024;
+    config.maxPBufferPixels = config.maxPBufferWidth * config.maxPBufferWidth;
+    config.maxSwapInterval = 0;
+    config.minSwapInterval = 4;
+    config.nativeRenderable = EGL_OPENGL_ES2_BIT;
+    config.nativeVisualID = 0;
+    config.nativeVisualType = 0;
+    config.renderableType = EGL_FALSE;
+    config.sampleBuffers = 0;
+    config.samples = 0;
+    config.stencilSize = 8;
+    config.surfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+    config.transparentType = EGL_NONE;
+    config.transparentRedValue = 0;
+    config.transparentGreenValue = 0;
+    config.transparentBlueValue = 0;
+
+    return config;
+}
+
+static std::vector&lt;egl::Config&gt; GenerateUniqueConfigs(size_t count)
+{
+    std::vector&lt;egl::Config&gt; configs;
+
+    for (size_t i = 0; i &lt; count; i++)
+    {
+        egl::Config config = GenerateGenericConfig();
+        config.samples = i;
+        configs.push_back(config);
+    }
+
+    return configs;
+}
+
+// Add unique configs to a ConfigSet and expect that the size of the
+// set is equal to the number of configs added.
+TEST(ConfigSetTest, Size)
+{
+    egl::ConfigSet set;
+
+    std::vector&lt;egl::Config&gt; uniqueConfigs = GenerateUniqueConfigs(16);
+    for (size_t i = 0; i &lt; uniqueConfigs.size(); i++)
+    {
+        set.add(uniqueConfigs[i]);
+        EXPECT_EQ(set.size(), i + 1);
+    }
+}
+
+// [EGL 1.5] section 3.4:
+// EGL_CONFIG_ID is a unique integer identifying different EGLConfigs. Configuration IDs
+// must be small positive integers starting at 1 and ID assignment should be compact;
+// that is, if there are N EGLConfigs defined by the EGL implementation, their
+// configuration IDs should be in the range [1, N].
+TEST(ConfigSetTest, IDs)
+{
+    egl::ConfigSet set;
+
+    std::set&lt;EGLint&gt; ids;
+
+    std::vector&lt;egl::Config&gt; uniqueConfigs = GenerateUniqueConfigs(16);
+    for (size_t i = 0; i &lt; uniqueConfigs.size(); i++)
+    {
+        EGLint id = set.add(uniqueConfigs[i]);
+
+        // Check that the config that was inserted has the ID that was returned
+        // by ConfigSet::add
+        EXPECT_EQ(id, set.get(id).configID);
+
+        ids.insert(id);
+    }
+
+    // Verify configCount unique IDs
+    EXPECT_EQ(ids.size(), set.size());
+
+    // Check that there are no gaps and the IDs are in the range [1, N].
+    EXPECT_EQ(*std::min_element(ids.begin(), ids.end()), 1);
+    EXPECT_EQ(*std::max_element(ids.begin(), ids.end()), static_cast&lt;EGLint&gt;(set.size()));
+}
+
+TEST(ConfigSetTest, Filtering_BitSizes)
+{
+    egl::ConfigSet set;
+
+    struct VariableConfigBitSize
+    {
+        EGLint Name;
+        EGLint(egl::Config::*ConfigMember);
+    };
+
+    VariableConfigBitSize testMembers[] = 
+    {
+        { EGL_RED_SIZE,     &amp;egl::Config::redSize     },
+        { EGL_GREEN_SIZE,   &amp;egl::Config::greenSize   },
+        { EGL_BLUE_SIZE,    &amp;egl::Config::blueSize    },
+        { EGL_ALPHA_SIZE,   &amp;egl::Config::alphaSize   },
+        { EGL_DEPTH_SIZE,   &amp;egl::Config::depthSize   },
+        { EGL_STENCIL_SIZE, &amp;egl::Config::stencilSize },
+    };
+
+    // Generate configsPerType configs with varying bit sizes of each type
+    size_t configsPerType = 4;
+    for (size_t i = 0; i &lt; ArraySize(testMembers); i++)
+    {
+        for (size_t j = 0; j &lt; configsPerType; j++)
+        {
+            egl::Config config = GenerateGenericConfig();
+
+            // Set all the other tested members of this config to 0
+            for (size_t k = 0; k &lt; ArraySize(testMembers); k++)
+            {
+                config.*(testMembers[k].ConfigMember) = 0;
+            }
+
+            // Set the tested member of this config to i so it ranges from
+            // [1, configsPerType]
+            config.*(testMembers[i].ConfigMember) = j + 1;
+
+            set.add(config);
+        }
+    }
+
+    // for each tested member, filter by it's type and verify that the correct number
+    // of results are returned
+    for (size_t i = 0; i &lt; ArraySize(testMembers); i++)
+    {
+        // Start with a filter of 1 to not grab the other members
+        for (size_t j = 0; j &lt; configsPerType; j++)
+        {
+            egl::AttributeMap filter;
+            filter.insert(testMembers[i].Name, j + 1);
+
+            std::vector&lt;const egl::Config *&gt; filteredConfigs = set.filter(filter);
+
+            EXPECT_EQ(filteredConfigs.size(), configsPerType - j);
+        }
+    }
+}
+
+// Verify the sorting, [EGL 1.5] section 3.4.1.2 pg 30:
+// [configs are sorted] by larger total number of color bits (for an RGB
+// color buffer this is the sum of EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE,
+// and EGL_ALPHA_SIZE; for a luminance color buffer, the sum of EGL_LUMINANCE_SIZE
+// and EGL_ALPHA_SIZE).If the requested number of bits in attrib list for a
+// particular color component is 0 or EGL_DONT_CARE, then the number of bits
+// for that component is not considered.
+TEST(ConfigSetTest, Sorting_BitSizes)
+{
+    egl::ConfigSet set;
+    size_t testConfigCount = 64;
+    for (size_t i = 0; i &lt; testConfigCount; i++)
+    {
+        egl::Config config = GenerateGenericConfig();
+
+        // Give random-ish bit sizes to the config
+        config.redSize =   (i *  2) %  3;
+        config.greenSize = (i +  5) %  7;
+        config.blueSize =  (i +  7) % 11;
+        config.alphaSize = (i + 13) % 17;
+
+        set.add(config);
+    }
+
+    egl::AttributeMap greaterThan1BitFilter;
+    greaterThan1BitFilter.insert(EGL_RED_SIZE, 1);
+    greaterThan1BitFilter.insert(EGL_GREEN_SIZE, 1);
+    greaterThan1BitFilter.insert(EGL_BLUE_SIZE, 1);
+    greaterThan1BitFilter.insert(EGL_ALPHA_SIZE, 1);
+
+    std::vector&lt;const egl::Config *&gt; filteredConfigs = set.filter(greaterThan1BitFilter);
+    for (size_t i = 1; i &lt; filteredConfigs.size(); i++)
+    {
+        const egl::Config &amp;prevConfig = *filteredConfigs[i - 1];
+        size_t prevBitCount = prevConfig.redSize +
+                              prevConfig.greenSize +
+                              prevConfig.blueSize +
+                              prevConfig.alphaSize;
+
+        const egl::Config &amp;curConfig = *filteredConfigs[i];
+        size_t curBitCount = curConfig.redSize +
+                             curConfig.greenSize +
+                             curConfig.blueSize +
+                             curConfig.alphaSize;
+
+        EXPECT_GE(prevBitCount, curBitCount);
+    }
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEConstantsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Constants.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Contants.h: Defines some implementation specific and gl constants
+
+#ifndef LIBANGLE_CONSTANTS_H_
+#define LIBANGLE_CONSTANTS_H_
+
+namespace gl
+{
+
+enum
+{
+    MAX_VERTEX_ATTRIBS = 16,
+
+    // Implementation upper limits, real maximums depend on the hardware
+    IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
+    IMPLEMENTATION_MAX_DRAW_BUFFERS = 8,
+    IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS = IMPLEMENTATION_MAX_DRAW_BUFFERS + 2, // 2 extra for depth and/or stencil buffers
+
+    IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS = 16,
+    IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
+    IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS = IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS +
+                                                         IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS,
+
+    IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS = 4,
+
+    // 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_2D_TEXTURE_SIZE = 16384,
+    IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
+    IMPLEMENTATION_MAX_3D_TEXTURE_SIZE = 2048,
+    IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
+
+    IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15   // 1+log2 of MAX_TEXTURE_SIZE
+};
+
+}
+
+#endif // LIBANGLE_CONSTANTS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEContextcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1602 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/Context.h&quot;
+
+#include &lt;iterator&gt;
+#include &lt;sstream&gt;
+
+#include &quot;common/platform.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Compiler.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Fence.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Query.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/ResourceManager.h&quot;
+#include &quot;libANGLE/Sampler.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/TransformFeedback.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/validationES.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+namespace gl
+{
+
+Context::Context(const egl::Config *config, int clientVersion, const Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
+    : mRenderer(renderer),
+      mData(clientVersion, mState, mCaps, mTextureCaps, mExtensions, nullptr)
+{
+    ASSERT(robustAccess == false);   // Unimplemented
+
+    initCaps(clientVersion);
+    mState.initialize(mCaps, clientVersion);
+
+    mClientVersion = clientVersion;
+
+    mConfigID = config-&gt;configID;
+    mClientType = EGL_OPENGL_ES_API;
+
+    mFenceNVHandleAllocator.setBaseHandle(0);
+
+    if (shareContext != NULL)
+    {
+        mResourceManager = shareContext-&gt;mResourceManager;
+        mResourceManager-&gt;addRef();
+    }
+    else
+    {
+        mResourceManager = new ResourceManager(mRenderer);
+    }
+
+    mData.resourceManager = mResourceManager;
+
+    // [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.
+
+    Texture *zeroTexture2D = new Texture(mRenderer-&gt;createTexture(GL_TEXTURE_2D), 0, GL_TEXTURE_2D);
+    mZeroTextures[GL_TEXTURE_2D].set(zeroTexture2D);
+
+    Texture *zeroTextureCube = new Texture(mRenderer-&gt;createTexture(GL_TEXTURE_CUBE_MAP), 0, GL_TEXTURE_CUBE_MAP);
+    mZeroTextures[GL_TEXTURE_CUBE_MAP].set(zeroTextureCube);
+
+    if (mClientVersion &gt;= 3)
+    {
+        // TODO: These could also be enabled via extension
+        Texture *zeroTexture3D = new Texture(mRenderer-&gt;createTexture(GL_TEXTURE_3D), 0, GL_TEXTURE_3D);
+        mZeroTextures[GL_TEXTURE_3D].set(zeroTexture3D);
+
+        Texture *zeroTexture2DArray = new Texture(mRenderer-&gt;createTexture(GL_TEXTURE_2D_ARRAY), 0, GL_TEXTURE_2D_ARRAY);
+        mZeroTextures[GL_TEXTURE_2D_ARRAY].set(zeroTexture2DArray);
+    }
+
+    mState.initializeZeroTextures(mZeroTextures);
+
+    // Allocate default FBO
+    mFramebufferMap[0] = new Framebuffer(mCaps, mRenderer, 0);
+
+    bindVertexArray(0);
+    bindArrayBuffer(0);
+    bindElementArrayBuffer(0);
+
+    bindReadFramebuffer(0);
+    bindDrawFramebuffer(0);
+    bindRenderbuffer(0);
+
+    bindGenericUniformBuffer(0);
+    for (unsigned int i = 0; i &lt; mCaps.maxCombinedUniformBlocks; i++)
+    {
+        bindIndexedUniformBuffer(0, i, 0, -1);
+    }
+
+    bindCopyReadBuffer(0);
+    bindCopyWriteBuffer(0);
+    bindPixelPackBuffer(0);
+    bindPixelUnpackBuffer(0);
+
+    // [OpenGL ES 3.0.2] section 2.14.1 pg 85:
+    // In the initial state, a default transform feedback object is bound and treated as
+    // a transform feedback object with a name of zero. That object is bound any time
+    // BindTransformFeedback is called with id of zero
+    mTransformFeedbackZero.set(new TransformFeedback(mRenderer-&gt;createTransformFeedback(), 0, mCaps));
+    bindTransformFeedback(0);
+
+    mHasBeenCurrent = false;
+    mContextLost = false;
+    mResetStatus = GL_NO_ERROR;
+    mResetStrategy = (notifyResets ? GL_LOSE_CONTEXT_ON_RESET_EXT : GL_NO_RESET_NOTIFICATION_EXT);
+    mRobustAccess = robustAccess;
+
+    mCompiler = new Compiler(mRenderer-&gt;createCompiler(getData()));
+}
+
+Context::~Context()
+{
+    mState.reset();
+
+    while (!mFramebufferMap.empty())
+    {
+        // Delete the framebuffer in reverse order to destroy the framebuffer zero last.
+        deleteFramebuffer(mFramebufferMap.rbegin()-&gt;first);
+    }
+
+    while (!mFenceNVMap.empty())
+    {
+        deleteFenceNV(mFenceNVMap.begin()-&gt;first);
+    }
+
+    while (!mQueryMap.empty())
+    {
+        deleteQuery(mQueryMap.begin()-&gt;first);
+    }
+
+    while (!mVertexArrayMap.empty())
+    {
+        deleteVertexArray(mVertexArrayMap.begin()-&gt;first);
+    }
+
+    mTransformFeedbackZero.set(NULL);
+    while (!mTransformFeedbackMap.empty())
+    {
+        deleteTransformFeedback(mTransformFeedbackMap.begin()-&gt;first);
+    }
+
+    for (auto &amp;zeroTexture : mZeroTextures)
+    {
+        zeroTexture.second.set(NULL);
+    }
+    mZeroTextures.clear();
+
+    if (mResourceManager)
+    {
+        mResourceManager-&gt;release();
+    }
+
+    SafeDelete(mCompiler);
+}
+
+void Context::makeCurrent(egl::Surface *surface)
+{
+    ASSERT(surface != nullptr);
+
+    if (!mHasBeenCurrent)
+    {
+        initRendererString();
+        initExtensionStrings();
+
+        mState.setViewportParams(0, 0, surface-&gt;getWidth(), surface-&gt;getHeight());
+        mState.setScissorParams(0, 0, surface-&gt;getWidth(), surface-&gt;getHeight());
+
+        mHasBeenCurrent = true;
+    }
+
+    // Update default framebuffer
+    Framebuffer *defaultFBO = mFramebufferMap[0];
+
+    GLenum drawBufferState = GL_BACK;
+    defaultFBO-&gt;setDrawBuffers(1, &amp;drawBufferState);
+    defaultFBO-&gt;setReadBuffer(GL_BACK);
+
+    const FramebufferAttachment *backAttachment = defaultFBO-&gt;getAttachment(GL_BACK);
+
+    if (backAttachment &amp;&amp; backAttachment-&gt;getSurface() == surface)
+    {
+        // FBO already initialized to the surface.
+        return;
+    }
+
+    const egl::Config *config = surface-&gt;getConfig();
+
+    defaultFBO-&gt;setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_BACK, ImageIndex::MakeInvalid(), surface);
+
+    if (config-&gt;depthSize &gt; 0)
+    {
+        defaultFBO-&gt;setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_DEPTH, ImageIndex::MakeInvalid(), surface);
+    }
+    else
+    {
+        defaultFBO-&gt;resetAttachment(GL_DEPTH);
+    }
+
+    if (config-&gt;stencilSize &gt; 0)
+    {
+        defaultFBO-&gt;setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_STENCIL, ImageIndex::MakeInvalid(), surface);
+    }
+    else
+    {
+        defaultFBO-&gt;resetAttachment(GL_STENCIL);
+    }
+}
+
+void Context::releaseSurface()
+{
+    Framebuffer *defaultFBO = mFramebufferMap[0];
+    defaultFBO-&gt;resetAttachment(GL_BACK);
+    defaultFBO-&gt;resetAttachment(GL_DEPTH);
+    defaultFBO-&gt;resetAttachment(GL_STENCIL);
+}
+
+// NOTE: this function should not assume that this context is current!
+void Context::markContextLost()
+{
+    if (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT)
+        mResetStatus = GL_UNKNOWN_CONTEXT_RESET_EXT;
+    mContextLost = true;
+}
+
+bool Context::isContextLost()
+{
+    return mContextLost;
+}
+
+GLuint Context::createBuffer()
+{
+    return mResourceManager-&gt;createBuffer();
+}
+
+GLuint Context::createProgram()
+{
+    return mResourceManager-&gt;createProgram();
+}
+
+GLuint Context::createShader(GLenum type)
+{
+    return mResourceManager-&gt;createShader(getData(), type);
+}
+
+GLuint Context::createTexture()
+{
+    return mResourceManager-&gt;createTexture();
+}
+
+GLuint Context::createRenderbuffer()
+{
+    return mResourceManager-&gt;createRenderbuffer();
+}
+
+GLsync Context::createFenceSync()
+{
+    GLuint handle = mResourceManager-&gt;createFenceSync();
+
+    return reinterpret_cast&lt;GLsync&gt;(static_cast&lt;uintptr_t&gt;(handle));
+}
+
+GLuint Context::createVertexArray()
+{
+    GLuint handle = mVertexArrayHandleAllocator.allocate();
+
+    // Although the spec states VAO state is not initialized until the object is bound,
+    // we create it immediately. The resulting behaviour is transparent to the application,
+    // since it's not currently possible to access the state until the object is bound.
+    VertexArray *vertexArray = new VertexArray(mRenderer-&gt;createVertexArray(), handle, MAX_VERTEX_ATTRIBS);
+    mVertexArrayMap[handle] = vertexArray;
+    return handle;
+}
+
+GLuint Context::createSampler()
+{
+    return mResourceManager-&gt;createSampler();
+}
+
+GLuint Context::createTransformFeedback()
+{
+    GLuint handle = mTransformFeedbackAllocator.allocate();
+    TransformFeedback *transformFeedback = new TransformFeedback(mRenderer-&gt;createTransformFeedback(), handle, mCaps);
+    transformFeedback-&gt;addRef();
+    mTransformFeedbackMap[handle] = transformFeedback;
+    return handle;
+}
+
+// Returns an unused framebuffer name
+GLuint Context::createFramebuffer()
+{
+    GLuint handle = mFramebufferHandleAllocator.allocate();
+
+    mFramebufferMap[handle] = NULL;
+
+    return handle;
+}
+
+GLuint Context::createFenceNV()
+{
+    GLuint handle = mFenceNVHandleAllocator.allocate();
+
+    mFenceNVMap[handle] = new FenceNV(mRenderer-&gt;createFenceNV());
+
+    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-&gt;getBuffer(buffer))
+    {
+        detachBuffer(buffer);
+    }
+
+    mResourceManager-&gt;deleteBuffer(buffer);
+}
+
+void Context::deleteShader(GLuint shader)
+{
+    mResourceManager-&gt;deleteShader(shader);
+}
+
+void Context::deleteProgram(GLuint program)
+{
+    mResourceManager-&gt;deleteProgram(program);
+}
+
+void Context::deleteTexture(GLuint texture)
+{
+    if (mResourceManager-&gt;getTexture(texture))
+    {
+        detachTexture(texture);
+    }
+
+    mResourceManager-&gt;deleteTexture(texture);
+}
+
+void Context::deleteRenderbuffer(GLuint renderbuffer)
+{
+    if (mResourceManager-&gt;getRenderbuffer(renderbuffer))
+    {
+        detachRenderbuffer(renderbuffer);
+    }
+
+    mResourceManager-&gt;deleteRenderbuffer(renderbuffer);
+}
+
+void Context::deleteFenceSync(GLsync fenceSync)
+{
+    // The spec specifies the underlying Fence object is not deleted until all current
+    // wait commands finish. However, since the name becomes invalid, we cannot query the fence,
+    // and since our API is currently designed for being called from a single thread, we can delete
+    // the fence immediately.
+    mResourceManager-&gt;deleteFenceSync(static_cast&lt;GLuint&gt;(reinterpret_cast&lt;uintptr_t&gt;(fenceSync)));
+}
+
+void Context::deleteVertexArray(GLuint vertexArray)
+{
+    auto vertexArrayObject = mVertexArrayMap.find(vertexArray);
+
+    if (vertexArrayObject != mVertexArrayMap.end())
+    {
+        detachVertexArray(vertexArray);
+
+        mVertexArrayHandleAllocator.release(vertexArrayObject-&gt;first);
+        delete vertexArrayObject-&gt;second;
+        mVertexArrayMap.erase(vertexArrayObject);
+    }
+}
+
+void Context::deleteSampler(GLuint sampler)
+{
+    if (mResourceManager-&gt;getSampler(sampler))
+    {
+        detachSampler(sampler);
+    }
+
+    mResourceManager-&gt;deleteSampler(sampler);
+}
+
+void Context::deleteTransformFeedback(GLuint transformFeedback)
+{
+    auto iter = mTransformFeedbackMap.find(transformFeedback);
+    if (iter != mTransformFeedbackMap.end())
+    {
+        detachTransformFeedback(transformFeedback);
+        mTransformFeedbackAllocator.release(transformFeedback);
+        iter-&gt;second-&gt;release();
+        mTransformFeedbackMap.erase(iter);
+    }
+}
+
+void Context::deleteFramebuffer(GLuint framebuffer)
+{
+    FramebufferMap::iterator framebufferObject = mFramebufferMap.find(framebuffer);
+
+    if (framebufferObject != mFramebufferMap.end())
+    {
+        detachFramebuffer(framebuffer);
+
+        mFramebufferHandleAllocator.release(framebufferObject-&gt;first);
+        delete framebufferObject-&gt;second;
+        mFramebufferMap.erase(framebufferObject);
+    }
+}
+
+void Context::deleteFenceNV(GLuint fence)
+{
+    FenceNVMap::iterator fenceObject = mFenceNVMap.find(fence);
+
+    if (fenceObject != mFenceNVMap.end())
+    {
+        mFenceNVHandleAllocator.release(fenceObject-&gt;first);
+        delete fenceObject-&gt;second;
+        mFenceNVMap.erase(fenceObject);
+    }
+}
+
+void Context::deleteQuery(GLuint query)
+{
+    QueryMap::iterator queryObject = mQueryMap.find(query);
+    if (queryObject != mQueryMap.end())
+    {
+        mQueryHandleAllocator.release(queryObject-&gt;first);
+        if (queryObject-&gt;second)
+        {
+            queryObject-&gt;second-&gt;release();
+        }
+        mQueryMap.erase(queryObject);
+    }
+}
+
+Buffer *Context::getBuffer(GLuint handle)
+{
+    return mResourceManager-&gt;getBuffer(handle);
+}
+
+Shader *Context::getShader(GLuint handle) const
+{
+    return mResourceManager-&gt;getShader(handle);
+}
+
+Program *Context::getProgram(GLuint handle) const
+{
+    return mResourceManager-&gt;getProgram(handle);
+}
+
+Texture *Context::getTexture(GLuint handle) const
+{
+    return mResourceManager-&gt;getTexture(handle);
+}
+
+Renderbuffer *Context::getRenderbuffer(GLuint handle)
+{
+    return mResourceManager-&gt;getRenderbuffer(handle);
+}
+
+FenceSync *Context::getFenceSync(GLsync handle) const
+{
+    return mResourceManager-&gt;getFenceSync(static_cast&lt;GLuint&gt;(reinterpret_cast&lt;uintptr_t&gt;(handle)));
+}
+
+VertexArray *Context::getVertexArray(GLuint handle) const
+{
+    auto vertexArray = mVertexArrayMap.find(handle);
+
+    if (vertexArray == mVertexArrayMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return vertexArray-&gt;second;
+    }
+}
+
+Sampler *Context::getSampler(GLuint handle) const
+{
+    return mResourceManager-&gt;getSampler(handle);
+}
+
+TransformFeedback *Context::getTransformFeedback(GLuint handle) const
+{
+    if (handle == 0)
+    {
+        return mTransformFeedbackZero.get();
+    }
+    else
+    {
+        TransformFeedbackMap::const_iterator iter = mTransformFeedbackMap.find(handle);
+        return (iter != mTransformFeedbackMap.end()) ? iter-&gt;second : NULL;
+    }
+}
+
+bool Context::isSampler(GLuint samplerName) const
+{
+    return mResourceManager-&gt;isSampler(samplerName);
+}
+
+void Context::bindArrayBuffer(unsigned int buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.setArrayBufferBinding(getBuffer(buffer));
+}
+
+void Context::bindElementArrayBuffer(unsigned int buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.getVertexArray()-&gt;setElementArrayBuffer(getBuffer(buffer));
+}
+
+void Context::bindTexture(GLenum target, GLuint handle)
+{
+    Texture *texture = NULL;
+
+    if (handle == 0)
+    {
+        texture = mZeroTextures[target].get();
+    }
+    else
+    {
+        mResourceManager-&gt;checkTextureAllocation(handle, target);
+        texture = getTexture(handle);
+    }
+
+    ASSERT(texture);
+
+    mState.setSamplerTexture(target, texture);
+}
+
+void Context::bindReadFramebuffer(GLuint framebuffer)
+{
+    if (!getFramebuffer(framebuffer))
+    {
+        mFramebufferMap[framebuffer] = new Framebuffer(mCaps, mRenderer, framebuffer);
+    }
+
+    mState.setReadFramebufferBinding(getFramebuffer(framebuffer));
+}
+
+void Context::bindDrawFramebuffer(GLuint framebuffer)
+{
+    if (!getFramebuffer(framebuffer))
+    {
+        mFramebufferMap[framebuffer] = new Framebuffer(mCaps, mRenderer, framebuffer);
+    }
+
+    mState.setDrawFramebufferBinding(getFramebuffer(framebuffer));
+}
+
+void Context::bindRenderbuffer(GLuint renderbuffer)
+{
+    mResourceManager-&gt;checkRenderbufferAllocation(renderbuffer);
+
+    mState.setRenderbufferBinding(getRenderbuffer(renderbuffer));
+}
+
+void Context::bindVertexArray(GLuint vertexArray)
+{
+    if (!getVertexArray(vertexArray))
+    {
+        VertexArray *vertexArrayObject = new VertexArray(mRenderer-&gt;createVertexArray(), vertexArray, MAX_VERTEX_ATTRIBS);
+        mVertexArrayMap[vertexArray] = vertexArrayObject;
+    }
+
+    mState.setVertexArrayBinding(getVertexArray(vertexArray));
+}
+
+void Context::bindSampler(GLuint textureUnit, GLuint sampler)
+{
+    ASSERT(textureUnit &lt; mCaps.maxCombinedTextureImageUnits);
+    mResourceManager-&gt;checkSamplerAllocation(sampler);
+
+    mState.setSamplerBinding(textureUnit, getSampler(sampler));
+}
+
+void Context::bindGenericUniformBuffer(GLuint buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.setGenericUniformBufferBinding(getBuffer(buffer));
+}
+
+void Context::bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.setIndexedUniformBufferBinding(index, getBuffer(buffer), offset, size);
+}
+
+void Context::bindGenericTransformFeedbackBuffer(GLuint buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.getCurrentTransformFeedback()-&gt;bindGenericBuffer(getBuffer(buffer));
+}
+
+void Context::bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.getCurrentTransformFeedback()-&gt;bindIndexedBuffer(index, getBuffer(buffer), offset, size);
+}
+
+void Context::bindCopyReadBuffer(GLuint buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.setCopyReadBufferBinding(getBuffer(buffer));
+}
+
+void Context::bindCopyWriteBuffer(GLuint buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.setCopyWriteBufferBinding(getBuffer(buffer));
+}
+
+void Context::bindPixelPackBuffer(GLuint buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.setPixelPackBufferBinding(getBuffer(buffer));
+}
+
+void Context::bindPixelUnpackBuffer(GLuint buffer)
+{
+    mResourceManager-&gt;checkBufferAllocation(buffer);
+
+    mState.setPixelUnpackBufferBinding(getBuffer(buffer));
+}
+
+void Context::useProgram(GLuint program)
+{
+    mState.setProgram(getProgram(program));
+}
+
+void Context::bindTransformFeedback(GLuint transformFeedback)
+{
+    mState.setTransformFeedbackBinding(getTransformFeedback(transformFeedback));
+}
+
+Error Context::beginQuery(GLenum target, GLuint query)
+{
+    Query *queryObject = getQuery(query, true, target);
+    ASSERT(queryObject);
+
+    // begin query
+    Error error = queryObject-&gt;begin();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // set query as active for specified target only if begin succeeded
+    mState.setActiveQuery(target, queryObject);
+
+    return Error(GL_NO_ERROR);
+}
+
+Error Context::endQuery(GLenum target)
+{
+    Query *queryObject = mState.getActiveQuery(target);
+    ASSERT(queryObject);
+
+    gl::Error error = queryObject-&gt;end();
+
+    // Always unbind the query, even if there was an error. This may delete the query object.
+    mState.setActiveQuery(target, NULL);
+
+    return error;
+}
+
+Framebuffer *Context::getFramebuffer(unsigned int handle) const
+{
+    FramebufferMap::const_iterator framebuffer = mFramebufferMap.find(handle);
+
+    if (framebuffer == mFramebufferMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return framebuffer-&gt;second;
+    }
+}
+
+FenceNV *Context::getFenceNV(unsigned int handle)
+{
+    FenceNVMap::iterator fence = mFenceNVMap.find(handle);
+
+    if (fence == mFenceNVMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return fence-&gt;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-&gt;second &amp;&amp; create)
+        {
+            query-&gt;second = new Query(mRenderer-&gt;createQuery(type), handle);
+            query-&gt;second-&gt;addRef();
+        }
+        return query-&gt;second;
+    }
+}
+
+Texture *Context::getTargetTexture(GLenum target) const
+{
+    ASSERT(ValidTextureTarget(this, target));
+
+    return getSamplerTexture(mState.getActiveSampler(), target);
+}
+
+Texture *Context::getSamplerTexture(unsigned int sampler, GLenum type) const
+{
+    return mState.getSamplerTexture(sampler, type);
+}
+
+Compiler *Context::getCompiler() const
+{
+    return mCompiler;
+}
+
+void Context::getBooleanv(GLenum pname, GLboolean *params)
+{
+    switch (pname)
+    {
+      case GL_SHADER_COMPILER:           *params = GL_TRUE;                             break;
+      case GL_CONTEXT_ROBUST_ACCESS_EXT: *params = mRobustAccess ? GL_TRUE : GL_FALSE;  break;
+      default:
+        mState.getBooleanv(pname, params);
+        break;
+    }
+}
+
+void Context::getFloatv(GLenum pname, GLfloat *params)
+{
+    // Queries about context capabilities and maximums are answered by Context.
+    // Queries about current GL state values are answered by State.
+    switch (pname)
+    {
+      case GL_ALIASED_LINE_WIDTH_RANGE:
+        params[0] = mCaps.minAliasedLineWidth;
+        params[1] = mCaps.maxAliasedLineWidth;
+        break;
+      case GL_ALIASED_POINT_SIZE_RANGE:
+        params[0] = mCaps.minAliasedPointSize;
+        params[1] = mCaps.maxAliasedPointSize;
+        break;
+      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+        ASSERT(mExtensions.textureFilterAnisotropic);
+        *params = mExtensions.maxTextureAnisotropy;
+        break;
+      default:
+        mState.getFloatv(pname, params);
+        break;
+    }
+}
+
+void Context::getIntegerv(GLenum pname, GLint *params)
+{
+    // Queries about context capabilities and maximums are answered by Context.
+    // Queries about current GL state values are answered by State.
+
+    switch (pname)
+    {
+      case GL_MAX_VERTEX_ATTRIBS:                       *params = mCaps.maxVertexAttributes;                            break;
+      case GL_MAX_VERTEX_UNIFORM_VECTORS:               *params = mCaps.maxVertexUniformVectors;                        break;
+      case GL_MAX_VERTEX_UNIFORM_COMPONENTS:            *params = mCaps.maxVertexUniformComponents;                     break;
+      case GL_MAX_VARYING_VECTORS:                      *params = mCaps.maxVaryingVectors;                              break;
+      case GL_MAX_VARYING_COMPONENTS:                   *params = mCaps.maxVertexOutputComponents;                      break;
+      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:         *params = mCaps.maxCombinedTextureImageUnits;                   break;
+      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:           *params = mCaps.maxVertexTextureImageUnits;                     break;
+      case GL_MAX_TEXTURE_IMAGE_UNITS:                  *params = mCaps.maxTextureImageUnits;                           break;
+      case GL_MAX_FRAGMENT_UNIFORM_VECTORS:             *params = mCaps.maxFragmentUniformVectors;                      break;
+      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:          *params = mCaps.maxFragmentInputComponents;                     break;
+      case GL_MAX_RENDERBUFFER_SIZE:                    *params = mCaps.maxRenderbufferSize;                            break;
+      case GL_MAX_COLOR_ATTACHMENTS_EXT:                *params = mCaps.maxColorAttachments;                            break;
+      case GL_MAX_DRAW_BUFFERS_EXT:                     *params = mCaps.maxDrawBuffers;                                 break;
+      //case GL_FRAMEBUFFER_BINDING:                    // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
+      case GL_SUBPIXEL_BITS:                            *params = 4;                                                    break;
+      case GL_MAX_TEXTURE_SIZE:                         *params = mCaps.max2DTextureSize;                               break;
+      case GL_MAX_CUBE_MAP_TEXTURE_SIZE:                *params = mCaps.maxCubeMapTextureSize;                          break;
+      case GL_MAX_3D_TEXTURE_SIZE:                      *params = mCaps.max3DTextureSize;                               break;
+      case GL_MAX_ARRAY_TEXTURE_LAYERS:                 *params = mCaps.maxArrayTextureLayers;                          break;
+      case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:          *params = mCaps.uniformBufferOffsetAlignment;                   break;
+      case GL_MAX_UNIFORM_BUFFER_BINDINGS:              *params = mCaps.maxUniformBufferBindings;                       break;
+      case GL_MAX_VERTEX_UNIFORM_BLOCKS:                *params = mCaps.maxVertexUniformBlocks;                         break;
+      case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:              *params = mCaps.maxFragmentUniformBlocks;                       break;
+      case GL_MAX_COMBINED_UNIFORM_BLOCKS:              *params = mCaps.maxCombinedTextureImageUnits;                   break;
+      case GL_MAJOR_VERSION:                            *params = mClientVersion;                                       break;
+      case GL_MINOR_VERSION:                            *params = 0;                                                    break;
+      case GL_MAX_ELEMENTS_INDICES:                     *params = mCaps.maxElementsIndices;                             break;
+      case GL_MAX_ELEMENTS_VERTICES:                    *params = mCaps.maxElementsVertices;                            break;
+      case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mCaps.maxTransformFeedbackInterleavedComponents; break;
+      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:       *params = mCaps.maxTransformFeedbackSeparateAttributes;    break;
+      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:    *params = mCaps.maxTransformFeedbackSeparateComponents;    break;
+      case GL_NUM_COMPRESSED_TEXTURE_FORMATS:           *params = static_cast&lt;GLint&gt;(mCaps.compressedTextureFormats.size());  break;
+      case GL_MAX_SAMPLES_ANGLE:                        *params = mCaps.maxSamples;                                     break;
+      case GL_MAX_VIEWPORT_DIMS:
+        {
+            params[0] = mCaps.maxViewportWidth;
+            params[1] = mCaps.maxViewportHeight;
+        }
+        break;
+      case GL_COMPRESSED_TEXTURE_FORMATS:
+        std::copy(mCaps.compressedTextureFormats.begin(), mCaps.compressedTextureFormats.end(), params);
+        break;
+      case GL_RESET_NOTIFICATION_STRATEGY_EXT:
+        *params = mResetStrategy;
+        break;
+      case GL_NUM_SHADER_BINARY_FORMATS:
+        *params = static_cast&lt;GLint&gt;(mCaps.shaderBinaryFormats.size());
+        break;
+      case GL_SHADER_BINARY_FORMATS:
+        std::copy(mCaps.shaderBinaryFormats.begin(), mCaps.shaderBinaryFormats.end(), params);
+        break;
+      case GL_NUM_PROGRAM_BINARY_FORMATS:
+        *params = static_cast&lt;GLint&gt;(mCaps.programBinaryFormats.size());
+        break;
+      case GL_PROGRAM_BINARY_FORMATS:
+        std::copy(mCaps.programBinaryFormats.begin(), mCaps.programBinaryFormats.end(), params);
+        break;
+      case GL_NUM_EXTENSIONS:
+        *params = static_cast&lt;GLint&gt;(mExtensionStrings.size());
+        break;
+      default:
+        mState.getIntegerv(getData(), pname, params);
+        break;
+    }
+}
+
+void Context::getInteger64v(GLenum pname, GLint64 *params)
+{
+    // Queries about context capabilities and maximums are answered by Context.
+    // Queries about current GL state values are answered by State.
+    switch (pname)
+    {
+      case GL_MAX_ELEMENT_INDEX:
+        *params = mCaps.maxElementIndex;
+        break;
+      case GL_MAX_UNIFORM_BLOCK_SIZE:
+        *params = mCaps.maxUniformBlockSize;
+        break;
+      case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+        *params = mCaps.maxCombinedVertexUniformComponents;
+        break;
+      case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+        *params = mCaps.maxCombinedFragmentUniformComponents;
+        break;
+      case GL_MAX_SERVER_WAIT_TIMEOUT:
+        *params = mCaps.maxServerWaitTimeout;
+        break;
+      default:
+        UNREACHABLE();
+        break;
+    }
+}
+
+bool Context::getIndexedIntegerv(GLenum target, GLuint index, GLint *data)
+{
+    // Queries about context capabilities and maximums are answered by Context.
+    // Queries about current GL state values are answered by State.
+    // Indexed integer queries all refer to current state, so this function is a
+    // mere passthrough.
+    return mState.getIndexedIntegerv(target, index, data);
+}
+
+bool Context::getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data)
+{
+    // Queries about context capabilities and maximums are answered by Context.
+    // Queries about current GL state values are answered by State.
+    // Indexed integer queries all refer to current state, so this function is a
+    // mere passthrough.
+    return mState.getIndexedInteger64v(target, index, data);
+}
+
+bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
+{
+    if (pname &gt;= GL_DRAW_BUFFER0_EXT &amp;&amp; pname &lt;= GL_DRAW_BUFFER15_EXT)
+    {
+        *type = GL_INT;
+        *numParams = 1;
+        return true;
+    }
+
+    // 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 = static_cast&lt;unsigned int&gt;(mCaps.compressedTextureFormats.size());
+        }
+        return true;
+      case GL_PROGRAM_BINARY_FORMATS_OES:
+        {
+            *type = GL_INT;
+            *numParams = static_cast&lt;unsigned int&gt;(mCaps.programBinaryFormats.size());
+        }
+        return true;
+      case GL_SHADER_BINARY_FORMATS:
+        {
+            *type = GL_INT;
+            *numParams = static_cast&lt;unsigned int&gt;(mCaps.shaderBinaryFormats.size());
+        }
+        return true;
+
+      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_MAX_COLOR_ATTACHMENTS_EXT:
+      case GL_MAX_DRAW_BUFFERS_EXT:
+      case GL_NUM_SHADER_BINARY_FORMATS:
+      case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+      case GL_ARRAY_BUFFER_BINDING:
+      //case GL_FRAMEBUFFER_BINDING: // equivalent to DRAW_FRAMEBUFFER_BINDING_ANGLE
+      case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE:
+      case GL_READ_FRAMEBUFFER_BINDING_ANGLE:
+      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:
+        {
+            *type = GL_INT;
+            *numParams = 1;
+        }
+        return true;
+      case GL_MAX_SAMPLES_ANGLE:
+        {
+            if (mExtensions.framebufferMultisample)
+            {
+                *type = GL_INT;
+                *numParams = 1;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        return true;
+      case GL_PIXEL_PACK_BUFFER_BINDING:
+      case GL_PIXEL_UNPACK_BUFFER_BINDING:
+        {
+            if (mExtensions.pixelBufferObject)
+            {
+                *type = GL_INT;
+                *numParams = 1;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        return true;
+      case GL_MAX_VIEWPORT_DIMS:
+        {
+            *type = GL_INT;
+            *numParams = 2;
+        }
+        return true;
+      case GL_VIEWPORT:
+      case GL_SCISSOR_BOX:
+        {
+            *type = GL_INT;
+            *numParams = 4;
+        }
+        return true;
+      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;
+        }
+        return true;
+      case GL_COLOR_WRITEMASK:
+        {
+            *type = GL_BOOL;
+            *numParams = 4;
+        }
+        return true;
+      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;
+        }
+        return true;
+      case GL_ALIASED_LINE_WIDTH_RANGE:
+      case GL_ALIASED_POINT_SIZE_RANGE:
+      case GL_DEPTH_RANGE:
+        {
+            *type = GL_FLOAT;
+            *numParams = 2;
+        }
+        return true;
+      case GL_COLOR_CLEAR_VALUE:
+      case GL_BLEND_COLOR:
+        {
+            *type = GL_FLOAT;
+            *numParams = 4;
+        }
+        return true;
+      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+        if (!mExtensions.maxTextureAnisotropy)
+        {
+            return false;
+        }
+        *type = GL_FLOAT;
+        *numParams = 1;
+        return true;
+    }
+
+    if (mClientVersion &lt; 3)
+    {
+        return false;
+    }
+
+    // Check for ES3.0+ parameter names
+    switch (pname)
+    {
+      case GL_MAX_UNIFORM_BUFFER_BINDINGS:
+      case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
+      case GL_UNIFORM_BUFFER_BINDING:
+      case GL_TRANSFORM_FEEDBACK_BINDING:
+      case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+      case GL_COPY_READ_BUFFER_BINDING:
+      case GL_COPY_WRITE_BUFFER_BINDING:
+      case GL_TEXTURE_BINDING_3D:
+      case GL_TEXTURE_BINDING_2D_ARRAY:
+      case GL_MAX_3D_TEXTURE_SIZE:
+      case GL_MAX_ARRAY_TEXTURE_LAYERS:
+      case GL_MAX_VERTEX_UNIFORM_BLOCKS:
+      case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
+      case GL_MAX_COMBINED_UNIFORM_BLOCKS:
+      case GL_MAX_VARYING_COMPONENTS:
+      case GL_VERTEX_ARRAY_BINDING:
+      case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
+      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+      case GL_NUM_EXTENSIONS:
+      case GL_MAJOR_VERSION:
+      case GL_MINOR_VERSION:
+      case GL_MAX_ELEMENTS_INDICES:
+      case GL_MAX_ELEMENTS_VERTICES:
+      case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+        {
+            *type = GL_INT;
+            *numParams = 1;
+        }
+        return true;
+
+      case GL_MAX_ELEMENT_INDEX:
+      case GL_MAX_UNIFORM_BLOCK_SIZE:
+      case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+      case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+      case GL_MAX_SERVER_WAIT_TIMEOUT:
+        {
+            *type = GL_INT_64_ANGLEX;
+            *numParams = 1;
+        }
+        return true;
+
+      case GL_TRANSFORM_FEEDBACK_ACTIVE:
+      case GL_TRANSFORM_FEEDBACK_PAUSED:
+        {
+            *type = GL_BOOL;
+            *numParams = 1;
+        }
+        return true;
+    }
+
+    return false;
+}
+
+bool Context::getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams)
+{
+    if (mClientVersion &lt; 3)
+    {
+        return false;
+    }
+
+    switch (target)
+    {
+      case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+      case GL_UNIFORM_BUFFER_BINDING:
+        {
+            *type = GL_INT;
+            *numParams = 1;
+        }
+        return true;
+      case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+      case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+      case GL_UNIFORM_BUFFER_START:
+      case GL_UNIFORM_BUFFER_SIZE:
+        {
+            *type = GL_INT_64_ANGLEX;
+            *numParams = 1;
+        }
+    }
+
+    return false;
+}
+
+Error Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
+{
+    return mRenderer-&gt;drawArrays(getData(), mode, first, count, instances);
+}
+
+Error Context::drawElements(GLenum mode, GLsizei count, GLenum type,
+                            const GLvoid *indices, GLsizei instances,
+                            const rx::RangeUI &amp;indexRange)
+{
+    return mRenderer-&gt;drawElements(getData(), mode, count, type, indices, instances, indexRange);
+}
+
+Error Context::flush()
+{
+    return mRenderer-&gt;flush();
+}
+
+Error Context::finish()
+{
+    return mRenderer-&gt;finish();
+}
+
+void Context::recordError(const Error &amp;error)
+{
+    if (error.isError())
+    {
+        mErrors.insert(error.getCode());
+    }
+}
+
+// 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 (mErrors.empty())
+    {
+        return GL_NO_ERROR;
+    }
+    else
+    {
+        GLenum error = *mErrors.begin();
+        mErrors.erase(mErrors.begin());
+        return error;
+    }
+}
+
+GLenum Context::getResetStatus()
+{
+    //TODO(jmadill): needs MANGLE reworking
+    if (mResetStatus == GL_NO_ERROR &amp;&amp; !mContextLost)
+    {
+        // mResetStatus will be set by the markContextLost callback
+        // in the case a notification is sent
+        if (mRenderer-&gt;testDeviceLost())
+        {
+            mRenderer-&gt;notifyDeviceLost();
+        }
+    }
+
+    GLenum status = mResetStatus;
+
+    if (mResetStatus != GL_NO_ERROR)
+    {
+        ASSERT(mContextLost);
+
+        if (mRenderer-&gt;testDeviceResettable())
+        {
+            mResetStatus = GL_NO_ERROR;
+        }
+    }
+
+    return status;
+}
+
+bool Context::isResetNotificationEnabled()
+{
+    return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
+}
+
+int Context::getClientVersion() const
+{
+    return mClientVersion;
+}
+
+EGLint Context::getConfigID() const
+{
+    return mConfigID;
+}
+
+EGLenum Context::getClientType() const
+{
+    return mClientType;
+}
+
+EGLenum Context::getRenderBuffer() const
+{
+    ASSERT(mFramebufferMap.count(0) &gt; 0);
+    const Framebuffer *framebuffer = mFramebufferMap.find(0)-&gt;second;
+    const FramebufferAttachment *backAttachment = framebuffer-&gt;getAttachment(GL_BACK);
+    return backAttachment ? backAttachment-&gt;getSurface()-&gt;getRenderBuffer() : EGL_NONE;
+}
+
+const Caps &amp;Context::getCaps() const
+{
+    return mCaps;
+}
+
+const TextureCapsMap &amp;Context::getTextureCaps() const
+{
+    return mTextureCaps;
+}
+
+const Extensions &amp;Context::getExtensions() const
+{
+    return mExtensions;
+}
+
+void Context::detachTexture(GLuint texture)
+{
+    // Simple pass-through to State's detachTexture method, as textures do not require
+    // allocation map management either here or in the resource manager at detach time.
+    // Zero textures are held by the Context, and we don't attempt to request them from
+    // the State.
+    mState.detachTexture(mZeroTextures, texture);
+}
+
+void Context::detachBuffer(GLuint buffer)
+{
+    // Buffer detachment is handled by Context, because the buffer must also be
+    // attached from any VAOs in existence, and Context holds the VAO map.
+
+    // [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.
+
+    mState.removeArrayBufferBinding(buffer);
+
+    // mark as freed among the vertex array objects
+    for (auto vaoIt = mVertexArrayMap.begin(); vaoIt != mVertexArrayMap.end(); vaoIt++)
+    {
+        vaoIt-&gt;second-&gt;detachBuffer(buffer);
+    }
+}
+
+void Context::detachFramebuffer(GLuint framebuffer)
+{
+    // Framebuffer detachment is handled by Context, because 0 is a valid
+    // Framebuffer object, and a pointer to it must be passed from Context
+    // to State at binding time.
+
+    // [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.removeReadFramebufferBinding(framebuffer) &amp;&amp; framebuffer != 0)
+    {
+        bindReadFramebuffer(0);
+    }
+
+    if (mState.removeDrawFramebufferBinding(framebuffer) &amp;&amp; framebuffer != 0)
+    {
+        bindDrawFramebuffer(0);
+    }
+}
+
+void Context::detachRenderbuffer(GLuint renderbuffer)
+{
+    mState.detachRenderbuffer(renderbuffer);
+}
+
+void Context::detachVertexArray(GLuint vertexArray)
+{
+    // Vertex array detachment is handled by Context, because 0 is a valid
+    // VAO, and a pointer to it must be passed from Context to State at
+    // binding time.
+
+    // [OpenGL ES 3.0.2] section 2.10 page 43:
+    // If a vertex array object that is currently bound is deleted, the binding
+    // for that object reverts to zero and the default vertex array becomes current.
+    if (mState.removeVertexArrayBinding(vertexArray))
+    {
+        bindVertexArray(0);
+    }
+}
+
+void Context::detachTransformFeedback(GLuint transformFeedback)
+{
+    mState.detachTransformFeedback(transformFeedback);
+}
+
+void Context::detachSampler(GLuint sampler)
+{
+    mState.detachSampler(sampler);
+}
+
+void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+    mState.getVertexArray()-&gt;setVertexAttribDivisor(index, divisor);
+}
+
+void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+    mResourceManager-&gt;checkSamplerAllocation(sampler);
+
+    Sampler *samplerObject = getSampler(sampler);
+    ASSERT(samplerObject);
+
+    switch (pname)
+    {
+      case GL_TEXTURE_MIN_FILTER:    samplerObject-&gt;setMinFilter(static_cast&lt;GLenum&gt;(param));       break;
+      case GL_TEXTURE_MAG_FILTER:    samplerObject-&gt;setMagFilter(static_cast&lt;GLenum&gt;(param));       break;
+      case GL_TEXTURE_WRAP_S:        samplerObject-&gt;setWrapS(static_cast&lt;GLenum&gt;(param));           break;
+      case GL_TEXTURE_WRAP_T:        samplerObject-&gt;setWrapT(static_cast&lt;GLenum&gt;(param));           break;
+      case GL_TEXTURE_WRAP_R:        samplerObject-&gt;setWrapR(static_cast&lt;GLenum&gt;(param));           break;
+      case GL_TEXTURE_MIN_LOD:       samplerObject-&gt;setMinLod(static_cast&lt;GLfloat&gt;(param));         break;
+      case GL_TEXTURE_MAX_LOD:       samplerObject-&gt;setMaxLod(static_cast&lt;GLfloat&gt;(param));         break;
+      case GL_TEXTURE_COMPARE_MODE:  samplerObject-&gt;setComparisonMode(static_cast&lt;GLenum&gt;(param));  break;
+      case GL_TEXTURE_COMPARE_FUNC:  samplerObject-&gt;setComparisonFunc(static_cast&lt;GLenum&gt;(param));  break;
+      default:                       UNREACHABLE(); break;
+    }
+}
+
+void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+    mResourceManager-&gt;checkSamplerAllocation(sampler);
+
+    Sampler *samplerObject = getSampler(sampler);
+    ASSERT(samplerObject);
+
+    switch (pname)
+    {
+      case GL_TEXTURE_MIN_FILTER:    samplerObject-&gt;setMinFilter(uiround&lt;GLenum&gt;(param));       break;
+      case GL_TEXTURE_MAG_FILTER:    samplerObject-&gt;setMagFilter(uiround&lt;GLenum&gt;(param));       break;
+      case GL_TEXTURE_WRAP_S:        samplerObject-&gt;setWrapS(uiround&lt;GLenum&gt;(param));           break;
+      case GL_TEXTURE_WRAP_T:        samplerObject-&gt;setWrapT(uiround&lt;GLenum&gt;(param));           break;
+      case GL_TEXTURE_WRAP_R:        samplerObject-&gt;setWrapR(uiround&lt;GLenum&gt;(param));           break;
+      case GL_TEXTURE_MIN_LOD:       samplerObject-&gt;setMinLod(param);                           break;
+      case GL_TEXTURE_MAX_LOD:       samplerObject-&gt;setMaxLod(param);                           break;
+      case GL_TEXTURE_COMPARE_MODE:  samplerObject-&gt;setComparisonMode(uiround&lt;GLenum&gt;(param));  break;
+      case GL_TEXTURE_COMPARE_FUNC:  samplerObject-&gt;setComparisonFunc(uiround&lt;GLenum&gt;(param));  break;
+      default:                       UNREACHABLE(); break;
+    }
+}
+
+GLint Context::getSamplerParameteri(GLuint sampler, GLenum pname)
+{
+    mResourceManager-&gt;checkSamplerAllocation(sampler);
+
+    Sampler *samplerObject = getSampler(sampler);
+    ASSERT(samplerObject);
+
+    switch (pname)
+    {
+      case GL_TEXTURE_MIN_FILTER:    return static_cast&lt;GLint&gt;(samplerObject-&gt;getMinFilter());
+      case GL_TEXTURE_MAG_FILTER:    return static_cast&lt;GLint&gt;(samplerObject-&gt;getMagFilter());
+      case GL_TEXTURE_WRAP_S:        return static_cast&lt;GLint&gt;(samplerObject-&gt;getWrapS());
+      case GL_TEXTURE_WRAP_T:        return static_cast&lt;GLint&gt;(samplerObject-&gt;getWrapT());
+      case GL_TEXTURE_WRAP_R:        return static_cast&lt;GLint&gt;(samplerObject-&gt;getWrapR());
+      case GL_TEXTURE_MIN_LOD:       return uiround&lt;GLint&gt;(samplerObject-&gt;getMinLod());
+      case GL_TEXTURE_MAX_LOD:       return uiround&lt;GLint&gt;(samplerObject-&gt;getMaxLod());
+      case GL_TEXTURE_COMPARE_MODE:  return static_cast&lt;GLint&gt;(samplerObject-&gt;getComparisonMode());
+      case GL_TEXTURE_COMPARE_FUNC:  return static_cast&lt;GLint&gt;(samplerObject-&gt;getComparisonFunc());
+      default:                       UNREACHABLE(); return 0;
+    }
+}
+
+GLfloat Context::getSamplerParameterf(GLuint sampler, GLenum pname)
+{
+    mResourceManager-&gt;checkSamplerAllocation(sampler);
+
+    Sampler *samplerObject = getSampler(sampler);
+    ASSERT(samplerObject);
+
+    switch (pname)
+    {
+      case GL_TEXTURE_MIN_FILTER:    return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getMinFilter());
+      case GL_TEXTURE_MAG_FILTER:    return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getMagFilter());
+      case GL_TEXTURE_WRAP_S:        return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getWrapS());
+      case GL_TEXTURE_WRAP_T:        return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getWrapT());
+      case GL_TEXTURE_WRAP_R:        return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getWrapR());
+      case GL_TEXTURE_MIN_LOD:       return samplerObject-&gt;getMinLod();
+      case GL_TEXTURE_MAX_LOD:       return samplerObject-&gt;getMaxLod();
+      case GL_TEXTURE_COMPARE_MODE:  return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getComparisonMode());
+      case GL_TEXTURE_COMPARE_FUNC:  return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getComparisonFunc());
+      default:                       UNREACHABLE(); return 0;
+    }
+}
+
+void Context::initRendererString()
+{
+    std::ostringstream rendererString;
+    rendererString &lt;&lt; &quot;ANGLE (&quot;;
+    rendererString &lt;&lt; mRenderer-&gt;getRendererDescription();
+    rendererString &lt;&lt; &quot;)&quot;;
+
+    mRendererString = MakeStaticString(rendererString.str());
+}
+
+const std::string &amp;Context::getRendererString() const
+{
+    return mRendererString;
+}
+
+void Context::initExtensionStrings()
+{
+    mExtensionStrings = mExtensions.getStrings();
+
+    std::ostringstream combinedStringStream;
+    std::copy(mExtensionStrings.begin(), mExtensionStrings.end(), std::ostream_iterator&lt;std::string&gt;(combinedStringStream, &quot; &quot;));
+    mExtensionString = combinedStringStream.str();
+}
+
+const std::string &amp;Context::getExtensionString() const
+{
+    return mExtensionString;
+}
+
+const std::string &amp;Context::getExtensionString(size_t idx) const
+{
+    return mExtensionStrings[idx];
+}
+
+size_t Context::getExtensionStringCount() const
+{
+    return mExtensionStrings.size();
+}
+
+void Context::initCaps(GLuint clientVersion)
+{
+    mCaps = mRenderer-&gt;getRendererCaps();
+
+    mExtensions = mRenderer-&gt;getRendererExtensions();
+
+    if (clientVersion &lt; 3)
+    {
+        // Disable ES3+ extensions
+        mExtensions.colorBufferFloat = false;
+    }
+
+    if (clientVersion &gt; 2)
+    {
+        // FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
+        //mExtensions.sRGB = false;
+    }
+
+    // Apply implementation limits
+    mCaps.maxVertexAttributes = std::min&lt;GLuint&gt;(mCaps.maxVertexAttributes, MAX_VERTEX_ATTRIBS);
+    mCaps.maxVertexUniformBlocks = std::min&lt;GLuint&gt;(mCaps.maxVertexUniformBlocks, IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS);
+    mCaps.maxVertexOutputComponents = std::min&lt;GLuint&gt;(mCaps.maxVertexOutputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+
+    mCaps.maxFragmentInputComponents = std::min&lt;GLuint&gt;(mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
+
+    mCaps.compressedTextureFormats.clear();
+
+    const TextureCapsMap &amp;rendererFormats = mRenderer-&gt;getRendererTextureCaps();
+    for (TextureCapsMap::const_iterator i = rendererFormats.begin(); i != rendererFormats.end(); i++)
+    {
+        GLenum format = i-&gt;first;
+        TextureCaps formatCaps = i-&gt;second;
+
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(format);
+
+        // Update the format caps based on the client version and extensions
+        formatCaps.texturable = formatInfo.textureSupport(clientVersion, mExtensions);
+        formatCaps.renderable = formatInfo.renderSupport(clientVersion, mExtensions);
+        formatCaps.filterable = formatInfo.filterSupport(clientVersion, mExtensions);
+
+        // OpenGL ES does not support multisampling with integer formats
+        if (!formatInfo.renderSupport || formatInfo.componentType == GL_INT || formatInfo.componentType == GL_UNSIGNED_INT)
+        {
+            formatCaps.sampleCounts.clear();
+        }
+
+        if (formatCaps.texturable &amp;&amp; formatInfo.compressed)
+        {
+            mCaps.compressedTextureFormats.push_back(format);
+        }
+
+        mTextureCaps.insert(format, formatCaps);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEContexth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Context.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,279 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 LIBANGLE_CONTEXT_H_
+#define LIBANGLE_CONTEXT_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/HandleAllocator.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;string&gt;
+#include &lt;set&gt;
+#include &lt;map&gt;
+
+namespace rx
+{
+class Renderer;
+}
+
+namespace egl
+{
+class Surface;
+struct Config;
+}
+
+namespace gl
+{
+class Compiler;
+class Shader;
+class Program;
+class Texture;
+class Framebuffer;
+class Renderbuffer;
+class FenceNV;
+class FenceSync;
+class Query;
+class ResourceManager;
+class Buffer;
+struct VertexAttribute;
+class VertexArray;
+class Sampler;
+class TransformFeedback;
+
+class Context final : angle::NonCopyable
+{
+  public:
+    Context(const egl::Config *config, int clientVersion, const Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
+
+    virtual ~Context();
+
+    void makeCurrent(egl::Surface *surface);
+    void releaseSurface();
+
+    virtual void markContextLost();
+    bool isContextLost();
+
+    // 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();
+    GLuint createSampler();
+    GLuint createTransformFeedback();
+    GLsync createFenceSync();
+
+    void deleteBuffer(GLuint buffer);
+    void deleteShader(GLuint shader);
+    void deleteProgram(GLuint program);
+    void deleteTexture(GLuint texture);
+    void deleteRenderbuffer(GLuint renderbuffer);
+    void deleteSampler(GLuint sampler);
+    void deleteTransformFeedback(GLuint transformFeedback);
+    void deleteFenceSync(GLsync fenceSync);
+
+    // Framebuffers are owned by the Context, so these methods do not pass through
+    GLuint createFramebuffer();
+    void deleteFramebuffer(GLuint framebuffer);
+
+    // NV Fences are owned by the Context.
+    GLuint createFenceNV();
+    void deleteFenceNV(GLuint fence);
+
+    // Queries are owned by the Context;
+    GLuint createQuery();
+    void deleteQuery(GLuint query);
+
+    // Vertex arrays are owned by the Context
+    GLuint createVertexArray();
+    void deleteVertexArray(GLuint vertexArray);
+
+    void bindArrayBuffer(GLuint buffer);
+    void bindElementArrayBuffer(GLuint buffer);
+    void bindTexture(GLenum target, GLuint handle);
+    void bindReadFramebuffer(GLuint framebuffer);
+    void bindDrawFramebuffer(GLuint framebuffer);
+    void bindRenderbuffer(GLuint renderbuffer);
+    void bindVertexArray(GLuint vertexArray);
+    void bindSampler(GLuint textureUnit, GLuint sampler);
+    void bindGenericUniformBuffer(GLuint buffer);
+    void bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
+    void bindGenericTransformFeedbackBuffer(GLuint buffer);
+    void bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
+    void bindCopyReadBuffer(GLuint buffer);
+    void bindCopyWriteBuffer(GLuint buffer);
+    void bindPixelPackBuffer(GLuint buffer);
+    void bindPixelUnpackBuffer(GLuint buffer);
+    void useProgram(GLuint program);
+    void bindTransformFeedback(GLuint transformFeedback);
+
+    Error beginQuery(GLenum target, GLuint query);
+    Error endQuery(GLenum target);
+
+    void setVertexAttribDivisor(GLuint index, GLuint divisor);
+
+    void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
+    void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
+    GLint getSamplerParameteri(GLuint sampler, GLenum pname);
+    GLfloat getSamplerParameterf(GLuint sampler, GLenum pname);
+
+    Buffer *getBuffer(GLuint handle);
+    FenceNV *getFenceNV(GLuint handle);
+    FenceSync *getFenceSync(GLsync handle) const;
+    Shader *getShader(GLuint handle) const;
+    Program *getProgram(GLuint handle) const;
+    Texture *getTexture(GLuint handle) const;
+    Framebuffer *getFramebuffer(GLuint handle) const;
+    Renderbuffer *getRenderbuffer(GLuint handle);
+    VertexArray *getVertexArray(GLuint handle) const;
+    Sampler *getSampler(GLuint handle) const;
+    Query *getQuery(GLuint handle, bool create, GLenum type);
+    TransformFeedback *getTransformFeedback(GLuint handle) const;
+
+    Texture *getTargetTexture(GLenum target) const;
+    Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
+
+    Compiler *getCompiler() const;
+
+    bool isSampler(GLuint samplerName) const;
+
+    void getBooleanv(GLenum pname, GLboolean *params);
+    void getFloatv(GLenum pname, GLfloat *params);
+    void getIntegerv(GLenum pname, GLint *params);
+    void getInteger64v(GLenum pname, GLint64 *params);
+
+    bool getIndexedIntegerv(GLenum target, GLuint index, GLint *data);
+    bool getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data);
+
+    bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
+    bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
+
+    Error drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances);
+    Error drawElements(GLenum mode, GLsizei count, GLenum type,
+                       const GLvoid *indices, GLsizei instances,
+                       const rx::RangeUI &amp;indexRange);
+    Error flush();
+    Error finish();
+
+    void recordError(const Error &amp;error);
+
+    GLenum getError();
+    GLenum getResetStatus();
+    virtual bool isResetNotificationEnabled();
+
+    virtual int getClientVersion() const;
+
+    EGLint getConfigID() const;
+    EGLenum getClientType() const;
+    EGLenum getRenderBuffer() const;
+
+    const Caps &amp;getCaps() const;
+    const TextureCapsMap &amp;getTextureCaps() const;
+    const Extensions &amp;getExtensions() const;
+
+    const std::string &amp;getRendererString() const;
+
+    const std::string &amp;getExtensionString() const;
+    const std::string &amp;getExtensionString(size_t idx) const;
+    size_t getExtensionStringCount() const;
+
+    rx::Renderer *getRenderer() { return mRenderer; }
+
+    State &amp;getState() { return mState; }
+    const State &amp;getState() const { return mState; }
+
+    const Data &amp;getData() const { return mData; }
+
+  private:
+    void detachBuffer(GLuint buffer);
+    void detachTexture(GLuint texture);
+    void detachFramebuffer(GLuint framebuffer);
+    void detachRenderbuffer(GLuint renderbuffer);
+    void detachVertexArray(GLuint vertexArray);
+    void detachTransformFeedback(GLuint transformFeedback);
+    void detachSampler(GLuint sampler);
+
+    void initRendererString();
+    void initExtensionStrings();
+
+    void initCaps(GLuint clientVersion);
+
+    // Caps to use for validation
+    Caps mCaps;
+    TextureCapsMap mTextureCaps;
+    Extensions mExtensions;
+
+    // Shader compiler
+    Compiler *mCompiler;
+
+    rx::Renderer *const mRenderer;
+    State mState;
+
+    int mClientVersion;
+
+    EGLint mConfigID;
+    EGLenum mClientType;
+
+    TextureMap mZeroTextures;
+
+    typedef std::map&lt;GLuint, Framebuffer*&gt; FramebufferMap;
+    FramebufferMap mFramebufferMap;
+    HandleAllocator mFramebufferHandleAllocator;
+
+    typedef std::map&lt;GLuint, FenceNV*&gt; FenceNVMap;
+    FenceNVMap mFenceNVMap;
+    HandleAllocator mFenceNVHandleAllocator;
+
+    typedef std::map&lt;GLuint, Query*&gt; QueryMap;
+    QueryMap mQueryMap;
+    HandleAllocator mQueryHandleAllocator;
+
+    typedef std::map&lt;GLuint, VertexArray*&gt; VertexArrayMap;
+    VertexArrayMap mVertexArrayMap;
+    HandleAllocator mVertexArrayHandleAllocator;
+
+    BindingPointer&lt;TransformFeedback&gt; mTransformFeedbackZero;
+    typedef std::map&lt;GLuint, TransformFeedback*&gt; TransformFeedbackMap;
+    TransformFeedbackMap mTransformFeedbackMap;
+    HandleAllocator mTransformFeedbackAllocator;
+
+    std::string mRendererString;
+    std::string mExtensionString;
+    std::vector&lt;std::string&gt; mExtensionStrings;
+
+    // Recorded errors
+    typedef std::set&lt;GLenum&gt; ErrorSet;
+    ErrorSet mErrors;
+
+    // Current/lost context flags
+    bool mHasBeenCurrent;
+    bool mContextLost;
+    GLenum mResetStatus;
+    GLenum mResetStrategy;
+    bool mRobustAccess;
+
+    ResourceManager *mResourceManager;
+
+    // Cache the Data object to avoid re-calling the constructor
+    Data mData;
+};
+
+}
+
+#endif   // LIBANGLE_CONTEXT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEDatacpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// Data.cpp: Container class for all GL relevant state, caps and objects
+
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/ResourceManager.h&quot;
+
+namespace gl
+{
+
+Data::Data(GLint clientVersionIn, const State &amp;stateIn, const Caps &amp;capsIn,
+           const TextureCapsMap &amp;textureCapsIn, const Extensions &amp;extensionsIn,
+           const ResourceManager *resourceManagerIn)
+    : clientVersion(clientVersionIn),
+      state(&amp;stateIn),
+      caps(&amp;capsIn),
+      textureCaps(&amp;textureCapsIn),
+      extensions(&amp;extensionsIn),
+      resourceManager(resourceManagerIn)
+{}
+
+Data::~Data()
+{
+}
+
+Data::Data(const Data &amp;other)
+    : clientVersion(other.clientVersion),
+      state(other.state),
+      caps(other.caps),
+      textureCaps(other.textureCaps),
+      extensions(other.extensions),
+      resourceManager(other.resourceManager)
+{
+}
+
+Data &amp;Data::operator=(const Data &amp;other)
+{
+    clientVersion = other.clientVersion;
+    state = other.state;
+    caps = other.caps;
+    textureCaps = other.textureCaps;
+    extensions = other.extensions;
+    resourceManager = other.resourceManager;
+    return *this;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEDatah"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Data.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// Data.h: Container class for all GL relevant state, caps and objects
+
+#ifndef LIBANGLE_DATA_H_
+#define LIBANGLE_DATA_H_
+
+#include &quot;libANGLE/State.h&quot;
+
+namespace gl
+{
+
+struct Data final
+{
+  public:
+    Data(GLint clientVersion, const State &amp;state, const Caps &amp;caps,
+         const TextureCapsMap &amp;textureCaps, const Extensions &amp;extensions,
+         const ResourceManager *resourceManager);
+    ~Data();
+
+    Data(const Data &amp;other);
+    Data &amp;operator=(const Data &amp;other);
+
+    GLint clientVersion;
+    const State *state;
+    const Caps *caps;
+    const TextureCapsMap *textureCaps;
+    const Extensions *extensions;
+    const ResourceManager *resourceManager;
+};
+
+}
+
+#endif // LIBANGLE_DATA_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEDevicecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// Device.cpp: Implements the egl::Device class, representing the abstract
+// device. Implements EGLDevice.
+
+#include &quot;libANGLE/Device.h&quot;
+
+#include &lt;iterator&gt;
+
+#include &lt;platform/Platform.h&gt;
+#include &lt;EGL/eglext.h&gt;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/platform.h&quot;
+#include &quot;libANGLE/renderer/DeviceImpl.h&quot;
+
+namespace egl
+{
+
+template &lt;typename T&gt;
+static std::string GenerateExtensionsString(const T &amp;extensions)
+{
+    std::vector&lt;std::string&gt; extensionsVector = extensions.getStrings();
+
+    std::ostringstream stream;
+    std::copy(extensionsVector.begin(), extensionsVector.end(), std::ostream_iterator&lt;std::string&gt;(stream, &quot; &quot;));
+    return stream.str();
+}
+
+Device::Device(Display *display, rx::DeviceImpl *impl)
+    : mDisplay(display),
+      mImplementation(impl)
+{
+    initDeviceExtensions();
+}
+
+Device::~Device()
+{
+
+}
+
+Error Device::getDevice(EGLAttrib *value)
+{
+    return getImplementation()-&gt;getDevice(value);
+}
+
+EGLint Device::getType()
+{
+    return getImplementation()-&gt;getType();
+}
+
+void Device::initDeviceExtensions()
+{
+    mImplementation-&gt;generateExtensions(&amp;mDeviceExtensions);
+    mDeviceExtensionString = GenerateExtensionsString(mDeviceExtensions);
+}
+
+const DeviceExtensions &amp;Device::getExtensions() const
+{
+    return mDeviceExtensions;
+}
+
+const std::string &amp;Device::getExtensionString() const
+{
+    return mDeviceExtensionString;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEDeviceh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Device.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// Device.h: Implements the egl::Device class, representing the abstract
+// device. Implements EGLDevice.
+
+#ifndef LIBANGLE_DEVICE_H_
+#define LIBANGLE_DEVICE_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+
+namespace rx
+{
+class DeviceImpl;
+}
+
+namespace egl
+{
+class Device final : angle::NonCopyable
+{
+  public:
+    Device(Display *display, rx::DeviceImpl *impl);
+    virtual ~Device();
+
+    Error getDevice(EGLAttrib *value);
+    Display *getDisplay() { return mDisplay; };
+    EGLint getType();
+
+    const DeviceExtensions &amp;getExtensions() const;
+    const std::string &amp;getExtensionString() const;
+
+    rx::DeviceImpl *getImplementation() { return mImplementation; }
+
+  private:
+    void initDeviceExtensions();
+
+    Display *mDisplay;
+    rx::DeviceImpl *mImplementation;
+
+    DeviceExtensions mDeviceExtensions;
+    std::string mDeviceExtensionString;
+};
+
+}
+
+#endif   // LIBANGLE_DEVICE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEDisplaycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,703 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/Display.h&quot;
+
+#include &lt;algorithm&gt;
+#include &lt;iterator&gt;
+#include &lt;map&gt;
+#include &lt;sstream&gt;
+#include &lt;vector&gt;
+
+#include &lt;platform/Platform.h&gt;
+#include &lt;EGL/eglext.h&gt;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/platform.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/Device.h&quot;
+#include &quot;libANGLE/renderer/DisplayImpl.h&quot;
+#include &quot;third_party/trace_event/trace_event.h&quot;
+
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+#   include &quot;libANGLE/renderer/d3d/DisplayD3D.h&quot;
+#endif
+
+#if defined(ANGLE_ENABLE_OPENGL)
+#   if defined(ANGLE_PLATFORM_WINDOWS)
+#       include &quot;libANGLE/renderer/gl/wgl/DisplayWGL.h&quot;
+#   else
+#       error Unsupported OpenGL platform.
+#   endif
+#endif
+
+namespace egl
+{
+
+namespace
+{
+
+class DefaultPlatform : public angle::Platform
+{
+public:
+    DefaultPlatform() {}
+    ~DefaultPlatform() override {}
+};
+
+DefaultPlatform *defaultPlatform = nullptr;
+
+void InitDefaultPlatformImpl()
+{
+    if (ANGLEPlatformCurrent() == nullptr)
+    {
+        if (defaultPlatform == nullptr)
+        {
+            defaultPlatform = new DefaultPlatform();
+        }
+
+        ANGLEPlatformInitialize(defaultPlatform);
+    }
+}
+
+void DeinitDefaultPlatformImpl()
+{
+    if (defaultPlatform != nullptr)
+    {
+        if (ANGLEPlatformCurrent() == defaultPlatform)
+        {
+            ANGLEPlatformShutdown();
+        }
+
+        SafeDelete(defaultPlatform);
+    }
+}
+
+typedef std::map&lt;EGLNativeWindowType, Surface*&gt; WindowSurfaceMap;
+// Get a map of all EGL window surfaces to validate that no window has more than one EGL surface
+// associated with it.
+static WindowSurfaceMap *GetWindowSurfaces()
+{
+    static WindowSurfaceMap windowSurfaces;
+    return &amp;windowSurfaces;
+}
+
+typedef std::map&lt;EGLNativeDisplayType, Display*&gt; DisplayMap;
+static DisplayMap *GetDisplayMap()
+{
+    static DisplayMap displays;
+    return &amp;displays;
+}
+
+rx::DisplayImpl *CreateDisplayImpl(const AttributeMap &amp;attribMap)
+{
+    rx::DisplayImpl *impl = nullptr;
+    EGLint displayType = attribMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
+    switch (displayType)
+    {
+      case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+        // Default to D3D displays
+        impl = new rx::DisplayD3D();
+#else
+        // No display available
+        UNREACHABLE();
+#endif
+        break;
+
+      case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
+      case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+        impl = new rx::DisplayD3D();
+#else
+        // A D3D display was requested on a platform that doesn't support it
+        UNREACHABLE();
+#endif
+        break;
+
+      case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
+#if defined(ANGLE_ENABLE_OPENGL)
+#if defined(ANGLE_PLATFORM_WINDOWS)
+        impl = new rx::DisplayWGL();
+#else
+#error Unsupported OpenGL platform.
+#endif
+#else
+        UNREACHABLE();
+#endif
+        break;
+
+      default:
+        UNREACHABLE();
+        break;
+    }
+
+    ASSERT(impl != nullptr);
+    return impl;
+}
+
+}
+
+Display *Display::getDisplay(EGLNativeDisplayType displayId, const AttributeMap &amp;attribMap)
+{
+    // Initialize the global platform if not already
+    InitDefaultPlatformImpl();
+
+    Display *display = NULL;
+
+    DisplayMap *displays = GetDisplayMap();
+    DisplayMap::const_iterator iter = displays-&gt;find(displayId);
+    if (iter != displays-&gt;end())
+    {
+        display = iter-&gt;second;
+    }
+
+    if (display == nullptr)
+    {
+        // Validate the native display
+        if (!Display::isValidNativeDisplay(displayId))
+        {
+            return NULL;
+        }
+
+        display = new Display(displayId);
+        displays-&gt;insert(std::make_pair(displayId, display));
+    }
+
+    // Apply new attributes if the display is not initialized yet.
+    if (!display-&gt;isInitialized())
+    {
+        rx::DisplayImpl* impl = CreateDisplayImpl(attribMap);
+        display-&gt;setAttributes(impl, attribMap);
+    }
+
+    return display;
+}
+
+Display::Display(EGLNativeDisplayType displayId)
+    : mImplementation(nullptr),
+      mDisplayId(displayId),
+      mAttributeMap(),
+      mConfigSet(),
+      mContextSet(),
+      mInitialized(false),
+      mCaps(),
+      mDisplayExtensions(),
+      mDisplayExtensionString(),
+      mVendorString(),
+      mDevice(nullptr)
+{
+}
+
+Display::~Display()
+{
+    terminate();
+
+    DisplayMap *displays = GetDisplayMap();
+    DisplayMap::iterator iter = displays-&gt;find(mDisplayId);
+    if (iter != displays-&gt;end())
+    {
+        displays-&gt;erase(iter);
+    }
+
+    SafeDelete(mDevice);
+    SafeDelete(mImplementation);
+}
+
+void Display::setAttributes(rx::DisplayImpl *impl, const AttributeMap &amp;attribMap)
+{
+    ASSERT(!mInitialized);
+
+    ASSERT(impl != nullptr);
+    SafeDelete(mImplementation);
+    mImplementation = impl;
+
+    mAttributeMap = attribMap;
+}
+
+Error Display::initialize()
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;egl::Display::initialize&quot;);
+
+    ASSERT(mImplementation != nullptr);
+
+    if (isInitialized())
+    {
+        return Error(EGL_SUCCESS);
+    }
+
+    Error error = mImplementation-&gt;initialize(this);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mCaps = mImplementation-&gt;getCaps();
+
+    mConfigSet = mImplementation-&gt;generateConfigs();
+    if (mConfigSet.size() == 0)
+    {
+        mImplementation-&gt;terminate();
+        return Error(EGL_NOT_INITIALIZED);
+    }
+
+    initDisplayExtensions();
+    initVendorString();
+
+    if (mDisplayExtensions.deviceQuery)
+    {
+        rx::DeviceImpl *impl = nullptr;
+        error = mImplementation-&gt;getDevice(&amp;impl);
+        if (error.isError())
+        {
+            return error;
+        }
+        mDevice = new Device(this, impl);
+    }
+    else
+    {
+        mDevice = nullptr;
+    }
+
+    mInitialized = true;
+    return Error(EGL_SUCCESS);
+}
+
+void Display::terminate()
+{
+    makeCurrent(nullptr, nullptr, nullptr);
+
+    while (!mContextSet.empty())
+    {
+        destroyContext(*mContextSet.begin());
+    }
+
+    mConfigSet.clear();
+
+    mImplementation-&gt;terminate();
+
+    mInitialized = false;
+
+    // De-init default platform
+    DeinitDefaultPlatformImpl();
+}
+
+std::vector&lt;const Config*&gt; Display::getConfigs(const egl::AttributeMap &amp;attribs) const
+{
+    return mConfigSet.filter(attribs);
+}
+
+bool Display::getConfigAttrib(const Config *configuration, EGLint attribute, EGLint *value)
+{
+    switch (attribute)
+    {
+      case EGL_BUFFER_SIZE:               *value = configuration-&gt;bufferSize;             break;
+      case EGL_ALPHA_SIZE:                *value = configuration-&gt;alphaSize;              break;
+      case EGL_BLUE_SIZE:                 *value = configuration-&gt;blueSize;               break;
+      case EGL_GREEN_SIZE:                *value = configuration-&gt;greenSize;              break;
+      case EGL_RED_SIZE:                  *value = configuration-&gt;redSize;                break;
+      case EGL_DEPTH_SIZE:                *value = configuration-&gt;depthSize;              break;
+      case EGL_STENCIL_SIZE:              *value = configuration-&gt;stencilSize;            break;
+      case EGL_CONFIG_CAVEAT:             *value = configuration-&gt;configCaveat;           break;
+      case EGL_CONFIG_ID:                 *value = configuration-&gt;configID;               break;
+      case EGL_LEVEL:                     *value = configuration-&gt;level;                  break;
+      case EGL_NATIVE_RENDERABLE:         *value = configuration-&gt;nativeRenderable;       break;
+      case EGL_NATIVE_VISUAL_TYPE:        *value = configuration-&gt;nativeVisualType;       break;
+      case EGL_SAMPLES:                   *value = configuration-&gt;samples;                break;
+      case EGL_SAMPLE_BUFFERS:            *value = configuration-&gt;sampleBuffers;          break;
+      case EGL_SURFACE_TYPE:              *value = configuration-&gt;surfaceType;            break;
+      case EGL_TRANSPARENT_TYPE:          *value = configuration-&gt;transparentType;        break;
+      case EGL_TRANSPARENT_BLUE_VALUE:    *value = configuration-&gt;transparentBlueValue;   break;
+      case EGL_TRANSPARENT_GREEN_VALUE:   *value = configuration-&gt;transparentGreenValue;  break;
+      case EGL_TRANSPARENT_RED_VALUE:     *value = configuration-&gt;transparentRedValue;    break;
+      case EGL_BIND_TO_TEXTURE_RGB:       *value = configuration-&gt;bindToTextureRGB;       break;
+      case EGL_BIND_TO_TEXTURE_RGBA:      *value = configuration-&gt;bindToTextureRGBA;      break;
+      case EGL_MIN_SWAP_INTERVAL:         *value = configuration-&gt;minSwapInterval;        break;
+      case EGL_MAX_SWAP_INTERVAL:         *value = configuration-&gt;maxSwapInterval;        break;
+      case EGL_LUMINANCE_SIZE:            *value = configuration-&gt;luminanceSize;          break;
+      case EGL_ALPHA_MASK_SIZE:           *value = configuration-&gt;alphaMaskSize;          break;
+      case EGL_COLOR_BUFFER_TYPE:         *value = configuration-&gt;colorBufferType;        break;
+      case EGL_RENDERABLE_TYPE:           *value = configuration-&gt;renderableType;         break;
+      case EGL_MATCH_NATIVE_PIXMAP:       *value = false; UNIMPLEMENTED();                break;
+      case EGL_CONFORMANT:                *value = configuration-&gt;conformant;             break;
+      case EGL_MAX_PBUFFER_WIDTH:         *value = configuration-&gt;maxPBufferWidth;        break;
+      case EGL_MAX_PBUFFER_HEIGHT:        *value = configuration-&gt;maxPBufferHeight;       break;
+      case EGL_MAX_PBUFFER_PIXELS:        *value = configuration-&gt;maxPBufferPixels;       break;
+      default:
+        return false;
+    }
+
+    return true;
+}
+
+Error Display::createWindowSurface(const Config *configuration, EGLNativeWindowType window, const AttributeMap &amp;attribs,
+                                   Surface **outSurface)
+{
+    if (mImplementation-&gt;testDeviceLost())
+    {
+        Error error = restoreLostDevice();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    rx::SurfaceImpl *surfaceImpl = nullptr;
+    Error error = mImplementation-&gt;createWindowSurface(configuration, window, attribs, &amp;surfaceImpl);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(surfaceImpl != nullptr);
+    Surface *surface = new Surface(surfaceImpl, EGL_WINDOW_BIT, configuration, attribs);
+    mImplementation-&gt;getSurfaceSet().insert(surface);
+
+    WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
+    ASSERT(windowSurfaces &amp;&amp; windowSurfaces-&gt;find(window) == windowSurfaces-&gt;end());
+    windowSurfaces-&gt;insert(std::make_pair(window, surface));
+
+    ASSERT(outSurface != nullptr);
+    *outSurface = surface;
+    return Error(EGL_SUCCESS);
+}
+
+Error Display::createPbufferSurface(const Config *configuration, const AttributeMap &amp;attribs, Surface **outSurface)
+{
+    ASSERT(isInitialized());
+
+    if (mImplementation-&gt;testDeviceLost())
+    {
+        Error error = restoreLostDevice();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    rx::SurfaceImpl *surfaceImpl = nullptr;
+    Error error = mImplementation-&gt;createPbufferSurface(configuration, attribs, &amp;surfaceImpl);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(surfaceImpl != nullptr);
+    Surface *surface = new Surface(surfaceImpl, EGL_PBUFFER_BIT, configuration, attribs);
+    mImplementation-&gt;getSurfaceSet().insert(surface);
+
+    ASSERT(outSurface != nullptr);
+    *outSurface = surface;
+    return Error(EGL_SUCCESS);
+}
+
+Error Display::createPbufferFromClientBuffer(const Config *configuration, EGLClientBuffer shareHandle,
+                                             const AttributeMap &amp;attribs, Surface **outSurface)
+{
+    ASSERT(isInitialized());
+
+    if (mImplementation-&gt;testDeviceLost())
+    {
+        Error error = restoreLostDevice();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    rx::SurfaceImpl *surfaceImpl = nullptr;
+    Error error = mImplementation-&gt;createPbufferFromClientBuffer(configuration, shareHandle, attribs, &amp;surfaceImpl);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(surfaceImpl != nullptr);
+    Surface *surface = new Surface(surfaceImpl, EGL_PBUFFER_BIT, configuration, attribs);
+    mImplementation-&gt;getSurfaceSet().insert(surface);
+
+    ASSERT(outSurface != nullptr);
+    *outSurface = surface;
+    return Error(EGL_SUCCESS);
+}
+
+Error Display::createPixmapSurface(const Config *configuration, NativePixmapType nativePixmap, const AttributeMap &amp;attribs,
+                                   Surface **outSurface)
+{
+    ASSERT(isInitialized());
+
+    if (mImplementation-&gt;testDeviceLost())
+    {
+        Error error = restoreLostDevice();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    rx::SurfaceImpl *surfaceImpl = nullptr;
+    Error error = mImplementation-&gt;createPixmapSurface(configuration, nativePixmap, attribs, &amp;surfaceImpl);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(surfaceImpl != nullptr);
+    Surface *surface = new Surface(surfaceImpl, EGL_PIXMAP_BIT, configuration, attribs);
+    mImplementation-&gt;getSurfaceSet().insert(surface);
+
+    ASSERT(outSurface != nullptr);
+    *outSurface = surface;
+    return Error(EGL_SUCCESS);
+}
+
+Error Display::createContext(const Config *configuration, gl::Context *shareContext, const AttributeMap &amp;attribs,
+                             gl::Context **outContext)
+{
+    ASSERT(isInitialized());
+
+    if (mImplementation-&gt;testDeviceLost())
+    {
+        Error error = restoreLostDevice();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    gl::Context *context = nullptr;
+    Error error = mImplementation-&gt;createContext(configuration, shareContext, attribs, &amp;context);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(context != nullptr);
+    mContextSet.insert(context);
+
+    ASSERT(outContext != nullptr);
+    *outContext = context;
+    return Error(EGL_SUCCESS);
+}
+
+Error Display::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
+{
+    Error error = mImplementation-&gt;makeCurrent(drawSurface, readSurface, context);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (context != nullptr &amp;&amp; drawSurface != nullptr)
+    {
+        ASSERT(readSurface == drawSurface);
+        context-&gt;makeCurrent(drawSurface);
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+Error Display::restoreLostDevice()
+{
+    for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++)
+    {
+        if ((*ctx)-&gt;isResetNotificationEnabled())
+        {
+            // If reset notifications have been requested, application must delete all contexts first
+            return Error(EGL_CONTEXT_LOST);
+        }
+    }
+
+    return mImplementation-&gt;restoreLostDevice();
+}
+
+void Display::destroySurface(Surface *surface)
+{
+    if (surface-&gt;getType() == EGL_WINDOW_BIT)
+    {
+        WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
+        ASSERT(windowSurfaces);
+
+        bool surfaceRemoved = false;
+        for (WindowSurfaceMap::iterator iter = windowSurfaces-&gt;begin(); iter != windowSurfaces-&gt;end(); iter++)
+        {
+            if (iter-&gt;second == surface)
+            {
+                windowSurfaces-&gt;erase(iter);
+                surfaceRemoved = true;
+                break;
+            }
+        }
+
+        ASSERT(surfaceRemoved);
+    }
+
+    mImplementation-&gt;destroySurface(surface);
+}
+
+void Display::destroyContext(gl::Context *context)
+{
+    mContextSet.erase(context);
+    SafeDelete(context);
+}
+
+bool Display::isDeviceLost() const
+{
+    ASSERT(isInitialized());
+    return mImplementation-&gt;isDeviceLost();
+}
+
+bool Display::testDeviceLost()
+{
+    ASSERT(isInitialized());
+    return mImplementation-&gt;testDeviceLost();
+}
+
+void Display::notifyDeviceLost()
+{
+    for (ContextSet::iterator context = mContextSet.begin(); context != mContextSet.end(); context++)
+    {
+        (*context)-&gt;markContextLost();
+    }
+}
+
+const Caps &amp;Display::getCaps() const
+{
+    return mCaps;
+}
+
+bool Display::isInitialized() const
+{
+    return mInitialized;
+}
+
+bool Display::isValidConfig(const Config *config) const
+{
+    return mConfigSet.contains(config);
+}
+
+bool Display::isValidContext(gl::Context *context) const
+{
+    return mContextSet.find(context) != mContextSet.end();
+}
+
+bool Display::isValidSurface(Surface *surface) const
+{
+    return mImplementation-&gt;getSurfaceSet().find(surface) != mImplementation-&gt;getSurfaceSet().end();
+}
+
+bool Display::hasExistingWindowSurface(EGLNativeWindowType window)
+{
+    WindowSurfaceMap *windowSurfaces = GetWindowSurfaces();
+    ASSERT(windowSurfaces);
+
+    return windowSurfaces-&gt;find(window) != windowSurfaces-&gt;end();
+}
+
+static ClientExtensions GenerateClientExtensions()
+{
+    ClientExtensions extensions;
+
+    extensions.clientExtensions = true;
+    extensions.platformBase = true;
+    extensions.platformANGLE = true;
+
+#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
+    extensions.platformANGLED3D = true;
+#endif
+
+#if defined(ANGLE_ENABLE_OPENGL)
+    extensions.platformANGLEOpenGL = true;
+#endif
+
+    return extensions;
+}
+
+template &lt;typename T&gt;
+static std::string GenerateExtensionsString(const T &amp;extensions)
+{
+    std::vector&lt;std::string&gt; extensionsVector = extensions.getStrings();
+
+    std::ostringstream stream;
+    std::copy(extensionsVector.begin(), extensionsVector.end(), std::ostream_iterator&lt;std::string&gt;(stream, &quot; &quot;));
+    return stream.str();
+}
+
+const ClientExtensions &amp;Display::getClientExtensions()
+{
+    static const ClientExtensions clientExtensions = GenerateClientExtensions();
+    return clientExtensions;
+}
+
+const std::string &amp;Display::getClientExtensionString()
+{
+    static const std::string clientExtensionsString = GenerateExtensionsString(getClientExtensions());
+    return clientExtensionsString;
+}
+
+void Display::initDisplayExtensions()
+{
+    mDisplayExtensions = mImplementation-&gt;getExtensions();
+    mDisplayExtensionString = GenerateExtensionsString(mDisplayExtensions);
+}
+
+bool Display::isValidNativeWindow(EGLNativeWindowType window) const
+{
+    return mImplementation-&gt;isValidNativeWindow(window);
+}
+
+bool Display::isValidNativeDisplay(EGLNativeDisplayType display)
+{
+    // TODO(jmadill): handle this properly
+    if (display == EGL_DEFAULT_DISPLAY)
+    {
+        return true;
+    }
+
+#if defined(ANGLE_PLATFORM_WINDOWS) &amp;&amp; !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    if (display == EGL_SOFTWARE_DISPLAY_ANGLE ||
+        display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+        display == EGL_D3D11_ONLY_DISPLAY_ANGLE)
+    {
+        return true;
+    }
+    return (WindowFromDC(display) != NULL);
+#else
+    return true;
+#endif
+}
+
+void Display::initVendorString()
+{
+    mVendorString = mImplementation-&gt;getVendorString();
+}
+
+const DisplayExtensions &amp;Display::getExtensions() const
+{
+    return mDisplayExtensions;
+}
+
+const std::string &amp;Display::getExtensionString() const
+{
+    return mDisplayExtensionString;
+}
+
+const std::string &amp;Display::getVendorString() const
+{
+    return mVendorString;
+}
+
+Device *Display::getDevice() const
+{
+    return mDevice;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEDisplayh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Display.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,129 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// 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 LIBANGLE_DISPLAY_H_
+#define LIBANGLE_DISPLAY_H_
+
+#include &lt;set&gt;
+#include &lt;vector&gt;
+
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/AttributeMap.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+namespace gl
+{
+class Context;
+}
+
+namespace rx
+{
+class DisplayImpl;
+}
+
+namespace egl
+{
+class Surface;
+class Device;
+
+class Display final : angle::NonCopyable
+{
+  public:
+    ~Display();
+
+    Error initialize();
+    void terminate();
+
+    static egl::Display *getDisplay(EGLNativeDisplayType displayId, const AttributeMap &amp;attribMap);
+
+    static const ClientExtensions &amp;getClientExtensions();
+    static const std::string &amp;getClientExtensionString();
+
+    std::vector&lt;const Config*&gt; getConfigs(const egl::AttributeMap &amp;attribs) const;
+    bool getConfigAttrib(const Config *configuration, EGLint attribute, EGLint *value);
+
+    Error createWindowSurface(const Config *configuration, EGLNativeWindowType window, const AttributeMap &amp;attribs,
+                              Surface **outSurface);
+    Error createPbufferSurface(const Config *configuration, const AttributeMap &amp;attribs, Surface **outSurface);
+    Error createPbufferFromClientBuffer(const Config *configuration, EGLClientBuffer shareHandle, const AttributeMap &amp;attribs,
+                                        Surface **outSurface);
+    Error createPixmapSurface(const Config *configuration, NativePixmapType nativePixmap, const AttributeMap &amp;attribs,
+                              Surface **outSurface);
+
+    Error createContext(const Config *configuration, gl::Context *shareContext, const AttributeMap &amp;attribs,
+                        gl::Context **outContext);
+
+    Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context);
+
+    void destroySurface(egl::Surface *surface);
+    void destroyContext(gl::Context *context);
+
+    bool isInitialized() const;
+    bool isValidConfig(const Config *config) const;
+    bool isValidContext(gl::Context *context) const;
+    bool isValidSurface(egl::Surface *surface) const;
+    bool isValidNativeWindow(EGLNativeWindowType window) const;
+
+    static bool isValidNativeDisplay(EGLNativeDisplayType display);
+    static bool hasExistingWindowSurface(EGLNativeWindowType window);
+
+    bool isDeviceLost() const;
+    bool testDeviceLost();
+    void notifyDeviceLost();
+
+    const Caps &amp;getCaps() const;
+
+    const DisplayExtensions &amp;getExtensions() const;
+    const std::string &amp;getExtensionString() const;
+    const std::string &amp;getVendorString() const;
+
+    const AttributeMap &amp;getAttributeMap() const { return mAttributeMap; }
+    EGLNativeDisplayType getNativeDisplayId() const { return mDisplayId; }
+
+    rx::DisplayImpl *getImplementation() { return mImplementation; }
+    Device *getDevice() const;
+
+  private:
+    Display(EGLNativeDisplayType displayId);
+
+    void setAttributes(rx::DisplayImpl *impl, const AttributeMap &amp;attribMap);
+
+    Error restoreLostDevice();
+
+    void initDisplayExtensions();
+    void initVendorString();
+
+    rx::DisplayImpl *mImplementation;
+
+    EGLNativeDisplayType mDisplayId;
+    AttributeMap mAttributeMap;
+
+    ConfigSet mConfigSet;
+
+    typedef std::set&lt;gl::Context*&gt; ContextSet;
+    ContextSet mContextSet;
+
+    bool mInitialized;
+
+    Caps mCaps;
+
+    DisplayExtensions mDisplayExtensions;
+    std::string mDisplayExtensionString;
+
+    std::string mVendorString;
+
+    Device* mDevice;
+};
+
+}
+
+#endif   // LIBANGLE_DISPLAY_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEErrorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// Error.cpp: Implements the egl::Error and gl::Error classes which encapsulate API errors
+// and optional error messages.
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;cstdarg&gt;
+
+namespace gl
+{
+
+Error::Error(GLenum errorCode, const char *msg, ...)
+    : mCode(errorCode),
+      mMessage(nullptr)
+{
+    va_list vararg;
+    va_start(vararg, msg);
+    createMessageString();
+    *mMessage = FormatString(msg, vararg);
+    va_end(vararg);
+}
+
+void Error::createMessageString() const
+{
+    if (mMessage == nullptr)
+    {
+        mMessage = new std::string();
+    }
+}
+
+const std::string &amp;Error::getMessage() const
+{
+    createMessageString();
+    return *mMessage;
+}
+
+}
+
+namespace egl
+{
+
+Error::Error(EGLint errorCode, const char *msg, ...)
+    : mCode(errorCode),
+      mID(0),
+      mMessage(nullptr)
+{
+    va_list vararg;
+    va_start(vararg, msg);
+    createMessageString();
+    *mMessage = FormatString(msg, vararg);
+    va_end(vararg);
+}
+
+Error::Error(EGLint errorCode, EGLint id, const char *msg, ...)
+    : mCode(errorCode),
+      mID(id),
+      mMessage(nullptr)
+{
+    va_list vararg;
+    va_start(vararg, msg);
+    createMessageString();
+    *mMessage = FormatString(msg, vararg);
+    va_end(vararg);
+}
+void Error::createMessageString() const
+{
+    if (mMessage == nullptr)
+    {
+        mMessage = new std::string();
+    }
+}
+
+const std::string &amp;Error::getMessage() const
+{
+    createMessageString();
+    return *mMessage;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEErrorh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+
+// Error.h: Defines the egl::Error and gl::Error classes which encapsulate API errors
+// and optional error messages.
+
+#ifndef LIBANGLE_ERROR_H_
+#define LIBANGLE_ERROR_H_
+
+#include &quot;angle_gl.h&quot;
+#include &lt;EGL/egl.h&gt;
+
+#include &lt;string&gt;
+
+namespace gl
+{
+
+class Error final
+{
+  public:
+    explicit inline Error(GLenum errorCode);
+    Error(GLenum errorCode, const char *msg, ...);
+    inline Error(const Error &amp;other);
+    inline Error(Error &amp;&amp;other);
+
+    inline ~Error();
+
+    inline Error &amp;operator=(const Error &amp;other);
+    inline Error &amp;operator=(Error &amp;&amp;other);
+
+    inline GLenum getCode() const;
+    inline bool isError() const;
+
+    const std::string &amp;getMessage() const;
+
+  private:
+    void createMessageString() const;
+
+    GLenum mCode;
+    mutable std::string *mMessage;
+};
+
+}
+
+namespace egl
+{
+
+class Error final
+{
+  public:
+    explicit inline Error(EGLint errorCode);
+    Error(EGLint errorCode, const char *msg, ...);
+    Error(EGLint errorCode, EGLint id, const char *msg, ...);
+    inline Error(const Error &amp;other);
+    inline Error(Error &amp;&amp;other);
+
+    inline ~Error();
+
+    inline Error &amp;operator=(const Error &amp;other);
+    inline Error &amp;operator=(Error &amp;&amp;other);
+
+    inline EGLint getCode() const;
+    inline EGLint getID() const;
+    inline bool isError() const;
+
+    const std::string &amp;getMessage() const;
+
+  private:
+    void createMessageString() const;
+
+    EGLint mCode;
+    EGLint mID;
+    mutable std::string *mMessage;
+};
+
+}
+
+#include &quot;Error.inl&quot;
+
+#endif // LIBANGLE_ERROR_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEErrorinl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.inl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.inl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Error.inl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+
+// Error.inl: Inline definitions of egl::Error and gl::Error classes which encapsulate API errors
+// and optional error messages.
+
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;cstdarg&gt;
+
+namespace gl
+{
+
+Error::Error(GLenum errorCode)
+    : mCode(errorCode),
+      mMessage(nullptr)
+{
+}
+
+Error::Error(const Error &amp;other)
+    : mCode(other.mCode),
+      mMessage(nullptr)
+{
+    if (other.mMessage != nullptr)
+    {
+        createMessageString();
+        *mMessage = *(other.mMessage);
+    }
+}
+
+Error::Error(Error &amp;&amp;other)
+    : mCode(other.mCode),
+      mMessage(other.mMessage)
+{
+    other.mMessage = nullptr;
+}
+
+Error::~Error()
+{
+    SafeDelete(mMessage);
+}
+
+Error &amp;Error::operator=(const Error &amp;other)
+{
+    mCode = other.mCode;
+
+    if (other.mMessage != nullptr)
+    {
+        createMessageString();
+        *mMessage = *(other.mMessage);
+    }
+    else
+    {
+        SafeDelete(mMessage);
+    }
+
+    return *this;
+}
+
+Error &amp;Error::operator=(Error &amp;&amp;other)
+{
+    mCode = other.mCode;
+    mMessage = other.mMessage;
+
+    other.mMessage = nullptr;
+
+    return *this;
+}
+
+GLenum Error::getCode() const
+{
+    return mCode;
+}
+
+bool Error::isError() const
+{
+    return (mCode != GL_NO_ERROR);
+}
+
+}
+
+namespace egl
+{
+
+Error::Error(EGLint errorCode)
+    : mCode(errorCode),
+      mID(0),
+      mMessage(nullptr)
+{
+}
+
+Error::Error(const Error &amp;other)
+    : mCode(other.mCode),
+      mID(other.mID),
+      mMessage(nullptr)
+{
+    if (other.mMessage != nullptr)
+    {
+        createMessageString();
+        *mMessage = *(other.mMessage);
+    }
+}
+
+Error::Error(Error &amp;&amp;other)
+    : mCode(other.mCode),
+      mID(other.mID),
+      mMessage(other.mMessage)
+{
+    other.mMessage = nullptr;
+}
+
+Error::~Error()
+{
+    SafeDelete(mMessage);
+}
+
+Error &amp;Error::operator=(const Error &amp;other)
+{
+    mCode = other.mCode;
+    mID = other.mID;
+
+    if (other.mMessage != nullptr)
+    {
+        createMessageString();
+        *mMessage = *(other.mMessage);
+    }
+    else
+    {
+        SafeDelete(mMessage);
+    }
+
+    return *this;
+}
+
+Error &amp;Error::operator=(Error &amp;&amp;other)
+{
+    mCode = other.mCode;
+    mID = other.mID;
+    mMessage = other.mMessage;
+
+    other.mMessage = nullptr;
+
+    return *this;
+}
+
+EGLint Error::getCode() const
+{
+    return mCode;
+}
+
+EGLint Error::getID() const
+{
+    return mID;
+}
+
+bool Error::isError() const
+{
+    return (mCode != EGL_SUCCESS);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFencecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,120 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence.cpp: Implements the gl::FenceNV and gl::FenceSync classes, which support the GL_NV_fence
+// extension and GLES3 sync objects.
+
+#include &quot;libANGLE/Fence.h&quot;
+
+#include &quot;libANGLE/renderer/FenceNVImpl.h&quot;
+#include &quot;libANGLE/renderer/FenceSyncImpl.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+#include &quot;common/utilities.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+namespace gl
+{
+
+FenceNV::FenceNV(rx::FenceNVImpl *impl)
+    : mFence(impl),
+      mIsSet(false),
+      mStatus(GL_FALSE),
+      mCondition(GL_NONE)
+{
+}
+
+FenceNV::~FenceNV()
+{
+    SafeDelete(mFence);
+}
+
+Error FenceNV::set(GLenum condition)
+{
+    Error error = mFence-&gt;set(condition);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mCondition = condition;
+    mStatus = GL_FALSE;
+    mIsSet = true;
+
+    return Error(GL_NO_ERROR);
+}
+
+Error FenceNV::test(GLboolean *outResult)
+{
+    // Flush the command buffer by default
+    Error error = mFence-&gt;test(&amp;mStatus);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    *outResult = mStatus;
+    return Error(GL_NO_ERROR);
+}
+
+Error FenceNV::finish()
+{
+    ASSERT(mIsSet);
+
+    gl::Error error = mFence-&gt;finish();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mStatus = GL_TRUE;
+
+    return Error(GL_NO_ERROR);
+}
+
+FenceSync::FenceSync(rx::FenceSyncImpl *impl, GLuint id)
+    : RefCountObject(id),
+      mFence(impl),
+      mCondition(GL_NONE),
+      mFlags(0)
+{
+}
+
+FenceSync::~FenceSync()
+{
+    SafeDelete(mFence);
+}
+
+Error FenceSync::set(GLenum condition, GLbitfield flags)
+{
+    Error error = mFence-&gt;set(condition, flags);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mCondition = condition;
+    mFlags = flags;
+    return Error(GL_NO_ERROR);
+}
+
+Error FenceSync::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult)
+{
+    ASSERT(mCondition != GL_NONE);
+    return mFence-&gt;clientWait(flags, timeout, outResult);
+}
+
+Error FenceSync::serverWait(GLbitfield flags, GLuint64 timeout)
+{
+    return mFence-&gt;serverWait(flags, timeout);
+}
+
+Error FenceSync::getStatus(GLint *outResult) const
+{
+    return mFence-&gt;getStatus(outResult);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFenceh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Fence.h: Defines the gl::FenceNV and gl::FenceSync classes, which support the GL_NV_fence
+// extension and GLES3 sync objects.
+
+#ifndef LIBANGLE_FENCE_H_
+#define LIBANGLE_FENCE_H_
+
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+namespace rx
+{
+class FenceNVImpl;
+class FenceSyncImpl;
+}
+
+namespace gl
+{
+
+class FenceNV final : angle::NonCopyable
+{
+  public:
+    explicit FenceNV(rx::FenceNVImpl *impl);
+    virtual ~FenceNV();
+
+    Error set(GLenum condition);
+    Error test(GLboolean *outResult);
+    Error finish();
+
+    bool isSet() const { return mIsSet; }
+    GLboolean getStatus() const { return mStatus; }
+    GLenum getCondition() const { return mCondition; }
+
+  private:
+    rx::FenceNVImpl *mFence;
+
+    bool mIsSet;
+
+    GLboolean mStatus;
+    GLenum mCondition;
+};
+
+class FenceSync final : public RefCountObject
+{
+  public:
+    explicit FenceSync(rx::FenceSyncImpl *impl, GLuint id);
+    virtual ~FenceSync();
+
+    Error set(GLenum condition, GLbitfield flags);
+    Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult);
+    Error serverWait(GLbitfield flags, GLuint64 timeout);
+    Error getStatus(GLint *outResult) const;
+
+    GLenum getCondition() const { return mCondition; }
+    GLbitfield getFlags() const { return mFlags; }
+
+  private:
+    rx::FenceSyncImpl *mFence;
+
+    GLenum mCondition;
+    GLbitfield mFlags;
+};
+
+}
+
+#endif   // LIBANGLE_FENCE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFence_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Fence_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+#include &quot;libANGLE/Fence.h&quot;
+#include &quot;libANGLE/renderer/FenceNVImpl.h&quot;
+#include &quot;libANGLE/renderer/FenceSyncImpl.h&quot;
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::SetArgumentPointee;
+
+namespace {
+
+//
+// FenceNV tests
+//
+
+class MockFenceNVImpl : public rx::FenceNVImpl
+{
+  public:
+    virtual ~MockFenceNVImpl() { destroy(); }
+
+    MOCK_METHOD1(set, gl::Error(GLenum));
+    MOCK_METHOD1(test, gl::Error(GLboolean *));
+    MOCK_METHOD0(finish, gl::Error());
+
+    MOCK_METHOD0(destroy, void());
+};
+
+class FenceNVTest : public testing::Test
+{
+  protected:
+    virtual void SetUp()
+    {
+        mImpl = new MockFenceNVImpl;
+        EXPECT_CALL(*mImpl, destroy());
+        mFence = new gl::FenceNV(mImpl);
+    }
+
+    virtual void TearDown()
+    {
+        delete mFence;
+    }
+
+    MockFenceNVImpl *mImpl;
+    gl::FenceNV* mFence;
+};
+
+TEST_F(FenceNVTest, DestructionDeletesImpl)
+{
+    MockFenceNVImpl* impl = new MockFenceNVImpl;
+    EXPECT_CALL(*impl, destroy()).Times(1).RetiresOnSaturation();
+
+    gl::FenceNV* fence = new gl::FenceNV(impl);
+    delete fence;
+
+    // Only needed because the mock is leaked if bugs are present,
+    // which logs an error, but does not cause the test to fail.
+    // Ordinarily mocks are verified when destroyed.
+    testing::Mock::VerifyAndClear(impl);
+}
+
+TEST_F(FenceNVTest, SetAndTestBehavior)
+{
+    EXPECT_CALL(*mImpl, set(_))
+        .WillOnce(Return(gl::Error(GL_NO_ERROR)))
+        .RetiresOnSaturation();
+    EXPECT_FALSE(mFence-&gt;isSet());
+    mFence-&gt;set(GL_ALL_COMPLETED_NV);
+    EXPECT_TRUE(mFence-&gt;isSet());
+    // Fake the behavior of testing the fence before and after it's passed.
+    EXPECT_CALL(*mImpl, test(_))
+        .WillOnce(DoAll(SetArgumentPointee&lt;0&gt;(GL_FALSE),
+                        Return(gl::Error(GL_NO_ERROR))))
+        .WillOnce(DoAll(SetArgumentPointee&lt;0&gt;(GL_TRUE),
+                        Return(gl::Error(GL_NO_ERROR))))
+        .RetiresOnSaturation();
+    GLboolean out;
+    mFence-&gt;test(&amp;out);
+    EXPECT_EQ(GL_FALSE, out);
+    mFence-&gt;test(&amp;out);
+    EXPECT_EQ(GL_TRUE, out);
+}
+
+//
+// FenceSync tests
+//
+
+class MockFenceSyncImpl : public rx::FenceSyncImpl
+{
+  public:
+    virtual ~MockFenceSyncImpl() { destroy(); }
+
+    MOCK_METHOD2(set, gl::Error(GLenum, GLbitfield));
+    MOCK_METHOD3(clientWait, gl::Error(GLbitfield, GLuint64, GLenum *));
+    MOCK_METHOD2(serverWait, gl::Error(GLbitfield, GLuint64));
+    MOCK_METHOD1(getStatus, gl::Error(GLint *));
+
+    MOCK_METHOD0(destroy, void());
+};
+
+class FenceSyncTest : public testing::Test
+{
+  protected:
+    virtual void SetUp()
+    {
+        mImpl = new MockFenceSyncImpl;
+        EXPECT_CALL(*mImpl, destroy());
+        mFence = new gl::FenceSync(mImpl, 1);
+        mFence-&gt;addRef();
+    }
+
+    virtual void TearDown()
+    {
+        mFence-&gt;release();
+    }
+
+    MockFenceSyncImpl *mImpl;
+    gl::FenceSync* mFence;
+};
+
+TEST_F(FenceSyncTest, DestructionDeletesImpl)
+{
+    MockFenceSyncImpl* impl = new MockFenceSyncImpl;
+    EXPECT_CALL(*impl, destroy()).Times(1).RetiresOnSaturation();
+
+    gl::FenceSync* fence = new gl::FenceSync(impl, 1);
+    fence-&gt;addRef();
+    fence-&gt;release();
+
+    // Only needed because the mock is leaked if bugs are present,
+    // which logs an error, but does not cause the test to fail.
+    // Ordinarily mocks are verified when destroyed.
+    testing::Mock::VerifyAndClear(impl);
+}
+
+TEST_F(FenceSyncTest, SetAndGetStatusBehavior)
+{
+    EXPECT_CALL(*mImpl, set(_, _))
+        .WillOnce(Return(gl::Error(GL_NO_ERROR)))
+        .RetiresOnSaturation();
+    mFence-&gt;set(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+    EXPECT_EQ(static_cast&lt;GLenum&gt;(GL_SYNC_GPU_COMMANDS_COMPLETE), mFence-&gt;getCondition());
+    // Fake the behavior of testing the fence before and after it's passed.
+    EXPECT_CALL(*mImpl, getStatus(_))
+        .WillOnce(DoAll(SetArgumentPointee&lt;0&gt;(GL_UNSIGNALED),
+                        Return(gl::Error(GL_NO_ERROR))))
+        .WillOnce(DoAll(SetArgumentPointee&lt;0&gt;(GL_SIGNALED),
+                        Return(gl::Error(GL_NO_ERROR))))
+        .RetiresOnSaturation();
+    GLint out;
+    mFence-&gt;getStatus(&amp;out);
+    EXPECT_EQ(GL_UNSIGNALED, out);
+    mFence-&gt;getStatus(&amp;out);
+    EXPECT_EQ(GL_SIGNALED, out);
+}
+
+} // namespace
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFloat16ToFloat32cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,2203 @@
</span><ins>+//
+// 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.
+//
+
+// This file is automatically generated.
+
+namespace gl
+{
+
+const static unsigned g_mantissa[2048] = {
+    0x00000000,
+    0x33800000,
+    0x34000000,
+    0x34400000,
+    0x34800000,
+    0x34a00000,
+    0x34c00000,
+    0x34e00000,
+    0x35000000,
+    0x35100000,
+    0x35200000,
+    0x35300000,
+    0x35400000,
+    0x35500000,
+    0x35600000,
+    0x35700000,
+    0x35800000,
+    0x35880000,
+    0x35900000,
+    0x35980000,
+    0x35a00000,
+    0x35a80000,
+    0x35b00000,
+    0x35b80000,
+    0x35c00000,
+    0x35c80000,
+    0x35d00000,
+    0x35d80000,
+    0x35e00000,
+    0x35e80000,
+    0x35f00000,
+    0x35f80000,
+    0x36000000,
+    0x36040000,
+    0x36080000,
+    0x360c0000,
+    0x36100000,
+    0x36140000,
+    0x36180000,
+    0x361c0000,
+    0x36200000,
+    0x36240000,
+    0x36280000,
+    0x362c0000,
+    0x36300000,
+    0x36340000,
+    0x36380000,
+    0x363c0000,
+    0x36400000,
+    0x36440000,
+    0x36480000,
+    0x364c0000,
+    0x36500000,
+    0x36540000,
+    0x36580000,
+    0x365c0000,
+    0x36600000,
+    0x36640000,
+    0x36680000,
+    0x366c0000,
+    0x36700000,
+    0x36740000,
+    0x36780000,
+    0x367c0000,
+    0x36800000,
+    0x36820000,
+    0x36840000,
+    0x36860000,
+    0x36880000,
+    0x368a0000,
+    0x368c0000,
+    0x368e0000,
+    0x36900000,
+    0x36920000,
+    0x36940000,
+    0x36960000,
+    0x36980000,
+    0x369a0000,
+    0x369c0000,
+    0x369e0000,
+    0x36a00000,
+    0x36a20000,
+    0x36a40000,
+    0x36a60000,
+    0x36a80000,
+    0x36aa0000,
+    0x36ac0000,
+    0x36ae0000,
+    0x36b00000,
+    0x36b20000,
+    0x36b40000,
+    0x36b60000,
+    0x36b80000,
+    0x36ba0000,
+    0x36bc0000,
+    0x36be0000,
+    0x36c00000,
+    0x36c20000,
+    0x36c40000,
+    0x36c60000,
+    0x36c80000,
+    0x36ca0000,
+    0x36cc0000,
+    0x36ce0000,
+    0x36d00000,
+    0x36d20000,
+    0x36d40000,
+    0x36d60000,
+    0x36d80000,
+    0x36da0000,
+    0x36dc0000,
+    0x36de0000,
+    0x36e00000,
+    0x36e20000,
+    0x36e40000,
+    0x36e60000,
+    0x36e80000,
+    0x36ea0000,
+    0x36ec0000,
+    0x36ee0000,
+    0x36f00000,
+    0x36f20000,
+    0x36f40000,
+    0x36f60000,
+    0x36f80000,
+    0x36fa0000,
+    0x36fc0000,
+    0x36fe0000,
+    0x37000000,
+    0x37010000,
+    0x37020000,
+    0x37030000,
+    0x37040000,
+    0x37050000,
+    0x37060000,
+    0x37070000,
+    0x37080000,
+    0x37090000,
+    0x370a0000,
+    0x370b0000,
+    0x370c0000,
+    0x370d0000,
+    0x370e0000,
+    0x370f0000,
+    0x37100000,
+    0x37110000,
+    0x37120000,
+    0x37130000,
+    0x37140000,
+    0x37150000,
+    0x37160000,
+    0x37170000,
+    0x37180000,
+    0x37190000,
+    0x371a0000,
+    0x371b0000,
+    0x371c0000,
+    0x371d0000,
+    0x371e0000,
+    0x371f0000,
+    0x37200000,
+    0x37210000,
+    0x37220000,
+    0x37230000,
+    0x37240000,
+    0x37250000,
+    0x37260000,
+    0x37270000,
+    0x37280000,
+    0x37290000,
+    0x372a0000,
+    0x372b0000,
+    0x372c0000,
+    0x372d0000,
+    0x372e0000,
+    0x372f0000,
+    0x37300000,
+    0x37310000,
+    0x37320000,
+    0x37330000,
+    0x37340000,
+    0x37350000,
+    0x37360000,
+    0x37370000,
+    0x37380000,
+    0x37390000,
+    0x373a0000,
+    0x373b0000,
+    0x373c0000,
+    0x373d0000,
+    0x373e0000,
+    0x373f0000,
+    0x37400000,
+    0x37410000,
+    0x37420000,
+    0x37430000,
+    0x37440000,
+    0x37450000,
+    0x37460000,
+    0x37470000,
+    0x37480000,
+    0x37490000,
+    0x374a0000,
+    0x374b0000,
+    0x374c0000,
+    0x374d0000,
+    0x374e0000,
+    0x374f0000,
+    0x37500000,
+    0x37510000,
+    0x37520000,
+    0x37530000,
+    0x37540000,
+    0x37550000,
+    0x37560000,
+    0x37570000,
+    0x37580000,
+    0x37590000,
+    0x375a0000,
+    0x375b0000,
+    0x375c0000,
+    0x375d0000,
+    0x375e0000,
+    0x375f0000,
+    0x37600000,
+    0x37610000,
+    0x37620000,
+    0x37630000,
+    0x37640000,
+    0x37650000,
+    0x37660000,
+    0x37670000,
+    0x37680000,
+    0x37690000,
+    0x376a0000,
+    0x376b0000,
+    0x376c0000,
+    0x376d0000,
+    0x376e0000,
+    0x376f0000,
+    0x37700000,
+    0x37710000,
+    0x37720000,
+    0x37730000,
+    0x37740000,
+    0x37750000,
+    0x37760000,
+    0x37770000,
+    0x37780000,
+    0x37790000,
+    0x377a0000,
+    0x377b0000,
+    0x377c0000,
+    0x377d0000,
+    0x377e0000,
+    0x377f0000,
+    0x37800000,
+    0x37808000,
+    0x37810000,
+    0x37818000,
+    0x37820000,
+    0x37828000,
+    0x37830000,
+    0x37838000,
+    0x37840000,
+    0x37848000,
+    0x37850000,
+    0x37858000,
+    0x37860000,
+    0x37868000,
+    0x37870000,
+    0x37878000,
+    0x37880000,
+    0x37888000,
+    0x37890000,
+    0x37898000,
+    0x378a0000,
+    0x378a8000,
+    0x378b0000,
+    0x378b8000,
+    0x378c0000,
+    0x378c8000,
+    0x378d0000,
+    0x378d8000,
+    0x378e0000,
+    0x378e8000,
+    0x378f0000,
+    0x378f8000,
+    0x37900000,
+    0x37908000,
+    0x37910000,
+    0x37918000,
+    0x37920000,
+    0x37928000,
+    0x37930000,
+    0x37938000,
+    0x37940000,
+    0x37948000,
+    0x37950000,
+    0x37958000,
+    0x37960000,
+    0x37968000,
+    0x37970000,
+    0x37978000,
+    0x37980000,
+    0x37988000,
+    0x37990000,
+    0x37998000,
+    0x379a0000,
+    0x379a8000,
+    0x379b0000,
+    0x379b8000,
+    0x379c0000,
+    0x379c8000,
+    0x379d0000,
+    0x379d8000,
+    0x379e0000,
+    0x379e8000,
+    0x379f0000,
+    0x379f8000,
+    0x37a00000,
+    0x37a08000,
+    0x37a10000,
+    0x37a18000,
+    0x37a20000,
+    0x37a28000,
+    0x37a30000,
+    0x37a38000,
+    0x37a40000,
+    0x37a48000,
+    0x37a50000,
+    0x37a58000,
+    0x37a60000,
+    0x37a68000,
+    0x37a70000,
+    0x37a78000,
+    0x37a80000,
+    0x37a88000,
+    0x37a90000,
+    0x37a98000,
+    0x37aa0000,
+    0x37aa8000,
+    0x37ab0000,
+    0x37ab8000,
+    0x37ac0000,
+    0x37ac8000,
+    0x37ad0000,
+    0x37ad8000,
+    0x37ae0000,
+    0x37ae8000,
+    0x37af0000,
+    0x37af8000,
+    0x37b00000,
+    0x37b08000,
+    0x37b10000,
+    0x37b18000,
+    0x37b20000,
+    0x37b28000,
+    0x37b30000,
+    0x37b38000,
+    0x37b40000,
+    0x37b48000,
+    0x37b50000,
+    0x37b58000,
+    0x37b60000,
+    0x37b68000,
+    0x37b70000,
+    0x37b78000,
+    0x37b80000,
+    0x37b88000,
+    0x37b90000,
+    0x37b98000,
+    0x37ba0000,
+    0x37ba8000,
+    0x37bb0000,
+    0x37bb8000,
+    0x37bc0000,
+    0x37bc8000,
+    0x37bd0000,
+    0x37bd8000,
+    0x37be0000,
+    0x37be8000,
+    0x37bf0000,
+    0x37bf8000,
+    0x37c00000,
+    0x37c08000,
+    0x37c10000,
+    0x37c18000,
+    0x37c20000,
+    0x37c28000,
+    0x37c30000,
+    0x37c38000,
+    0x37c40000,
+    0x37c48000,
+    0x37c50000,
+    0x37c58000,
+    0x37c60000,
+    0x37c68000,
+    0x37c70000,
+    0x37c78000,
+    0x37c80000,
+    0x37c88000,
+    0x37c90000,
+    0x37c98000,
+    0x37ca0000,
+    0x37ca8000,
+    0x37cb0000,
+    0x37cb8000,
+    0x37cc0000,
+    0x37cc8000,
+    0x37cd0000,
+    0x37cd8000,
+    0x37ce0000,
+    0x37ce8000,
+    0x37cf0000,
+    0x37cf8000,
+    0x37d00000,
+    0x37d08000,
+    0x37d10000,
+    0x37d18000,
+    0x37d20000,
+    0x37d28000,
+    0x37d30000,
+    0x37d38000,
+    0x37d40000,
+    0x37d48000,
+    0x37d50000,
+    0x37d58000,
+    0x37d60000,
+    0x37d68000,
+    0x37d70000,
+    0x37d78000,
+    0x37d80000,
+    0x37d88000,
+    0x37d90000,
+    0x37d98000,
+    0x37da0000,
+    0x37da8000,
+    0x37db0000,
+    0x37db8000,
+    0x37dc0000,
+    0x37dc8000,
+    0x37dd0000,
+    0x37dd8000,
+    0x37de0000,
+    0x37de8000,
+    0x37df0000,
+    0x37df8000,
+    0x37e00000,
+    0x37e08000,
+    0x37e10000,
+    0x37e18000,
+    0x37e20000,
+    0x37e28000,
+    0x37e30000,
+    0x37e38000,
+    0x37e40000,
+    0x37e48000,
+    0x37e50000,
+    0x37e58000,
+    0x37e60000,
+    0x37e68000,
+    0x37e70000,
+    0x37e78000,
+    0x37e80000,
+    0x37e88000,
+    0x37e90000,
+    0x37e98000,
+    0x37ea0000,
+    0x37ea8000,
+    0x37eb0000,
+    0x37eb8000,
+    0x37ec0000,
+    0x37ec8000,
+    0x37ed0000,
+    0x37ed8000,
+    0x37ee0000,
+    0x37ee8000,
+    0x37ef0000,
+    0x37ef8000,
+    0x37f00000,
+    0x37f08000,
+    0x37f10000,
+    0x37f18000,
+    0x37f20000,
+    0x37f28000,
+    0x37f30000,
+    0x37f38000,
+    0x37f40000,
+    0x37f48000,
+    0x37f50000,
+    0x37f58000,
+    0x37f60000,
+    0x37f68000,
+    0x37f70000,
+    0x37f78000,
+    0x37f80000,
+    0x37f88000,
+    0x37f90000,
+    0x37f98000,
+    0x37fa0000,
+    0x37fa8000,
+    0x37fb0000,
+    0x37fb8000,
+    0x37fc0000,
+    0x37fc8000,
+    0x37fd0000,
+    0x37fd8000,
+    0x37fe0000,
+    0x37fe8000,
+    0x37ff0000,
+    0x37ff8000,
+    0x38000000,
+    0x38004000,
+    0x38008000,
+    0x3800c000,
+    0x38010000,
+    0x38014000,
+    0x38018000,
+    0x3801c000,
+    0x38020000,
+    0x38024000,
+    0x38028000,
+    0x3802c000,
+    0x38030000,
+    0x38034000,
+    0x38038000,
+    0x3803c000,
+    0x38040000,
+    0x38044000,
+    0x38048000,
+    0x3804c000,
+    0x38050000,
+    0x38054000,
+    0x38058000,
+    0x3805c000,
+    0x38060000,
+    0x38064000,
+    0x38068000,
+    0x3806c000,
+    0x38070000,
+    0x38074000,
+    0x38078000,
+    0x3807c000,
+    0x38080000,
+    0x38084000,
+    0x38088000,
+    0x3808c000,
+    0x38090000,
+    0x38094000,
+    0x38098000,
+    0x3809c000,
+    0x380a0000,
+    0x380a4000,
+    0x380a8000,
+    0x380ac000,
+    0x380b0000,
+    0x380b4000,
+    0x380b8000,
+    0x380bc000,
+    0x380c0000,
+    0x380c4000,
+    0x380c8000,
+    0x380cc000,
+    0x380d0000,
+    0x380d4000,
+    0x380d8000,
+    0x380dc000,
+    0x380e0000,
+    0x380e4000,
+    0x380e8000,
+    0x380ec000,
+    0x380f0000,
+    0x380f4000,
+    0x380f8000,
+    0x380fc000,
+    0x38100000,
+    0x38104000,
+    0x38108000,
+    0x3810c000,
+    0x38110000,
+    0x38114000,
+    0x38118000,
+    0x3811c000,
+    0x38120000,
+    0x38124000,
+    0x38128000,
+    0x3812c000,
+    0x38130000,
+    0x38134000,
+    0x38138000,
+    0x3813c000,
+    0x38140000,
+    0x38144000,
+    0x38148000,
+    0x3814c000,
+    0x38150000,
+    0x38154000,
+    0x38158000,
+    0x3815c000,
+    0x38160000,
+    0x38164000,
+    0x38168000,
+    0x3816c000,
+    0x38170000,
+    0x38174000,
+    0x38178000,
+    0x3817c000,
+    0x38180000,
+    0x38184000,
+    0x38188000,
+    0x3818c000,
+    0x38190000,
+    0x38194000,
+    0x38198000,
+    0x3819c000,
+    0x381a0000,
+    0x381a4000,
+    0x381a8000,
+    0x381ac000,
+    0x381b0000,
+    0x381b4000,
+    0x381b8000,
+    0x381bc000,
+    0x381c0000,
+    0x381c4000,
+    0x381c8000,
+    0x381cc000,
+    0x381d0000,
+    0x381d4000,
+    0x381d8000,
+    0x381dc000,
+    0x381e0000,
+    0x381e4000,
+    0x381e8000,
+    0x381ec000,
+    0x381f0000,
+    0x381f4000,
+    0x381f8000,
+    0x381fc000,
+    0x38200000,
+    0x38204000,
+    0x38208000,
+    0x3820c000,
+    0x38210000,
+    0x38214000,
+    0x38218000,
+    0x3821c000,
+    0x38220000,
+    0x38224000,
+    0x38228000,
+    0x3822c000,
+    0x38230000,
+    0x38234000,
+    0x38238000,
+    0x3823c000,
+    0x38240000,
+    0x38244000,
+    0x38248000,
+    0x3824c000,
+    0x38250000,
+    0x38254000,
+    0x38258000,
+    0x3825c000,
+    0x38260000,
+    0x38264000,
+    0x38268000,
+    0x3826c000,
+    0x38270000,
+    0x38274000,
+    0x38278000,
+    0x3827c000,
+    0x38280000,
+    0x38284000,
+    0x38288000,
+    0x3828c000,
+    0x38290000,
+    0x38294000,
+    0x38298000,
+    0x3829c000,
+    0x382a0000,
+    0x382a4000,
+    0x382a8000,
+    0x382ac000,
+    0x382b0000,
+    0x382b4000,
+    0x382b8000,
+    0x382bc000,
+    0x382c0000,
+    0x382c4000,
+    0x382c8000,
+    0x382cc000,
+    0x382d0000,
+    0x382d4000,
+    0x382d8000,
+    0x382dc000,
+    0x382e0000,
+    0x382e4000,
+    0x382e8000,
+    0x382ec000,
+    0x382f0000,
+    0x382f4000,
+    0x382f8000,
+    0x382fc000,
+    0x38300000,
+    0x38304000,
+    0x38308000,
+    0x3830c000,
+    0x38310000,
+    0x38314000,
+    0x38318000,
+    0x3831c000,
+    0x38320000,
+    0x38324000,
+    0x38328000,
+    0x3832c000,
+    0x38330000,
+    0x38334000,
+    0x38338000,
+    0x3833c000,
+    0x38340000,
+    0x38344000,
+    0x38348000,
+    0x3834c000,
+    0x38350000,
+    0x38354000,
+    0x38358000,
+    0x3835c000,
+    0x38360000,
+    0x38364000,
+    0x38368000,
+    0x3836c000,
+    0x38370000,
+    0x38374000,
+    0x38378000,
+    0x3837c000,
+    0x38380000,
+    0x38384000,
+    0x38388000,
+    0x3838c000,
+    0x38390000,
+    0x38394000,
+    0x38398000,
+    0x3839c000,
+    0x383a0000,
+    0x383a4000,
+    0x383a8000,
+    0x383ac000,
+    0x383b0000,
+    0x383b4000,
+    0x383b8000,
+    0x383bc000,
+    0x383c0000,
+    0x383c4000,
+    0x383c8000,
+    0x383cc000,
+    0x383d0000,
+    0x383d4000,
+    0x383d8000,
+    0x383dc000,
+    0x383e0000,
+    0x383e4000,
+    0x383e8000,
+    0x383ec000,
+    0x383f0000,
+    0x383f4000,
+    0x383f8000,
+    0x383fc000,
+    0x38400000,
+    0x38404000,
+    0x38408000,
+    0x3840c000,
+    0x38410000,
+    0x38414000,
+    0x38418000,
+    0x3841c000,
+    0x38420000,
+    0x38424000,
+    0x38428000,
+    0x3842c000,
+    0x38430000,
+    0x38434000,
+    0x38438000,
+    0x3843c000,
+    0x38440000,
+    0x38444000,
+    0x38448000,
+    0x3844c000,
+    0x38450000,
+    0x38454000,
+    0x38458000,
+    0x3845c000,
+    0x38460000,
+    0x38464000,
+    0x38468000,
+    0x3846c000,
+    0x38470000,
+    0x38474000,
+    0x38478000,
+    0x3847c000,
+    0x38480000,
+    0x38484000,
+    0x38488000,
+    0x3848c000,
+    0x38490000,
+    0x38494000,
+    0x38498000,
+    0x3849c000,
+    0x384a0000,
+    0x384a4000,
+    0x384a8000,
+    0x384ac000,
+    0x384b0000,
+    0x384b4000,
+    0x384b8000,
+    0x384bc000,
+    0x384c0000,
+    0x384c4000,
+    0x384c8000,
+    0x384cc000,
+    0x384d0000,
+    0x384d4000,
+    0x384d8000,
+    0x384dc000,
+    0x384e0000,
+    0x384e4000,
+    0x384e8000,
+    0x384ec000,
+    0x384f0000,
+    0x384f4000,
+    0x384f8000,
+    0x384fc000,
+    0x38500000,
+    0x38504000,
+    0x38508000,
+    0x3850c000,
+    0x38510000,
+    0x38514000,
+    0x38518000,
+    0x3851c000,
+    0x38520000,
+    0x38524000,
+    0x38528000,
+    0x3852c000,
+    0x38530000,
+    0x38534000,
+    0x38538000,
+    0x3853c000,
+    0x38540000,
+    0x38544000,
+    0x38548000,
+    0x3854c000,
+    0x38550000,
+    0x38554000,
+    0x38558000,
+    0x3855c000,
+    0x38560000,
+    0x38564000,
+    0x38568000,
+    0x3856c000,
+    0x38570000,
+    0x38574000,
+    0x38578000,
+    0x3857c000,
+    0x38580000,
+    0x38584000,
+    0x38588000,
+    0x3858c000,
+    0x38590000,
+    0x38594000,
+    0x38598000,
+    0x3859c000,
+    0x385a0000,
+    0x385a4000,
+    0x385a8000,
+    0x385ac000,
+    0x385b0000,
+    0x385b4000,
+    0x385b8000,
+    0x385bc000,
+    0x385c0000,
+    0x385c4000,
+    0x385c8000,
+    0x385cc000,
+    0x385d0000,
+    0x385d4000,
+    0x385d8000,
+    0x385dc000,
+    0x385e0000,
+    0x385e4000,
+    0x385e8000,
+    0x385ec000,
+    0x385f0000,
+    0x385f4000,
+    0x385f8000,
+    0x385fc000,
+    0x38600000,
+    0x38604000,
+    0x38608000,
+    0x3860c000,
+    0x38610000,
+    0x38614000,
+    0x38618000,
+    0x3861c000,
+    0x38620000,
+    0x38624000,
+    0x38628000,
+    0x3862c000,
+    0x38630000,
+    0x38634000,
+    0x38638000,
+    0x3863c000,
+    0x38640000,
+    0x38644000,
+    0x38648000,
+    0x3864c000,
+    0x38650000,
+    0x38654000,
+    0x38658000,
+    0x3865c000,
+    0x38660000,
+    0x38664000,
+    0x38668000,
+    0x3866c000,
+    0x38670000,
+    0x38674000,
+    0x38678000,
+    0x3867c000,
+    0x38680000,
+    0x38684000,
+    0x38688000,
+    0x3868c000,
+    0x38690000,
+    0x38694000,
+    0x38698000,
+    0x3869c000,
+    0x386a0000,
+    0x386a4000,
+    0x386a8000,
+    0x386ac000,
+    0x386b0000,
+    0x386b4000,
+    0x386b8000,
+    0x386bc000,
+    0x386c0000,
+    0x386c4000,
+    0x386c8000,
+    0x386cc000,
+    0x386d0000,
+    0x386d4000,
+    0x386d8000,
+    0x386dc000,
+    0x386e0000,
+    0x386e4000,
+    0x386e8000,
+    0x386ec000,
+    0x386f0000,
+    0x386f4000,
+    0x386f8000,
+    0x386fc000,
+    0x38700000,
+    0x38704000,
+    0x38708000,
+    0x3870c000,
+    0x38710000,
+    0x38714000,
+    0x38718000,
+    0x3871c000,
+    0x38720000,
+    0x38724000,
+    0x38728000,
+    0x3872c000,
+    0x38730000,
+    0x38734000,
+    0x38738000,
+    0x3873c000,
+    0x38740000,
+    0x38744000,
+    0x38748000,
+    0x3874c000,
+    0x38750000,
+    0x38754000,
+    0x38758000,
+    0x3875c000,
+    0x38760000,
+    0x38764000,
+    0x38768000,
+    0x3876c000,
+    0x38770000,
+    0x38774000,
+    0x38778000,
+    0x3877c000,
+    0x38780000,
+    0x38784000,
+    0x38788000,
+    0x3878c000,
+    0x38790000,
+    0x38794000,
+    0x38798000,
+    0x3879c000,
+    0x387a0000,
+    0x387a4000,
+    0x387a8000,
+    0x387ac000,
+    0x387b0000,
+    0x387b4000,
+    0x387b8000,
+    0x387bc000,
+    0x387c0000,
+    0x387c4000,
+    0x387c8000,
+    0x387cc000,
+    0x387d0000,
+    0x387d4000,
+    0x387d8000,
+    0x387dc000,
+    0x387e0000,
+    0x387e4000,
+    0x387e8000,
+    0x387ec000,
+    0x387f0000,
+    0x387f4000,
+    0x387f8000,
+    0x387fc000,
+    0x38000000,
+    0x38002000,
+    0x38004000,
+    0x38006000,
+    0x38008000,
+    0x3800a000,
+    0x3800c000,
+    0x3800e000,
+    0x38010000,
+    0x38012000,
+    0x38014000,
+    0x38016000,
+    0x38018000,
+    0x3801a000,
+    0x3801c000,
+    0x3801e000,
+    0x38020000,
+    0x38022000,
+    0x38024000,
+    0x38026000,
+    0x38028000,
+    0x3802a000,
+    0x3802c000,
+    0x3802e000,
+    0x38030000,
+    0x38032000,
+    0x38034000,
+    0x38036000,
+    0x38038000,
+    0x3803a000,
+    0x3803c000,
+    0x3803e000,
+    0x38040000,
+    0x38042000,
+    0x38044000,
+    0x38046000,
+    0x38048000,
+    0x3804a000,
+    0x3804c000,
+    0x3804e000,
+    0x38050000,
+    0x38052000,
+    0x38054000,
+    0x38056000,
+    0x38058000,
+    0x3805a000,
+    0x3805c000,
+    0x3805e000,
+    0x38060000,
+    0x38062000,
+    0x38064000,
+    0x38066000,
+    0x38068000,
+    0x3806a000,
+    0x3806c000,
+    0x3806e000,
+    0x38070000,
+    0x38072000,
+    0x38074000,
+    0x38076000,
+    0x38078000,
+    0x3807a000,
+    0x3807c000,
+    0x3807e000,
+    0x38080000,
+    0x38082000,
+    0x38084000,
+    0x38086000,
+    0x38088000,
+    0x3808a000,
+    0x3808c000,
+    0x3808e000,
+    0x38090000,
+    0x38092000,
+    0x38094000,
+    0x38096000,
+    0x38098000,
+    0x3809a000,
+    0x3809c000,
+    0x3809e000,
+    0x380a0000,
+    0x380a2000,
+    0x380a4000,
+    0x380a6000,
+    0x380a8000,
+    0x380aa000,
+    0x380ac000,
+    0x380ae000,
+    0x380b0000,
+    0x380b2000,
+    0x380b4000,
+    0x380b6000,
+    0x380b8000,
+    0x380ba000,
+    0x380bc000,
+    0x380be000,
+    0x380c0000,
+    0x380c2000,
+    0x380c4000,
+    0x380c6000,
+    0x380c8000,
+    0x380ca000,
+    0x380cc000,
+    0x380ce000,
+    0x380d0000,
+    0x380d2000,
+    0x380d4000,
+    0x380d6000,
+    0x380d8000,
+    0x380da000,
+    0x380dc000,
+    0x380de000,
+    0x380e0000,
+    0x380e2000,
+    0x380e4000,
+    0x380e6000,
+    0x380e8000,
+    0x380ea000,
+    0x380ec000,
+    0x380ee000,
+    0x380f0000,
+    0x380f2000,
+    0x380f4000,
+    0x380f6000,
+    0x380f8000,
+    0x380fa000,
+    0x380fc000,
+    0x380fe000,
+    0x38100000,
+    0x38102000,
+    0x38104000,
+    0x38106000,
+    0x38108000,
+    0x3810a000,
+    0x3810c000,
+    0x3810e000,
+    0x38110000,
+    0x38112000,
+    0x38114000,
+    0x38116000,
+    0x38118000,
+    0x3811a000,
+    0x3811c000,
+    0x3811e000,
+    0x38120000,
+    0x38122000,
+    0x38124000,
+    0x38126000,
+    0x38128000,
+    0x3812a000,
+    0x3812c000,
+    0x3812e000,
+    0x38130000,
+    0x38132000,
+    0x38134000,
+    0x38136000,
+    0x38138000,
+    0x3813a000,
+    0x3813c000,
+    0x3813e000,
+    0x38140000,
+    0x38142000,
+    0x38144000,
+    0x38146000,
+    0x38148000,
+    0x3814a000,
+    0x3814c000,
+    0x3814e000,
+    0x38150000,
+    0x38152000,
+    0x38154000,
+    0x38156000,
+    0x38158000,
+    0x3815a000,
+    0x3815c000,
+    0x3815e000,
+    0x38160000,
+    0x38162000,
+    0x38164000,
+    0x38166000,
+    0x38168000,
+    0x3816a000,
+    0x3816c000,
+    0x3816e000,
+    0x38170000,
+    0x38172000,
+    0x38174000,
+    0x38176000,
+    0x38178000,
+    0x3817a000,
+    0x3817c000,
+    0x3817e000,
+    0x38180000,
+    0x38182000,
+    0x38184000,
+    0x38186000,
+    0x38188000,
+    0x3818a000,
+    0x3818c000,
+    0x3818e000,
+    0x38190000,
+    0x38192000,
+    0x38194000,
+    0x38196000,
+    0x38198000,
+    0x3819a000,
+    0x3819c000,
+    0x3819e000,
+    0x381a0000,
+    0x381a2000,
+    0x381a4000,
+    0x381a6000,
+    0x381a8000,
+    0x381aa000,
+    0x381ac000,
+    0x381ae000,
+    0x381b0000,
+    0x381b2000,
+    0x381b4000,
+    0x381b6000,
+    0x381b8000,
+    0x381ba000,
+    0x381bc000,
+    0x381be000,
+    0x381c0000,
+    0x381c2000,
+    0x381c4000,
+    0x381c6000,
+    0x381c8000,
+    0x381ca000,
+    0x381cc000,
+    0x381ce000,
+    0x381d0000,
+    0x381d2000,
+    0x381d4000,
+    0x381d6000,
+    0x381d8000,
+    0x381da000,
+    0x381dc000,
+    0x381de000,
+    0x381e0000,
+    0x381e2000,
+    0x381e4000,
+    0x381e6000,
+    0x381e8000,
+    0x381ea000,
+    0x381ec000,
+    0x381ee000,
+    0x381f0000,
+    0x381f2000,
+    0x381f4000,
+    0x381f6000,
+    0x381f8000,
+    0x381fa000,
+    0x381fc000,
+    0x381fe000,
+    0x38200000,
+    0x38202000,
+    0x38204000,
+    0x38206000,
+    0x38208000,
+    0x3820a000,
+    0x3820c000,
+    0x3820e000,
+    0x38210000,
+    0x38212000,
+    0x38214000,
+    0x38216000,
+    0x38218000,
+    0x3821a000,
+    0x3821c000,
+    0x3821e000,
+    0x38220000,
+    0x38222000,
+    0x38224000,
+    0x38226000,
+    0x38228000,
+    0x3822a000,
+    0x3822c000,
+    0x3822e000,
+    0x38230000,
+    0x38232000,
+    0x38234000,
+    0x38236000,
+    0x38238000,
+    0x3823a000,
+    0x3823c000,
+    0x3823e000,
+    0x38240000,
+    0x38242000,
+    0x38244000,
+    0x38246000,
+    0x38248000,
+    0x3824a000,
+    0x3824c000,
+    0x3824e000,
+    0x38250000,
+    0x38252000,
+    0x38254000,
+    0x38256000,
+    0x38258000,
+    0x3825a000,
+    0x3825c000,
+    0x3825e000,
+    0x38260000,
+    0x38262000,
+    0x38264000,
+    0x38266000,
+    0x38268000,
+    0x3826a000,
+    0x3826c000,
+    0x3826e000,
+    0x38270000,
+    0x38272000,
+    0x38274000,
+    0x38276000,
+    0x38278000,
+    0x3827a000,
+    0x3827c000,
+    0x3827e000,
+    0x38280000,
+    0x38282000,
+    0x38284000,
+    0x38286000,
+    0x38288000,
+    0x3828a000,
+    0x3828c000,
+    0x3828e000,
+    0x38290000,
+    0x38292000,
+    0x38294000,
+    0x38296000,
+    0x38298000,
+    0x3829a000,
+    0x3829c000,
+    0x3829e000,
+    0x382a0000,
+    0x382a2000,
+    0x382a4000,
+    0x382a6000,
+    0x382a8000,
+    0x382aa000,
+    0x382ac000,
+    0x382ae000,
+    0x382b0000,
+    0x382b2000,
+    0x382b4000,
+    0x382b6000,
+    0x382b8000,
+    0x382ba000,
+    0x382bc000,
+    0x382be000,
+    0x382c0000,
+    0x382c2000,
+    0x382c4000,
+    0x382c6000,
+    0x382c8000,
+    0x382ca000,
+    0x382cc000,
+    0x382ce000,
+    0x382d0000,
+    0x382d2000,
+    0x382d4000,
+    0x382d6000,
+    0x382d8000,
+    0x382da000,
+    0x382dc000,
+    0x382de000,
+    0x382e0000,
+    0x382e2000,
+    0x382e4000,
+    0x382e6000,
+    0x382e8000,
+    0x382ea000,
+    0x382ec000,
+    0x382ee000,
+    0x382f0000,
+    0x382f2000,
+    0x382f4000,
+    0x382f6000,
+    0x382f8000,
+    0x382fa000,
+    0x382fc000,
+    0x382fe000,
+    0x38300000,
+    0x38302000,
+    0x38304000,
+    0x38306000,
+    0x38308000,
+    0x3830a000,
+    0x3830c000,
+    0x3830e000,
+    0x38310000,
+    0x38312000,
+    0x38314000,
+    0x38316000,
+    0x38318000,
+    0x3831a000,
+    0x3831c000,
+    0x3831e000,
+    0x38320000,
+    0x38322000,
+    0x38324000,
+    0x38326000,
+    0x38328000,
+    0x3832a000,
+    0x3832c000,
+    0x3832e000,
+    0x38330000,
+    0x38332000,
+    0x38334000,
+    0x38336000,
+    0x38338000,
+    0x3833a000,
+    0x3833c000,
+    0x3833e000,
+    0x38340000,
+    0x38342000,
+    0x38344000,
+    0x38346000,
+    0x38348000,
+    0x3834a000,
+    0x3834c000,
+    0x3834e000,
+    0x38350000,
+    0x38352000,
+    0x38354000,
+    0x38356000,
+    0x38358000,
+    0x3835a000,
+    0x3835c000,
+    0x3835e000,
+    0x38360000,
+    0x38362000,
+    0x38364000,
+    0x38366000,
+    0x38368000,
+    0x3836a000,
+    0x3836c000,
+    0x3836e000,
+    0x38370000,
+    0x38372000,
+    0x38374000,
+    0x38376000,
+    0x38378000,
+    0x3837a000,
+    0x3837c000,
+    0x3837e000,
+    0x38380000,
+    0x38382000,
+    0x38384000,
+    0x38386000,
+    0x38388000,
+    0x3838a000,
+    0x3838c000,
+    0x3838e000,
+    0x38390000,
+    0x38392000,
+    0x38394000,
+    0x38396000,
+    0x38398000,
+    0x3839a000,
+    0x3839c000,
+    0x3839e000,
+    0x383a0000,
+    0x383a2000,
+    0x383a4000,
+    0x383a6000,
+    0x383a8000,
+    0x383aa000,
+    0x383ac000,
+    0x383ae000,
+    0x383b0000,
+    0x383b2000,
+    0x383b4000,
+    0x383b6000,
+    0x383b8000,
+    0x383ba000,
+    0x383bc000,
+    0x383be000,
+    0x383c0000,
+    0x383c2000,
+    0x383c4000,
+    0x383c6000,
+    0x383c8000,
+    0x383ca000,
+    0x383cc000,
+    0x383ce000,
+    0x383d0000,
+    0x383d2000,
+    0x383d4000,
+    0x383d6000,
+    0x383d8000,
+    0x383da000,
+    0x383dc000,
+    0x383de000,
+    0x383e0000,
+    0x383e2000,
+    0x383e4000,
+    0x383e6000,
+    0x383e8000,
+    0x383ea000,
+    0x383ec000,
+    0x383ee000,
+    0x383f0000,
+    0x383f2000,
+    0x383f4000,
+    0x383f6000,
+    0x383f8000,
+    0x383fa000,
+    0x383fc000,
+    0x383fe000,
+    0x38400000,
+    0x38402000,
+    0x38404000,
+    0x38406000,
+    0x38408000,
+    0x3840a000,
+    0x3840c000,
+    0x3840e000,
+    0x38410000,
+    0x38412000,
+    0x38414000,
+    0x38416000,
+    0x38418000,
+    0x3841a000,
+    0x3841c000,
+    0x3841e000,
+    0x38420000,
+    0x38422000,
+    0x38424000,
+    0x38426000,
+    0x38428000,
+    0x3842a000,
+    0x3842c000,
+    0x3842e000,
+    0x38430000,
+    0x38432000,
+    0x38434000,
+    0x38436000,
+    0x38438000,
+    0x3843a000,
+    0x3843c000,
+    0x3843e000,
+    0x38440000,
+    0x38442000,
+    0x38444000,
+    0x38446000,
+    0x38448000,
+    0x3844a000,
+    0x3844c000,
+    0x3844e000,
+    0x38450000,
+    0x38452000,
+    0x38454000,
+    0x38456000,
+    0x38458000,
+    0x3845a000,
+    0x3845c000,
+    0x3845e000,
+    0x38460000,
+    0x38462000,
+    0x38464000,
+    0x38466000,
+    0x38468000,
+    0x3846a000,
+    0x3846c000,
+    0x3846e000,
+    0x38470000,
+    0x38472000,
+    0x38474000,
+    0x38476000,
+    0x38478000,
+    0x3847a000,
+    0x3847c000,
+    0x3847e000,
+    0x38480000,
+    0x38482000,
+    0x38484000,
+    0x38486000,
+    0x38488000,
+    0x3848a000,
+    0x3848c000,
+    0x3848e000,
+    0x38490000,
+    0x38492000,
+    0x38494000,
+    0x38496000,
+    0x38498000,
+    0x3849a000,
+    0x3849c000,
+    0x3849e000,
+    0x384a0000,
+    0x384a2000,
+    0x384a4000,
+    0x384a6000,
+    0x384a8000,
+    0x384aa000,
+    0x384ac000,
+    0x384ae000,
+    0x384b0000,
+    0x384b2000,
+    0x384b4000,
+    0x384b6000,
+    0x384b8000,
+    0x384ba000,
+    0x384bc000,
+    0x384be000,
+    0x384c0000,
+    0x384c2000,
+    0x384c4000,
+    0x384c6000,
+    0x384c8000,
+    0x384ca000,
+    0x384cc000,
+    0x384ce000,
+    0x384d0000,
+    0x384d2000,
+    0x384d4000,
+    0x384d6000,
+    0x384d8000,
+    0x384da000,
+    0x384dc000,
+    0x384de000,
+    0x384e0000,
+    0x384e2000,
+    0x384e4000,
+    0x384e6000,
+    0x384e8000,
+    0x384ea000,
+    0x384ec000,
+    0x384ee000,
+    0x384f0000,
+    0x384f2000,
+    0x384f4000,
+    0x384f6000,
+    0x384f8000,
+    0x384fa000,
+    0x384fc000,
+    0x384fe000,
+    0x38500000,
+    0x38502000,
+    0x38504000,
+    0x38506000,
+    0x38508000,
+    0x3850a000,
+    0x3850c000,
+    0x3850e000,
+    0x38510000,
+    0x38512000,
+    0x38514000,
+    0x38516000,
+    0x38518000,
+    0x3851a000,
+    0x3851c000,
+    0x3851e000,
+    0x38520000,
+    0x38522000,
+    0x38524000,
+    0x38526000,
+    0x38528000,
+    0x3852a000,
+    0x3852c000,
+    0x3852e000,
+    0x38530000,
+    0x38532000,
+    0x38534000,
+    0x38536000,
+    0x38538000,
+    0x3853a000,
+    0x3853c000,
+    0x3853e000,
+    0x38540000,
+    0x38542000,
+    0x38544000,
+    0x38546000,
+    0x38548000,
+    0x3854a000,
+    0x3854c000,
+    0x3854e000,
+    0x38550000,
+    0x38552000,
+    0x38554000,
+    0x38556000,
+    0x38558000,
+    0x3855a000,
+    0x3855c000,
+    0x3855e000,
+    0x38560000,
+    0x38562000,
+    0x38564000,
+    0x38566000,
+    0x38568000,
+    0x3856a000,
+    0x3856c000,
+    0x3856e000,
+    0x38570000,
+    0x38572000,
+    0x38574000,
+    0x38576000,
+    0x38578000,
+    0x3857a000,
+    0x3857c000,
+    0x3857e000,
+    0x38580000,
+    0x38582000,
+    0x38584000,
+    0x38586000,
+    0x38588000,
+    0x3858a000,
+    0x3858c000,
+    0x3858e000,
+    0x38590000,
+    0x38592000,
+    0x38594000,
+    0x38596000,
+    0x38598000,
+    0x3859a000,
+    0x3859c000,
+    0x3859e000,
+    0x385a0000,
+    0x385a2000,
+    0x385a4000,
+    0x385a6000,
+    0x385a8000,
+    0x385aa000,
+    0x385ac000,
+    0x385ae000,
+    0x385b0000,
+    0x385b2000,
+    0x385b4000,
+    0x385b6000,
+    0x385b8000,
+    0x385ba000,
+    0x385bc000,
+    0x385be000,
+    0x385c0000,
+    0x385c2000,
+    0x385c4000,
+    0x385c6000,
+    0x385c8000,
+    0x385ca000,
+    0x385cc000,
+    0x385ce000,
+    0x385d0000,
+    0x385d2000,
+    0x385d4000,
+    0x385d6000,
+    0x385d8000,
+    0x385da000,
+    0x385dc000,
+    0x385de000,
+    0x385e0000,
+    0x385e2000,
+    0x385e4000,
+    0x385e6000,
+    0x385e8000,
+    0x385ea000,
+    0x385ec000,
+    0x385ee000,
+    0x385f0000,
+    0x385f2000,
+    0x385f4000,
+    0x385f6000,
+    0x385f8000,
+    0x385fa000,
+    0x385fc000,
+    0x385fe000,
+    0x38600000,
+    0x38602000,
+    0x38604000,
+    0x38606000,
+    0x38608000,
+    0x3860a000,
+    0x3860c000,
+    0x3860e000,
+    0x38610000,
+    0x38612000,
+    0x38614000,
+    0x38616000,
+    0x38618000,
+    0x3861a000,
+    0x3861c000,
+    0x3861e000,
+    0x38620000,
+    0x38622000,
+    0x38624000,
+    0x38626000,
+    0x38628000,
+    0x3862a000,
+    0x3862c000,
+    0x3862e000,
+    0x38630000,
+    0x38632000,
+    0x38634000,
+    0x38636000,
+    0x38638000,
+    0x3863a000,
+    0x3863c000,
+    0x3863e000,
+    0x38640000,
+    0x38642000,
+    0x38644000,
+    0x38646000,
+    0x38648000,
+    0x3864a000,
+    0x3864c000,
+    0x3864e000,
+    0x38650000,
+    0x38652000,
+    0x38654000,
+    0x38656000,
+    0x38658000,
+    0x3865a000,
+    0x3865c000,
+    0x3865e000,
+    0x38660000,
+    0x38662000,
+    0x38664000,
+    0x38666000,
+    0x38668000,
+    0x3866a000,
+    0x3866c000,
+    0x3866e000,
+    0x38670000,
+    0x38672000,
+    0x38674000,
+    0x38676000,
+    0x38678000,
+    0x3867a000,
+    0x3867c000,
+    0x3867e000,
+    0x38680000,
+    0x38682000,
+    0x38684000,
+    0x38686000,
+    0x38688000,
+    0x3868a000,
+    0x3868c000,
+    0x3868e000,
+    0x38690000,
+    0x38692000,
+    0x38694000,
+    0x38696000,
+    0x38698000,
+    0x3869a000,
+    0x3869c000,
+    0x3869e000,
+    0x386a0000,
+    0x386a2000,
+    0x386a4000,
+    0x386a6000,
+    0x386a8000,
+    0x386aa000,
+    0x386ac000,
+    0x386ae000,
+    0x386b0000,
+    0x386b2000,
+    0x386b4000,
+    0x386b6000,
+    0x386b8000,
+    0x386ba000,
+    0x386bc000,
+    0x386be000,
+    0x386c0000,
+    0x386c2000,
+    0x386c4000,
+    0x386c6000,
+    0x386c8000,
+    0x386ca000,
+    0x386cc000,
+    0x386ce000,
+    0x386d0000,
+    0x386d2000,
+    0x386d4000,
+    0x386d6000,
+    0x386d8000,
+    0x386da000,
+    0x386dc000,
+    0x386de000,
+    0x386e0000,
+    0x386e2000,
+    0x386e4000,
+    0x386e6000,
+    0x386e8000,
+    0x386ea000,
+    0x386ec000,
+    0x386ee000,
+    0x386f0000,
+    0x386f2000,
+    0x386f4000,
+    0x386f6000,
+    0x386f8000,
+    0x386fa000,
+    0x386fc000,
+    0x386fe000,
+    0x38700000,
+    0x38702000,
+    0x38704000,
+    0x38706000,
+    0x38708000,
+    0x3870a000,
+    0x3870c000,
+    0x3870e000,
+    0x38710000,
+    0x38712000,
+    0x38714000,
+    0x38716000,
+    0x38718000,
+    0x3871a000,
+    0x3871c000,
+    0x3871e000,
+    0x38720000,
+    0x38722000,
+    0x38724000,
+    0x38726000,
+    0x38728000,
+    0x3872a000,
+    0x3872c000,
+    0x3872e000,
+    0x38730000,
+    0x38732000,
+    0x38734000,
+    0x38736000,
+    0x38738000,
+    0x3873a000,
+    0x3873c000,
+    0x3873e000,
+    0x38740000,
+    0x38742000,
+    0x38744000,
+    0x38746000,
+    0x38748000,
+    0x3874a000,
+    0x3874c000,
+    0x3874e000,
+    0x38750000,
+    0x38752000,
+    0x38754000,
+    0x38756000,
+    0x38758000,
+    0x3875a000,
+    0x3875c000,
+    0x3875e000,
+    0x38760000,
+    0x38762000,
+    0x38764000,
+    0x38766000,
+    0x38768000,
+    0x3876a000,
+    0x3876c000,
+    0x3876e000,
+    0x38770000,
+    0x38772000,
+    0x38774000,
+    0x38776000,
+    0x38778000,
+    0x3877a000,
+    0x3877c000,
+    0x3877e000,
+    0x38780000,
+    0x38782000,
+    0x38784000,
+    0x38786000,
+    0x38788000,
+    0x3878a000,
+    0x3878c000,
+    0x3878e000,
+    0x38790000,
+    0x38792000,
+    0x38794000,
+    0x38796000,
+    0x38798000,
+    0x3879a000,
+    0x3879c000,
+    0x3879e000,
+    0x387a0000,
+    0x387a2000,
+    0x387a4000,
+    0x387a6000,
+    0x387a8000,
+    0x387aa000,
+    0x387ac000,
+    0x387ae000,
+    0x387b0000,
+    0x387b2000,
+    0x387b4000,
+    0x387b6000,
+    0x387b8000,
+    0x387ba000,
+    0x387bc000,
+    0x387be000,
+    0x387c0000,
+    0x387c2000,
+    0x387c4000,
+    0x387c6000,
+    0x387c8000,
+    0x387ca000,
+    0x387cc000,
+    0x387ce000,
+    0x387d0000,
+    0x387d2000,
+    0x387d4000,
+    0x387d6000,
+    0x387d8000,
+    0x387da000,
+    0x387dc000,
+    0x387de000,
+    0x387e0000,
+    0x387e2000,
+    0x387e4000,
+    0x387e6000,
+    0x387e8000,
+    0x387ea000,
+    0x387ec000,
+    0x387ee000,
+    0x387f0000,
+    0x387f2000,
+    0x387f4000,
+    0x387f6000,
+    0x387f8000,
+    0x387fa000,
+    0x387fc000,
+    0x387fe000,
+};
+
+const static unsigned g_exponent[64] = {
+    0x00000000,
+    0x00800000,
+    0x01000000,
+    0x01800000,
+    0x02000000,
+    0x02800000,
+    0x03000000,
+    0x03800000,
+    0x04000000,
+    0x04800000,
+    0x05000000,
+    0x05800000,
+    0x06000000,
+    0x06800000,
+    0x07000000,
+    0x07800000,
+    0x08000000,
+    0x08800000,
+    0x09000000,
+    0x09800000,
+    0x0a000000,
+    0x0a800000,
+    0x0b000000,
+    0x0b800000,
+    0x0c000000,
+    0x0c800000,
+    0x0d000000,
+    0x0d800000,
+    0x0e000000,
+    0x0e800000,
+    0x0f000000,
+    0x47800000,
+    0x80000000,
+    0x80800000,
+    0x81000000,
+    0x81800000,
+    0x82000000,
+    0x82800000,
+    0x83000000,
+    0x83800000,
+    0x84000000,
+    0x84800000,
+    0x85000000,
+    0x85800000,
+    0x86000000,
+    0x86800000,
+    0x87000000,
+    0x87800000,
+    0x88000000,
+    0x88800000,
+    0x89000000,
+    0x89800000,
+    0x8a000000,
+    0x8a800000,
+    0x8b000000,
+    0x8b800000,
+    0x8c000000,
+    0x8c800000,
+    0x8d000000,
+    0x8d800000,
+    0x8e000000,
+    0x8e800000,
+    0x8f000000,
+    0xc7800000,
+};
+
+const static unsigned g_offset[64] = {
+    0x00000000,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000000,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+    0x00000400,
+};
+
+float float16ToFloat32(unsigned short h)
+{
+    unsigned i32 = g_mantissa[g_offset[h &gt;&gt; 10] + (h &amp; 0x3ff)] + g_exponent[h &gt;&gt; 10];
+    return *(float*) &amp;i32;
+}
+}
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFloat16ToFloat32py"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.py (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.py                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Float16ToFloat32.py        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+# 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.
+#
+
+# This script generates a function that converts 16-bit precision floating
+# point numbers to 32-bit.
+# It is based on ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf.
+
+def convertMantissa(i):
+    if i == 0:
+        return 0
+    elif i &lt; 1024:
+        m = i &lt;&lt; 13
+        e = 0
+        while not (m &amp; 0x00800000):
+            e -= 0x00800000
+            m = m &lt;&lt; 1
+        m &amp;= ~0x00800000
+        e += 0x38800000
+        return m | e
+    else:
+        return 0x38000000 + ((i - 1024) &lt;&lt; 13)
+
+def convertExponent(i):
+    if i == 0:
+        return 0
+    elif i in range(1, 31):
+        return i &lt;&lt; 23
+    elif i == 31:
+        return 0x47800000
+    elif i == 32:
+        return 0x80000000
+    elif i in range(33, 63):
+        return 0x80000000 + ((i - 32) &lt;&lt; 23)
+    else:
+        return 0xC7800000
+
+def convertOffset(i):
+    if i == 0 or i == 32:
+        return 0
+    else:
+        return 1024
+
+print &quot;&quot;&quot;//
+// 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.
+//
+
+// This file is automatically generated.
+
+namespace gl
+{
+&quot;&quot;&quot;
+
+print &quot;const static unsigned g_mantissa[2048] = {&quot;
+for i in range(0, 2048):
+    print &quot;    %#010x,&quot; % convertMantissa(i)
+print &quot;};\n&quot;
+
+print &quot;const static unsigned g_exponent[64] = {&quot;
+for i in range(0, 64):
+    print &quot;    %#010x,&quot; % convertExponent(i)
+print &quot;};\n&quot;
+
+print &quot;const static unsigned g_offset[64] = {&quot;
+for i in range(0, 64):
+    print &quot;    %#010x,&quot; % convertOffset(i)
+print &quot;};\n&quot;
+
+print &quot;&quot;&quot;float float16ToFloat32(unsigned short h)
+{
+    unsigned i32 = g_mantissa[g_offset[h &gt;&gt; 10] + (h &amp; 0x3ff)] + g_exponent[h &gt;&gt; 10];
+    return *(float*) &amp;i32;
+}
+}
+&quot;&quot;&quot;
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFramebuffercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,644 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/Framebuffer.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/FramebufferImpl.h&quot;
+#include &quot;libANGLE/renderer/ImplFactory.h&quot;
+#include &quot;libANGLE/renderer/RenderbufferImpl.h&quot;
+#include &quot;libANGLE/renderer/Workarounds.h&quot;
+
+namespace gl
+{
+
+namespace
+{
+void DetachMatchingAttachment(FramebufferAttachment *attachment, GLenum matchType, GLuint matchId)
+{
+    if (attachment-&gt;isAttached() &amp;&amp;
+        attachment-&gt;type() == matchType &amp;&amp;
+        attachment-&gt;id() == matchId)
+    {
+        attachment-&gt;detach();
+    }
+}
+}
+
+Framebuffer::Data::Data(const Caps &amp;caps)
+    : mColorAttachments(caps.maxColorAttachments),
+      mDrawBufferStates(caps.maxDrawBuffers, GL_NONE),
+      mReadBufferState(GL_COLOR_ATTACHMENT0_EXT)
+{
+    mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
+}
+
+Framebuffer::Data::~Data()
+{
+}
+
+const FramebufferAttachment *Framebuffer::Data::getReadAttachment() const
+{
+    ASSERT(mReadBufferState == GL_BACK || (mReadBufferState &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp; mReadBufferState &lt;= GL_COLOR_ATTACHMENT15));
+    size_t readIndex = (mReadBufferState == GL_BACK ? 0 : static_cast&lt;size_t&gt;(mReadBufferState - GL_COLOR_ATTACHMENT0));
+    ASSERT(readIndex &lt; mColorAttachments.size());
+    return mColorAttachments[readIndex].isAttached() ? &amp;mColorAttachments[readIndex] : nullptr;
+}
+
+const FramebufferAttachment *Framebuffer::Data::getFirstColorAttachment() const
+{
+    for (const FramebufferAttachment &amp;colorAttachment : mColorAttachments)
+    {
+        if (colorAttachment.isAttached())
+        {
+            return &amp;colorAttachment;
+        }
+    }
+
+    return nullptr;
+}
+
+const FramebufferAttachment *Framebuffer::Data::getDepthOrStencilAttachment() const
+{
+    if (mDepthAttachment.isAttached())
+    {
+        return &amp;mDepthAttachment;
+    }
+    if (mStencilAttachment.isAttached())
+    {
+        return &amp;mStencilAttachment;
+    }
+    return nullptr;
+}
+
+const FramebufferAttachment *Framebuffer::Data::getColorAttachment(unsigned int colorAttachment) const
+{
+    ASSERT(colorAttachment &lt; mColorAttachments.size());
+    return mColorAttachments[colorAttachment].isAttached() ?
+           &amp;mColorAttachments[colorAttachment] :
+           nullptr;
+}
+
+const FramebufferAttachment *Framebuffer::Data::getDepthAttachment() const
+{
+    return mDepthAttachment.isAttached() ? &amp;mDepthAttachment : nullptr;
+}
+
+const FramebufferAttachment *Framebuffer::Data::getStencilAttachment() const
+{
+    return mStencilAttachment.isAttached() ? &amp;mStencilAttachment : nullptr;
+}
+
+const FramebufferAttachment *Framebuffer::Data::getDepthStencilAttachment() const
+{
+    // A valid depth-stencil attachment has the same resource bound to both the
+    // depth and stencil attachment points.
+    if (mDepthAttachment.isAttached() &amp;&amp; mStencilAttachment.isAttached() &amp;&amp;
+        mDepthAttachment.type() == mStencilAttachment.type() &amp;&amp;
+        mDepthAttachment.id() == mStencilAttachment.id())
+    {
+        return &amp;mDepthAttachment;
+    }
+
+    return nullptr;
+}
+
+Framebuffer::Framebuffer(const Caps &amp;caps, rx::ImplFactory *factory, GLuint id)
+    : mData(caps),
+      mImpl(nullptr),
+      mId(id)
+{
+    if (mId == 0)
+    {
+        mImpl = factory-&gt;createDefaultFramebuffer(mData);
+    }
+    else
+    {
+        mImpl = factory-&gt;createFramebuffer(mData);
+    }
+    ASSERT(mImpl != nullptr);
+}
+
+Framebuffer::~Framebuffer()
+{
+    SafeDelete(mImpl);
+}
+
+void Framebuffer::detachTexture(GLuint textureId)
+{
+    detachResourceById(GL_TEXTURE, textureId);
+}
+
+void Framebuffer::detachRenderbuffer(GLuint renderbufferId)
+{
+    detachResourceById(GL_RENDERBUFFER, renderbufferId);
+}
+
+void Framebuffer::detachResourceById(GLenum resourceType, GLuint resourceId)
+{
+    for (auto &amp;colorAttachment : mData.mColorAttachments)
+    {
+        DetachMatchingAttachment(&amp;colorAttachment, resourceType, resourceId);
+    }
+
+    DetachMatchingAttachment(&amp;mData.mDepthAttachment, resourceType, resourceId);
+    DetachMatchingAttachment(&amp;mData.mStencilAttachment, resourceType, resourceId);
+}
+
+const FramebufferAttachment *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
+{
+    return mData.getColorAttachment(colorAttachment);
+}
+
+const FramebufferAttachment *Framebuffer::getDepthbuffer() const
+{
+    return mData.getDepthAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getStencilbuffer() const
+{
+    return mData.getStencilAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getDepthStencilBuffer() const
+{
+    return mData.getDepthStencilAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getDepthOrStencilbuffer() const
+{
+    return mData.getDepthOrStencilAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getReadColorbuffer() const
+{
+    return mData.getReadAttachment();
+}
+
+GLenum Framebuffer::getReadColorbufferType() const
+{
+    const FramebufferAttachment *readAttachment = mData.getReadAttachment();
+    return (readAttachment != nullptr ? readAttachment-&gt;type() : GL_NONE);
+}
+
+const FramebufferAttachment *Framebuffer::getFirstColorbuffer() const
+{
+    return mData.getFirstColorAttachment();
+}
+
+const FramebufferAttachment *Framebuffer::getAttachment(GLenum attachment) const
+{
+    if (attachment &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15)
+    {
+        return mData.getColorAttachment(attachment - GL_COLOR_ATTACHMENT0);
+    }
+    else
+    {
+        switch (attachment)
+        {
+          case GL_COLOR:
+          case GL_BACK:
+            return mData.getColorAttachment(0);
+          case GL_DEPTH:
+          case GL_DEPTH_ATTACHMENT:
+            return mData.getDepthAttachment();
+          case GL_STENCIL:
+          case GL_STENCIL_ATTACHMENT:
+            return mData.getStencilAttachment();
+          case GL_DEPTH_STENCIL:
+          case GL_DEPTH_STENCIL_ATTACHMENT:
+            return getDepthStencilBuffer();
+          default:
+            UNREACHABLE();
+            return nullptr;
+        }
+    }
+}
+
+GLenum Framebuffer::getDrawBufferState(unsigned int colorAttachment) const
+{
+    ASSERT(colorAttachment &lt; mData.mDrawBufferStates.size());
+    return mData.mDrawBufferStates[colorAttachment];
+}
+
+void Framebuffer::setDrawBuffers(size_t count, const GLenum *buffers)
+{
+    auto &amp;drawStates = mData.mDrawBufferStates;
+
+    ASSERT(count &lt;= drawStates.size());
+    std::copy(buffers, buffers + count, drawStates.begin());
+    std::fill(drawStates.begin() + count, drawStates.end(), GL_NONE);
+    mImpl-&gt;setDrawBuffers(count, buffers);
+}
+
+GLenum Framebuffer::getReadBufferState() const
+{
+    return mData.mReadBufferState;
+}
+
+void Framebuffer::setReadBuffer(GLenum buffer)
+{
+    ASSERT(buffer == GL_BACK || buffer == GL_NONE ||
+           (buffer &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp;
+            (buffer - GL_COLOR_ATTACHMENT0) &lt; mData.mColorAttachments.size()));
+    mData.mReadBufferState = buffer;
+    mImpl-&gt;setReadBuffer(buffer);
+}
+
+bool Framebuffer::isEnabledColorAttachment(unsigned int colorAttachment) const
+{
+    ASSERT(colorAttachment &lt; mData.mColorAttachments.size());
+    return (mData.mColorAttachments[colorAttachment].isAttached() &amp;&amp;
+            mData.mDrawBufferStates[colorAttachment] != GL_NONE);
+}
+
+bool Framebuffer::hasEnabledColorAttachment() const
+{
+    for (size_t colorAttachment = 0; colorAttachment &lt; mData.mColorAttachments.size(); ++colorAttachment)
+    {
+        if (isEnabledColorAttachment(static_cast&lt;unsigned int&gt;(colorAttachment)))
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+bool Framebuffer::hasStencil() const
+{
+    return (mData.mStencilAttachment.isAttached() &amp;&amp; mData.mStencilAttachment.getStencilSize() &gt; 0);
+}
+
+bool Framebuffer::usingExtendedDrawBuffers() const
+{
+    for (size_t colorAttachment = 1; colorAttachment &lt; mData.mColorAttachments.size(); ++colorAttachment)
+    {
+        if (isEnabledColorAttachment(static_cast&lt;unsigned int&gt;(colorAttachment)))
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+GLenum Framebuffer::checkStatus(const gl::Data &amp;data) const
+{
+    // The default framebuffer *must* always be complete, though it may not be
+    // subject to the same rules as application FBOs. ie, it could have 0x0 size.
+    if (mId == 0)
+    {
+        return GL_FRAMEBUFFER_COMPLETE;
+    }
+
+    int width = 0;
+    int height = 0;
+    unsigned int colorbufferSize = 0;
+    int samples = -1;
+    bool missingAttachment = true;
+
+    for (const FramebufferAttachment &amp;colorAttachment : mData.mColorAttachments)
+    {
+        if (colorAttachment.isAttached())
+        {
+            if (colorAttachment.getWidth() == 0 || colorAttachment.getHeight() == 0)
+            {
+                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+            }
+
+            GLenum internalformat = colorAttachment.getInternalFormat();
+            const TextureCaps &amp;formatCaps = data.textureCaps-&gt;get(internalformat);
+            const InternalFormat &amp;formatInfo = GetInternalFormatInfo(internalformat);
+            if (colorAttachment.type() == GL_TEXTURE)
+            {
+                if (!formatCaps.renderable)
+                {
+                    return GL_FRAMEBUFFER_UNSUPPORTED;
+                }
+
+                if (formatInfo.depthBits &gt; 0 || formatInfo.stencilBits &gt; 0)
+                {
+                    return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+                }
+            }
+            else if (colorAttachment.type() == GL_RENDERBUFFER)
+            {
+                if (!formatCaps.renderable || formatInfo.depthBits &gt; 0 || formatInfo.stencilBits &gt; 0)
+                {
+                    return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+                }
+            }
+
+            if (!missingAttachment)
+            {
+                // all color attachments must have the same width and height
+                if (colorAttachment.getWidth() != width || colorAttachment.getHeight() != height)
+                {
+                    return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
+                }
+
+                // APPLE_framebuffer_multisample, which EXT_draw_buffers refers to, requires that
+                // all color attachments have the same number of samples for the FBO to be complete.
+                if (colorAttachment.getSamples() != samples)
+                {
+                    return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT;
+                }
+
+                // in GLES 2.0, all color attachments attachments must have the same number of bitplanes
+                // in GLES 3.0, there is no such restriction
+                if (data.clientVersion &lt; 3)
+                {
+                    if (formatInfo.pixelBytes != colorbufferSize)
+                    {
+                        return GL_FRAMEBUFFER_UNSUPPORTED;
+                    }
+                }
+            }
+            else
+            {
+                width = colorAttachment.getWidth();
+                height = colorAttachment.getHeight();
+                samples = colorAttachment.getSamples();
+                colorbufferSize = formatInfo.pixelBytes;
+                missingAttachment = false;
+            }
+        }
+    }
+
+    const FramebufferAttachment &amp;depthAttachment = mData.mDepthAttachment;
+    if (depthAttachment.isAttached())
+    {
+        if (depthAttachment.getWidth() == 0 || depthAttachment.getHeight() == 0)
+        {
+            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+        }
+
+        GLenum internalformat = depthAttachment.getInternalFormat();
+        const TextureCaps &amp;formatCaps = data.textureCaps-&gt;get(internalformat);
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(internalformat);
+        if (depthAttachment.type() == GL_TEXTURE)
+        {
+            // depth texture attachments require OES/ANGLE_depth_texture
+            if (!data.extensions-&gt;depthTextures)
+            {
+                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+            }
+
+            if (!formatCaps.renderable)
+            {
+                return GL_FRAMEBUFFER_UNSUPPORTED;
+            }
+
+            if (formatInfo.depthBits == 0)
+            {
+                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+            }
+        }
+        else if (depthAttachment.type() == GL_RENDERBUFFER)
+        {
+            if (!formatCaps.renderable || formatInfo.depthBits == 0)
+            {
+                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+            }
+        }
+
+        if (missingAttachment)
+        {
+            width = depthAttachment.getWidth();
+            height = depthAttachment.getHeight();
+            samples = depthAttachment.getSamples();
+            missingAttachment = false;
+        }
+        else if (width != depthAttachment.getWidth() || height != depthAttachment.getHeight())
+        {
+            return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
+        }
+        else if (samples != depthAttachment.getSamples())
+        {
+            return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
+        }
+    }
+
+    const FramebufferAttachment &amp;stencilAttachment = mData.mStencilAttachment;
+    if (stencilAttachment.isAttached())
+    {
+        if (stencilAttachment.getWidth() == 0 || stencilAttachment.getHeight() == 0)
+        {
+            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+        }
+
+        GLenum internalformat = stencilAttachment.getInternalFormat();
+        const TextureCaps &amp;formatCaps = data.textureCaps-&gt;get(internalformat);
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(internalformat);
+        if (stencilAttachment.type() == GL_TEXTURE)
+        {
+            // texture stencil attachments come along as part
+            // of OES_packed_depth_stencil + OES/ANGLE_depth_texture
+            if (!data.extensions-&gt;depthTextures)
+            {
+                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+            }
+
+            if (!formatCaps.renderable)
+            {
+                return GL_FRAMEBUFFER_UNSUPPORTED;
+            }
+
+            if (formatInfo.stencilBits == 0)
+            {
+                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+            }
+        }
+        else if (stencilAttachment.type() == GL_RENDERBUFFER)
+        {
+            if (!formatCaps.renderable || formatInfo.stencilBits == 0)
+            {
+                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+            }
+        }
+
+        if (missingAttachment)
+        {
+            width = stencilAttachment.getWidth();
+            height = stencilAttachment.getHeight();
+            samples = stencilAttachment.getSamples();
+            missingAttachment = false;
+        }
+        else if (width != stencilAttachment.getWidth() || height != stencilAttachment.getHeight())
+        {
+            return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
+        }
+        else if (samples != stencilAttachment.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 (depthAttachment.isAttached() &amp;&amp; stencilAttachment.isAttached() &amp;&amp; !hasValidDepthStencil())
+    {
+        return GL_FRAMEBUFFER_UNSUPPORTED;
+    }
+
+    // we need to have at least one attachment to be complete
+    if (missingAttachment)
+    {
+        return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
+    }
+
+    return mImpl-&gt;checkStatus();
+}
+
+Error Framebuffer::invalidate(size_t count, const GLenum *attachments)
+{
+    return mImpl-&gt;invalidate(count, attachments);
+}
+
+Error Framebuffer::invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &amp;area)
+{
+    return mImpl-&gt;invalidateSub(count, attachments, area);
+}
+
+Error Framebuffer::clear(const gl::Data &amp;data, GLbitfield mask)
+{
+    return mImpl-&gt;clear(data, mask);
+}
+
+Error Framebuffer::clearBufferfv(const State &amp;state, GLenum buffer, GLint drawbuffer, const GLfloat *values)
+{
+    return mImpl-&gt;clearBufferfv(state, buffer, drawbuffer, values);
+}
+
+Error Framebuffer::clearBufferuiv(const State &amp;state, GLenum buffer, GLint drawbuffer, const GLuint *values)
+{
+    return mImpl-&gt;clearBufferuiv(state, buffer, drawbuffer, values);
+}
+
+Error Framebuffer::clearBufferiv(const State &amp;state, GLenum buffer, GLint drawbuffer, const GLint *values)
+{
+    return mImpl-&gt;clearBufferiv(state, buffer, drawbuffer, values);
+}
+
+Error Framebuffer::clearBufferfi(const State &amp;state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+    return mImpl-&gt;clearBufferfi(state, buffer, drawbuffer, depth, stencil);
+}
+
+GLenum Framebuffer::getImplementationColorReadFormat() const
+{
+    return mImpl-&gt;getImplementationColorReadFormat();
+}
+
+GLenum Framebuffer::getImplementationColorReadType() const
+{
+    return mImpl-&gt;getImplementationColorReadType();
+}
+
+Error Framebuffer::readPixels(const gl::State &amp;state, const gl::Rectangle &amp;area, GLenum format, GLenum type, GLvoid *pixels) const
+{
+    return mImpl-&gt;readPixels(state, area, format, type, pixels);
+}
+
+Error Framebuffer::blit(const gl::State &amp;state, const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea,
+                        GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer)
+{
+    return mImpl-&gt;blit(state, sourceArea, destArea, mask, filter, sourceFramebuffer);
+}
+
+int Framebuffer::getSamples(const gl::Data &amp;data) const
+{
+    if (checkStatus(data) == GL_FRAMEBUFFER_COMPLETE)
+    {
+        // for a complete framebuffer, all attachments must have the same sample count
+        // in this case return the first nonzero sample size
+        for (const FramebufferAttachment &amp;colorAttachment : mData.mColorAttachments)
+        {
+            if (colorAttachment.isAttached())
+            {
+                return colorAttachment.getSamples();
+            }
+        }
+    }
+
+    return 0;
+}
+
+bool Framebuffer::hasValidDepthStencil() const
+{
+    return mData.getDepthStencilAttachment() != nullptr;
+}
+
+void Framebuffer::setAttachment(GLenum type,
+                                GLenum binding,
+                                const ImageIndex &amp;textureIndex,
+                                FramebufferAttachmentObject *resource)
+{
+    if (binding == GL_DEPTH_STENCIL || binding == GL_DEPTH_STENCIL_ATTACHMENT)
+    {
+        // ensure this is a legitimate depth+stencil format
+        FramebufferAttachment::Target target(binding, textureIndex);
+        GLenum internalFormat = resource-&gt;getAttachmentInternalFormat(target);
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(internalFormat);
+        if (resource &amp;&amp; formatInfo.depthBits &gt; 0 &amp;&amp; formatInfo.stencilBits &gt; 0)
+        {
+            mData.mDepthAttachment.attach(type, binding, textureIndex, resource);
+            mData.mStencilAttachment.attach(type, binding, textureIndex, resource);
+        }
+        else
+        {
+            mData.mDepthAttachment.detach();
+            mData.mStencilAttachment.detach();
+        }
+        mImpl-&gt;onUpdateDepthStencilAttachment();
+    }
+    else
+    {
+        switch (binding)
+        {
+          case GL_DEPTH:
+          case GL_DEPTH_ATTACHMENT:
+            mData.mDepthAttachment.attach(type, binding, textureIndex, resource);
+            mImpl-&gt;onUpdateDepthAttachment();
+            break;
+          case GL_STENCIL:
+          case GL_STENCIL_ATTACHMENT:
+            mData.mStencilAttachment.attach(type, binding, textureIndex, resource);
+            mImpl-&gt;onUpdateStencilAttachment();
+            break;
+          case GL_BACK:
+            mData.mColorAttachments[0].attach(type, binding, textureIndex, resource);
+            mImpl-&gt;onUpdateColorAttachment(0);
+            break;
+          default:
+            {
+                size_t colorIndex = binding - GL_COLOR_ATTACHMENT0;
+                ASSERT(colorIndex &lt; mData.mColorAttachments.size());
+                mData.mColorAttachments[colorIndex].attach(type, binding, textureIndex, resource);
+                mImpl-&gt;onUpdateColorAttachment(colorIndex);
+            }
+            break;
+        }
+    }
+}
+
+void Framebuffer::resetAttachment(GLenum binding)
+{
+    setAttachment(GL_NONE, binding, ImageIndex::MakeInvalid(), nullptr);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFramebufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Framebuffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// 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 LIBANGLE_FRAMEBUFFER_H_
+#define LIBANGLE_FRAMEBUFFER_H_
+
+#include &lt;vector&gt;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+namespace rx
+{
+class ImplFactory;
+class FramebufferImpl;
+class RenderbufferImpl;
+struct Workarounds;
+}
+
+namespace egl
+{
+class Surface;
+}
+
+namespace gl
+{
+class Renderbuffer;
+class State;
+class Texture;
+class TextureCapsMap;
+struct Caps;
+struct Data;
+struct Extensions;
+struct ImageIndex;
+struct Rectangle;
+
+class Framebuffer
+{
+  public:
+
+    class Data final : angle::NonCopyable
+    {
+      public:
+        explicit Data(const Caps &amp;caps);
+        ~Data();
+
+        const FramebufferAttachment *getReadAttachment() const;
+        const FramebufferAttachment *getFirstColorAttachment() const;
+        const FramebufferAttachment *getDepthOrStencilAttachment() const;
+        const FramebufferAttachment *getColorAttachment(unsigned int colorAttachment) const;
+        const FramebufferAttachment *getDepthAttachment() const;
+        const FramebufferAttachment *getStencilAttachment() const;
+        const FramebufferAttachment *getDepthStencilAttachment() const;
+
+        const std::vector&lt;GLenum&gt; &amp;getDrawBufferStates() const { return mDrawBufferStates; }
+        const std::vector&lt;FramebufferAttachment&gt; &amp;getColorAttachments() const { return mColorAttachments; }
+
+      private:
+        friend class Framebuffer;
+
+        std::vector&lt;FramebufferAttachment&gt; mColorAttachments;
+        FramebufferAttachment mDepthAttachment;
+        FramebufferAttachment mStencilAttachment;
+
+        std::vector&lt;GLenum&gt; mDrawBufferStates;
+        GLenum mReadBufferState;
+    };
+
+    Framebuffer(const Caps &amp;caps, rx::ImplFactory *factory, GLuint id);
+    virtual ~Framebuffer();
+
+    const rx::FramebufferImpl *getImplementation() const { return mImpl; }
+    rx::FramebufferImpl *getImplementation() { return mImpl; }
+
+    GLuint id() const { return mId; }
+
+    void setAttachment(GLenum type,
+                       GLenum binding,
+                       const ImageIndex &amp;textureIndex,
+                       FramebufferAttachmentObject *resource);
+    void resetAttachment(GLenum binding);
+
+    void detachTexture(GLuint texture);
+    void detachRenderbuffer(GLuint renderbuffer);
+
+    const FramebufferAttachment *getColorbuffer(unsigned int colorAttachment) const;
+    const FramebufferAttachment *getDepthbuffer() const;
+    const FramebufferAttachment *getStencilbuffer() const;
+    const FramebufferAttachment *getDepthStencilBuffer() const;
+    const FramebufferAttachment *getDepthOrStencilbuffer() const;
+    const FramebufferAttachment *getReadColorbuffer() const;
+    GLenum getReadColorbufferType() const;
+    const FramebufferAttachment *getFirstColorbuffer() const;
+
+    const FramebufferAttachment *getAttachment(GLenum attachment) const;
+
+    GLenum getDrawBufferState(unsigned int colorAttachment) const;
+    void setDrawBuffers(size_t count, const GLenum *buffers);
+
+    GLenum getReadBufferState() const;
+    void setReadBuffer(GLenum buffer);
+
+    bool isEnabledColorAttachment(unsigned int colorAttachment) const;
+    bool hasEnabledColorAttachment() const;
+    bool hasStencil() const;
+    int getSamples(const gl::Data &amp;data) const;
+    bool usingExtendedDrawBuffers() const;
+
+    GLenum checkStatus(const gl::Data &amp;data) const;
+    bool hasValidDepthStencil() const;
+
+    Error invalidate(size_t count, const GLenum *attachments);
+    Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &amp;area);
+
+    Error clear(const gl::Data &amp;data, GLbitfield mask);
+    Error clearBufferfv(const State &amp;state, GLenum buffer, GLint drawbuffer, const GLfloat *values);
+    Error clearBufferuiv(const State &amp;state, GLenum buffer, GLint drawbuffer, const GLuint *values);
+    Error clearBufferiv(const State &amp;state, GLenum buffer, GLint drawbuffer, const GLint *values);
+    Error clearBufferfi(const State &amp;state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+
+    GLenum getImplementationColorReadFormat() const;
+    GLenum getImplementationColorReadType() const;
+    Error readPixels(const gl::State &amp;state, const gl::Rectangle &amp;area, GLenum format, GLenum type, GLvoid *pixels) const;
+
+    Error blit(const gl::State &amp;state, const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea,
+               GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer);
+
+  protected:
+    void detachResourceById(GLenum resourceType, GLuint resourceId);
+
+    Data mData;
+    rx::FramebufferImpl *mImpl;
+    GLuint mId;
+};
+
+}
+
+#endif   // LIBANGLE_FRAMEBUFFER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFramebufferAttachmentcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// FramebufferAttachment.cpp: the gl::FramebufferAttachment class and its derived classes
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/FramebufferImpl.h&quot;
+
+namespace gl
+{
+
+////// FramebufferAttachment::Target Implementation //////
+
+FramebufferAttachment::Target::Target(GLenum binding, const ImageIndex &amp;imageIndex)
+    : mBinding(binding),
+      mTextureIndex(imageIndex)
+{
+}
+
+FramebufferAttachment::Target::Target(const Target &amp;other)
+    : mBinding(other.mBinding),
+      mTextureIndex(other.mTextureIndex)
+{
+}
+
+FramebufferAttachment::Target &amp;FramebufferAttachment::Target::operator=(const Target &amp;other)
+{
+    this-&gt;mBinding = other.mBinding;
+    this-&gt;mTextureIndex = other.mTextureIndex;
+    return *this;
+}
+
+////// FramebufferAttachment Implementation //////
+
+FramebufferAttachment::FramebufferAttachment()
+    : mType(GL_NONE),
+      mTarget(GL_NONE, ImageIndex::MakeInvalid())
+{
+}
+
+FramebufferAttachment::FramebufferAttachment(GLenum type,
+                                             GLenum binding,
+                                             const ImageIndex &amp;textureIndex,
+                                             FramebufferAttachmentObject *resource)
+    : mType(type),
+      mTarget(binding, textureIndex)
+{
+    mResource.set(resource);
+}
+
+void FramebufferAttachment::detach()
+{
+    mType = GL_NONE;
+    mResource.set(nullptr);
+
+    // not technically necessary, could omit for performance
+    mTarget = Target(GL_NONE, ImageIndex::MakeInvalid());
+}
+
+void FramebufferAttachment::attach(GLenum type,
+                                   GLenum binding,
+                                   const ImageIndex &amp;textureIndex,
+                                   FramebufferAttachmentObject *resource)
+{
+    mType = type;
+    mTarget = Target(binding, textureIndex);
+    mResource.set(resource);
+}
+
+FramebufferAttachment::~FramebufferAttachment()
+{
+    mResource.set(nullptr);
+}
+
+GLuint FramebufferAttachment::getRedSize() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).redBits;
+}
+
+GLuint FramebufferAttachment::getGreenSize() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).greenBits;
+}
+
+GLuint FramebufferAttachment::getBlueSize() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).blueBits;
+}
+
+GLuint FramebufferAttachment::getAlphaSize() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).alphaBits;
+}
+
+GLuint FramebufferAttachment::getDepthSize() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).depthBits;
+}
+
+GLuint FramebufferAttachment::getStencilSize() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).stencilBits;
+}
+
+GLenum FramebufferAttachment::getComponentType() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).componentType;
+}
+
+GLenum FramebufferAttachment::getColorEncoding() const
+{
+    return GetInternalFormatInfo(getInternalFormat()).colorEncoding;
+}
+
+const ImageIndex &amp;FramebufferAttachment::getTextureImageIndex() const
+{
+    ASSERT(type() == GL_TEXTURE);
+    return mTarget.textureIndex();
+}
+
+GLenum FramebufferAttachment::cubeMapFace() const
+{
+    ASSERT(mType == GL_TEXTURE);
+
+    const auto &amp;index = mTarget.textureIndex();
+    return IsCubeMapTextureTarget(index.type) ? index.type : GL_NONE;
+}
+
+GLint FramebufferAttachment::mipLevel() const
+{
+    ASSERT(type() == GL_TEXTURE);
+    return mTarget.textureIndex().mipIndex;
+}
+
+GLint FramebufferAttachment::layer() const
+{
+    ASSERT(mType == GL_TEXTURE);
+
+    const auto &amp;index = mTarget.textureIndex();
+
+    if (index.type == GL_TEXTURE_2D_ARRAY || index.type == GL_TEXTURE_3D)
+    {
+        return index.layerIndex;
+    }
+    return 0;
+}
+
+Texture *FramebufferAttachment::getTexture() const
+{
+    return rx::GetAs&lt;Texture&gt;(mResource.get());
+}
+
+Renderbuffer *FramebufferAttachment::getRenderbuffer() const
+{
+    return rx::GetAs&lt;Renderbuffer&gt;(mResource.get());
+}
+
+const egl::Surface *FramebufferAttachment::getSurface() const
+{
+    return rx::GetAs&lt;egl::Surface&gt;(mResource.get());
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEFramebufferAttachmenth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/FramebufferAttachment.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,228 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// FramebufferAttachment.h: Defines the wrapper class gl::FramebufferAttachment, as well as the
+// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#ifndef LIBANGLE_FRAMEBUFFERATTACHMENT_H_
+#define LIBANGLE_FRAMEBUFFERATTACHMENT_H_
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/ImageIndex.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+namespace egl
+{
+class Surface;
+}
+
+namespace rx
+{
+// An implementation-specific object associated with an attachment.
+
+class FramebufferAttachmentRenderTarget : angle::NonCopyable
+{
+  public:
+    FramebufferAttachmentRenderTarget() {}
+    virtual ~FramebufferAttachmentRenderTarget() {}
+};
+
+class FramebufferAttachmentObjectImpl;
+}
+
+namespace gl
+{
+class FramebufferAttachmentObject;
+class Renderbuffer;
+class Texture;
+
+// FramebufferAttachment implements a GL framebuffer attachment.
+// Attachments are &quot;light&quot; containers, which store pointers to ref-counted GL objects.
+// We support GL texture (2D/3D/Cube/2D array) and renderbuffer object attachments.
+// Note: Our old naming scheme used the term &quot;Renderbuffer&quot; for both GL renderbuffers and for
+// framebuffer attachments, which confused their usage.
+
+class FramebufferAttachment final
+{
+  public:
+    FramebufferAttachment();
+
+    FramebufferAttachment(GLenum type,
+                          GLenum binding,
+                          const ImageIndex &amp;textureIndex,
+                          FramebufferAttachmentObject *resource);
+
+    FramebufferAttachment(const FramebufferAttachment &amp;other)
+       : mType(other.mType),
+         mTarget(other.mTarget)
+    {
+        mResource.set(other.mResource.get());
+    }
+
+    FramebufferAttachment &amp;operator=(const FramebufferAttachment &amp;other)
+    {
+        mType = other.mType;
+        mTarget = other.mTarget;
+        mResource.set(other.mResource.get());
+        return *this;
+    }
+
+    ~FramebufferAttachment();
+
+    // A framebuffer attachment points to one of three types of resources: Renderbuffers,
+    // Textures and egl::Surface. The &quot;Target&quot; struct indicates which part of the
+    // object an attachment references. For the three types:
+    //   - a Renderbuffer has a unique renderable target, and needs no target index
+    //   - a Texture has targets for every image and uses an ImageIndex
+    //   - a Surface has targets for Color and Depth/Stencil, and uses the attachment binding
+    class Target
+    {
+      public:
+        Target(GLenum binding, const ImageIndex &amp;imageIndex);
+        Target(const Target &amp;other);
+        Target &amp;operator=(const Target &amp;other);
+
+        GLenum binding() const { return mBinding; }
+        const ImageIndex &amp;textureIndex() const { return mTextureIndex; }
+
+      private:
+        GLenum mBinding;
+        ImageIndex mTextureIndex;
+    };
+
+    void detach();
+    void attach(GLenum type,
+                GLenum binding,
+                const ImageIndex &amp;textureIndex,
+                FramebufferAttachmentObject *resource);
+
+    // Helper methods
+    GLuint getRedSize() const;
+    GLuint getGreenSize() const;
+    GLuint getBlueSize() const;
+    GLuint getAlphaSize() const;
+    GLuint getDepthSize() const;
+    GLuint getStencilSize() const;
+    GLenum getComponentType() const;
+    GLenum getColorEncoding() const;
+
+    bool isTextureWithId(GLuint textureId) const { return mType == GL_TEXTURE &amp;&amp; id() == textureId; }
+    bool isRenderbufferWithId(GLuint renderbufferId) const { return mType == GL_RENDERBUFFER &amp;&amp; id() == renderbufferId; }
+
+    GLenum getBinding() const { return mTarget.binding(); }
+    GLuint id() const { return mResource.id(); }
+
+    // These methods are only legal to call on Texture attachments
+    const ImageIndex &amp;getTextureImageIndex() const;
+    GLenum cubeMapFace() const;
+    GLint mipLevel() const;
+    GLint layer() const;
+
+    GLsizei getWidth() const;
+    GLsizei getHeight() const;
+    GLenum getInternalFormat() const;
+    GLsizei getSamples() const;
+    GLenum type() const { return mType; }
+    bool isAttached() const { return mType != GL_NONE; }
+
+    Renderbuffer *getRenderbuffer() const;
+    Texture *getTexture() const;
+    const egl::Surface *getSurface() const;
+
+    // &quot;T&quot; must be static_castable from FramebufferAttachmentRenderTarget
+    template &lt;typename T&gt;
+    gl::Error getRenderTarget(T **rtOut) const
+    {
+        // Cast through the pointer-to-pointer type
+        rx::FramebufferAttachmentRenderTarget *rtPtr = nullptr;
+        gl::Error error = getRenderTarget(&amp;rtPtr);
+        *rtOut = static_cast&lt;T*&gt;(rtPtr);
+        return error;
+    }
+
+  private:
+    gl::Error getRenderTarget(rx::FramebufferAttachmentRenderTarget **rtOut) const;
+
+    GLenum mType;
+    Target mTarget;
+    BindingPointer&lt;FramebufferAttachmentObject&gt; mResource;
+};
+
+// A base class for objects that FBO Attachments may point to.
+class FramebufferAttachmentObject : public RefCountObject
+{
+  public:
+    FramebufferAttachmentObject(GLuint id) : RefCountObject(id) {}
+
+    virtual GLsizei getAttachmentWidth(const FramebufferAttachment::Target &amp;target) const = 0;
+    virtual GLsizei getAttachmentHeight(const FramebufferAttachment::Target &amp;target) const = 0;
+    virtual GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &amp;target) const = 0;
+    virtual GLsizei getAttachmentSamples(const FramebufferAttachment::Target &amp;target) const = 0;
+
+    Error getAttachmentRenderTarget(const FramebufferAttachment::Target &amp;target,
+                                    rx::FramebufferAttachmentRenderTarget **rtOut) const;
+
+  protected:
+    virtual rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const = 0;
+};
+
+inline GLsizei FramebufferAttachment::getWidth() const
+{
+    return mResource-&gt;getAttachmentWidth(mTarget);
+}
+
+inline GLsizei FramebufferAttachment::getHeight() const
+{
+    return mResource-&gt;getAttachmentHeight(mTarget);
+}
+
+inline GLenum FramebufferAttachment::getInternalFormat() const
+{
+    return mResource-&gt;getAttachmentInternalFormat(mTarget);
+}
+
+inline GLsizei FramebufferAttachment::getSamples() const
+{
+    return mResource-&gt;getAttachmentSamples(mTarget);
+}
+
+inline gl::Error FramebufferAttachment::getRenderTarget(rx::FramebufferAttachmentRenderTarget **rtOut) const
+{
+    return mResource-&gt;getAttachmentRenderTarget(mTarget, rtOut);
+}
+
+} // namespace gl
+
+namespace rx
+{
+
+class FramebufferAttachmentObjectImpl : angle::NonCopyable
+{
+  public:
+    FramebufferAttachmentObjectImpl() {}
+    virtual ~FramebufferAttachmentObjectImpl() {}
+
+    virtual gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                                FramebufferAttachmentRenderTarget **rtOut) = 0;
+};
+
+} // namespace rx
+
+namespace gl
+{
+
+inline Error FramebufferAttachmentObject::getAttachmentRenderTarget(
+    const FramebufferAttachment::Target &amp;target,
+    rx::FramebufferAttachmentRenderTarget **rtOut) const
+{
+    return getAttachmentImpl()-&gt;getAttachmentRenderTarget(target, rtOut);
+}
+
+}
+
+#endif // LIBANGLE_FRAMEBUFFERATTACHMENT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEHandleAllocatorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,133 @@
</span><ins>+//
+// 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 &quot;libANGLE/HandleAllocator.h&quot;
+
+#include &lt;algorithm&gt;
+
+#include &quot;common/debug.h&quot;
+
+namespace gl
+{
+
+struct HandleAllocator::HandleRangeComparator
+{
+    bool operator()(const HandleRange &amp;range, GLuint handle) const
+    {
+        return (handle &lt; range.begin);
+    }
+};
+
+HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1)
+{
+    mUnallocatedList.push_back(HandleRange(1, std::numeric_limits&lt;GLuint&gt;::max() - 1));
+}
+
+HandleAllocator::HandleAllocator(GLuint maximumHandleValue) : mBaseValue(1), mNextValue(1)
+{
+    mUnallocatedList.push_back(HandleRange(1, maximumHandleValue));
+}
+
+HandleAllocator::~HandleAllocator()
+{
+}
+
+void HandleAllocator::setBaseHandle(GLuint value)
+{
+    ASSERT(mBaseValue == mNextValue);
+    mBaseValue = value;
+    mNextValue = value;
+}
+
+GLuint HandleAllocator::allocate()
+{
+    ASSERT(!mUnallocatedList.empty() || !mReleasedList.empty());
+
+    // Allocate from released list, constant time.
+    if (!mReleasedList.empty())
+    {
+        GLuint reusedHandle = mReleasedList.back();
+        mReleasedList.pop_back();
+        return reusedHandle;
+    }
+
+    // Allocate from unallocated list, constant time.
+    auto listIt = mUnallocatedList.begin();
+
+    GLuint freeListHandle = listIt-&gt;begin;
+    ASSERT(freeListHandle &gt; 0);
+
+    listIt-&gt;begin++;
+    if (listIt-&gt;begin == listIt-&gt;end)
+    {
+        mUnallocatedList.erase(listIt);
+    }
+
+    return freeListHandle;
+}
+
+void HandleAllocator::release(GLuint handle)
+{
+    // Add to released list, constant time.
+    mReleasedList.push_back(handle);
+}
+
+void HandleAllocator::reserve(GLuint handle)
+{
+    // Clear from released list -- might be a slow operation.
+    if (!mReleasedList.empty())
+    {
+        auto releasedIt = std::find(mReleasedList.begin(), mReleasedList.end(), handle);
+        if (releasedIt != mReleasedList.end())
+        {
+            mReleasedList.erase(releasedIt);
+            return;
+        }
+    }
+
+    // Not in released list, reserve in the unallocated list.
+    auto boundIt = std::lower_bound(mUnallocatedList.begin(), mUnallocatedList.end(), handle, HandleRangeComparator());
+
+    ASSERT(boundIt != mUnallocatedList.end());
+
+    GLuint begin = boundIt-&gt;begin;
+    GLuint end = boundIt-&gt;end;
+
+    if (handle == begin || handle == end)
+    {
+        if (begin + 1 == end)
+        {
+            mUnallocatedList.erase(boundIt);
+        }
+        else if (handle == begin)
+        {
+            boundIt-&gt;begin++;
+        }
+        else
+        {
+            ASSERT(handle == end);
+            boundIt-&gt;end--;
+        }
+        return;
+    }
+
+    // need to split the range
+    auto placementIt = mUnallocatedList.erase(boundIt);
+
+    if (begin != handle)
+    {
+        placementIt = mUnallocatedList.insert(placementIt, HandleRange(begin, handle));
+    }
+    if (handle + 1 != end)
+    {
+        mUnallocatedList.insert(placementIt, HandleRange(handle + 1, end));
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEHandleAllocatorh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+//
+// 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 LIBANGLE_HANDLEALLOCATOR_H_
+#define LIBANGLE_HANDLEALLOCATOR_H_
+
+#include &quot;common/angleutils.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;stack&gt;
+
+namespace gl
+{
+
+class HandleAllocator final : angle::NonCopyable
+{
+  public:
+    // Maximum handle = MAX_UINT-1
+    HandleAllocator();
+    // Specify maximum handle value
+    HandleAllocator(GLuint maximumHandleValue);
+
+    ~HandleAllocator();
+
+    void setBaseHandle(GLuint value);
+
+    GLuint allocate();
+    void release(GLuint handle);
+    void reserve(GLuint handle);
+
+  private:
+    GLuint mBaseValue;
+    GLuint mNextValue;
+    typedef std::vector&lt;GLuint&gt; HandleList;
+    HandleList mFreeValues;
+
+    struct HandleRange
+    {
+        HandleRange(GLuint beginIn, GLuint endIn) : begin(beginIn), end(endIn) {}
+
+        GLuint begin;
+        GLuint end;
+    };
+
+    struct HandleRangeComparator;
+
+    // The freelist consists of never-allocated handles, stored
+    // as ranges, and handles that were previously allocated and
+    // released, stored in a stack.
+    std::vector&lt;HandleRange&gt; mUnallocatedList;
+    std::vector&lt;GLuint&gt; mReleasedList;
+};
+
+}
+
+#endif   // LIBANGLE_HANDLEALLOCATOR_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEHandleAllocator_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/HandleAllocator_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// Unit tests for HandleAllocator.
+//
+
+#include &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+
+#include &quot;libANGLE/HandleAllocator.h&quot;
+
+namespace
+{
+
+TEST(HandleAllocatorTest, ReservationsWithGaps)
+{
+    gl::HandleAllocator allocator;
+
+    std::set&lt;GLuint&gt; allocationList;
+    for (GLuint id = 2; id &lt; 50; id += 2)
+    {
+        allocationList.insert(id);
+    }
+
+    for (GLuint id : allocationList)
+    {
+        allocator.reserve(id);
+    }
+
+    std::set&lt;GLuint&gt; allocatedList;
+    for (size_t allocationNum = 0; allocationNum &lt; allocationList.size() * 2; ++allocationNum)
+    {
+        GLuint handle = allocator.allocate();
+        EXPECT_EQ(0u, allocationList.count(handle));
+        EXPECT_EQ(0u, allocatedList.count(handle));
+        allocatedList.insert(handle);
+    }
+}
+
+TEST(HandleAllocatorTest, Random)
+{
+    gl::HandleAllocator allocator;
+
+    std::set&lt;GLuint&gt; allocationList;
+    for (size_t iterationCount = 0; iterationCount &lt; 40; ++iterationCount)
+    {
+        for (size_t randomCount = 0; randomCount &lt; 40; ++randomCount)
+        {
+            GLuint randomHandle = (rand() % 1000) + 1;
+            if (allocationList.count(randomHandle) == 0)
+            {
+                allocator.reserve(randomHandle);
+                allocationList.insert(randomHandle);
+            }
+        }
+
+        for (size_t normalCount = 0; normalCount &lt; 40; ++normalCount)
+        {
+            GLuint normalHandle = allocator.allocate();
+            EXPECT_EQ(0u, allocationList.count(normalHandle));
+            allocationList.insert(normalHandle);
+        }
+    }
+}
+
+TEST(HandleAllocatorTest, Reallocation)
+{
+    // Note: no current test for overflow
+    gl::HandleAllocator limitedAllocator(10);
+
+    for (GLuint count = 1; count &lt; 10; count++)
+    {
+        GLuint result = limitedAllocator.allocate();
+        EXPECT_EQ(count, result);
+    }
+
+    for (GLuint count = 1; count &lt; 10; count++)
+    {
+        limitedAllocator.release(count);
+    }
+
+    for (GLuint count = 2; count &lt; 10; count++)
+    {
+        limitedAllocator.reserve(count);
+    }
+
+    GLint finalResult = limitedAllocator.allocate();
+    EXPECT_EQ(finalResult, 1);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEImageIndexcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,170 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// ImageIndex.cpp: Implementation for ImageIndex methods.
+
+#include &quot;libANGLE/ImageIndex.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace gl
+{
+
+ImageIndex::ImageIndex(const ImageIndex &amp;other)
+    : type(other.type),
+      mipIndex(other.mipIndex),
+      layerIndex(other.layerIndex)
+{}
+
+ImageIndex &amp;ImageIndex::operator=(const ImageIndex &amp;other)
+{
+    type = other.type;
+    mipIndex = other.mipIndex;
+    layerIndex = other.layerIndex;
+    return *this;
+}
+
+ImageIndex ImageIndex::Make2D(GLint mipIndex)
+{
+    return ImageIndex(GL_TEXTURE_2D, mipIndex, ENTIRE_LEVEL);
+}
+
+ImageIndex ImageIndex::MakeCube(GLenum target, GLint mipIndex)
+{
+    ASSERT(gl::IsCubeMapTextureTarget(target));
+    return ImageIndex(target, mipIndex, static_cast&lt;int&gt;(CubeMapTextureTargetToLayerIndex(target)));
+}
+
+ImageIndex ImageIndex::Make2DArray(GLint mipIndex, GLint layerIndex)
+{
+    return ImageIndex(GL_TEXTURE_2D_ARRAY, mipIndex, layerIndex);
+}
+
+ImageIndex ImageIndex::Make3D(GLint mipIndex, GLint layerIndex)
+{
+    return ImageIndex(GL_TEXTURE_3D, mipIndex, layerIndex);
+}
+
+ImageIndex ImageIndex::MakeGeneric(GLenum target, GLint mipIndex)
+{
+    GLint layerIndex = IsCubeMapTextureTarget(target) ? static_cast&lt;GLint&gt;(CubeMapTextureTargetToLayerIndex(target)) : ENTIRE_LEVEL;
+    return ImageIndex(target, mipIndex, layerIndex);
+}
+
+ImageIndex ImageIndex::MakeInvalid()
+{
+    return ImageIndex(GL_NONE, -1, -1);
+}
+
+bool ImageIndex::operator&lt;(const ImageIndex &amp;other) const
+{
+    if (type != other.type)
+    {
+        return type &lt; other.type;
+    }
+    else if (mipIndex != other.mipIndex)
+    {
+        return mipIndex &lt; other.mipIndex;
+    }
+    else
+    {
+        return layerIndex &lt; other.layerIndex;
+    }
+}
+
+ImageIndex::ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn)
+    : type(typeIn),
+      mipIndex(mipIndexIn),
+      layerIndex(layerIndexIn)
+{}
+
+ImageIndexIterator ImageIndexIterator::Make2D(GLint minMip, GLint maxMip)
+{
+    return ImageIndexIterator(GL_TEXTURE_2D, rx::Range&lt;GLint&gt;(minMip, maxMip),
+                              rx::Range&lt;GLint&gt;(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), NULL);
+}
+
+ImageIndexIterator ImageIndexIterator::MakeCube(GLint minMip, GLint maxMip)
+{
+    return ImageIndexIterator(GL_TEXTURE_CUBE_MAP, rx::Range&lt;GLint&gt;(minMip, maxMip), rx::Range&lt;GLint&gt;(0, 6), NULL);
+}
+
+ImageIndexIterator ImageIndexIterator::Make3D(GLint minMip, GLint maxMip,
+                                              GLint minLayer, GLint maxLayer)
+{
+    return ImageIndexIterator(GL_TEXTURE_3D, rx::Range&lt;GLint&gt;(minMip, maxMip), rx::Range&lt;GLint&gt;(minLayer, maxLayer), NULL);
+}
+
+ImageIndexIterator ImageIndexIterator::Make2DArray(GLint minMip, GLint maxMip,
+                                                   const GLsizei *layerCounts)
+{
+    return ImageIndexIterator(GL_TEXTURE_2D_ARRAY, rx::Range&lt;GLint&gt;(minMip, maxMip),
+                              rx::Range&lt;GLint&gt;(0, IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS), layerCounts);
+}
+
+ImageIndexIterator::ImageIndexIterator(GLenum type, const rx::Range&lt;GLint&gt; &amp;mipRange,
+                                       const rx::Range&lt;GLint&gt; &amp;layerRange, const GLsizei *layerCounts)
+    : mType(type),
+      mMipRange(mipRange),
+      mLayerRange(layerRange),
+      mLayerCounts(layerCounts),
+      mCurrentMip(mipRange.start),
+      mCurrentLayer(layerRange.start)
+{}
+
+GLint ImageIndexIterator::maxLayer() const
+{
+    return (mLayerCounts ? static_cast&lt;GLint&gt;(mLayerCounts[mCurrentMip]) : mLayerRange.end);
+}
+
+ImageIndex ImageIndexIterator::next()
+{
+    ASSERT(hasNext());
+
+    ImageIndex value = current();
+
+    // Iterate layers in the inner loop for now. We can add switchable
+    // layer or mip iteration if we need it.
+
+    if (mCurrentLayer != ImageIndex::ENTIRE_LEVEL)
+    {
+        if (mCurrentLayer &lt; maxLayer()-1)
+        {
+            mCurrentLayer++;
+        }
+        else if (mCurrentMip &lt; mMipRange.end-1)
+        {
+            mCurrentMip++;
+            mCurrentLayer = mLayerRange.start;
+        }
+    }
+    else if (mCurrentMip &lt; mMipRange.end-1)
+    {
+        mCurrentMip++;
+        mCurrentLayer = mLayerRange.start;
+    }
+
+    return value;
+}
+
+ImageIndex ImageIndexIterator::current() const
+{
+    ImageIndex value(mType, mCurrentMip, mCurrentLayer);
+
+    if (mType == GL_TEXTURE_CUBE_MAP)
+    {
+        value.type = LayerIndexToCubeMapTextureTarget(mCurrentLayer);
+    }
+
+    return value;
+}
+
+bool ImageIndexIterator::hasNext() const
+{
+    return (mCurrentMip &lt; mMipRange.end || mCurrentLayer &lt; maxLayer());
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEImageIndexh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndex.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// ImageIndex.h: A helper struct for indexing into an Image array
+
+#ifndef LIBANGLE_IMAGE_INDEX_H_
+#define LIBANGLE_IMAGE_INDEX_H_
+
+#include &quot;common/mathutil.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+namespace gl
+{
+
+class ImageIndexIterator;
+
+struct ImageIndex
+{
+    GLenum type;
+    GLint mipIndex;
+    GLint layerIndex;
+
+    ImageIndex(const ImageIndex &amp;other);
+    ImageIndex &amp;operator=(const ImageIndex &amp;other);
+
+    bool hasLayer() const { return layerIndex != ENTIRE_LEVEL; }
+
+    static ImageIndex Make2D(GLint mipIndex);
+    static ImageIndex MakeCube(GLenum target, GLint mipIndex);
+    static ImageIndex Make2DArray(GLint mipIndex, GLint layerIndex);
+    static ImageIndex Make3D(GLint mipIndex, GLint layerIndex = ENTIRE_LEVEL);
+    static ImageIndex MakeGeneric(GLenum target, GLint mipIndex);
+
+    static ImageIndex MakeInvalid();
+
+    static const GLint ENTIRE_LEVEL = static_cast&lt;GLint&gt;(-1);
+
+    bool operator&lt;(const ImageIndex &amp;other) const;
+
+  private:
+    friend class ImageIndexIterator;
+
+    ImageIndex(GLenum typeIn, GLint mipIndexIn, GLint layerIndexIn);
+};
+
+class ImageIndexIterator
+{
+  public:
+    static ImageIndexIterator Make2D(GLint minMip, GLint maxMip);
+    static ImageIndexIterator MakeCube(GLint minMip, GLint maxMip);
+    static ImageIndexIterator Make3D(GLint minMip, GLint maxMip, GLint minLayer, GLint maxLayer);
+    static ImageIndexIterator Make2DArray(GLint minMip, GLint maxMip, const GLsizei *layerCounts);
+
+    ImageIndex next();
+    ImageIndex current() const;
+    bool hasNext() const;
+
+  private:
+
+    ImageIndexIterator(GLenum type, const rx::Range&lt;GLint&gt; &amp;mipRange,
+                       const rx::Range&lt;GLint&gt; &amp;layerRange, const GLsizei *layerCounts);
+
+    GLint maxLayer() const;
+
+    GLenum mType;
+    rx::Range&lt;GLint&gt; mMipRange;
+    rx::Range&lt;GLint&gt; mLayerRange;
+    const GLsizei *mLayerCounts;
+    GLint mCurrentMip;
+    GLint mCurrentLayer;
+};
+
+}
+
+#endif // LIBANGLE_IMAGE_INDEX_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEImageIndexIterator_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndexIterator_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndexIterator_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/ImageIndexIterator_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/ImageIndex.h&quot;
+
+using namespace gl;
+
+namespace
+{
+
+static const GLint minMip = 0;
+static const GLint maxMip = 4;
+static const GLint minLayer = 1;
+static const GLint maxLayer = 3;
+
+TEST(ImageIndexTest, Iterator2D)
+{
+    ImageIndexIterator iter = ImageIndexIterator::Make2D(minMip, maxMip);
+
+    ASSERT_GE(0, minMip);
+
+    for (GLint mip = minMip; mip &lt; maxMip; mip++)
+    {
+        EXPECT_TRUE(iter.hasNext());
+        ImageIndex current = iter.current();
+        ImageIndex nextIndex = iter.next();
+
+        EXPECT_EQ(static_cast&lt;GLenum&gt;(GL_TEXTURE_2D), nextIndex.type);
+        EXPECT_EQ(mip, nextIndex.mipIndex);
+        EXPECT_FALSE(nextIndex.hasLayer());
+
+        // Also test current
+        EXPECT_EQ(current.type, nextIndex.type);
+        EXPECT_EQ(current.mipIndex, nextIndex.mipIndex);
+        EXPECT_EQ(current.layerIndex, nextIndex.layerIndex);
+    }
+}
+
+TEST(ImageIndexTest, IteratorCube)
+{
+    ImageIndexIterator iter = ImageIndexIterator::MakeCube(0, 4);
+
+    ASSERT_GE(0, minMip);
+
+    for (GLint mip = minMip; mip &lt; maxMip; mip++)
+    {
+        for (GLint layer = 0; layer &lt; 6; layer++)
+        {
+            EXPECT_TRUE(iter.hasNext());
+            ImageIndex nextIndex = iter.next();
+
+            GLenum cubeTarget = LayerIndexToCubeMapTextureTarget(layer);
+
+            EXPECT_EQ(cubeTarget, nextIndex.type);
+            EXPECT_EQ(mip, nextIndex.mipIndex);
+            EXPECT_EQ(layer, nextIndex.layerIndex);
+            EXPECT_TRUE(nextIndex.hasLayer());
+        }
+    }
+}
+
+TEST(ImageIndexTest, Iterator3D)
+{
+    ImageIndexIterator iter = ImageIndexIterator::Make3D(minMip, maxMip, minLayer, maxLayer);
+
+    ASSERT_GE(0, minMip);
+
+    for (GLint mip = minMip; mip &lt; maxMip; mip++)
+    {
+        for (GLint layer = minLayer; layer &lt; maxLayer; layer++)
+        {
+            EXPECT_TRUE(iter.hasNext());
+            ImageIndex nextIndex = iter.next();
+
+            EXPECT_EQ(static_cast&lt;GLenum&gt;(GL_TEXTURE_3D), nextIndex.type);
+            EXPECT_EQ(mip, nextIndex.mipIndex);
+            EXPECT_EQ(layer, nextIndex.layerIndex);
+            EXPECT_TRUE(nextIndex.hasLayer());
+        }
+    }
+}
+
+TEST(ImageIndexTest, Iterator2DArray)
+{
+    GLsizei layerCounts[] = { 1, 3, 5, 2 };
+
+    ImageIndexIterator iter = ImageIndexIterator::Make2DArray(minMip, maxMip, layerCounts);
+
+    ASSERT_GE(0, minMip);
+    ASSERT_EQ(ArraySize(layerCounts), static_cast&lt;size_t&gt;(maxMip));
+
+    for (GLint mip = minMip; mip &lt; maxMip; mip++)
+    {
+        for (GLint layer = 0; layer &lt; layerCounts[mip]; layer++)
+        {
+            EXPECT_TRUE(iter.hasNext());
+            ImageIndex nextIndex = iter.next();
+
+            EXPECT_EQ(static_cast&lt;GLenum&gt;(GL_TEXTURE_2D_ARRAY), nextIndex.type);
+            EXPECT_EQ(mip, nextIndex.mipIndex);
+            EXPECT_EQ(layer, nextIndex.layerIndex);
+            EXPECT_TRUE(nextIndex.hasLayer());
+        }
+    }
+}
+
+} // namespace
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEPlatformcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Platform.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Platform.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Platform.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// Platform.cpp: Implementation methods for angle::Platform.
+
+#include &lt;platform/Platform.h&gt;
+
+#include &quot;common/debug.h&quot;
+
+namespace
+{
+angle::Platform *currentPlatform = nullptr;
+}
+
+// static
+ANGLE_EXPORT angle::Platform *ANGLEPlatformCurrent()
+{
+    return currentPlatform;
+}
+
+// static
+ANGLE_EXPORT void ANGLEPlatformInitialize(angle::Platform *platformImpl)
+{
+    ASSERT(platformImpl != nullptr);
+    currentPlatform = platformImpl;
+}
+
+// static
+ANGLE_EXPORT void ANGLEPlatformShutdown()
+{
+    currentPlatform = nullptr;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEProgramcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1622 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/Program.h&quot;
+
+#include &lt;algorithm&gt;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/platform.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;common/version.h&quot;
+#include &quot;compiler/translator/blocklayout.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/ResourceManager.h&quot;
+#include &quot;libANGLE/features.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+#include &quot;libANGLE/renderer/ProgramImpl.h&quot;
+
+namespace gl
+{
+const char * const g_fakepath = &quot;C:\\fakepath&quot;;
+
+namespace
+{
+
+unsigned int ParseAndStripArrayIndex(std::string* name)
+{
+    unsigned int subscript = GL_INVALID_INDEX;
+
+    // Strip any trailing array operator and retrieve the subscript
+    size_t open = name-&gt;find_last_of('[');
+    size_t close = name-&gt;find_last_of(']');
+    if (open != std::string::npos &amp;&amp; close == name-&gt;length() - 1)
+    {
+        subscript = atoi(name-&gt;substr(open + 1).c_str());
+        name-&gt;erase(open);
+    }
+
+    return subscript;
+}
+
+}
+
+AttributeBindings::AttributeBindings()
+{
+}
+
+AttributeBindings::~AttributeBindings()
+{
+}
+
+InfoLog::InfoLog()
+{
+}
+
+InfoLog::~InfoLog()
+{
+}
+
+size_t InfoLog::getLength() const
+{
+    return mStream.str().length();
+}
+
+void InfoLog::getLog(GLsizei bufSize, GLsizei *length, char *infoLog)
+{
+    size_t index = 0;
+
+    if (bufSize &gt; 0)
+    {
+        const std::string str(mStream.str());
+
+        if (!str.empty())
+        {
+            index = std::min(static_cast&lt;size_t&gt;(bufSize) - 1, str.length());
+            memcpy(infoLog, str.c_str(), index);
+        }
+
+        infoLog[index] = '\0';
+    }
+
+    if (length)
+    {
+        *length = static_cast&lt;GLsizei&gt;(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);
+
+    mStream &lt;&lt; message &lt;&lt; &quot;\n&quot;;
+}
+
+void InfoLog::append(const char *format, ...)
+{
+    if (!format)
+    {
+        return;
+    }
+
+    va_list vararg;
+    va_start(vararg, format);
+    std::string tempString(FormatString(format, vararg));
+    va_end(vararg);
+
+    mStream &lt;&lt; tempString &lt;&lt; &quot;\n&quot;;
+}
+
+void InfoLog::reset()
+{
+}
+
+VariableLocation::VariableLocation()
+    : name(),
+      element(0),
+      index(0)
+{
+}
+
+VariableLocation::VariableLocation(const std::string &amp;name, unsigned int element, unsigned int index)
+    : name(name),
+      element(element),
+      index(index)
+{
+}
+
+LinkedVarying::LinkedVarying()
+{
+}
+
+LinkedVarying::LinkedVarying(const std::string &amp;name, GLenum type, GLsizei size, const std::string &amp;semanticName,
+                             unsigned int semanticIndex, unsigned int semanticIndexCount)
+    : name(name), type(type), size(size), semanticName(semanticName), semanticIndex(semanticIndex), semanticIndexCount(semanticIndexCount)
+{
+}
+
+Program::Program(rx::ProgramImpl *impl, ResourceManager *manager, GLuint handle)
+    : mProgram(impl),
+      mValidated(false),
+      mTransformFeedbackVaryings(),
+      mTransformFeedbackBufferMode(GL_NONE),
+      mFragmentShader(nullptr),
+      mVertexShader(nullptr),
+      mLinked(false),
+      mDeleteStatus(false),
+      mRefCount(0),
+      mResourceManager(manager),
+      mHandle(handle)
+{
+    ASSERT(mProgram);
+
+    resetUniformBlockBindings();
+    unlink();
+}
+
+Program::~Program()
+{
+    unlink(true);
+
+    if (mVertexShader != nullptr)
+    {
+        mVertexShader-&gt;release();
+    }
+
+    if (mFragmentShader != nullptr)
+    {
+        mFragmentShader-&gt;release();
+    }
+
+    SafeDelete(mProgram);
+}
+
+bool Program::attachShader(Shader *shader)
+{
+    if (shader-&gt;getType() == GL_VERTEX_SHADER)
+    {
+        if (mVertexShader)
+        {
+            return false;
+        }
+
+        mVertexShader = shader;
+        mVertexShader-&gt;addRef();
+    }
+    else if (shader-&gt;getType() == GL_FRAGMENT_SHADER)
+    {
+        if (mFragmentShader)
+        {
+            return false;
+        }
+
+        mFragmentShader = shader;
+        mFragmentShader-&gt;addRef();
+    }
+    else UNREACHABLE();
+
+    return true;
+}
+
+bool Program::detachShader(Shader *shader)
+{
+    if (shader-&gt;getType() == GL_VERTEX_SHADER)
+    {
+        if (mVertexShader != shader)
+        {
+            return false;
+        }
+
+        mVertexShader-&gt;release();
+        mVertexShader = nullptr;
+    }
+    else if (shader-&gt;getType() == GL_FRAGMENT_SHADER)
+    {
+        if (mFragmentShader != shader)
+        {
+            return false;
+        }
+
+        mFragmentShader-&gt;release();
+        mFragmentShader = nullptr;
+    }
+    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 &lt; MAX_VERTEX_ATTRIBS)
+    {
+        for (int i = 0; i &lt; 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
+Error Program::link(const Data &amp;data)
+{
+    unlink(false);
+
+    mInfoLog.reset();
+    resetUniformBlockBindings();
+
+    if (!mFragmentShader || !mFragmentShader-&gt;isCompiled())
+    {
+        return Error(GL_NO_ERROR);
+    }
+    ASSERT(mFragmentShader-&gt;getType() == GL_FRAGMENT_SHADER);
+
+    if (!mVertexShader || !mVertexShader-&gt;isCompiled())
+    {
+        return Error(GL_NO_ERROR);
+    }
+    ASSERT(mVertexShader-&gt;getType() == GL_VERTEX_SHADER);
+
+    if (!linkAttributes(data, mInfoLog, mAttributeBindings, mVertexShader))
+    {
+        return Error(GL_NO_ERROR);
+    }
+
+    int registers;
+    std::vector&lt;LinkedVarying&gt; linkedVaryings;
+    rx::LinkResult result = mProgram-&gt;link(data, mInfoLog, mFragmentShader, mVertexShader, mTransformFeedbackVaryings, mTransformFeedbackBufferMode,
+                                           &amp;registers, &amp;linkedVaryings, &amp;mOutputVariables);
+    if (result.error.isError() || !result.linkSuccess)
+    {
+        return result.error;
+    }
+
+    if (!mProgram-&gt;linkUniforms(mInfoLog, *mVertexShader, *mFragmentShader, *data.caps))
+    {
+        return Error(GL_NO_ERROR);
+    }
+
+    if (!linkUniformBlocks(mInfoLog, *mVertexShader, *mFragmentShader, *data.caps))
+    {
+        return Error(GL_NO_ERROR);
+    }
+
+    if (!gatherTransformFeedbackLinkedVaryings(mInfoLog, linkedVaryings, mTransformFeedbackVaryings,
+                                               mTransformFeedbackBufferMode, &amp;mProgram-&gt;getTransformFeedbackLinkedVaryings(), *data.caps))
+    {
+        return Error(GL_NO_ERROR);
+    }
+
+    // TODO: The concept of &quot;executables&quot; is D3D only, and as such this belongs in ProgramD3D. It must be called,
+    // however, last in this function, so it can't simply be moved to ProgramD3D::link without further shuffling.
+    result = mProgram-&gt;compileProgramExecutables(mInfoLog, mFragmentShader, mVertexShader, registers);
+    if (result.error.isError() || !result.linkSuccess)
+    {
+        mInfoLog.append(&quot;Failed to create D3D shaders.&quot;);
+        unlink(false);
+        return result.error;
+    }
+
+    mLinked = true;
+    return gl::Error(GL_NO_ERROR);
+}
+
+int AttributeBindings::getAttributeBinding(const std::string &amp;name) const
+{
+    for (int location = 0; location &lt; 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-&gt;release();
+            mFragmentShader = nullptr;
+        }
+
+        if (mVertexShader)
+        {
+            mVertexShader-&gt;release();
+            mVertexShader = nullptr;
+        }
+    }
+
+    std::fill(mLinkedAttribute, mLinkedAttribute + ArraySize(mLinkedAttribute), sh::Attribute());
+    mOutputVariables.clear();
+
+    mProgram-&gt;reset();
+
+    mValidated = false;
+
+    mLinked = false;
+}
+
+bool Program::isLinked()
+{
+    return mLinked;
+}
+
+Error Program::loadBinary(GLenum binaryFormat, const void *binary, GLsizei length)
+{
+    unlink(false);
+
+#if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED
+    return Error(GL_NO_ERROR);
+#else
+    ASSERT(binaryFormat == mProgram-&gt;getBinaryFormat());
+
+    BinaryInputStream stream(binary, length);
+
+    GLenum format = stream.readInt&lt;GLenum&gt;();
+    if (format != mProgram-&gt;getBinaryFormat())
+    {
+        mInfoLog.append(&quot;Invalid program binary format.&quot;);
+        return Error(GL_NO_ERROR);
+    }
+
+    int majorVersion = stream.readInt&lt;int&gt;();
+    int minorVersion = stream.readInt&lt;int&gt;();
+    if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION)
+    {
+        mInfoLog.append(&quot;Invalid program binary version.&quot;);
+        return Error(GL_NO_ERROR);
+    }
+
+    unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
+    stream.readBytes(commitString, ANGLE_COMMIT_HASH_SIZE);
+    if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) != 0)
+    {
+        mInfoLog.append(&quot;Invalid program binary version.&quot;);
+        return Error(GL_NO_ERROR);
+    }
+
+    // TODO(jmadill): replace MAX_VERTEX_ATTRIBS
+    for (int i = 0; i &lt; MAX_VERTEX_ATTRIBS; ++i)
+    {
+        stream.readInt(&amp;mLinkedAttribute[i].type);
+        stream.readString(&amp;mLinkedAttribute[i].name);
+        stream.readInt(&amp;mProgram-&gt;getSemanticIndexes()[i]);
+    }
+
+    unsigned int attribCount = stream.readInt&lt;unsigned int&gt;();
+    for (unsigned int attribIndex = 0; attribIndex &lt; attribCount; ++attribIndex)
+    {
+        GLenum type = stream.readInt&lt;GLenum&gt;();
+        GLenum precision = stream.readInt&lt;GLenum&gt;();
+        std::string name = stream.readString();
+        GLint arraySize = stream.readInt&lt;GLint&gt;();
+        int location = stream.readInt&lt;int&gt;();
+        mProgram-&gt;setShaderAttribute(attribIndex, type, precision, name, arraySize, location);
+    }
+
+    rx::LinkResult result = mProgram-&gt;load(mInfoLog, &amp;stream);
+    if (result.error.isError() || !result.linkSuccess)
+    {
+        return result.error;
+    }
+
+    mLinked = true;
+    return Error(GL_NO_ERROR);
+#endif // #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED
+}
+
+Error Program::saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, GLsizei *length) const
+{
+    if (binaryFormat)
+    {
+        *binaryFormat = mProgram-&gt;getBinaryFormat();
+    }
+
+    BinaryOutputStream stream;
+
+    stream.writeInt(mProgram-&gt;getBinaryFormat());
+    stream.writeInt(ANGLE_MAJOR_VERSION);
+    stream.writeInt(ANGLE_MINOR_VERSION);
+    stream.writeBytes(reinterpret_cast&lt;const unsigned char*&gt;(ANGLE_COMMIT_HASH), ANGLE_COMMIT_HASH_SIZE);
+
+    // TODO(jmadill): replace MAX_VERTEX_ATTRIBS
+    for (unsigned int i = 0; i &lt; MAX_VERTEX_ATTRIBS; ++i)
+    {
+        stream.writeInt(mLinkedAttribute[i].type);
+        stream.writeString(mLinkedAttribute[i].name);
+        stream.writeInt(mProgram-&gt;getSemanticIndexes()[i]);
+    }
+
+    const auto &amp;shaderAttributes = mProgram-&gt;getShaderAttributes();
+    stream.writeInt(shaderAttributes.size());
+    for (const auto &amp;attrib : shaderAttributes)
+    {
+        stream.writeInt(attrib.type);
+        stream.writeInt(attrib.precision);
+        stream.writeString(attrib.name);
+        stream.writeInt(attrib.arraySize);
+        stream.writeInt(attrib.location);
+    }
+
+    gl::Error error = mProgram-&gt;save(&amp;stream);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    GLsizei streamLength = static_cast&lt;GLsizei&gt;(stream.length());
+    const void *streamData = stream.data();
+
+    if (streamLength &gt; bufSize)
+    {
+        if (length)
+        {
+            *length = 0;
+        }
+
+        // TODO: This should be moved to the validation layer but computing the size of the binary before saving
+        // it causes the save to happen twice.  It may be possible to write the binary to a separate buffer, validate
+        // sizes and then copy it.
+        return Error(GL_INVALID_OPERATION);
+    }
+
+    if (binary)
+    {
+        char *ptr = reinterpret_cast&lt;char*&gt;(binary);
+
+        memcpy(ptr, streamData, streamLength);
+        ptr += streamLength;
+
+        ASSERT(ptr - streamLength == binary);
+    }
+
+    if (length)
+    {
+        *length = streamLength;
+    }
+
+    return Error(GL_NO_ERROR);
+}
+
+GLint Program::getBinaryLength() const
+{
+    GLint length;
+    Error error = saveBinary(nullptr, nullptr, std::numeric_limits&lt;GLint&gt;::max(), &amp;length);
+    if (error.isError())
+    {
+        return 0;
+    }
+
+    return length;
+}
+
+void Program::release()
+{
+    mRefCount--;
+
+    if (mRefCount == 0 &amp;&amp; mDeleteStatus)
+    {
+        mResourceManager-&gt;deleteProgram(mHandle);
+    }
+}
+
+void Program::addRef()
+{
+    mRefCount++;
+}
+
+unsigned int Program::getRefCount() const
+{
+    return mRefCount;
+}
+
+int Program::getInfoLogLength() const
+{
+    return static_cast&lt;int&gt;(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 &lt; maxCount)
+        {
+            shaders[total] = mVertexShader-&gt;getHandle();
+        }
+
+        total++;
+    }
+
+    if (mFragmentShader)
+    {
+        if (total &lt; maxCount)
+        {
+            shaders[total] = mFragmentShader-&gt;getHandle();
+        }
+
+        total++;
+    }
+
+    if (count)
+    {
+        *count = total;
+    }
+}
+
+GLuint Program::getAttributeLocation(const std::string &amp;name)
+{
+    for (int index = 0; index &lt; MAX_VERTEX_ATTRIBS; index++)
+    {
+        if (mLinkedAttribute[index].name == name)
+        {
+            return index;
+        }
+    }
+
+    return static_cast&lt;GLuint&gt;(-1);
+}
+
+const int *Program::getSemanticIndexes() const
+{
+    return mProgram-&gt;getSemanticIndexes();
+}
+
+int Program::getSemanticIndex(int attributeIndex)
+{
+    ASSERT(attributeIndex &gt;= 0 &amp;&amp; attributeIndex &lt; MAX_VERTEX_ATTRIBS);
+
+    return mProgram-&gt;getSemanticIndexes()[attributeIndex];
+}
+
+void Program::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+    if (mLinked)
+    {
+        // Skip over inactive attributes
+        unsigned int activeAttribute = 0;
+        unsigned int attribute;
+        for (attribute = 0; attribute &lt; MAX_VERTEX_ATTRIBS; attribute++)
+        {
+            if (mLinkedAttribute[attribute].name.empty())
+            {
+                continue;
+            }
+
+            if (activeAttribute == index)
+            {
+                break;
+            }
+
+            activeAttribute++;
+        }
+
+        if (bufsize &gt; 0)
+        {
+            const char *string = mLinkedAttribute[attribute].name.c_str();
+
+            strncpy(name, string, bufsize);
+            name[bufsize - 1] = '\0';
+
+            if (length)
+            {
+                *length = static_cast&lt;GLsizei&gt;(strlen(name));
+            }
+        }
+
+        *size = 1;   // Always a single 'type' instance
+
+        *type = mLinkedAttribute[attribute].type;
+    }
+    else
+    {
+        if (bufsize &gt; 0)
+        {
+            name[0] = '\0';
+        }
+
+        if (length)
+        {
+            *length = 0;
+        }
+
+        *type = GL_NONE;
+        *size = 1;
+    }
+}
+
+GLint Program::getActiveAttributeCount()
+{
+    int count = 0;
+
+    if (mLinked)
+    {
+        for (int attributeIndex = 0; attributeIndex &lt; MAX_VERTEX_ATTRIBS; attributeIndex++)
+        {
+            if (!mLinkedAttribute[attributeIndex].name.empty())
+            {
+                count++;
+            }
+        }
+    }
+
+    return count;
+}
+
+GLint Program::getActiveAttributeMaxLength()
+{
+    int maxLength = 0;
+
+    if (mLinked)
+    {
+        for (int attributeIndex = 0; attributeIndex &lt; MAX_VERTEX_ATTRIBS; attributeIndex++)
+        {
+            if (!mLinkedAttribute[attributeIndex].name.empty())
+            {
+                maxLength = std::max((int)(mLinkedAttribute[attributeIndex].name.length() + 1), maxLength);
+            }
+        }
+    }
+
+    return maxLength;
+}
+
+// Returns one more than the highest sampler index used.
+GLint Program::getUsedSamplerRange(SamplerType type)
+{
+    return mProgram-&gt;getUsedSamplerRange(type);
+}
+
+bool Program::usesPointSize() const
+{
+    return mProgram-&gt;usesPointSize();
+}
+
+GLint Program::getSamplerMapping(SamplerType type, unsigned int samplerIndex, const Caps &amp;caps)
+{
+    return mProgram-&gt;getSamplerMapping(type, samplerIndex, caps);
+}
+
+GLenum Program::getSamplerTextureType(SamplerType type, unsigned int samplerIndex)
+{
+    return mProgram-&gt;getSamplerTextureType(type, samplerIndex);
+}
+
+GLint Program::getFragDataLocation(const std::string &amp;name) const
+{
+    std::string baseName(name);
+    unsigned int arrayIndex = ParseAndStripArrayIndex(&amp;baseName);
+    for (auto locationIt = mOutputVariables.begin(); locationIt != mOutputVariables.end(); locationIt++)
+    {
+        const VariableLocation &amp;outputVariable = locationIt-&gt;second;
+        if (outputVariable.name == baseName &amp;&amp; (arrayIndex == GL_INVALID_INDEX || arrayIndex == outputVariable.element))
+        {
+            return static_cast&lt;GLint&gt;(locationIt-&gt;first);
+        }
+    }
+    return -1;
+}
+
+void Program::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+    if (mLinked)
+    {
+        ASSERT(index &lt; mProgram-&gt;getUniforms().size());   // index must be smaller than getActiveUniformCount()
+        LinkedUniform *uniform = mProgram-&gt;getUniforms()[index];
+
+        if (bufsize &gt; 0)
+        {
+            std::string string = uniform-&gt;name;
+            if (uniform-&gt;isArray())
+            {
+                string += &quot;[0]&quot;;
+            }
+
+            strncpy(name, string.c_str(), bufsize);
+            name[bufsize - 1] = '\0';
+
+            if (length)
+            {
+                *length = static_cast&lt;GLsizei&gt;(strlen(name));
+            }
+        }
+
+        *size = uniform-&gt;elementCount();
+        *type = uniform-&gt;type;
+    }
+    else
+    {
+        if (bufsize &gt; 0)
+        {
+            name[0] = '\0';
+        }
+
+        if (length)
+        {
+            *length = 0;
+        }
+
+        *size = 0;
+        *type = GL_NONE;
+    }
+}
+
+GLint Program::getActiveUniformCount()
+{
+    if (mLinked)
+    {
+        return static_cast&lt;GLint&gt;(mProgram-&gt;getUniforms().size());
+    }
+    else
+    {
+        return 0;
+    }
+}
+
+GLint Program::getActiveUniformMaxLength()
+{
+    int maxLength = 0;
+
+    if (mLinked)
+    {
+        unsigned int numUniforms = static_cast&lt;unsigned int&gt;(mProgram-&gt;getUniforms().size());
+        for (unsigned int uniformIndex = 0; uniformIndex &lt; numUniforms; uniformIndex++)
+        {
+            if (!mProgram-&gt;getUniforms()[uniformIndex]-&gt;name.empty())
+            {
+                int length = (int)(mProgram-&gt;getUniforms()[uniformIndex]-&gt;name.length() + 1);
+                if (mProgram-&gt;getUniforms()[uniformIndex]-&gt;isArray())
+                {
+                    length += 3;  // Counting in &quot;[0]&quot;.
+                }
+                maxLength = std::max(length, maxLength);
+            }
+        }
+    }
+
+    return maxLength;
+}
+
+GLint Program::getActiveUniformi(GLuint index, GLenum pname) const
+{
+    const gl::LinkedUniform&amp; uniform = *mProgram-&gt;getUniforms()[index];
+    switch (pname)
+    {
+      case GL_UNIFORM_TYPE:         return static_cast&lt;GLint&gt;(uniform.type);
+      case GL_UNIFORM_SIZE:         return static_cast&lt;GLint&gt;(uniform.elementCount());
+      case GL_UNIFORM_NAME_LENGTH:  return static_cast&lt;GLint&gt;(uniform.name.size() + 1 + (uniform.isArray() ? 3 : 0));
+      case GL_UNIFORM_BLOCK_INDEX:  return uniform.blockIndex;
+      case GL_UNIFORM_OFFSET:       return uniform.blockInfo.offset;
+      case GL_UNIFORM_ARRAY_STRIDE: return uniform.blockInfo.arrayStride;
+      case GL_UNIFORM_MATRIX_STRIDE: return uniform.blockInfo.matrixStride;
+      case GL_UNIFORM_IS_ROW_MAJOR: return static_cast&lt;GLint&gt;(uniform.blockInfo.isRowMajorMatrix);
+      default:
+        UNREACHABLE();
+        break;
+    }
+    return 0;
+}
+
+bool Program::isValidUniformLocation(GLint location) const
+{
+    ASSERT(rx::IsIntegerCastSafe&lt;GLint&gt;(mProgram-&gt;getUniformIndices().size()));
+    return (location &gt;= 0 &amp;&amp; location &lt; static_cast&lt;GLint&gt;(mProgram-&gt;getUniformIndices().size()));
+}
+
+LinkedUniform *Program::getUniformByLocation(GLint location) const
+{
+    return mProgram-&gt;getUniformByLocation(location);
+}
+
+LinkedUniform *Program::getUniformByName(const std::string &amp;name) const
+{
+    return mProgram-&gt;getUniformByName(name);
+}
+
+GLint Program::getUniformLocation(const std::string &amp;name)
+{
+    return mProgram-&gt;getUniformLocation(name);
+}
+
+GLuint Program::getUniformIndex(const std::string &amp;name)
+{
+    return mProgram-&gt;getUniformIndex(name);
+}
+
+void Program::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mProgram-&gt;setUniform1fv(location, count, v);
+}
+
+void Program::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mProgram-&gt;setUniform2fv(location, count, v);
+}
+
+void Program::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mProgram-&gt;setUniform3fv(location, count, v);
+}
+
+void Program::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mProgram-&gt;setUniform4fv(location, count, v);
+}
+
+void Program::setUniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+    mProgram-&gt;setUniform1iv(location, count, v);
+}
+
+void Program::setUniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+    mProgram-&gt;setUniform2iv(location, count, v);
+}
+
+void Program::setUniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+    mProgram-&gt;setUniform3iv(location, count, v);
+}
+
+void Program::setUniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+    mProgram-&gt;setUniform4iv(location, count, v);
+}
+
+void Program::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mProgram-&gt;setUniform1uiv(location, count, v);
+}
+
+void Program::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mProgram-&gt;setUniform2uiv(location, count, v);
+}
+
+void Program::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mProgram-&gt;setUniform3uiv(location, count, v);
+}
+
+void Program::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mProgram-&gt;setUniform4uiv(location, count, v);
+}
+
+void Program::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix2fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix3fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix4fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix2x3fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix2x4fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix3x2fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix3x4fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix4x2fv(location, count, transpose, v);
+}
+
+void Program::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *v)
+{
+    mProgram-&gt;setUniformMatrix4x3fv(location, count, transpose, v);
+}
+
+void Program::getUniformfv(GLint location, GLfloat *v)
+{
+    mProgram-&gt;getUniformfv(location, v);
+}
+
+void Program::getUniformiv(GLint location, GLint *v)
+{
+    mProgram-&gt;getUniformiv(location, v);
+}
+
+void Program::getUniformuiv(GLint location, GLuint *v)
+{
+    mProgram-&gt;getUniformuiv(location, v);
+}
+
+// Applies all the uniforms set for this program object to the renderer
+Error Program::applyUniforms()
+{
+    return mProgram-&gt;applyUniforms();
+}
+
+Error Program::applyUniformBuffers(const gl::Data &amp;data)
+{
+    return mProgram-&gt;applyUniformBuffers(data, mUniformBlockBindings);
+}
+
+void Program::flagForDeletion()
+{
+    mDeleteStatus = true;
+}
+
+bool Program::isFlaggedForDeletion() const
+{
+    return mDeleteStatus;
+}
+
+void Program::validate(const Caps &amp;caps)
+{
+    mInfoLog.reset();
+    mValidated = false;
+
+    if (mLinked)
+    {
+        applyUniforms();
+        mValidated = mProgram-&gt;validateSamplers(&amp;mInfoLog, caps);
+    }
+    else
+    {
+        mInfoLog.append(&quot;Program has not been successfully linked.&quot;);
+    }
+}
+
+bool Program::validateSamplers(InfoLog *infoLog, const Caps &amp;caps)
+{
+    return mProgram-&gt;validateSamplers(infoLog, caps);
+}
+
+bool Program::isValidated() const
+{
+    return mValidated;
+}
+
+void Program::updateSamplerMapping()
+{
+    return mProgram-&gt;updateSamplerMapping();
+}
+
+GLuint Program::getActiveUniformBlockCount()
+{
+    return static_cast&lt;GLuint&gt;(mProgram-&gt;getUniformBlocks().size());
+}
+
+void Program::getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const
+{
+    ASSERT(uniformBlockIndex &lt; mProgram-&gt;getUniformBlocks().size());   // index must be smaller than getActiveUniformBlockCount()
+
+    const UniformBlock &amp;uniformBlock = *mProgram-&gt;getUniformBlocks()[uniformBlockIndex];
+
+    if (bufSize &gt; 0)
+    {
+        std::string string = uniformBlock.name;
+
+        if (uniformBlock.isArrayElement())
+        {
+            string += ArrayString(uniformBlock.elementIndex);
+        }
+
+        strncpy(uniformBlockName, string.c_str(), bufSize);
+        uniformBlockName[bufSize - 1] = '\0';
+
+        if (length)
+        {
+            *length = static_cast&lt;GLsizei&gt;(strlen(uniformBlockName));
+        }
+    }
+}
+
+void Program::getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const
+{
+    ASSERT(uniformBlockIndex &lt; mProgram-&gt;getUniformBlocks().size());   // index must be smaller than getActiveUniformBlockCount()
+
+    const UniformBlock &amp;uniformBlock = *mProgram-&gt;getUniformBlocks()[uniformBlockIndex];
+
+    switch (pname)
+    {
+      case GL_UNIFORM_BLOCK_DATA_SIZE:
+        *params = static_cast&lt;GLint&gt;(uniformBlock.dataSize);
+        break;
+      case GL_UNIFORM_BLOCK_NAME_LENGTH:
+        *params = static_cast&lt;GLint&gt;(uniformBlock.name.size() + 1 + (uniformBlock.isArrayElement() ? 3 : 0));
+        break;
+      case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+        *params = static_cast&lt;GLint&gt;(uniformBlock.memberUniformIndexes.size());
+        break;
+      case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+        {
+            for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
+            {
+                params[blockMemberIndex] = static_cast&lt;GLint&gt;(uniformBlock.memberUniformIndexes[blockMemberIndex]);
+            }
+        }
+        break;
+      case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+        *params = static_cast&lt;GLint&gt;(uniformBlock.isReferencedByVertexShader());
+        break;
+      case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+        *params = static_cast&lt;GLint&gt;(uniformBlock.isReferencedByFragmentShader());
+        break;
+      default: UNREACHABLE();
+    }
+}
+
+GLint Program::getActiveUniformBlockMaxLength()
+{
+    int maxLength = 0;
+
+    if (mLinked)
+    {
+        unsigned int numUniformBlocks = static_cast&lt;unsigned int&gt;(mProgram-&gt;getUniformBlocks().size());
+        for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; numUniformBlocks; uniformBlockIndex++)
+        {
+            const UniformBlock &amp;uniformBlock = *mProgram-&gt;getUniformBlocks()[uniformBlockIndex];
+            if (!uniformBlock.name.empty())
+            {
+                const int length = static_cast&lt;int&gt;(uniformBlock.name.length() + 1);
+
+                // Counting in &quot;[0]&quot;.
+                const int arrayLength = (uniformBlock.isArrayElement() ? 3 : 0);
+
+                maxLength = std::max(length + arrayLength, maxLength);
+            }
+        }
+    }
+
+    return maxLength;
+}
+
+GLuint Program::getUniformBlockIndex(const std::string &amp;name)
+{
+    return mProgram-&gt;getUniformBlockIndex(name);
+}
+
+const UniformBlock *Program::getUniformBlockByIndex(GLuint index) const
+{
+    return mProgram-&gt;getUniformBlockByIndex(index);
+}
+
+void Program::bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+    mUniformBlockBindings[uniformBlockIndex] = uniformBlockBinding;
+}
+
+GLuint Program::getUniformBlockBinding(GLuint uniformBlockIndex) const
+{
+    return mUniformBlockBindings[uniformBlockIndex];
+}
+
+void Program::resetUniformBlockBindings()
+{
+    for (unsigned int blockId = 0; blockId &lt; IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; blockId++)
+    {
+        mUniformBlockBindings[blockId] = 0;
+    }
+}
+
+void Program::setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
+{
+    mTransformFeedbackVaryings.resize(count);
+    for (GLsizei i = 0; i &lt; count; i++)
+    {
+        mTransformFeedbackVaryings[i] = varyings[i];
+    }
+
+    mTransformFeedbackBufferMode = bufferMode;
+}
+
+void Program::getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const
+{
+    if (mLinked)
+    {
+        ASSERT(index &lt; mProgram-&gt;getTransformFeedbackLinkedVaryings().size());
+        const LinkedVarying &amp;varying = mProgram-&gt;getTransformFeedbackLinkedVaryings()[index];
+        GLsizei lastNameIdx = std::min(bufSize - 1, static_cast&lt;GLsizei&gt;(varying.name.length()));
+        if (length)
+        {
+            *length = lastNameIdx;
+        }
+        if (size)
+        {
+            *size = varying.size;
+        }
+        if (type)
+        {
+            *type = varying.type;
+        }
+        if (name)
+        {
+            memcpy(name, varying.name.c_str(), lastNameIdx);
+            name[lastNameIdx] = '\0';
+        }
+    }
+}
+
+GLsizei Program::getTransformFeedbackVaryingCount() const
+{
+    if (mLinked)
+    {
+        return static_cast&lt;GLsizei&gt;(mProgram-&gt;getTransformFeedbackLinkedVaryings().size());
+    }
+    else
+    {
+        return 0;
+    }
+}
+
+GLsizei Program::getTransformFeedbackVaryingMaxLength() const
+{
+    if (mLinked)
+    {
+        GLsizei maxSize = 0;
+        for (size_t i = 0; i &lt; mProgram-&gt;getTransformFeedbackLinkedVaryings().size(); i++)
+        {
+            const LinkedVarying &amp;varying = mProgram-&gt;getTransformFeedbackLinkedVaryings()[i];
+            maxSize = std::max(maxSize, static_cast&lt;GLsizei&gt;(varying.name.length() + 1));
+        }
+
+        return maxSize;
+    }
+    else
+    {
+        return 0;
+    }
+}
+
+GLenum Program::getTransformFeedbackBufferMode() const
+{
+    return mTransformFeedbackBufferMode;
+}
+
+bool Program::linkVaryings(InfoLog &amp;infoLog, Shader *fragmentShader, Shader *vertexShader)
+{
+    std::vector&lt;PackedVarying&gt; &amp;fragmentVaryings = fragmentShader-&gt;getVaryings();
+    std::vector&lt;PackedVarying&gt; &amp;vertexVaryings = vertexShader-&gt;getVaryings();
+
+    for (size_t fragVaryingIndex = 0; fragVaryingIndex &lt; fragmentVaryings.size(); fragVaryingIndex++)
+    {
+        PackedVarying *input = &amp;fragmentVaryings[fragVaryingIndex];
+        bool matched = false;
+
+        // Built-in varyings obey special rules
+        if (input-&gt;isBuiltIn())
+        {
+            continue;
+        }
+
+        for (size_t vertVaryingIndex = 0; vertVaryingIndex &lt; vertexVaryings.size(); vertVaryingIndex++)
+        {
+            PackedVarying *output = &amp;vertexVaryings[vertVaryingIndex];
+            if (output-&gt;name == input-&gt;name)
+            {
+                if (!linkValidateVaryings(infoLog, output-&gt;name, *input, *output))
+                {
+                    return false;
+                }
+
+                output-&gt;registerIndex = input-&gt;registerIndex;
+                output-&gt;columnIndex = input-&gt;columnIndex;
+
+                matched = true;
+                break;
+            }
+        }
+
+        // We permit unmatched, unreferenced varyings
+        if (!matched &amp;&amp; input-&gt;staticUse)
+        {
+            infoLog.append(&quot;Fragment varying %s does not match any vertex varying&quot;, input-&gt;name.c_str());
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool Program::linkValidateInterfaceBlockFields(InfoLog &amp;infoLog, const std::string &amp;uniformName, const sh::InterfaceBlockField &amp;vertexUniform, const sh::InterfaceBlockField &amp;fragmentUniform)
+{
+    if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
+    {
+        return false;
+    }
+
+    if (vertexUniform.isRowMajorLayout != fragmentUniform.isRowMajorLayout)
+    {
+        infoLog.append(&quot;Matrix packings for %s differ between vertex and fragment shaders&quot;, uniformName.c_str());
+        return false;
+    }
+
+    return true;
+}
+
+// Determines the mapping between GL attributes and Direct3D 9 vertex stream usage indices
+bool Program::linkAttributes(const Data &amp;data,
+                             InfoLog &amp;infoLog,
+                             const AttributeBindings &amp;attributeBindings,
+                             const Shader *vertexShader)
+{
+    unsigned int usedLocations = 0;
+    const std::vector&lt;sh::Attribute&gt; &amp;shaderAttributes = vertexShader-&gt;getActiveAttributes();
+    GLuint maxAttribs = data.caps-&gt;maxVertexAttributes;
+
+    // TODO(jmadill): handle aliasing robustly
+    if (shaderAttributes.size() &gt;= maxAttribs)
+    {
+        infoLog.append(&quot;Too many vertex attributes.&quot;);
+        return false;
+    }
+
+    // Link attributes that have a binding location
+    for (unsigned int attributeIndex = 0; attributeIndex &lt; shaderAttributes.size(); attributeIndex++)
+    {
+        const sh::Attribute &amp;attribute = shaderAttributes[attributeIndex];
+
+        ASSERT(attribute.staticUse);
+
+        const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
+
+        mProgram-&gt;setShaderAttribute(attributeIndex, attribute);
+
+        if (location != -1)   // Set by glBindAttribLocation or by location layout qualifier
+        {
+            const int rows = VariableRegisterCount(attribute.type);
+
+            if (static_cast&lt;GLuint&gt;(rows + location) &gt; maxAttribs)
+            {
+                infoLog.append(&quot;Active attribute (%s) at location %d is too big to fit&quot;, attribute.name.c_str(), location);
+
+                return false;
+            }
+
+            for (int row = 0; row &lt; rows; row++)
+            {
+                const int rowLocation = location + row;
+                sh::ShaderVariable &amp;linkedAttribute = mLinkedAttribute[rowLocation];
+
+                // In GLSL 3.00, attribute aliasing produces a link error
+                // In GLSL 1.00, attribute aliasing is allowed, but ANGLE currently has a bug
+                // TODO(jmadill): fix aliasing on ES2
+                // if (mProgram-&gt;getShaderVersion() &gt;= 300)
+                {
+                    if (!linkedAttribute.name.empty())
+                    {
+                        infoLog.append(&quot;Attribute '%s' aliases attribute '%s' at location %d&quot;, attribute.name.c_str(), linkedAttribute.name.c_str(), rowLocation);
+                        return false;
+                    }
+                }
+
+                linkedAttribute = attribute;
+                usedLocations |= 1 &lt;&lt; rowLocation;
+            }
+        }
+    }
+
+    // Link attributes that don't have a binding location
+    for (unsigned int attributeIndex = 0; attributeIndex &lt; shaderAttributes.size(); attributeIndex++)
+    {
+        const sh::Attribute &amp;attribute = shaderAttributes[attributeIndex];
+
+        ASSERT(attribute.staticUse);
+
+        const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
+
+        if (location == -1)   // Not set by glBindAttribLocation or by location layout qualifier
+        {
+            int rows = VariableRegisterCount(attribute.type);
+            int availableIndex = AllocateFirstFreeBits(&amp;usedLocations, rows, maxAttribs);
+
+            if (availableIndex == -1 || static_cast&lt;GLuint&gt;(availableIndex + rows) &gt; maxAttribs)
+            {
+                infoLog.append(&quot;Too many active attributes (%s)&quot;, attribute.name.c_str());
+
+                return false;   // Fail to link
+            }
+
+            mLinkedAttribute[availableIndex] = attribute;
+        }
+    }
+
+    for (GLuint attributeIndex = 0; attributeIndex &lt; maxAttribs;)
+    {
+        int index = vertexShader-&gt;getSemanticIndex(mLinkedAttribute[attributeIndex].name);
+        int rows = VariableRegisterCount(mLinkedAttribute[attributeIndex].type);
+
+        for (int r = 0; r &lt; rows; r++)
+        {
+            mProgram-&gt;getSemanticIndexes()[attributeIndex++] = index++;
+        }
+    }
+
+    return true;
+}
+
+bool Program::linkUniformBlocks(InfoLog &amp;infoLog, const Shader &amp;vertexShader, const Shader &amp;fragmentShader, const Caps &amp;caps)
+{
+    const std::vector&lt;sh::InterfaceBlock&gt; &amp;vertexInterfaceBlocks = vertexShader.getInterfaceBlocks();
+    const std::vector&lt;sh::InterfaceBlock&gt; &amp;fragmentInterfaceBlocks = fragmentShader.getInterfaceBlocks();
+    // Check that interface blocks defined in the vertex and fragment shaders are identical
+    typedef std::map&lt;std::string, const sh::InterfaceBlock*&gt; UniformBlockMap;
+    UniformBlockMap linkedUniformBlocks;
+    for (unsigned int blockIndex = 0; blockIndex &lt; vertexInterfaceBlocks.size(); blockIndex++)
+    {
+        const sh::InterfaceBlock &amp;vertexInterfaceBlock = vertexInterfaceBlocks[blockIndex];
+        linkedUniformBlocks[vertexInterfaceBlock.name] = &amp;vertexInterfaceBlock;
+    }
+    for (unsigned int blockIndex = 0; blockIndex &lt; fragmentInterfaceBlocks.size(); blockIndex++)
+    {
+        const sh::InterfaceBlock &amp;fragmentInterfaceBlock = fragmentInterfaceBlocks[blockIndex];
+        UniformBlockMap::const_iterator entry = linkedUniformBlocks.find(fragmentInterfaceBlock.name);
+        if (entry != linkedUniformBlocks.end())
+        {
+            const sh::InterfaceBlock &amp;vertexInterfaceBlock = *entry-&gt;second;
+            if (!areMatchingInterfaceBlocks(infoLog, vertexInterfaceBlock, fragmentInterfaceBlock))
+            {
+                return false;
+            }
+        }
+    }
+    for (unsigned int blockIndex = 0; blockIndex &lt; vertexInterfaceBlocks.size(); blockIndex++)
+    {
+        const sh::InterfaceBlock &amp;interfaceBlock = vertexInterfaceBlocks[blockIndex];
+        // Note: shared and std140 layouts are always considered active
+        if (interfaceBlock.staticUse || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED)
+        {
+            if (!mProgram-&gt;defineUniformBlock(infoLog, vertexShader, interfaceBlock, caps))
+            {
+                return false;
+            }
+        }
+    }
+    for (unsigned int blockIndex = 0; blockIndex &lt; fragmentInterfaceBlocks.size(); blockIndex++)
+    {
+        const sh::InterfaceBlock &amp;interfaceBlock = fragmentInterfaceBlocks[blockIndex];
+        // Note: shared and std140 layouts are always considered active
+        if (interfaceBlock.staticUse || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED)
+        {
+            if (!mProgram-&gt;defineUniformBlock(infoLog, fragmentShader, interfaceBlock, caps))
+            {
+                return false;
+            }
+        }
+    }
+    return true;
+}
+
+bool Program::areMatchingInterfaceBlocks(gl::InfoLog &amp;infoLog, const sh::InterfaceBlock &amp;vertexInterfaceBlock,
+                                         const sh::InterfaceBlock &amp;fragmentInterfaceBlock)
+{
+    const char* blockName = vertexInterfaceBlock.name.c_str();
+    // validate blocks for the same member types
+    if (vertexInterfaceBlock.fields.size() != fragmentInterfaceBlock.fields.size())
+    {
+        infoLog.append(&quot;Types for interface block '%s' differ between vertex and fragment shaders&quot;, blockName);
+        return false;
+    }
+    if (vertexInterfaceBlock.arraySize != fragmentInterfaceBlock.arraySize)
+    {
+        infoLog.append(&quot;Array sizes differ for interface block '%s' between vertex and fragment shaders&quot;, blockName);
+        return false;
+    }
+    if (vertexInterfaceBlock.layout != fragmentInterfaceBlock.layout || vertexInterfaceBlock.isRowMajorLayout != fragmentInterfaceBlock.isRowMajorLayout)
+    {
+        infoLog.append(&quot;Layout qualifiers differ for interface block '%s' between vertex and fragment shaders&quot;, blockName);
+        return false;
+    }
+    const unsigned int numBlockMembers = static_cast&lt;unsigned int&gt;(vertexInterfaceBlock.fields.size());
+    for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; numBlockMembers; blockMemberIndex++)
+    {
+        const sh::InterfaceBlockField &amp;vertexMember = vertexInterfaceBlock.fields[blockMemberIndex];
+        const sh::InterfaceBlockField &amp;fragmentMember = fragmentInterfaceBlock.fields[blockMemberIndex];
+        if (vertexMember.name != fragmentMember.name)
+        {
+            infoLog.append(&quot;Name mismatch for field %d of interface block '%s': (in vertex: '%s', in fragment: '%s')&quot;,
+                           blockMemberIndex, blockName, vertexMember.name.c_str(), fragmentMember.name.c_str());
+            return false;
+        }
+        std::string memberName = &quot;interface block '&quot; + vertexInterfaceBlock.name + &quot;' member '&quot; + vertexMember.name + &quot;'&quot;;
+        if (!linkValidateInterfaceBlockFields(infoLog, memberName, vertexMember, fragmentMember))
+        {
+            return false;
+        }
+    }
+    return true;
+}
+
+bool Program::linkValidateVariablesBase(InfoLog &amp;infoLog, const std::string &amp;variableName, const sh::ShaderVariable &amp;vertexVariable,
+                                              const sh::ShaderVariable &amp;fragmentVariable, bool validatePrecision)
+{
+    if (vertexVariable.type != fragmentVariable.type)
+    {
+        infoLog.append(&quot;Types for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
+        return false;
+    }
+    if (vertexVariable.arraySize != fragmentVariable.arraySize)
+    {
+        infoLog.append(&quot;Array sizes for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
+        return false;
+    }
+    if (validatePrecision &amp;&amp; vertexVariable.precision != fragmentVariable.precision)
+    {
+        infoLog.append(&quot;Precisions for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
+        return false;
+    }
+
+    if (vertexVariable.fields.size() != fragmentVariable.fields.size())
+    {
+        infoLog.append(&quot;Structure lengths for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
+        return false;
+    }
+    const unsigned int numMembers = static_cast&lt;unsigned int&gt;(vertexVariable.fields.size());
+    for (unsigned int memberIndex = 0; memberIndex &lt; numMembers; memberIndex++)
+    {
+        const sh::ShaderVariable &amp;vertexMember = vertexVariable.fields[memberIndex];
+        const sh::ShaderVariable &amp;fragmentMember = fragmentVariable.fields[memberIndex];
+
+        if (vertexMember.name != fragmentMember.name)
+        {
+            infoLog.append(&quot;Name mismatch for field '%d' of %s: (in vertex: '%s', in fragment: '%s')&quot;,
+                           memberIndex, variableName.c_str(),
+                           vertexMember.name.c_str(), fragmentMember.name.c_str());
+            return false;
+        }
+
+        const std::string memberName = variableName.substr(0, variableName.length() - 1) + &quot;.&quot; +
+                                       vertexMember.name + &quot;'&quot;;
+
+        if (!linkValidateVariablesBase(infoLog, vertexMember.name, vertexMember, fragmentMember, validatePrecision))
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool Program::linkValidateUniforms(InfoLog &amp;infoLog, const std::string &amp;uniformName, const sh::Uniform &amp;vertexUniform, const sh::Uniform &amp;fragmentUniform)
+{
+    if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool Program::linkValidateVaryings(InfoLog &amp;infoLog, const std::string &amp;varyingName, const sh::Varying &amp;vertexVarying, const sh::Varying &amp;fragmentVarying)
+{
+    if (!linkValidateVariablesBase(infoLog, varyingName, vertexVarying, fragmentVarying, false))
+    {
+        return false;
+    }
+
+    if (!sh::InterpolationTypesMatch(vertexVarying.interpolation, fragmentVarying.interpolation))
+    {
+        infoLog.append(&quot;Interpolation types for %s differ between vertex and fragment shaders&quot;, varyingName.c_str());
+        return false;
+    }
+
+    return true;
+}
+
+bool Program::gatherTransformFeedbackLinkedVaryings(InfoLog &amp;infoLog, const std::vector&lt;LinkedVarying&gt; &amp;linkedVaryings,
+                                                    const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryingNames,
+                                                    GLenum transformFeedbackBufferMode,
+                                                    std::vector&lt;LinkedVarying&gt; *outTransformFeedbackLinkedVaryings,
+                                                    const Caps &amp;caps) const
+{
+    size_t totalComponents = 0;
+
+    // Gather the linked varyings that are used for transform feedback, they should all exist.
+    outTransformFeedbackLinkedVaryings-&gt;clear();
+    for (size_t i = 0; i &lt; transformFeedbackVaryingNames.size(); i++)
+    {
+        bool found = false;
+        for (size_t j = 0; j &lt; linkedVaryings.size(); j++)
+        {
+            if (transformFeedbackVaryingNames[i] == linkedVaryings[j].name)
+            {
+                for (size_t k = 0; k &lt; outTransformFeedbackLinkedVaryings-&gt;size(); k++)
+                {
+                    if (outTransformFeedbackLinkedVaryings-&gt;at(k).name == linkedVaryings[j].name)
+                    {
+                        infoLog.append(&quot;Two transform feedback varyings specify the same output variable (%s).&quot;, linkedVaryings[j].name.c_str());
+                        return false;
+                    }
+                }
+
+                size_t componentCount = linkedVaryings[j].semanticIndexCount * 4;
+                if (transformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &amp;&amp;
+                    componentCount &gt; caps.maxTransformFeedbackSeparateComponents)
+                {
+                    infoLog.append(&quot;Transform feedback varying's %s components (%u) exceed the maximum separate components (%u).&quot;,
+                                   linkedVaryings[j].name.c_str(), componentCount, caps.maxTransformFeedbackSeparateComponents);
+                    return false;
+                }
+
+                totalComponents += componentCount;
+
+                outTransformFeedbackLinkedVaryings-&gt;push_back(linkedVaryings[j]);
+                found = true;
+                break;
+            }
+        }
+
+        // All transform feedback varyings are expected to exist since packVaryings checks for them.
+        ASSERT(found);
+    }
+
+    if (transformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS &amp;&amp; totalComponents &gt; caps.maxTransformFeedbackInterleavedComponents)
+    {
+        infoLog.append(&quot;Transform feedback varying total components (%u) exceed the maximum interleaved components (%u).&quot;,
+                       totalComponents, caps.maxTransformFeedbackInterleavedComponents);
+        return false;
+    }
+
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEProgramh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Program.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,281 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 LIBANGLE_PROGRAM_H_
+#define LIBANGLE_PROGRAM_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;GLSLANG/ShaderLang.h&gt;
+
+#include &lt;vector&gt;
+#include &lt;sstream&gt;
+#include &lt;string&gt;
+#include &lt;set&gt;
+
+namespace rx
+{
+class Renderer;
+class Renderer;
+struct TranslatedAttribute;
+class ProgramImpl;
+}
+
+namespace gl
+{
+struct Caps;
+struct Data;
+class ResourceManager;
+class Shader;
+class InfoLog;
+class AttributeBindings;
+class Buffer;
+class Framebuffer;
+struct UniformBlock;
+struct LinkedUniform;
+
+extern const char * const g_fakepath;
+
+class AttributeBindings
+{
+  public:
+    AttributeBindings();
+    ~AttributeBindings();
+
+    void bindAttributeLocation(GLuint index, const char *name);
+    int getAttributeBinding(const std::string &amp;name) const;
+
+  private:
+    std::set&lt;std::string&gt; mAttributeBinding[MAX_VERTEX_ATTRIBS];
+};
+
+class InfoLog : angle::NonCopyable
+{
+  public:
+    InfoLog();
+    ~InfoLog();
+
+    size_t getLength() const;
+    void getLog(GLsizei bufSize, GLsizei *length, char *infoLog);
+
+    void appendSanitized(const char *message);
+    void append(const char *info, ...);
+    void reset();
+  private:
+    std::stringstream mStream;
+};
+
+// Struct used for correlating uniforms/elements of uniform arrays to handles
+struct VariableLocation
+{
+    VariableLocation();
+    VariableLocation(const std::string &amp;name, unsigned int element, unsigned int index);
+
+    std::string name;
+    unsigned int element;
+    unsigned int index;
+};
+
+struct LinkedVarying
+{
+    LinkedVarying();
+    LinkedVarying(const std::string &amp;name, GLenum type, GLsizei size, const std::string &amp;semanticName,
+        unsigned int semanticIndex, unsigned int semanticIndexCount);
+
+    // Original GL name
+    std::string name;
+
+    GLenum type;
+    GLsizei size;
+
+    // DirectX semantic information
+    std::string semanticName;
+    unsigned int semanticIndex;
+    unsigned int semanticIndexCount;
+};
+
+class Program : angle::NonCopyable
+{
+  public:
+    Program(rx::ProgramImpl *impl, ResourceManager *manager, GLuint handle);
+    ~Program();
+
+    GLuint id() const { return mHandle; }
+
+    rx::ProgramImpl *getImplementation() { return mProgram; }
+    const rx::ProgramImpl *getImplementation() const { return mProgram; }
+
+    bool attachShader(Shader *shader);
+    bool detachShader(Shader *shader);
+    int getAttachedShadersCount() const;
+
+    void bindAttributeLocation(GLuint index, const char *name);
+
+    Error link(const Data &amp;data);
+    bool isLinked();
+
+    Error loadBinary(GLenum binaryFormat, const void *binary, GLsizei length);
+    Error saveBinary(GLenum *binaryFormat, void *binary, GLsizei bufSize, GLsizei *length) const;
+    GLint getBinaryLength() const;
+
+    int getInfoLogLength() const;
+    void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
+    void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
+
+    GLuint getAttributeLocation(const std::string &amp;name);
+    int getSemanticIndex(int attributeIndex);
+    const int *getSemanticIndexes() const;
+
+    void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+    GLint getActiveAttributeCount();
+    GLint getActiveAttributeMaxLength();
+
+    GLint getSamplerMapping(SamplerType type, unsigned int samplerIndex, const Caps &amp;caps);
+    GLenum getSamplerTextureType(SamplerType type, unsigned int samplerIndex);
+    GLint getUsedSamplerRange(SamplerType type);
+    bool usesPointSize() const;
+
+    GLint getFragDataLocation(const std::string &amp;name) const;
+
+    void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+    GLint getActiveUniformCount();
+    GLint getActiveUniformMaxLength();
+    GLint getActiveUniformi(GLuint index, GLenum pname) const;
+    bool isValidUniformLocation(GLint location) const;
+    LinkedUniform *getUniformByLocation(GLint location) const;
+    LinkedUniform *getUniformByName(const std::string &amp;name) const;
+
+    GLint getUniformLocation(const std::string &amp;name);
+    GLuint getUniformIndex(const std::string &amp;name);
+    void setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform1iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform2iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform3iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform4iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform1uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+
+    void getUniformfv(GLint location, GLfloat *params);
+    void getUniformiv(GLint location, GLint *params);
+    void getUniformuiv(GLint location, GLuint *params);
+
+    Error applyUniforms();
+    Error applyUniformBuffers(const gl::Data &amp;data);
+
+    void getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const;
+    void getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const;
+    GLuint getActiveUniformBlockCount();
+    GLint getActiveUniformBlockMaxLength();
+
+    GLuint getUniformBlockIndex(const std::string &amp;name);
+
+    void bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+    GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const;
+
+    const UniformBlock *getUniformBlockByIndex(GLuint index) const;
+
+    void setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode);
+    void getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const;
+    GLsizei getTransformFeedbackVaryingCount() const;
+    GLsizei getTransformFeedbackVaryingMaxLength() const;
+    GLenum getTransformFeedbackBufferMode() const;
+
+    static bool linkVaryings(InfoLog &amp;infoLog, Shader *fragmentShader, Shader *vertexShader);
+    static bool linkValidateUniforms(InfoLog &amp;infoLog, const std::string &amp;uniformName, const sh::Uniform &amp;vertexUniform, const sh::Uniform &amp;fragmentUniform);
+    static bool linkValidateInterfaceBlockFields(InfoLog &amp;infoLog, const std::string &amp;uniformName, const sh::InterfaceBlockField &amp;vertexUniform, const sh::InterfaceBlockField &amp;fragmentUniform);
+
+    void addRef();
+    void release();
+    unsigned int getRefCount() const;
+    void flagForDeletion();
+    bool isFlaggedForDeletion() const;
+
+    void validate(const Caps &amp;caps);
+    bool validateSamplers(InfoLog *infoLog, const Caps &amp;caps);
+    bool isValidated() const;
+    void updateSamplerMapping();
+
+  private:
+    void unlink(bool destroy = false);
+    void resetUniformBlockBindings();
+
+    bool linkAttributes(const Data &amp;data,
+                        InfoLog &amp;infoLog,
+                        const AttributeBindings &amp;attributeBindings,
+                        const Shader *vertexShader);
+    bool linkUniformBlocks(InfoLog &amp;infoLog, const Shader &amp;vertexShader, const Shader &amp;fragmentShader, const Caps &amp;caps);
+    bool areMatchingInterfaceBlocks(gl::InfoLog &amp;infoLog, const sh::InterfaceBlock &amp;vertexInterfaceBlock,
+                                    const sh::InterfaceBlock &amp;fragmentInterfaceBlock);
+
+    static bool linkValidateVariablesBase(InfoLog &amp;infoLog,
+                                          const std::string &amp;variableName,
+                                          const sh::ShaderVariable &amp;vertexVariable,
+                                          const sh::ShaderVariable &amp;fragmentVariable,
+                                          bool validatePrecision);
+
+    static bool linkValidateVaryings(InfoLog &amp;infoLog, const std::string &amp;varyingName, const sh::Varying &amp;vertexVarying, const sh::Varying &amp;fragmentVarying);
+    bool gatherTransformFeedbackLinkedVaryings(InfoLog &amp;infoLog, const std::vector&lt;LinkedVarying&gt; &amp;linkedVaryings,
+                                               const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryingNames,
+                                               GLenum transformFeedbackBufferMode,
+                                               std::vector&lt;LinkedVarying&gt; *outTransformFeedbackLinkedVaryings,
+                                               const Caps &amp;caps) const;
+    bool assignUniformBlockRegister(InfoLog &amp;infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex, const Caps &amp;caps);
+    void defineOutputVariables(Shader *fragmentShader);
+
+    rx::ProgramImpl *mProgram;
+
+    sh::Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
+
+    std::map&lt;int, VariableLocation&gt; mOutputVariables;
+
+    bool mValidated;
+
+    Shader *mFragmentShader;
+    Shader *mVertexShader;
+
+    AttributeBindings mAttributeBindings;
+
+    GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
+
+    std::vector&lt;std::string&gt; mTransformFeedbackVaryings;
+    GLenum mTransformFeedbackBufferMode;
+
+    bool mLinked;
+    bool mDeleteStatus;   // Flag to indicate that the program can be deleted when no longer in use
+
+    unsigned int mRefCount;
+
+    ResourceManager *mResourceManager;
+    const GLuint mHandle;
+
+    InfoLog mInfoLog;
+};
+}
+
+#endif   // LIBANGLE_PROGRAM_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEQuerycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+//
+// 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 &quot;libANGLE/Query.h&quot;
+#include &quot;libANGLE/renderer/QueryImpl.h&quot;
+
+namespace gl
+{
+Query::Query(rx::QueryImpl *impl, GLuint id)
+    : RefCountObject(id),
+      mQuery(impl)
+{
+}
+
+Query::~Query()
+{
+    SafeDelete(mQuery);
+}
+
+Error Query::begin()
+{
+    return mQuery-&gt;begin();
+}
+
+Error Query::end()
+{
+    return mQuery-&gt;end();
+}
+
+Error Query::getResult(GLuint *params)
+{
+    return mQuery-&gt;getResult(params);
+}
+
+Error Query::isResultAvailable(GLuint *available)
+{
+    return mQuery-&gt;isResultAvailable(available);
+}
+
+GLenum Query::getType() const
+{
+    return mQuery-&gt;getType();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEQueryh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Query.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+//
+// 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 LIBANGLE_QUERY_H_
+#define LIBANGLE_QUERY_H_
+
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+namespace rx
+{
+class QueryImpl;
+}
+
+namespace gl
+{
+
+class Query : public RefCountObject
+{
+  public:
+    Query(rx::QueryImpl *impl, GLuint id);
+    virtual ~Query();
+
+    Error begin();
+    Error end();
+
+    Error getResult(GLuint *params);
+    Error isResultAvailable(GLuint *available);
+
+    GLenum getType() const;
+
+  private:
+    rx::QueryImpl *mQuery;
+};
+
+}
+
+#endif   // LIBANGLE_QUERY_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLERefCountObjectcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RefCountObject.cpp: Defines the gl::RefCountObject base class that provides
+// lifecycle support for GL objects using the traditional BindObject scheme, but
+// that need to be reference counted for correct cross-context deletion.
+// (Concretely, textures, buffers and renderbuffers.)
+
+#include &quot;RefCountObject.h&quot;
+
+RefCountObject::RefCountObject(GLuint id)
+    : mId(id),
+      mRefCount(0)
+{
+}
+
+RefCountObject::~RefCountObject()
+{
+    ASSERT(mRefCount == 0);
+}
+
+void RefCountObject::addRef() const
+{
+    mRefCount++;
+}
+
+void RefCountObject::release() const
+{
+    ASSERT(mRefCount &gt; 0);
+
+    if (--mRefCount == 0)
+    {
+        delete this;
+    }
+}
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLERefCountObjecth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/RefCountObject.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+//
+// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// RefCountObject.h: Defines the gl::RefCountObject base class that provides
+// lifecycle support for GL objects using the traditional BindObject scheme, but
+// that need to be reference counted for correct cross-context deletion.
+// (Concretely, textures, buffers and renderbuffers.)
+
+#ifndef LIBANGLE_REFCOUNTOBJECT_H_
+#define LIBANGLE_REFCOUNTOBJECT_H_
+
+#include &quot;common/debug.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;cstddef&gt;
+
+class RefCountObject : angle::NonCopyable
+{
+  public:
+    explicit RefCountObject(GLuint id);
+    virtual ~RefCountObject();
+
+    virtual void addRef() const;
+    virtual void release() const;
+
+    GLuint id() const { return mId; }
+
+  private:
+    GLuint mId;
+
+    mutable std::size_t mRefCount;
+};
+
+template &lt;class ObjectType&gt;
+class BindingPointer
+{
+public:
+    BindingPointer()
+        : mObject(nullptr)
+    {
+    }
+
+    BindingPointer(const BindingPointer&lt;ObjectType&gt; &amp;other)
+        : mObject(nullptr)
+    {
+        set(other.mObject);
+    }
+
+    void operator=(const BindingPointer&lt;ObjectType&gt; &amp;other)
+    {
+        set(other.mObject);
+    }
+
+    virtual ~BindingPointer()
+    {
+        // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up.
+        ASSERT(mObject == nullptr);
+    }
+
+    virtual void set(ObjectType *newObject)
+    {
+        // addRef first in case newObject == mObject and this is the last reference to it.
+        if (newObject != nullptr) reinterpret_cast&lt;const RefCountObject*&gt;(newObject)-&gt;addRef();
+        if (mObject != nullptr) reinterpret_cast&lt;const RefCountObject*&gt;(mObject)-&gt;release();
+        mObject = newObject;
+    }
+
+    ObjectType *get() const { return mObject; }
+    ObjectType *operator-&gt;() const { return mObject; }
+
+    GLuint id() const { return (mObject != nullptr) ? mObject-&gt;id() : 0; }
+
+  private:
+    ObjectType *mObject;
+};
+
+template &lt;class ObjectType&gt;
+class OffsetBindingPointer : public BindingPointer&lt;ObjectType&gt;
+{
+  public:
+    OffsetBindingPointer() : mOffset(0), mSize(0) { }
+
+    void set(ObjectType *newObject) override
+    {
+        BindingPointer&lt;ObjectType&gt;::set(newObject);
+        mOffset = 0;
+        mSize = 0;
+    }
+
+    void set(ObjectType *newObject, GLintptr offset, GLsizeiptr size)
+    {
+        BindingPointer&lt;ObjectType&gt;::set(newObject);
+        mOffset = offset;
+        mSize = size;
+    }
+
+    GLintptr getOffset() const { return mOffset; }
+    GLsizeiptr getSize() const { return mSize; }
+
+  private:
+    GLintptr mOffset;
+    GLsizeiptr mSize;
+};
+
+#endif   // LIBANGLE_REFCOUNTOBJECT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLERenderbuffercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,130 @@
</span><ins>+//
+// 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.
+//
+
+// Renderbuffer.cpp: Implements the renderer-agnostic gl::Renderbuffer class,
+// GL renderbuffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#include &quot;libANGLE/Renderbuffer.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+
+namespace gl
+{
+
+Renderbuffer::Renderbuffer(rx::RenderbufferImpl *impl, GLuint id)
+  : FramebufferAttachmentObject(id),
+    mRenderbuffer(impl),
+    mWidth(0),
+    mHeight(0),
+    mInternalFormat(GL_RGBA4),
+    mSamples(0)
+{
+}
+
+Renderbuffer::~Renderbuffer()
+{
+    SafeDelete(mRenderbuffer);
+}
+
+Error Renderbuffer::setStorage(GLenum internalformat, size_t width, size_t height)
+{
+    Error error = mRenderbuffer-&gt;setStorage(internalformat, width, height);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mWidth = static_cast&lt;GLsizei&gt;(width);
+    mHeight = static_cast&lt;GLsizei&gt;(height);
+    mInternalFormat = internalformat;
+    mSamples = 0;
+
+    return Error(GL_NO_ERROR);
+}
+
+Error Renderbuffer::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height)
+{
+    Error error = mRenderbuffer-&gt;setStorageMultisample(samples, internalformat, width, height);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mWidth = static_cast&lt;GLsizei&gt;(width);
+    mHeight = static_cast&lt;GLsizei&gt;(height);
+    mInternalFormat = internalformat;
+    mSamples = static_cast&lt;GLsizei&gt;(samples);
+
+    return Error(GL_NO_ERROR);
+}
+
+rx::RenderbufferImpl *Renderbuffer::getImplementation()
+{
+    ASSERT(mRenderbuffer);
+    return mRenderbuffer;
+}
+
+const rx::RenderbufferImpl *Renderbuffer::getImplementation() const
+{
+    return mRenderbuffer;
+}
+
+GLsizei Renderbuffer::getWidth() const
+{
+    return mWidth;
+}
+
+GLsizei Renderbuffer::getHeight() const
+{
+    return mHeight;
+}
+
+GLenum Renderbuffer::getInternalFormat() const
+{
+    return mInternalFormat;
+}
+
+GLsizei Renderbuffer::getSamples() const
+{
+    return mSamples;
+}
+
+GLuint Renderbuffer::getRedSize() const
+{
+    return GetInternalFormatInfo(mInternalFormat).redBits;
+}
+
+GLuint Renderbuffer::getGreenSize() const
+{
+    return GetInternalFormatInfo(mInternalFormat).greenBits;
+}
+
+GLuint Renderbuffer::getBlueSize() const
+{
+    return GetInternalFormatInfo(mInternalFormat).blueBits;
+}
+
+GLuint Renderbuffer::getAlphaSize() const
+{
+    return GetInternalFormatInfo(mInternalFormat).alphaBits;
+}
+
+GLuint Renderbuffer::getDepthSize() const
+{
+    return GetInternalFormatInfo(mInternalFormat).depthBits;
+}
+
+GLuint Renderbuffer::getStencilSize() const
+{
+    return GetInternalFormatInfo(mInternalFormat).stencilBits;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLERenderbufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Renderbuffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+//
+// 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 renderer-agnostic container class gl::Renderbuffer.
+// Implements GL renderbuffer objects and related functionality.
+// [OpenGL ES 2.0.24] section 4.4.3 page 108.
+
+#ifndef LIBANGLE_RENDERBUFFER_H_
+#define LIBANGLE_RENDERBUFFER_H_
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/renderer/RenderbufferImpl.h&quot;
+
+namespace gl
+{
+// A GL renderbuffer object is usually used as a depth or stencil buffer attachment
+// for a framebuffer object. The renderbuffer itself is a distinct GL object, see
+// FramebufferAttachment and Framebuffer for how they are applied to an FBO via an
+// attachment point.
+
+class Renderbuffer : public FramebufferAttachmentObject
+{
+  public:
+    Renderbuffer(rx::RenderbufferImpl *impl, GLuint id);
+    virtual ~Renderbuffer();
+
+    Error setStorage(GLenum internalformat, size_t width, size_t height);
+    Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height);
+
+    rx::RenderbufferImpl *getImplementation();
+    const rx::RenderbufferImpl *getImplementation() const;
+
+    GLsizei getWidth() const;
+    GLsizei getHeight() const;
+    GLenum getInternalFormat() const;
+    GLsizei getSamples() const;
+    GLuint getRedSize() const;
+    GLuint getGreenSize() const;
+    GLuint getBlueSize() const;
+    GLuint getAlphaSize() const;
+    GLuint getDepthSize() const;
+    GLuint getStencilSize() const;
+
+    // FramebufferAttachmentObject Impl
+    GLsizei getAttachmentWidth(const FramebufferAttachment::Target &amp;/*target*/) const override { return getWidth(); }
+    GLsizei getAttachmentHeight(const FramebufferAttachment::Target &amp;/*target*/) const override { return getHeight(); }
+    GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &amp;/*target*/) const override { return getInternalFormat(); }
+    GLsizei getAttachmentSamples(const FramebufferAttachment::Target &amp;/*target*/) const override { return getSamples(); }
+
+  private:
+    rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mRenderbuffer; }
+
+    rx::RenderbufferImpl *mRenderbuffer;
+
+    GLsizei mWidth;
+    GLsizei mHeight;
+    GLenum mInternalFormat;
+    GLsizei mSamples;
+};
+
+}
+
+#endif   // LIBANGLE_RENDERBUFFER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEResourceManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,456 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// 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 &quot;libANGLE/ResourceManager.h&quot;
+
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/Shader.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/Sampler.h&quot;
+#include &quot;libANGLE/Fence.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+namespace gl
+{
+ResourceManager::ResourceManager(rx::ImplFactory *factory)
+    : mFactory(factory),
+      mRefCount(1)
+{
+}
+
+ResourceManager::~ResourceManager()
+{
+    while (!mBufferMap.empty())
+    {
+        deleteBuffer(mBufferMap.begin()-&gt;first);
+    }
+
+    while (!mProgramMap.empty())
+    {
+        deleteProgram(mProgramMap.begin()-&gt;first);
+    }
+
+    while (!mShaderMap.empty())
+    {
+        deleteShader(mShaderMap.begin()-&gt;first);
+    }
+
+    while (!mRenderbufferMap.empty())
+    {
+        deleteRenderbuffer(mRenderbufferMap.begin()-&gt;first);
+    }
+
+    while (!mTextureMap.empty())
+    {
+        deleteTexture(mTextureMap.begin()-&gt;first);
+    }
+
+    while (!mSamplerMap.empty())
+    {
+        deleteSampler(mSamplerMap.begin()-&gt;first);
+    }
+
+    while (!mFenceSyncMap.empty())
+    {
+        deleteFenceSync(mFenceSyncMap.begin()-&gt;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(const gl::Data &amp;data, GLenum type)
+{
+    GLuint handle = mProgramShaderHandleAllocator.allocate();
+
+    if (type == GL_VERTEX_SHADER || type == GL_FRAGMENT_SHADER)
+    {
+        mShaderMap[handle] = new Shader(this, mFactory-&gt;createShader(type), type, handle);
+    }
+    else UNREACHABLE();
+
+    return handle;
+}
+
+// Returns an unused program/shader name
+GLuint ResourceManager::createProgram()
+{
+    GLuint handle = mProgramShaderHandleAllocator.allocate();
+
+    mProgramMap[handle] = new Program(mFactory-&gt;createProgram(), 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;
+}
+
+// Returns an unused sampler name
+GLuint ResourceManager::createSampler()
+{
+    GLuint handle = mSamplerHandleAllocator.allocate();
+
+    mSamplerMap[handle] = NULL;
+
+    return handle;
+}
+
+// Returns the next unused fence name, and allocates the fence
+GLuint ResourceManager::createFenceSync()
+{
+    GLuint handle = mFenceSyncHandleAllocator.allocate();
+
+    FenceSync *fenceSync = new FenceSync(mFactory-&gt;createFenceSync(), handle);
+    fenceSync-&gt;addRef();
+    mFenceSyncMap[handle] = fenceSync;
+
+    return handle;
+}
+
+void ResourceManager::deleteBuffer(GLuint buffer)
+{
+    BufferMap::iterator bufferObject = mBufferMap.find(buffer);
+
+    if (bufferObject != mBufferMap.end())
+    {
+        mBufferHandleAllocator.release(bufferObject-&gt;first);
+        if (bufferObject-&gt;second) bufferObject-&gt;second-&gt;release();
+        mBufferMap.erase(bufferObject);
+    }
+}
+
+void ResourceManager::deleteShader(GLuint shader)
+{
+    ShaderMap::iterator shaderObject = mShaderMap.find(shader);
+
+    if (shaderObject != mShaderMap.end())
+    {
+        if (shaderObject-&gt;second-&gt;getRefCount() == 0)
+        {
+            mProgramShaderHandleAllocator.release(shaderObject-&gt;first);
+            delete shaderObject-&gt;second;
+            mShaderMap.erase(shaderObject);
+        }
+        else
+        {
+            shaderObject-&gt;second-&gt;flagForDeletion();
+        }
+    }
+}
+
+void ResourceManager::deleteProgram(GLuint program)
+{
+    ProgramMap::iterator programObject = mProgramMap.find(program);
+
+    if (programObject != mProgramMap.end())
+    {
+        if (programObject-&gt;second-&gt;getRefCount() == 0)
+        {
+            mProgramShaderHandleAllocator.release(programObject-&gt;first);
+            delete programObject-&gt;second;
+            mProgramMap.erase(programObject);
+        }
+        else
+        { 
+            programObject-&gt;second-&gt;flagForDeletion();
+        }
+    }
+}
+
+void ResourceManager::deleteTexture(GLuint texture)
+{
+    TextureMap::iterator textureObject = mTextureMap.find(texture);
+
+    if (textureObject != mTextureMap.end())
+    {
+        mTextureHandleAllocator.release(textureObject-&gt;first);
+        if (textureObject-&gt;second) textureObject-&gt;second-&gt;release();
+        mTextureMap.erase(textureObject);
+    }
+}
+
+void ResourceManager::deleteRenderbuffer(GLuint renderbuffer)
+{
+    RenderbufferMap::iterator renderbufferObject = mRenderbufferMap.find(renderbuffer);
+
+    if (renderbufferObject != mRenderbufferMap.end())
+    {
+        mRenderbufferHandleAllocator.release(renderbufferObject-&gt;first);
+        if (renderbufferObject-&gt;second) renderbufferObject-&gt;second-&gt;release();
+        mRenderbufferMap.erase(renderbufferObject);
+    }
+}
+
+void ResourceManager::deleteSampler(GLuint sampler)
+{
+    auto samplerObject = mSamplerMap.find(sampler);
+
+    if (samplerObject != mSamplerMap.end())
+    {
+        mSamplerHandleAllocator.release(samplerObject-&gt;first);
+        if (samplerObject-&gt;second) samplerObject-&gt;second-&gt;release();
+        mSamplerMap.erase(samplerObject);
+    }
+}
+
+void ResourceManager::deleteFenceSync(GLuint fenceSync)
+{
+    auto fenceObjectIt = mFenceSyncMap.find(fenceSync);
+
+    if (fenceObjectIt != mFenceSyncMap.end())
+    {
+        mFenceSyncHandleAllocator.release(fenceObjectIt-&gt;first);
+        if (fenceObjectIt-&gt;second) fenceObjectIt-&gt;second-&gt;release();
+        mFenceSyncMap.erase(fenceObjectIt);
+    }
+}
+
+Buffer *ResourceManager::getBuffer(unsigned int handle)
+{
+    BufferMap::iterator buffer = mBufferMap.find(handle);
+
+    if (buffer == mBufferMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return buffer-&gt;second;
+    }
+}
+
+Shader *ResourceManager::getShader(unsigned int handle)
+{
+    ShaderMap::iterator shader = mShaderMap.find(handle);
+
+    if (shader == mShaderMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return shader-&gt;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-&gt;second;
+    }
+}
+
+Program *ResourceManager::getProgram(unsigned int handle) const
+{
+    ProgramMap::const_iterator program = mProgramMap.find(handle);
+
+    if (program == mProgramMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return program-&gt;second;
+    }
+}
+
+Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
+{
+    RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle);
+
+    if (renderbuffer == mRenderbufferMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return renderbuffer-&gt;second;
+    }
+}
+
+Sampler *ResourceManager::getSampler(unsigned int handle)
+{
+    auto sampler = mSamplerMap.find(handle);
+
+    if (sampler == mSamplerMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return sampler-&gt;second;
+    }
+}
+
+FenceSync *ResourceManager::getFenceSync(unsigned int handle)
+{
+    auto fenceObjectIt = mFenceSyncMap.find(handle);
+
+    if (fenceObjectIt == mFenceSyncMap.end())
+    {
+        return NULL;
+    }
+    else
+    {
+        return fenceObjectIt-&gt;second;
+    }
+}
+
+void ResourceManager::setRenderbuffer(GLuint handle, Renderbuffer *buffer)
+{
+    mRenderbufferMap[handle] = buffer;
+}
+
+void ResourceManager::checkBufferAllocation(GLuint handle)
+{
+    if (handle != 0)
+    {
+        auto bufferMapIt = mBufferMap.find(handle);
+        bool handleAllocated = (bufferMapIt != mBufferMap.end());
+
+        if (handleAllocated &amp;&amp; bufferMapIt-&gt;second != nullptr)
+        {
+            return;
+        }
+
+        Buffer *buffer = new Buffer(mFactory-&gt;createBuffer(), handle);
+        buffer-&gt;addRef();
+
+        if (handleAllocated)
+        {
+            bufferMapIt-&gt;second = buffer;
+        }
+        else
+        {
+            mBufferHandleAllocator.reserve(handle);
+            mBufferMap[handle] = buffer;
+        }
+    }
+}
+
+void ResourceManager::checkTextureAllocation(GLuint handle, GLenum type)
+{
+    if (handle != 0)
+    {
+        auto textureMapIt = mTextureMap.find(handle);
+        bool handleAllocated = (textureMapIt != mTextureMap.end());
+
+        if (handleAllocated &amp;&amp; textureMapIt-&gt;second != nullptr)
+        {
+            return;
+        }
+
+        Texture *texture = new Texture(mFactory-&gt;createTexture(type), handle, type);
+        texture-&gt;addRef();
+
+        if (handleAllocated)
+        {
+            textureMapIt-&gt;second = texture;
+        }
+        else
+        {
+            mTextureHandleAllocator.reserve(handle);
+            mTextureMap[handle] = texture;
+        }
+    }
+}
+
+void ResourceManager::checkRenderbufferAllocation(GLuint handle)
+{
+    if (handle != 0)
+    {
+        auto renderbufferMapIt = mRenderbufferMap.find(handle);
+        bool handleAllocated = (renderbufferMapIt != mRenderbufferMap.end());
+
+        if (handleAllocated &amp;&amp; renderbufferMapIt-&gt;second != nullptr)
+        {
+            return;
+        }
+
+        Renderbuffer *renderbuffer = new Renderbuffer(mFactory-&gt;createRenderbuffer(), handle);
+        renderbuffer-&gt;addRef();
+
+        if (handleAllocated)
+        {
+            renderbufferMapIt-&gt;second = renderbuffer;
+        }
+        else
+        {
+            mRenderbufferHandleAllocator.reserve(handle);
+            mRenderbufferMap[handle] = renderbuffer;
+        }
+    }
+}
+
+void ResourceManager::checkSamplerAllocation(GLuint sampler)
+{
+    if (sampler != 0 &amp;&amp; !getSampler(sampler))
+    {
+        Sampler *samplerObject = new Sampler(sampler);
+        mSamplerMap[sampler] = samplerObject;
+        samplerObject-&gt;addRef();
+        // Samplers cannot be created via Bind
+    }
+}
+
+bool ResourceManager::isSampler(GLuint sampler)
+{
+    return mSamplerMap.find(sampler) != mSamplerMap.end();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEResourceManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// ResourceManager.h : Defines the ResourceManager class, which tracks objects
+// shared by multiple GL contexts.
+
+#ifndef LIBANGLE_RESOURCEMANAGER_H_
+#define LIBANGLE_RESOURCEMANAGER_H_
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/HandleAllocator.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+class ImplFactory;
+}
+
+namespace gl
+{
+class Buffer;
+class Shader;
+class Program;
+class Texture;
+class Renderbuffer;
+class Sampler;
+class FenceSync;
+struct Data;
+
+class ResourceManager : angle::NonCopyable
+{
+  public:
+    explicit ResourceManager(rx::ImplFactory *factory);
+    ~ResourceManager();
+
+    void addRef();
+    void release();
+
+    GLuint createBuffer();
+    GLuint createShader(const gl::Data &amp;data, GLenum type);
+    GLuint createProgram();
+    GLuint createTexture();
+    GLuint createRenderbuffer();
+    GLuint createSampler();
+    GLuint createFenceSync();
+
+    void deleteBuffer(GLuint buffer);
+    void deleteShader(GLuint shader);
+    void deleteProgram(GLuint program);
+    void deleteTexture(GLuint texture);
+    void deleteRenderbuffer(GLuint renderbuffer);
+    void deleteSampler(GLuint sampler);
+    void deleteFenceSync(GLuint fenceSync);
+
+    Buffer *getBuffer(GLuint handle);
+    Shader *getShader(GLuint handle);
+    Program *getProgram(GLuint handle) const;
+    Texture *getTexture(GLuint handle);
+    Renderbuffer *getRenderbuffer(GLuint handle);
+    Sampler *getSampler(GLuint handle);
+    FenceSync *getFenceSync(GLuint handle);
+
+    void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
+
+    void checkBufferAllocation(GLuint handle);
+    void checkTextureAllocation(GLuint handle, GLenum type);
+    void checkRenderbufferAllocation(GLuint handle);
+    void checkSamplerAllocation(GLuint sampler);
+
+    bool isSampler(GLuint sampler);
+
+  private:
+    void createTextureInternal(GLuint handle);
+
+    rx::ImplFactory *mFactory;
+    std::size_t mRefCount;
+
+    typedef std::map&lt;GLuint, Buffer*&gt; BufferMap;
+    BufferMap mBufferMap;
+    HandleAllocator mBufferHandleAllocator;
+
+    typedef std::map&lt;GLuint, Shader*&gt; ShaderMap;
+    ShaderMap mShaderMap;
+
+    typedef std::map&lt;GLuint, Program*&gt; ProgramMap;
+    ProgramMap mProgramMap;
+    HandleAllocator mProgramShaderHandleAllocator;
+
+    typedef std::map&lt;GLuint, Texture*&gt; TextureMap;
+    TextureMap mTextureMap;
+    HandleAllocator mTextureHandleAllocator;
+
+    typedef std::map&lt;GLuint, Renderbuffer*&gt; RenderbufferMap;
+    RenderbufferMap mRenderbufferMap;
+    HandleAllocator mRenderbufferHandleAllocator;
+
+    typedef std::map&lt;GLuint, Sampler*&gt; SamplerMap;
+    SamplerMap mSamplerMap;
+    HandleAllocator mSamplerHandleAllocator;
+
+    typedef std::map&lt;GLuint, FenceSync*&gt; FenceMap;
+    FenceMap mFenceSyncMap;
+    HandleAllocator mFenceSyncHandleAllocator;
+};
+
+}
+
+#endif // LIBANGLE_RESOURCEMANAGER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEResourceManager_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/ResourceManager_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// Unit tests for ResourceManager.
+//
+
+#include &lt;gmock/gmock.h&gt;
+#include &lt;gtest/gtest.h&gt;
+
+#include &quot;angle_unittests_utils.h&quot;
+#include &quot;libANGLE/ResourceManager.h&quot;
+
+using namespace rx;
+using namespace gl;
+
+namespace
+{
+
+class MockFactory : public NullFactory
+{
+  public:
+    MOCK_METHOD0(createBuffer, BufferImpl*());
+    MOCK_METHOD1(createTexture, TextureImpl*(GLenum));
+    MOCK_METHOD0(createRenderbuffer, RenderbufferImpl*());
+};
+
+class ResourceManagerTest : public testing::Test
+{
+  protected:
+    void SetUp() override
+    {
+        mResourceManager = new ResourceManager(&amp;mMockFactory);
+    }
+
+    void TearDown() override
+    {
+        SafeDelete(mResourceManager);
+    }
+
+    MockFactory mMockFactory;
+    ResourceManager *mResourceManager;
+};
+
+TEST_F(ResourceManagerTest, ReallocateBoundTexture)
+{
+    EXPECT_CALL(mMockFactory, createTexture(GL_TEXTURE_2D)).Times(1).RetiresOnSaturation();
+
+    mResourceManager-&gt;checkTextureAllocation(1, GL_TEXTURE_2D);
+    GLuint newTexture = mResourceManager-&gt;createTexture();
+    EXPECT_NE(1u, newTexture);
+}
+
+TEST_F(ResourceManagerTest, ReallocateBoundBuffer)
+{
+    EXPECT_CALL(mMockFactory, createBuffer()).Times(1).RetiresOnSaturation();
+
+    mResourceManager-&gt;checkBufferAllocation(1);
+    GLuint newBuffer = mResourceManager-&gt;createBuffer();
+    EXPECT_NE(1u, newBuffer);
+}
+
+TEST_F(ResourceManagerTest, ReallocateBoundRenderbuffer)
+{
+    EXPECT_CALL(mMockFactory, createRenderbuffer()).Times(1).RetiresOnSaturation();
+
+    mResourceManager-&gt;checkRenderbufferAllocation(1);
+    GLuint newRenderbuffer = mResourceManager-&gt;createRenderbuffer();
+    EXPECT_NE(1u, newRenderbuffer);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLESamplercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Sampler.cpp : Implements the Sampler class, which represents a GLES 3
+// sampler object. Sampler objects store some state needed to sample textures.
+
+#include &quot;libANGLE/Sampler.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+namespace gl
+{
+
+Sampler::Sampler(GLuint id)
+    : RefCountObject(id),
+      mMinFilter(GL_NEAREST_MIPMAP_LINEAR),
+      mMagFilter(GL_LINEAR),
+      mWrapS(GL_REPEAT),
+      mWrapT(GL_REPEAT),
+      mWrapR(GL_REPEAT),
+      mMinLod(-1000.0f),
+      mMaxLod(1000.0f),
+      mComparisonMode(GL_NONE),
+      mComparisonFunc(GL_LEQUAL)
+{
+}
+
+void Sampler::getState(SamplerState *samplerState) const
+{
+    samplerState-&gt;minFilter   = mMinFilter;
+    samplerState-&gt;magFilter   = mMagFilter;
+    samplerState-&gt;wrapS       = mWrapS;
+    samplerState-&gt;wrapT       = mWrapT;
+    samplerState-&gt;wrapR       = mWrapR;
+    samplerState-&gt;minLod      = mMinLod;
+    samplerState-&gt;maxLod      = mMaxLod;
+    samplerState-&gt;compareMode = mComparisonMode;
+    samplerState-&gt;compareFunc = mComparisonFunc;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLESamplerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Sampler.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Sampler.h : Defines the Sampler class, which represents a GLES 3
+// sampler object. Sampler objects store some state needed to sample textures.
+
+#ifndef LIBANGLE_SAMPLER_H_
+#define LIBANGLE_SAMPLER_H_
+
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+namespace gl
+{
+struct SamplerState;
+
+class Sampler : public RefCountObject
+{
+  public:
+    Sampler(GLuint id);
+
+    void setMinFilter(GLenum minFilter) { mMinFilter = minFilter; }
+    void setMagFilter(GLenum magFilter) { mMagFilter = magFilter; }
+    void setWrapS(GLenum wrapS) { mWrapS = wrapS; }
+    void setWrapT(GLenum wrapT) { mWrapT = wrapT; }
+    void setWrapR(GLenum wrapR) { mWrapR = wrapR; }
+    void setMinLod(GLfloat minLod) { mMinLod = minLod; }
+    void setMaxLod(GLfloat maxLod) { mMaxLod = maxLod; }
+    void setComparisonMode(GLenum comparisonMode) { mComparisonMode = comparisonMode; }
+    void setComparisonFunc(GLenum comparisonFunc) { mComparisonFunc = comparisonFunc; }
+
+    GLenum getMinFilter() const { return mMinFilter; }
+    GLenum getMagFilter() const { return mMagFilter; }
+    GLenum getWrapS() const { return mWrapS; }
+    GLenum getWrapT() const { return mWrapT; }
+    GLenum getWrapR() const { return mWrapR; }
+    GLfloat getMinLod() const { return mMinLod; }
+    GLfloat getMaxLod() const { return mMaxLod; }
+    GLenum getComparisonMode() const { return mComparisonMode; }
+    GLenum getComparisonFunc() const { return mComparisonFunc; }
+
+    void getState(SamplerState *samplerState) const;
+
+  private:
+    GLenum mMinFilter;
+    GLenum mMagFilter;
+    GLenum mWrapS;
+    GLenum mWrapT;
+    GLenum mWrapR;
+    GLfloat mMinLod;
+    GLfloat mMaxLod;
+    GLenum mComparisonMode;
+    GLenum mComparisonFunc;
+};
+
+}
+
+#endif // LIBANGLE_SAMPLER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEShadercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,243 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/Shader.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+#include &quot;libANGLE/renderer/ShaderImpl.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/ResourceManager.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+#include &quot;GLSLANG/ShaderLang.h&quot;
+
+#include &lt;sstream&gt;
+
+namespace gl
+{
+
+Shader::Shader(ResourceManager *manager, rx::ShaderImpl *impl, GLenum type, GLuint handle)
+    : mShader(impl),
+      mType(type),
+      mHandle(handle),
+      mResourceManager(manager),
+      mRefCount(0),
+      mDeleteStatus(false),
+      mCompiled(false)
+{
+    ASSERT(impl);
+}
+
+Shader::~Shader()
+{
+    SafeDelete(mShader);
+}
+
+GLuint Shader::getHandle() const
+{
+    return mHandle;
+}
+
+void Shader::setSource(GLsizei count, const char *const *string, const GLint *length)
+{
+    std::ostringstream stream;
+
+    for (int i = 0; i &lt; count; i++)
+    {
+        if (length == nullptr || length[i] &lt; 0)
+        {
+            stream.write(string[i], strlen(string[i]));
+        }
+        else
+        {
+            stream.write(string[i], length[i]);
+        }
+    }
+
+    mSource = stream.str();
+}
+
+int Shader::getInfoLogLength() const
+{
+    return  mShader-&gt;getInfoLog().empty() ? 0 : static_cast&lt;int&gt;(mShader-&gt;getInfoLog().length() + 1);
+}
+
+void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
+{
+    int index = 0;
+
+    if (bufSize &gt; 0)
+    {
+        index = std::min(bufSize - 1, static_cast&lt;GLsizei&gt;(mShader-&gt;getInfoLog().length()));
+        memcpy(infoLog, mShader-&gt;getInfoLog().c_str(), index);
+
+        infoLog[index] = '\0';
+    }
+
+    if (length)
+    {
+        *length = index;
+    }
+}
+
+int Shader::getSourceLength() const
+{
+    return mSource.empty() ? 0 : static_cast&lt;int&gt;(mSource.length() + 1);
+}
+
+int Shader::getTranslatedSourceLength() const
+{
+    return mShader-&gt;getTranslatedSource().empty() ? 0 : static_cast&lt;int&gt;(mShader-&gt;getTranslatedSource().length() + 1);
+}
+
+void Shader::getSourceImpl(const std::string &amp;source, GLsizei bufSize, GLsizei *length, char *buffer)
+{
+    int index = 0;
+
+    if (bufSize &gt; 0)
+    {
+        index = std::min(bufSize - 1, static_cast&lt;GLsizei&gt;(source.length()));
+        memcpy(buffer, source.c_str(), index);
+
+        buffer[index] = '\0';
+    }
+
+    if (length)
+    {
+        *length = index;
+    }
+}
+
+void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer) const
+{
+    getSourceImpl(mSource, bufSize, length, buffer);
+}
+
+void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const
+{
+    getSourceImpl(mShader-&gt;getTranslatedSource(), bufSize, length, buffer);
+}
+
+void Shader::getTranslatedSourceWithDebugInfo(GLsizei bufSize, GLsizei *length, char *buffer) const
+{
+    std::string debugInfo(mShader-&gt;getDebugInfo());
+    getSourceImpl(debugInfo, bufSize, length, buffer);
+}
+
+void Shader::compile(Compiler *compiler)
+{
+    mCompiled = mShader-&gt;compile(compiler, mSource);
+}
+
+void Shader::addRef()
+{
+    mRefCount++;
+}
+
+void Shader::release()
+{
+    mRefCount--;
+
+    if (mRefCount == 0 &amp;&amp; mDeleteStatus)
+    {
+        mResourceManager-&gt;deleteShader(mHandle);
+    }
+}
+
+unsigned int Shader::getRefCount() const
+{
+    return mRefCount;
+}
+
+bool Shader::isFlaggedForDeletion() const
+{
+    return mDeleteStatus;
+}
+
+void Shader::flagForDeletion()
+{
+    mDeleteStatus = true;
+}
+
+const std::vector&lt;gl::PackedVarying&gt; &amp;Shader::getVaryings() const
+{
+    return mShader-&gt;getVaryings();
+}
+
+const std::vector&lt;sh::Uniform&gt; &amp;Shader::getUniforms() const
+{
+    return mShader-&gt;getUniforms();
+}
+
+const std::vector&lt;sh::InterfaceBlock&gt; &amp;Shader::getInterfaceBlocks() const
+{
+    return mShader-&gt;getInterfaceBlocks();
+}
+
+const std::vector&lt;sh::Attribute&gt; &amp;Shader::getActiveAttributes() const
+{
+    return mShader-&gt;getActiveAttributes();
+}
+
+const std::vector&lt;sh::Attribute&gt; &amp;Shader::getActiveOutputVariables() const
+{
+    return mShader-&gt;getActiveOutputVariables();
+}
+
+std::vector&lt;gl::PackedVarying&gt; &amp;Shader::getVaryings()
+{
+    return mShader-&gt;getVaryings();
+}
+
+std::vector&lt;sh::Uniform&gt; &amp;Shader::getUniforms()
+{
+    return mShader-&gt;getUniforms();
+}
+
+std::vector&lt;sh::InterfaceBlock&gt; &amp;Shader::getInterfaceBlocks()
+{
+    return mShader-&gt;getInterfaceBlocks();
+}
+
+std::vector&lt;sh::Attribute&gt; &amp;Shader::getActiveAttributes()
+{
+    return mShader-&gt;getActiveAttributes();
+}
+
+std::vector&lt;sh::Attribute&gt; &amp;Shader::getActiveOutputVariables()
+{
+    return mShader-&gt;getActiveOutputVariables();
+}
+
+
+int Shader::getSemanticIndex(const std::string &amp;attributeName) const
+{
+    if (!attributeName.empty())
+    {
+        const auto &amp;activeAttributes = mShader-&gt;getActiveAttributes();
+
+        int semanticIndex = 0;
+        for (size_t attributeIndex = 0; attributeIndex &lt; activeAttributes.size(); attributeIndex++)
+        {
+            const sh::ShaderVariable &amp;attribute = activeAttributes[attributeIndex];
+
+            if (attribute.name == attributeName)
+            {
+                return semanticIndex;
+            }
+
+            semanticIndex += gl::VariableRegisterCount(attribute.type);
+        }
+    }
+
+    return -1;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEShaderh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Shader.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// 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 LIBANGLE_SHADER_H_
+#define LIBANGLE_SHADER_H_
+
+#include &lt;string&gt;
+#include &lt;list&gt;
+#include &lt;vector&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &lt;GLSLANG/ShaderLang.h&gt;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+namespace rx
+{
+class ShaderImpl;
+}
+
+namespace gl
+{
+class Compiler;
+class ResourceManager;
+struct Data;
+
+struct PackedVarying : public sh::Varying
+{
+    unsigned int registerIndex; // Assigned during link
+    unsigned int columnIndex; // Assigned during link, defaults to 0
+
+    PackedVarying(const sh::Varying &amp;varying)
+      : sh::Varying(varying),
+        registerIndex(GL_INVALID_INDEX),
+        columnIndex(0)
+    {}
+
+    bool registerAssigned() const { return registerIndex != GL_INVALID_INDEX; }
+
+    void resetRegisterAssignment()
+    {
+        registerIndex = GL_INVALID_INDEX;
+    }
+};
+
+class Shader : angle::NonCopyable
+{
+  public:
+    Shader(ResourceManager *manager, rx::ShaderImpl *impl, GLenum type, GLuint handle);
+
+    virtual ~Shader();
+
+    GLenum getType() const { return mType; }
+    GLuint getHandle() const;
+
+    rx::ShaderImpl *getImplementation() { return mShader; }
+    const rx::ShaderImpl *getImplementation() const { return mShader; }
+
+    void deleteSource();
+    void setSource(GLsizei count, const char *const *string, const GLint *length);
+    int getInfoLogLength() const;
+    void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const;
+    int getSourceLength() const;
+    void getSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
+    int getTranslatedSourceLength() const;
+    void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
+    void getTranslatedSourceWithDebugInfo(GLsizei bufSize, GLsizei *length, char *buffer) const;
+
+    void compile(Compiler *compiler);
+    bool isCompiled() const { return mCompiled; }
+
+    void addRef();
+    void release();
+    unsigned int getRefCount() const;
+    bool isFlaggedForDeletion() const;
+    void flagForDeletion();
+
+    const std::vector&lt;gl::PackedVarying&gt; &amp;getVaryings() const;
+    const std::vector&lt;sh::Uniform&gt; &amp;getUniforms() const;
+    const std::vector&lt;sh::InterfaceBlock&gt; &amp;getInterfaceBlocks() const;
+    const std::vector&lt;sh::Attribute&gt; &amp;getActiveAttributes() const;
+    const std::vector&lt;sh::Attribute&gt; &amp;getActiveOutputVariables() const;
+
+    std::vector&lt;gl::PackedVarying&gt; &amp;getVaryings();
+    std::vector&lt;sh::Uniform&gt; &amp;getUniforms();
+    std::vector&lt;sh::InterfaceBlock&gt; &amp;getInterfaceBlocks();
+    std::vector&lt;sh::Attribute&gt; &amp;getActiveAttributes();
+    std::vector&lt;sh::Attribute&gt; &amp;getActiveOutputVariables();
+
+    int getSemanticIndex(const std::string &amp;attributeName) const;
+
+  private:
+    static void getSourceImpl(const std::string &amp;source, GLsizei bufSize, GLsizei *length, char *buffer);
+
+    rx::ShaderImpl *mShader;
+    const GLuint mHandle;
+    const GLenum mType;
+    std::string mSource;
+    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
+    bool mCompiled;             // Indicates if this shader has been successfully compiled
+
+    ResourceManager *mResourceManager;
+};
+
+}
+
+#endif   // LIBANGLE_SHADER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEStatecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1441 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// State.cpp: Implements the State class, encapsulating raw GL state.
+
+#include &quot;libANGLE/State.h&quot;
+
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Query.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+
+namespace gl
+{
+
+State::State()
+{
+    mMaxDrawBuffers = 0;
+    mMaxCombinedTextureImageUnits = 0;
+}
+
+State::~State()
+{
+    reset();
+}
+
+void State::initialize(const Caps &amp;caps, GLuint clientVersion)
+{
+    mMaxDrawBuffers = caps.maxDrawBuffers;
+    mMaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
+
+    setColorClearValue(0.0f, 0.0f, 0.0f, 0.0f);
+
+    mDepthClearValue = 1.0f;
+    mStencilClearValue = 0;
+
+    mRasterizer.rasterizerDiscard = false;
+    mRasterizer.cullFace = false;
+    mRasterizer.cullMode = GL_BACK;
+    mRasterizer.frontFace = GL_CCW;
+    mRasterizer.polygonOffsetFill = false;
+    mRasterizer.polygonOffsetFactor = 0.0f;
+    mRasterizer.polygonOffsetUnits = 0.0f;
+    mRasterizer.pointDrawMode = false;
+    mRasterizer.multiSample = false;
+    mScissorTest = false;
+    mScissor.x = 0;
+    mScissor.y = 0;
+    mScissor.width = 0;
+    mScissor.height = 0;
+
+    mBlend.blend = false;
+    mBlend.sourceBlendRGB = GL_ONE;
+    mBlend.sourceBlendAlpha = GL_ONE;
+    mBlend.destBlendRGB = GL_ZERO;
+    mBlend.destBlendAlpha = GL_ZERO;
+    mBlend.blendEquationRGB = GL_FUNC_ADD;
+    mBlend.blendEquationAlpha = GL_FUNC_ADD;
+    mBlend.sampleAlphaToCoverage = false;
+    mBlend.dither = true;
+
+    mBlendColor.red = 0;
+    mBlendColor.green = 0;
+    mBlendColor.blue = 0;
+    mBlendColor.alpha = 0;
+
+    mDepthStencil.depthTest = false;
+    mDepthStencil.depthFunc = GL_LESS;
+    mDepthStencil.depthMask = true;
+    mDepthStencil.stencilTest = false;
+    mDepthStencil.stencilFunc = GL_ALWAYS;
+    mDepthStencil.stencilMask = static_cast&lt;GLuint&gt;(-1);
+    mDepthStencil.stencilWritemask = static_cast&lt;GLuint&gt;(-1);
+    mDepthStencil.stencilBackFunc = GL_ALWAYS;
+    mDepthStencil.stencilBackMask = static_cast&lt;GLuint&gt;(-1);
+    mDepthStencil.stencilBackWritemask = static_cast&lt;GLuint&gt;(-1);
+    mDepthStencil.stencilFail = GL_KEEP;
+    mDepthStencil.stencilPassDepthFail = GL_KEEP;
+    mDepthStencil.stencilPassDepthPass = GL_KEEP;
+    mDepthStencil.stencilBackFail = GL_KEEP;
+    mDepthStencil.stencilBackPassDepthFail = GL_KEEP;
+    mDepthStencil.stencilBackPassDepthPass = GL_KEEP;
+
+    mStencilRef = 0;
+    mStencilBackRef = 0;
+
+    mSampleCoverage = false;
+    mSampleCoverageValue = 1.0f;
+    mSampleCoverageInvert = false;
+    mGenerateMipmapHint = GL_DONT_CARE;
+    mFragmentShaderDerivativeHint = GL_DONT_CARE;
+
+    mLineWidth = 1.0f;
+
+    mViewport.x = 0;
+    mViewport.y = 0;
+    mViewport.width = 0;
+    mViewport.height = 0;
+    mNearZ = 0.0f;
+    mFarZ = 1.0f;
+
+    mBlend.colorMaskRed = true;
+    mBlend.colorMaskGreen = true;
+    mBlend.colorMaskBlue = true;
+    mBlend.colorMaskAlpha = true;
+
+    mActiveSampler = 0;
+
+    const GLfloat defaultFloatValues[] = { 0.0f, 0.0f, 0.0f, 1.0f };
+    mVertexAttribCurrentValues.resize(caps.maxVertexAttributes);
+    for (size_t attribIndex = 0; attribIndex &lt; mVertexAttribCurrentValues.size(); ++attribIndex)
+    {
+        mVertexAttribCurrentValues[attribIndex].setFloatValues(defaultFloatValues);
+    }
+
+    mUniformBuffers.resize(caps.maxCombinedUniformBlocks);
+
+    mSamplerTextures[GL_TEXTURE_2D].resize(caps.maxCombinedTextureImageUnits);
+    mSamplerTextures[GL_TEXTURE_CUBE_MAP].resize(caps.maxCombinedTextureImageUnits);
+    if (clientVersion &gt;= 3)
+    {
+        // TODO: These could also be enabled via extension
+        mSamplerTextures[GL_TEXTURE_2D_ARRAY].resize(caps.maxCombinedTextureImageUnits);
+        mSamplerTextures[GL_TEXTURE_3D].resize(caps.maxCombinedTextureImageUnits);
+    }
+
+    mSamplers.resize(caps.maxCombinedTextureImageUnits);
+
+    mActiveQueries[GL_ANY_SAMPLES_PASSED].set(NULL);
+    mActiveQueries[GL_ANY_SAMPLES_PASSED_CONSERVATIVE].set(NULL);
+    mActiveQueries[GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN].set(NULL);
+
+    mProgram = NULL;
+
+    mReadFramebuffer = NULL;
+    mDrawFramebuffer = NULL;
+
+    mPrimitiveRestart = false;
+}
+
+void State::reset()
+{
+    for (TextureBindingMap::iterator bindingVec = mSamplerTextures.begin(); bindingVec != mSamplerTextures.end(); bindingVec++)
+    {
+        TextureBindingVector &amp;textureVector = bindingVec-&gt;second;
+        for (size_t textureIdx = 0; textureIdx &lt; textureVector.size(); textureIdx++)
+        {
+            textureVector[textureIdx].set(NULL);
+        }
+    }
+    for (size_t samplerIdx = 0; samplerIdx &lt; mSamplers.size(); samplerIdx++)
+    {
+        mSamplers[samplerIdx].set(NULL);
+    }
+
+    mArrayBuffer.set(NULL);
+    mRenderbuffer.set(NULL);
+
+    if (mProgram)
+    {
+        mProgram-&gt;release();
+    }
+    mProgram = NULL;
+
+    mTransformFeedback.set(NULL);
+
+    for (State::ActiveQueryMap::iterator i = mActiveQueries.begin(); i != mActiveQueries.end(); i++)
+    {
+        i-&gt;second.set(NULL);
+    }
+
+    mGenericUniformBuffer.set(NULL);
+    for (BufferVector::iterator bufItr = mUniformBuffers.begin(); bufItr != mUniformBuffers.end(); ++bufItr)
+    {
+        bufItr-&gt;set(NULL);
+    }
+
+    mCopyReadBuffer.set(NULL);
+    mCopyWriteBuffer.set(NULL);
+
+    mPack.pixelBuffer.set(NULL);
+    mUnpack.pixelBuffer.set(NULL);
+
+    mProgram = NULL;
+}
+
+const RasterizerState &amp;State::getRasterizerState() const
+{
+    return mRasterizer;
+}
+
+const BlendState &amp;State::getBlendState() const
+{
+    return mBlend;
+}
+
+const DepthStencilState &amp;State::getDepthStencilState() const
+{
+    return mDepthStencil;
+}
+
+void State::setColorClearValue(float red, float green, float blue, float alpha)
+{
+    mColorClearValue.red = red;
+    mColorClearValue.green = green;
+    mColorClearValue.blue = blue;
+    mColorClearValue.alpha = alpha;
+}
+
+void State::setDepthClearValue(float depth)
+{
+    mDepthClearValue = depth;
+}
+
+void State::setStencilClearValue(int stencil)
+{
+    mStencilClearValue = stencil;
+}
+
+void State::setColorMask(bool red, bool green, bool blue, bool alpha)
+{
+    mBlend.colorMaskRed = red;
+    mBlend.colorMaskGreen = green;
+    mBlend.colorMaskBlue = blue;
+    mBlend.colorMaskAlpha = alpha;
+}
+
+void State::setDepthMask(bool mask)
+{
+    mDepthStencil.depthMask = mask;
+}
+
+bool State::isRasterizerDiscardEnabled() const
+{
+    return mRasterizer.rasterizerDiscard;
+}
+
+void State::setRasterizerDiscard(bool enabled)
+{
+    mRasterizer.rasterizerDiscard = enabled;
+}
+
+bool State::isCullFaceEnabled() const
+{
+    return mRasterizer.cullFace;
+}
+
+void State::setCullFace(bool enabled)
+{
+    mRasterizer.cullFace = enabled;
+}
+
+void State::setCullMode(GLenum mode)
+{
+    mRasterizer.cullMode = mode;
+}
+
+void State::setFrontFace(GLenum front)
+{
+    mRasterizer.frontFace = front;
+}
+
+bool State::isDepthTestEnabled() const
+{
+    return mDepthStencil.depthTest;
+}
+
+void State::setDepthTest(bool enabled)
+{
+    mDepthStencil.depthTest = enabled;
+}
+
+void State::setDepthFunc(GLenum depthFunc)
+{
+     mDepthStencil.depthFunc = depthFunc;
+}
+
+void State::setDepthRange(float zNear, float zFar)
+{
+    mNearZ = zNear;
+    mFarZ = zFar;
+}
+
+float State::getNearPlane() const
+{
+    return mNearZ;
+}
+
+float State::getFarPlane() const
+{
+    return mFarZ;
+}
+
+bool State::isBlendEnabled() const
+{
+    return mBlend.blend;
+}
+
+void State::setBlend(bool enabled)
+{
+    mBlend.blend = enabled;
+}
+
+void State::setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha)
+{
+    mBlend.sourceBlendRGB = sourceRGB;
+    mBlend.destBlendRGB = destRGB;
+    mBlend.sourceBlendAlpha = sourceAlpha;
+    mBlend.destBlendAlpha = destAlpha;
+}
+
+void State::setBlendColor(float red, float green, float blue, float alpha)
+{
+    mBlendColor.red = red;
+    mBlendColor.green = green;
+    mBlendColor.blue = blue;
+    mBlendColor.alpha = alpha;
+}
+
+void State::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation)
+{
+    mBlend.blendEquationRGB = rgbEquation;
+    mBlend.blendEquationAlpha = alphaEquation;
+}
+
+const ColorF &amp;State::getBlendColor() const
+{
+    return mBlendColor;
+}
+
+bool State::isStencilTestEnabled() const
+{
+    return mDepthStencil.stencilTest;
+}
+
+void State::setStencilTest(bool enabled)
+{
+    mDepthStencil.stencilTest = enabled;
+}
+
+void State::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask)
+{
+    mDepthStencil.stencilFunc = stencilFunc;
+    mStencilRef = (stencilRef &gt; 0) ? stencilRef : 0;
+    mDepthStencil.stencilMask = stencilMask;
+}
+
+void State::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask)
+{
+    mDepthStencil.stencilBackFunc = stencilBackFunc;
+    mStencilBackRef = (stencilBackRef &gt; 0) ? stencilBackRef : 0;
+    mDepthStencil.stencilBackMask = stencilBackMask;
+}
+
+void State::setStencilWritemask(GLuint stencilWritemask)
+{
+    mDepthStencil.stencilWritemask = stencilWritemask;
+}
+
+void State::setStencilBackWritemask(GLuint stencilBackWritemask)
+{
+    mDepthStencil.stencilBackWritemask = stencilBackWritemask;
+}
+
+void State::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass)
+{
+    mDepthStencil.stencilFail = stencilFail;
+    mDepthStencil.stencilPassDepthFail = stencilPassDepthFail;
+    mDepthStencil.stencilPassDepthPass = stencilPassDepthPass;
+}
+
+void State::setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass)
+{
+    mDepthStencil.stencilBackFail = stencilBackFail;
+    mDepthStencil.stencilBackPassDepthFail = stencilBackPassDepthFail;
+    mDepthStencil.stencilBackPassDepthPass = stencilBackPassDepthPass;
+}
+
+GLint State::getStencilRef() const
+{
+    return mStencilRef;
+}
+
+GLint State::getStencilBackRef() const
+{
+    return mStencilBackRef;
+}
+
+bool State::isPolygonOffsetFillEnabled() const
+{
+    return mRasterizer.polygonOffsetFill;
+}
+
+void State::setPolygonOffsetFill(bool enabled)
+{
+     mRasterizer.polygonOffsetFill = enabled;
+}
+
+void State::setPolygonOffsetParams(GLfloat factor, GLfloat units)
+{
+    // An application can pass NaN values here, so handle this gracefully
+    mRasterizer.polygonOffsetFactor = factor != factor ? 0.0f : factor;
+    mRasterizer.polygonOffsetUnits = units != units ? 0.0f : units;
+}
+
+bool State::isSampleAlphaToCoverageEnabled() const
+{
+    return mBlend.sampleAlphaToCoverage;
+}
+
+void State::setSampleAlphaToCoverage(bool enabled)
+{
+    mBlend.sampleAlphaToCoverage = enabled;
+}
+
+bool State::isSampleCoverageEnabled() const
+{
+    return mSampleCoverage;
+}
+
+void State::setSampleCoverage(bool enabled)
+{
+    mSampleCoverage = enabled;
+}
+
+void State::setSampleCoverageParams(GLclampf value, bool invert)
+{
+    mSampleCoverageValue = value;
+    mSampleCoverageInvert = invert;
+}
+
+GLclampf State::getSampleCoverageValue() const
+{
+    return mSampleCoverageValue;
+}
+
+bool State::getSampleCoverageInvert() const
+{
+    return mSampleCoverageInvert;
+}
+
+bool State::isScissorTestEnabled() const
+{
+    return mScissorTest;
+}
+
+void State::setScissorTest(bool enabled)
+{
+    mScissorTest = enabled;
+}
+
+void State::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    mScissor.x = x;
+    mScissor.y = y;
+    mScissor.width = width;
+    mScissor.height = height;
+}
+
+const Rectangle &amp;State::getScissor() const
+{
+    return mScissor;
+}
+
+bool State::isDitherEnabled() const
+{
+    return mBlend.dither;
+}
+
+void State::setDither(bool enabled)
+{
+    mBlend.dither = enabled;
+}
+
+bool State::isPrimitiveRestartEnabled() const
+{
+    return mPrimitiveRestart;
+}
+
+void State::setPrimitiveRestart(bool enabled)
+{
+    mPrimitiveRestart = enabled;
+}
+
+void State::setEnableFeature(GLenum feature, bool enabled)
+{
+    switch (feature)
+    {
+      case GL_CULL_FACE:                     setCullFace(enabled);              break;
+      case GL_POLYGON_OFFSET_FILL:           setPolygonOffsetFill(enabled);     break;
+      case GL_SAMPLE_ALPHA_TO_COVERAGE:      setSampleAlphaToCoverage(enabled); break;
+      case GL_SAMPLE_COVERAGE:               setSampleCoverage(enabled);        break;
+      case GL_SCISSOR_TEST:                  setScissorTest(enabled);           break;
+      case GL_STENCIL_TEST:                  setStencilTest(enabled);           break;
+      case GL_DEPTH_TEST:                    setDepthTest(enabled);             break;
+      case GL_BLEND:                         setBlend(enabled);                 break;
+      case GL_DITHER:                        setDither(enabled);                break;
+      case GL_PRIMITIVE_RESTART_FIXED_INDEX: setPrimitiveRestart(enabled);      break;
+      case GL_RASTERIZER_DISCARD:            setRasterizerDiscard(enabled);     break;
+      default:                               UNREACHABLE();
+    }
+}
+
+bool State::getEnableFeature(GLenum feature)
+{
+    switch (feature)
+    {
+      case GL_CULL_FACE:                     return isCullFaceEnabled();
+      case GL_POLYGON_OFFSET_FILL:           return isPolygonOffsetFillEnabled();
+      case GL_SAMPLE_ALPHA_TO_COVERAGE:      return isSampleAlphaToCoverageEnabled();
+      case GL_SAMPLE_COVERAGE:               return isSampleCoverageEnabled();
+      case GL_SCISSOR_TEST:                  return isScissorTestEnabled();
+      case GL_STENCIL_TEST:                  return isStencilTestEnabled();
+      case GL_DEPTH_TEST:                    return isDepthTestEnabled();
+      case GL_BLEND:                         return isBlendEnabled();
+      case GL_DITHER:                        return isDitherEnabled();
+      case GL_PRIMITIVE_RESTART_FIXED_INDEX: return isPrimitiveRestartEnabled();
+      case GL_RASTERIZER_DISCARD:            return isRasterizerDiscardEnabled();
+      default:                               UNREACHABLE(); return false;
+    }
+}
+
+void State::setLineWidth(GLfloat width)
+{
+    mLineWidth = width;
+}
+
+float State::getLineWidth() const
+{
+    return mLineWidth;
+}
+
+void State::setGenerateMipmapHint(GLenum hint)
+{
+    mGenerateMipmapHint = hint;
+}
+
+void State::setFragmentShaderDerivativeHint(GLenum hint)
+{
+    mFragmentShaderDerivativeHint = 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 State::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    mViewport.x = x;
+    mViewport.y = y;
+    mViewport.width = width;
+    mViewport.height = height;
+}
+
+const Rectangle &amp;State::getViewport() const
+{
+    return mViewport;
+}
+
+void State::setActiveSampler(unsigned int active)
+{
+    mActiveSampler = active;
+}
+
+unsigned int State::getActiveSampler() const
+{
+    return static_cast&lt;unsigned int&gt;(mActiveSampler);
+}
+
+void State::setSamplerTexture(GLenum type, Texture *texture)
+{
+    mSamplerTextures[type][mActiveSampler].set(texture);
+}
+
+Texture *State::getSamplerTexture(unsigned int sampler, GLenum type) const
+{
+    const auto it = mSamplerTextures.find(type);
+    ASSERT(it != mSamplerTextures.end());
+    return it-&gt;second[sampler].get();
+}
+
+GLuint State::getSamplerTextureId(unsigned int sampler, GLenum type) const
+{
+    const auto it = mSamplerTextures.find(type);
+    ASSERT(it != mSamplerTextures.end());
+    return it-&gt;second[sampler].id();
+}
+
+void State::detachTexture(const TextureMap &amp;zeroTextures, GLuint texture)
+{
+    // Textures have a detach method on State rather than a simple
+    // removeBinding, because the zero/null texture objects are managed
+    // separately, and don't have to go through the Context's maps or
+    // the ResourceManager.
+
+    // [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 (TextureBindingMap::iterator bindingVec = mSamplerTextures.begin(); bindingVec != mSamplerTextures.end(); bindingVec++)
+    {
+        GLenum textureType = bindingVec-&gt;first;
+        TextureBindingVector &amp;textureVector = bindingVec-&gt;second;
+        for (size_t textureIdx = 0; textureIdx &lt; textureVector.size(); textureIdx++)
+        {
+            BindingPointer&lt;Texture&gt; &amp;binding = textureVector[textureIdx];
+            if (binding.id() == texture)
+            {
+                auto it = zeroTextures.find(textureType);
+                ASSERT(it != zeroTextures.end());
+                // Zero textures are the &quot;default&quot; textures instead of NULL
+                binding.set(it-&gt;second.get());
+            }
+        }
+    }
+
+    // [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 Texture2DAttachment had been called, with a texture of 0, for each attachment point to which this
+    // image was attached in the currently bound framebuffer.
+
+    if (mReadFramebuffer)
+    {
+        mReadFramebuffer-&gt;detachTexture(texture);
+    }
+
+    if (mDrawFramebuffer)
+    {
+        mDrawFramebuffer-&gt;detachTexture(texture);
+    }
+}
+
+void State::initializeZeroTextures(const TextureMap &amp;zeroTextures)
+{
+    for (const auto &amp;zeroTexture : zeroTextures)
+    {
+        auto &amp;samplerTextureArray = mSamplerTextures[zeroTexture.first];
+
+        for (size_t textureUnit = 0; textureUnit &lt; samplerTextureArray.size(); ++textureUnit)
+        {
+            samplerTextureArray[textureUnit].set(zeroTexture.second.get());
+        }
+    }
+}
+
+void State::setSamplerBinding(GLuint textureUnit, Sampler *sampler)
+{
+    mSamplers[textureUnit].set(sampler);
+}
+
+GLuint State::getSamplerId(GLuint textureUnit) const
+{
+    ASSERT(textureUnit &lt; mSamplers.size());
+    return mSamplers[textureUnit].id();
+}
+
+Sampler *State::getSampler(GLuint textureUnit) const
+{
+    return mSamplers[textureUnit].get();
+}
+
+void State::detachSampler(GLuint sampler)
+{
+    // [OpenGL ES 3.0.2] section 3.8.2 pages 123-124:
+    // If a sampler object that is currently bound to one or more texture units is
+    // deleted, it is as though BindSampler is called once for each texture unit to
+    // which the sampler is bound, with unit set to the texture unit and sampler set to zero.
+    for (size_t textureUnit = 0; textureUnit &lt; mSamplers.size(); textureUnit++)
+    {
+        BindingPointer&lt;Sampler&gt; &amp;samplerBinding = mSamplers[textureUnit];
+        if (samplerBinding.id() == sampler)
+        {
+            samplerBinding.set(NULL);
+        }
+    }
+}
+
+void State::setRenderbufferBinding(Renderbuffer *renderbuffer)
+{
+    mRenderbuffer.set(renderbuffer);
+}
+
+GLuint State::getRenderbufferId() const
+{
+    return mRenderbuffer.id();
+}
+
+Renderbuffer *State::getCurrentRenderbuffer()
+{
+    return mRenderbuffer.get();
+}
+
+void State::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 (mRenderbuffer.id() == renderbuffer)
+    {
+        mRenderbuffer.set(NULL);
+    }
+
+    // [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 = mReadFramebuffer;
+    Framebuffer *drawFramebuffer = mDrawFramebuffer;
+
+    if (readFramebuffer)
+    {
+        readFramebuffer-&gt;detachRenderbuffer(renderbuffer);
+    }
+
+    if (drawFramebuffer &amp;&amp; drawFramebuffer != readFramebuffer)
+    {
+        drawFramebuffer-&gt;detachRenderbuffer(renderbuffer);
+    }
+
+}
+
+void State::setReadFramebufferBinding(Framebuffer *framebuffer)
+{
+    mReadFramebuffer = framebuffer;
+}
+
+void State::setDrawFramebufferBinding(Framebuffer *framebuffer)
+{
+    mDrawFramebuffer = framebuffer;
+}
+
+Framebuffer *State::getTargetFramebuffer(GLenum target) const
+{
+    switch (target)
+    {
+    case GL_READ_FRAMEBUFFER_ANGLE:  return mReadFramebuffer;
+    case GL_DRAW_FRAMEBUFFER_ANGLE:
+    case GL_FRAMEBUFFER:             return mDrawFramebuffer;
+    default:                         UNREACHABLE(); return NULL;
+    }
+}
+
+Framebuffer *State::getReadFramebuffer()
+{
+    return mReadFramebuffer;
+}
+
+Framebuffer *State::getDrawFramebuffer()
+{
+    return mDrawFramebuffer;
+}
+
+const Framebuffer *State::getReadFramebuffer() const
+{
+    return mReadFramebuffer;
+}
+
+const Framebuffer *State::getDrawFramebuffer() const
+{
+    return mDrawFramebuffer;
+}
+
+bool State::removeReadFramebufferBinding(GLuint framebuffer)
+{
+    if (mReadFramebuffer != nullptr &amp;&amp;
+        mReadFramebuffer-&gt;id() == framebuffer)
+    {
+        mReadFramebuffer = NULL;
+        return true;
+    }
+
+    return false;
+}
+
+bool State::removeDrawFramebufferBinding(GLuint framebuffer)
+{
+    if (mReadFramebuffer != nullptr &amp;&amp;
+        mDrawFramebuffer-&gt;id() == framebuffer)
+    {
+        mDrawFramebuffer = NULL;
+        return true;
+    }
+
+    return false;
+}
+
+void State::setVertexArrayBinding(VertexArray *vertexArray)
+{
+    mVertexArray = vertexArray;
+}
+
+GLuint State::getVertexArrayId() const
+{
+    ASSERT(mVertexArray != NULL);
+    return mVertexArray-&gt;id();
+}
+
+VertexArray *State::getVertexArray() const
+{
+    ASSERT(mVertexArray != NULL);
+    return mVertexArray;
+}
+
+bool State::removeVertexArrayBinding(GLuint vertexArray)
+{
+    if (mVertexArray-&gt;id() == vertexArray)
+    {
+        mVertexArray = NULL;
+        return true;
+    }
+
+    return false;
+}
+
+void State::setProgram(Program *newProgram)
+{
+    if (mProgram != newProgram)
+    {
+        if (mProgram)
+        {
+            mProgram-&gt;release();
+        }
+
+        mProgram = newProgram;
+
+        if (mProgram)
+        {
+            newProgram-&gt;addRef();
+        }
+    }
+}
+
+Program *State::getProgram() const
+{
+    return mProgram;
+}
+
+void State::setTransformFeedbackBinding(TransformFeedback *transformFeedback)
+{
+    mTransformFeedback.set(transformFeedback);
+}
+
+TransformFeedback *State::getCurrentTransformFeedback() const
+{
+    return mTransformFeedback.get();
+}
+
+bool State::isTransformFeedbackActiveUnpaused() const
+{
+    gl::TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
+    return curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isActive() &amp;&amp; !curTransformFeedback-&gt;isPaused();
+}
+
+void State::detachTransformFeedback(GLuint transformFeedback)
+{
+    if (mTransformFeedback.id() == transformFeedback)
+    {
+        mTransformFeedback.set(NULL);
+    }
+}
+
+bool State::isQueryActive() const
+{
+    for (State::ActiveQueryMap::const_iterator i = mActiveQueries.begin();
+        i != mActiveQueries.end(); i++)
+    {
+        if (i-&gt;second.get() != NULL)
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+void State::setActiveQuery(GLenum target, Query *query)
+{
+    mActiveQueries[target].set(query);
+}
+
+GLuint State::getActiveQueryId(GLenum target) const
+{
+    const Query *query = getActiveQuery(target);
+    return (query ? query-&gt;id() : 0u);
+}
+
+Query *State::getActiveQuery(GLenum target) const
+{
+    const auto it = mActiveQueries.find(target);
+
+    // All query types should already exist in the activeQueries map
+    ASSERT(it != mActiveQueries.end());
+
+    return it-&gt;second.get();
+}
+
+void State::setArrayBufferBinding(Buffer *buffer)
+{
+    mArrayBuffer.set(buffer);
+}
+
+GLuint State::getArrayBufferId() const
+{
+    return mArrayBuffer.id();
+}
+
+bool State::removeArrayBufferBinding(GLuint buffer)
+{
+    if (mArrayBuffer.id() == buffer)
+    {
+        mArrayBuffer.set(NULL);
+        return true;
+    }
+
+    return false;
+}
+
+void State::setGenericUniformBufferBinding(Buffer *buffer)
+{
+    mGenericUniformBuffer.set(buffer);
+}
+
+void State::setIndexedUniformBufferBinding(GLuint index, Buffer *buffer, GLintptr offset, GLsizeiptr size)
+{
+    mUniformBuffers[index].set(buffer, offset, size);
+}
+
+GLuint State::getIndexedUniformBufferId(GLuint index) const
+{
+    ASSERT(static_cast&lt;size_t&gt;(index) &lt; mUniformBuffers.size());
+
+    return mUniformBuffers[index].id();
+}
+
+Buffer *State::getIndexedUniformBuffer(GLuint index) const
+{
+    ASSERT(static_cast&lt;size_t&gt;(index) &lt; mUniformBuffers.size());
+
+    return mUniformBuffers[index].get();
+}
+
+GLintptr State::getIndexedUniformBufferOffset(GLuint index) const
+{
+    ASSERT(static_cast&lt;size_t&gt;(index) &lt; mUniformBuffers.size());
+
+    return mUniformBuffers[index].getOffset();
+}
+
+GLsizeiptr State::getIndexedUniformBufferSize(GLuint index) const
+{
+    ASSERT(static_cast&lt;size_t&gt;(index) &lt; mUniformBuffers.size());
+
+    return mUniformBuffers[index].getSize();
+}
+
+void State::setCopyReadBufferBinding(Buffer *buffer)
+{
+    mCopyReadBuffer.set(buffer);
+}
+
+void State::setCopyWriteBufferBinding(Buffer *buffer)
+{
+    mCopyWriteBuffer.set(buffer);
+}
+
+void State::setPixelPackBufferBinding(Buffer *buffer)
+{
+    mPack.pixelBuffer.set(buffer);
+}
+
+void State::setPixelUnpackBufferBinding(Buffer *buffer)
+{
+    mUnpack.pixelBuffer.set(buffer);
+}
+
+Buffer *State::getTargetBuffer(GLenum target) const
+{
+    switch (target)
+    {
+      case GL_ARRAY_BUFFER:              return mArrayBuffer.get();
+      case GL_COPY_READ_BUFFER:          return mCopyReadBuffer.get();
+      case GL_COPY_WRITE_BUFFER:         return mCopyWriteBuffer.get();
+      case GL_ELEMENT_ARRAY_BUFFER:      return getVertexArray()-&gt;getElementArrayBuffer();
+      case GL_PIXEL_PACK_BUFFER:         return mPack.pixelBuffer.get();
+      case GL_PIXEL_UNPACK_BUFFER:       return mUnpack.pixelBuffer.get();
+      case GL_TRANSFORM_FEEDBACK_BUFFER: return mTransformFeedback-&gt;getGenericBuffer().get();
+      case GL_UNIFORM_BUFFER:            return mGenericUniformBuffer.get();
+      default: UNREACHABLE();            return NULL;
+    }
+}
+
+void State::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
+{
+    getVertexArray()-&gt;enableAttribute(attribNum, enabled);
+}
+
+void State::setVertexAttribf(GLuint index, const GLfloat values[4])
+{
+    ASSERT(static_cast&lt;size_t&gt;(index) &lt; mVertexAttribCurrentValues.size());
+    mVertexAttribCurrentValues[index].setFloatValues(values);
+}
+
+void State::setVertexAttribu(GLuint index, const GLuint values[4])
+{
+    ASSERT(static_cast&lt;size_t&gt;(index) &lt; mVertexAttribCurrentValues.size());
+    mVertexAttribCurrentValues[index].setUnsignedIntValues(values);
+}
+
+void State::setVertexAttribi(GLuint index, const GLint values[4])
+{
+    ASSERT(static_cast&lt;size_t&gt;(index) &lt; mVertexAttribCurrentValues.size());
+    mVertexAttribCurrentValues[index].setIntValues(values);
+}
+
+void State::setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
+    bool pureInteger, GLsizei stride, const void *pointer)
+{
+    getVertexArray()-&gt;setAttributeState(attribNum, boundBuffer, size, type, normalized, pureInteger, stride, pointer);
+}
+
+const VertexAttribCurrentValueData &amp;State::getVertexAttribCurrentValue(unsigned int attribNum) const
+{
+    ASSERT(static_cast&lt;size_t&gt;(attribNum) &lt; mVertexAttribCurrentValues.size());
+    return mVertexAttribCurrentValues[attribNum];
+}
+
+const void *State::getVertexAttribPointer(unsigned int attribNum) const
+{
+    return getVertexArray()-&gt;getVertexAttribute(attribNum).pointer;
+}
+
+void State::setPackAlignment(GLint alignment)
+{
+    mPack.alignment = alignment;
+}
+
+GLint State::getPackAlignment() const
+{
+    return mPack.alignment;
+}
+
+void State::setPackReverseRowOrder(bool reverseRowOrder)
+{
+    mPack.reverseRowOrder = reverseRowOrder;
+}
+
+bool State::getPackReverseRowOrder() const
+{
+    return mPack.reverseRowOrder;
+}
+
+const PixelPackState &amp;State::getPackState() const
+{
+    return mPack;
+}
+
+PixelPackState &amp;State::getPackState()
+{
+    return mPack;
+}
+
+void State::setUnpackAlignment(GLint alignment)
+{
+    mUnpack.alignment = alignment;
+}
+
+GLint State::getUnpackAlignment() const
+{
+    return mUnpack.alignment;
+}
+
+void State::setUnpackRowLength(GLint rowLength)
+{
+    mUnpack.rowLength = rowLength;
+}
+
+GLint State::getUnpackRowLength() const
+{
+    return mUnpack.rowLength;
+}
+
+const PixelUnpackState &amp;State::getUnpackState() const
+{
+    return mUnpack;
+}
+
+PixelUnpackState &amp;State::getUnpackState()
+{
+    return mUnpack;
+}
+
+void State::getBooleanv(GLenum pname, GLboolean *params)
+{
+    switch (pname)
+    {
+      case GL_SAMPLE_COVERAGE_INVERT:    *params = mSampleCoverageInvert;         break;
+      case GL_DEPTH_WRITEMASK:           *params = mDepthStencil.depthMask;       break;
+      case GL_COLOR_WRITEMASK:
+        params[0] = mBlend.colorMaskRed;
+        params[1] = mBlend.colorMaskGreen;
+        params[2] = mBlend.colorMaskBlue;
+        params[3] = mBlend.colorMaskAlpha;
+        break;
+      case GL_CULL_FACE:                 *params = mRasterizer.cullFace;          break;
+      case GL_POLYGON_OFFSET_FILL:       *params = mRasterizer.polygonOffsetFill; break;
+      case GL_SAMPLE_ALPHA_TO_COVERAGE:  *params = mBlend.sampleAlphaToCoverage;  break;
+      case GL_SAMPLE_COVERAGE:           *params = mSampleCoverage;               break;
+      case GL_SCISSOR_TEST:              *params = mScissorTest;                  break;
+      case GL_STENCIL_TEST:              *params = mDepthStencil.stencilTest;     break;
+      case GL_DEPTH_TEST:                *params = mDepthStencil.depthTest;       break;
+      case GL_BLEND:                     *params = mBlend.blend;                  break;
+      case GL_DITHER:                    *params = mBlend.dither;                 break;
+      case GL_TRANSFORM_FEEDBACK_ACTIVE: *params = getCurrentTransformFeedback()-&gt;isActive() ? GL_TRUE : GL_FALSE; break;
+      case GL_TRANSFORM_FEEDBACK_PAUSED: *params = getCurrentTransformFeedback()-&gt;isPaused() ? GL_TRUE : GL_FALSE; break;
+      default:
+        UNREACHABLE();
+        break;
+    }
+}
+
+void State::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 = mLineWidth;                         break;
+      case GL_SAMPLE_COVERAGE_VALUE:    *params = mSampleCoverageValue;               break;
+      case GL_DEPTH_CLEAR_VALUE:        *params = mDepthClearValue;                   break;
+      case GL_POLYGON_OFFSET_FACTOR:    *params = mRasterizer.polygonOffsetFactor;    break;
+      case GL_POLYGON_OFFSET_UNITS:     *params = mRasterizer.polygonOffsetUnits;     break;
+      case GL_DEPTH_RANGE:
+        params[0] = mNearZ;
+        params[1] = mFarZ;
+        break;
+      case GL_COLOR_CLEAR_VALUE:
+        params[0] = mColorClearValue.red;
+        params[1] = mColorClearValue.green;
+        params[2] = mColorClearValue.blue;
+        params[3] = mColorClearValue.alpha;
+        break;
+      case GL_BLEND_COLOR:
+        params[0] = mBlendColor.red;
+        params[1] = mBlendColor.green;
+        params[2] = mBlendColor.blue;
+        params[3] = mBlendColor.alpha;
+        break;
+      default:
+        UNREACHABLE();
+        break;
+    }
+}
+
+void State::getIntegerv(const gl::Data &amp;data, GLenum pname, GLint *params)
+{
+    if (pname &gt;= GL_DRAW_BUFFER0_EXT &amp;&amp; pname &lt;= GL_DRAW_BUFFER15_EXT)
+    {
+        unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0_EXT);
+        ASSERT(colorAttachment &lt; mMaxDrawBuffers);
+        Framebuffer *framebuffer = mDrawFramebuffer;
+        *params = framebuffer-&gt;getDrawBufferState(colorAttachment);
+        return;
+    }
+
+    // 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
+    // State::getFloatv.
+    switch (pname)
+    {
+      case GL_ARRAY_BUFFER_BINDING:                     *params = mArrayBuffer.id();                              break;
+      case GL_ELEMENT_ARRAY_BUFFER_BINDING:             *params = getVertexArray()-&gt;getElementArrayBufferId();    break;
+        //case GL_FRAMEBUFFER_BINDING:                    // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
+      case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE:           *params = mDrawFramebuffer-&gt;id();                         break;
+      case GL_READ_FRAMEBUFFER_BINDING_ANGLE:           *params = mReadFramebuffer-&gt;id();                         break;
+      case GL_RENDERBUFFER_BINDING:                     *params = mRenderbuffer.id();                             break;
+      case GL_VERTEX_ARRAY_BINDING:                     *params = mVertexArray-&gt;id();                             break;
+      case GL_CURRENT_PROGRAM:                          *params = mProgram ? mProgram-&gt;id() : 0;                  break;
+      case GL_PACK_ALIGNMENT:                           *params = mPack.alignment;                                break;
+      case GL_PACK_REVERSE_ROW_ORDER_ANGLE:             *params = mPack.reverseRowOrder;                          break;
+      case GL_UNPACK_ALIGNMENT:                         *params = mUnpack.alignment;                              break;
+      case GL_UNPACK_ROW_LENGTH:                        *params = mUnpack.rowLength;                              break;
+      case GL_GENERATE_MIPMAP_HINT:                     *params = mGenerateMipmapHint;                            break;
+      case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:      *params = mFragmentShaderDerivativeHint;                  break;
+      case GL_ACTIVE_TEXTURE:                           *params = static_cast&lt;GLint&gt;(mActiveSampler + GL_TEXTURE0);     break;
+      case GL_STENCIL_FUNC:                             *params = mDepthStencil.stencilFunc;                      break;
+      case GL_STENCIL_REF:                              *params = mStencilRef;                                    break;
+      case GL_STENCIL_VALUE_MASK:                       *params = clampToInt(mDepthStencil.stencilMask);          break;
+      case GL_STENCIL_BACK_FUNC:                        *params = mDepthStencil.stencilBackFunc;                  break;
+      case GL_STENCIL_BACK_REF:                         *params = mStencilBackRef;                                break;
+      case GL_STENCIL_BACK_VALUE_MASK:                  *params = clampToInt(mDepthStencil.stencilBackMask);      break;
+      case GL_STENCIL_FAIL:                             *params = mDepthStencil.stencilFail;                      break;
+      case GL_STENCIL_PASS_DEPTH_FAIL:                  *params = mDepthStencil.stencilPassDepthFail;             break;
+      case GL_STENCIL_PASS_DEPTH_PASS:                  *params = mDepthStencil.stencilPassDepthPass;             break;
+      case GL_STENCIL_BACK_FAIL:                        *params = mDepthStencil.stencilBackFail;                  break;
+      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:             *params = mDepthStencil.stencilBackPassDepthFail;         break;
+      case GL_STENCIL_BACK_PASS_DEPTH_PASS:             *params = mDepthStencil.stencilBackPassDepthPass;         break;
+      case GL_DEPTH_FUNC:                               *params = mDepthStencil.depthFunc;                        break;
+      case GL_BLEND_SRC_RGB:                            *params = mBlend.sourceBlendRGB;                          break;
+      case GL_BLEND_SRC_ALPHA:                          *params = mBlend.sourceBlendAlpha;                        break;
+      case GL_BLEND_DST_RGB:                            *params = mBlend.destBlendRGB;                            break;
+      case GL_BLEND_DST_ALPHA:                          *params = mBlend.destBlendAlpha;                          break;
+      case GL_BLEND_EQUATION_RGB:                       *params = mBlend.blendEquationRGB;                        break;
+      case GL_BLEND_EQUATION_ALPHA:                     *params = mBlend.blendEquationAlpha;                      break;
+      case GL_STENCIL_WRITEMASK:                        *params = clampToInt(mDepthStencil.stencilWritemask);     break;
+      case GL_STENCIL_BACK_WRITEMASK:                   *params = clampToInt(mDepthStencil.stencilBackWritemask); break;
+      case GL_STENCIL_CLEAR_VALUE:                      *params = mStencilClearValue;                             break;
+      case GL_IMPLEMENTATION_COLOR_READ_TYPE:           *params = mReadFramebuffer-&gt;getImplementationColorReadType();   break;
+      case GL_IMPLEMENTATION_COLOR_READ_FORMAT:         *params = mReadFramebuffer-&gt;getImplementationColorReadFormat(); break;
+      case GL_SAMPLE_BUFFERS:
+      case GL_SAMPLES:
+        {
+            gl::Framebuffer *framebuffer = mDrawFramebuffer;
+            if (framebuffer-&gt;checkStatus(data) == GL_FRAMEBUFFER_COMPLETE)
+            {
+                switch (pname)
+                {
+                  case GL_SAMPLE_BUFFERS:
+                    if (framebuffer-&gt;getSamples(data) != 0)
+                    {
+                        *params = 1;
+                    }
+                    else
+                    {
+                        *params = 0;
+                    }
+                    break;
+                  case GL_SAMPLES:
+                    *params = framebuffer-&gt;getSamples(data);
+                    break;
+                }
+            }
+            else
+            {
+                *params = 0;
+            }
+        }
+        break;
+      case GL_VIEWPORT:
+        params[0] = mViewport.x;
+        params[1] = mViewport.y;
+        params[2] = mViewport.width;
+        params[3] = mViewport.height;
+        break;
+      case GL_SCISSOR_BOX:
+        params[0] = mScissor.x;
+        params[1] = mScissor.y;
+        params[2] = mScissor.width;
+        params[3] = mScissor.height;
+        break;
+      case GL_CULL_FACE_MODE:                   *params = mRasterizer.cullMode;   break;
+      case GL_FRONT_FACE:                       *params = mRasterizer.frontFace;  break;
+      case GL_RED_BITS:
+      case GL_GREEN_BITS:
+      case GL_BLUE_BITS:
+      case GL_ALPHA_BITS:
+        {
+            gl::Framebuffer *framebuffer = getDrawFramebuffer();
+            const gl::FramebufferAttachment *colorbuffer = framebuffer-&gt;getFirstColorbuffer();
+
+            if (colorbuffer)
+            {
+                switch (pname)
+                {
+                case GL_RED_BITS:   *params = colorbuffer-&gt;getRedSize();      break;
+                case GL_GREEN_BITS: *params = colorbuffer-&gt;getGreenSize();    break;
+                case GL_BLUE_BITS:  *params = colorbuffer-&gt;getBlueSize();     break;
+                case GL_ALPHA_BITS: *params = colorbuffer-&gt;getAlphaSize();    break;
+                }
+            }
+            else
+            {
+                *params = 0;
+            }
+        }
+        break;
+      case GL_DEPTH_BITS:
+        {
+            const gl::Framebuffer *framebuffer = getDrawFramebuffer();
+            const gl::FramebufferAttachment *depthbuffer = framebuffer-&gt;getDepthbuffer();
+
+            if (depthbuffer)
+            {
+                *params = depthbuffer-&gt;getDepthSize();
+            }
+            else
+            {
+                *params = 0;
+            }
+        }
+        break;
+      case GL_STENCIL_BITS:
+        {
+            const gl::Framebuffer *framebuffer = getDrawFramebuffer();
+            const gl::FramebufferAttachment *stencilbuffer = framebuffer-&gt;getStencilbuffer();
+
+            if (stencilbuffer)
+            {
+                *params = stencilbuffer-&gt;getStencilSize();
+            }
+            else
+            {
+                *params = 0;
+            }
+        }
+        break;
+      case GL_TEXTURE_BINDING_2D:
+        ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_2D) ;
+        break;
+      case GL_TEXTURE_BINDING_CUBE_MAP:
+        ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_CUBE_MAP);
+        break;
+      case GL_TEXTURE_BINDING_3D:
+        ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_3D);
+        break;
+      case GL_TEXTURE_BINDING_2D_ARRAY:
+        ASSERT(mActiveSampler &lt; mMaxCombinedTextureImageUnits);
+        *params = getSamplerTextureId(static_cast&lt;unsigned int&gt;(mActiveSampler), GL_TEXTURE_2D_ARRAY);
+        break;
+      case GL_UNIFORM_BUFFER_BINDING:
+        *params = mGenericUniformBuffer.id();
+        break;
+      case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+        *params = mTransformFeedback-&gt;getGenericBuffer().id();
+        break;
+      case GL_COPY_READ_BUFFER_BINDING:
+        *params = mCopyReadBuffer.id();
+        break;
+      case GL_COPY_WRITE_BUFFER_BINDING:
+        *params = mCopyWriteBuffer.id();
+        break;
+      case GL_PIXEL_PACK_BUFFER_BINDING:
+        *params = mPack.pixelBuffer.id();
+        break;
+      case GL_PIXEL_UNPACK_BUFFER_BINDING:
+        *params = mUnpack.pixelBuffer.id();
+        break;
+      default:
+        UNREACHABLE();
+        break;
+    }
+}
+
+bool State::getIndexedIntegerv(GLenum target, GLuint index, GLint *data)
+{
+    switch (target)
+    {
+      case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+        if (static_cast&lt;size_t&gt;(index) &lt; mTransformFeedback-&gt;getIndexedBufferCount())
+        {
+            *data = mTransformFeedback-&gt;getIndexedBuffer(index).id();
+        }
+        break;
+      case GL_UNIFORM_BUFFER_BINDING:
+        if (static_cast&lt;size_t&gt;(index) &lt; mUniformBuffers.size())
+        {
+            *data = mUniformBuffers[index].id();
+        }
+        break;
+      default:
+        return false;
+    }
+
+    return true;
+}
+
+bool State::getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data)
+{
+    switch (target)
+    {
+      case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+        if (static_cast&lt;size_t&gt;(index) &lt; mTransformFeedback-&gt;getIndexedBufferCount())
+        {
+            *data = mTransformFeedback-&gt;getIndexedBuffer(index).getOffset();
+        }
+        break;
+      case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+        if (static_cast&lt;size_t&gt;(index) &lt; mTransformFeedback-&gt;getIndexedBufferCount())
+        {
+            *data = mTransformFeedback-&gt;getIndexedBuffer(index).getSize();
+        }
+        break;
+      case GL_UNIFORM_BUFFER_START:
+        if (static_cast&lt;size_t&gt;(index) &lt; mUniformBuffers.size())
+        {
+            *data = mUniformBuffers[index].getOffset();
+        }
+        break;
+      case GL_UNIFORM_BUFFER_SIZE:
+        if (static_cast&lt;size_t&gt;(index) &lt; mUniformBuffers.size())
+        {
+            *data = mUniformBuffers[index].getSize();
+        }
+        break;
+      default:
+        return false;
+    }
+
+    return true;
+}
+
+bool State::hasMappedBuffer(GLenum target) const
+{
+    if (target == GL_ARRAY_BUFFER)
+    {
+        const VertexArray *vao = getVertexArray();
+        const auto &amp;vertexAttribs = vao-&gt;getVertexAttributes();
+        unsigned int maxEnabledAttrib = vao-&gt;getMaxEnabledAttribute();
+        for (size_t attribIndex = 0; attribIndex &lt; maxEnabledAttrib; attribIndex++)
+        {
+            const gl::VertexAttribute &amp;vertexAttrib = vertexAttribs[attribIndex];
+            gl::Buffer *boundBuffer = vertexAttrib.buffer.get();
+            if (vertexAttrib.enabled &amp;&amp; boundBuffer &amp;&amp; boundBuffer-&gt;isMapped())
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+    else
+    {
+        Buffer *buffer = getTargetBuffer(target);
+        return (buffer &amp;&amp; buffer-&gt;isMapped());
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEStateh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/State.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,328 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// State.h: Defines the State class, encapsulating raw GL state
+
+#ifndef LIBANGLE_STATE_H_
+#define LIBANGLE_STATE_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/TransformFeedback.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Sampler.h&quot;
+
+namespace gl
+{
+class Query;
+class VertexArray;
+class Context;
+struct Caps;
+struct Data;
+
+typedef std::map&lt; GLenum, BindingPointer&lt;Texture&gt; &gt; TextureMap;
+
+class State : angle::NonCopyable
+{
+  public:
+    State();
+    ~State();
+
+    void initialize(const Caps&amp; caps, GLuint clientVersion);
+    void reset();
+
+    // State chunk getters
+    const RasterizerState &amp;getRasterizerState() const;
+    const BlendState &amp;getBlendState() const;
+    const DepthStencilState &amp;getDepthStencilState() const;
+
+    // Clear behavior setters &amp; state parameter block generation function
+    void setColorClearValue(float red, float green, float blue, float alpha);
+    void setDepthClearValue(float depth);
+    void setStencilClearValue(int stencil);
+
+    const ColorF &amp;getColorClearValue() const { return mColorClearValue; }
+    float getDepthClearValue() const { return mDepthClearValue; }
+    int getStencilClearValue() const { return mStencilClearValue; }
+
+    // Write mask manipulation
+    void setColorMask(bool red, bool green, bool blue, bool alpha);
+    void setDepthMask(bool mask);
+
+    // Discard toggle &amp; query
+    bool isRasterizerDiscardEnabled() const;
+    void setRasterizerDiscard(bool enabled);
+
+    // Primitive restart
+    bool isPrimitiveRestartEnabled() const;
+    void setPrimitiveRestart(bool enabled);
+
+    // Face culling state manipulation
+    bool isCullFaceEnabled() const;
+    void setCullFace(bool enabled);
+    void setCullMode(GLenum mode);
+    void setFrontFace(GLenum front);
+
+    // Depth test state manipulation
+    bool isDepthTestEnabled() const;
+    void setDepthTest(bool enabled);
+    void setDepthFunc(GLenum depthFunc);
+    void setDepthRange(float zNear, float zFar);
+    float getNearPlane() const;
+    float getFarPlane() const;
+
+    // Blend state manipulation
+    bool isBlendEnabled() const;
+    void setBlend(bool enabled);
+    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);
+    const ColorF &amp;getBlendColor() const;
+
+    // Stencil state maniupulation
+    bool isStencilTestEnabled() const;
+    void setStencilTest(bool enabled);
+    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);
+    GLint getStencilRef() const;
+    GLint getStencilBackRef() const;
+
+    // Depth bias/polygon offset state manipulation
+    bool isPolygonOffsetFillEnabled() const;
+    void setPolygonOffsetFill(bool enabled);
+    void setPolygonOffsetParams(GLfloat factor, GLfloat units);
+
+    // Multisample coverage state manipulation
+    bool isSampleAlphaToCoverageEnabled() const;
+    void setSampleAlphaToCoverage(bool enabled);
+    bool isSampleCoverageEnabled() const;
+    void setSampleCoverage(bool enabled);
+    void setSampleCoverageParams(GLclampf value, bool invert);
+    GLclampf getSampleCoverageValue() const;
+    bool getSampleCoverageInvert() const;
+
+    // Scissor test state toggle &amp; query
+    bool isScissorTestEnabled() const;
+    void setScissorTest(bool enabled);
+    void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
+    const Rectangle &amp;getScissor() const;
+
+    // Dither state toggle &amp; query
+    bool isDitherEnabled() const;
+    void setDither(bool enabled);
+
+    // Generic state toggle &amp; query
+    void setEnableFeature(GLenum feature, bool enabled);
+    bool getEnableFeature(GLenum feature);
+
+    // Line width state setter
+    void setLineWidth(GLfloat width);
+    float getLineWidth() const;
+
+    // Hint setters
+    void setGenerateMipmapHint(GLenum hint);
+    void setFragmentShaderDerivativeHint(GLenum hint);
+
+    // Viewport state setter/getter
+    void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
+    const Rectangle &amp;getViewport() const;
+
+    // Texture binding &amp; active texture unit manipulation
+    void setActiveSampler(unsigned int active);
+    unsigned int getActiveSampler() const;
+    void setSamplerTexture(GLenum type, Texture *texture);
+    Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
+    GLuint getSamplerTextureId(unsigned int sampler, GLenum type) const;
+    void detachTexture(const TextureMap &amp;zeroTextures, GLuint texture);
+    void initializeZeroTextures(const TextureMap &amp;zeroTextures);
+
+    // Sampler object binding manipulation
+    void setSamplerBinding(GLuint textureUnit, Sampler *sampler);
+    GLuint getSamplerId(GLuint textureUnit) const;
+    Sampler *getSampler(GLuint textureUnit) const;
+    void detachSampler(GLuint sampler);
+
+    // Renderbuffer binding manipulation
+    void setRenderbufferBinding(Renderbuffer *renderbuffer);
+    GLuint getRenderbufferId() const;
+    Renderbuffer *getCurrentRenderbuffer();
+    void detachRenderbuffer(GLuint renderbuffer);
+
+    // Framebuffer binding manipulation
+    void setReadFramebufferBinding(Framebuffer *framebuffer);
+    void setDrawFramebufferBinding(Framebuffer *framebuffer);
+    Framebuffer *getTargetFramebuffer(GLenum target) const;
+    Framebuffer *getReadFramebuffer();
+    Framebuffer *getDrawFramebuffer();
+    const Framebuffer *getReadFramebuffer() const;
+    const Framebuffer *getDrawFramebuffer() const;
+    bool removeReadFramebufferBinding(GLuint framebuffer);
+    bool removeDrawFramebufferBinding(GLuint framebuffer);
+
+    // Vertex array object binding manipulation
+    void setVertexArrayBinding(VertexArray *vertexArray);
+    GLuint getVertexArrayId() const;
+    VertexArray *getVertexArray() const;
+    bool removeVertexArrayBinding(GLuint vertexArray);
+
+    // Program binding manipulation
+    void setProgram(Program *newProgram);
+    Program *getProgram() const;
+
+    // Transform feedback object (not buffer) binding manipulation
+    void setTransformFeedbackBinding(TransformFeedback *transformFeedback);
+    TransformFeedback *getCurrentTransformFeedback() const;
+    bool isTransformFeedbackActiveUnpaused() const;
+    void detachTransformFeedback(GLuint transformFeedback);
+
+    // Query binding manipulation
+    bool isQueryActive() const;
+    void setActiveQuery(GLenum target, Query *query);
+    GLuint getActiveQueryId(GLenum target) const;
+    Query *getActiveQuery(GLenum target) const;
+
+    //// Typed buffer binding point manipulation ////
+    // GL_ARRAY_BUFFER
+    void setArrayBufferBinding(Buffer *buffer);
+    GLuint getArrayBufferId() const;
+    bool removeArrayBufferBinding(GLuint buffer);
+
+    // GL_UNIFORM_BUFFER - Both indexed and generic targets
+    void setGenericUniformBufferBinding(Buffer *buffer);
+    void setIndexedUniformBufferBinding(GLuint index, Buffer *buffer, GLintptr offset, GLsizeiptr size);
+    GLuint getIndexedUniformBufferId(GLuint index) const;
+    Buffer *getIndexedUniformBuffer(GLuint index) const;
+    GLintptr getIndexedUniformBufferOffset(GLuint index) const;
+    GLsizeiptr getIndexedUniformBufferSize(GLuint index) const;
+
+    // GL_COPY_[READ/WRITE]_BUFFER
+    void setCopyReadBufferBinding(Buffer *buffer);
+    void setCopyWriteBufferBinding(Buffer *buffer);
+
+    // GL_PIXEL[PACK/UNPACK]_BUFFER
+    void setPixelPackBufferBinding(Buffer *buffer);
+    void setPixelUnpackBufferBinding(Buffer *buffer);
+
+    // Retrieve typed buffer by target (non-indexed)
+    Buffer *getTargetBuffer(GLenum target) const;
+
+    // Vertex attrib manipulation
+    void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
+    void setVertexAttribf(GLuint index, const GLfloat values[4]);
+    void setVertexAttribu(GLuint index, const GLuint values[4]);
+    void setVertexAttribi(GLuint index, const GLint values[4]);
+    void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
+                              bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
+    const VertexAttribCurrentValueData &amp;getVertexAttribCurrentValue(unsigned int attribNum) const;
+    const void *getVertexAttribPointer(unsigned int attribNum) const;
+
+    // Pixel pack state manipulation
+    void setPackAlignment(GLint alignment);
+    GLint getPackAlignment() const;
+    void setPackReverseRowOrder(bool reverseRowOrder);
+    bool getPackReverseRowOrder() const;
+    const PixelPackState &amp;getPackState() const;
+    PixelPackState &amp;getPackState();
+
+    // Pixel unpack state manipulation
+    void setUnpackAlignment(GLint alignment);
+    GLint getUnpackAlignment() const;
+    void setUnpackRowLength(GLint rowLength);
+    GLint getUnpackRowLength() const;
+    const PixelUnpackState &amp;getUnpackState() const;
+    PixelUnpackState &amp;getUnpackState();
+
+    // State query functions
+    void getBooleanv(GLenum pname, GLboolean *params);
+    void getFloatv(GLenum pname, GLfloat *params);
+    void getIntegerv(const gl::Data &amp;data, GLenum pname, GLint *params);
+    bool getIndexedIntegerv(GLenum target, GLuint index, GLint *data);
+    bool getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data);
+
+    bool hasMappedBuffer(GLenum target) const;
+
+  private:
+    // Cached values from Context's caps
+    GLuint mMaxDrawBuffers;
+    GLuint mMaxCombinedTextureImageUnits;
+
+    ColorF mColorClearValue;
+    GLclampf mDepthClearValue;
+    int mStencilClearValue;
+
+    RasterizerState mRasterizer;
+    bool mScissorTest;
+    Rectangle mScissor;
+
+    BlendState mBlend;
+    ColorF mBlendColor;
+    bool mSampleCoverage;
+    GLclampf mSampleCoverageValue;
+    bool mSampleCoverageInvert;
+
+    DepthStencilState mDepthStencil;
+    GLint mStencilRef;
+    GLint mStencilBackRef;
+
+    GLfloat mLineWidth;
+
+    GLenum mGenerateMipmapHint;
+    GLenum mFragmentShaderDerivativeHint;
+
+    Rectangle mViewport;
+    float mNearZ;
+    float mFarZ;
+
+    BindingPointer&lt;Buffer&gt; mArrayBuffer;
+    Framebuffer *mReadFramebuffer;
+    Framebuffer *mDrawFramebuffer;
+    BindingPointer&lt;Renderbuffer&gt; mRenderbuffer;
+    Program *mProgram;
+
+    typedef std::vector&lt;VertexAttribCurrentValueData&gt; VertexAttribVector;
+    VertexAttribVector mVertexAttribCurrentValues; // From glVertexAttrib
+    VertexArray *mVertexArray;
+
+    // Texture and sampler bindings
+    size_t mActiveSampler;   // Active texture unit selector - GL_TEXTURE0
+
+    typedef std::vector&lt; BindingPointer&lt;Texture&gt; &gt; TextureBindingVector;
+    typedef std::map&lt;GLenum, TextureBindingVector&gt; TextureBindingMap;
+    TextureBindingMap mSamplerTextures;
+
+    typedef std::vector&lt; BindingPointer&lt;Sampler&gt; &gt; SamplerBindingVector;
+    SamplerBindingVector mSamplers;
+
+    typedef std::map&lt; GLenum, BindingPointer&lt;Query&gt; &gt; ActiveQueryMap;
+    ActiveQueryMap mActiveQueries;
+
+    BindingPointer&lt;Buffer&gt; mGenericUniformBuffer;
+    typedef std::vector&lt; OffsetBindingPointer&lt;Buffer&gt; &gt; BufferVector;
+    BufferVector mUniformBuffers;
+
+    BindingPointer&lt;TransformFeedback&gt; mTransformFeedback;
+
+    BindingPointer&lt;Buffer&gt; mCopyReadBuffer;
+    BindingPointer&lt;Buffer&gt; mCopyWriteBuffer;
+
+    PixelUnpackState mUnpack;
+    PixelPackState mPack;
+
+    bool mPrimitiveRestart;
+};
+
+}
+
+#endif // LIBANGLE_STATE_H_
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLESurfacecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,176 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/Surface.h&quot;
+
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+
+namespace egl
+{
+
+Surface::Surface(rx::SurfaceImpl *impl, EGLint surfaceType, const egl::Config *config, const AttributeMap &amp;attributes)
+    : FramebufferAttachmentObject(0), // id unused
+      mImplementation(impl),
+      mType(surfaceType),
+      mConfig(config),
+      mPostSubBufferRequested(false),
+      mFixedSize(false),
+      mFixedWidth(0),
+      mFixedHeight(0),
+      mTextureFormat(EGL_NO_TEXTURE),
+      mTextureTarget(EGL_NO_TEXTURE),
+      // FIXME: Determine actual pixel aspect ratio
+      mPixelAspectRatio(static_cast&lt;EGLint&gt;(1.0 * EGL_DISPLAY_SCALING)),
+      mRenderBuffer(EGL_BACK_BUFFER),
+      mSwapBehavior(EGL_BUFFER_PRESERVED),
+      mTexture(NULL)
+{
+    addRef();
+
+    mPostSubBufferRequested = (attributes.get(EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_FALSE) == EGL_TRUE);
+
+    mFixedSize = (attributes.get(EGL_FIXED_SIZE_ANGLE, EGL_FALSE) == EGL_TRUE);
+    if (mFixedSize)
+    {
+        mFixedWidth = attributes.get(EGL_WIDTH, 0);
+        mFixedHeight = attributes.get(EGL_HEIGHT, 0);
+    }
+
+    if (mType != EGL_WINDOW_BIT)
+    {
+        mTextureFormat = attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
+        mTextureTarget = attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
+    }
+}
+
+Surface::~Surface()
+{
+    if (mTexture)
+    {
+        if (mImplementation)
+        {
+            mImplementation-&gt;releaseTexImage(EGL_BACK_BUFFER);
+        }
+        mTexture-&gt;releaseTexImage();
+        mTexture = NULL;
+    }
+
+    SafeDelete(mImplementation);
+}
+
+EGLint Surface::getType() const
+{
+    return mType;
+}
+
+Error Surface::swap()
+{
+    return mImplementation-&gt;swap();
+}
+
+Error Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    return mImplementation-&gt;postSubBuffer(x, y, width, height);
+}
+
+Error Surface::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+    return mImplementation-&gt;querySurfacePointerANGLE(attribute, value);
+}
+
+EGLint Surface::isPostSubBufferSupported() const
+{
+    return mPostSubBufferRequested &amp;&amp; mImplementation-&gt;isPostSubBufferSupported();
+}
+
+void Surface::setSwapInterval(EGLint interval)
+{
+    mImplementation-&gt;setSwapInterval(interval);
+}
+
+const Config *Surface::getConfig() const
+{
+    return mConfig;
+}
+
+EGLint Surface::getPixelAspectRatio() const
+{
+    return mPixelAspectRatio;
+}
+
+EGLenum Surface::getRenderBuffer() const
+{
+    return mRenderBuffer;
+}
+
+EGLenum Surface::getSwapBehavior() const
+{
+    return mSwapBehavior;
+}
+
+EGLenum Surface::getTextureFormat() const
+{
+    return mTextureFormat;
+}
+
+EGLenum Surface::getTextureTarget() const
+{
+    return mTextureTarget;
+}
+
+EGLint Surface::isFixedSize() const
+{
+    return mFixedSize;
+}
+
+EGLint Surface::getWidth() const
+{
+    return mFixedSize ? static_cast&lt;EGLint&gt;(mFixedWidth) : mImplementation-&gt;getWidth();
+}
+
+EGLint Surface::getHeight() const
+{
+    return mFixedSize ? static_cast&lt;EGLint&gt;(mFixedHeight) : mImplementation-&gt;getHeight();
+}
+
+Error Surface::bindTexImage(gl::Texture *texture, EGLint buffer)
+{
+    ASSERT(!mTexture);
+
+    texture-&gt;bindTexImage(this);
+    mTexture = texture;
+    return mImplementation-&gt;bindTexImage(buffer);
+}
+
+Error Surface::releaseTexImage(EGLint buffer)
+{
+    ASSERT(mTexture);
+    gl::Texture *boundTexture = mTexture;
+    mTexture = NULL;
+
+    boundTexture-&gt;releaseTexImage();
+    return mImplementation-&gt;releaseTexImage(buffer);
+}
+
+GLenum Surface::getAttachmentInternalFormat(const gl::FramebufferAttachment::Target &amp;target) const
+{
+    const egl::Config *config = getConfig();
+    return (target.binding() == GL_BACK ? config-&gt;renderTargetFormat : config-&gt;depthStencilFormat);
+}
+
+GLsizei Surface::getAttachmentSamples(const gl::FramebufferAttachment::Target &amp;target) const
+{
+    return getConfig()-&gt;samples;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLESurfaceh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,101 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 LIBANGLE_SURFACE_H_
+#define LIBANGLE_SURFACE_H_
+
+#include &lt;EGL/egl.h&gt;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/renderer/SurfaceImpl.h&quot;
+
+namespace gl
+{
+class Texture;
+}
+
+namespace egl
+{
+class AttributeMap;
+class Display;
+struct Config;
+
+class Surface final : public gl::FramebufferAttachmentObject
+{
+  public:
+    Surface(rx::SurfaceImpl *impl, EGLint surfaceType, const egl::Config *config, const AttributeMap &amp;attributes);
+
+    rx::SurfaceImpl *getImplementation() { return mImplementation; }
+    const rx::SurfaceImpl *getImplementation() const { return mImplementation; }
+
+    EGLint getType() const;
+
+    Error swap();
+    Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height);
+    Error querySurfacePointerANGLE(EGLint attribute, void **value);
+    Error bindTexImage(gl::Texture *texture, EGLint buffer);
+    Error releaseTexImage(EGLint buffer);
+
+    EGLint isPostSubBufferSupported() const;
+
+    void setSwapInterval(EGLint interval);
+
+    const Config *getConfig() const;
+
+    // width and height can change with client window resizing
+    EGLint getWidth() const;
+    EGLint getHeight() const;
+    EGLint getPixelAspectRatio() const;
+    EGLenum getRenderBuffer() const;
+    EGLenum getSwapBehavior() const;
+    EGLenum getTextureFormat() const;
+    EGLenum getTextureTarget() const;
+
+    gl::Texture *getBoundTexture() const { return mTexture; }
+
+    EGLint isFixedSize() const;
+
+    // FramebufferAttachmentObject implementation
+    GLsizei getAttachmentWidth(const gl::FramebufferAttachment::Target &amp;/*target*/) const override { return getWidth(); }
+    GLsizei getAttachmentHeight(const gl::FramebufferAttachment::Target &amp;/*target*/) const override { return getHeight(); }
+    GLenum getAttachmentInternalFormat(const gl::FramebufferAttachment::Target &amp;target) const override;
+    GLsizei getAttachmentSamples(const gl::FramebufferAttachment::Target &amp;target) const override;
+
+  private:
+    virtual ~Surface();
+    rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mImplementation; }
+
+    rx::SurfaceImpl *mImplementation;
+
+    EGLint mType;
+
+    const egl::Config *mConfig;
+
+    bool mPostSubBufferRequested;
+
+    bool mFixedSize;
+    size_t mFixedWidth;
+    size_t mFixedHeight;
+
+    EGLenum mTextureFormat;
+    EGLenum mTextureTarget;
+
+    EGLint mPixelAspectRatio;      // Display aspect ratio
+    EGLenum mRenderBuffer;         // Render buffer
+    EGLenum mSwapBehavior;         // Buffer swap behavior
+
+    gl::Texture *mTexture;
+};
+
+}
+
+#endif   // LIBANGLE_SURFACE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLESurface_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Surface_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+#include &quot;libANGLE/AttributeMap.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/renderer/SurfaceImpl.h&quot;
+
+namespace
+{
+
+class MockSurfaceImpl : public rx::SurfaceImpl
+{
+  public:
+    virtual ~MockSurfaceImpl() { destroy(); }
+
+    MOCK_METHOD0(initialize, egl::Error());
+    MOCK_METHOD0(swap, egl::Error());
+    MOCK_METHOD4(postSubBuffer, egl::Error(EGLint, EGLint, EGLint, EGLint));
+    MOCK_METHOD2(querySurfacePointerANGLE, egl::Error(EGLint, void**));
+    MOCK_METHOD1(bindTexImage, egl::Error(EGLint));
+    MOCK_METHOD1(releaseTexImage, egl::Error(EGLint));
+    MOCK_METHOD1(setSwapInterval, void(EGLint));
+    MOCK_CONST_METHOD0(getWidth, EGLint());
+    MOCK_CONST_METHOD0(getHeight, EGLint());
+    MOCK_CONST_METHOD0(isPostSubBufferSupported, EGLint(void));
+    MOCK_METHOD2(getAttachmentRenderTarget, gl::Error(const gl::FramebufferAttachment::Target &amp;, rx::FramebufferAttachmentRenderTarget **));
+
+    MOCK_METHOD0(destroy, void());
+};
+
+class SurfaceTest : public testing::Test
+{
+  protected:
+    virtual void SetUp()
+    {
+        mImpl = new MockSurfaceImpl;
+        EXPECT_CALL(*mImpl, destroy());
+        mSurface = new egl::Surface(mImpl, EGL_WINDOW_BIT, &amp;mConfig, egl::AttributeMap());
+    }
+
+    virtual void TearDown()
+    {
+        mSurface-&gt;release();
+    }
+
+    MockSurfaceImpl *mImpl;
+    egl::Surface *mSurface;
+    egl::Config mConfig;
+};
+
+TEST_F(SurfaceTest, DestructionDeletesImpl)
+{
+    MockSurfaceImpl *impl = new MockSurfaceImpl;
+    EXPECT_CALL(*impl, destroy()).Times(1).RetiresOnSaturation();
+
+    egl::Surface *surface = new egl::Surface(impl, EGL_WINDOW_BIT, &amp;mConfig, egl::AttributeMap());
+    surface-&gt;release();
+
+    // Only needed because the mock is leaked if bugs are present,
+    // which logs an error, but does not cause the test to fail.
+    // Ordinarily mocks are verified when destroyed.
+    testing::Mock::VerifyAndClear(impl);
+}
+
+} // namespace
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLETexturecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,593 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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. [OpenGL ES 2.0.24] section 3.7 page 63.
+
+#include &quot;libANGLE/Texture.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+
+namespace gl
+{
+
+bool IsMipmapFiltered(const gl::SamplerState &amp;samplerState)
+{
+    switch (samplerState.minFilter)
+    {
+      case GL_NEAREST:
+      case GL_LINEAR:
+        return false;
+      case GL_NEAREST_MIPMAP_NEAREST:
+      case GL_LINEAR_MIPMAP_NEAREST:
+      case GL_NEAREST_MIPMAP_LINEAR:
+      case GL_LINEAR_MIPMAP_LINEAR:
+        return true;
+      default: UNREACHABLE();
+        return false;
+    }
+}
+
+bool IsPointSampled(const gl::SamplerState &amp;samplerState)
+{
+    return (samplerState.magFilter == GL_NEAREST &amp;&amp; (samplerState.minFilter == GL_NEAREST || samplerState.minFilter == GL_NEAREST_MIPMAP_NEAREST));
+}
+
+static size_t GetImageDescIndex(GLenum target, size_t level)
+{
+    return IsCubeMapTextureTarget(target) ? ((level * 6) + CubeMapTextureTargetToLayerIndex(target)) : level;
+}
+
+unsigned int Texture::mCurrentTextureSerial = 1;
+
+Texture::Texture(rx::TextureImpl *impl, GLuint id, GLenum target)
+    : FramebufferAttachmentObject(id),
+      mTexture(impl),
+      mTextureSerial(issueTextureSerial()),
+      mUsage(GL_NONE),
+      mImmutableLevelCount(0),
+      mTarget(target),
+      mImageDescs(IMPLEMENTATION_MAX_TEXTURE_LEVELS * (target == GL_TEXTURE_CUBE_MAP ? 6 : 1)),
+      mCompletenessCache(),
+      mBoundSurface(NULL)
+{
+}
+
+Texture::~Texture()
+{
+    if (mBoundSurface)
+    {
+        mBoundSurface-&gt;releaseTexImage(EGL_BACK_BUFFER);
+        mBoundSurface = NULL;
+    }
+    SafeDelete(mTexture);
+}
+
+GLenum Texture::getTarget() const
+{
+    return mTarget;
+}
+
+void Texture::setUsage(GLenum usage)
+{
+    mUsage = usage;
+    getImplementation()-&gt;setUsage(usage);
+}
+
+GLenum Texture::getUsage() const
+{
+    return mUsage;
+}
+
+size_t Texture::getWidth(GLenum target, size_t level) const
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+    return getImageDesc(target, level).size.width;
+}
+
+size_t Texture::getHeight(GLenum target, size_t level) const
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+    return getImageDesc(target, level).size.height;
+}
+
+size_t Texture::getDepth(GLenum target, size_t level) const
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+    return getImageDesc(target, level).size.depth;
+}
+
+GLenum Texture::getInternalFormat(GLenum target, size_t level) const
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+    return getImageDesc(target, level).internalFormat;
+}
+
+bool Texture::isSamplerComplete(const SamplerState &amp;samplerState, const Data &amp;data) const
+{
+    const ImageDesc &amp;baseImageDesc = getImageDesc(getBaseImageTarget(), samplerState.baseLevel);
+    const TextureCaps &amp;textureCaps = data.textureCaps-&gt;get(baseImageDesc.internalFormat);
+    if (!mCompletenessCache.cacheValid ||
+        mCompletenessCache.samplerState != samplerState ||
+        mCompletenessCache.filterable != textureCaps.filterable ||
+        mCompletenessCache.clientVersion != data.clientVersion ||
+        mCompletenessCache.supportsNPOT != data.extensions-&gt;textureNPOT)
+    {
+        mCompletenessCache.cacheValid = true;
+        mCompletenessCache.samplerState = samplerState;
+        mCompletenessCache.filterable = textureCaps.filterable;
+        mCompletenessCache.clientVersion = data.clientVersion;
+        mCompletenessCache.supportsNPOT = data.extensions-&gt;textureNPOT;
+        mCompletenessCache.samplerComplete = computeSamplerCompleteness(samplerState, data);
+    }
+    return mCompletenessCache.samplerComplete;
+}
+
+// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
+bool Texture::isCubeComplete() const
+{
+    ASSERT(mTarget == GL_TEXTURE_CUBE_MAP);
+
+    const ImageDesc &amp;baseImageDesc = getImageDesc(FirstCubeMapTextureTarget, 0);
+    if (baseImageDesc.size.width == 0 || baseImageDesc.size.width != baseImageDesc.size.height)
+    {
+        return false;
+    }
+
+    for (GLenum face = FirstCubeMapTextureTarget + 1; face &lt;= LastCubeMapTextureTarget; face++)
+    {
+        const ImageDesc &amp;faceImageDesc = getImageDesc(face, 0);
+        if (faceImageDesc.size.width != baseImageDesc.size.width ||
+            faceImageDesc.size.height != baseImageDesc.size.height ||
+            faceImageDesc.internalFormat != baseImageDesc.internalFormat)
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+unsigned int Texture::getTextureSerial() const
+{
+    return mTextureSerial;
+}
+
+unsigned int Texture::issueTextureSerial()
+{
+    return mCurrentTextureSerial++;
+}
+
+bool Texture::isImmutable() const
+{
+    return (mImmutableLevelCount &gt; 0);
+}
+
+int Texture::immutableLevelCount()
+{
+    return mImmutableLevelCount;
+}
+
+Error Texture::setImage(GLenum target, size_t level, GLenum internalFormat, const Extents &amp;size, GLenum format, GLenum type,
+                        const PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+
+    Error error = mTexture-&gt;setImage(target, level, internalFormat, size, format, type, unpack, pixels);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    releaseTexImage();
+
+    setImageDesc(target, level, ImageDesc(size, GetSizedInternalFormat(internalFormat, type)));
+
+    return Error(GL_NO_ERROR);
+}
+
+Error Texture::setSubImage(GLenum target, size_t level, const Box &amp;area, GLenum format, GLenum type,
+                           const PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+
+    return mTexture-&gt;setSubImage(target, level, area, format, type, unpack, pixels);
+}
+
+Error Texture::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const Extents &amp;size,
+                                  const PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+
+    Error error = mTexture-&gt;setCompressedImage(target, level, internalFormat, size, unpack, pixels);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    releaseTexImage();
+
+    setImageDesc(target, level, ImageDesc(size, GetSizedInternalFormat(internalFormat, GL_UNSIGNED_BYTE)));
+
+    return Error(GL_NO_ERROR);
+}
+
+Error Texture::setCompressedSubImage(GLenum target, size_t level, const Box &amp;area, GLenum format,
+                                     const PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+
+    return mTexture-&gt;setCompressedSubImage(target, level, area, format, unpack, pixels);
+}
+
+Error Texture::copyImage(GLenum target, size_t level, const Rectangle &amp;sourceArea, GLenum internalFormat,
+                         const Framebuffer *source)
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+
+    Error error = mTexture-&gt;copyImage(target, level, sourceArea, internalFormat, source);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    releaseTexImage();
+
+    setImageDesc(target, level, ImageDesc(Extents(sourceArea.width, sourceArea.height, 1),
+                                          GetSizedInternalFormat(internalFormat, GL_UNSIGNED_BYTE)));
+
+    return Error(GL_NO_ERROR);
+}
+
+Error Texture::copySubImage(GLenum target, size_t level, const Offset &amp;destOffset, const Rectangle &amp;sourceArea,
+                            const Framebuffer *source)
+{
+    ASSERT(target == mTarget || (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; IsCubeMapTextureTarget(target)));
+
+    return mTexture-&gt;copySubImage(target, level, destOffset, sourceArea, source);
+}
+
+Error Texture::setStorage(GLenum target, size_t levels, GLenum internalFormat, const Extents &amp;size)
+{
+    ASSERT(target == mTarget);
+
+    Error error = mTexture-&gt;setStorage(target, levels, internalFormat, size);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    releaseTexImage();
+
+    mImmutableLevelCount = static_cast&lt;GLsizei&gt;(levels);
+    clearImageDescs();
+    setImageDescChain(levels, size, internalFormat);
+
+    return Error(GL_NO_ERROR);
+}
+
+
+Error Texture::generateMipmaps()
+{
+    Error error = mTexture-&gt;generateMipmaps(getSamplerState());
+    if (error.isError())
+    {
+        return error;
+    }
+
+    releaseTexImage();
+
+    const ImageDesc &amp;baseImageInfo = getImageDesc(getBaseImageTarget(), 0);
+    size_t mipLevels = log2(std::max(std::max(baseImageInfo.size.width, baseImageInfo.size.height), baseImageInfo.size.depth)) + 1;
+    setImageDescChain(mipLevels, baseImageInfo.size, baseImageInfo.internalFormat);
+
+    return Error(GL_NO_ERROR);
+}
+
+void Texture::setImageDescChain(size_t levels, Extents baseSize, GLenum sizedInternalFormat)
+{
+    for (size_t level = 0; level &lt; levels; level++)
+    {
+        Extents levelSize(std::max&lt;int&gt;(baseSize.width &gt;&gt; level, 1),
+                          std::max&lt;int&gt;(baseSize.height &gt;&gt; level, 1),
+                          (mTarget == GL_TEXTURE_2D_ARRAY) ? baseSize.depth : std::max&lt;int&gt;(baseSize.depth &gt;&gt; level, 1));
+        ImageDesc levelInfo(levelSize, sizedInternalFormat);
+
+        if (mTarget == GL_TEXTURE_CUBE_MAP)
+        {
+            for (size_t face = FirstCubeMapTextureTarget; face &lt;= LastCubeMapTextureTarget; face++)
+            {
+                setImageDesc(static_cast&lt;GLenum&gt;(face), level, levelInfo);
+            }
+        }
+        else
+        {
+            setImageDesc(mTarget, level, levelInfo);
+        }
+    }
+}
+
+Texture::ImageDesc::ImageDesc()
+    : ImageDesc(Extents(0, 0, 0), GL_NONE)
+{
+}
+
+Texture::ImageDesc::ImageDesc(const Extents &amp;size, GLenum internalFormat)
+    : size(size),
+      internalFormat(internalFormat)
+{
+}
+
+const Texture::ImageDesc &amp;Texture::getImageDesc(GLenum target, size_t level) const
+{
+    size_t descIndex = GetImageDescIndex(target, level);
+    ASSERT(descIndex &lt; mImageDescs.size());
+    return mImageDescs[descIndex];
+}
+
+void Texture::setImageDesc(GLenum target, size_t level, const ImageDesc &amp;desc)
+{
+    size_t descIndex = GetImageDescIndex(target, level);
+    ASSERT(descIndex &lt; mImageDescs.size());
+    mImageDescs[descIndex] = desc;
+    mCompletenessCache.cacheValid = false;
+}
+
+void Texture::clearImageDesc(GLenum target, size_t level)
+{
+    setImageDesc(target, level, ImageDesc());
+}
+
+void Texture::clearImageDescs()
+{
+    for (size_t descIndex = 0; descIndex &lt; mImageDescs.size(); descIndex++)
+    {
+        mImageDescs[descIndex] = ImageDesc();
+    }
+    mCompletenessCache.cacheValid = false;
+}
+
+void Texture::bindTexImage(egl::Surface *surface)
+{
+    ASSERT(surface);
+
+    releaseTexImage();
+    mTexture-&gt;bindTexImage(surface);
+    mBoundSurface = surface;
+
+    // Set the image info to the size and format of the surface
+    ASSERT(mTarget == GL_TEXTURE_2D);
+    Extents size(surface-&gt;getWidth(), surface-&gt;getHeight(), 1);
+    ImageDesc desc(size, surface-&gt;getConfig()-&gt;renderTargetFormat);
+    setImageDesc(mTarget, 0, desc);
+}
+
+void Texture::releaseTexImage()
+{
+    if (mBoundSurface)
+    {
+        mBoundSurface = NULL;
+        mTexture-&gt;releaseTexImage();
+
+        // Erase the image info for level 0
+        ASSERT(mTarget == GL_TEXTURE_2D);
+        clearImageDesc(mTarget, 0);
+    }
+}
+
+GLenum Texture::getBaseImageTarget() const
+{
+    return mTarget == GL_TEXTURE_CUBE_MAP ? FirstCubeMapTextureTarget : mTarget;
+}
+
+size_t Texture::getExpectedMipLevels() const
+{
+    const ImageDesc &amp;baseImageDesc = getImageDesc(getBaseImageTarget(), 0);
+    if (mTarget == GL_TEXTURE_3D)
+    {
+        return log2(std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height), baseImageDesc.size.depth)) + 1;
+    }
+    else
+    {
+        return log2(std::max(baseImageDesc.size.width, baseImageDesc.size.height)) + 1;
+    }
+}
+
+bool Texture::computeSamplerCompleteness(const SamplerState &amp;samplerState, const Data &amp;data) const
+{
+    const ImageDesc &amp;baseImageDesc = getImageDesc(getBaseImageTarget(), samplerState.baseLevel);
+    if (baseImageDesc.size.width == 0 || baseImageDesc.size.height == 0 || baseImageDesc.size.depth == 0)
+    {
+        return false;
+    }
+
+    if (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; baseImageDesc.size.width != baseImageDesc.size.height)
+    {
+        return false;
+    }
+
+    const TextureCaps &amp;textureCaps = data.textureCaps-&gt;get(baseImageDesc.internalFormat);
+    if (!textureCaps.filterable &amp;&amp; !IsPointSampled(samplerState))
+    {
+        return false;
+    }
+
+    bool npotSupport = data.extensions-&gt;textureNPOT || data.clientVersion &gt;= 3;
+    if (!npotSupport)
+    {
+        if ((samplerState.wrapS != GL_CLAMP_TO_EDGE &amp;&amp; !gl::isPow2(baseImageDesc.size.width)) ||
+            (samplerState.wrapT != GL_CLAMP_TO_EDGE &amp;&amp; !gl::isPow2(baseImageDesc.size.height)))
+        {
+            return false;
+        }
+    }
+
+    if (IsMipmapFiltered(samplerState))
+    {
+        if (!npotSupport)
+        {
+            if (!gl::isPow2(baseImageDesc.size.width) || !gl::isPow2(baseImageDesc.size.height))
+            {
+                return false;
+            }
+        }
+
+        if (!computeMipmapCompleteness(samplerState))
+        {
+            return false;
+        }
+    }
+    else
+    {
+        if (mTarget == GL_TEXTURE_CUBE_MAP &amp;&amp; !isCubeComplete())
+        {
+            return false;
+        }
+    }
+
+    // OpenGLES 3.0.2 spec section 3.8.13 states that a texture is not mipmap complete if:
+    // The internalformat specified for the texture arrays is a sized internal depth or
+    // depth and stencil format (see table 3.13), the value of TEXTURE_COMPARE_-
+    // MODE is NONE, and either the magnification filter is not NEAREST or the mini-
+    // fication filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST.
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(baseImageDesc.internalFormat);
+    if (formatInfo.depthBits &gt; 0 &amp;&amp; data.clientVersion &gt; 2)
+    {
+        if (samplerState.compareMode == GL_NONE)
+        {
+            if ((samplerState.minFilter != GL_NEAREST &amp;&amp; samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST) ||
+                samplerState.magFilter != GL_NEAREST)
+            {
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
+bool Texture::computeMipmapCompleteness(const gl::SamplerState &amp;samplerState) const
+{
+    size_t expectedMipLevels = getExpectedMipLevels();
+
+    size_t maxLevel = std::min&lt;size_t&gt;(expectedMipLevels, samplerState.maxLevel + 1);
+
+    for (size_t level = samplerState.baseLevel; level &lt; maxLevel; level++)
+    {
+        if (mTarget == GL_TEXTURE_CUBE_MAP)
+        {
+            for (GLenum face = FirstCubeMapTextureTarget; face &lt;= LastCubeMapTextureTarget; face++)
+            {
+                if (!computeLevelCompleteness(face, level, samplerState))
+                {
+                    return false;
+                }
+            }
+        }
+        else
+        {
+            if (!computeLevelCompleteness(mTarget, level, samplerState))
+            {
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
+
+bool Texture::computeLevelCompleteness(GLenum target, size_t level, const gl::SamplerState &amp;samplerState) const
+{
+    ASSERT(level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+    if (isImmutable())
+    {
+        return true;
+    }
+
+    const ImageDesc &amp;baseImageDesc = getImageDesc(getBaseImageTarget(), samplerState.baseLevel);
+    if (baseImageDesc.size.width == 0 || baseImageDesc.size.height == 0 || baseImageDesc.size.depth == 0)
+    {
+        return false;
+    }
+
+    // The base image level is complete if the width and height are positive
+    if (level == 0)
+    {
+        return true;
+    }
+
+    const ImageDesc &amp;levelImageDesc = getImageDesc(target, level);
+    if (levelImageDesc.internalFormat != baseImageDesc.internalFormat)
+    {
+        return false;
+    }
+
+    if (levelImageDesc.size.width != std::max(1, baseImageDesc.size.width &gt;&gt; level))
+    {
+        return false;
+    }
+
+    if (levelImageDesc.size.height != std::max(1, baseImageDesc.size.height &gt;&gt; level))
+    {
+        return false;
+    }
+
+    if (mTarget == GL_TEXTURE_3D)
+    {
+        if (levelImageDesc.size.depth != std::max(1, baseImageDesc.size.depth &gt;&gt; level))
+        {
+            return false;
+        }
+    }
+    else if (mTarget == GL_TEXTURE_2D_ARRAY)
+    {
+        if (levelImageDesc.size.depth != baseImageDesc.size.depth)
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+Texture::SamplerCompletenessCache::SamplerCompletenessCache()
+    : cacheValid(false),
+      samplerState(),
+      filterable(false),
+      clientVersion(0),
+      supportsNPOT(false),
+      samplerComplete(false)
+{
+}
+
+GLsizei Texture::getAttachmentWidth(const gl::FramebufferAttachment::Target &amp;target) const
+{
+    return static_cast&lt;GLsizei&gt;(getWidth(target.textureIndex().type, target.textureIndex().mipIndex));
+}
+
+GLsizei Texture::getAttachmentHeight(const gl::FramebufferAttachment::Target &amp;target) const
+{
+    return static_cast&lt;GLsizei&gt;(getHeight(target.textureIndex().type, target.textureIndex().mipIndex));
+}
+
+GLenum Texture::getAttachmentInternalFormat(const gl::FramebufferAttachment::Target &amp;target) const
+{
+    return getInternalFormat(target.textureIndex().type, target.textureIndex().mipIndex);
+}
+
+GLsizei Texture::getAttachmentSamples(const gl::FramebufferAttachment::Target &amp;/*target*/) const
+{
+    // Multisample textures not currently supported
+    return 0;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLETextureh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Texture.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// Texture.h: Defines the gl::Texture class [OpenGL ES 2.0.24] section 3.7 page 63.
+
+#ifndef LIBANGLE_TEXTURE_H_
+#define LIBANGLE_TEXTURE_H_
+
+#include &lt;vector&gt;
+#include &lt;map&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/TextureImpl.h&quot;
+
+namespace egl
+{
+class Surface;
+}
+
+namespace gl
+{
+class Framebuffer;
+struct Data;
+
+bool IsMipmapFiltered(const gl::SamplerState &amp;samplerState);
+
+class Texture final : public FramebufferAttachmentObject
+{
+  public:
+    Texture(rx::TextureImpl *impl, GLuint id, GLenum target);
+
+    virtual ~Texture();
+
+    GLenum getTarget() const;
+
+    const SamplerState &amp;getSamplerState() const { return mSamplerState; }
+    SamplerState &amp;getSamplerState() { return mSamplerState; }
+
+    void setUsage(GLenum usage);
+    GLenum getUsage() const;
+
+    size_t getWidth(GLenum target, size_t level) const;
+    size_t getHeight(GLenum target, size_t level) const;
+    size_t getDepth(GLenum target, size_t level) const;
+    GLenum getInternalFormat(GLenum target, size_t level) const;
+
+    bool isSamplerComplete(const SamplerState &amp;samplerState, const Data &amp;data) const;
+    bool isCubeComplete() const;
+
+    virtual Error setImage(GLenum target, size_t level, GLenum internalFormat, const Extents &amp;size, GLenum format, GLenum type,
+                           const PixelUnpackState &amp;unpack, const uint8_t *pixels);
+    virtual Error setSubImage(GLenum target, size_t level, const Box &amp;area, GLenum format, GLenum type,
+                              const PixelUnpackState &amp;unpack, const uint8_t *pixels);
+
+    virtual Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const Extents &amp;size,
+                                     const PixelUnpackState &amp;unpack, const uint8_t *pixels);
+    virtual Error setCompressedSubImage(GLenum target, size_t level, const Box &amp;area, GLenum format,
+                                        const PixelUnpackState &amp;unpack, const uint8_t *pixels);
+
+    virtual Error copyImage(GLenum target, size_t level, const Rectangle &amp;sourceArea, GLenum internalFormat,
+                            const Framebuffer *source);
+    virtual Error copySubImage(GLenum target, size_t level, const Offset &amp;destOffset, const Rectangle &amp;sourceArea,
+                              const Framebuffer *source);
+
+    virtual Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const Extents &amp;size);
+
+    virtual Error generateMipmaps();
+
+    // Texture serials provide a unique way of identifying a Texture that isn't a raw pointer.
+    // &quot;id&quot; is not good enough, as Textures can be deleted, then re-allocated with the same id.
+    unsigned int getTextureSerial() const;
+
+    bool isImmutable() const;
+    GLsizei immutableLevelCount();
+
+    void bindTexImage(egl::Surface *surface);
+    void releaseTexImage();
+
+    rx::TextureImpl *getImplementation() { return mTexture; }
+    const rx::TextureImpl *getImplementation() const { return mTexture; }
+
+    static const GLuint INCOMPLETE_TEXTURE_ID = static_cast&lt;GLuint&gt;(-1);   // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
+
+    // FramebufferAttachmentObject implementation
+    GLsizei getAttachmentWidth(const FramebufferAttachment::Target &amp;target) const override;
+    GLsizei getAttachmentHeight(const FramebufferAttachment::Target &amp;target) const override;
+    GLenum getAttachmentInternalFormat(const FramebufferAttachment::Target &amp;target) const override;
+    GLsizei getAttachmentSamples(const FramebufferAttachment::Target &amp;target) const override;
+
+  private:
+    rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const override { return mTexture; }
+    static unsigned int issueTextureSerial();
+
+    rx::TextureImpl *mTexture;
+
+    SamplerState mSamplerState;
+    GLenum mUsage;
+
+    GLsizei mImmutableLevelCount;
+
+    GLenum mTarget;
+
+
+    struct ImageDesc
+    {
+        Extents size;
+        GLenum internalFormat;
+
+        ImageDesc();
+        ImageDesc(const Extents &amp;size, GLenum internalFormat);
+    };
+
+    const unsigned int mTextureSerial;
+    static unsigned int mCurrentTextureSerial;
+
+    GLenum getBaseImageTarget() const;
+    size_t getExpectedMipLevels() const;
+
+    bool computeSamplerCompleteness(const SamplerState &amp;samplerState, const Data &amp;data) const;
+    bool computeMipmapCompleteness(const gl::SamplerState &amp;samplerState) const;
+    bool computeLevelCompleteness(GLenum target, size_t level, const gl::SamplerState &amp;samplerState) const;
+
+    const ImageDesc &amp;getImageDesc(GLenum target, size_t level) const;
+    void setImageDesc(GLenum target, size_t level, const ImageDesc &amp;desc);
+    void setImageDescChain(size_t levels, Extents baseSize, GLenum sizedInternalFormat);
+    void clearImageDesc(GLenum target, size_t level);
+    void clearImageDescs();
+
+    std::vector&lt;ImageDesc&gt; mImageDescs;
+
+    struct SamplerCompletenessCache
+    {
+        SamplerCompletenessCache();
+
+        bool cacheValid;
+
+        // All values that affect sampler completeness that are not stored within
+        // the texture itself
+        SamplerState samplerState;
+        bool filterable;
+        GLint clientVersion;
+        bool supportsNPOT;
+
+        // Result of the sampler completeness with the above parameters
+        bool samplerComplete;
+    };
+    mutable SamplerCompletenessCache mCompletenessCache;
+
+    egl::Surface *mBoundSurface;
+};
+
+}
+
+#endif   // LIBANGLE_TEXTURE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLETransformFeedbackcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,121 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;libANGLE/TransformFeedback.h&quot;
+
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/renderer/TransformFeedbackImpl.h&quot;
+
+namespace gl
+{
+
+TransformFeedback::TransformFeedback(rx::TransformFeedbackImpl* impl, GLuint id, const Caps &amp;caps)
+    : RefCountObject(id),
+      mImplementation(impl),
+      mActive(false),
+      mPrimitiveMode(GL_NONE),
+      mPaused(false),
+      mGenericBuffer(),
+      mIndexedBuffers(caps.maxTransformFeedbackSeparateAttributes)
+{
+    ASSERT(impl != NULL);
+}
+
+TransformFeedback::~TransformFeedback()
+{
+    mGenericBuffer.set(nullptr);
+    for (size_t i = 0; i &lt; mIndexedBuffers.size(); i++)
+    {
+        mIndexedBuffers[i].set(nullptr);
+    }
+
+    SafeDelete(mImplementation);
+}
+
+void TransformFeedback::begin(GLenum primitiveMode)
+{
+    mActive = true;
+    mPrimitiveMode = primitiveMode;
+    mPaused = false;
+    mImplementation-&gt;begin(primitiveMode);
+}
+
+void TransformFeedback::end()
+{
+    mActive = false;
+    mPrimitiveMode = GL_NONE;
+    mPaused = false;
+    mImplementation-&gt;end();
+}
+
+void TransformFeedback::pause()
+{
+    mPaused = true;
+    mImplementation-&gt;pause();
+}
+
+void TransformFeedback::resume()
+{
+    mPaused = false;
+    mImplementation-&gt;resume();
+}
+
+bool TransformFeedback::isActive() const
+{
+    return mActive;
+}
+
+bool TransformFeedback::isPaused() const
+{
+    return mPaused;
+}
+
+GLenum TransformFeedback::getPrimitiveMode() const
+{
+    return mPrimitiveMode;
+}
+
+void TransformFeedback::bindGenericBuffer(Buffer *buffer)
+{
+    mGenericBuffer.set(buffer);
+    mImplementation-&gt;bindGenericBuffer(mGenericBuffer);
+}
+
+const BindingPointer&lt;Buffer&gt; &amp;TransformFeedback::getGenericBuffer() const
+{
+    return mGenericBuffer;
+}
+
+void TransformFeedback::bindIndexedBuffer(size_t index, Buffer *buffer, size_t offset, size_t size)
+{
+    ASSERT(index &lt; mIndexedBuffers.size());
+    mIndexedBuffers[index].set(buffer, offset, size);
+    mImplementation-&gt;bindIndexedBuffer(index, mIndexedBuffers[index]);
+}
+
+const OffsetBindingPointer&lt;Buffer&gt; &amp;TransformFeedback::getIndexedBuffer(size_t index) const
+{
+    ASSERT(index &lt; mIndexedBuffers.size());
+    return mIndexedBuffers[index];
+}
+
+size_t TransformFeedback::getIndexedBufferCount() const
+{
+    return mIndexedBuffers.size();
+}
+
+rx::TransformFeedbackImpl *TransformFeedback::getImplementation()
+{
+    return mImplementation;
+}
+
+const rx::TransformFeedbackImpl *TransformFeedback::getImplementation() const
+{
+    return mImplementation;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLETransformFeedbackh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+//
+// Copyright (c) 2014 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 LIBANGLE_TRANSFORM_FEEDBACK_H_
+#define LIBANGLE_TRANSFORM_FEEDBACK_H_
+
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+namespace rx
+{
+class TransformFeedbackImpl;
+}
+
+namespace gl
+{
+class Buffer;
+struct Caps;
+
+class TransformFeedback : public RefCountObject
+{
+  public:
+    TransformFeedback(rx::TransformFeedbackImpl* impl, GLuint id, const Caps &amp;caps);
+    virtual ~TransformFeedback();
+
+    void begin(GLenum primitiveMode);
+    void end();
+    void pause();
+    void resume();
+
+    bool isActive() const;
+    bool isPaused() const;
+    GLenum getPrimitiveMode() const;
+
+    void bindGenericBuffer(Buffer *buffer);
+    const BindingPointer&lt;Buffer&gt; &amp;getGenericBuffer() const;
+
+    void bindIndexedBuffer(size_t index, Buffer *buffer, size_t offset, size_t size);
+    const OffsetBindingPointer&lt;Buffer&gt; &amp;getIndexedBuffer(size_t index) const;
+    size_t getIndexedBufferCount() const;
+
+    rx::TransformFeedbackImpl *getImplementation();
+    const rx::TransformFeedbackImpl *getImplementation() const;
+
+  private:
+    rx::TransformFeedbackImpl* mImplementation;
+
+    bool mActive;
+    GLenum mPrimitiveMode;
+    bool mPaused;
+
+    BindingPointer&lt;Buffer&gt; mGenericBuffer;
+    std::vector&lt;OffsetBindingPointer&lt;Buffer&gt;&gt; mIndexedBuffers;
+};
+
+}
+
+#endif // LIBANGLE_TRANSFORM_FEEDBACK_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLETransformFeedback_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/TransformFeedback_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,131 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/TransformFeedback.h&quot;
+#include &quot;libANGLE/renderer/BufferImpl_mock.h&quot;
+#include &quot;libANGLE/renderer/TransformFeedbackImpl_mock.h&quot;
+
+using ::testing::_;
+using ::testing::Return;
+using ::testing::SetArgumentPointee;
+
+namespace
+{
+
+class TransformFeedbackTest : public testing::Test
+{
+  protected:
+    virtual void SetUp()
+    {
+        // Set a reasonable number of tf attributes
+        mCaps.maxTransformFeedbackSeparateAttributes = 8;
+
+        mImpl = new rx::MockTransformFeedbackImpl;
+        EXPECT_CALL(*mImpl, destructor());
+        mFeedback = new gl::TransformFeedback(mImpl, 1, mCaps);
+        mFeedback-&gt;addRef();
+    }
+
+    virtual void TearDown()
+    {
+        mFeedback-&gt;release();
+    }
+
+    rx::MockTransformFeedbackImpl* mImpl;
+    gl::TransformFeedback* mFeedback;
+    gl::Caps mCaps;
+};
+
+TEST_F(TransformFeedbackTest, DestructionDeletesImpl)
+{
+    rx::MockTransformFeedbackImpl* impl = new rx::MockTransformFeedbackImpl;
+    EXPECT_CALL(*impl, destructor()).Times(1).RetiresOnSaturation();
+
+    gl::TransformFeedback* feedback = new gl::TransformFeedback(impl, 1, mCaps);
+    feedback-&gt;addRef();
+    feedback-&gt;release();
+
+    // Only needed because the mock is leaked if bugs are present,
+    // which logs an error, but does not cause the test to fail.
+    // Ordinarily mocks are verified when destroyed.
+    testing::Mock::VerifyAndClear(impl);
+}
+
+TEST_F(TransformFeedbackTest, SideEffectsOfStartAndStop)
+{
+    testing::InSequence seq;
+
+    EXPECT_FALSE(mFeedback-&gt;isActive());
+    EXPECT_CALL(*mImpl, begin(GL_TRIANGLES));
+    mFeedback-&gt;begin(GL_TRIANGLES);
+    EXPECT_TRUE(mFeedback-&gt;isActive());
+    EXPECT_EQ(static_cast&lt;GLenum&gt;(GL_TRIANGLES), mFeedback-&gt;getPrimitiveMode());
+    EXPECT_CALL(*mImpl, end());
+    mFeedback-&gt;end();
+    EXPECT_FALSE(mFeedback-&gt;isActive());
+}
+
+TEST_F(TransformFeedbackTest, SideEffectsOfPauseAndResume)
+{
+    testing::InSequence seq;
+
+    EXPECT_FALSE(mFeedback-&gt;isActive());
+    EXPECT_CALL(*mImpl, begin(GL_TRIANGLES));
+    mFeedback-&gt;begin(GL_TRIANGLES);
+    EXPECT_FALSE(mFeedback-&gt;isPaused());
+    EXPECT_CALL(*mImpl, pause());
+    mFeedback-&gt;pause();
+    EXPECT_TRUE(mFeedback-&gt;isPaused());
+    EXPECT_CALL(*mImpl, resume());
+    mFeedback-&gt;resume();
+    EXPECT_FALSE(mFeedback-&gt;isPaused());
+    EXPECT_CALL(*mImpl, end());
+    mFeedback-&gt;end();
+}
+
+TEST_F(TransformFeedbackTest, BufferBinding)
+{
+    rx::MockBufferImpl *bufferImpl = new rx::MockBufferImpl;
+    gl::Buffer *buffer = new gl::Buffer(bufferImpl, 1);
+    EXPECT_CALL(*bufferImpl, destructor()).Times(1).RetiresOnSaturation();
+
+    static const size_t bindIndex = 0;
+
+    rx::MockTransformFeedbackImpl *feedbackImpl = new rx::MockTransformFeedbackImpl;
+    EXPECT_CALL(*feedbackImpl, destructor()).Times(1).RetiresOnSaturation();
+
+    gl::TransformFeedback *feedback = new gl::TransformFeedback(feedbackImpl, 1, mCaps);
+
+    EXPECT_EQ(feedback-&gt;getIndexedBufferCount(), mCaps.maxTransformFeedbackSeparateAttributes);
+
+    EXPECT_CALL(*feedbackImpl, bindGenericBuffer(_));
+    feedback-&gt;bindGenericBuffer(buffer);
+    EXPECT_EQ(feedback-&gt;getGenericBuffer().get(), buffer);
+
+    EXPECT_CALL(*feedbackImpl, bindIndexedBuffer(_, _));
+    feedback-&gt;bindIndexedBuffer(bindIndex, buffer, 0, 1);
+    for (size_t i = 0; i &lt; feedback-&gt;getIndexedBufferCount(); i++)
+    {
+        if (i == bindIndex)
+        {
+            EXPECT_EQ(feedback-&gt;getIndexedBuffer(i).get(), buffer);
+        }
+        else
+        {
+            EXPECT_EQ(feedback-&gt;getIndexedBuffer(i).get(), nullptr);
+        }
+    }
+
+    feedback-&gt;addRef();
+    feedback-&gt;release();
+
+    testing::Mock::VerifyAndClear(bufferImpl);
+}
+
+} // namespace
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEUniformcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,112 @@
</span><ins>+//
+// Copyright (c) 2010-2013 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 &quot;libANGLE/Uniform.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+#include &lt;cstring&gt;
+
+namespace gl
+{
+
+LinkedUniform::LinkedUniform(GLenum type, GLenum precision, const std::string &amp;name, unsigned int arraySize,
+                             const int blockIndex, const sh::BlockMemberInfo &amp;blockInfo)
+    : type(type),
+      precision(precision),
+      name(name),
+      arraySize(arraySize),
+      blockIndex(blockIndex),
+      blockInfo(blockInfo),
+      data(NULL),
+      dirty(true),
+      psRegisterIndex(GL_INVALID_INDEX),
+      vsRegisterIndex(GL_INVALID_INDEX),
+      registerCount(0),
+      registerElement(0)
+{
+    // We use data storage for default block uniforms to cache values that are sent to D3D during rendering
+    // Uniform blocks/buffers are treated separately by the Renderer (ES3 path only)
+    if (isInDefaultBlock())
+    {
+        size_t bytes = dataSize();
+        data = new unsigned char[bytes];
+        memset(data, 0, bytes);
+        registerCount = VariableRowCount(type) * elementCount();
+    }
+}
+
+LinkedUniform::~LinkedUniform()
+{
+    delete[] data;
+}
+
+bool LinkedUniform::isArray() const
+{
+    return arraySize &gt; 0;
+}
+
+unsigned int LinkedUniform::elementCount() const
+{
+    return arraySize &gt; 0 ? arraySize : 1;
+}
+
+bool LinkedUniform::isReferencedByVertexShader() const
+{
+    return vsRegisterIndex != GL_INVALID_INDEX;
+}
+
+bool LinkedUniform::isReferencedByFragmentShader() const
+{
+    return psRegisterIndex != GL_INVALID_INDEX;
+}
+
+bool LinkedUniform::isInDefaultBlock() const
+{
+    return blockIndex == -1;
+}
+
+size_t LinkedUniform::dataSize() const
+{
+    ASSERT(type != GL_STRUCT_ANGLEX);
+    return VariableInternalSize(type) * elementCount();
+}
+
+bool LinkedUniform::isSampler() const
+{
+    return IsSamplerType(type);
+}
+
+bool LinkedUniform::isBuiltIn() const
+{
+    return name.compare(0, 3, &quot;gl_&quot;) == 0;
+}
+
+UniformBlock::UniformBlock(const std::string &amp;name, unsigned int elementIndex, unsigned int dataSize)
+    : name(name),
+      elementIndex(elementIndex),
+      dataSize(dataSize),
+      psRegisterIndex(GL_INVALID_INDEX),
+      vsRegisterIndex(GL_INVALID_INDEX)
+{
+}
+
+bool UniformBlock::isArrayElement() const
+{
+    return elementIndex != GL_INVALID_INDEX;
+}
+
+bool UniformBlock::isReferencedByVertexShader() const
+{
+    return vsRegisterIndex != GL_INVALID_INDEX;
+}
+
+bool UniformBlock::isReferencedByFragmentShader() const
+{
+    return psRegisterIndex != GL_INVALID_INDEX;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEUniformh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/Uniform.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+//
+// Copyright (c) 2010-2013 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 LIBANGLE_UNIFORM_H_
+#define LIBANGLE_UNIFORM_H_
+
+#include &lt;string&gt;
+#include &lt;vector&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/debug.h&quot;
+#include &quot;compiler/translator/blocklayout.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+namespace gl
+{
+
+// Helper struct representing a single shader uniform
+struct LinkedUniform : angle::NonCopyable
+{
+    LinkedUniform(GLenum type, GLenum precision, const std::string &amp;name, unsigned int arraySize, const int blockIndex, const sh::BlockMemberInfo &amp;blockInfo);
+
+    ~LinkedUniform();
+
+    bool isArray() const;
+    unsigned int elementCount() const;
+    bool isReferencedByVertexShader() const;
+    bool isReferencedByFragmentShader() const;
+    bool isInDefaultBlock() const;
+    size_t dataSize() const;
+    bool isSampler() const;
+    bool isBuiltIn() const;
+
+    const GLenum type;
+    const GLenum precision;
+    const std::string name;
+    const unsigned int arraySize;
+    const int blockIndex;
+    const sh::BlockMemberInfo blockInfo;
+
+    unsigned char *data;
+    bool dirty;
+
+    unsigned int psRegisterIndex;
+    unsigned int vsRegisterIndex;
+    unsigned int registerCount;
+
+    // Register &quot;elements&quot; are used for uniform structs in ES3, to appropriately identify single uniforms
+    // inside aggregate types, which are packed according C-like structure rules.
+    unsigned int registerElement;
+};
+
+// Helper struct representing a single shader uniform block
+struct UniformBlock : angle::NonCopyable
+{
+    // use GL_INVALID_INDEX for non-array elements
+    UniformBlock(const std::string &amp;name, unsigned int elementIndex, unsigned int dataSize);
+
+    bool isArrayElement() const;
+    bool isReferencedByVertexShader() const;
+    bool isReferencedByFragmentShader() const;
+
+    const std::string name;
+    const unsigned int elementIndex;
+    const unsigned int dataSize;
+
+    std::vector&lt;unsigned int&gt; memberUniformIndexes;
+
+    unsigned int psRegisterIndex;
+    unsigned int vsRegisterIndex;
+};
+
+}
+
+#endif   // LIBANGLE_UNIFORM_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEVertexArraycpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+// Implementation of the state class for mananging GLES 3 Vertex Array Objects.
+//
+
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/renderer/VertexArrayImpl.h&quot;
+
+namespace gl
+{
+
+VertexArray::VertexArray(rx::VertexArrayImpl *impl, GLuint id, size_t maxAttribs)
+    : mId(id),
+      mVertexArray(impl),
+      mVertexAttributes(maxAttribs),
+      mMaxEnabledAttribute(0)
+{
+    ASSERT(impl != NULL);
+}
+
+VertexArray::~VertexArray()
+{
+    SafeDelete(mVertexArray);
+
+    for (size_t i = 0; i &lt; getMaxAttribs(); i++)
+    {
+        mVertexAttributes[i].buffer.set(NULL);
+    }
+    mElementArrayBuffer.set(NULL);
+}
+
+GLuint VertexArray::id() const
+{
+    return mId;
+}
+
+void VertexArray::detachBuffer(GLuint bufferName)
+{
+    for (size_t attribute = 0; attribute &lt; getMaxAttribs(); attribute++)
+    {
+        if (mVertexAttributes[attribute].buffer.id() == bufferName)
+        {
+            mVertexAttributes[attribute].buffer.set(NULL);
+        }
+    }
+
+    if (mElementArrayBuffer.id() == bufferName)
+    {
+        mElementArrayBuffer.set(NULL);
+    }
+}
+
+const VertexAttribute&amp; VertexArray::getVertexAttribute(size_t attributeIndex) const
+{
+    ASSERT(attributeIndex &lt; getMaxAttribs());
+    return mVertexAttributes[attributeIndex];
+}
+
+const std::vector&lt;VertexAttribute&gt; &amp;VertexArray::getVertexAttributes() const
+{
+    return mVertexAttributes;
+}
+
+void VertexArray::setVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+    ASSERT(index &lt; getMaxAttribs());
+    mVertexAttributes[index].divisor = divisor;
+    mVertexArray-&gt;setAttributeDivisor(index, divisor);
+}
+
+void VertexArray::enableAttribute(unsigned int attributeIndex, bool enabledState)
+{
+    ASSERT(attributeIndex &lt; getMaxAttribs());
+    mVertexAttributes[attributeIndex].enabled = enabledState;
+    mVertexArray-&gt;enableAttribute(attributeIndex, enabledState);
+
+    // Update state cache
+    if (enabledState)
+    {
+        mMaxEnabledAttribute = std::max(attributeIndex, mMaxEnabledAttribute);
+    }
+    else if (mMaxEnabledAttribute == attributeIndex)
+    {
+        while (mMaxEnabledAttribute &gt; 0 &amp;&amp; !mVertexAttributes[mMaxEnabledAttribute].enabled)
+        {
+            --mMaxEnabledAttribute;
+        }
+    }
+}
+
+void VertexArray::setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
+                                    bool normalized, bool pureInteger, GLsizei stride, const void *pointer)
+{
+    ASSERT(attributeIndex &lt; getMaxAttribs());
+    mVertexAttributes[attributeIndex].buffer.set(boundBuffer);
+    mVertexAttributes[attributeIndex].size = size;
+    mVertexAttributes[attributeIndex].type = type;
+    mVertexAttributes[attributeIndex].normalized = normalized;
+    mVertexAttributes[attributeIndex].pureInteger = pureInteger;
+    mVertexAttributes[attributeIndex].stride = stride;
+    mVertexAttributes[attributeIndex].pointer = pointer;
+    mVertexArray-&gt;setAttribute(attributeIndex, mVertexAttributes[attributeIndex]);
+}
+
+void VertexArray::setElementArrayBuffer(Buffer *buffer)
+{
+    mElementArrayBuffer.set(buffer);
+    mVertexArray-&gt;setElementArrayBuffer(buffer);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEVertexArrayh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexArray.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+//
+// Copyright (c) 2013 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 class contains prototypes for representing GLES 3 Vertex Array Objects:
+//
+//   The buffer objects that are to be used by the vertex stage of the GL are collected
+//   together to form a vertex array object. All state related to the definition of data used
+//   by the vertex processor is encapsulated in a vertex array object.
+//
+
+#ifndef LIBANGLE_VERTEXARRAY_H_
+#define LIBANGLE_VERTEXARRAY_H_
+
+#include &quot;libANGLE/RefCountObject.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+
+#include &lt;vector&gt;
+
+namespace rx
+{
+class VertexArrayImpl;
+}
+
+namespace gl
+{
+class Buffer;
+
+class VertexArray
+{
+  public:
+    VertexArray(rx::VertexArrayImpl *impl, GLuint id, size_t maxAttribs);
+    ~VertexArray();
+
+    GLuint id() const;
+
+    const VertexAttribute&amp; getVertexAttribute(size_t attributeIndex) const;
+    const std::vector&lt;VertexAttribute&gt; &amp;getVertexAttributes() const;
+
+    void detachBuffer(GLuint bufferName);
+    void setVertexAttribDivisor(GLuint index, GLuint divisor);
+    void enableAttribute(unsigned int attributeIndex, bool enabledState);
+    void setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
+                           bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
+
+    Buffer *getElementArrayBuffer() const { return mElementArrayBuffer.get(); }
+    void setElementArrayBuffer(Buffer *buffer);
+    GLuint getElementArrayBufferId() const { return mElementArrayBuffer.id(); }
+    size_t getMaxAttribs() const { return mVertexAttributes.size(); }
+
+    rx::VertexArrayImpl *getImplementation() { return mVertexArray; }
+    const rx::VertexArrayImpl *getImplementation() const { return mVertexArray; }
+
+    unsigned int getMaxEnabledAttribute() const { return mMaxEnabledAttribute; }
+
+  private:
+    GLuint mId;
+
+    rx::VertexArrayImpl *mVertexArray;
+    std::vector&lt;VertexAttribute&gt; mVertexAttributes;
+    BindingPointer&lt;Buffer&gt; mElementArrayBuffer;
+    unsigned int mMaxEnabledAttribute;
+};
+
+}
+
+#endif // LIBANGLE_VERTEXARRAY_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEVertexAttributecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+// Implementation of the state class for mananging GLES 3 Vertex Array Objects.
+//
+
+#include &quot;libANGLE/VertexAttribute.h&quot;
+
+namespace gl
+{
+
+VertexAttribute::VertexAttribute()
+    : enabled(false),
+      type(GL_FLOAT),
+      size(4),
+      normalized(false),
+      pureInteger(false),
+      stride(0),
+      pointer(NULL),
+      divisor(0)
+{
+}
+
+bool operator==(const VertexAttribute &amp;a, const VertexAttribute &amp;b)
+{
+    return a.enabled == b.enabled &amp;&amp;
+           a.type == b.type &amp;&amp;
+           a.size == b.size &amp;&amp;
+           a.normalized == b.normalized &amp;&amp;
+           a.pureInteger == b.pureInteger &amp;&amp;
+           a.stride == b.stride &amp;&amp;
+           a.pointer == b.pointer &amp;&amp;
+           a.buffer.get() == b.buffer.get() &amp;&amp;
+           a.divisor == b.divisor;
+}
+
+bool operator!=(const VertexAttribute &amp;a, const VertexAttribute &amp;b)
+{
+    return !(a == b);
+}
+
+size_t ComputeVertexAttributeTypeSize(const VertexAttribute&amp; attrib)
+{
+    GLuint size = attrib.size;
+    switch (attrib.type)
+    {
+      case GL_BYTE:                        return size * sizeof(GLbyte);
+      case GL_UNSIGNED_BYTE:               return size * sizeof(GLubyte);
+      case GL_SHORT:                       return size * sizeof(GLshort);
+      case GL_UNSIGNED_SHORT:              return size * sizeof(GLushort);
+      case GL_INT:                         return size * sizeof(GLint);
+      case GL_UNSIGNED_INT:                return size * sizeof(GLuint);
+      case GL_INT_2_10_10_10_REV:          return 4;
+      case GL_UNSIGNED_INT_2_10_10_10_REV: return 4;
+      case GL_FIXED:                       return size * sizeof(GLfixed);
+      case GL_HALF_FLOAT:                  return size * sizeof(GLhalf);
+      case GL_FLOAT:                       return size * sizeof(GLfloat);
+      default: UNREACHABLE();              return size * sizeof(GLfloat);
+    }
+}
+
+size_t ComputeVertexAttributeStride(const VertexAttribute&amp; attrib)
+{
+    if (!attrib.enabled)
+    {
+        return 16;
+    }
+    return attrib.stride ? attrib.stride : ComputeVertexAttributeTypeSize(attrib);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEVertexAttributeh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/VertexAttribute.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+// Helper structure describing a single vertex attribute
+//
+
+#ifndef LIBANGLE_VERTEXATTRIBUTE_H_
+#define LIBANGLE_VERTEXATTRIBUTE_H_
+
+#include &quot;libANGLE/Buffer.h&quot;
+
+namespace gl
+{
+
+struct VertexAttribute
+{
+    bool enabled; // From glEnable/DisableVertexAttribArray
+
+    GLenum type;
+    GLuint size;
+    bool normalized;
+    bool pureInteger;
+    GLuint stride; // 0 means natural stride
+
+    union
+    {
+        const GLvoid *pointer;
+        GLintptr offset;
+    };
+    BindingPointer&lt;Buffer&gt; buffer; // Captured when glVertexAttribPointer is called.
+
+    GLuint divisor;
+
+    VertexAttribute();
+};
+
+bool operator==(const VertexAttribute &amp;a, const VertexAttribute &amp;b);
+bool operator!=(const VertexAttribute &amp;a, const VertexAttribute &amp;b);
+
+template &lt;typename T&gt;
+T QuerySingleVertexAttributeParameter(const VertexAttribute&amp; attrib, GLenum pname)
+{
+  switch (pname)
+  {
+    case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+      return static_cast&lt;T&gt;(attrib.enabled ? GL_TRUE : GL_FALSE);
+    case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+      return static_cast&lt;T&gt;(attrib.size);
+    case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+      return static_cast&lt;T&gt;(attrib.stride);
+    case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+      return static_cast&lt;T&gt;(attrib.type);
+    case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+      return static_cast&lt;T&gt;(attrib.normalized ? GL_TRUE : GL_FALSE);
+    case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+      return static_cast&lt;T&gt;(attrib.buffer.id());
+    case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+      return static_cast&lt;T&gt;(attrib.divisor);
+    case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+      return static_cast&lt;T&gt;(attrib.pureInteger ? GL_TRUE : GL_FALSE);
+    default:
+      UNREACHABLE();
+      return static_cast&lt;T&gt;(0);
+  }
+}
+
+size_t ComputeVertexAttributeTypeSize(const VertexAttribute&amp; attrib);
+size_t ComputeVertexAttributeStride(const VertexAttribute&amp; attrib);
+
+struct VertexAttribCurrentValueData
+{
+    union
+    {
+        GLfloat FloatValues[4];
+        GLint IntValues[4];
+        GLuint UnsignedIntValues[4];
+    };
+    GLenum Type;
+
+    void setFloatValues(const GLfloat floatValues[4])
+    {
+        for (unsigned int valueIndex = 0; valueIndex &lt; 4; valueIndex++)
+        {
+            FloatValues[valueIndex] = floatValues[valueIndex];
+        }
+        Type = GL_FLOAT;
+    }
+
+    void setIntValues(const GLint intValues[4])
+    {
+        for (unsigned int valueIndex = 0; valueIndex &lt; 4; valueIndex++)
+        {
+            IntValues[valueIndex] = intValues[valueIndex];
+        }
+        Type = GL_INT;
+    }
+
+    void setUnsignedIntValues(const GLuint unsignedIntValues[4])
+    {
+        for (unsigned int valueIndex = 0; valueIndex &lt; 4; valueIndex++)
+        {
+            UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
+        }
+        Type = GL_UNSIGNED_INT;
+    }
+
+    bool operator==(const VertexAttribCurrentValueData &amp;other)
+    {
+        return (Type == other.Type &amp;&amp; memcmp(FloatValues, other.FloatValues, sizeof(float) * 4) == 0);
+    }
+
+    bool operator!=(const VertexAttribCurrentValueData &amp;other)
+    {
+        return !(*this == other);
+    }
+};
+
+}
+
+#endif // LIBANGLE_VERTEXATTRIBUTE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEangletypescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,246 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// angletypes.h : Defines a variety of structures and enum types that are used throughout libGLESv2
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;libANGLE/State.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+
+namespace gl
+{
+
+bool operator==(const Rectangle &amp;a, const Rectangle &amp;b)
+{
+    return a.x == b.x &amp;&amp;
+           a.y == b.y &amp;&amp;
+           a.width == b.width &amp;&amp;
+           a.height == b.height;
+}
+
+bool operator!=(const Rectangle &amp;a, const Rectangle &amp;b)
+{
+    return !(a == b);
+}
+
+SamplerState::SamplerState()
+    : minFilter(GL_NEAREST_MIPMAP_LINEAR),
+      magFilter(GL_LINEAR),
+      wrapS(GL_REPEAT),
+      wrapT(GL_REPEAT),
+      wrapR(GL_REPEAT),
+      maxAnisotropy(1.0f),
+      baseLevel(0),
+      maxLevel(1000),
+      minLod(-1000.0f),
+      maxLod(1000.0f),
+      compareMode(GL_NONE),
+      compareFunc(GL_LEQUAL),
+      swizzleRed(GL_RED),
+      swizzleGreen(GL_GREEN),
+      swizzleBlue(GL_BLUE),
+      swizzleAlpha(GL_ALPHA)
+{}
+
+bool SamplerState::swizzleRequired() const
+{
+    return swizzleRed != GL_RED || swizzleGreen != GL_GREEN ||
+           swizzleBlue != GL_BLUE || swizzleAlpha != GL_ALPHA;
+}
+
+bool SamplerState::operator==(const SamplerState &amp;other) const
+{
+    return minFilter == other.minFilter &amp;&amp;
+           magFilter == other.magFilter &amp;&amp;
+           wrapS == other.wrapS &amp;&amp;
+           wrapT == other.wrapT &amp;&amp;
+           wrapR == other.wrapR &amp;&amp;
+           maxAnisotropy == other.maxAnisotropy &amp;&amp;
+           baseLevel == other.baseLevel &amp;&amp;
+           maxLevel == other.maxLevel &amp;&amp;
+           minLod == other.minLod &amp;&amp;
+           maxLod == other.maxLod &amp;&amp;
+           compareMode == other.compareMode &amp;&amp;
+           compareFunc == other.compareFunc &amp;&amp;
+           swizzleRed == other.swizzleRed &amp;&amp;
+           swizzleGreen == other.swizzleGreen &amp;&amp;
+           swizzleBlue == other.swizzleBlue &amp;&amp;
+           swizzleAlpha == other.swizzleAlpha;
+}
+
+bool SamplerState::operator!=(const SamplerState &amp;other) const
+{
+    return !(*this == other);
+}
+
+static void MinMax(int a, int b, int *minimum, int *maximum)
+{
+    if (a &lt; b)
+    {
+        *minimum = a;
+        *maximum = b;
+    }
+    else
+    {
+        *minimum = b;
+        *maximum = a;
+    }
+}
+
+bool ClipRectangle(const Rectangle &amp;source, const Rectangle &amp;clip, Rectangle *intersection)
+{
+    int minSourceX, maxSourceX, minSourceY, maxSourceY;
+    MinMax(source.x, source.x + source.width, &amp;minSourceX, &amp;maxSourceX);
+    MinMax(source.y, source.y + source.height, &amp;minSourceY, &amp;maxSourceY);
+
+    int minClipX, maxClipX, minClipY, maxClipY;
+    MinMax(clip.x, clip.x + clip.width, &amp;minClipX, &amp;maxClipX);
+    MinMax(clip.y, clip.y + clip.height, &amp;minClipY, &amp;maxClipY);
+
+    if (minSourceX &gt;= maxClipX || maxSourceX &lt;= minClipX || minSourceY &gt;= maxClipY || maxSourceY &lt;= minClipY)
+    {
+        if (intersection)
+        {
+            intersection-&gt;x = minSourceX;
+            intersection-&gt;y = maxSourceY;
+            intersection-&gt;width = maxSourceX - minSourceX;
+            intersection-&gt;height = maxSourceY - minSourceY;
+        }
+
+        return false;
+    }
+    else
+    {
+        if (intersection)
+        {
+            intersection-&gt;x = std::max(minSourceX, minClipX);
+            intersection-&gt;y = std::max(minSourceY, minClipY);
+            intersection-&gt;width  = std::min(maxSourceX, maxClipX) - std::max(minSourceX, minClipX);
+            intersection-&gt;height = std::min(maxSourceY, maxClipY) - std::max(minSourceY, minClipY);
+        }
+
+        return true;
+    }
+}
+
+VertexFormat::VertexFormat()
+    : mType(GL_NONE),
+      mNormalized(GL_FALSE),
+      mComponents(0),
+      mPureInteger(false)
+{}
+
+VertexFormat::VertexFormat(GLenum type, GLboolean normalized, GLuint components, bool pureInteger)
+    : mType(type),
+      mNormalized(normalized),
+      mComponents(components),
+      mPureInteger(pureInteger)
+{
+    // Float data can not be normalized, so ignore the user setting
+    if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
+    {
+        mNormalized = GL_FALSE;
+    }
+}
+
+VertexFormat::VertexFormat(const VertexAttribute &amp;attrib)
+    : mType(attrib.type),
+      mNormalized(attrib.normalized ? GL_TRUE : GL_FALSE),
+      mComponents(attrib.size),
+      mPureInteger(attrib.pureInteger)
+{
+    // Ensure we aren't initializing a vertex format which should be using
+    // the current-value type
+    ASSERT(attrib.enabled);
+
+    // Float data can not be normalized, so ignore the user setting
+    if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
+    {
+        mNormalized = GL_FALSE;
+    }
+}
+
+VertexFormat::VertexFormat(const VertexAttribute &amp;attrib, GLenum currentValueType)
+    : mType(attrib.type),
+      mNormalized(attrib.normalized ? GL_TRUE : GL_FALSE),
+      mComponents(attrib.size),
+      mPureInteger(attrib.pureInteger)
+{
+    if (!attrib.enabled)
+    {
+        mType = currentValueType;
+        mNormalized = GL_FALSE;
+        mComponents = 4;
+        mPureInteger = (currentValueType != GL_FLOAT);
+    }
+
+    // Float data can not be normalized, so ignore the user setting
+    if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
+    {
+        mNormalized = GL_FALSE;
+    }
+}
+
+void VertexFormat::GetInputLayout(VertexFormat *inputLayout,
+                                  Program *program,
+                                  const State &amp;state)
+{
+    const std::vector&lt;VertexAttribute&gt; &amp;vertexAttributes = state.getVertexArray()-&gt;getVertexAttributes();
+    for (unsigned int attributeIndex = 0; attributeIndex &lt; vertexAttributes.size(); attributeIndex++)
+    {
+        int semanticIndex = program-&gt;getSemanticIndex(attributeIndex);
+
+        if (semanticIndex != -1)
+        {
+            inputLayout[semanticIndex] = VertexFormat(vertexAttributes[attributeIndex], state.getVertexAttribCurrentValue(attributeIndex).Type);
+        }
+    }
+}
+
+bool VertexFormat::operator==(const VertexFormat &amp;other) const
+{
+    return (mType == other.mType                &amp;&amp;
+            mComponents == other.mComponents    &amp;&amp;
+            mNormalized == other.mNormalized    &amp;&amp;
+            mPureInteger == other.mPureInteger  );
+}
+
+bool VertexFormat::operator!=(const VertexFormat &amp;other) const
+{
+    return !(*this == other);
+}
+
+bool VertexFormat::operator&lt;(const VertexFormat&amp; other) const
+{
+    if (mType != other.mType)
+    {
+        return mType &lt; other.mType;
+    }
+    if (mNormalized != other.mNormalized)
+    {
+        return mNormalized &lt; other.mNormalized;
+    }
+    if (mComponents != other.mComponents)
+    {
+        return mComponents &lt; other.mComponents;
+    }
+    return mPureInteger &lt; other.mPureInteger;
+}
+
+bool Box::operator==(const Box &amp;other) const
+{
+    return (x == other.x &amp;&amp; y == other.y &amp;&amp; z == other.z &amp;&amp;
+            width == other.width &amp;&amp; height == other.height &amp;&amp; depth == other.depth);
+}
+
+bool Box::operator!=(const Box &amp;other) const
+{
+    return !(*this == other);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEangletypesh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/angletypes.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,340 @@
</span><ins>+//
+// Copyright (c) 2012-2013 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.
+//
+
+// angletypes.h : Defines a variety of structures and enum types that are used throughout libGLESv2
+
+#ifndef LIBANGLE_ANGLETYPES_H_
+#define LIBANGLE_ANGLETYPES_H_
+
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/RefCountObject.h&quot;
+
+#include &lt;stdint.h&gt;
+
+namespace gl
+{
+class Buffer;
+class State;
+class Program;
+struct VertexAttribute;
+struct VertexAttribCurrentValueData;
+
+enum SamplerType
+{
+    SAMPLER_PIXEL,
+    SAMPLER_VERTEX
+};
+
+template &lt;typename T&gt;
+struct Color
+{
+    T red;
+    T green;
+    T blue;
+    T alpha;
+
+    Color() : red(0), green(0), blue(0), alpha(0) { }
+    Color(T r, T g, T b, T a) : red(r), green(g), blue(b), alpha(a) { }
+};
+
+template &lt;typename T&gt;
+bool operator==(const Color&lt;T&gt; &amp;a, const Color&lt;T&gt; &amp;b)
+{
+    return a.red == b.red &amp;&amp;
+           a.green == b.green &amp;&amp;
+           a.blue == b.blue &amp;&amp;
+           a.alpha == b.alpha;
+}
+
+template &lt;typename T&gt;
+bool operator!=(const Color&lt;T&gt; &amp;a, const Color&lt;T&gt; &amp;b)
+{
+    return !(a == b);
+}
+
+typedef Color&lt;float&gt; ColorF;
+typedef Color&lt;int&gt; ColorI;
+typedef Color&lt;unsigned int&gt; ColorUI;
+
+struct Rectangle
+{
+    int x;
+    int y;
+    int width;
+    int height;
+
+    Rectangle() : x(0), y(0), width(0), height(0) { }
+    Rectangle(int x_in, int y_in, int width_in, int height_in) : x(x_in), y(y_in), width(width_in), height(height_in) { }
+};
+
+bool operator==(const Rectangle &amp;a, const Rectangle &amp;b);
+bool operator!=(const Rectangle &amp;a, const Rectangle &amp;b);
+
+bool ClipRectangle(const Rectangle &amp;source, const Rectangle &amp;clip, Rectangle *intersection);
+
+struct Offset
+{
+    int x;
+    int y;
+    int z;
+
+    Offset() : x(0), y(0), z(0) { }
+    Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) { }
+};
+
+struct Extents
+{
+    int width;
+    int height;
+    int depth;
+
+    Extents() : width(0), height(0), depth(0) { }
+    Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) { }
+
+    bool empty() const { return (width * height * depth) == 0; }
+};
+
+struct Box
+{
+    int x;
+    int y;
+    int z;
+    int width;
+    int height;
+    int depth;
+
+    Box() : x(0), y(0), z(0), width(0), height(0), depth(0) { }
+    Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in) : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in) { }
+    Box(const Offset &amp;offset, const Extents &amp;size) : x(offset.x), y(offset.y), z(offset.z), width(size.width), height(size.height), depth(size.depth) { }
+    bool operator==(const Box &amp;other) const;
+    bool operator!=(const Box &amp;other) const;
+};
+
+
+struct RasterizerState
+{
+    bool cullFace;
+    GLenum cullMode;
+    GLenum frontFace;
+
+    bool polygonOffsetFill;
+    GLfloat polygonOffsetFactor;
+    GLfloat polygonOffsetUnits;
+
+    bool pointDrawMode;
+    bool multiSample;
+
+    bool rasterizerDiscard;
+};
+
+struct BlendState
+{
+    bool blend;
+    GLenum sourceBlendRGB;
+    GLenum destBlendRGB;
+    GLenum sourceBlendAlpha;
+    GLenum destBlendAlpha;
+    GLenum blendEquationRGB;
+    GLenum blendEquationAlpha;
+
+    bool colorMaskRed;
+    bool colorMaskGreen;
+    bool colorMaskBlue;
+    bool colorMaskAlpha;
+
+    bool sampleAlphaToCoverage;
+
+    bool dither;
+};
+
+struct DepthStencilState
+{
+    bool depthTest;
+    GLenum depthFunc;
+    bool depthMask;
+
+    bool stencilTest;
+    GLenum stencilFunc;
+    GLuint stencilMask;
+    GLenum stencilFail;
+    GLenum stencilPassDepthFail;
+    GLenum stencilPassDepthPass;
+    GLuint stencilWritemask;
+    GLenum stencilBackFunc;
+    GLuint stencilBackMask;
+    GLenum stencilBackFail;
+    GLenum stencilBackPassDepthFail;
+    GLenum stencilBackPassDepthPass;
+    GLuint stencilBackWritemask;
+};
+
+struct SamplerState
+{
+    SamplerState();
+
+    GLenum minFilter;
+    GLenum magFilter;
+    GLenum wrapS;
+    GLenum wrapT;
+    GLenum wrapR;
+    float maxAnisotropy;
+
+    GLint baseLevel;
+    GLint maxLevel;
+    GLfloat minLod;
+    GLfloat maxLod;
+
+    GLenum compareMode;
+    GLenum compareFunc;
+
+    GLenum swizzleRed;
+    GLenum swizzleGreen;
+    GLenum swizzleBlue;
+    GLenum swizzleAlpha;
+
+    bool swizzleRequired() const;
+
+    bool operator==(const SamplerState &amp;other) const;
+    bool operator!=(const SamplerState &amp;other) const;
+};
+
+struct PixelUnpackState
+{
+    BindingPointer&lt;Buffer&gt; pixelBuffer;
+    GLint alignment;
+    GLint rowLength;
+    GLint skipRows;
+    GLint skipPixels;
+    GLint imageHeight;
+    GLint skipImages;
+
+    PixelUnpackState()
+        : alignment(4),
+          rowLength(0),
+          skipRows(0),
+          skipPixels(0),
+          imageHeight(0),
+          skipImages(0)
+    {}
+
+    PixelUnpackState(GLint alignmentIn, GLint rowLengthIn)
+        : alignment(alignmentIn),
+          rowLength(rowLengthIn),
+          skipRows(0),
+          skipPixels(0),
+          imageHeight(0),
+          skipImages(0)
+    {}
+};
+
+struct PixelPackState
+{
+    BindingPointer&lt;Buffer&gt; pixelBuffer;
+    GLint alignment;
+    bool reverseRowOrder;
+    GLint rowLength;
+    GLint skipRows;
+    GLint skipPixels;
+
+    PixelPackState()
+        : alignment(4),
+          reverseRowOrder(false),
+          rowLength(0),
+          skipRows(0),
+          skipPixels(0)
+    {}
+
+    explicit PixelPackState(GLint alignmentIn, bool reverseRowOrderIn)
+        : alignment(alignmentIn),
+          reverseRowOrder(reverseRowOrderIn),
+          rowLength(0),
+          skipRows(0),
+          skipPixels(0)
+    {}
+};
+
+struct VertexFormat
+{
+    GLenum      mType;
+    GLboolean   mNormalized;
+    GLuint      mComponents;
+    bool        mPureInteger;
+
+    VertexFormat();
+    VertexFormat(GLenum type, GLboolean normalized, GLuint components, bool pureInteger);
+    explicit VertexFormat(const VertexAttribute &amp;attribute);
+    VertexFormat(const VertexAttribute &amp;attribute, GLenum currentValueType);
+
+    static void GetInputLayout(VertexFormat *inputLayout,
+                               Program *program,
+                               const State&amp; currentValues);
+
+    bool operator==(const VertexFormat &amp;other) const;
+    bool operator!=(const VertexFormat &amp;other) const;
+    bool operator&lt;(const VertexFormat&amp; other) const;
+};
+
+}
+
+namespace rx
+{
+
+enum VendorID : uint32_t
+{
+    VENDOR_ID_AMD = 0x1002,
+    VENDOR_ID_INTEL = 0x8086,
+    VENDOR_ID_NVIDIA = 0x10DE,
+};
+
+// A macro that determines whether an object has a given runtime type.
+#if defined(__clang__)
+#if __has_feature(cxx_rtti)
+#define ANGLE_HAS_DYNAMIC_CAST 1
+#endif
+#elif !defined(NDEBUG) &amp;&amp; (!defined(_MSC_VER) || defined(_CPPRTTI)) &amp;&amp; (!defined(__GNUC__) || __GNUC__ &lt; 4 || (__GNUC__ == 4 &amp;&amp; __GNUC_MINOR__ &lt; 3) || defined(__GXX_RTTI))
+#define ANGLE_HAS_DYNAMIC_CAST 1
+#endif
+
+#ifdef ANGLE_HAS_DYNAMIC_CAST
+#define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast&lt;type &gt;(obj) != nullptr)
+#undef ANGLE_HAS_DYNAMIC_CAST
+#else
+#define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (obj != nullptr)
+#endif
+
+// Downcast a base implementation object (EG TextureImpl to TextureD3D)
+template &lt;typename DestT, typename SrcT&gt;
+inline DestT *GetAs(SrcT *src)
+{
+    ASSERT(ANGLE_HAS_DYNAMIC_TYPE(DestT*, src));
+    return static_cast&lt;DestT*&gt;(src);
+}
+
+template &lt;typename DestT, typename SrcT&gt;
+inline const DestT *GetAs(const SrcT *src)
+{
+    ASSERT(ANGLE_HAS_DYNAMIC_TYPE(const DestT*, src));
+    return static_cast&lt;const DestT*&gt;(src);
+}
+
+#undef ANGLE_HAS_DYNAMIC_TYPE
+
+// Downcast a GL object to an Impl (EG gl::Texture to rx::TextureD3D)
+template &lt;typename DestT, typename SrcT&gt;
+inline DestT *GetImplAs(SrcT *src)
+{
+    return GetAs&lt;DestT&gt;(src-&gt;getImplementation());
+}
+
+template &lt;typename DestT, typename SrcT&gt;
+inline const DestT *GetImplAs(const SrcT *src)
+{
+    return GetAs&lt;const DestT&gt;(src-&gt;getImplementation());
+}
+
+}
+
+#endif // LIBANGLE_ANGLETYPES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEfeaturesh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/features.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/features.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/features.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+//
+// Copyright (c) 2014 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 LIBANGLE_FEATURES_H_
+#define LIBANGLE_FEATURES_H_
+
+#define ANGLE_DISABLED 0
+#define ANGLE_ENABLED 1
+
+// Feature defaults
+
+// Direct3D9EX
+// The &quot;Debug This Pixel...&quot; 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 &quot;ANGLE_D3D9EX=0&quot; in your project file.
+#if !defined(ANGLE_D3D9EX)
+#define ANGLE_D3D9EX ANGLE_ENABLED
+#endif
+
+// Vsync
+// ENABLED allows Vsync to be configured at runtime
+// DISABLED disallows Vsync
+#if !defined(ANGLE_VSYNC)
+#define ANGLE_VSYNC ANGLE_ENABLED
+#endif
+
+// Program binary loading
+#if !defined(ANGLE_PROGRAM_BINARY_LOAD)
+#define ANGLE_PROGRAM_BINARY_LOAD ANGLE_ENABLED
+#endif
+
+// Shader debug info
+#if !defined(ANGLE_SHADER_DEBUG_INFO)
+#define ANGLE_SHADER_DEBUG_INFO ANGLE_DISABLED
+#endif
+
+#endif // LIBANGLE_FEATURES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEformatutilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,650 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// formatutils.cpp: Queries for GL image formats.
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+namespace gl
+{
+
+// ES2 requires that format is equal to internal format at all glTex*Image2D entry points and the implementation
+// can decide the true, sized, internal format. The ES2FormatMap determines the internal format for all valid
+// format and type combinations.
+
+typedef std::pair&lt;GLenum, GLenum&gt; FormatTypePair;
+typedef std::pair&lt;FormatTypePair, GLenum&gt; FormatPair;
+typedef std::map&lt;FormatTypePair, GLenum&gt; FormatMap;
+
+// A helper function to insert data into the format map with fewer characters.
+static inline void InsertFormatMapping(FormatMap *map, GLenum format, GLenum type, GLenum internalFormat)
+{
+    map-&gt;insert(FormatPair(FormatTypePair(format, type), internalFormat));
+}
+
+FormatMap BuildFormatMap()
+{
+    FormatMap map;
+
+    //                       | Format               | Type                             | Internal format          |
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_BYTE,                  GL_RGBA8);
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_BYTE,                           GL_RGBA8_SNORM);
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_4_4_4_4,         GL_RGBA4);
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_5_5_5_1,         GL_RGB5_A1);
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_INT_2_10_10_10_REV,    GL_RGB10_A2);
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_FLOAT,                          GL_RGBA32F);
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_HALF_FLOAT,                     GL_RGBA16F);
+    InsertFormatMapping(&amp;map, GL_RGBA,               GL_HALF_FLOAT_OES,                 GL_RGBA16F);
+
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_BYTE,                  GL_RGBA8UI);
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_BYTE,                           GL_RGBA8I);
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_SHORT,                 GL_RGBA16UI);
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_SHORT,                          GL_RGBA16I);
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_INT,                   GL_RGBA32UI);
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_INT,                            GL_RGBA32I);
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_INT_2_10_10_10_REV,    GL_RGB10_A2UI);
+
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_BYTE,                  GL_RGB8);
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_BYTE,                           GL_RGB8_SNORM);
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_SHORT_5_6_5,           GL_RGB565);
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_INT_10F_11F_11F_REV,   GL_R11F_G11F_B10F);
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_INT_5_9_9_9_REV,       GL_RGB9_E5);
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_FLOAT,                          GL_RGB32F);
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_HALF_FLOAT,                     GL_RGB16F);
+    InsertFormatMapping(&amp;map, GL_RGB,                GL_HALF_FLOAT_OES,                 GL_RGB16F);
+
+    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_BYTE,                  GL_RGB8UI);
+    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_BYTE,                           GL_RGB8I);
+    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_SHORT,                 GL_RGB16UI);
+    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_SHORT,                          GL_RGB16I);
+    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_INT,                   GL_RGB32UI);
+    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_INT,                            GL_RGB32I);
+
+    InsertFormatMapping(&amp;map, GL_RG,                 GL_UNSIGNED_BYTE,                  GL_RG8);
+    InsertFormatMapping(&amp;map, GL_RG,                 GL_BYTE,                           GL_RG8_SNORM);
+    InsertFormatMapping(&amp;map, GL_RG,                 GL_FLOAT,                          GL_RG32F);
+    InsertFormatMapping(&amp;map, GL_RG,                 GL_HALF_FLOAT,                     GL_RG16F);
+    InsertFormatMapping(&amp;map, GL_RG,                 GL_HALF_FLOAT_OES,                 GL_RG16F);
+
+    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_BYTE,                  GL_RG8UI);
+    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_BYTE,                           GL_RG8I);
+    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_SHORT,                 GL_RG16UI);
+    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_SHORT,                          GL_RG16I);
+    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_INT,                   GL_RG32UI);
+    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_INT,                            GL_RG32I);
+
+    InsertFormatMapping(&amp;map, GL_RED,                GL_UNSIGNED_BYTE,                  GL_R8);
+    InsertFormatMapping(&amp;map, GL_RED,                GL_BYTE,                           GL_R8_SNORM);
+    InsertFormatMapping(&amp;map, GL_RED,                GL_FLOAT,                          GL_R32F);
+    InsertFormatMapping(&amp;map, GL_RED,                GL_HALF_FLOAT,                     GL_R16F);
+    InsertFormatMapping(&amp;map, GL_RED,                GL_HALF_FLOAT_OES,                 GL_R16F);
+
+    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_BYTE,                  GL_R8UI);
+    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_BYTE,                           GL_R8I);
+    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_SHORT,                 GL_R16UI);
+    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_SHORT,                          GL_R16I);
+    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_INT,                   GL_R32UI);
+    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_INT,                            GL_R32I);
+
+    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_UNSIGNED_BYTE,                  GL_LUMINANCE8_ALPHA8_EXT);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE,          GL_UNSIGNED_BYTE,                  GL_LUMINANCE8_EXT);
+    InsertFormatMapping(&amp;map, GL_ALPHA,              GL_UNSIGNED_BYTE,                  GL_ALPHA8_EXT);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_FLOAT,                          GL_LUMINANCE_ALPHA32F_EXT);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE,          GL_FLOAT,                          GL_LUMINANCE32F_EXT);
+    InsertFormatMapping(&amp;map, GL_ALPHA,              GL_FLOAT,                          GL_ALPHA32F_EXT);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_HALF_FLOAT,                     GL_LUMINANCE_ALPHA16F_EXT);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_HALF_FLOAT_OES,                 GL_LUMINANCE_ALPHA16F_EXT);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE,          GL_HALF_FLOAT,                     GL_LUMINANCE16F_EXT);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE,          GL_HALF_FLOAT_OES,                 GL_LUMINANCE16F_EXT);
+    InsertFormatMapping(&amp;map, GL_ALPHA,              GL_HALF_FLOAT,                     GL_ALPHA16F_EXT);
+    InsertFormatMapping(&amp;map, GL_ALPHA,              GL_HALF_FLOAT_OES,                 GL_ALPHA16F_EXT);
+
+    InsertFormatMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_BYTE,                  GL_BGRA8_EXT);
+    InsertFormatMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_BGRA4_ANGLEX);
+    InsertFormatMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_BGR5_A1_ANGLEX);
+
+    InsertFormatMapping(&amp;map, GL_SRGB_EXT,           GL_UNSIGNED_BYTE,                  GL_SRGB8);
+    InsertFormatMapping(&amp;map, GL_SRGB_ALPHA_EXT,     GL_UNSIGNED_BYTE,                  GL_SRGB8_ALPHA8);
+
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    GL_UNSIGNED_BYTE,     GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   GL_UNSIGNED_BYTE,     GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE,     GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE,     GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE);
+
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_UNSIGNED_SHORT,                 GL_DEPTH_COMPONENT16);
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_UNSIGNED_INT,                   GL_DEPTH_COMPONENT32_OES);
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_FLOAT,                          GL_DEPTH_COMPONENT32F);
+
+    InsertFormatMapping(&amp;map, GL_STENCIL,            GL_UNSIGNED_BYTE,                  GL_STENCIL_INDEX8);
+
+    InsertFormatMapping(&amp;map, GL_DEPTH_STENCIL,      GL_UNSIGNED_INT_24_8,              GL_DEPTH24_STENCIL8);
+    InsertFormatMapping(&amp;map, GL_DEPTH_STENCIL,      GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_DEPTH32F_STENCIL8);
+
+    return map;
+}
+
+Type::Type()
+    : bytes(0),
+      bytesShift(0),
+      specialInterpretation(false)
+{
+}
+
+static Type GenTypeInfo(GLuint bytes, bool specialInterpretation)
+{
+    Type info;
+    info.bytes = bytes;
+    GLuint i = 0;
+    while ((1u &lt;&lt; i) &lt; bytes)
+    {
+        ++i;
+    }
+    info.bytesShift = i;
+    ASSERT((1u &lt;&lt; info.bytesShift) == bytes);
+    info.specialInterpretation = specialInterpretation;
+    return info;
+}
+
+bool operator&lt;(const Type&amp; a, const Type&amp; b)
+{
+    return memcmp(&amp;a, &amp;b, sizeof(Type)) &lt; 0;
+}
+
+// Information about internal formats
+static bool AlwaysSupported(GLuint, const Extensions &amp;)
+{
+    return true;
+}
+
+static bool UnimplementedSupport(GLuint, const Extensions &amp;)
+{
+    return false;
+}
+
+static bool NeverSupported(GLuint, const Extensions &amp;)
+{
+    return false;
+}
+
+template &lt;GLuint minCoreGLVersion&gt;
+static bool RequireES(GLuint clientVersion, const Extensions &amp;)
+{
+    return clientVersion &gt;= minCoreGLVersion;
+}
+
+// Pointer to a boolean memeber of the Extensions struct
+typedef bool(Extensions::*ExtensionBool);
+
+// Check support for a single extension
+template &lt;ExtensionBool bool1&gt;
+static bool RequireExt(GLuint, const Extensions &amp; extensions)
+{
+    return extensions.*bool1;
+}
+
+// Check for a minimum client version or a single extension
+template &lt;GLuint minCoreGLVersion, ExtensionBool bool1&gt;
+static bool RequireESOrExt(GLuint clientVersion, const Extensions &amp;extensions)
+{
+    return clientVersion &gt;= minCoreGLVersion || extensions.*bool1;
+}
+
+// Check for a minimum client version or two extensions
+template &lt;GLuint minCoreGLVersion, ExtensionBool bool1, ExtensionBool bool2&gt;
+static bool RequireESOrExtAndExt(GLuint clientVersion, const Extensions &amp;extensions)
+{
+    return clientVersion &gt;= minCoreGLVersion || (extensions.*bool1 &amp;&amp; extensions.*bool2);
+}
+
+// Check for a minimum client version or at least one of two extensions
+template &lt;GLuint minCoreGLVersion, ExtensionBool bool1, ExtensionBool bool2&gt;
+static bool RequireESOrExtOrExt(GLuint clientVersion, const Extensions &amp;extensions)
+{
+    return clientVersion &gt;= minCoreGLVersion || extensions.*bool1 || extensions.*bool2;
+}
+
+// Check support for two extensions
+template &lt;ExtensionBool bool1, ExtensionBool bool2&gt;
+static bool RequireExtAndExt(GLuint, const Extensions &amp;extensions)
+{
+    return extensions.*bool1 &amp;&amp; extensions.*bool2;
+}
+
+InternalFormat::InternalFormat()
+    : redBits(0),
+      greenBits(0),
+      blueBits(0),
+      luminanceBits(0),
+      alphaBits(0),
+      sharedBits(0),
+      depthBits(0),
+      stencilBits(0),
+      pixelBytes(0),
+      componentCount(0),
+      compressedBlockWidth(0),
+      compressedBlockHeight(0),
+      format(GL_NONE),
+      type(GL_NONE),
+      componentType(GL_NONE),
+      colorEncoding(GL_NONE),
+      compressed(false),
+      textureSupport(NeverSupported),
+      renderSupport(NeverSupported),
+      filterSupport(NeverSupported)
+{
+}
+
+static InternalFormat UnsizedFormat(GLenum format, InternalFormat::SupportCheckFunction textureSupport,
+                                    InternalFormat::SupportCheckFunction renderSupport,
+                                    InternalFormat::SupportCheckFunction filterSupport)
+{
+    InternalFormat formatInfo;
+    formatInfo.format = format;
+    formatInfo.textureSupport = textureSupport;
+    formatInfo.renderSupport = renderSupport;
+    formatInfo.filterSupport = filterSupport;
+    return formatInfo;
+}
+
+static InternalFormat RGBAFormat(GLuint red, GLuint green, GLuint blue, GLuint alpha, GLuint shared,
+                                 GLenum format, GLenum type, GLenum componentType, bool srgb,
+                                 InternalFormat::SupportCheckFunction textureSupport,
+                                 InternalFormat::SupportCheckFunction renderSupport,
+                                 InternalFormat::SupportCheckFunction filterSupport)
+{
+    InternalFormat formatInfo;
+    formatInfo.redBits = red;
+    formatInfo.greenBits = green;
+    formatInfo.blueBits = blue;
+    formatInfo.alphaBits = alpha;
+    formatInfo.sharedBits = shared;
+    formatInfo.pixelBytes = (red + green + blue + alpha + shared) / 8;
+    formatInfo.componentCount = ((red &gt; 0) ? 1 : 0) + ((green &gt; 0) ? 1 : 0) + ((blue &gt; 0) ? 1 : 0) + ((alpha &gt; 0) ? 1 : 0);
+    formatInfo.format = format;
+    formatInfo.type = type;
+    formatInfo.componentType = componentType;
+    formatInfo.colorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
+    formatInfo.textureSupport = textureSupport;
+    formatInfo.renderSupport = renderSupport;
+    formatInfo.filterSupport = filterSupport;
+    return formatInfo;
+}
+
+static InternalFormat LUMAFormat(GLuint luminance, GLuint alpha, GLenum format, GLenum type, GLenum componentType,
+                                 InternalFormat::SupportCheckFunction textureSupport,
+                                 InternalFormat::SupportCheckFunction renderSupport,
+                                 InternalFormat::SupportCheckFunction filterSupport)
+{
+    InternalFormat formatInfo;
+    formatInfo.luminanceBits = luminance;
+    formatInfo.alphaBits = alpha;
+    formatInfo.pixelBytes = (luminance + alpha) / 8;
+    formatInfo.componentCount = ((luminance &gt; 0) ? 1 : 0) + ((alpha &gt; 0) ? 1 : 0);
+    formatInfo.format = format;
+    formatInfo.type = type;
+    formatInfo.componentType = componentType;
+    formatInfo.colorEncoding = GL_LINEAR;
+    formatInfo.textureSupport = textureSupport;
+    formatInfo.renderSupport = renderSupport;
+    formatInfo.filterSupport = filterSupport;
+    return formatInfo;
+}
+
+static InternalFormat DepthStencilFormat(GLuint depthBits, GLuint stencilBits, GLuint unusedBits, GLenum format,
+                                         GLenum type, GLenum componentType, InternalFormat::SupportCheckFunction textureSupport,
+                                         InternalFormat::SupportCheckFunction renderSupport,
+                                         InternalFormat::SupportCheckFunction filterSupport)
+{
+    InternalFormat formatInfo;
+    formatInfo.depthBits = depthBits;
+    formatInfo.stencilBits = stencilBits;
+    formatInfo.pixelBytes = (depthBits + stencilBits + unusedBits) / 8;
+    formatInfo.componentCount = ((depthBits &gt; 0) ? 1 : 0) + ((stencilBits &gt; 0) ? 1 : 0);
+    formatInfo.format = format;
+    formatInfo.type = type;
+    formatInfo.componentType = componentType;
+    formatInfo.colorEncoding = GL_LINEAR;
+    formatInfo.textureSupport = textureSupport;
+    formatInfo.renderSupport = renderSupport;
+    formatInfo.filterSupport = filterSupport;
+    return formatInfo;
+}
+
+static InternalFormat CompressedFormat(GLuint compressedBlockWidth, GLuint compressedBlockHeight, GLuint compressedBlockSize,
+                                       GLuint componentCount, GLenum format, GLenum type, bool srgb,
+                                       InternalFormat::SupportCheckFunction textureSupport,
+                                       InternalFormat::SupportCheckFunction renderSupport,
+                                       InternalFormat::SupportCheckFunction filterSupport)
+{
+    InternalFormat formatInfo;
+    formatInfo.compressedBlockWidth = compressedBlockWidth;
+    formatInfo.compressedBlockHeight = compressedBlockHeight;
+    formatInfo.pixelBytes = compressedBlockSize / 8;
+    formatInfo.componentCount = componentCount;
+    formatInfo.format = format;
+    formatInfo.type = type;
+    formatInfo.componentType = GL_UNSIGNED_NORMALIZED;
+    formatInfo.colorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
+    formatInfo.compressed = true;
+    formatInfo.textureSupport = textureSupport;
+    formatInfo.renderSupport = renderSupport;
+    formatInfo.filterSupport = filterSupport;
+    return formatInfo;
+}
+
+typedef std::pair&lt;GLenum, InternalFormat&gt; InternalFormatInfoPair;
+typedef std::map&lt;GLenum, InternalFormat&gt; InternalFormatInfoMap;
+
+static InternalFormatInfoMap BuildInternalFormatInfoMap()
+{
+    InternalFormatInfoMap map;
+
+    // From ES 3.0.1 spec, table 3.12
+    map.insert(InternalFormatInfoPair(GL_NONE,              InternalFormat()));
+
+    //                               | Internal format     |          | R | G | B | A |S | Format         | Type                           | Component type        | SRGB | Texture supported                        | Renderable                               | Filterable    |
+    map.insert(InternalFormatInfoPair(GL_R8,                RGBAFormat( 8,  0,  0,  0, 0, GL_RED,          GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, RequireESOrExt&lt;3, &amp;Extensions::textureRG&gt;, RequireESOrExt&lt;3, &amp;Extensions::textureRG&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_R8_SNORM,          RGBAFormat( 8,  0,  0,  0, 0, GL_RED,          GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, RequireES&lt;3&gt;,                              NeverSupported,                            AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG8,               RGBAFormat( 8,  8,  0,  0, 0, GL_RG,           GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, RequireESOrExt&lt;3, &amp;Extensions::textureRG&gt;, RequireESOrExt&lt;3, &amp;Extensions::textureRG&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG8_SNORM,         RGBAFormat( 8,  8,  0,  0, 0, GL_RG,           GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, RequireES&lt;3&gt;,                              NeverSupported,                            AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB8,              RGBAFormat( 8,  8,  8,  0, 0, GL_RGB,          GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, RequireESOrExt&lt;3, &amp;Extensions::rgb8rgba8&gt;, RequireESOrExt&lt;3, &amp;Extensions::rgb8rgba8&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB8_SNORM,        RGBAFormat( 8,  8,  8,  0, 0, GL_RGB,          GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, RequireES&lt;3&gt;,                              NeverSupported,                            AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB565,            RGBAFormat( 5,  6,  5,  0, 0, GL_RGB,          GL_UNSIGNED_SHORT_5_6_5,         GL_UNSIGNED_NORMALIZED, false, RequireES&lt;2&gt;,                              RequireES&lt;2&gt;,                              AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA4,             RGBAFormat( 4,  4,  4,  4, 0, GL_RGBA,         GL_UNSIGNED_SHORT_4_4_4_4,       GL_UNSIGNED_NORMALIZED, false, RequireES&lt;2&gt;,                              RequireES&lt;2&gt;,                              AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB5_A1,           RGBAFormat( 5,  5,  5,  1, 0, GL_RGBA,         GL_UNSIGNED_SHORT_5_5_5_1,       GL_UNSIGNED_NORMALIZED, false, RequireES&lt;2&gt;,                              RequireES&lt;2&gt;,                              AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA8,             RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA,         GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, RequireESOrExt&lt;3, &amp;Extensions::rgb8rgba8&gt;, RequireESOrExt&lt;3, &amp;Extensions::rgb8rgba8&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA8_SNORM,       RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA,         GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, RequireES&lt;3&gt;,                              NeverSupported,                            AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB10_A2,          RGBAFormat(10, 10, 10,  2, 0, GL_RGBA,         GL_UNSIGNED_INT_2_10_10_10_REV,  GL_UNSIGNED_NORMALIZED, false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB10_A2UI,        RGBAFormat(10, 10, 10,  2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV,  GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              NeverSupported,                            NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_SRGB8,             RGBAFormat( 8,  8,  8,  0, 0, GL_RGB,          GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, true,  RequireESOrExt&lt;3, &amp;Extensions::sRGB&gt;,      NeverSupported,                            AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_SRGB8_ALPHA8,      RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA,         GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, true,  RequireESOrExt&lt;3, &amp;Extensions::sRGB&gt;,      RequireESOrExt&lt;3, &amp;Extensions::sRGB&gt;,      AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_R11F_G11F_B10F,    RGBAFormat(11, 11, 10,  0, 0, GL_RGB,          GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FLOAT,               false, RequireES&lt;3&gt;,                              RequireExt&lt;&amp;Extensions::colorBufferFloat&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB9_E5,           RGBAFormat( 9,  9,  9,  0, 5, GL_RGB,          GL_UNSIGNED_INT_5_9_9_9_REV,     GL_FLOAT,               false, RequireES&lt;3&gt;,                              NeverSupported,                            AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_R8I,               RGBAFormat( 8,  0,  0,  0, 0, GL_RED_INTEGER,  GL_BYTE,                         GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_R8UI,              RGBAFormat( 8,  0,  0,  0, 0, GL_RED_INTEGER,  GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_R16I,              RGBAFormat(16,  0,  0,  0, 0, GL_RED_INTEGER,  GL_SHORT,                        GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_R16UI,             RGBAFormat(16,  0,  0,  0, 0, GL_RED_INTEGER,  GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_R32I,              RGBAFormat(32,  0,  0,  0, 0, GL_RED_INTEGER,  GL_INT,                          GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_R32UI,             RGBAFormat(32,  0,  0,  0, 0, GL_RED_INTEGER,  GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG8I,              RGBAFormat( 8,  8,  0,  0, 0, GL_RG_INTEGER,   GL_BYTE,                         GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG8UI,             RGBAFormat( 8,  8,  0,  0, 0, GL_RG_INTEGER,   GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG16I,             RGBAFormat(16, 16,  0,  0, 0, GL_RG_INTEGER,   GL_SHORT,                        GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG16UI,            RGBAFormat(16, 16,  0,  0, 0, GL_RG_INTEGER,   GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG32I,             RGBAFormat(32, 32,  0,  0, 0, GL_RG_INTEGER,   GL_INT,                          GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG32UI,            RGBAFormat(32, 32,  0,  0, 0, GL_RG_INTEGER,   GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB8I,             RGBAFormat( 8,  8,  8,  0, 0, GL_RGB_INTEGER,  GL_BYTE,                         GL_INT,                 false, RequireES&lt;3&gt;,                              NeverSupported,                            NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB8UI,            RGBAFormat( 8,  8,  8,  0, 0, GL_RGB_INTEGER,  GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              NeverSupported,                            NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB16I,            RGBAFormat(16, 16, 16,  0, 0, GL_RGB_INTEGER,  GL_SHORT,                        GL_INT,                 false, RequireES&lt;3&gt;,                              NeverSupported,                            NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB16UI,           RGBAFormat(16, 16, 16,  0, 0, GL_RGB_INTEGER,  GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              NeverSupported,                            NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB32I,            RGBAFormat(32, 32, 32,  0, 0, GL_RGB_INTEGER,  GL_INT,                          GL_INT,                 false, RequireES&lt;3&gt;,                              NeverSupported,                            NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB32UI,           RGBAFormat(32, 32, 32,  0, 0, GL_RGB_INTEGER,  GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              NeverSupported,                            NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA8I,            RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA_INTEGER, GL_BYTE,                         GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA8UI,           RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA16I,           RGBAFormat(16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT,                        GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA16UI,          RGBAFormat(16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA32I,           RGBAFormat(32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT,                          GL_INT,                 false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA32UI,          RGBAFormat(32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, RequireES&lt;3&gt;,                              RequireES&lt;3&gt;,                              NeverSupported)));
+
+    map.insert(InternalFormatInfoPair(GL_BGRA8_EXT,         RGBAFormat( 8,  8,  8,  8, 0, GL_BGRA_EXT,     GL_UNSIGNED_BYTE,                  GL_UNSIGNED_NORMALIZED, false, RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;, RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_BGRA4_ANGLEX,      RGBAFormat( 4,  4,  4,  4, 0, GL_BGRA_EXT,     GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_UNSIGNED_NORMALIZED, false, RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;, RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_BGR5_A1_ANGLEX,    RGBAFormat( 5,  5,  5,  1, 0, GL_BGRA_EXT,     GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_UNSIGNED_NORMALIZED, false, RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;, RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;, AlwaysSupported)));
+
+    // Floating point renderability and filtering is provided by OES_texture_float and OES_texture_half_float
+    //                               | Internal format     |          | D |S | Format             | Type                                   | Comp   | SRGB |  Texture supported                                                             | Renderable                                                                    | Filterable                                    |
+    //                               |                     |          |   |  |                    |                                        | type   |      |                                                                                |                                                                               |                                               |
+    map.insert(InternalFormatInfoPair(GL_R16F,              RGBAFormat(16,  0,  0,  0, 0, GL_RED,          GL_HALF_FLOAT,                   GL_FLOAT, false, RequireESOrExtAndExt&lt;3, &amp;Extensions::textureHalfFloat, &amp;Extensions::textureRG&gt;, RequireESOrExtAndExt&lt;3, &amp;Extensions::textureHalfFloat, &amp;Extensions::textureRG&gt;, RequireExt&lt;&amp;Extensions::textureHalfFloatLinear&gt;)));
+    map.insert(InternalFormatInfoPair(GL_RG16F,             RGBAFormat(16, 16,  0,  0, 0, GL_RG,           GL_HALF_FLOAT,                   GL_FLOAT, false, RequireESOrExtAndExt&lt;3, &amp;Extensions::textureHalfFloat, &amp;Extensions::textureRG&gt;, RequireESOrExtAndExt&lt;3, &amp;Extensions::textureHalfFloat, &amp;Extensions::textureRG&gt;, RequireExt&lt;&amp;Extensions::textureHalfFloatLinear&gt;)));
+    map.insert(InternalFormatInfoPair(GL_RGB16F,            RGBAFormat(16, 16, 16,  0, 0, GL_RGB,          GL_HALF_FLOAT,                   GL_FLOAT, false, RequireESOrExt&lt;3, &amp;Extensions::textureHalfFloat&gt;,                               RequireESOrExt&lt;3, &amp;Extensions::textureHalfFloat&gt;,                               RequireExt&lt;&amp;Extensions::textureHalfFloatLinear&gt;)));
+    map.insert(InternalFormatInfoPair(GL_RGBA16F,           RGBAFormat(16, 16, 16, 16, 0, GL_RGBA,         GL_HALF_FLOAT,                   GL_FLOAT, false, RequireESOrExt&lt;3, &amp;Extensions::textureHalfFloat&gt;,                               RequireESOrExt&lt;3, &amp;Extensions::textureHalfFloat&gt;,                               RequireExt&lt;&amp;Extensions::textureHalfFloatLinear&gt;)));
+    map.insert(InternalFormatInfoPair(GL_R32F,              RGBAFormat(32,  0,  0,  0, 0, GL_RED,          GL_FLOAT,                        GL_FLOAT, false, RequireESOrExtAndExt&lt;3, &amp;Extensions::textureFloat, &amp;Extensions::textureRG&gt;,     RequireESOrExtAndExt&lt;3, &amp;Extensions::textureFloat, &amp;Extensions::textureRG&gt;,     RequireExt&lt;&amp;Extensions::textureFloatLinear&gt;    )));
+    map.insert(InternalFormatInfoPair(GL_RG32F,             RGBAFormat(32, 32,  0,  0, 0, GL_RG,           GL_FLOAT,                        GL_FLOAT, false, RequireESOrExtAndExt&lt;3, &amp;Extensions::textureFloat, &amp;Extensions::textureRG&gt;,     RequireESOrExtAndExt&lt;3, &amp;Extensions::textureFloat, &amp;Extensions::textureRG&gt;,     RequireExt&lt;&amp;Extensions::textureFloatLinear&gt;    )));
+    map.insert(InternalFormatInfoPair(GL_RGB32F,            RGBAFormat(32, 32, 32,  0, 0, GL_RGB,          GL_FLOAT,                        GL_FLOAT, false, RequireESOrExt&lt;3, &amp;Extensions::textureFloat&gt;,                                   RequireESOrExt&lt;3, &amp;Extensions::textureFloat&gt;,                                   RequireExt&lt;&amp;Extensions::textureFloatLinear&gt;    )));
+    map.insert(InternalFormatInfoPair(GL_RGBA32F,           RGBAFormat(32, 32, 32, 32, 0, GL_RGBA,         GL_FLOAT,                        GL_FLOAT, false, RequireESOrExt&lt;3, &amp;Extensions::textureFloat&gt;,                                   RequireESOrExt&lt;3, &amp;Extensions::textureFloat&gt;,                                   RequireExt&lt;&amp;Extensions::textureFloatLinear&gt;    )));
+
+    // Depth stencil formats
+    //                               | Internal format         |                  | D |S | X | Format            | Type                             | Component type        | Supported                                    | Renderable                                                                         | Filterable                                  |
+    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT16,     DepthStencilFormat(16, 0,  0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT,                 GL_UNSIGNED_NORMALIZED, RequireES&lt;2&gt;,                                  RequireES&lt;2&gt;,                                                                        RequireESOrExt&lt;3, &amp;Extensions::depthTextures&gt;)));
+    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT24,     DepthStencilFormat(24, 0,  0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,                   GL_UNSIGNED_NORMALIZED, RequireES&lt;3&gt;,                                  RequireES&lt;3&gt;,                                                                        RequireESOrExt&lt;3, &amp;Extensions::depthTextures&gt;)));
+    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32F,    DepthStencilFormat(32, 0,  0, GL_DEPTH_COMPONENT, GL_FLOAT,                          GL_FLOAT,               RequireES&lt;3&gt;,                                  RequireES&lt;3&gt;,                                                                        RequireESOrExt&lt;3, &amp;Extensions::depthTextures&gt;)));
+    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32_OES, DepthStencilFormat(32, 0,  0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,                   GL_UNSIGNED_NORMALIZED, RequireExt&lt;&amp;Extensions::depthTextures&gt;,        RequireExt&lt;&amp;Extensions::depthTextures&gt;,                                              AlwaysSupported                              )));
+    map.insert(InternalFormatInfoPair(GL_DEPTH24_STENCIL8,      DepthStencilFormat(24, 8,  0, GL_DEPTH_STENCIL,   GL_UNSIGNED_INT_24_8,              GL_UNSIGNED_NORMALIZED, RequireESOrExt&lt;3, &amp;Extensions::depthTextures&gt;, RequireESOrExtOrExt&lt;3, &amp;Extensions::depthTextures, &amp;Extensions::packedDepthStencil&gt;, AlwaysSupported                              )));
+    map.insert(InternalFormatInfoPair(GL_DEPTH32F_STENCIL8,     DepthStencilFormat(32, 8, 24, GL_DEPTH_STENCIL,   GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT,               RequireES&lt;3&gt;,                                  RequireES&lt;3&gt;,                                                                        AlwaysSupported                              )));
+    // STENCIL_INDEX8 is special-cased, see around the bottom of the list.
+
+    // Luminance alpha formats
+    //                               | Internal format          |          | L | A | Format            | Type            | Component type        | Supported                                                                    | Renderable    | Filterable    |
+    map.insert(InternalFormatInfoPair(GL_ALPHA8_EXT,             LUMAFormat( 0,  8, GL_ALPHA,           GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt&lt;&amp;Extensions::textureStorage&gt;,                                      NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE8_EXT,         LUMAFormat( 8,  0, GL_LUMINANCE,       GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt&lt;&amp;Extensions::textureStorage&gt;,                                      NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_ALPHA32F_EXT,           LUMAFormat( 0, 32, GL_ALPHA,           GL_FLOAT,         GL_FLOAT,               RequireExtAndExt&lt;&amp;Extensions::textureStorage, &amp;Extensions::textureFloat&gt;,     NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE32F_EXT,       LUMAFormat(32,  0, GL_LUMINANCE,       GL_FLOAT,         GL_FLOAT,               RequireExtAndExt&lt;&amp;Extensions::textureStorage, &amp;Extensions::textureFloat&gt;,     NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_ALPHA16F_EXT,           LUMAFormat( 0, 16, GL_ALPHA,           GL_HALF_FLOAT,    GL_FLOAT,               RequireExtAndExt&lt;&amp;Extensions::textureStorage, &amp;Extensions::textureHalfFloat&gt;, NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE16F_EXT,       LUMAFormat(16,  0, GL_LUMINANCE,       GL_HALF_FLOAT,    GL_FLOAT,               RequireExtAndExt&lt;&amp;Extensions::textureStorage, &amp;Extensions::textureHalfFloat&gt;, NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE8_ALPHA8_EXT,  LUMAFormat( 8,  8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt&lt;&amp;Extensions::textureStorage&gt;,                                      NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA32F_EXT, LUMAFormat(32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT,         GL_FLOAT,               RequireExtAndExt&lt;&amp;Extensions::textureStorage, &amp;Extensions::textureFloat&gt;,     NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA16F_EXT, LUMAFormat(16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT,    GL_FLOAT,               RequireExtAndExt&lt;&amp;Extensions::textureStorage, &amp;Extensions::textureHalfFloat&gt;, NeverSupported, AlwaysSupported)));
+
+    // Unsized formats
+    //                               | Internal format   |             | Format            | Supported                                         | Renderable                                        | Filterable    |
+    map.insert(InternalFormatInfoPair(GL_ALPHA,           UnsizedFormat(GL_ALPHA,           RequireES&lt;2&gt;,                                       NeverSupported,                                     AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE,       UnsizedFormat(GL_LUMINANCE,       RequireES&lt;2&gt;,                                       NeverSupported,                                     AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA, UnsizedFormat(GL_LUMINANCE_ALPHA, RequireES&lt;2&gt;,                                       NeverSupported,                                     AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RED,             UnsizedFormat(GL_RED,             RequireESOrExt&lt;3, &amp;Extensions::textureRG&gt;,          NeverSupported,                                     AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RG,              UnsizedFormat(GL_RG,              RequireESOrExt&lt;3, &amp;Extensions::textureRG&gt;,          NeverSupported,                                     AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGB,             UnsizedFormat(GL_RGB,             RequireES&lt;2&gt;,                                       RequireES&lt;2&gt;,                                       AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RGBA,            UnsizedFormat(GL_RGBA,            RequireES&lt;2&gt;,                                       RequireES&lt;2&gt;,                                       AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_RED_INTEGER,     UnsizedFormat(GL_RED_INTEGER,     RequireES&lt;3&gt;,                                       NeverSupported,                                     NeverSupported )));
+    map.insert(InternalFormatInfoPair(GL_RG_INTEGER,      UnsizedFormat(GL_RG_INTEGER,      RequireES&lt;3&gt;,                                       NeverSupported,                                     NeverSupported )));
+    map.insert(InternalFormatInfoPair(GL_RGB_INTEGER,     UnsizedFormat(GL_RGB_INTEGER,     RequireES&lt;3&gt;,                                       NeverSupported,                                     NeverSupported )));
+    map.insert(InternalFormatInfoPair(GL_RGBA_INTEGER,    UnsizedFormat(GL_RGBA_INTEGER,    RequireES&lt;3&gt;,                                       NeverSupported,                                     NeverSupported )));
+    map.insert(InternalFormatInfoPair(GL_BGRA_EXT,        UnsizedFormat(GL_BGRA_EXT,        RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;,     RequireExt&lt;&amp;Extensions::textureFormatBGRA8888&gt;,     AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT, UnsizedFormat(GL_DEPTH_COMPONENT, RequireES&lt;2&gt;,                                       RequireES&lt;2&gt;,                                       AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_DEPTH_STENCIL,   UnsizedFormat(GL_DEPTH_STENCIL,   RequireESOrExt&lt;3, &amp;Extensions::packedDepthStencil&gt;, RequireESOrExt&lt;3, &amp;Extensions::packedDepthStencil&gt;, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_SRGB_EXT,        UnsizedFormat(GL_RGB,             RequireESOrExt&lt;3, &amp;Extensions::sRGB&gt;,               NeverSupported,                                     AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_SRGB_ALPHA_EXT,  UnsizedFormat(GL_RGBA,            RequireESOrExt&lt;3, &amp;Extensions::sRGB&gt;,               RequireESOrExt&lt;3, &amp;Extensions::sRGB&gt;,               AlwaysSupported)));
+
+    // Compressed formats, From ES 3.0.1 spec, table 3.16
+    //                               | Internal format                             |                |W |H | BS |CC| Format                                      | Type            | SRGB | Supported          | Renderable           | Filterable         |
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_R11_EAC,                        CompressedFormat(4, 4,  64, 1, GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE, false, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_R11_EAC,                 CompressedFormat(4, 4,  64, 1, GL_COMPRESSED_SIGNED_R11_EAC,                 GL_UNSIGNED_BYTE, false, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RG11_EAC,                       CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_RG11_EAC,                       GL_UNSIGNED_BYTE, false, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_RG11_EAC,                CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_SIGNED_RG11_EAC,                GL_UNSIGNED_BYTE, false, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_ETC2,                      CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_RGB8_ETC2,                      GL_UNSIGNED_BYTE, false, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ETC2,                     CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_SRGB8_ETC2,                     GL_UNSIGNED_BYTE, true,  UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  GL_UNSIGNED_BYTE, false, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, true,  UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA8_ETC2_EAC,                 CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA8_ETC2_EAC,                 GL_UNSIGNED_BYTE, false, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          GL_UNSIGNED_BYTE, true,  UnimplementedSupport, UnimplementedSupport, UnimplementedSupport)));
+
+    // From GL_EXT_texture_compression_dxt1
+    //                               | Internal format                   |                |W |H | BS |CC| Format                            | Type            | SRGB | Supported                                      | Renderable    | Filterable    |
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    GL_UNSIGNED_BYTE, false, RequireExt&lt;&amp;Extensions::textureCompressionDXT1&gt;, NeverSupported, AlwaysSupported)));
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   CompressedFormat(4, 4,  64, 4, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   GL_UNSIGNED_BYTE, false, RequireExt&lt;&amp;Extensions::textureCompressionDXT1&gt;, NeverSupported, AlwaysSupported)));
+
+    // From GL_ANGLE_texture_compression_dxt3
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, false, RequireExt&lt;&amp;Extensions::textureCompressionDXT5&gt;, NeverSupported, AlwaysSupported)));
+
+    // From GL_ANGLE_texture_compression_dxt5
+    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, false, RequireExt&lt;&amp;Extensions::textureCompressionDXT5&gt;, NeverSupported, AlwaysSupported)));
+
+    // For STENCIL_INDEX8 we chose a normalized component type for the following reasons:
+    // - Multisampled buffer are disallowed for non-normalized integer component types and we want to support it for STENCIL_INDEX8
+    // - All other stencil formats (all depth-stencil) are either float or normalized
+    // - It affects only validation of internalformat in RenderbufferStorageMultisample.
+    //                               | Internal format  |                  |D |S |X | Format          | Type            | Component type        | Supported   | Renderable  | Filterable   |
+    map.insert(InternalFormatInfoPair(GL_STENCIL_INDEX8, DepthStencilFormat(0, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES&lt;2&gt;, RequireES&lt;2&gt;, NeverSupported)));
+
+    return map;
+}
+
+static const InternalFormatInfoMap &amp;GetInternalFormatMap()
+{
+    static const InternalFormatInfoMap formatMap = BuildInternalFormatInfoMap();
+    return formatMap;
+}
+
+static FormatSet BuildAllSizedInternalFormatSet()
+{
+    FormatSet result;
+
+    const InternalFormatInfoMap &amp;formats = GetInternalFormatMap();
+    for (InternalFormatInfoMap::const_iterator i = formats.begin(); i != formats.end(); i++)
+    {
+        if (i-&gt;second.pixelBytes &gt; 0)
+        {
+            result.insert(i-&gt;first);
+        }
+    }
+
+    return result;
+}
+
+const Type &amp;GetTypeInfo(GLenum type)
+{
+    switch (type)
+    {
+      case GL_UNSIGNED_BYTE:
+      case GL_BYTE:
+        {
+            static const Type info = GenTypeInfo(1, false);
+            return info;
+        }
+      case GL_UNSIGNED_SHORT:
+      case GL_SHORT:
+      case GL_HALF_FLOAT:
+      case GL_HALF_FLOAT_OES:
+        {
+            static const Type info = GenTypeInfo(2, false);
+            return info;
+        }
+      case GL_UNSIGNED_INT:
+      case GL_INT:
+      case GL_FLOAT:
+        {
+            static const Type info = GenTypeInfo(4, false);
+            return info;
+        }
+      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_4_4_4_4_REV_EXT:
+      case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT:
+        {
+            static const Type info = GenTypeInfo(2, true);
+            return info;
+        }
+      case GL_UNSIGNED_INT_2_10_10_10_REV:
+      case GL_UNSIGNED_INT_24_8:
+      case GL_UNSIGNED_INT_10F_11F_11F_REV:
+      case GL_UNSIGNED_INT_5_9_9_9_REV:
+        {
+            ASSERT(GL_UNSIGNED_INT_24_8_OES == GL_UNSIGNED_INT_24_8);
+            static const Type info = GenTypeInfo(4, true);
+            return info;
+        }
+      case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+        {
+            static const Type info = GenTypeInfo(8, true);
+            return info;
+        }
+      default:
+        {
+            static const Type defaultInfo;
+            return defaultInfo;
+        }
+    }
+}
+
+const InternalFormat &amp;GetInternalFormatInfo(GLenum internalFormat)
+{
+    const InternalFormatInfoMap &amp;formatMap = GetInternalFormatMap();
+    InternalFormatInfoMap::const_iterator iter = formatMap.find(internalFormat);
+    if (iter != formatMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        static const InternalFormat defaultInternalFormat;
+        return defaultInternalFormat;
+    }
+}
+
+GLuint InternalFormat::computeRowPitch(GLenum formatType, GLsizei width, GLint alignment, GLint rowLength) const
+{
+    ASSERT(alignment &gt; 0 &amp;&amp; isPow2(alignment));
+    GLuint rowBytes;
+    if (rowLength &gt; 0)
+    {
+        ASSERT(!compressed);
+        rowBytes = pixelBytes * rowLength;
+    }
+    else
+    {
+        rowBytes = computeBlockSize(formatType, width, 1);
+    }
+    return rx::roundUp(rowBytes, static_cast&lt;GLuint&gt;(alignment));
+}
+
+GLuint InternalFormat::computeDepthPitch(GLenum formatType, GLsizei width, GLsizei height, GLint alignment, GLint rowLength) const
+{
+    return computeRowPitch(formatType, width, alignment, rowLength) * height;
+}
+
+GLuint InternalFormat::computeBlockSize(GLenum formatType, GLsizei width, GLsizei height) const
+{
+    if (compressed)
+    {
+        GLsizei numBlocksWide = (width + compressedBlockWidth - 1) / compressedBlockWidth;
+        GLsizei numBlocksHight = (height + compressedBlockHeight - 1) / compressedBlockHeight;
+        return (pixelBytes * numBlocksWide * numBlocksHight);
+    }
+    else
+    {
+        const Type &amp;typeInfo = GetTypeInfo(formatType);
+        if (typeInfo.specialInterpretation)
+        {
+            return typeInfo.bytes * width * height;
+        }
+        else
+        {
+            return componentCount * typeInfo.bytes * width * height;
+        }
+    }
+}
+
+GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type)
+{
+    const InternalFormat&amp; formatInfo = GetInternalFormatInfo(internalFormat);
+    if (formatInfo.pixelBytes &gt; 0)
+    {
+        return internalFormat;
+    }
+    else
+    {
+        static const FormatMap formatMap = BuildFormatMap();
+        FormatMap::const_iterator iter = formatMap.find(FormatTypePair(internalFormat, type));
+        if (iter != formatMap.end())
+        {
+            return iter-&gt;second;
+        }
+        else
+        {
+            return GL_NONE;
+        }
+    }
+}
+
+const FormatSet &amp;GetAllSizedInternalFormats()
+{
+    static FormatSet formatSet = BuildAllSizedInternalFormatSet();
+    return formatSet;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEformatutilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/formatutils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// formatutils.h: Queries for GL image formats.
+
+#ifndef LIBANGLE_FORMATUTILS_H_
+#define LIBANGLE_FORMATUTILS_H_
+
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;cstddef&gt;
+#include &lt;stdint.h&gt;
+
+namespace gl
+{
+
+struct Type
+{
+    Type();
+
+    GLuint bytes;
+    GLuint bytesShift; // Bit shift by this value to effectively divide/multiply by &quot;bytes&quot; in a more optimal way
+    bool specialInterpretation;
+};
+const Type &amp;GetTypeInfo(GLenum type);
+
+struct InternalFormat
+{
+    InternalFormat();
+
+    GLuint redBits;
+    GLuint greenBits;
+    GLuint blueBits;
+
+    GLuint luminanceBits;
+
+    GLuint alphaBits;
+    GLuint sharedBits;
+
+    GLuint depthBits;
+    GLuint stencilBits;
+
+    GLuint pixelBytes;
+
+    GLuint componentCount;
+
+    bool compressed;
+    GLuint compressedBlockWidth;
+    GLuint compressedBlockHeight;
+
+    GLenum format;
+    GLenum type;
+
+    GLenum componentType;
+    GLenum colorEncoding;
+
+    typedef bool (*SupportCheckFunction)(GLuint, const Extensions &amp;);
+    SupportCheckFunction textureSupport;
+    SupportCheckFunction renderSupport;
+    SupportCheckFunction filterSupport;
+
+    GLuint computeRowPitch(GLenum formatType, GLsizei width, GLint alignment, GLint rowLength) const;
+    GLuint computeDepthPitch(GLenum formatType, GLsizei width, GLsizei height, GLint alignment, GLint rowLength) const;
+    GLuint computeBlockSize(GLenum formatType, GLsizei width, GLsizei height) const;
+};
+const InternalFormat &amp;GetInternalFormatInfo(GLenum internalFormat);
+
+GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type);
+
+typedef std::set&lt;GLenum&gt; FormatSet;
+const FormatSet &amp;GetAllSizedInternalFormats();
+
+}
+
+#endif // LIBANGLE_FORMATUTILS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEhistogram_macrosh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/histogram_macros.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/histogram_macros.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/histogram_macros.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// histogram_macros.h:
+//   Helpers for making histograms, to keep consistency with Chromium's
+//   histogram_macros.h.
+
+#ifndef LIBANGLE_HISTOGRAM_MACROS_H_
+#define LIBANGLE_HISTOGRAM_MACROS_H_
+
+#include &lt;platform/Platform.h&gt;
+
+#define ANGLE_HISTOGRAM_TIMES(name, sample) ANGLE_HISTOGRAM_CUSTOM_TIMES( \
+    name, sample, 1, 10000, 50)
+
+#define ANGLE_HISTOGRAM_MEDIUM_TIMES(name, sample) ANGLE_HISTOGRAM_CUSTOM_TIMES( \
+    name, sample, 10, 180000, 50)
+
+// Use this macro when times can routinely be much longer than 10 seconds.
+#define ANGLE_HISTOGRAM_LONG_TIMES(name, sample) ANGLE_HISTOGRAM_CUSTOM_TIMES( \
+    name, sample, 1, 3600000, 50)
+
+// Use this macro when times can routinely be much longer than 10 seconds and
+// you want 100 buckets.
+#define ANGLE_HISTOGRAM_LONG_TIMES_100(name, sample) ANGLE_HISTOGRAM_CUSTOM_TIMES( \
+    name, sample, 1, 3600000, 100)
+
+// For folks that need real specific times, use this to select a precise range
+// of times you want plotted, and the number of buckets you want used.
+#define ANGLE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
+    ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count)
+
+#define ANGLE_HISTOGRAM_COUNTS(name, sample) ANGLE_HISTOGRAM_CUSTOM_COUNTS( \
+    name, sample, 1, 1000000, 50)
+
+#define ANGLE_HISTOGRAM_COUNTS_100(name, sample) \
+    ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 100, 50)
+
+#define ANGLE_HISTOGRAM_COUNTS_10000(name, sample) \
+    ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 10000, 50)
+
+#define ANGLE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
+    ANGLEPlatformCurrent()-&gt;histogramCustomCounts(\
+      name, sample, min, max, bucket_count)
+
+#define ANGLE_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \
+    ANGLE_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
+
+#define ANGLE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
+    ANGLEPlatformCurrent()-&gt;histogramEnumeration(name, sample, boundary_value)
+
+#define ANGLE_HISTOGRAM_MEMORY_KB(name, sample) ANGLE_HISTOGRAM_CUSTOM_COUNTS( \
+    name, sample, 1000, 500000, 50)
+
+#define ANGLE_HISTOGRAM_MEMORY_MB(name, sample) ANGLE_HISTOGRAM_CUSTOM_COUNTS( \
+    name, sample, 1, 1000, 50)
+
+#endif  // BASE_METRICS_HISTOGRAM_MACROS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEqueryconversionscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// queryconversions.cpp: Implementation of state query cast conversions
+
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace gl
+{
+
+// Helper class for converting a GL type to a GLenum:
+// We can't use CastStateValueEnum generally, because of GLboolean + GLubyte overlap.
+// We restrict our use to CastStateValue, where it eliminates duplicate parameters.
+
+template &lt;typename GLType&gt;
+struct CastStateValueEnum { static GLenum mEnumForType; };
+
+template &lt;&gt; GLenum CastStateValueEnum&lt;GLint&gt;::mEnumForType      = GL_INT;
+template &lt;&gt; GLenum CastStateValueEnum&lt;GLuint&gt;::mEnumForType     = GL_UNSIGNED_INT;
+template &lt;&gt; GLenum CastStateValueEnum&lt;GLboolean&gt;::mEnumForType  = GL_BOOL;
+template &lt;&gt; GLenum CastStateValueEnum&lt;GLint64&gt;::mEnumForType    = GL_INT_64_ANGLEX;
+template &lt;&gt; GLenum CastStateValueEnum&lt;GLfloat&gt;::mEnumForType    = GL_FLOAT;
+
+template &lt;typename QueryT, typename NativeT&gt;
+QueryT CastStateValueToInt(GLenum pname, NativeT value)
+{
+    GLenum queryType = CastStateValueEnum&lt;QueryT&gt;::mEnumForType;
+    GLenum nativeType = CastStateValueEnum&lt;NativeT&gt;::mEnumForType;
+
+    if (nativeType == GL_FLOAT)
+    {
+        // RGBA color values and DepthRangeF values are converted to integer using Equation 2.4 from Table 4.5
+        if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
+        {
+            return static_cast&lt;QueryT&gt;((static_cast&lt;GLfloat&gt;(0xFFFFFFFF) * value - 1.0f) / 2.0f);
+        }
+        else
+        {
+            return gl::iround&lt;QueryT&gt;(static_cast&lt;GLfloat&gt;(value));
+        }
+    }
+
+    // Clamp 64-bit int values when casting to int
+    if (nativeType == GL_INT_64_ANGLEX &amp;&amp; queryType == GL_INT)
+    {
+        GLint64 minIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;GLint&gt;::min());
+        GLint64 maxIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;GLint&gt;::max());
+        GLint64 clampedValue = std::max(std::min(static_cast&lt;GLint64&gt;(value), maxIntValue), minIntValue);
+        return static_cast&lt;QueryT&gt;(clampedValue);
+    }
+
+    return static_cast&lt;QueryT&gt;(value);
+}
+
+template &lt;typename QueryT, typename NativeT&gt;
+QueryT CastStateValue(GLenum pname, NativeT value)
+{
+    GLenum queryType = CastStateValueEnum&lt;QueryT&gt;::mEnumForType;
+
+    switch (queryType)
+    {
+      case GL_INT:              return CastStateValueToInt&lt;QueryT, NativeT&gt;(pname, value);
+      case GL_INT_64_ANGLEX:    return CastStateValueToInt&lt;QueryT, NativeT&gt;(pname, value);
+      case GL_FLOAT:            return static_cast&lt;QueryT&gt;(value);
+      case GL_BOOL:             return static_cast&lt;QueryT&gt;(value == static_cast&lt;NativeT&gt;(0) ? GL_FALSE : GL_TRUE);
+      default: UNREACHABLE();   return 0;
+    }
+}
+
+template &lt;typename QueryT&gt;
+void CastStateValues(Context *context, GLenum nativeType, GLenum pname,
+                     unsigned int numParams, QueryT *outParams)
+{
+    if (nativeType == GL_INT)
+    {
+        GLint *intParams = NULL;
+        intParams = new GLint[numParams];
+
+        context-&gt;getIntegerv(pname, intParams);
+
+        for (unsigned int i = 0; i &lt; numParams; ++i)
+        {
+            outParams[i] = CastStateValue&lt;QueryT&gt;(pname, intParams[i]);
+        }
+
+        delete [] intParams;
+    }
+    else if (nativeType == GL_BOOL)
+    {
+        GLboolean *boolParams = NULL;
+        boolParams = new GLboolean[numParams];
+
+        context-&gt;getBooleanv(pname, boolParams);
+
+        for (unsigned int i = 0; i &lt; numParams; ++i)
+        {
+            outParams[i] = (boolParams[i] == GL_FALSE ? static_cast&lt;QueryT&gt;(0) : static_cast&lt;QueryT&gt;(1));
+        }
+
+        delete [] boolParams;
+    }
+    else if (nativeType == GL_FLOAT)
+    {
+        GLfloat *floatParams = NULL;
+        floatParams = new GLfloat[numParams];
+
+        context-&gt;getFloatv(pname, floatParams);
+
+        for (unsigned int i = 0; i &lt; numParams; ++i)
+        {
+            outParams[i] = CastStateValue&lt;QueryT&gt;(pname, floatParams[i]);
+        }
+
+        delete [] floatParams;
+    }
+    else if (nativeType == GL_INT_64_ANGLEX)
+    {
+        GLint64 *int64Params = NULL;
+        int64Params = new GLint64[numParams];
+
+        context-&gt;getInteger64v(pname, int64Params);
+
+        for (unsigned int i = 0; i &lt; numParams; ++i)
+        {
+            outParams[i] = CastStateValue&lt;QueryT&gt;(pname, int64Params[i]);
+        }
+
+        delete [] int64Params;
+    }
+    else UNREACHABLE();
+}
+
+// Explicit template instantiation (how we export template functions in different files)
+// The calls below will make CastStateValues successfully link with the GL state query types
+// The GL state query API types are: bool, int, uint, float, int64
+
+template void CastStateValues&lt;GLboolean&gt;(Context *, GLenum, GLenum, unsigned int, GLboolean *);
+template void CastStateValues&lt;GLint&gt;(Context *, GLenum, GLenum, unsigned int, GLint *);
+template void CastStateValues&lt;GLuint&gt;(Context *, GLenum, GLenum, unsigned int, GLuint *);
+template void CastStateValues&lt;GLfloat&gt;(Context *, GLenum, GLenum, unsigned int, GLfloat *);
+template void CastStateValues&lt;GLint64&gt;(Context *, GLenum, GLenum, unsigned int, GLint64 *);
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEqueryconversionsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/queryconversions.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// queryconversions.h: Declaration of state query cast conversions
+
+namespace gl
+{
+
+// The GL state query API types are: bool, int, uint, float, int64
+template &lt;typename QueryT&gt;
+void CastStateValues(Context *context, GLenum nativeType, GLenum pname,
+                     unsigned int numParams, QueryT *outParams);
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererBufferImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// BufferImpl.h: Defines the abstract rx::BufferImpl class.
+
+#ifndef LIBANGLE_RENDERER_BUFFERIMPL_H_
+#define LIBANGLE_RENDERER_BUFFERIMPL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+
+#include &lt;stdint.h&gt;
+
+namespace rx
+{
+
+class BufferImpl : angle::NonCopyable
+{
+  public:
+    virtual ~BufferImpl() { }
+
+    virtual gl::Error setData(const void* data, size_t size, GLenum usage) = 0;
+    virtual gl::Error setSubData(const void* data, size_t size, size_t offset) = 0;
+    virtual gl::Error copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size) = 0;
+    virtual gl::Error map(GLenum access, GLvoid **mapPtr) = 0;
+    virtual gl::Error mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr) = 0;
+    virtual gl::Error unmap(GLboolean *result) = 0;
+
+    // This method may not have a corresponding GL-backed function. It is necessary
+    // for validation, for certain indexed draw calls.
+    virtual gl::Error getData(const uint8_t **outData) = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_BUFFERIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererBufferImpl_mockh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl_mock.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl_mock.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/BufferImpl_mock.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// BufferImpl_mock.h: Defines a mock of the BufferImpl class.
+
+#ifndef LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_
+#define LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_
+
+#include &quot;gmock/gmock.h&quot;
+
+#include &quot;libANGLE/renderer/BufferImpl.h&quot;
+
+namespace rx
+{
+
+class MockBufferImpl : public BufferImpl
+{
+  public:
+    ~MockBufferImpl() override { destructor(); }
+
+    MOCK_METHOD3(setData, gl::Error(const void*, size_t, GLenum));
+    MOCK_METHOD3(setSubData, gl::Error(const void*, size_t, size_t));
+    MOCK_METHOD4(copySubData, gl::Error(BufferImpl *, GLintptr, GLintptr, GLsizeiptr));
+    MOCK_METHOD2(map, gl::Error(GLenum, GLvoid **));
+    MOCK_METHOD4(mapRange, gl::Error(size_t, size_t, GLbitfield, GLvoid **));
+    MOCK_METHOD1(unmap, gl::Error(GLboolean *result));
+
+    MOCK_METHOD1(getData, gl::Error(const uint8_t **));
+
+    MOCK_METHOD0(destructor, void());
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_BUFFERIMPLMOCK_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererCompilerImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/CompilerImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/CompilerImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/CompilerImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// CompilerImpl.h: Defines the rx::CompilerImpl class, an implementation interface
+//                 for the gl::Compiler object.
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#ifndef LIBANGLE_RENDERER_COMPILERIMPL_H_
+#define LIBANGLE_RENDERER_COMPILERIMPL_H_
+
+namespace rx
+{
+
+class CompilerImpl : angle::NonCopyable
+{
+  public:
+    CompilerImpl() {}
+    virtual ~CompilerImpl() {}
+
+    virtual gl::Error release() = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_COMPILERIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererDeviceImplcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// DeviceImpl.cpp: Implementation methods of egl::Device
+
+#include &quot;libANGLE/renderer/DeviceImpl.h&quot;
+
+namespace rx
+{
+
+DeviceImpl::DeviceImpl()
+{
+}
+
+DeviceImpl::~DeviceImpl()
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererDeviceImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DeviceImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// DeviceImpl.h: Implementation methods of egl::Device
+
+#ifndef LIBANGLE_RENDERER_DEVICEIMPL_H_
+#define LIBANGLE_RENDERER_DEVICEIMPL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+
+namespace egl
+{
+class Device;
+}
+
+namespace rx
+{
+class DeviceImpl : angle::NonCopyable
+{
+  public:
+    DeviceImpl();
+    virtual ~DeviceImpl();
+
+    virtual egl::Error getDevice(EGLAttrib *value) = 0;
+    virtual EGLint getType() = 0;
+    virtual void generateExtensions(egl::DeviceExtensions *outExtensions) const = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_DEVICEIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererDisplayImplcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// DisplayImpl.cpp: Implementation methods of egl::Display
+
+#include &quot;libANGLE/renderer/DisplayImpl.h&quot;
+
+#include &quot;libANGLE/Surface.h&quot;
+
+namespace rx
+{
+
+DisplayImpl::DisplayImpl()
+    : mExtensionsInitialized(false),
+      mCapsInitialized(false)
+{
+}
+
+DisplayImpl::~DisplayImpl()
+{
+    while (!mSurfaceSet.empty())
+    {
+        destroySurface(*mSurfaceSet.begin());
+    }
+}
+
+void DisplayImpl::destroySurface(egl::Surface *surface)
+{
+    mSurfaceSet.erase(surface);
+    surface-&gt;release();
+}
+
+const egl::DisplayExtensions &amp;DisplayImpl::getExtensions() const
+{
+    if (!mExtensionsInitialized)
+    {
+        generateExtensions(&amp;mExtensions);
+        mExtensionsInitialized = true;
+    }
+
+    return mExtensions;
+}
+
+const egl::Caps &amp;DisplayImpl::getCaps() const
+{
+    if (!mCapsInitialized)
+    {
+        generateCaps(&amp;mCaps);
+        mCapsInitialized = true;
+    }
+
+    return mCaps;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererDisplayImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/DisplayImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// DisplayImpl.h: Implementation methods of egl::Display
+
+#ifndef LIBANGLE_RENDERER_DISPLAYIMPL_H_
+#define LIBANGLE_RENDERER_DISPLAYIMPL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+#include &lt;set&gt;
+#include &lt;vector&gt;
+
+namespace egl
+{
+class AttributeMap;
+class Display;
+struct Config;
+class Surface;
+}
+
+namespace gl
+{
+class Context;
+}
+
+namespace rx
+{
+class SurfaceImpl;
+struct ConfigDesc;
+class DeviceImpl;
+
+class DisplayImpl : angle::NonCopyable
+{
+  public:
+    DisplayImpl();
+    virtual ~DisplayImpl();
+
+    virtual egl::Error initialize(egl::Display *display) = 0;
+    virtual void terminate() = 0;
+
+    virtual egl::Error createWindowSurface(const egl::Config *configuration, EGLNativeWindowType window, const egl::AttributeMap &amp;attribs,
+                                           SurfaceImpl **outSurface) = 0;
+    virtual egl::Error createPbufferSurface(const egl::Config *configuration, const egl::AttributeMap &amp;attribs,
+                                            SurfaceImpl **outSurface) = 0;
+    virtual egl::Error createPbufferFromClientBuffer(const egl::Config *configuration, EGLClientBuffer shareHandle,
+                                                     const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface) = 0;
+    virtual egl::Error createPixmapSurface(const egl::Config *configuration, NativePixmapType nativePixmap,
+                                           const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface) = 0;
+    virtual egl::Error createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &amp;attribs,
+                                     gl::Context **outContext) = 0;
+
+    virtual egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) = 0;
+
+    virtual egl::ConfigSet generateConfigs() const = 0;
+
+    virtual bool isDeviceLost() const = 0;
+    virtual bool testDeviceLost() = 0;
+    virtual egl::Error restoreLostDevice() = 0;
+
+    virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0;
+
+    virtual std::string getVendorString() const = 0;
+
+    virtual egl::Error getDevice(DeviceImpl **device) = 0;
+
+    const egl::Caps &amp;getCaps() const;
+
+    typedef std::set&lt;egl::Surface*&gt; SurfaceSet;
+    const SurfaceSet &amp;getSurfaceSet() const { return mSurfaceSet; }
+    SurfaceSet &amp;getSurfaceSet() { return mSurfaceSet; }
+
+    void destroySurface(egl::Surface *surface);
+
+    const egl::DisplayExtensions &amp;getExtensions() const;
+
+  protected:
+    // Place the surface set here so it can be accessible for handling
+    // context loss events. (It is shared between the Display and Impl.)
+    SurfaceSet mSurfaceSet;
+
+  private:
+    virtual void generateExtensions(egl::DisplayExtensions *outExtensions) const = 0;
+    virtual void generateCaps(egl::Caps *outCaps) const = 0;
+
+    mutable bool mExtensionsInitialized;
+    mutable egl::DisplayExtensions mExtensions;
+
+    mutable bool mCapsInitialized;
+    mutable egl::Caps mCaps;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_DISPLAYIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererFenceNVImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceNVImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceNVImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceNVImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// FenceNVImpl.h: Defines the rx::FenceNVImpl class.
+
+#ifndef LIBANGLE_RENDERER_FENCENVIMPL_H_
+#define LIBANGLE_RENDERER_FENCENVIMPL_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+namespace rx
+{
+
+class FenceNVImpl : angle::NonCopyable
+{
+  public:
+    FenceNVImpl() { };
+    virtual ~FenceNVImpl() { };
+
+    virtual gl::Error set(GLenum condition) = 0;
+    virtual gl::Error test(GLboolean *outFinished) = 0;
+    virtual gl::Error finish() = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_FENCENVIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererFenceSyncImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceSyncImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceSyncImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FenceSyncImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// FenceSyncImpl.h: Defines the rx::FenceSyncImpl class.
+
+#ifndef LIBANGLE_RENDERER_FENCESYNCIMPL_H_
+#define LIBANGLE_RENDERER_FENCESYNCIMPL_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+namespace rx
+{
+
+class FenceSyncImpl : angle::NonCopyable
+{
+  public:
+    FenceSyncImpl() { };
+    virtual ~FenceSyncImpl() { };
+
+    virtual gl::Error set(GLenum condition, GLbitfield flags) = 0;
+    virtual gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) = 0;
+    virtual gl::Error serverWait(GLbitfield flags, GLuint64 timeout) = 0;
+    virtual gl::Error getStatus(GLint *outResult) = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_FENCESYNCIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererFramebufferImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FramebufferImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FramebufferImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/FramebufferImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// FramebufferImpl.h: Defines the abstract rx::FramebufferImpl class.
+
+#ifndef LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
+#define LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+
+namespace gl
+{
+class State;
+class Framebuffer;
+class FramebufferAttachment;
+struct Rectangle;
+}
+
+namespace rx
+{
+
+class FramebufferImpl : angle::NonCopyable
+{
+  public:
+    explicit FramebufferImpl(const gl::Framebuffer::Data &amp;data) : mData(data) { }
+    virtual ~FramebufferImpl() { }
+
+    virtual void onUpdateColorAttachment(size_t index) = 0;
+    virtual void onUpdateDepthAttachment() = 0;
+    virtual void onUpdateStencilAttachment() = 0;
+    virtual void onUpdateDepthStencilAttachment() = 0;
+
+    virtual void setDrawBuffers(size_t count, const GLenum *buffers) = 0;
+    virtual void setReadBuffer(GLenum buffer) = 0;
+
+    virtual gl::Error invalidate(size_t count, const GLenum *attachments) = 0;
+    virtual gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &amp;area) = 0;
+
+    virtual gl::Error clear(const gl::Data &amp;data, GLbitfield mask) = 0;
+    virtual gl::Error clearBufferfv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLfloat *values) = 0;
+    virtual gl::Error clearBufferuiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLuint *values) = 0;
+    virtual gl::Error clearBufferiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLint *values) = 0;
+    virtual gl::Error clearBufferfi(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) = 0;
+
+    virtual GLenum getImplementationColorReadFormat() const = 0;
+    virtual GLenum getImplementationColorReadType() const = 0;
+    virtual gl::Error readPixels(const gl::State &amp;state, const gl::Rectangle &amp;area, GLenum format, GLenum type, GLvoid *pixels) const = 0;
+
+    virtual gl::Error blit(const gl::State &amp;state, const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea,
+                           GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer) = 0;
+
+    virtual GLenum checkStatus() const = 0;
+
+    const gl::Framebuffer::Data &amp;getData() const { return mData; }
+
+  protected:
+    const gl::Framebuffer::Data &amp;mData;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererImplFactoryh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ImplFactory.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ImplFactory.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ImplFactory.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// ImplFactory.h:
+//   Factory interface for Impl objects.
+//
+
+#ifndef LIBANGLE_RENDERER_IMPLFACTORY_H_
+#define LIBANGLE_RENDERER_IMPLFACTORY_H_
+
+#include &quot;libANGLE/Framebuffer.h&quot;
+
+namespace rx
+{
+class BufferImpl;
+class CompilerImpl;
+class FenceNVImpl;
+class FenceSyncImpl;
+class FramebufferImpl;
+class ProgramImpl;
+class QueryImpl;
+class RenderbufferImpl;
+class ShaderImpl;
+class TextureImpl;
+class TransformFeedbackImpl;
+class VertexArrayImpl;
+
+class ImplFactory : angle::NonCopyable
+{
+  public:
+    ImplFactory() {}
+    virtual ~ImplFactory() {}
+
+    // Shader creation
+    virtual CompilerImpl *createCompiler(const gl::Data &amp;data) = 0;
+    virtual ShaderImpl *createShader(GLenum type) = 0;
+    virtual ProgramImpl *createProgram() = 0;
+
+    // Framebuffer creation
+    virtual FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &amp;data) = 0;
+    virtual FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &amp;data) = 0;
+
+    // Texture creation
+    virtual TextureImpl *createTexture(GLenum target) = 0;
+
+    // Renderbuffer creation
+    virtual RenderbufferImpl *createRenderbuffer() = 0;
+
+    // Buffer creation
+    virtual BufferImpl *createBuffer() = 0;
+
+    // Vertex Array creation
+    virtual VertexArrayImpl *createVertexArray() = 0;
+
+    // Query and Fence creation
+    virtual QueryImpl *createQuery(GLenum type) = 0;
+    virtual FenceNVImpl *createFenceNV() = 0;
+    virtual FenceSyncImpl *createFenceSync() = 0;
+
+    // Transform Feedback creation
+    virtual TransformFeedbackImpl *createTransformFeedback() = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_IMPLFACTORY_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererIndexRangeCachecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// IndexRangeCache.cpp: Defines the rx::IndexRangeCache class which stores information about
+// ranges of indices.
+
+#include &quot;libANGLE/renderer/IndexRangeCache.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+template &lt;class IndexType&gt;
+static RangeUI ComputeTypedRange(const IndexType *indices, GLsizei count)
+{
+    unsigned int minIndex = indices[0];
+    unsigned int maxIndex = indices[0];
+
+    for (GLsizei i = 1; i &lt; count; i++)
+    {
+        if (minIndex &gt; indices[i]) minIndex = indices[i];
+        if (maxIndex &lt; indices[i]) maxIndex = indices[i];
+    }
+
+    return RangeUI(minIndex, maxIndex);
+}
+
+RangeUI IndexRangeCache::ComputeRange(GLenum type, const GLvoid *indices, GLsizei count)
+{
+    switch (type)
+    {
+      case GL_UNSIGNED_BYTE:
+        return ComputeTypedRange(static_cast&lt;const GLubyte*&gt;(indices), count);
+      case GL_UNSIGNED_INT:
+        return ComputeTypedRange(static_cast&lt;const GLuint*&gt;(indices), count);
+      case GL_UNSIGNED_SHORT:
+        return ComputeTypedRange(static_cast&lt;const GLushort*&gt;(indices), count);
+      default:
+        UNREACHABLE();
+        return RangeUI();
+    }
+}
+
+void IndexRangeCache::addRange(GLenum type, unsigned int offset, GLsizei count, const RangeUI &amp;range)
+{
+    mIndexRangeCache[IndexRange(type, offset, count)] = range;
+}
+
+void IndexRangeCache::invalidateRange(unsigned int offset, unsigned int size)
+{
+    unsigned int invalidateStart = offset;
+    unsigned int invalidateEnd = offset + size;
+
+    IndexRangeMap::iterator i = mIndexRangeCache.begin();
+    while (i != mIndexRangeCache.end())
+    {
+        unsigned int rangeStart = i-&gt;first.offset;
+        unsigned int rangeEnd = i-&gt;first.offset + (gl::GetTypeInfo(i-&gt;first.type).bytes * i-&gt;first.count);
+
+        if (invalidateEnd &lt; rangeStart || invalidateStart &gt; rangeEnd)
+        {
+            ++i;
+        }
+        else
+        {
+            mIndexRangeCache.erase(i++);
+        }
+    }
+}
+
+bool IndexRangeCache::findRange(GLenum type, unsigned int offset, GLsizei count,
+                                RangeUI *outRange) const
+{
+    IndexRangeMap::const_iterator i = mIndexRangeCache.find(IndexRange(type, offset, count));
+    if (i != mIndexRangeCache.end())
+    {
+        if (outRange)        *outRange = i-&gt;second;
+        return true;
+    }
+    else
+    {
+        if (outRange)        *outRange = RangeUI(0, 0);
+        return false;
+    }
+}
+
+void IndexRangeCache::clear()
+{
+    mIndexRangeCache.clear();
+}
+
+IndexRangeCache::IndexRange::IndexRange()
+    : type(GL_NONE), offset(0), count(0)
+{
+}
+
+IndexRangeCache::IndexRange::IndexRange(GLenum typ, intptr_t off, GLsizei c)
+    : type(typ), offset(static_cast&lt;unsigned int&gt;(off)), count(c)
+{
+}
+
+bool IndexRangeCache::IndexRange::operator&lt;(const IndexRange&amp; rhs) const
+{
+    if (type != rhs.type) return type &lt; rhs.type;
+    if (offset != rhs.offset) return offset &lt; rhs.offset;
+    return count &lt; rhs.count;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererIndexRangeCacheh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/IndexRangeCache.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// IndexRangeCache.h: Defines the rx::IndexRangeCache class which stores information about
+// ranges of indices.
+
+#ifndef LIBANGLE_RENDERER_INDEXRANGECACHE_H_
+#define LIBANGLE_RENDERER_INDEXRANGECACHE_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/mathutil.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+
+class IndexRangeCache
+{
+  public:
+    void addRange(GLenum type, unsigned int offset, GLsizei count, const RangeUI &amp;range);
+    bool findRange(GLenum type, unsigned int offset, GLsizei count, RangeUI *rangeOut) const;
+
+    void invalidateRange(unsigned int offset, unsigned int size);
+    void clear();
+
+    static RangeUI ComputeRange(GLenum type, const GLvoid *indices, GLsizei count);
+
+  private:
+    struct IndexRange
+    {
+        GLenum type;
+        unsigned int offset;
+        GLsizei count;
+
+        IndexRange();
+        IndexRange(GLenum type, intptr_t offset, GLsizei count);
+
+        bool operator&lt;(const IndexRange&amp; rhs) const;
+    };
+
+    typedef std::map&lt;IndexRange, RangeUI&gt; IndexRangeMap;
+    IndexRangeMap mIndexRangeCache;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_INDEXRANGECACHE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererProgramImplcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// ProgramD3D.cpp: Defines the rx::ProgramD3D class which implements rx::ProgramImpl.
+
+#include &quot;libANGLE/renderer/ProgramImpl.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+namespace rx
+{
+
+LinkResult::LinkResult(bool linkSuccess, const gl::Error &amp;error)
+    : linkSuccess(linkSuccess),
+      error(error)
+{
+}
+
+ProgramImpl::~ProgramImpl()
+{
+    // Ensure that reset was called by the inherited class during destruction
+    ASSERT(mUniformIndex.size() == 0);
+}
+
+gl::LinkedUniform *ProgramImpl::getUniformByLocation(GLint location) const
+{
+    ASSERT(location &gt;= 0 &amp;&amp; static_cast&lt;size_t&gt;(location) &lt; mUniformIndex.size());
+    return mUniforms[mUniformIndex[location].index];
+}
+
+gl::LinkedUniform *ProgramImpl::getUniformByName(const std::string &amp;name) const
+{
+    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
+    {
+        if (mUniforms[uniformIndex]-&gt;name == name)
+        {
+            return mUniforms[uniformIndex];
+        }
+    }
+
+    return NULL;
+}
+
+gl::UniformBlock *ProgramImpl::getUniformBlockByIndex(GLuint blockIndex) const
+{
+    ASSERT(blockIndex &lt; mUniformBlocks.size());
+    return mUniformBlocks[blockIndex];
+}
+
+GLint ProgramImpl::getUniformLocation(const std::string &amp;name) const
+{
+    size_t subscript = GL_INVALID_INDEX;
+    std::string baseName = gl::ParseUniformName(name, &amp;subscript);
+
+    unsigned int numUniforms = mUniformIndex.size();
+    for (unsigned int location = 0; location &lt; numUniforms; location++)
+    {
+        if (mUniformIndex[location].name == baseName)
+        {
+            const int index = mUniformIndex[location].index;
+            const bool isArray = mUniforms[index]-&gt;isArray();
+
+            if ((isArray &amp;&amp; mUniformIndex[location].element == subscript) ||
+                (subscript == GL_INVALID_INDEX))
+            {
+                return location;
+            }
+        }
+    }
+
+    return -1;
+}
+
+GLuint ProgramImpl::getUniformIndex(const std::string &amp;name) const
+{
+    size_t subscript = GL_INVALID_INDEX;
+    std::string baseName = gl::ParseUniformName(name, &amp;subscript);
+
+    // The app is not allowed to specify array indices other than 0 for arrays of basic types
+    if (subscript != 0 &amp;&amp; subscript != GL_INVALID_INDEX)
+    {
+        return GL_INVALID_INDEX;
+    }
+
+    unsigned int numUniforms = mUniforms.size();
+    for (unsigned int index = 0; index &lt; numUniforms; index++)
+    {
+        if (mUniforms[index]-&gt;name == baseName)
+        {
+            if (mUniforms[index]-&gt;isArray() || subscript == GL_INVALID_INDEX)
+            {
+                return index;
+            }
+        }
+    }
+
+    return GL_INVALID_INDEX;
+}
+
+GLuint ProgramImpl::getUniformBlockIndex(const std::string &amp;name) const
+{
+    size_t subscript = GL_INVALID_INDEX;
+    std::string baseName = gl::ParseUniformName(name, &amp;subscript);
+
+    unsigned int numUniformBlocks = mUniformBlocks.size();
+    for (unsigned int blockIndex = 0; blockIndex &lt; numUniformBlocks; blockIndex++)
+    {
+        const gl::UniformBlock &amp;uniformBlock = *mUniformBlocks[blockIndex];
+        if (uniformBlock.name == baseName)
+        {
+            const bool arrayElementZero = (subscript == GL_INVALID_INDEX &amp;&amp; uniformBlock.elementIndex == 0);
+            if (subscript == uniformBlock.elementIndex || arrayElementZero)
+            {
+                return blockIndex;
+            }
+        }
+    }
+
+    return GL_INVALID_INDEX;
+}
+
+void ProgramImpl::reset()
+{
+    std::fill(mSemanticIndex, mSemanticIndex + ArraySize(mSemanticIndex), -1);
+    SafeDeleteContainer(mUniforms);
+    mUniformIndex.clear();
+    SafeDeleteContainer(mUniformBlocks);
+    mTransformFeedbackLinkedVaryings.clear();
+}
+
+void ProgramImpl::setShaderAttribute(size_t index, const sh::Attribute &amp;attrib)
+{
+    if (mShaderAttributes.size() &lt;= index)
+    {
+        mShaderAttributes.resize(index + 1);
+    }
+    mShaderAttributes[index] = attrib;
+}
+
+void ProgramImpl::setShaderAttribute(size_t index, GLenum type, GLenum precision, const std::string &amp;name, GLint size, int location)
+{
+    if (mShaderAttributes.size() &lt;= index)
+    {
+        mShaderAttributes.resize(index + 1);
+    }
+    mShaderAttributes[index].type = type;
+    mShaderAttributes[index].precision = precision;
+    mShaderAttributes[index].name = name;
+    mShaderAttributes[index].arraySize = size;
+    mShaderAttributes[index].location = location;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererProgramImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ProgramImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,141 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// ProgramImpl.h: Defines the abstract rx::ProgramImpl class.
+
+#ifndef LIBANGLE_RENDERER_PROGRAMIMPL_H_
+#define LIBANGLE_RENDERER_PROGRAMIMPL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/BinaryStream.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Shader.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+
+struct LinkResult
+{
+    bool linkSuccess;
+    gl::Error error;
+    LinkResult(bool linkSuccess, const gl::Error &amp;error);
+};
+
+class ProgramImpl : angle::NonCopyable
+{
+  public:
+    typedef int SemanticIndexArray[gl::MAX_VERTEX_ATTRIBS];
+
+    ProgramImpl() { }
+    virtual ~ProgramImpl();
+
+    virtual bool usesPointSize() const = 0;
+    virtual int getShaderVersion() const = 0;
+    virtual GLenum getTransformFeedbackBufferMode() const = 0;
+
+    virtual GLenum getBinaryFormat() = 0;
+    virtual LinkResult load(gl::InfoLog &amp;infoLog, gl::BinaryInputStream *stream) = 0;
+    virtual gl::Error save(gl::BinaryOutputStream *stream) = 0;
+
+    virtual LinkResult link(const gl::Data &amp;data, gl::InfoLog &amp;infoLog,
+                            gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                            const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings,
+                            GLenum transformFeedbackBufferMode,
+                            int *registers, std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings,
+                            std::map&lt;int, gl::VariableLocation&gt; *outputVariables) = 0;
+
+    virtual void setUniform1fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+    virtual void setUniform2fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+    virtual void setUniform3fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+    virtual void setUniform4fv(GLint location, GLsizei count, const GLfloat *v) = 0;
+    virtual void setUniform1iv(GLint location, GLsizei count, const GLint *v) = 0;
+    virtual void setUniform2iv(GLint location, GLsizei count, const GLint *v) = 0;
+    virtual void setUniform3iv(GLint location, GLsizei count, const GLint *v) = 0;
+    virtual void setUniform4iv(GLint location, GLsizei count, const GLint *v) = 0;
+    virtual void setUniform1uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+    virtual void setUniform2uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+    virtual void setUniform3uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+    virtual void setUniform4uiv(GLint location, GLsizei count, const GLuint *v) = 0;
+    virtual void setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+    virtual void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) = 0;
+
+    virtual void getUniformfv(GLint location, GLfloat *params) = 0;
+    virtual void getUniformiv(GLint location, GLint *params) = 0;
+    virtual void getUniformuiv(GLint location, GLuint *params) = 0;
+
+    // TODO: The following functions are possibly only applicable to D3D backends. The should be carefully evaluated to
+    // determine if they can be removed from this interface.
+    virtual GLint getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &amp;caps) const = 0;
+    virtual GLenum getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const = 0;
+    virtual GLint getUsedSamplerRange(gl::SamplerType type) const = 0;
+    virtual void updateSamplerMapping() = 0;
+    virtual bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &amp;caps) = 0;
+
+    virtual LinkResult compileProgramExecutables(gl::InfoLog &amp;infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                                                 int registers) = 0;
+
+    virtual bool linkUniforms(gl::InfoLog &amp;infoLog, const gl::Shader &amp;vertexShader, const gl::Shader &amp;fragmentShader,
+                              const gl::Caps &amp;caps) = 0;
+    virtual bool defineUniformBlock(gl::InfoLog &amp;infoLog, const gl::Shader &amp;shader, const sh::InterfaceBlock &amp;interfaceBlock,
+                                    const gl::Caps &amp;caps) = 0;
+
+    virtual gl::Error applyUniforms() = 0;
+    virtual gl::Error applyUniformBuffers(const gl::Data &amp;data, GLuint uniformBlockBindings[]) = 0;
+    virtual bool assignUniformBlockRegister(gl::InfoLog &amp;infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
+                                            unsigned int registerIndex, const gl::Caps &amp;caps) = 0;
+
+    const std::vector&lt;gl::LinkedUniform*&gt; &amp;getUniforms() const { return mUniforms; }
+    const std::vector&lt;gl::VariableLocation&gt; &amp;getUniformIndices() const { return mUniformIndex; }
+    const std::vector&lt;gl::UniformBlock*&gt; &amp;getUniformBlocks() const { return mUniformBlocks; }
+    const std::vector&lt;gl::LinkedVarying&gt; &amp;getTransformFeedbackLinkedVaryings() const { return mTransformFeedbackLinkedVaryings; }
+    const std::vector&lt;sh::Attribute&gt; getShaderAttributes() { return mShaderAttributes; }
+    const SemanticIndexArray &amp;getSemanticIndexes() const { return mSemanticIndex; }
+
+    std::vector&lt;gl::LinkedUniform*&gt; &amp;getUniforms() { return mUniforms; }
+    std::vector&lt;gl::VariableLocation&gt; &amp;getUniformIndices() { return mUniformIndex; }
+    std::vector&lt;gl::UniformBlock*&gt; &amp;getUniformBlocks() { return mUniformBlocks; }
+    std::vector&lt;gl::LinkedVarying&gt; &amp;getTransformFeedbackLinkedVaryings() { return mTransformFeedbackLinkedVaryings; }
+    SemanticIndexArray &amp;getSemanticIndexes() { return mSemanticIndex; }
+
+    gl::LinkedUniform *getUniformByLocation(GLint location) const;
+    gl::LinkedUniform *getUniformByName(const std::string &amp;name) const;
+    gl::UniformBlock *getUniformBlockByIndex(GLuint blockIndex) const;
+
+    GLint getUniformLocation(const std::string &amp;name) const;
+    GLuint getUniformIndex(const std::string &amp;name) const;
+    GLuint getUniformBlockIndex(const std::string &amp;name) const;
+
+    void setShaderAttribute(size_t index, const sh::Attribute &amp;attrib);
+    void setShaderAttribute(size_t index, GLenum type, GLenum precision, const std::string &amp;name, GLint size, int location);
+
+    virtual void reset();
+
+  protected:
+    std::vector&lt;gl::LinkedUniform*&gt; mUniforms;
+    std::vector&lt;gl::VariableLocation&gt; mUniformIndex;
+    std::vector&lt;gl::UniformBlock*&gt; mUniformBlocks;
+    std::vector&lt;gl::LinkedVarying&gt; mTransformFeedbackLinkedVaryings;
+
+    SemanticIndexArray mSemanticIndex;
+
+  private:
+    std::vector&lt;sh::Attribute&gt; mShaderAttributes;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_PROGRAMIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererQueryImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/QueryImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/QueryImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/QueryImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// QueryImpl.h: Defines the abstract rx::QueryImpl class.
+
+#ifndef LIBANGLE_RENDERER_QUERYIMPL_H_
+#define LIBANGLE_RENDERER_QUERYIMPL_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+
+namespace rx
+{
+
+class QueryImpl : angle::NonCopyable
+{
+  public:
+    explicit QueryImpl(GLenum type) { mType = type; }
+    virtual ~QueryImpl() { }
+
+    virtual gl::Error begin() = 0;
+    virtual gl::Error end() = 0;
+    virtual gl::Error getResult(GLuint *params) = 0;
+    virtual gl::Error isResultAvailable(GLuint *available) = 0;
+
+    GLenum getType() const { return mType;  }
+
+  private:
+    GLenum mType;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_QUERYIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererRenderbufferImplcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// RenderbufferImpl.h: Implements the shared methods of the abstract class gl::RenderbufferImpl
+
+#include &quot;libANGLE/renderer/RenderbufferImpl.h&quot;
+
+namespace rx
+{
+RenderbufferImpl::RenderbufferImpl()
+{
+}
+
+RenderbufferImpl::~RenderbufferImpl()
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererRenderbufferImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/RenderbufferImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// RenderbufferImpl.h: Defines the abstract class gl::RenderbufferImpl
+
+#ifndef LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
+#define LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+namespace rx
+{
+
+class RenderbufferImpl : public FramebufferAttachmentObjectImpl
+{
+  public:
+    RenderbufferImpl();
+    virtual ~RenderbufferImpl() = 0;
+
+    virtual gl::Error setStorage(GLenum internalformat, size_t width, size_t height) = 0;
+    virtual gl::Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) = 0;
+};
+
+}
+
+#endif   // LIBANGLE_RENDERER_RENDERBUFFERIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererRenderercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// Renderer.cpp: Implements EGL dependencies for creating and destroying Renderer instances.
+
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/AttributeMap.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+
+namespace rx
+{
+
+Renderer::Renderer()
+    : mCapsInitialized(false),
+      mWorkaroundsInitialized(false)
+{
+}
+
+Renderer::~Renderer()
+{
+}
+
+const gl::Caps &amp;Renderer::getRendererCaps() const
+{
+    if (!mCapsInitialized)
+    {
+        generateCaps(&amp;mCaps, &amp;mTextureCaps, &amp;mExtensions);
+        mCapsInitialized = true;
+    }
+
+    return mCaps;
+}
+
+const gl::TextureCapsMap &amp;Renderer::getRendererTextureCaps() const
+{
+    if (!mCapsInitialized)
+    {
+        generateCaps(&amp;mCaps, &amp;mTextureCaps, &amp;mExtensions);
+        mCapsInitialized = true;
+    }
+
+    return mTextureCaps;
+}
+
+const gl::Extensions &amp;Renderer::getRendererExtensions() const
+{
+    if (!mCapsInitialized)
+    {
+        generateCaps(&amp;mCaps, &amp;mTextureCaps, &amp;mExtensions);
+        mCapsInitialized = true;
+    }
+
+    return mExtensions;
+}
+
+const Workarounds &amp;Renderer::getWorkarounds() const
+{
+    if (!mWorkaroundsInitialized)
+    {
+        mWorkarounds = generateWorkarounds();
+        mWorkaroundsInitialized = true;
+    }
+
+    return mWorkarounds;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererRendererh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Renderer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// Renderer.h: Defines a back-end specific class that hides the details of the
+// implementation-specific renderer.
+
+#ifndef LIBANGLE_RENDERER_RENDERER_H_
+#define LIBANGLE_RENDERER_RENDERER_H_
+
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/Uniform.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/ImplFactory.h&quot;
+#include &quot;libANGLE/renderer/Workarounds.h&quot;
+#include &quot;common/mathutil.h&quot;
+
+#include &lt;stdint.h&gt;
+
+#include &lt;EGL/egl.h&gt;
+
+namespace egl
+{
+class AttributeMap;
+class Display;
+class Surface;
+}
+
+namespace gl
+{
+class Buffer;
+struct Data;
+}
+
+namespace rx
+{
+struct TranslatedIndexData;
+struct Workarounds;
+class DisplayImpl;
+
+class Renderer : public ImplFactory
+{
+  public:
+    Renderer();
+    virtual ~Renderer();
+
+    virtual gl::Error flush() = 0;
+    virtual gl::Error finish() = 0;
+
+    virtual gl::Error drawArrays(const gl::Data &amp;data, GLenum mode,
+                                 GLint first, GLsizei count, GLsizei instances) = 0;
+    virtual gl::Error drawElements(const gl::Data &amp;data, GLenum mode, GLsizei count, GLenum type,
+                                   const GLvoid *indices, GLsizei instances,
+                                   const RangeUI &amp;indexRange) = 0;
+
+    // lost device
+    //TODO(jmadill): investigate if this stuff is necessary in GL
+    virtual void notifyDeviceLost() = 0;
+    virtual bool isDeviceLost() const = 0;
+    virtual bool testDeviceLost() = 0;
+    virtual bool testDeviceResettable() = 0;
+
+    virtual VendorID getVendorId() const = 0;
+    virtual std::string getVendorString() const = 0;
+    virtual std::string getRendererDescription() const = 0;
+
+    // Renderer capabilities
+    const gl::Caps &amp;getRendererCaps() const;
+    const gl::TextureCapsMap &amp;getRendererTextureCaps() const;
+    const gl::Extensions &amp;getRendererExtensions() const;
+    const Workarounds &amp;getWorkarounds() const;
+
+  private:
+    virtual void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps, gl::Extensions *outExtensions) const = 0;
+    virtual Workarounds generateWorkarounds() const = 0;
+
+    mutable bool mCapsInitialized;
+    mutable gl::Caps mCaps;
+    mutable gl::TextureCapsMap mTextureCaps;
+    mutable gl::Extensions mExtensions;
+
+    mutable bool mWorkaroundsInitialized;
+    mutable Workarounds mWorkarounds;
+};
+
+}
+#endif // LIBANGLE_RENDERER_RENDERER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererShaderImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ShaderImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ShaderImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/ShaderImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// ShaderImpl.h: Defines the abstract rx::ShaderImpl class.
+
+#ifndef LIBANGLE_RENDERER_SHADERIMPL_H_
+#define LIBANGLE_RENDERER_SHADERIMPL_H_
+
+#include &lt;vector&gt;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Shader.h&quot;
+
+namespace rx
+{
+
+class ShaderImpl : angle::NonCopyable
+{
+  public:
+    ShaderImpl() { }
+    virtual ~ShaderImpl() { }
+
+    virtual bool compile(gl::Compiler *compiler, const std::string &amp;source) = 0;
+    virtual std::string getDebugInfo() const = 0;
+
+    virtual const std::string &amp;getInfoLog() const { return mInfoLog; }
+    virtual const std::string &amp;getTranslatedSource() const { return mTranslatedSource; }
+
+    const std::vector&lt;gl::PackedVarying&gt; &amp;getVaryings() const { return mVaryings; }
+    const std::vector&lt;sh::Uniform&gt; &amp;getUniforms() const { return mUniforms; }
+    const std::vector&lt;sh::InterfaceBlock&gt; &amp;getInterfaceBlocks() const  { return mInterfaceBlocks; }
+    const std::vector&lt;sh::Attribute&gt; &amp;getActiveAttributes() const { return mActiveAttributes; }
+    const std::vector&lt;sh::Attribute&gt; &amp;getActiveOutputVariables() const { return mActiveOutputVariables; }
+
+    std::vector&lt;gl::PackedVarying&gt; &amp;getVaryings() { return mVaryings; }
+    std::vector&lt;sh::Uniform&gt; &amp;getUniforms() { return mUniforms; }
+    std::vector&lt;sh::InterfaceBlock&gt; &amp;getInterfaceBlocks() { return mInterfaceBlocks; }
+    std::vector&lt;sh::Attribute&gt; &amp;getActiveAttributes() { return mActiveAttributes; }
+    std::vector&lt;sh::Attribute&gt; &amp;getActiveOutputVariables() { return mActiveOutputVariables; }
+
+  protected:
+    std::string mInfoLog;
+    std::string mTranslatedSource;
+
+    std::vector&lt;gl::PackedVarying&gt; mVaryings;
+    std::vector&lt;sh::Uniform&gt; mUniforms;
+    std::vector&lt;sh::InterfaceBlock&gt; mInterfaceBlocks;
+    std::vector&lt;sh::Attribute&gt; mActiveAttributes;
+    std::vector&lt;sh::Attribute&gt; mActiveOutputVariables;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_SHADERIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererSurfaceImplcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+// SurfaceImpl.cpp: Implementation of Surface stub method class
+
+#include &quot;libANGLE/renderer/SurfaceImpl.h&quot;
+
+namespace rx
+{
+
+SurfaceImpl::SurfaceImpl()
+{
+}
+
+SurfaceImpl::~SurfaceImpl()
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererSurfaceImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/SurfaceImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// SurfaceImpl.h: Implementation methods of egl::Surface
+
+#ifndef LIBANGLE_RENDERER_SURFACEIMPL_H_
+#define LIBANGLE_RENDERER_SURFACEIMPL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+namespace egl
+{
+class Display;
+struct Config;
+}
+
+namespace rx
+{
+
+class SurfaceImpl : public FramebufferAttachmentObjectImpl
+{
+  public:
+    SurfaceImpl();
+    virtual ~SurfaceImpl();
+
+    virtual egl::Error initialize() = 0;
+    virtual egl::Error swap() = 0;
+    virtual egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) = 0;
+    virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0;
+    virtual egl::Error bindTexImage(EGLint buffer) = 0;
+    virtual egl::Error releaseTexImage(EGLint buffer) = 0;
+    virtual void setSwapInterval(EGLint interval) = 0;
+
+    // width and height can change with client window resizing
+    virtual EGLint getWidth() const = 0;
+    virtual EGLint getHeight() const = 0;
+
+    virtual EGLint isPostSubBufferSupported() const = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_SURFACEIMPL_H_
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererTextureImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TextureImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TextureImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TextureImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// TextureImpl.h: Defines the abstract rx::TextureImpl classes.
+
+#ifndef LIBANGLE_RENDERER_TEXTUREIMPL_H_
+#define LIBANGLE_RENDERER_TEXTUREIMPL_H_
+
+#include &lt;stdint.h&gt;
+
+#include &quot;angle_gl.h&quot;
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/ImageIndex.h&quot;
+
+namespace egl
+{
+class Surface;
+}
+
+namespace gl
+{
+struct Box;
+struct Extents;
+struct Offset;
+struct Rectangle;
+class Framebuffer;
+struct PixelUnpackState;
+struct SamplerState;
+}
+
+namespace rx
+{
+
+class TextureImpl : public FramebufferAttachmentObjectImpl
+{
+  public:
+    TextureImpl() {}
+    virtual ~TextureImpl() {}
+
+    virtual void setUsage(GLenum usage) = 0;
+
+    virtual gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                               const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) = 0;
+    virtual gl::Error setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                                  const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) = 0;
+
+    virtual gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                         const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) = 0;
+    virtual gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                            const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) = 0;
+
+    virtual gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                                const gl::Framebuffer *source) = 0;
+    virtual gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                                   const gl::Framebuffer *source) = 0;
+
+    virtual gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size) = 0;
+
+    virtual gl::Error generateMipmaps(const gl::SamplerState &amp;samplerState) = 0;
+
+    virtual void bindTexImage(egl::Surface *surface) = 0;
+    virtual void releaseTexImage() = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_TEXTUREIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererTransformFeedbackImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// TransformFeedbackImpl.h: Defines the abstract rx::TransformFeedbackImpl class.
+
+#ifndef LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
+#define LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/TransformFeedback.h&quot;
+
+namespace rx
+{
+
+class TransformFeedbackImpl : angle::NonCopyable
+{
+  public:
+    virtual ~TransformFeedbackImpl() { }
+
+    virtual void begin(GLenum primitiveMode) = 0;
+    virtual void end() = 0;
+    virtual void pause() = 0;
+    virtual void resume() = 0;
+
+    virtual void bindGenericBuffer(const BindingPointer&lt;gl::Buffer&gt; &amp;binding) = 0;
+    virtual void bindIndexedBuffer(size_t index, const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding) = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererTransformFeedbackImpl_mockh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl_mock.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl_mock.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/TransformFeedbackImpl_mock.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// TransformFeedbackImpl_mock.h: Defines a mock of the TransformFeedbackImpl class.
+
+#ifndef LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
+#define LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
+
+#include &quot;gmock/gmock.h&quot;
+
+#include &quot;libANGLE/renderer/TransformFeedbackImpl.h&quot;
+
+namespace rx
+{
+
+class MockTransformFeedbackImpl : public TransformFeedbackImpl
+{
+  public:
+    ~MockTransformFeedbackImpl() override { destructor(); }
+
+    MOCK_METHOD1(begin, void(GLenum primitiveMode));
+    MOCK_METHOD0(end, void());
+    MOCK_METHOD0(pause, void());
+    MOCK_METHOD0(resume, void());
+
+    MOCK_METHOD1(bindGenericBuffer, void(const BindingPointer&lt;gl::Buffer&gt; &amp;));
+    MOCK_METHOD2(bindIndexedBuffer, void(size_t, const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;));
+
+    MOCK_METHOD0(destructor, void());
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_TRANSFORMFEEDBACKIMPLMOCK_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererVertexArrayImplh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/VertexArrayImpl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/VertexArrayImpl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/VertexArrayImpl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// VertexAttribImpl.h: Defines the abstract rx::VertexAttribImpl class.
+
+#ifndef LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
+#define LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+
+namespace rx
+{
+
+class VertexArrayImpl : angle::NonCopyable
+{
+  public:
+    virtual ~VertexArrayImpl() { }
+
+    virtual void setElementArrayBuffer(const gl::Buffer *buffer) = 0;
+    virtual void setAttribute(size_t idx, const gl::VertexAttribute &amp;attr) = 0;
+    virtual void setAttributeDivisor(size_t idx, GLuint divisor) = 0;
+    virtual void enableAttribute(size_t idx, bool enabledState) = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererWorkaroundsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Workarounds.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Workarounds.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/Workarounds.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// angletypes.h: Workarounds for driver bugs and other issues.
+
+#ifndef LIBANGLE_RENDERER_WORKAROUNDS_H_
+#define LIBANGLE_RENDERER_WORKAROUNDS_H_
+
+// TODO(jmadill,zmo,geofflang): make a workarounds library that can operate
+// independent of ANGLE's renderer. Workarounds should also be accessible
+// outside of the Renderer.
+
+namespace rx
+{
+
+struct D3DCompilerWorkarounds : angle::NonCopyable
+{
+    D3DCompilerWorkarounds()
+        : skipOptimization(false),
+          useMaxOptimization(false),
+          enableIEEEStrictness(false)
+    {}
+
+    void reset()
+    {
+        skipOptimization = false;
+        useMaxOptimization = false;
+        enableIEEEStrictness = false;
+    }
+
+    bool skipOptimization;
+    bool useMaxOptimization;
+
+    // IEEE strictness needs to be enabled for NANs to work.
+    bool enableIEEEStrictness;
+};
+
+struct Workarounds
+{
+    Workarounds()
+        : mrtPerfWorkaround(false),
+          setDataFasterThanImageUpload(false),
+          zeroMaxLodWorkaround(false),
+          useInstancedPointSpriteEmulation(false)
+    {}
+
+    // On some systems, having extra rendertargets than necessary slows down the shader.
+    // We can fix this by optimizing those out of the shader. At the same time, we can
+    // work around a bug on some nVidia drivers that they ignore &quot;null&quot; render targets
+    // in D3D11, by compacting the active color attachments list to omit null entries.
+    bool mrtPerfWorkaround;
+
+    bool setDataFasterThanImageUpload;
+
+    // Some renderers can't disable mipmaps on a mipmapped texture (i.e. solely sample from level zero, and ignore the other levels).
+    // D3D11 Feature Level 10+ does this by setting MaxLOD to 0.0f in the Sampler state. D3D9 sets D3DSAMP_MIPFILTER to D3DTEXF_NONE.
+    // There is no equivalent to this in D3D11 Feature Level 9_3.
+    // This causes problems when (for example) an application creates a mipmapped texture2D, but sets GL_TEXTURE_MIN_FILTER to GL_NEAREST (i.e disables mipmaps).
+    // To work around this, D3D11 FL9_3 has to create two copies of the texture. The textures' level zeros are identical, but only one texture has mips.
+    bool zeroMaxLodWorkaround;
+
+    // Some renderers do not support Geometry Shaders so the Geometry Shader-based
+    // PointSprite emulation will not work.
+    // To work around this, D3D11 FL9_3 has to use a different pointsprite
+    // emulation that is implemented using instanced quads.
+    bool useInstancedPointSpriteEmulation;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_WORKAROUNDS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dBufferD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,80 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// BufferD3D.cpp Defines common functionality between the Buffer9 and Buffer11 classes.
+
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/IndexBuffer.h&quot;
+#include &quot;libANGLE/renderer/d3d/VertexBuffer.h&quot;
+
+namespace rx
+{
+
+unsigned int BufferD3D::mNextSerial = 1;
+
+BufferD3D::BufferD3D(BufferFactoryD3D *factory)
+    : BufferImpl(),
+      mFactory(factory),
+      mStaticVertexBuffer(nullptr),
+      mStaticIndexBuffer(nullptr),
+      mUnmodifiedDataUse(0)
+{
+    updateSerial();
+}
+
+BufferD3D::~BufferD3D()
+{
+    SafeDelete(mStaticVertexBuffer);
+    SafeDelete(mStaticIndexBuffer);
+}
+
+void BufferD3D::updateSerial()
+{
+    mSerial = mNextSerial++;
+}
+
+void BufferD3D::initializeStaticData()
+{
+    if (!mStaticVertexBuffer)
+    {
+        mStaticVertexBuffer = new StaticVertexBufferInterface(mFactory);
+    }
+    if (!mStaticIndexBuffer)
+    {
+        mStaticIndexBuffer = new StaticIndexBufferInterface(mFactory);
+    }
+}
+
+void BufferD3D::invalidateStaticData()
+{
+    if ((mStaticVertexBuffer &amp;&amp; mStaticVertexBuffer-&gt;getBufferSize() != 0) || (mStaticIndexBuffer &amp;&amp; mStaticIndexBuffer-&gt;getBufferSize() != 0))
+    {
+        SafeDelete(mStaticVertexBuffer);
+        SafeDelete(mStaticIndexBuffer);
+
+        // Re-init static data to track that we're in a static buffer
+        initializeStaticData();
+    }
+
+    mUnmodifiedDataUse = 0;
+}
+
+// Creates static buffers if sufficient used data has been left unmodified
+void BufferD3D::promoteStaticUsage(int dataSize)
+{
+    if (!mStaticVertexBuffer &amp;&amp; !mStaticIndexBuffer)
+    {
+        mUnmodifiedDataUse += dataSize;
+
+        if (mUnmodifiedDataUse &gt; 3 * getSize())
+        {
+            initializeStaticData();
+        }
+    }
+}
+
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dBufferD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/BufferD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// BufferD3D.h: Defines the rx::BufferD3D class, an implementation of BufferImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_BUFFERD3D_H_
+#define LIBANGLE_RENDERER_D3D_BUFFERD3D_H_
+
+#include &quot;libANGLE/renderer/BufferImpl.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &lt;stdint.h&gt;
+
+namespace rx
+{
+class BufferFactoryD3D;
+class StaticIndexBufferInterface;
+class StaticVertexBufferInterface;
+
+class BufferD3D : public BufferImpl
+{
+  public:
+    BufferD3D(BufferFactoryD3D *factory);
+    virtual ~BufferD3D();
+
+    unsigned int getSerial() const { return mSerial; }
+
+    virtual size_t getSize() const = 0;
+    virtual bool supportsDirectBinding() const = 0;
+    virtual void markTransformFeedbackUsage() = 0;
+
+    StaticVertexBufferInterface *getStaticVertexBuffer() { return mStaticVertexBuffer; }
+    StaticIndexBufferInterface *getStaticIndexBuffer() { return mStaticIndexBuffer; }
+
+    void initializeStaticData();
+    void invalidateStaticData();
+    void promoteStaticUsage(int dataSize);
+
+  protected:
+    void updateSerial();
+
+    BufferFactoryD3D *mFactory;
+    unsigned int mSerial;
+    static unsigned int mNextSerial;
+
+    StaticVertexBufferInterface *mStaticVertexBuffer;
+    StaticIndexBufferInterface *mStaticIndexBuffer;
+    unsigned int mUnmodifiedDataUse;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_BUFFERD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dCompilerD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// CompilerD3D.cpp: Implementation of the rx::CompilerD3D class.
+
+#include &quot;libANGLE/renderer/d3d/CompilerD3D.h&quot;
+
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+// Global count of active shader compiler handles. Needed to know when to call ShInitialize and ShFinalize.
+static size_t activeCompilerHandles = 0;
+
+CompilerD3D::CompilerD3D(const gl::Data &amp;data, ShShaderOutput outputType)
+    : mSpec(data.clientVersion &gt; 2 ? SH_GLES3_SPEC : SH_GLES2_SPEC),
+      mOutputType(outputType),
+      mResources(),
+      mFragmentCompiler(NULL),
+      mVertexCompiler(NULL)
+{
+    ASSERT(data.clientVersion == 2 || data.clientVersion == 3);
+
+    const gl::Caps &amp;caps = *data.caps;
+    const gl::Extensions &amp;extensions = *data.extensions;
+
+    ShInitBuiltInResources(&amp;mResources);
+    mResources.MaxVertexAttribs = caps.maxVertexAttributes;
+    mResources.MaxVertexUniformVectors = caps.maxVertexUniformVectors;
+    mResources.MaxVaryingVectors = caps.maxVaryingVectors;
+    mResources.MaxVertexTextureImageUnits = caps.maxVertexTextureImageUnits;
+    mResources.MaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
+    mResources.MaxTextureImageUnits = caps.maxTextureImageUnits;
+    mResources.MaxFragmentUniformVectors = caps.maxFragmentUniformVectors;
+    mResources.MaxDrawBuffers = caps.maxDrawBuffers;
+    mResources.OES_standard_derivatives = extensions.standardDerivatives;
+    mResources.EXT_draw_buffers = extensions.drawBuffers;
+    mResources.EXT_shader_texture_lod = 1;
+    // resources.OES_EGL_image_external = mRenderer-&gt;getShareHandleSupport() ? 1 : 0; // TODO: commented out until the extension is actually supported.
+    mResources.FragmentPrecisionHigh = 1;   // Shader Model 2+ always supports FP24 (s16e7) which corresponds to highp
+    mResources.EXT_frag_depth = 1; // Shader Model 2+ always supports explicit depth output
+
+    // GLSL ES 3.0 constants
+    mResources.MaxVertexOutputVectors = caps.maxVertexOutputComponents / 4;
+    mResources.MaxFragmentInputVectors = caps.maxFragmentInputComponents / 4;
+    mResources.MinProgramTexelOffset = caps.minProgramTexelOffset;
+    mResources.MaxProgramTexelOffset = caps.maxProgramTexelOffset;
+}
+
+CompilerD3D::~CompilerD3D()
+{
+    release();
+}
+
+gl::Error CompilerD3D::release()
+{
+    if (mFragmentCompiler)
+    {
+        ShDestruct(mFragmentCompiler);
+        mFragmentCompiler = NULL;
+
+        ASSERT(activeCompilerHandles &gt; 0);
+        activeCompilerHandles--;
+    }
+
+    if (mVertexCompiler)
+    {
+        ShDestruct(mVertexCompiler);
+        mVertexCompiler = NULL;
+
+        ASSERT(activeCompilerHandles &gt; 0);
+        activeCompilerHandles--;
+    }
+
+    if (activeCompilerHandles == 0)
+    {
+        ShFinalize();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+ShHandle CompilerD3D::getCompilerHandle(GLenum type)
+{
+    ShHandle *compiler = NULL;
+    switch (type)
+    {
+      case GL_VERTEX_SHADER:
+        compiler = &amp;mVertexCompiler;
+        break;
+
+      case GL_FRAGMENT_SHADER:
+        compiler = &amp;mFragmentCompiler;
+        break;
+
+      default:
+        UNREACHABLE();
+        return NULL;
+    }
+
+    if (!(*compiler))
+    {
+        if (activeCompilerHandles == 0)
+        {
+            ShInitialize();
+        }
+
+        *compiler = ShConstructCompiler(type, mSpec, mOutputType, &amp;mResources);
+        activeCompilerHandles++;
+    }
+
+    return *compiler;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dCompilerD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/CompilerD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// CompilerD3D.h: Defines the rx::CompilerD3D class, an implementation of rx::CompilerImpl.
+
+#ifndef LIBANGLE_RENDERER_COMPILERD3D_H_
+#define LIBANGLE_RENDERER_COMPILERD3D_H_
+
+#include &quot;libANGLE/renderer/CompilerImpl.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+
+#include &quot;GLSLANG/ShaderLang.h&quot;
+
+namespace gl
+{
+struct Data;
+}
+
+namespace rx
+{
+
+class CompilerD3D : public CompilerImpl
+{
+  public:
+    CompilerD3D(const gl::Data &amp;data, ShShaderOutput outputType);
+    virtual ~CompilerD3D();
+
+    gl::Error release() override;
+
+    ShHandle getCompilerHandle(GLenum type);
+
+  private:
+    ShShaderSpec mSpec;
+    ShShaderOutput mOutputType;
+    ShBuiltInResources mResources;
+
+    ShHandle mFragmentCompiler;
+    ShHandle mVertexCompiler;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_COMPILERD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDeviceD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// DeviceD3D.cpp: D3D implementation of egl::Device
+
+#include &quot;libANGLE/renderer/d3d/DeviceD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+
+#include &quot;libANGLE/Device.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+
+namespace rx
+{
+
+DeviceD3D::DeviceD3D(rx::RendererD3D *renderer)
+    : mRenderer(renderer)
+{
+}
+
+egl::Error DeviceD3D::getDevice(EGLAttrib *value)
+{
+    *value = reinterpret_cast&lt;EGLAttrib&gt;(mRenderer-&gt;getD3DDevice());
+    if (*value == 0)
+    {
+        return egl::Error(EGL_BAD_DEVICE_EXT);
+    }
+    return egl::Error(EGL_SUCCESS);
+}
+
+EGLint DeviceD3D::getType()
+{
+    switch (mRenderer-&gt;getRendererClass())
+    {
+      case RENDERER_D3D11:
+        return EGL_D3D11_DEVICE_ANGLE;
+      case RENDERER_D3D9:
+        return EGL_D3D9_DEVICE_ANGLE;
+      default:
+        UNREACHABLE();
+        return EGL_NONE;
+    }
+}
+
+void DeviceD3D::generateExtensions(egl::DeviceExtensions *outExtensions) const
+{
+    outExtensions-&gt;deviceD3D = true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDeviceD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DeviceD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// DeviceD3D.h: D3D implementation of egl::Device
+
+#ifndef LIBANGLE_RENDERER_D3D_DEVICED3D_H_
+#define LIBANGLE_RENDERER_D3D_DEVICED3D_H_
+
+#include &quot;libANGLE/Device.h&quot;
+#include &quot;libANGLE/renderer/DeviceImpl.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+
+namespace rx
+{
+class DeviceD3D : public DeviceImpl
+{
+  public:
+    DeviceD3D(RendererD3D *renderer);
+
+    egl::Error getDevice(EGLAttrib *value) override;
+    EGLint getType() override;
+    void generateExtensions(egl::DeviceExtensions *outExtensions) const override;
+
+  private:
+    RendererD3D *mRenderer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_DEVICED3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDisplayD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,441 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// DisplayD3D.cpp: D3D implementation of egl::Display
+
+#include &quot;libANGLE/renderer/d3d/DisplayD3D.h&quot;
+
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/histogram_macros.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SurfaceD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SwapChainD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/DeviceD3D.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+
+#if defined (ANGLE_ENABLE_D3D9)
+#   include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#endif // ANGLE_ENABLE_D3D9
+
+#if defined (ANGLE_ENABLE_D3D11)
+#   include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#endif // ANGLE_ENABLE_D3D11
+
+#if defined (ANGLE_TEST_CONFIG)
+#   define ANGLE_DEFAULT_D3D11 1
+#endif
+
+#if !defined(ANGLE_DEFAULT_D3D11)
+// Enables use of the Direct3D 11 API for a default display, when available
+#   define ANGLE_DEFAULT_D3D11 0
+#endif
+
+namespace rx
+{
+
+typedef RendererD3D *(*CreateRendererD3DFunction)(egl::Display*);
+
+template &lt;typename RendererType&gt;
+static RendererD3D *CreateTypedRendererD3D(egl::Display *display)
+{
+    return new RendererType(display);
+}
+
+egl::Error CreateRendererD3D(egl::Display *display, RendererD3D **outRenderer)
+{
+    ASSERT(outRenderer != nullptr);
+
+    std::vector&lt;CreateRendererD3DFunction&gt; rendererCreationFunctions;
+
+    const auto &amp;attribMap = display-&gt;getAttributeMap();
+    EGLNativeDisplayType nativeDisplay = display-&gt;getNativeDisplayId();
+
+    EGLint requestedDisplayType = attribMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
+
+#   if defined(ANGLE_ENABLE_D3D11)
+        if (nativeDisplay == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+            nativeDisplay == EGL_D3D11_ONLY_DISPLAY_ANGLE ||
+            requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+        {
+            rendererCreationFunctions.push_back(CreateTypedRendererD3D&lt;Renderer11&gt;);
+        }
+#   endif
+
+#   if defined(ANGLE_ENABLE_D3D9)
+        if (nativeDisplay == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
+            requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE)
+        {
+            rendererCreationFunctions.push_back(CreateTypedRendererD3D&lt;Renderer9&gt;);
+        }
+#   endif
+
+    if (nativeDisplay != EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE &amp;&amp;
+        nativeDisplay != EGL_D3D11_ONLY_DISPLAY_ANGLE &amp;&amp;
+        requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE)
+    {
+        // The default display is requested, try the D3D9 and D3D11 renderers, order them using
+        // the definition of ANGLE_DEFAULT_D3D11
+#       if ANGLE_DEFAULT_D3D11
+#           if defined(ANGLE_ENABLE_D3D11)
+                rendererCreationFunctions.push_back(CreateTypedRendererD3D&lt;Renderer11&gt;);
+#           endif
+#           if defined(ANGLE_ENABLE_D3D9)
+                rendererCreationFunctions.push_back(CreateTypedRendererD3D&lt;Renderer9&gt;);
+#           endif
+#       else
+#           if defined(ANGLE_ENABLE_D3D9)
+                rendererCreationFunctions.push_back(CreateTypedRendererD3D&lt;Renderer9&gt;);
+#           endif
+#           if defined(ANGLE_ENABLE_D3D11)
+                rendererCreationFunctions.push_back(CreateTypedRendererD3D&lt;Renderer11&gt;);
+#           endif
+#       endif
+    }
+
+    egl::Error result(EGL_NOT_INITIALIZED, &quot;No available renderers.&quot;);
+    for (size_t i = 0; i &lt; rendererCreationFunctions.size(); i++)
+    {
+        RendererD3D *renderer = rendererCreationFunctions[i](display);
+        result = renderer-&gt;initialize();
+
+#       if defined(ANGLE_ENABLE_D3D11)
+            if (renderer-&gt;getRendererClass() == RENDERER_D3D11)
+            {
+                ASSERT(result.getID() &gt;= 0 &amp;&amp; result.getID() &lt; NUM_D3D11_INIT_ERRORS);
+                ANGLE_HISTOGRAM_ENUMERATION(&quot;GPU.ANGLE.D3D11InitializeResult&quot;,
+                                            result.getID(),
+                                            NUM_D3D11_INIT_ERRORS);
+            }
+#       endif
+
+#       if defined(ANGLE_ENABLE_D3D9)
+            if (renderer-&gt;getRendererClass() == RENDERER_D3D9)
+            {
+                ASSERT(result.getID() &gt;= 0 &amp;&amp; result.getID() &lt; NUM_D3D9_INIT_ERRORS);
+                ANGLE_HISTOGRAM_ENUMERATION(&quot;GPU.ANGLE.D3D9InitializeResult&quot;,
+                                            result.getID(),
+                                            NUM_D3D9_INIT_ERRORS);
+            }
+#       endif
+
+        if (!result.isError())
+        {
+            *outRenderer = renderer;
+            break;
+        }
+        else
+        {
+            // Failed to create the renderer, try the next
+            SafeDelete(renderer);
+        }
+    }
+
+    return result;
+}
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+namespace
+{
+
+LRESULT CALLBACK IntermediateWindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    switch (message)
+    {
+      case WM_ERASEBKGND:
+        // Prevent windows from erasing the background.
+        return 1;
+      case WM_PAINT:
+        // Do not paint anything.
+        PAINTSTRUCT paint;
+        if (BeginPaint(window, &amp;paint))
+        {
+            EndPaint(window, &amp;paint);
+        }
+        return 0;
+    }
+
+    return DefWindowProc(window, message, wParam, lParam);
+}
+
+}
+#endif
+
+DisplayD3D::DisplayD3D()
+    : mDisplay(nullptr),
+      mRenderer(nullptr),
+      mChildWindowClass(0),
+      mDevice(nullptr)
+{
+}
+
+egl::Error DisplayD3D::createWindowSurface(const egl::Config *configuration, EGLNativeWindowType window,
+                                           const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface)
+{
+    ASSERT(mRenderer != nullptr);
+
+    EGLint width = attribs.get(EGL_WIDTH, 0);
+    EGLint height = attribs.get(EGL_HEIGHT, 0);
+    EGLint fixedSize = attribs.get(EGL_FIXED_SIZE_ANGLE, EGL_FALSE);
+
+    if (!fixedSize)
+    {
+        width = -1;
+        height = -1;
+    }
+
+    SurfaceD3D *surface = SurfaceD3D::createFromWindow(mRenderer, mDisplay, configuration, window, fixedSize,
+                                                       width, height);
+    egl::Error error = surface-&gt;initialize();
+    if (error.isError())
+    {
+        SafeDelete(surface);
+        return error;
+    }
+
+    *outSurface = surface;
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayD3D::createPbufferSurface(const egl::Config *configuration, const egl::AttributeMap &amp;attribs,
+                                            SurfaceImpl **outSurface)
+{
+    ASSERT(mRenderer != nullptr);
+
+    EGLint width = attribs.get(EGL_WIDTH, 0);
+    EGLint height = attribs.get(EGL_HEIGHT, 0);
+
+    SurfaceD3D *surface = SurfaceD3D::createOffscreen(mRenderer, mDisplay, configuration, NULL, width, height);
+    egl::Error error = surface-&gt;initialize();
+    if (error.isError())
+    {
+        SafeDelete(surface);
+        return error;
+    }
+
+    *outSurface = surface;
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayD3D::createPbufferFromClientBuffer(const egl::Config *configuration, EGLClientBuffer shareHandle,
+                                                     const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface)
+{
+    ASSERT(mRenderer != nullptr);
+
+    EGLint width = attribs.get(EGL_WIDTH, 0);
+    EGLint height = attribs.get(EGL_HEIGHT, 0);
+
+    SurfaceD3D *surface = SurfaceD3D::createOffscreen(mRenderer, mDisplay, configuration, shareHandle,
+                                                      width, height);
+    egl::Error error = surface-&gt;initialize();
+    if (error.isError())
+    {
+        SafeDelete(surface);
+        return error;
+    }
+
+    *outSurface = surface;
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayD3D::createPixmapSurface(const egl::Config *configuration, NativePixmapType nativePixmap,
+                                           const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface)
+{
+    ASSERT(mRenderer != nullptr);
+
+    UNIMPLEMENTED();
+    *outSurface = nullptr;
+    return egl::Error(EGL_BAD_DISPLAY);
+}
+
+egl::Error DisplayD3D::getDevice(DeviceImpl **device)
+{
+    *device = reinterpret_cast&lt;DeviceImpl*&gt;(mDevice);
+    ASSERT(*device != nullptr);
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayD3D::createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &amp;attribs,
+                                     gl::Context **outContext)
+{
+    ASSERT(mRenderer != nullptr);
+
+    EGLint clientVersion = attribs.get(EGL_CONTEXT_CLIENT_VERSION, 1);
+    bool notifyResets = (attribs.get(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, EGL_NO_RESET_NOTIFICATION_EXT) == EGL_LOSE_CONTEXT_ON_RESET_EXT);
+    bool robustAccess = (attribs.get(EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_FALSE) == EGL_TRUE);
+
+    *outContext = new gl::Context(config, clientVersion, shareContext, mRenderer, notifyResets, robustAccess);
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayD3D::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
+{
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayD3D::initialize(egl::Display *display)
+{
+    ASSERT(mRenderer == nullptr &amp;&amp; display != nullptr);
+    mDisplay = display;
+    egl::Error error = CreateRendererD3D(display, &amp;mRenderer);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(mDevice == nullptr);
+    mDevice = new DeviceD3D(mRenderer);
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    // Work around compile error from not defining &quot;UNICODE&quot; while Chromium does
+    const LPSTR idcArrow = MAKEINTRESOURCEA(32512);
+
+    std::string className = FormatString(&quot;ANGLE DisplayD3D 0x%0.8p Child Window Class&quot;, mDisplay);
+
+    WNDCLASSA childWindowClassDesc = { 0 };
+    childWindowClassDesc.style = CS_OWNDC;
+    childWindowClassDesc.lpfnWndProc = IntermediateWindowProc;
+    childWindowClassDesc.cbClsExtra = 0;
+    childWindowClassDesc.cbWndExtra = 0;
+    childWindowClassDesc.hInstance = GetModuleHandle(nullptr);
+    childWindowClassDesc.hIcon = nullptr;
+    childWindowClassDesc.hCursor = LoadCursorA(nullptr, idcArrow);
+    childWindowClassDesc.hbrBackground = 0;
+    childWindowClassDesc.lpszMenuName = nullptr;
+    childWindowClassDesc.lpszClassName = className.c_str();
+
+    mChildWindowClass = RegisterClassA(&amp;childWindowClassDesc);
+    if (!mChildWindowClass)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to register child window class.&quot;);
+    }
+#endif
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+void DisplayD3D::terminate()
+{
+    SafeDelete(mDevice);
+    SafeDelete(mRenderer);
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    if (mChildWindowClass != 0)
+    {
+        UnregisterClassA(reinterpret_cast&lt;const char*&gt;(mChildWindowClass), NULL);
+        mChildWindowClass = 0;
+    }
+#endif
+}
+
+egl::ConfigSet DisplayD3D::generateConfigs() const
+{
+    ASSERT(mRenderer != nullptr);
+    return mRenderer-&gt;generateConfigs();
+}
+
+bool DisplayD3D::isDeviceLost() const
+{
+    ASSERT(mRenderer != nullptr);
+    return mRenderer-&gt;isDeviceLost();
+}
+
+bool DisplayD3D::testDeviceLost()
+{
+    ASSERT(mRenderer != nullptr);
+    return mRenderer-&gt;testDeviceLost();
+}
+
+egl::Error DisplayD3D::restoreLostDevice()
+{
+    // Release surface resources to make the Reset() succeed
+    for (auto &amp;surface : mSurfaceSet)
+    {
+        if (surface-&gt;getBoundTexture())
+        {
+            surface-&gt;releaseTexImage(EGL_BACK_BUFFER);
+        }
+        SurfaceD3D *surfaceD3D = GetImplAs&lt;SurfaceD3D&gt;(surface);
+        surfaceD3D-&gt;releaseSwapChain();
+    }
+
+    if (!mRenderer-&gt;resetDevice())
+    {
+        return egl::Error(EGL_BAD_ALLOC);
+    }
+
+    // Restore any surfaces that may have been lost
+    for (const auto &amp;surface : mSurfaceSet)
+    {
+        SurfaceD3D *surfaceD3D = GetImplAs&lt;SurfaceD3D&gt;(surface);
+
+        egl::Error error = surfaceD3D-&gt;resetSwapChain();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+bool DisplayD3D::isValidNativeWindow(EGLNativeWindowType window) const
+{
+    return NativeWindow::isValidNativeWindow(window);
+}
+
+void DisplayD3D::generateExtensions(egl::DisplayExtensions *outExtensions) const
+{
+    outExtensions-&gt;createContextRobustness = true;
+
+    // ANGLE-specific extensions
+    if (mRenderer-&gt;getShareHandleSupport())
+    {
+        outExtensions-&gt;d3dShareHandleClientBuffer = true;
+        outExtensions-&gt;surfaceD3DTexture2DShareHandle = true;
+    }
+
+    outExtensions-&gt;querySurfacePointer = true;
+    outExtensions-&gt;windowFixedSize = true;
+
+    if (mRenderer-&gt;getPostSubBufferSupport())
+    {
+        outExtensions-&gt;postSubBuffer = true;
+    }
+
+    outExtensions-&gt;createContext = true;
+
+    outExtensions-&gt;deviceQuery = true;
+}
+
+std::string DisplayD3D::getVendorString() const
+{
+    std::string vendorString = &quot;Google Inc.&quot;;
+    if (mRenderer)
+    {
+        vendorString += &quot; &quot; + mRenderer-&gt;getVendorString();
+    }
+
+    return vendorString;
+}
+
+void DisplayD3D::generateCaps(egl::Caps *outCaps) const
+{
+    // Display must be initialized to generate caps
+    ASSERT(mRenderer != nullptr);
+
+    outCaps-&gt;textureNPOT = mRenderer-&gt;getRendererExtensions().textureNPOT;
+}
+
+ATOM DisplayD3D::getChildWindowClass() const
+{
+    return mChildWindowClass;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDisplayD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DisplayD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// DisplayD3D.h: D3D implementation of egl::Display
+
+#ifndef LIBANGLE_RENDERER_D3D_DISPLAYD3D_H_
+#define LIBANGLE_RENDERER_D3D_DISPLAYD3D_H_
+
+#include &quot;libANGLE/renderer/DisplayImpl.h&quot;
+#include &quot;libANGLE/Device.h&quot;
+
+namespace rx
+{
+class RendererD3D;
+
+class DisplayD3D : public DisplayImpl
+{
+  public:
+    DisplayD3D();
+
+    egl::Error initialize(egl::Display *display) override;
+    virtual void terminate() override;
+
+    egl::Error createWindowSurface(const egl::Config *configuration, EGLNativeWindowType window, const egl::AttributeMap &amp;attribs,
+                                   SurfaceImpl **outSurface) override;
+    egl::Error createPbufferSurface(const egl::Config *configuration, const egl::AttributeMap &amp;attribs,
+                                    SurfaceImpl **outSurface) override;
+    egl::Error createPbufferFromClientBuffer(const egl::Config *configuration, EGLClientBuffer shareHandle,
+                                             const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface) override;
+    egl::Error createPixmapSurface(const egl::Config *configuration, NativePixmapType nativePixmap,
+                                   const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface) override;
+
+    egl::Error createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &amp;attribs,
+                             gl::Context **outContext) override;
+
+    egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) override;
+
+    egl::ConfigSet generateConfigs() const override;
+
+    bool isDeviceLost() const override;
+    bool testDeviceLost() override;
+    egl::Error restoreLostDevice() override;
+
+    bool isValidNativeWindow(EGLNativeWindowType window) const override;
+
+    egl::Error getDevice(DeviceImpl **device) override;
+
+    std::string getVendorString() const override;
+
+    ATOM getChildWindowClass() const;
+
+  private:
+    void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
+    void generateCaps(egl::Caps *outCaps) const override;
+
+    egl::Display *mDisplay;
+
+    rx::RendererD3D *mRenderer;
+    ATOM mChildWindowClass;
+
+    DeviceImpl *mDevice;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_DISPLAYD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDynamicHLSLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1265 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// DynamicHLSL.cpp: Implementation for link and run-time HLSL generation
+//
+
+#include &quot;libANGLE/renderer/d3d/DynamicHLSL.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;compiler/translator/blocklayoutHLSL.h&quot;
+#include &quot;libANGLE/renderer/d3d/ShaderD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Shader.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+
+// For use with ArrayString, see angleutils.h
+static_assert(GL_INVALID_INDEX == UINT_MAX, &quot;GL_INVALID_INDEX must be equal to the max unsigned int.&quot;);
+
+using namespace gl;
+
+namespace rx
+{
+
+namespace
+{
+
+std::string HLSLComponentTypeString(GLenum componentType)
+{
+    switch (componentType)
+    {
+      case GL_UNSIGNED_INT:         return &quot;uint&quot;;
+      case GL_INT:                  return &quot;int&quot;;
+      case GL_UNSIGNED_NORMALIZED:
+      case GL_SIGNED_NORMALIZED:
+      case GL_FLOAT:                return &quot;float&quot;;
+      default: UNREACHABLE();       return &quot;not-component-type&quot;;
+    }
+}
+
+std::string HLSLComponentTypeString(GLenum componentType, int componentCount)
+{
+    return HLSLComponentTypeString(componentType) + (componentCount &gt; 1 ? Str(componentCount) : &quot;&quot;);
+}
+
+std::string HLSLMatrixTypeString(GLenum type)
+{
+    switch (type)
+    {
+      case GL_FLOAT_MAT2:     return &quot;float2x2&quot;;
+      case GL_FLOAT_MAT3:     return &quot;float3x3&quot;;
+      case GL_FLOAT_MAT4:     return &quot;float4x4&quot;;
+      case GL_FLOAT_MAT2x3:   return &quot;float2x3&quot;;
+      case GL_FLOAT_MAT3x2:   return &quot;float3x2&quot;;
+      case GL_FLOAT_MAT2x4:   return &quot;float2x4&quot;;
+      case GL_FLOAT_MAT4x2:   return &quot;float4x2&quot;;
+      case GL_FLOAT_MAT3x4:   return &quot;float3x4&quot;;
+      case GL_FLOAT_MAT4x3:   return &quot;float4x3&quot;;
+      default: UNREACHABLE(); return &quot;not-matrix-type&quot;;
+    }
+}
+
+std::string HLSLTypeString(GLenum type)
+{
+    if (gl::IsMatrixType(type))
+    {
+        return HLSLMatrixTypeString(type);
+    }
+
+    return HLSLComponentTypeString(gl::VariableComponentType(type), gl::VariableComponentCount(type));
+}
+
+const PixelShaderOutputVariable *FindOutputAtLocation(const std::vector&lt;PixelShaderOutputVariable&gt; &amp;outputVariables,
+                                                        unsigned int location)
+{
+    for (size_t variableIndex = 0; variableIndex &lt; outputVariables.size(); ++variableIndex)
+    {
+        if (outputVariables[variableIndex].outputIndex == location)
+        {
+            return &amp;outputVariables[variableIndex];
+        }
+    }
+
+    return NULL;
+}
+
+const std::string VERTEX_ATTRIBUTE_STUB_STRING = &quot;@@ VERTEX ATTRIBUTES @@&quot;;
+const std::string PIXEL_OUTPUT_STUB_STRING = &quot;@@ PIXEL OUTPUT @@&quot;;
+
+}
+
+DynamicHLSL::DynamicHLSL(RendererD3D *const renderer)
+    : mRenderer(renderer)
+{
+}
+
+static bool packVarying(PackedVarying *varying, const int maxVaryingVectors, VaryingPacking packing)
+{
+    // Make sure we use transposed matrix types to count registers correctly.
+    int registers = 0;
+    int elements = 0;
+
+    if (varying-&gt;isStruct())
+    {
+        registers = HLSLVariableRegisterCount(*varying, true) * varying-&gt;elementCount();
+        elements = 4;
+    }
+    else
+    {
+        GLenum transposedType = TransposeMatrixType(varying-&gt;type);
+        registers = VariableRowCount(transposedType) * varying-&gt;elementCount();
+        elements = VariableColumnCount(transposedType);
+    }
+
+    if (elements &gt;= 2 &amp;&amp; elements &lt;= 4)
+    {
+        for (int r = 0; r &lt;= maxVaryingVectors - registers; r++)
+        {
+            bool available = true;
+
+            for (int y = 0; y &lt; registers &amp;&amp; available; y++)
+            {
+                for (int x = 0; x &lt; elements &amp;&amp; available; x++)
+                {
+                    if (packing[r + y][x])
+                    {
+                        available = false;
+                    }
+                }
+            }
+
+            if (available)
+            {
+                varying-&gt;registerIndex = r;
+                varying-&gt;columnIndex = 0;
+
+                for (int y = 0; y &lt; registers; y++)
+                {
+                    for (int x = 0; x &lt; elements; x++)
+                    {
+                        packing[r + y][x] = &amp;*varying;
+                    }
+                }
+
+                return true;
+            }
+        }
+
+        if (elements == 2)
+        {
+            for (int r = maxVaryingVectors - registers; r &gt;= 0; r--)
+            {
+                bool available = true;
+
+                for (int y = 0; y &lt; registers &amp;&amp; available; y++)
+                {
+                    for (int x = 2; x &lt; 4 &amp;&amp; available; x++)
+                    {
+                        if (packing[r + y][x])
+                        {
+                            available = false;
+                        }
+                    }
+                }
+
+                if (available)
+                {
+                    varying-&gt;registerIndex = r;
+                    varying-&gt;columnIndex = 2;
+
+                    for (int y = 0; y &lt; registers; y++)
+                    {
+                        for (int x = 2; x &lt; 4; x++)
+                        {
+                            packing[r + y][x] = &amp;*varying;
+                        }
+                    }
+
+                    return true;
+                }
+            }
+        }
+    }
+    else if (elements == 1)
+    {
+        int space[4] = { 0 };
+
+        for (int y = 0; y &lt; maxVaryingVectors; y++)
+        {
+            for (int x = 0; x &lt; 4; x++)
+            {
+                space[x] += packing[y][x] ? 0 : 1;
+            }
+        }
+
+        int column = 0;
+
+        for (int x = 0; x &lt; 4; x++)
+        {
+            if (space[x] &gt;= registers &amp;&amp; (space[column] &lt; registers || space[x] &lt; space[column]))
+            {
+                column = x;
+            }
+        }
+
+        if (space[column] &gt;= registers)
+        {
+            for (int r = 0; r &lt; maxVaryingVectors; r++)
+            {
+                if (!packing[r][column])
+                {
+                    varying-&gt;registerIndex = r;
+                    varying-&gt;columnIndex = column;
+
+                    for (int y = r; y &lt; r + registers; y++)
+                    {
+                        packing[y][column] = &amp;*varying;
+                    }
+
+                    break;
+                }
+            }
+
+            return true;
+        }
+    }
+    else UNREACHABLE();
+
+    return false;
+}
+
+// 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 DynamicHLSL::packVaryings(InfoLog &amp;infoLog, VaryingPacking packing, ShaderD3D *fragmentShader,
+                              ShaderD3D *vertexShader, const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings)
+{
+    // TODO (geofflang):  Use context's caps
+    const int maxVaryingVectors = mRenderer-&gt;getRendererCaps().maxVaryingVectors;
+
+    vertexShader-&gt;resetVaryingsRegisterAssignment();
+    fragmentShader-&gt;resetVaryingsRegisterAssignment();
+
+    std::set&lt;std::string&gt; packedVaryings;
+
+    std::vector&lt;gl::PackedVarying&gt; &amp;fragmentVaryings = fragmentShader-&gt;getVaryings();
+    std::vector&lt;gl::PackedVarying&gt; &amp;vertexVaryings = vertexShader-&gt;getVaryings();
+    for (unsigned int varyingIndex = 0; varyingIndex &lt; fragmentVaryings.size(); varyingIndex++)
+    {
+        PackedVarying *varying = &amp;fragmentVaryings[varyingIndex];
+
+        // Do not assign registers to built-in or unreferenced varyings
+        if (varying-&gt;isBuiltIn() || !varying-&gt;staticUse)
+        {
+            continue;
+        }
+
+        if (packVarying(varying, maxVaryingVectors, packing))
+        {
+            packedVaryings.insert(varying-&gt;name);
+        }
+        else
+        {
+            infoLog.append(&quot;Could not pack varying %s&quot;, varying-&gt;name.c_str());
+            return -1;
+        }
+    }
+
+    for (unsigned int feedbackVaryingIndex = 0; feedbackVaryingIndex &lt; transformFeedbackVaryings.size(); feedbackVaryingIndex++)
+    {
+        const std::string &amp;transformFeedbackVarying = transformFeedbackVaryings[feedbackVaryingIndex];
+
+        if (transformFeedbackVarying == &quot;gl_Position&quot; || transformFeedbackVarying == &quot;gl_PointSize&quot;)
+        {
+            // do not pack builtin XFB varyings
+            continue;
+        }
+
+        if (packedVaryings.find(transformFeedbackVarying) == packedVaryings.end())
+        {
+            bool found = false;
+            for (unsigned int varyingIndex = 0; varyingIndex &lt; vertexVaryings.size(); varyingIndex++)
+            {
+                PackedVarying *varying = &amp;vertexVaryings[varyingIndex];
+                if (transformFeedbackVarying == varying-&gt;name)
+                {
+                    if (!packVarying(varying, maxVaryingVectors, packing))
+                    {
+                        infoLog.append(&quot;Could not pack varying %s&quot;, varying-&gt;name.c_str());
+                        return -1;
+                    }
+
+                    found = true;
+                    break;
+                }
+            }
+
+            if (!found)
+            {
+                infoLog.append(&quot;Transform feedback varying %s does not exist in the vertex shader.&quot;, transformFeedbackVarying.c_str());
+                return -1;
+            }
+        }
+    }
+
+    // Return the number of used registers
+    int registers = 0;
+
+    for (int r = 0; r &lt; maxVaryingVectors; r++)
+    {
+        if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
+        {
+            registers++;
+        }
+    }
+
+    return registers;
+}
+
+std::string DynamicHLSL::generateVaryingHLSL(const ShaderD3D *shader) const
+{
+    std::string varyingSemantic = getVaryingSemantic(shader-&gt;mUsesPointSize);
+    std::string varyingHLSL;
+
+    const std::vector&lt;gl::PackedVarying&gt; &amp;varyings = shader-&gt;getVaryings();
+
+    for (unsigned int varyingIndex = 0; varyingIndex &lt; varyings.size(); varyingIndex++)
+    {
+        const PackedVarying &amp;varying = varyings[varyingIndex];
+        if (varying.registerAssigned())
+        {
+            ASSERT(!varying.isBuiltIn());
+            GLenum transposedType = TransposeMatrixType(varying.type);
+            int variableRows = (varying.isStruct() ? 1 : VariableRowCount(transposedType));
+
+            for (unsigned int elementIndex = 0; elementIndex &lt; varying.elementCount(); elementIndex++)
+            {
+                for (int row = 0; row &lt; variableRows; row++)
+                {
+                    // TODO: Add checks to ensure D3D interpolation modifiers don't result in too many registers being used.
+                    // For example, if there are N registers, and we have N vec3 varyings and 1 float varying, then D3D will pack them into N registers.
+                    // If the float varying has the 'nointerpolation' modifier on it then we would need N + 1 registers, and D3D compilation will fail.
+
+                    switch (varying.interpolation)
+                    {
+                      case sh::INTERPOLATION_SMOOTH:   varyingHLSL += &quot;    &quot;;                 break;
+                      case sh::INTERPOLATION_FLAT:     varyingHLSL += &quot;    nointerpolation &quot;; break;
+                      case sh::INTERPOLATION_CENTROID: varyingHLSL += &quot;    centroid &quot;;        break;
+                      default:  UNREACHABLE();
+                    }
+
+                    unsigned int semanticIndex = elementIndex * variableRows +
+                                                 varying.columnIndex * mRenderer-&gt;getRendererCaps().maxVaryingVectors +
+                                                 varying.registerIndex + row;
+                    std::string n = Str(semanticIndex);
+
+                    std::string typeString;
+
+                    if (varying.isStruct())
+                    {
+                        // TODO(jmadill): pass back translated name from the shader translator
+                        typeString = decorateVariable(varying.structName);
+                    }
+                    else
+                    {
+                        GLenum componentType = VariableComponentType(transposedType);
+                        int columnCount = VariableColumnCount(transposedType);
+                        typeString = HLSLComponentTypeString(componentType, columnCount);
+                    }
+                    varyingHLSL += typeString + &quot; v&quot; + n + &quot; : &quot; + varyingSemantic + n + &quot;;\n&quot;;
+                }
+            }
+        }
+    }
+
+    return varyingHLSL;
+}
+
+std::string DynamicHLSL::generateVertexShaderForInputLayout(const std::string &amp;sourceShader,
+                                                            const VertexFormat inputLayout[],
+                                                            const std::vector&lt;sh::Attribute&gt; &amp;shaderAttributes) const
+{
+    std::string structHLSL, initHLSL;
+
+    int semanticIndex = 0;
+    unsigned int inputIndex = 0;
+
+    // If gl_PointSize is used in the shader then pointsprites rendering is expected.
+    // If the renderer does not support Geometry shaders then Instanced PointSprite emulation
+    // must be used.
+    bool usesPointSize = sourceShader.find(&quot;GL_USES_POINT_SIZE&quot;) != std::string::npos;
+    bool useInstancedPointSpriteEmulation = usesPointSize &amp;&amp; mRenderer-&gt;getWorkarounds().useInstancedPointSpriteEmulation;
+
+    // Instanced PointSprite emulation requires additional entries in the
+    // VS_INPUT structure to support the vertices that make up the quad vertices.
+    // These values must be in sync with the cooresponding values added during inputlayout creation
+    // in InputLayoutCache::applyVertexBuffers().
+    //
+    // The additional entries must appear first in the VS_INPUT layout because
+    // Windows Phone 8 era devices require per vertex data to physically come
+    // before per instance data in the shader.
+    if (useInstancedPointSpriteEmulation)
+    {
+        structHLSL += &quot;    float3 spriteVertexPos : SPRITEPOSITION0;\n&quot;;
+        structHLSL += &quot;    float2 spriteTexCoord : SPRITETEXCOORD0;\n&quot;;
+    }
+
+    for (size_t attributeIndex = 0; attributeIndex &lt; shaderAttributes.size(); ++attributeIndex)
+    {
+        const sh::Attribute &amp;shaderAttribute = shaderAttributes[attributeIndex];
+        if (!shaderAttribute.name.empty())
+        {
+            ASSERT(inputIndex &lt; MAX_VERTEX_ATTRIBS);
+            const VertexFormat &amp;vertexFormat = inputLayout[inputIndex];
+
+            // HLSL code for input structure
+            if (IsMatrixType(shaderAttribute.type))
+            {
+                // Matrix types are always transposed
+                structHLSL += &quot;    &quot; + HLSLMatrixTypeString(TransposeMatrixType(shaderAttribute.type));
+            }
+            else
+            {
+                GLenum componentType = mRenderer-&gt;getVertexComponentType(vertexFormat);
+
+                if (shaderAttribute.name == &quot;gl_InstanceID&quot;)
+                {
+                    // The input type of the instance ID in HLSL (uint) differs from the one in ESSL (int).
+                    structHLSL += &quot; uint&quot;;
+                }
+                else
+                {
+                    structHLSL += &quot;    &quot; + HLSLComponentTypeString(componentType, VariableComponentCount(shaderAttribute.type));
+                }
+            }
+
+            structHLSL += &quot; &quot; + decorateVariable(shaderAttribute.name) + &quot; : &quot;;
+
+            if (shaderAttribute.name == &quot;gl_InstanceID&quot;)
+            {
+                structHLSL += &quot;SV_InstanceID&quot;;
+            }
+            else
+            {
+                structHLSL += &quot;TEXCOORD&quot; + Str(semanticIndex);
+                semanticIndex += VariableRegisterCount(shaderAttribute.type);
+            }
+
+            structHLSL += &quot;;\n&quot;;
+
+            // HLSL code for initialization
+            initHLSL += &quot;    &quot; + decorateVariable(shaderAttribute.name) + &quot; = &quot;;
+
+            // Mismatched vertex attribute to vertex input may result in an undefined
+            // data reinterpretation (eg for pure integer-&gt;float, float-&gt;pure integer)
+            // TODO: issue warning with gl debug info extension, when supported
+            if (IsMatrixType(shaderAttribute.type) ||
+                (mRenderer-&gt;getVertexConversionType(vertexFormat) &amp; VERTEX_CONVERT_GPU) != 0)
+            {
+                initHLSL += generateAttributeConversionHLSL(vertexFormat, shaderAttribute);
+            }
+            else
+            {
+                initHLSL += &quot;input.&quot; + decorateVariable(shaderAttribute.name);
+            }
+
+            initHLSL += &quot;;\n&quot;;
+
+            inputIndex += VariableRowCount(TransposeMatrixType(shaderAttribute.type));
+        }
+    }
+
+    std::string replacementHLSL = &quot;struct VS_INPUT\n&quot;
+                                  &quot;{\n&quot; +
+                                  structHLSL +
+                                  &quot;};\n&quot;
+                                  &quot;\n&quot;
+                                  &quot;void initAttributes(VS_INPUT input)\n&quot;
+                                  &quot;{\n&quot; +
+                                  initHLSL +
+                                  &quot;}\n&quot;;
+
+    std::string vertexHLSL(sourceShader);
+
+    size_t copyInsertionPos = vertexHLSL.find(VERTEX_ATTRIBUTE_STUB_STRING);
+    vertexHLSL.replace(copyInsertionPos, VERTEX_ATTRIBUTE_STUB_STRING.length(), replacementHLSL);
+
+    return vertexHLSL;
+}
+
+std::string DynamicHLSL::generatePixelShaderForOutputSignature(const std::string &amp;sourceShader, const std::vector&lt;PixelShaderOutputVariable&gt; &amp;outputVariables,
+                                                               bool usesFragDepth, const std::vector&lt;GLenum&gt; &amp;outputLayout) const
+{
+    const int shaderModel = mRenderer-&gt;getMajorShaderModel();
+    std::string targetSemantic = (shaderModel &gt;= 4) ? &quot;SV_TARGET&quot; : &quot;COLOR&quot;;
+    std::string depthSemantic = (shaderModel &gt;= 4) ? &quot;SV_Depth&quot; : &quot;DEPTH&quot;;
+
+    std::string declarationHLSL;
+    std::string copyHLSL;
+
+    for (size_t layoutIndex = 0; layoutIndex &lt; outputLayout.size(); ++layoutIndex)
+    {
+        GLenum binding = outputLayout[layoutIndex];
+
+        if (binding != GL_NONE)
+        {
+            unsigned int location = (binding - GL_COLOR_ATTACHMENT0);
+
+            const PixelShaderOutputVariable *outputVariable = FindOutputAtLocation(outputVariables, location);
+
+            // OpenGL ES 3.0 spec $4.2.1
+            // If [...] not all user-defined output variables are written, the values of fragment colors
+            // corresponding to unwritten variables are similarly undefined.
+            if (outputVariable)
+            {
+                declarationHLSL += &quot;    &quot; + HLSLTypeString(outputVariable-&gt;type) + &quot; &quot; + outputVariable-&gt;name +
+                                   &quot; : &quot; + targetSemantic + Str(layoutIndex) + &quot;;\n&quot;;
+
+                copyHLSL += &quot;    output.&quot; + outputVariable-&gt;name + &quot; = &quot; + outputVariable-&gt;source + &quot;;\n&quot;;
+            }
+        }
+    }
+
+    if (usesFragDepth)
+    {
+        declarationHLSL += &quot;    float gl_Depth : &quot; + depthSemantic + &quot;;\n&quot;;
+        copyHLSL += &quot;    output.gl_Depth = gl_Depth; \n&quot;;
+    }
+
+    std::string replacementHLSL = &quot;struct PS_OUTPUT\n&quot;
+                                  &quot;{\n&quot; +
+                                  declarationHLSL +
+                                  &quot;};\n&quot;
+                                  &quot;\n&quot;
+                                  &quot;PS_OUTPUT generateOutput()\n&quot;
+                                  &quot;{\n&quot;
+                                  &quot;    PS_OUTPUT output;\n&quot; +
+                                  copyHLSL +
+                                  &quot;    return output;\n&quot;
+                                  &quot;}\n&quot;;
+
+    std::string pixelHLSL(sourceShader);
+
+    size_t outputInsertionPos = pixelHLSL.find(PIXEL_OUTPUT_STUB_STRING);
+    pixelHLSL.replace(outputInsertionPos, PIXEL_OUTPUT_STUB_STRING.length(), replacementHLSL);
+
+    return pixelHLSL;
+}
+
+std::string DynamicHLSL::getVaryingSemantic(bool pointSize) const
+{
+    // SM3 reserves the TEXCOORD semantic for point sprite texcoords (gl_PointCoord)
+    // In D3D11 we manually compute gl_PointCoord in the GS.
+    int shaderModel = mRenderer-&gt;getMajorShaderModel();
+    return ((pointSize &amp;&amp; shaderModel &lt; 4) ? &quot;COLOR&quot; : &quot;TEXCOORD&quot;);
+}
+
+struct DynamicHLSL::SemanticInfo
+{
+    struct BuiltinInfo
+    {
+        BuiltinInfo()
+            : enabled(false),
+              index(0),
+              systemValue(false)
+        {}
+
+        bool enabled;
+        std::string semantic;
+        unsigned int index;
+        bool systemValue;
+
+        std::string str() const
+        {
+            return (systemValue ? semantic : (semantic + Str(index)));
+        }
+
+        void enableSystem(const std::string &amp;systemValueSemantic)
+        {
+            enabled = true;
+            semantic = systemValueSemantic;
+            systemValue = true;
+        }
+
+        void enable(const std::string &amp;semanticVal, unsigned int indexVal)
+        {
+            enabled = true;
+            semantic = semanticVal;
+            index = indexVal;
+        }
+    };
+
+    BuiltinInfo dxPosition;
+    BuiltinInfo glPosition;
+    BuiltinInfo glFragCoord;
+    BuiltinInfo glPointCoord;
+    BuiltinInfo glPointSize;
+};
+
+DynamicHLSL::SemanticInfo DynamicHLSL::getSemanticInfo(int startRegisters, bool position, bool fragCoord,
+                                                       bool pointCoord, bool pointSize, bool pixelShader) const
+{
+    SemanticInfo info;
+    bool hlsl4 = (mRenderer-&gt;getMajorShaderModel() &gt;= 4);
+    const std::string &amp;varyingSemantic = getVaryingSemantic(pointSize);
+
+    int reservedRegisterIndex = startRegisters;
+
+    if (hlsl4)
+    {
+        info.dxPosition.enableSystem(&quot;SV_Position&quot;);
+    }
+    else if (pixelShader)
+    {
+        info.dxPosition.enableSystem(&quot;VPOS&quot;);
+    }
+    else
+    {
+        info.dxPosition.enableSystem(&quot;POSITION&quot;);
+    }
+
+    if (position)
+    {
+        info.glPosition.enable(varyingSemantic, reservedRegisterIndex++);
+    }
+
+    if (fragCoord)
+    {
+        info.glFragCoord.enable(varyingSemantic, reservedRegisterIndex++);
+    }
+
+    if (pointCoord)
+    {
+        // SM3 reserves the TEXCOORD semantic for point sprite texcoords (gl_PointCoord)
+        // In D3D11 we manually compute gl_PointCoord in the GS.
+        if (hlsl4)
+        {
+            info.glPointCoord.enable(varyingSemantic, reservedRegisterIndex++);
+        }
+        else
+        {
+            info.glPointCoord.enable(&quot;TEXCOORD&quot;, 0);
+        }
+    }
+
+    // Special case: do not include PSIZE semantic in HLSL 3 pixel shaders
+    if (pointSize &amp;&amp; (!pixelShader || hlsl4))
+    {
+        info.glPointSize.enableSystem(&quot;PSIZE&quot;);
+    }
+
+    return info;
+}
+
+std::string DynamicHLSL::generateVaryingLinkHLSL(const SemanticInfo &amp;info, const std::string &amp;varyingHLSL) const
+{
+    std::string linkHLSL = &quot;{\n&quot;;
+
+    ASSERT(info.dxPosition.enabled);
+    linkHLSL += &quot;    float4 dx_Position : &quot; + info.dxPosition.str() + &quot;;\n&quot;;
+
+    if (info.glPosition.enabled)
+    {
+        linkHLSL += &quot;    float4 gl_Position : &quot; + info.glPosition.str() + &quot;;\n&quot;;
+    }
+
+    if (info.glFragCoord.enabled)
+    {
+        linkHLSL += &quot;    float4 gl_FragCoord : &quot; + info.glFragCoord.str() + &quot;;\n&quot;;
+    }
+
+    if (info.glPointCoord.enabled)
+    {
+        linkHLSL += &quot;    float2 gl_PointCoord : &quot; + info.glPointCoord.str() + &quot;;\n&quot;;
+    }
+
+    if (info.glPointSize.enabled)
+    {
+        linkHLSL += &quot;    float gl_PointSize : &quot; + info.glPointSize.str() + &quot;;\n&quot;;
+    }
+
+    // Do this after glPointSize, to potentially combine gl_PointCoord and gl_PointSize into the same register.
+    linkHLSL += varyingHLSL;
+
+    linkHLSL += &quot;};\n&quot;;
+
+    return linkHLSL;
+}
+
+void DynamicHLSL::storeBuiltinLinkedVaryings(const SemanticInfo &amp;info,
+                                             std::vector&lt;LinkedVarying&gt; *linkedVaryings) const
+{
+    if (info.glPosition.enabled)
+    {
+        linkedVaryings-&gt;push_back(LinkedVarying(&quot;gl_Position&quot;, GL_FLOAT_VEC4, 1, info.glPosition.semantic,
+                                                info.glPosition.index, 1));
+    }
+
+    if (info.glFragCoord.enabled)
+    {
+        linkedVaryings-&gt;push_back(LinkedVarying(&quot;gl_FragCoord&quot;, GL_FLOAT_VEC4, 1, info.glFragCoord.semantic,
+                                                info.glFragCoord.index, 1));
+    }
+
+    if (info.glPointSize.enabled)
+    {
+        linkedVaryings-&gt;push_back(LinkedVarying(&quot;gl_PointSize&quot;, GL_FLOAT, 1, &quot;PSIZE&quot;, 0, 1));
+    }
+}
+
+void DynamicHLSL::storeUserLinkedVaryings(const ShaderD3D *vertexShader,
+                                          std::vector&lt;LinkedVarying&gt; *linkedVaryings) const
+{
+    const std::string &amp;varyingSemantic = getVaryingSemantic(vertexShader-&gt;mUsesPointSize);
+    const std::vector&lt;PackedVarying&gt; &amp;varyings = vertexShader-&gt;getVaryings();
+
+    for (unsigned int varyingIndex = 0; varyingIndex &lt; varyings.size(); varyingIndex++)
+    {
+        const PackedVarying &amp;varying = varyings[varyingIndex];
+
+        if (varying.registerAssigned())
+        {
+            ASSERT(!varying.isBuiltIn());
+            GLenum transposedType = TransposeMatrixType(varying.type);
+            int variableRows = (varying.isStruct() ? 1 : VariableRowCount(transposedType));
+
+            linkedVaryings-&gt;push_back(LinkedVarying(varying.name, varying.type, varying.elementCount(),
+                                                    varyingSemantic, varying.registerIndex,
+                                                    variableRows * varying.elementCount()));
+        }
+    }
+}
+
+bool DynamicHLSL::generateShaderLinkHLSL(const gl::Data &amp;data, InfoLog &amp;infoLog, int registers,
+                                         const VaryingPacking packing,
+                                         std::string &amp;pixelHLSL, std::string &amp;vertexHLSL,
+                                         ShaderD3D *fragmentShader, ShaderD3D *vertexShader,
+                                         const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings,
+                                         std::vector&lt;LinkedVarying&gt; *linkedVaryings,
+                                         std::map&lt;int, VariableLocation&gt; *programOutputVars,
+                                         std::vector&lt;PixelShaderOutputVariable&gt; *outPixelShaderKey,
+                                         bool *outUsesFragDepth) const
+{
+    if (pixelHLSL.empty() || vertexHLSL.empty())
+    {
+        return false;
+    }
+
+    bool usesMRT = fragmentShader-&gt;mUsesMultipleRenderTargets;
+    bool usesFragColor = fragmentShader-&gt;mUsesFragColor;
+    bool usesFragData = fragmentShader-&gt;mUsesFragData;
+    bool usesFragCoord = fragmentShader-&gt;mUsesFragCoord;
+    bool usesPointCoord = fragmentShader-&gt;mUsesPointCoord;
+    bool usesPointSize = vertexShader-&gt;mUsesPointSize;
+    bool useInstancedPointSpriteEmulation = usesPointSize &amp;&amp; mRenderer-&gt;getWorkarounds().useInstancedPointSpriteEmulation;
+
+    if (usesFragColor &amp;&amp; usesFragData)
+    {
+        infoLog.append(&quot;Cannot use both gl_FragColor and gl_FragData in the same fragment shader.&quot;);
+        return false;
+    }
+
+    // Write the HLSL input/output declarations
+    const int shaderModel = mRenderer-&gt;getMajorShaderModel();
+    const int registersNeeded = registers + (usesFragCoord ? 1 : 0) + (usesPointCoord ? 1 : 0);
+
+    // Two cases when writing to gl_FragColor and using ESSL 1.0:
+    // - with a 3.0 context, the output color is copied to channel 0
+    // - with a 2.0 context, the output color is broadcast to all channels
+    const bool broadcast = (fragmentShader-&gt;mUsesFragColor &amp;&amp; data.clientVersion &lt; 3);
+    const unsigned int numRenderTargets = (broadcast || usesMRT ? data.caps-&gt;maxDrawBuffers : 1);
+
+    // gl_Position only needs to be outputted from the vertex shader if transform feedback is active.
+    // This isn't supported on D3D11 Feature Level 9_3, so we don't output gl_Position from the vertex shader in this case.
+    // This saves us 1 output vector.
+    bool outputPositionFromVS = !(shaderModel &gt;= 4 &amp;&amp; mRenderer-&gt;getShaderModelSuffix() != &quot;&quot;);
+
+    int shaderVersion = vertexShader-&gt;getShaderVersion();
+
+    if (static_cast&lt;GLuint&gt;(registersNeeded) &gt; data.caps-&gt;maxVaryingVectors)
+    {
+        infoLog.append(&quot;No varying registers left to support gl_FragCoord/gl_PointCoord&quot;);
+        return false;
+    }
+
+    const std::string &amp;varyingHLSL = generateVaryingHLSL(vertexShader);
+
+    // Instanced PointSprite emulation requires that gl_PointCoord is present in the vertex shader VS_OUTPUT
+    // structure to ensure compatibility with the generated PS_INPUT of the pixel shader.
+    // GeometryShader PointSprite emulation does not require this additional entry because the
+    // GS_OUTPUT of the Geometry shader contains the pointCoord value and already matches the PS_INPUT of the
+    // generated pixel shader.
+    // The Geometry Shader point sprite implementation needs gl_PointSize to be in VS_OUTPUT and GS_INPUT.
+    // Instanced point sprites doesn't need gl_PointSize in VS_OUTPUT.
+    const SemanticInfo &amp;vertexSemantics = getSemanticInfo(registers, outputPositionFromVS,
+                                                          usesFragCoord, (useInstancedPointSpriteEmulation &amp;&amp; usesPointCoord),
+                                                          (!useInstancedPointSpriteEmulation &amp;&amp; usesPointSize), false);
+
+    storeUserLinkedVaryings(vertexShader, linkedVaryings);
+    storeBuiltinLinkedVaryings(vertexSemantics, linkedVaryings);
+
+    // Instanced PointSprite emulation requires additional entries originally generated in the
+    // GeometryShader HLSL.  These include pointsize clamp values.
+    if (useInstancedPointSpriteEmulation)
+    {
+        vertexHLSL += &quot;static float minPointSize = &quot; + Str((int)mRenderer-&gt;getRendererCaps().minAliasedPointSize) + &quot;.0f;\n&quot;
+                      &quot;static float maxPointSize = &quot; + Str((int)mRenderer-&gt;getRendererCaps().maxAliasedPointSize) + &quot;.0f;\n&quot;;
+    }
+
+    // Add stub string to be replaced when shader is dynamically defined by its layout
+    vertexHLSL += &quot;\n&quot; + VERTEX_ATTRIBUTE_STUB_STRING + &quot;\n&quot;
+                  &quot;struct VS_OUTPUT\n&quot; + generateVaryingLinkHLSL(vertexSemantics, varyingHLSL) + &quot;\n&quot;
+                  &quot;VS_OUTPUT main(VS_INPUT input)\n&quot;
+                  &quot;{\n&quot;
+                  &quot;    initAttributes(input);\n&quot;;
+
+    if (vertexShader-&gt;usesDeferredInit())
+    {
+        vertexHLSL += &quot;\n&quot;
+                      &quot;    initializeDeferredGlobals();\n&quot;;
+    }
+
+    vertexHLSL += &quot;\n&quot;
+                  &quot;    gl_main();\n&quot;
+                  &quot;\n&quot;
+                  &quot;    VS_OUTPUT output;\n&quot;;
+
+    if (outputPositionFromVS)
+    {
+        vertexHLSL += &quot;    output.gl_Position = gl_Position;\n&quot;;
+    }
+
+    // On D3D9 or D3D11 Feature Level 9, we need to emulate large viewports using dx_ViewAdjust.
+    if (shaderModel &gt;= 4  &amp;&amp; mRenderer-&gt;getShaderModelSuffix() == &quot;&quot;)
+    {
+        vertexHLSL += &quot;    output.dx_Position.x = gl_Position.x;\n&quot;
+                      &quot;    output.dx_Position.y = -gl_Position.y;\n&quot;
+                      &quot;    output.dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n&quot;
+                      &quot;    output.dx_Position.w = gl_Position.w;\n&quot;;
+    }
+    else
+    {
+        vertexHLSL += &quot;    output.dx_Position.x = gl_Position.x * dx_ViewAdjust.z + dx_ViewAdjust.x * gl_Position.w;\n&quot;
+                      &quot;    output.dx_Position.y = -(gl_Position.y * dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n&quot;
+                      &quot;    output.dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n&quot;
+                      &quot;    output.dx_Position.w = gl_Position.w;\n&quot;;
+    }
+
+    // We don't need to output gl_PointSize if we use are emulating point sprites via instancing.
+    if (usesPointSize &amp;&amp; shaderModel &gt;= 3 &amp;&amp; !useInstancedPointSpriteEmulation)
+    {
+        vertexHLSL += &quot;    output.gl_PointSize = gl_PointSize;\n&quot;;
+    }
+
+    if (usesFragCoord)
+    {
+        vertexHLSL += &quot;    output.gl_FragCoord = gl_Position;\n&quot;;
+    }
+
+    const std::vector&lt;PackedVarying&gt; &amp;vertexVaryings = vertexShader-&gt;getVaryings();
+    for (unsigned int vertVaryingIndex = 0; vertVaryingIndex &lt; vertexVaryings.size(); vertVaryingIndex++)
+    {
+        const PackedVarying &amp;varying = vertexVaryings[vertVaryingIndex];
+        if (varying.registerAssigned())
+        {
+            for (unsigned int elementIndex = 0; elementIndex &lt; varying.elementCount(); elementIndex++)
+            {
+                int variableRows = (varying.isStruct() ? 1 : VariableRowCount(TransposeMatrixType(varying.type)));
+
+                for (int row = 0; row &lt; variableRows; row++)
+                {
+                    int r = varying.registerIndex + varying.columnIndex * data.caps-&gt;maxVaryingVectors + elementIndex * variableRows + row;
+                    vertexHLSL += &quot;    output.v&quot; + Str(r);
+
+                    vertexHLSL += &quot; = _&quot; + varying.name;
+
+                    if (varying.isArray())
+                    {
+                        vertexHLSL += ArrayString(elementIndex);
+                    }
+
+                    if (variableRows &gt; 1)
+                    {
+                        vertexHLSL += ArrayString(row);
+                    }
+
+                    vertexHLSL += &quot;;\n&quot;;
+                }
+            }
+        }
+    }
+
+    // Instanced PointSprite emulation requires additional entries to calculate
+    // the final output vertex positions of the quad that represents each sprite.
+    if (useInstancedPointSpriteEmulation)
+    {
+        vertexHLSL += &quot;\n&quot;
+                      &quot;    gl_PointSize = clamp(gl_PointSize, minPointSize, maxPointSize);\n&quot;
+                      &quot;    output.dx_Position.xyz += float3(input.spriteVertexPos.x * gl_PointSize / (dx_ViewCoords.x*2), input.spriteVertexPos.y * gl_PointSize / (dx_ViewCoords.y*2), input.spriteVertexPos.z) * output.dx_Position.w;\n&quot;;
+
+        if (usesPointCoord)
+        {
+            vertexHLSL += &quot;\n&quot;
+                          &quot;    output.gl_PointCoord = input.spriteTexCoord;\n&quot;;
+        }
+    }
+
+    vertexHLSL += &quot;\n&quot;
+                  &quot;    return output;\n&quot;
+                  &quot;}\n&quot;;
+
+    const SemanticInfo &amp;pixelSemantics = getSemanticInfo(registers, outputPositionFromVS, usesFragCoord, usesPointCoord,
+                                                         (!useInstancedPointSpriteEmulation &amp;&amp; usesPointSize), true);
+
+    pixelHLSL += &quot;struct PS_INPUT\n&quot; + generateVaryingLinkHLSL(pixelSemantics, varyingHLSL) + &quot;\n&quot;;
+
+    if (shaderVersion &lt; 300)
+    {
+        for (unsigned int renderTargetIndex = 0; renderTargetIndex &lt; numRenderTargets; renderTargetIndex++)
+        {
+            PixelShaderOutputVariable outputKeyVariable;
+            outputKeyVariable.type = GL_FLOAT_VEC4;
+            outputKeyVariable.name = &quot;gl_Color&quot; + Str(renderTargetIndex);
+            outputKeyVariable.source = broadcast ? &quot;gl_Color[0]&quot; : &quot;gl_Color[&quot; + Str(renderTargetIndex) + &quot;]&quot;;
+            outputKeyVariable.outputIndex = renderTargetIndex;
+
+            outPixelShaderKey-&gt;push_back(outputKeyVariable);
+        }
+
+        *outUsesFragDepth = fragmentShader-&gt;mUsesFragDepth;
+    }
+    else
+    {
+        defineOutputVariables(fragmentShader, programOutputVars);
+
+        const std::vector&lt;sh::Attribute&gt; &amp;shaderOutputVars = fragmentShader-&gt;getActiveOutputVariables();
+        for (auto locationIt = programOutputVars-&gt;begin(); locationIt != programOutputVars-&gt;end(); locationIt++)
+        {
+            const VariableLocation &amp;outputLocation = locationIt-&gt;second;
+            const sh::ShaderVariable &amp;outputVariable = shaderOutputVars[outputLocation.index];
+            const std::string &amp;variableName = &quot;out_&quot; + outputLocation.name;
+            const std::string &amp;elementString = (outputLocation.element == GL_INVALID_INDEX ? &quot;&quot; : Str(outputLocation.element));
+
+            ASSERT(outputVariable.staticUse);
+
+            PixelShaderOutputVariable outputKeyVariable;
+            outputKeyVariable.type = outputVariable.type;
+            outputKeyVariable.name = variableName + elementString;
+            outputKeyVariable.source = variableName + ArrayString(outputLocation.element);
+            outputKeyVariable.outputIndex = locationIt-&gt;first;
+
+            outPixelShaderKey-&gt;push_back(outputKeyVariable);
+        }
+
+        *outUsesFragDepth = false;
+    }
+
+    pixelHLSL += PIXEL_OUTPUT_STUB_STRING + &quot;\n&quot;;
+
+    if (fragmentShader-&gt;mUsesFrontFacing)
+    {
+        if (shaderModel &gt;= 4)
+        {
+            pixelHLSL += &quot;PS_OUTPUT main(PS_INPUT input, bool isFrontFace : SV_IsFrontFace)\n&quot;
+                         &quot;{\n&quot;;
+        }
+        else
+        {
+            pixelHLSL += &quot;PS_OUTPUT main(PS_INPUT input, float vFace : VFACE)\n&quot;
+                         &quot;{\n&quot;;
+        }
+    }
+    else
+    {
+        pixelHLSL += &quot;PS_OUTPUT main(PS_INPUT input)\n&quot;
+                     &quot;{\n&quot;;
+    }
+
+    if (usesFragCoord)
+    {
+        pixelHLSL += &quot;    float rhw = 1.0 / input.gl_FragCoord.w;\n&quot;;
+
+        // Certain Shader Models (4_0+ and 3_0) allow reading from dx_Position in the pixel shader.
+        // Other Shader Models (4_0_level_9_3 and 2_x) don't support this, so we emulate it using dx_ViewCoords.
+        if (shaderModel &gt;= 4 &amp;&amp; mRenderer-&gt;getShaderModelSuffix() == &quot;&quot;)
+        {
+            pixelHLSL += &quot;    gl_FragCoord.x = input.dx_Position.x;\n&quot;
+                         &quot;    gl_FragCoord.y = input.dx_Position.y;\n&quot;;
+        }
+        else if (shaderModel == 3)
+        {
+            pixelHLSL += &quot;    gl_FragCoord.x = input.dx_Position.x + 0.5;\n&quot;
+                         &quot;    gl_FragCoord.y = input.dx_Position.y + 0.5;\n&quot;;
+        }
+        else
+        {
+            // dx_ViewCoords contains the viewport width/2, height/2, center.x and center.y. See Renderer::setViewport()
+            pixelHLSL += &quot;    gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_ViewCoords.x + dx_ViewCoords.z;\n&quot;
+                         &quot;    gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_ViewCoords.y + dx_ViewCoords.w;\n&quot;;
+        }
+
+        pixelHLSL += &quot;    gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_DepthFront.x + dx_DepthFront.y;\n&quot;
+                     &quot;    gl_FragCoord.w = rhw;\n&quot;;
+    }
+
+    if (usesPointCoord &amp;&amp; shaderModel &gt;= 3)
+    {
+        pixelHLSL += &quot;    gl_PointCoord.x = input.gl_PointCoord.x;\n&quot;;
+        pixelHLSL += &quot;    gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n&quot;;
+    }
+
+    if (fragmentShader-&gt;mUsesFrontFacing)
+    {
+        if (shaderModel &lt;= 3)
+        {
+            pixelHLSL += &quot;    gl_FrontFacing = (vFace * dx_DepthFront.z &gt;= 0.0);\n&quot;;
+        }
+        else
+        {
+            pixelHLSL += &quot;    gl_FrontFacing = isFrontFace;\n&quot;;
+        }
+    }
+
+    const std::vector&lt;PackedVarying&gt; &amp;fragmentVaryings = fragmentShader-&gt;getVaryings();
+    for (unsigned int varyingIndex = 0; varyingIndex &lt; fragmentVaryings.size(); varyingIndex++)
+    {
+        const PackedVarying &amp;varying = fragmentVaryings[varyingIndex];
+        if (varying.registerAssigned())
+        {
+            ASSERT(!varying.isBuiltIn());
+            for (unsigned int elementIndex = 0; elementIndex &lt; varying.elementCount(); elementIndex++)
+            {
+                GLenum transposedType = TransposeMatrixType(varying.type);
+                int variableRows = (varying.isStruct() ? 1 : VariableRowCount(transposedType));
+                for (int row = 0; row &lt; variableRows; row++)
+                {
+                    std::string n = Str(varying.registerIndex + varying.columnIndex * data.caps-&gt;maxVaryingVectors + elementIndex * variableRows + row);
+                    pixelHLSL += &quot;    _&quot; + varying.name;
+
+                    if (varying.isArray())
+                    {
+                        pixelHLSL += ArrayString(elementIndex);
+                    }
+
+                    if (variableRows &gt; 1)
+                    {
+                        pixelHLSL += ArrayString(row);
+                    }
+
+                    if (varying.isStruct())
+                    {
+                        pixelHLSL += &quot; = input.v&quot; + n + &quot;;\n&quot;;   break;
+                    }
+                    else
+                    {
+                        switch (VariableColumnCount(transposedType))
+                        {
+                          case 1: pixelHLSL += &quot; = input.v&quot; + n + &quot;.x;\n&quot;;   break;
+                          case 2: pixelHLSL += &quot; = input.v&quot; + n + &quot;.xy;\n&quot;;  break;
+                          case 3: pixelHLSL += &quot; = input.v&quot; + n + &quot;.xyz;\n&quot;; break;
+                          case 4: pixelHLSL += &quot; = input.v&quot; + n + &quot;;\n&quot;;     break;
+                          default: UNREACHABLE();
+                        }
+                    }
+                }
+            }
+        }
+        else
+        {
+            ASSERT(varying.isBuiltIn() || !varying.staticUse);
+        }
+    }
+
+    if (fragmentShader-&gt;usesDeferredInit())
+    {
+        pixelHLSL += &quot;\n&quot;
+                     &quot;    initializeDeferredGlobals();\n&quot;;
+    }
+
+    pixelHLSL += &quot;\n&quot;
+                 &quot;    gl_main();\n&quot;
+                 &quot;\n&quot;
+                 &quot;    return generateOutput();\n&quot;
+                 &quot;}\n&quot;;
+
+    return true;
+}
+
+void DynamicHLSL::defineOutputVariables(ShaderD3D *fragmentShader, std::map&lt;int, VariableLocation&gt; *programOutputVars) const
+{
+    const std::vector&lt;sh::Attribute&gt; &amp;shaderOutputVars = fragmentShader-&gt;getActiveOutputVariables();
+
+    for (unsigned int outputVariableIndex = 0; outputVariableIndex &lt; shaderOutputVars.size(); outputVariableIndex++)
+    {
+        const sh::Attribute &amp;outputVariable = shaderOutputVars[outputVariableIndex];
+        const int baseLocation = outputVariable.location == -1 ? 0 : outputVariable.location;
+
+        ASSERT(outputVariable.staticUse);
+
+        if (outputVariable.arraySize &gt; 0)
+        {
+            for (unsigned int elementIndex = 0; elementIndex &lt; outputVariable.arraySize; elementIndex++)
+            {
+                const int location = baseLocation + elementIndex;
+                ASSERT(programOutputVars-&gt;count(location) == 0);
+                (*programOutputVars)[location] = VariableLocation(outputVariable.name, elementIndex, outputVariableIndex);
+            }
+        }
+        else
+        {
+            ASSERT(programOutputVars-&gt;count(baseLocation) == 0);
+            (*programOutputVars)[baseLocation] = VariableLocation(outputVariable.name, GL_INVALID_INDEX, outputVariableIndex);
+        }
+    }
+}
+
+std::string DynamicHLSL::generateGeometryShaderHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const
+{
+    // for now we only handle point sprite emulation
+    ASSERT(vertexShader-&gt;mUsesPointSize &amp;&amp; mRenderer-&gt;getMajorShaderModel() &gt;= 4);
+    return generatePointSpriteHLSL(registers, fragmentShader, vertexShader);
+}
+
+std::string DynamicHLSL::generatePointSpriteHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const
+{
+    ASSERT(registers &gt;= 0);
+    ASSERT(vertexShader-&gt;mUsesPointSize);
+    ASSERT(mRenderer-&gt;getMajorShaderModel() &gt;= 4);
+
+    std::string geomHLSL;
+
+    const SemanticInfo &amp;inSemantics = getSemanticInfo(registers, true, fragmentShader-&gt;mUsesFragCoord,
+                                                      false, true, false);
+    const SemanticInfo &amp;outSemantics = getSemanticInfo(registers, true, fragmentShader-&gt;mUsesFragCoord,
+                                                       fragmentShader-&gt;mUsesPointCoord, true, false);
+
+    std::string varyingHLSL = generateVaryingHLSL(vertexShader);
+    std::string inLinkHLSL = generateVaryingLinkHLSL(inSemantics, varyingHLSL);
+    std::string outLinkHLSL = generateVaryingLinkHLSL(outSemantics, varyingHLSL);
+
+    // TODO(geofflang): use context's caps
+    geomHLSL += &quot;uniform float4 dx_ViewCoords : register(c1);\n&quot;
+                &quot;\n&quot;
+                &quot;struct GS_INPUT\n&quot; + inLinkHLSL + &quot;\n&quot; +
+                &quot;struct GS_OUTPUT\n&quot; + outLinkHLSL + &quot;\n&quot; +
+                &quot;\n&quot;
+                &quot;static float2 pointSpriteCorners[] = \n&quot;
+                &quot;{\n&quot;
+                &quot;    float2( 0.5f, -0.5f),\n&quot;
+                &quot;    float2( 0.5f,  0.5f),\n&quot;
+                &quot;    float2(-0.5f, -0.5f),\n&quot;
+                &quot;    float2(-0.5f,  0.5f)\n&quot;
+                &quot;};\n&quot;
+                &quot;\n&quot;
+                &quot;static float2 pointSpriteTexcoords[] = \n&quot;
+                &quot;{\n&quot;
+                &quot;    float2(1.0f, 1.0f),\n&quot;
+                &quot;    float2(1.0f, 0.0f),\n&quot;
+                &quot;    float2(0.0f, 1.0f),\n&quot;
+                &quot;    float2(0.0f, 0.0f)\n&quot;
+                &quot;};\n&quot;
+                &quot;\n&quot;
+                &quot;static float minPointSize = &quot; + Str(static_cast&lt;int&gt;(mRenderer-&gt;getRendererCaps().minAliasedPointSize)) + &quot;.0f;\n&quot;
+                &quot;static float maxPointSize = &quot; + Str(static_cast&lt;int&gt;(mRenderer-&gt;getRendererCaps().maxAliasedPointSize)) + &quot;.0f;\n&quot;
+                &quot;\n&quot;
+                &quot;[maxvertexcount(4)]\n&quot;
+                &quot;void main(point GS_INPUT input[1], inout TriangleStream&lt;GS_OUTPUT&gt; outStream)\n&quot;
+                &quot;{\n&quot;
+                &quot;    GS_OUTPUT output = (GS_OUTPUT)0;\n&quot;
+                &quot;    output.gl_Position = input[0].gl_Position;\n&quot;
+                &quot;    output.gl_PointSize = input[0].gl_PointSize;\n&quot;;
+
+    for (int r = 0; r &lt; registers; r++)
+    {
+        geomHLSL += &quot;    output.v&quot; + Str(r) + &quot; = input[0].v&quot; + Str(r) + &quot;;\n&quot;;
+    }
+
+    if (fragmentShader-&gt;mUsesFragCoord)
+    {
+        geomHLSL += &quot;    output.gl_FragCoord = input[0].gl_FragCoord;\n&quot;;
+    }
+
+    geomHLSL += &quot;    \n&quot;
+                &quot;    float gl_PointSize = clamp(input[0].gl_PointSize, minPointSize, maxPointSize);\n&quot;
+                &quot;    float4 dx_Position = input[0].dx_Position;\n&quot;
+                &quot;    float2 viewportScale = float2(1.0f / dx_ViewCoords.x, 1.0f / dx_ViewCoords.y) * dx_Position.w;\n&quot;;
+
+    for (int corner = 0; corner &lt; 4; corner++)
+    {
+        geomHLSL += &quot;    \n&quot;
+                    &quot;    output.dx_Position = dx_Position + float4(pointSpriteCorners[&quot; + Str(corner) + &quot;] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n&quot;;
+
+        if (fragmentShader-&gt;mUsesPointCoord)
+        {
+            geomHLSL += &quot;    output.gl_PointCoord = pointSpriteTexcoords[&quot; + Str(corner) + &quot;];\n&quot;;
+        }
+
+        geomHLSL += &quot;    outStream.Append(output);\n&quot;;
+    }
+
+    geomHLSL += &quot;    \n&quot;
+                &quot;    outStream.RestartStrip();\n&quot;
+                &quot;}\n&quot;;
+
+    return geomHLSL;
+}
+
+// This method needs to match OutputHLSL::decorate
+std::string DynamicHLSL::decorateVariable(const std::string &amp;name)
+{
+    if (name.compare(0, 3, &quot;gl_&quot;) != 0)
+    {
+        return &quot;_&quot; + name;
+    }
+
+    return name;
+}
+
+std::string DynamicHLSL::generateAttributeConversionHLSL(const VertexFormat &amp;vertexFormat, const sh::ShaderVariable &amp;shaderAttrib) const
+{
+    std::string attribString = &quot;input.&quot; + decorateVariable(shaderAttrib.name);
+
+    // Matrix
+    if (IsMatrixType(shaderAttrib.type))
+    {
+        return &quot;transpose(&quot; + attribString + &quot;)&quot;;
+    }
+
+    GLenum shaderComponentType = VariableComponentType(shaderAttrib.type);
+    int shaderComponentCount = VariableComponentCount(shaderAttrib.type);
+
+    // Perform integer to float conversion (if necessary)
+    bool requiresTypeConversion = (shaderComponentType == GL_FLOAT &amp;&amp; vertexFormat.mType != GL_FLOAT);
+
+    if (requiresTypeConversion)
+    {
+        // TODO: normalization for 32-bit integer formats
+        ASSERT(!vertexFormat.mNormalized &amp;&amp; !vertexFormat.mPureInteger);
+        return &quot;float&quot; + Str(shaderComponentCount) + &quot;(&quot; + attribString + &quot;)&quot;;
+    }
+
+    // No conversion necessary
+    return attribString;
+}
+
+void DynamicHLSL::getInputLayoutSignature(const VertexFormat inputLayout[], GLenum signature[]) const
+{
+    for (size_t inputIndex = 0; inputIndex &lt; MAX_VERTEX_ATTRIBS; inputIndex++)
+    {
+        const VertexFormat &amp;vertexFormat = inputLayout[inputIndex];
+
+        if (vertexFormat.mType == GL_NONE)
+        {
+            signature[inputIndex] = GL_NONE;
+        }
+        else
+        {
+            bool gpuConverted = ((mRenderer-&gt;getVertexConversionType(vertexFormat) &amp; VERTEX_CONVERT_GPU) != 0);
+            signature[inputIndex] = (gpuConverted ? GL_TRUE : GL_FALSE);
+        }
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dDynamicHLSLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/DynamicHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+// DynamicHLSL.h: Interface for link and run-time HLSL generation
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
+#define LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;vector&gt;
+#include &lt;map&gt;
+
+namespace sh
+{
+struct Attribute;
+struct ShaderVariable;
+}
+
+namespace gl
+{
+class InfoLog;
+struct VariableLocation;
+struct LinkedVarying;
+struct VertexAttribute;
+struct VertexFormat;
+struct PackedVarying;
+struct Data;
+}
+
+namespace rx
+{
+class RendererD3D;
+class ShaderD3D;
+
+typedef const gl::PackedVarying *VaryingPacking[gl::IMPLEMENTATION_MAX_VARYING_VECTORS][4];
+
+struct PixelShaderOutputVariable
+{
+    GLenum type;
+    std::string name;
+    std::string source;
+    size_t outputIndex;
+};
+
+class DynamicHLSL : angle::NonCopyable
+{
+  public:
+    explicit DynamicHLSL(RendererD3D *const renderer);
+
+    int packVaryings(gl::InfoLog &amp;infoLog, VaryingPacking packing, ShaderD3D *fragmentShader,
+                     ShaderD3D *vertexShader, const std::vector&lt;std::string&gt;&amp; transformFeedbackVaryings);
+    std::string generateVertexShaderForInputLayout(const std::string &amp;sourceShader,
+                                                   const gl::VertexFormat inputLayout[],
+                                                   const std::vector&lt;sh::Attribute&gt; &amp;shaderAttributes) const;
+    std::string generatePixelShaderForOutputSignature(const std::string &amp;sourceShader, const std::vector&lt;PixelShaderOutputVariable&gt; &amp;outputVariables,
+                                                      bool usesFragDepth, const std::vector&lt;GLenum&gt; &amp;outputLayout) const;
+    bool generateShaderLinkHLSL(const gl::Data &amp;data, gl::InfoLog &amp;infoLog, int registers,
+                                const VaryingPacking packing,
+                                std::string &amp;pixelHLSL, std::string &amp;vertexHLSL,
+                                ShaderD3D *fragmentShader, ShaderD3D *vertexShader,
+                                const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings,
+                                std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings,
+                                std::map&lt;int, gl::VariableLocation&gt; *programOutputVars,
+                                std::vector&lt;PixelShaderOutputVariable&gt; *outPixelShaderKey,
+                                bool *outUsesFragDepth) const;
+
+    std::string generateGeometryShaderHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const;
+    void getInputLayoutSignature(const gl::VertexFormat inputLayout[], GLenum signature[]) const;
+
+  private:
+    RendererD3D *const mRenderer;
+
+    struct SemanticInfo;
+
+    std::string getVaryingSemantic(bool pointSize) const;
+    SemanticInfo getSemanticInfo(int startRegisters, bool position, bool fragCoord, bool pointCoord,
+                                 bool pointSize, bool pixelShader) const;
+    std::string generateVaryingLinkHLSL(const SemanticInfo &amp;info, const std::string &amp;varyingHLSL) const;
+    std::string generateVaryingHLSL(const ShaderD3D *shader) const;
+    void storeUserLinkedVaryings(const ShaderD3D *vertexShader, std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings) const;
+    void storeBuiltinLinkedVaryings(const SemanticInfo &amp;info, std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings) const;
+    void defineOutputVariables(ShaderD3D *fragmentShader, std::map&lt;int, gl::VariableLocation&gt; *programOutputVars) const;
+    std::string generatePointSpriteHLSL(int registers, ShaderD3D *fragmentShader, ShaderD3D *vertexShader) const;
+
+    // Prepend an underscore
+    static std::string decorateVariable(const std::string &amp;name);
+
+    std::string generateAttributeConversionHLSL(const gl::VertexFormat &amp;vertexFormat, const sh::ShaderVariable &amp;shaderAttrib) const;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_DYNAMICHLSL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dFramebufferD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,420 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// FramebufferD3D.cpp: Implements the DefaultAttachmentD3D and FramebufferD3D classes.
+
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderbufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SurfaceD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SwapChainD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+
+namespace rx
+{
+
+namespace
+{
+
+ClearParameters GetClearParameters(const gl::State &amp;state, GLbitfield mask)
+{
+    ClearParameters clearParams;
+    memset(&amp;clearParams, 0, sizeof(ClearParameters));
+
+    const auto &amp;blendState = state.getBlendState();
+
+    for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
+    {
+        clearParams.clearColor[i] = false;
+    }
+    clearParams.colorFClearValue = state.getColorClearValue();
+    clearParams.colorClearType = GL_FLOAT;
+    clearParams.colorMaskRed = blendState.colorMaskRed;
+    clearParams.colorMaskGreen = blendState.colorMaskGreen;
+    clearParams.colorMaskBlue = blendState.colorMaskBlue;
+    clearParams.colorMaskAlpha = blendState.colorMaskAlpha;
+    clearParams.clearDepth = false;
+    clearParams.depthClearValue =  state.getDepthClearValue();
+    clearParams.clearStencil = false;
+    clearParams.stencilClearValue = state.getStencilClearValue();
+    clearParams.stencilWriteMask = state.getDepthStencilState().stencilWritemask;
+    clearParams.scissorEnabled = state.isScissorTestEnabled();
+    clearParams.scissor = state.getScissor();
+
+    const gl::Framebuffer *framebufferObject = state.getDrawFramebuffer();
+    if (mask &amp; GL_COLOR_BUFFER_BIT)
+    {
+        if (framebufferObject-&gt;hasEnabledColorAttachment())
+        {
+            for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
+            {
+                clearParams.clearColor[i] = true;
+            }
+        }
+    }
+
+    if (mask &amp; GL_DEPTH_BUFFER_BIT)
+    {
+        if (state.getDepthStencilState().depthMask &amp;&amp; framebufferObject-&gt;getDepthbuffer() != NULL)
+        {
+            clearParams.clearDepth = true;
+        }
+    }
+
+    if (mask &amp; GL_STENCIL_BUFFER_BIT)
+    {
+        if (framebufferObject-&gt;getStencilbuffer() != NULL &amp;&amp;
+            framebufferObject-&gt;getStencilbuffer()-&gt;getStencilSize() &gt; 0)
+        {
+            clearParams.clearStencil = true;
+        }
+    }
+
+    return clearParams;
+}
+
+}
+
+FramebufferD3D::FramebufferD3D(const gl::Framebuffer::Data &amp;data, RendererD3D *renderer)
+    : FramebufferImpl(data),
+      mRenderer(renderer),
+      mColorAttachmentsForRender(mData.getColorAttachments().size(), nullptr),
+      mInvalidateColorAttachmentCache(true)
+{
+    ASSERT(mRenderer != nullptr);
+}
+
+FramebufferD3D::~FramebufferD3D()
+{
+}
+
+void FramebufferD3D::onUpdateColorAttachment(size_t /*index*/)
+{
+    mInvalidateColorAttachmentCache = true;
+}
+
+void FramebufferD3D::onUpdateDepthAttachment()
+{
+}
+
+void FramebufferD3D::onUpdateStencilAttachment()
+{
+}
+
+void FramebufferD3D::onUpdateDepthStencilAttachment()
+{
+}
+
+void FramebufferD3D::setDrawBuffers(size_t, const GLenum *)
+{
+    mInvalidateColorAttachmentCache = true;
+}
+
+void FramebufferD3D::setReadBuffer(GLenum)
+{
+}
+
+gl::Error FramebufferD3D::invalidate(size_t, const GLenum *)
+{
+    // No-op in D3D
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferD3D::invalidateSub(size_t, const GLenum *, const gl::Rectangle &amp;)
+{
+    // No-op in D3D
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferD3D::clear(const gl::Data &amp;data, GLbitfield mask)
+{
+    const gl::State &amp;state = *data.state;
+    ClearParameters clearParams = GetClearParameters(state, mask);
+    return clear(state, clearParams);
+}
+
+gl::Error FramebufferD3D::clearBufferfv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLfloat *values)
+{
+    // glClearBufferfv can be called to clear the color buffer or depth buffer
+    ClearParameters clearParams = GetClearParameters(state, 0);
+
+    if (buffer == GL_COLOR)
+    {
+        for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
+        {
+            clearParams.clearColor[i] = (drawbuffer == static_cast&lt;int&gt;(i));
+        }
+        clearParams.colorFClearValue = gl::ColorF(values[0], values[1], values[2], values[3]);
+        clearParams.colorClearType = GL_FLOAT;
+    }
+
+    if (buffer == GL_DEPTH)
+    {
+        clearParams.clearDepth = true;
+        clearParams.depthClearValue = values[0];
+    }
+
+    return clear(state, clearParams);
+}
+
+gl::Error FramebufferD3D::clearBufferuiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLuint *values)
+{
+    // glClearBufferuiv can only be called to clear a color buffer
+    ClearParameters clearParams = GetClearParameters(state, 0);
+    for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
+    {
+        clearParams.clearColor[i] = (drawbuffer == static_cast&lt;int&gt;(i));
+    }
+    clearParams.colorUIClearValue = gl::ColorUI(values[0], values[1], values[2], values[3]);
+    clearParams.colorClearType = GL_UNSIGNED_INT;
+
+    return clear(state, clearParams);
+}
+
+gl::Error FramebufferD3D::clearBufferiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLint *values)
+{
+    // glClearBufferiv can be called to clear the color buffer or stencil buffer
+    ClearParameters clearParams = GetClearParameters(state, 0);
+
+    if (buffer == GL_COLOR)
+    {
+        for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
+        {
+            clearParams.clearColor[i] = (drawbuffer == static_cast&lt;int&gt;(i));
+        }
+        clearParams.colorIClearValue = gl::ColorI(values[0], values[1], values[2], values[3]);
+        clearParams.colorClearType = GL_INT;
+    }
+
+    if (buffer == GL_STENCIL)
+    {
+        clearParams.clearStencil = true;
+        clearParams.stencilClearValue = values[1];
+    }
+
+    return clear(state, clearParams);
+}
+
+gl::Error FramebufferD3D::clearBufferfi(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+    // glClearBufferfi can only be called to clear a depth stencil buffer
+    ClearParameters clearParams = GetClearParameters(state, 0);
+    clearParams.clearDepth = true;
+    clearParams.depthClearValue = depth;
+    clearParams.clearStencil = true;
+    clearParams.stencilClearValue = stencil;
+
+    return clear(state, clearParams);
+}
+
+GLenum FramebufferD3D::getImplementationColorReadFormat() const
+{
+    const gl::FramebufferAttachment *readAttachment = mData.getReadAttachment();
+
+    if (readAttachment == nullptr)
+    {
+        return GL_NONE;
+    }
+
+    RenderTargetD3D *attachmentRenderTarget = NULL;
+    gl::Error error = readAttachment-&gt;getRenderTarget(&amp;attachmentRenderTarget);
+    if (error.isError())
+    {
+        return GL_NONE;
+    }
+
+    GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
+    const gl::InternalFormat &amp;implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
+
+    return implementationFormatInfo.format;
+}
+
+GLenum FramebufferD3D::getImplementationColorReadType() const
+{
+    const gl::FramebufferAttachment *readAttachment = mData.getReadAttachment();
+
+    if (readAttachment == nullptr)
+    {
+        return GL_NONE;
+    }
+
+    RenderTargetD3D *attachmentRenderTarget = NULL;
+    gl::Error error = readAttachment-&gt;getRenderTarget(&amp;attachmentRenderTarget);
+    if (error.isError())
+    {
+        return GL_NONE;
+    }
+
+    GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
+    const gl::InternalFormat &amp;implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
+
+    return implementationFormatInfo.type;
+}
+
+gl::Error FramebufferD3D::readPixels(const gl::State &amp;state, const gl::Rectangle &amp;area, GLenum format, GLenum type, GLvoid *pixels) const
+{
+    const gl::PixelPackState &amp;packState = state.getPackState();
+
+    if (packState.rowLength != 0 || packState.skipRows != 0 || packState.skipPixels != 0)
+    {
+        UNIMPLEMENTED();
+        return gl::Error(GL_INVALID_OPERATION, &quot;invalid pixel store parameters in readPixels&quot;);
+    }
+
+    GLenum sizedInternalFormat = gl::GetSizedInternalFormat(format, type);
+    const gl::InternalFormat &amp;sizedFormatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
+    GLuint outputPitch = sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment, 0);
+
+    return readPixels(area, format, type, outputPitch, packState, reinterpret_cast&lt;uint8_t*&gt;(pixels));
+}
+
+gl::Error FramebufferD3D::blit(const gl::State &amp;state, const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea,
+                               GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer)
+{
+    bool blitRenderTarget = false;
+    if ((mask &amp; GL_COLOR_BUFFER_BIT) &amp;&amp;
+        sourceFramebuffer-&gt;getReadColorbuffer() != nullptr &amp;&amp;
+        mData.getFirstColorAttachment() != nullptr)
+    {
+        blitRenderTarget = true;
+    }
+
+    bool blitStencil = false;
+    if ((mask &amp; GL_STENCIL_BUFFER_BIT) &amp;&amp;
+        sourceFramebuffer-&gt;getStencilbuffer() != nullptr &amp;&amp;
+        mData.getStencilAttachment() != nullptr)
+    {
+        blitStencil = true;
+    }
+
+    bool blitDepth = false;
+    if ((mask &amp; GL_DEPTH_BUFFER_BIT) &amp;&amp;
+        sourceFramebuffer-&gt;getDepthbuffer() != nullptr &amp;&amp;
+        mData.getDepthAttachment() != nullptr)
+    {
+        blitDepth = true;
+    }
+
+    if (blitRenderTarget || blitDepth || blitStencil)
+    {
+        const gl::Rectangle *scissor = state.isScissorTestEnabled() ? &amp;state.getScissor() : NULL;
+        gl::Error error = blit(sourceArea, destArea, scissor, blitRenderTarget, blitDepth, blitStencil,
+                               filter, sourceFramebuffer);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLenum FramebufferD3D::checkStatus() const
+{
+    // D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness
+    const auto &amp;colorAttachments = mData.getColorAttachments();
+    for (size_t colorAttachment = 0; colorAttachment &lt; colorAttachments.size(); colorAttachment++)
+    {
+        const gl::FramebufferAttachment &amp;attachment = colorAttachments[colorAttachment];
+        if (attachment.isAttached())
+        {
+            for (size_t prevColorAttachment = 0; prevColorAttachment &lt; colorAttachment; prevColorAttachment++)
+            {
+                const gl::FramebufferAttachment &amp;prevAttachment = colorAttachments[prevColorAttachment];
+                if (prevAttachment.isAttached() &amp;&amp;
+                    (attachment.id() == prevAttachment.id() &amp;&amp;
+                     attachment.type() == prevAttachment.type()))
+                {
+                    return GL_FRAMEBUFFER_UNSUPPORTED;
+                }
+            }
+        }
+    }
+
+    return GL_FRAMEBUFFER_COMPLETE;
+}
+
+const gl::AttachmentList &amp;FramebufferD3D::getColorAttachmentsForRender(const Workarounds &amp;workarounds) const
+{
+    if (!mInvalidateColorAttachmentCache)
+    {
+        return mColorAttachmentsForRender;
+    }
+
+    // Does not actually free memory
+    mColorAttachmentsForRender.clear();
+
+    const auto &amp;colorAttachments = mData.getColorAttachments();
+    const auto &amp;drawBufferStates = mData.getDrawBufferStates();
+
+    for (size_t attachmentIndex = 0; attachmentIndex &lt; colorAttachments.size(); ++attachmentIndex)
+    {
+        GLenum drawBufferState = drawBufferStates[attachmentIndex];
+        const gl::FramebufferAttachment &amp;colorAttachment = colorAttachments[attachmentIndex];
+
+        if (colorAttachment.isAttached() &amp;&amp; drawBufferState != GL_NONE)
+        {
+            ASSERT(drawBufferState == GL_BACK || drawBufferState == (GL_COLOR_ATTACHMENT0_EXT + attachmentIndex));
+            mColorAttachmentsForRender.push_back(&amp;colorAttachment);
+        }
+        else if (!workarounds.mrtPerfWorkaround)
+        {
+            mColorAttachmentsForRender.push_back(nullptr);
+        }
+    }
+
+    mInvalidateColorAttachmentCache = false;
+    return mColorAttachmentsForRender;
+}
+
+// Note: RenderTarget serials should ideally be in the RenderTargets themselves.
+unsigned int GetAttachmentSerial(const gl::FramebufferAttachment *attachment)
+{
+    if (attachment-&gt;type() == GL_TEXTURE)
+    {
+        gl::Texture *texture = attachment-&gt;getTexture();
+        ASSERT(texture);
+        TextureD3D *textureD3D = GetImplAs&lt;TextureD3D&gt;(texture);
+        const gl::ImageIndex &amp;index = attachment-&gt;getTextureImageIndex();
+        return textureD3D-&gt;getRenderTargetSerial(index);
+    }
+    else if (attachment-&gt;type() == GL_RENDERBUFFER)
+    {
+        gl::Renderbuffer *renderbuffer = attachment-&gt;getRenderbuffer();
+        ASSERT(renderbuffer);
+        RenderbufferD3D *renderbufferD3D = GetImplAs&lt;RenderbufferD3D&gt;(renderbuffer);
+        return renderbufferD3D-&gt;getRenderTargetSerial();
+    }
+    else if (attachment-&gt;type() == GL_FRAMEBUFFER_DEFAULT)
+    {
+        const egl::Surface *surface = attachment-&gt;getSurface();
+        ASSERT(surface);
+        const SurfaceD3D *surfaceD3D = GetImplAs&lt;SurfaceD3D&gt;(surface);
+        ASSERT(surfaceD3D);
+
+        if (attachment-&gt;getBinding() == GL_BACK)
+        {
+            return surfaceD3D-&gt;getSwapChain()-&gt;getColorRenderTarget()-&gt;getSerial();
+        }
+        else
+        {
+            return surfaceD3D-&gt;getSwapChain()-&gt;getDepthStencilRenderTarget()-&gt;getSerial();
+        }
+    }
+    else
+    {
+        UNREACHABLE();
+        return 0;
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dFramebufferD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/FramebufferD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,113 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// FramebufferD3D.h: Defines the DefaultAttachmentD3D and FramebufferD3D classes.
+
+#ifndef LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
+#define LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
+
+#include &lt;vector&gt;
+#include &lt;cstdint&gt;
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/FramebufferImpl.h&quot;
+
+namespace gl
+{
+class FramebufferAttachment;
+struct PixelPackState;
+
+typedef std::vector&lt;const FramebufferAttachment *&gt; AttachmentList;
+
+}
+
+namespace rx
+{
+class RenderTargetD3D;
+class RendererD3D;
+
+struct ClearParameters
+{
+    bool clearColor[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
+    gl::ColorF colorFClearValue;
+    gl::ColorI colorIClearValue;
+    gl::ColorUI colorUIClearValue;
+    GLenum colorClearType;
+    bool colorMaskRed;
+    bool colorMaskGreen;
+    bool colorMaskBlue;
+    bool colorMaskAlpha;
+
+    bool clearDepth;
+    float depthClearValue;
+
+    bool clearStencil;
+    GLint stencilClearValue;
+    GLuint stencilWriteMask;
+
+    bool scissorEnabled;
+    gl::Rectangle scissor;
+};
+
+class FramebufferD3D : public FramebufferImpl
+{
+  public:
+    FramebufferD3D(const gl::Framebuffer::Data &amp;data, RendererD3D *renderer);
+    virtual ~FramebufferD3D();
+
+    void onUpdateColorAttachment(size_t index) override;
+    void onUpdateDepthAttachment() override;
+    void onUpdateStencilAttachment() override;
+    void onUpdateDepthStencilAttachment() override;
+
+    void setDrawBuffers(size_t count, const GLenum *buffers) override;
+    void setReadBuffer(GLenum buffer) override;
+
+    gl::Error invalidate(size_t count, const GLenum *attachments) override;
+    gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &amp;area) override;
+
+    gl::Error clear(const gl::Data &amp;data, GLbitfield mask) override;
+    gl::Error clearBufferfv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLfloat *values) override;
+    gl::Error clearBufferuiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLuint *values) override;
+    gl::Error clearBufferiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLint *values) override;
+    gl::Error clearBufferfi(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override;
+
+    GLenum getImplementationColorReadFormat() const override;
+    GLenum getImplementationColorReadType() const override;
+    gl::Error readPixels(const gl::State &amp;state, const gl::Rectangle &amp;area, GLenum format, GLenum type, GLvoid *pixels) const override;
+
+    gl::Error blit(const gl::State &amp;state, const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea,
+                   GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer) override;
+
+    GLenum checkStatus() const override;
+
+    const gl::AttachmentList &amp;getColorAttachmentsForRender(const Workarounds &amp;workarounds) const;
+
+  protected:
+    // Cache variable
+    mutable gl::AttachmentList mColorAttachmentsForRender;
+    mutable bool mInvalidateColorAttachmentCache;
+
+  private:
+    RendererD3D *const mRenderer;
+
+    virtual gl::Error clear(const gl::State &amp;state, const ClearParameters &amp;clearParams) = 0;
+
+    virtual gl::Error readPixels(const gl::Rectangle &amp;area, GLenum format, GLenum type, size_t outputPitch,
+                                 const gl::PixelPackState &amp;pack, uint8_t *pixels) const = 0;
+
+    virtual gl::Error blit(const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea, const gl::Rectangle *scissor,
+                           bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
+                           const gl::Framebuffer *sourceFramebuffer) = 0;
+
+    virtual GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const = 0;
+};
+
+unsigned int GetAttachmentSerial(const gl::FramebufferAttachment *attachment);
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dHLSLCompilercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,306 @@
</span><ins>+//
+// Copyright 2014 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 &quot;libANGLE/renderer/d3d/HLSLCompiler.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/features.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+#include &quot;third_party/trace_event/trace_event.h&quot;
+
+// Definitions local to the translation unit
+namespace
+{
+
+#ifdef CREATE_COMPILER_FLAG_INFO
+    #undef CREATE_COMPILER_FLAG_INFO
+#endif
+
+#define CREATE_COMPILER_FLAG_INFO(flag) { flag, #flag }
+
+struct CompilerFlagInfo
+{
+    UINT mFlag;
+    const char *mName;
+};
+
+CompilerFlagInfo CompilerFlagInfos[] =
+{
+    // NOTE: The data below is copied from d3dcompiler.h
+    // If something changes there it should be changed here as well
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_DEBUG),                          // (1 &lt;&lt; 0)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_SKIP_VALIDATION),                // (1 &lt;&lt; 1)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_SKIP_OPTIMIZATION),              // (1 &lt;&lt; 2)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PACK_MATRIX_ROW_MAJOR),          // (1 &lt;&lt; 3)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR),       // (1 &lt;&lt; 4)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PARTIAL_PRECISION),              // (1 &lt;&lt; 5)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT),       // (1 &lt;&lt; 6)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT),       // (1 &lt;&lt; 7)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_NO_PRESHADER),                   // (1 &lt;&lt; 8)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_AVOID_FLOW_CONTROL),             // (1 &lt;&lt; 9)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_PREFER_FLOW_CONTROL),            // (1 &lt;&lt; 10)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_ENABLE_STRICTNESS),              // (1 &lt;&lt; 11)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY), // (1 &lt;&lt; 12)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_IEEE_STRICTNESS),                // (1 &lt;&lt; 13)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL0),            // (1 &lt;&lt; 14)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL1),            // 0
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL2),            // ((1 &lt;&lt; 14) | (1 &lt;&lt; 15))
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_OPTIMIZATION_LEVEL3),            // (1 &lt;&lt; 15)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_RESERVED16),                     // (1 &lt;&lt; 16)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_RESERVED17),                     // (1 &lt;&lt; 17)
+    CREATE_COMPILER_FLAG_INFO(D3DCOMPILE_WARNINGS_ARE_ERRORS)             // (1 &lt;&lt; 18)
+};
+
+#undef CREATE_COMPILER_FLAG_INFO
+
+bool IsCompilerFlagSet(UINT mask, UINT flag)
+{
+    bool isFlagSet = IsMaskFlagSet(mask, flag);
+
+    switch(flag)
+    {
+      case D3DCOMPILE_OPTIMIZATION_LEVEL0:
+        return isFlagSet &amp;&amp; !IsMaskFlagSet(mask, UINT(D3DCOMPILE_OPTIMIZATION_LEVEL3));
+
+      case D3DCOMPILE_OPTIMIZATION_LEVEL1:
+        return (mask &amp; D3DCOMPILE_OPTIMIZATION_LEVEL2) == UINT(0);
+
+      case D3DCOMPILE_OPTIMIZATION_LEVEL3:
+        return isFlagSet &amp;&amp; !IsMaskFlagSet(mask, UINT(D3DCOMPILE_OPTIMIZATION_LEVEL0));
+
+      default:
+        return isFlagSet;
+    }
+}
+
+const char *GetCompilerFlagName(UINT mask, size_t flagIx)
+{
+    const CompilerFlagInfo &amp;flagInfo = CompilerFlagInfos[flagIx];
+    if (IsCompilerFlagSet(mask, flagInfo.mFlag))
+    {
+        return flagInfo.mName;
+    }
+
+    return nullptr;
+}
+
+}
+
+namespace rx
+{
+
+CompileConfig::CompileConfig()
+    : flags(0),
+      name()
+{
+}
+
+CompileConfig::CompileConfig(UINT flags, const std::string &amp;name)
+    : flags(flags),
+      name(name)
+{
+}
+
+HLSLCompiler::HLSLCompiler()
+    : mD3DCompilerModule(NULL),
+      mD3DCompileFunc(NULL),
+      mD3DDisassembleFunc(NULL)
+{
+}
+
+HLSLCompiler::~HLSLCompiler()
+{
+    release();
+}
+
+bool HLSLCompiler::initialize()
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;HLSLCompiler::initialize&quot;);
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+#if defined(ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES)
+    // Find a D3DCompiler module that had already been loaded based on a predefined list of versions.
+    static const char *d3dCompilerNames[] = ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES;
+
+    for (size_t i = 0; i &lt; ArraySize(d3dCompilerNames); ++i)
+    {
+        if (GetModuleHandleExA(0, d3dCompilerNames[i], &amp;mD3DCompilerModule))
+        {
+            break;
+        }
+    }
+#endif  // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES
+
+    if (!mD3DCompilerModule)
+    {
+        // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with.
+        mD3DCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
+    }
+
+    if (!mD3DCompilerModule)
+    {
+        ERR(&quot;No D3D compiler module found - aborting!\n&quot;);
+        return false;
+    }
+
+    mD3DCompileFunc = reinterpret_cast&lt;pD3DCompile&gt;(GetProcAddress(mD3DCompilerModule, &quot;D3DCompile&quot;));
+    ASSERT(mD3DCompileFunc);
+
+    mD3DDisassembleFunc = reinterpret_cast&lt;pD3DDisassemble&gt;(GetProcAddress(mD3DCompilerModule, &quot;D3DDisassemble&quot;));
+    ASSERT(mD3DDisassembleFunc);
+
+#else
+    // D3D Shader compiler is linked already into this module, so the export
+    // can be directly assigned.
+    mD3DCompilerModule = NULL;
+    mD3DCompileFunc = reinterpret_cast&lt;pD3DCompile&gt;(D3DCompile);
+    mD3DDisassembleFunc = reinterpret_cast&lt;pD3DDisassemble&gt;(D3DDisassemble);
+#endif
+
+    return mD3DCompileFunc != NULL;
+}
+
+void HLSLCompiler::release()
+{
+    if (mD3DCompilerModule)
+    {
+        FreeLibrary(mD3DCompilerModule);
+        mD3DCompilerModule = NULL;
+        mD3DCompileFunc = NULL;
+        mD3DDisassembleFunc = NULL;
+    }
+}
+
+gl::Error HLSLCompiler::compileToBinary(gl::InfoLog &amp;infoLog, const std::string &amp;hlsl, const std::string &amp;profile,
+                                        const std::vector&lt;CompileConfig&gt; &amp;configs, const D3D_SHADER_MACRO *overrideMacros,
+                                        ID3DBlob **outCompiledBlob, std::string *outDebugInfo) const
+{
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    ASSERT(mD3DCompilerModule);
+#endif
+    ASSERT(mD3DCompileFunc);
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    if (gl::DebugAnnotationsActive())
+    {
+        std::string sourcePath = getTempPath();
+        std::string sourceText = FormatString(&quot;#line 2 \&quot;%s\&quot;\n\n%s&quot;, sourcePath.c_str(), hlsl.c_str());
+        writeFile(sourcePath.c_str(), sourceText.c_str(), sourceText.size());
+    }
+#endif
+
+    const D3D_SHADER_MACRO *macros = overrideMacros ? overrideMacros : NULL;
+
+    for (size_t i = 0; i &lt; configs.size(); ++i)
+    {
+        ID3DBlob *errorMessage = NULL;
+        ID3DBlob *binary = NULL;
+
+        HRESULT result = mD3DCompileFunc(hlsl.c_str(), hlsl.length(), gl::g_fakepath, macros, NULL, &quot;main&quot;, profile.c_str(),
+                                         configs[i].flags, 0, &amp;binary, &amp;errorMessage);
+
+        if (errorMessage)
+        {
+            std::string message = reinterpret_cast&lt;const char*&gt;(errorMessage-&gt;GetBufferPointer());
+            SafeRelease(errorMessage);
+
+            infoLog.appendSanitized(message.c_str());
+            TRACE(&quot;\n%s&quot;, hlsl.c_str());
+            TRACE(&quot;\n%s&quot;, message.c_str());
+
+            if (message.find(&quot;error X3531:&quot;) != std::string::npos || // &quot;can't unroll loops marked with loop attribute&quot;
+                message.find(&quot;error X4014:&quot;) != std::string::npos)   // &quot;cannot have gradient operations inside loops with divergent flow control&quot;,
+                                                                     // even though it is counter-intuitive to disable unrolling for this error,
+                                                                     // some very long shaders have trouble deciding which loops to unroll and
+                                                                     // turning off forced unrolls allows them to compile properly.
+            {
+                macros = NULL;   // Disable [loop] and [flatten]
+
+                // Retry without changing compiler flags
+                i--;
+                continue;
+            }
+        }
+
+        if (SUCCEEDED(result))
+        {
+            *outCompiledBlob = binary;
+
+#if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED
+            (*outDebugInfo) += &quot;// COMPILER INPUT HLSL BEGIN\n\n&quot; + hlsl + &quot;\n// COMPILER INPUT HLSL END\n&quot;;
+            (*outDebugInfo) += &quot;\n\n// ASSEMBLY BEGIN\n\n&quot;;
+            (*outDebugInfo) += &quot;// Compiler configuration: &quot; + configs[i].name + &quot;\n// Flags:\n&quot;;
+            for (size_t fIx = 0; fIx &lt; ArraySize(CompilerFlagInfos); ++fIx)
+            {
+                const char *flagName = GetCompilerFlagName(configs[i].flags, fIx);
+                if (flagName != nullptr)
+                {
+                    (*outDebugInfo) += std::string(&quot;// &quot;) + flagName + &quot;\n&quot;;
+                }
+            }
+
+            (*outDebugInfo) += &quot;// Macros:\n&quot;;
+            if (macros == nullptr)
+            {
+                (*outDebugInfo) += &quot;// - : -\n&quot;;
+            }
+            else
+            {
+                for (const D3D_SHADER_MACRO *mIt = macros; mIt-&gt;Name != nullptr; ++mIt)
+                {
+                    (*outDebugInfo) += std::string(&quot;// &quot;) + mIt-&gt;Name + &quot; : &quot; + mIt-&gt;Definition + &quot;\n&quot;;
+                }
+            }
+
+            (*outDebugInfo) += &quot;\n&quot; + disassembleBinary(binary) + &quot;\n// ASSEMBLY END\n&quot;;
+#endif
+
+            return gl::Error(GL_NO_ERROR);
+        }
+        else
+        {
+            if (result == E_OUTOFMEMORY)
+            {
+                *outCompiledBlob = NULL;
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;HLSL compiler had an unexpected failure, result: 0x%X.&quot;, result);
+            }
+
+            infoLog.append(&quot;Warning: D3D shader compilation failed with %s flags.&quot;, configs[i].name.c_str());
+
+            if (i + 1 &lt; configs.size())
+            {
+                infoLog.append(&quot; Retrying with %s.\n&quot;, configs[i + 1].name.c_str());
+            }
+        }
+    }
+
+    // None of the configurations succeeded in compiling this shader but the compiler is still intact
+    *outCompiledBlob = NULL;
+    return gl::Error(GL_NO_ERROR);
+}
+
+std::string HLSLCompiler::disassembleBinary(ID3DBlob *shaderBinary) const
+{
+    // Retrieve disassembly
+    UINT flags = D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS | D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING;
+    ID3DBlob *disassembly = NULL;
+    pD3DDisassemble disassembleFunc = reinterpret_cast&lt;pD3DDisassemble&gt;(mD3DDisassembleFunc);
+    LPCVOID buffer = shaderBinary-&gt;GetBufferPointer();
+    SIZE_T bufSize = shaderBinary-&gt;GetBufferSize();
+    HRESULT result = disassembleFunc(buffer, bufSize, flags, &quot;&quot;, &amp;disassembly);
+
+    std::string asmSrc;
+    if (SUCCEEDED(result))
+    {
+        asmSrc = reinterpret_cast&lt;const char*&gt;(disassembly-&gt;GetBufferPointer());
+    }
+
+    SafeRelease(disassembly);
+
+    return asmSrc;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dHLSLCompilerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/HLSLCompiler.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+#ifndef LIBANGLE_RENDERER_D3D_HLSLCOMPILER_H_
+#define LIBANGLE_RENDERER_D3D_HLSLCOMPILER_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/platform.h&quot;
+
+#include &lt;vector&gt;
+#include &lt;string&gt;
+
+namespace gl
+{
+class InfoLog;
+}
+
+namespace rx
+{
+
+struct CompileConfig
+{
+    UINT flags;
+    std::string name;
+
+    CompileConfig();
+    CompileConfig(UINT flags, const std::string &amp;name);
+};
+
+class HLSLCompiler : angle::NonCopyable
+{
+  public:
+    HLSLCompiler();
+    ~HLSLCompiler();
+
+    bool initialize();
+    void release();
+
+    // Attempt to compile a HLSL shader using the supplied configurations, may output a NULL compiled blob
+    // even if no GL errors are returned.
+    gl::Error compileToBinary(gl::InfoLog &amp;infoLog, const std::string &amp;hlsl, const std::string &amp;profile,
+                              const std::vector&lt;CompileConfig&gt; &amp;configs, const D3D_SHADER_MACRO *overrideMacros,
+                              ID3DBlob **outCompiledBlob, std::string *outDebugInfo) const;
+
+    std::string disassembleBinary(ID3DBlob* shaderBinary) const;
+
+  private:
+    HMODULE mD3DCompilerModule;
+    pD3DCompile mD3DCompileFunc;
+    pD3DDisassemble mD3DDisassembleFunc;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_HLSLCOMPILER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dImageD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// Image.h: Implements the rx::Image class, an abstract base class for the
+// renderer-specific classes which will define the interface to the underlying
+// surfaces or resources.
+
+#include &quot;libANGLE/renderer/d3d/ImageD3D.h&quot;
+
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+
+namespace rx
+{
+
+ImageD3D::ImageD3D()
+    : mWidth(0),
+      mHeight(0),
+      mDepth(0),
+      mInternalFormat(GL_NONE),
+      mTarget(GL_NONE),
+      mRenderable(false),
+      mDirty(false)
+{
+}
+
+gl::Error ImageD3D::copy(const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea, const gl::Framebuffer *source)
+{
+    const gl::FramebufferAttachment *srcAttachment = source-&gt;getReadColorbuffer();
+    ASSERT(srcAttachment);
+
+    RenderTargetD3D *renderTarget = NULL;
+    gl::Error error = srcAttachment-&gt;getRenderTarget(&amp;renderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(renderTarget);
+    return copy(destOffset, sourceArea, renderTarget);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dImageD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ImageD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// ImageD3D.h: Defines the rx::ImageD3D class, an abstract base class for the
+// renderer-specific classes which will define the interface to the underlying
+// surfaces or resources.
+
+#ifndef LIBANGLE_RENDERER_D3D_IMAGED3D_H_
+#define LIBANGLE_RENDERER_D3D_IMAGED3D_H_
+
+#include &quot;common/debug.h&quot;
+
+#include &quot;libANGLE/Error.h&quot;
+
+namespace gl
+{
+class Framebuffer;
+struct ImageIndex;
+struct Box;
+struct Extents;
+struct Offset;
+struct Rectangle;
+struct PixelUnpackState;
+}
+
+namespace rx
+{
+class TextureStorage;
+class RendererD3D;
+class RenderTargetD3D;
+
+class ImageD3D : angle::NonCopyable
+{
+  public:
+    ImageD3D();
+    virtual ~ImageD3D() {};
+
+    GLsizei getWidth() const { return mWidth; }
+    GLsizei getHeight() const { return mHeight; }
+    GLsizei getDepth() const { return mDepth; }
+    GLenum getInternalFormat() const { return mInternalFormat; }
+    GLenum getTarget() const { return mTarget; }
+    bool isRenderableFormat() const { return mRenderable; }
+
+    void markDirty() { mDirty = true; }
+    void markClean() { mDirty = false; }
+    virtual bool isDirty() const = 0;
+
+    virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &amp;size, bool forceRelease) = 0;
+
+    virtual gl::Error loadData(const gl::Box &amp;area, const gl::PixelUnpackState &amp;unpack, GLenum type, const void *input) = 0;
+    virtual gl::Error loadCompressedData(const gl::Box &amp;area, const void *input) = 0;
+
+    virtual gl::Error setManagedSurface2D(TextureStorage *storage, int level) { return gl::Error(GL_NO_ERROR); };
+    virtual gl::Error setManagedSurfaceCube(TextureStorage *storage, int face, int level) { return gl::Error(GL_NO_ERROR); };
+    virtual gl::Error setManagedSurface3D(TextureStorage *storage, int level) { return gl::Error(GL_NO_ERROR); };
+    virtual gl::Error setManagedSurface2DArray(TextureStorage *storage, int layer, int level) { return gl::Error(GL_NO_ERROR); };
+    virtual gl::Error copyToStorage(TextureStorage *storage, const gl::ImageIndex &amp;index, const gl::Box &amp;region) = 0;
+
+    virtual gl::Error copy(const gl::Offset &amp;destOffset, const gl::Box &amp;sourceArea,
+                           const gl::ImageIndex &amp;sourceIndex, TextureStorage *source) = 0;
+
+    gl::Error copy(const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea, const gl::Framebuffer *source);
+
+  protected:
+    GLsizei mWidth;
+    GLsizei mHeight;
+    GLsizei mDepth;
+    GLenum mInternalFormat;
+    bool mRenderable;
+    GLenum mTarget;
+
+    bool mDirty;
+
+  private:
+    virtual gl::Error copy(const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea, RenderTargetD3D *source) = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_IMAGED3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexBuffercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+//
+// 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.
+//
+
+// IndexBuffer.cpp: Defines the abstract IndexBuffer class and IndexBufferInterface
+// class with derivations, classes that perform graphics API agnostic index buffer operations.
+
+#include &quot;libANGLE/renderer/d3d/IndexBuffer.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+
+namespace rx
+{
+
+unsigned int IndexBuffer::mNextSerial = 1;
+
+IndexBuffer::IndexBuffer()
+{
+    updateSerial();
+}
+
+IndexBuffer::~IndexBuffer()
+{
+}
+
+unsigned int IndexBuffer::getSerial() const
+{
+    return mSerial;
+}
+
+void IndexBuffer::updateSerial()
+{
+    mSerial = mNextSerial++;
+}
+
+
+IndexBufferInterface::IndexBufferInterface(BufferFactoryD3D *factory, bool dynamic)
+{
+    mIndexBuffer = factory-&gt;createIndexBuffer();
+
+    mDynamic = dynamic;
+    mWritePosition = 0;
+}
+
+IndexBufferInterface::~IndexBufferInterface()
+{
+    if (mIndexBuffer)
+    {
+        delete mIndexBuffer;
+    }
+}
+
+GLenum IndexBufferInterface::getIndexType() const
+{
+    return mIndexBuffer-&gt;getIndexType();
+}
+
+unsigned int IndexBufferInterface::getBufferSize() const
+{
+    return mIndexBuffer-&gt;getBufferSize();
+}
+
+unsigned int IndexBufferInterface::getSerial() const
+{
+    return mIndexBuffer-&gt;getSerial();
+}
+
+gl::Error IndexBufferInterface::mapBuffer(unsigned int size, void **outMappedMemory, unsigned int *streamOffset)
+{
+    // Protect against integer overflow
+    if (mWritePosition + size &lt; mWritePosition)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Mapping of internal index buffer would cause an integer overflow.&quot;);
+    }
+
+    gl::Error error = mIndexBuffer-&gt;mapBuffer(mWritePosition, size, outMappedMemory);
+    if (error.isError())
+    {
+        if (outMappedMemory)
+        {
+            *outMappedMemory = NULL;
+        }
+        return error;
+    }
+
+    if (streamOffset)
+    {
+        *streamOffset = mWritePosition;
+    }
+
+    mWritePosition += size;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error IndexBufferInterface::unmapBuffer()
+{
+    return mIndexBuffer-&gt;unmapBuffer();
+}
+
+IndexBuffer * IndexBufferInterface::getIndexBuffer() const
+{
+    return mIndexBuffer;
+}
+
+unsigned int IndexBufferInterface::getWritePosition() const
+{
+    return mWritePosition;
+}
+
+void IndexBufferInterface::setWritePosition(unsigned int writePosition)
+{
+    mWritePosition = writePosition;
+}
+
+gl::Error IndexBufferInterface::discard()
+{
+    return mIndexBuffer-&gt;discard();
+}
+
+gl::Error IndexBufferInterface::setBufferSize(unsigned int bufferSize, GLenum indexType)
+{
+    if (mIndexBuffer-&gt;getBufferSize() == 0)
+    {
+        return mIndexBuffer-&gt;initialize(bufferSize, indexType, mDynamic);
+    }
+    else
+    {
+        return mIndexBuffer-&gt;setSize(bufferSize, indexType);
+    }
+}
+
+StreamingIndexBufferInterface::StreamingIndexBufferInterface(BufferFactoryD3D *factory)
+    : IndexBufferInterface(factory, true)
+{
+}
+
+StreamingIndexBufferInterface::~StreamingIndexBufferInterface()
+{
+}
+
+gl::Error StreamingIndexBufferInterface::reserveBufferSpace(unsigned int size, GLenum indexType)
+{
+    unsigned int curBufferSize = getBufferSize();
+    unsigned int writePos = getWritePosition();
+    if (size &gt; curBufferSize)
+    {
+        gl::Error error = setBufferSize(std::max(size, 2 * curBufferSize), indexType);
+        if (error.isError())
+        {
+            return error;
+        }
+        setWritePosition(0);
+    }
+    else if (writePos + size &gt; curBufferSize || writePos + size &lt; writePos)
+    {
+        gl::Error error = discard();
+        if (error.isError())
+        {
+            return error;
+        }
+        setWritePosition(0);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+
+StaticIndexBufferInterface::StaticIndexBufferInterface(BufferFactoryD3D *factory)
+    : IndexBufferInterface(factory, false)
+{
+}
+
+StaticIndexBufferInterface::~StaticIndexBufferInterface()
+{
+}
+
+gl::Error StaticIndexBufferInterface::reserveBufferSpace(unsigned int size, GLenum indexType)
+{
+    unsigned int curSize = getBufferSize();
+    if (curSize == 0)
+    {
+        return setBufferSize(size, indexType);
+    }
+    else if (curSize &gt;= size &amp;&amp; indexType == getIndexType())
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION, &quot;Internal static index buffers can't be resized&quot;);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexBufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexBuffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,101 @@
</span><ins>+//
+// 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.
+//
+
+// IndexBuffer.h: Defines the abstract IndexBuffer class and IndexBufferInterface
+// class with derivations, classes that perform graphics API agnostic index buffer operations.
+
+#ifndef LIBANGLE_RENDERER_D3D_INDEXBUFFER_H_
+#define LIBANGLE_RENDERER_D3D_INDEXBUFFER_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/renderer/IndexRangeCache.h&quot;
+
+namespace rx
+{
+class BufferFactoryD3D;
+
+class IndexBuffer : angle::NonCopyable
+{
+  public:
+    IndexBuffer();
+    virtual ~IndexBuffer();
+
+    virtual gl::Error initialize(unsigned int bufferSize, GLenum indexType, bool dynamic) = 0;
+
+    virtual gl::Error mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory) = 0;
+    virtual gl::Error unmapBuffer() = 0;
+
+    virtual gl::Error discard() = 0;
+
+    virtual GLenum getIndexType() const = 0;
+    virtual unsigned int getBufferSize() const = 0;
+    virtual gl::Error setSize(unsigned int bufferSize, GLenum indexType) = 0;
+
+    unsigned int getSerial() const;
+
+  protected:
+    void updateSerial();
+
+  private:
+    unsigned int mSerial;
+    static unsigned int mNextSerial;
+};
+
+class IndexBufferInterface : angle::NonCopyable
+{
+  public:
+    IndexBufferInterface(BufferFactoryD3D *factory, bool dynamic);
+    virtual ~IndexBufferInterface();
+
+    virtual gl::Error reserveBufferSpace(unsigned int size, GLenum indexType) = 0;
+
+    GLenum getIndexType() const;
+    unsigned int getBufferSize() const;
+
+    unsigned int getSerial() const;
+
+    gl::Error mapBuffer(unsigned int size, void** outMappedMemory, unsigned int *streamOffset);
+    gl::Error unmapBuffer();
+
+    IndexBuffer *getIndexBuffer() const;
+
+  protected:
+    unsigned int getWritePosition() const;
+    void setWritePosition(unsigned int writePosition);
+
+    gl::Error discard();
+
+    gl::Error setBufferSize(unsigned int bufferSize, GLenum indexType);
+
+  private:
+    IndexBuffer *mIndexBuffer;
+
+    unsigned int mWritePosition;
+    bool mDynamic;
+};
+
+class StreamingIndexBufferInterface : public IndexBufferInterface
+{
+  public:
+    explicit StreamingIndexBufferInterface(BufferFactoryD3D *factory);
+    ~StreamingIndexBufferInterface();
+
+    gl::Error reserveBufferSpace(unsigned int size, GLenum indexType) override;
+};
+
+class StaticIndexBufferInterface : public IndexBufferInterface
+{
+  public:
+    explicit StaticIndexBufferInterface(BufferFactoryD3D *factory);
+    ~StaticIndexBufferInterface();
+
+    gl::Error reserveBufferSpace(unsigned int size, GLenum indexType) override;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_INDEXBUFFER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexDataManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,273 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 &quot;libANGLE/renderer/d3d/IndexDataManager.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/IndexBuffer.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+
+namespace rx
+{
+
+static void ConvertIndices(GLenum sourceType, GLenum destinationType, const void *input, GLsizei count, void *output)
+{
+    if (sourceType == GL_UNSIGNED_BYTE)
+    {
+        ASSERT(destinationType == GL_UNSIGNED_SHORT);
+        const GLubyte *in = static_cast&lt;const GLubyte*&gt;(input);
+        GLushort *out = static_cast&lt;GLushort*&gt;(output);
+
+        for (GLsizei i = 0; i &lt; count; i++)
+        {
+            out[i] = in[i];
+        }
+    }
+    else if (sourceType == GL_UNSIGNED_INT)
+    {
+        ASSERT(destinationType == GL_UNSIGNED_INT);
+        memcpy(output, input, count * sizeof(GLuint));
+    }
+    else if (sourceType == GL_UNSIGNED_SHORT)
+    {
+        if (destinationType == GL_UNSIGNED_SHORT)
+        {
+            memcpy(output, input, count * sizeof(GLushort));
+        }
+        else if (destinationType == GL_UNSIGNED_INT)
+        {
+            const GLushort *in = static_cast&lt;const GLushort*&gt;(input);
+            GLuint *out = static_cast&lt;GLuint*&gt;(output);
+
+            for (GLsizei i = 0; i &lt; count; i++)
+            {
+                out[i] = in[i];
+            }
+        }
+        else UNREACHABLE();
+    }
+    else UNREACHABLE();
+}
+
+IndexDataManager::IndexDataManager(BufferFactoryD3D *factory, RendererClass rendererClass)
+    : mFactory(factory),
+      mRendererClass(rendererClass),
+      mStreamingBufferShort(nullptr),
+      mStreamingBufferInt(nullptr)
+{
+}
+
+IndexDataManager::~IndexDataManager()
+{
+    SafeDelete(mStreamingBufferShort);
+    SafeDelete(mStreamingBufferInt);
+}
+
+gl::Error IndexDataManager::prepareIndexData(GLenum type, GLsizei count, gl::Buffer *buffer, const GLvoid *indices, TranslatedIndexData *translated)
+{
+    const gl::Type &amp;typeInfo = gl::GetTypeInfo(type);
+
+    GLenum destinationIndexType = (type == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT;
+
+    unsigned int offset = 0;
+    bool alignedOffset = false;
+
+    BufferD3D *storage = NULL;
+
+    if (buffer != NULL)
+    {
+        offset = static_cast&lt;unsigned int&gt;(reinterpret_cast&lt;uintptr_t&gt;(indices));
+
+        storage = GetImplAs&lt;BufferD3D&gt;(buffer);
+
+        // We'll trust that the compiler will optimize the % below:
+        // the operands are unsigned and the divisor is a constant.
+        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;
+        }
+
+        ASSERT(typeInfo.bytes * static_cast&lt;unsigned int&gt;(count) + offset &lt;= storage-&gt;getSize());
+
+        const uint8_t *bufferData = NULL;
+        gl::Error error = storage-&gt;getData(&amp;bufferData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        indices = bufferData + offset;
+    }
+
+    StaticIndexBufferInterface *staticBuffer = storage ? storage-&gt;getStaticIndexBuffer() : NULL;
+    IndexBufferInterface *indexBuffer = NULL;
+    bool directStorage = alignedOffset &amp;&amp; storage &amp;&amp; storage-&gt;supportsDirectBinding() &amp;&amp;
+                         destinationIndexType == type;
+    unsigned int streamOffset = 0;
+
+    // Avoid D3D11's primitive restart index value
+    // see http://msdn.microsoft.com/en-us/library/windows/desktop/bb205124(v=vs.85).aspx
+    bool primitiveRestartWorkaround = mRendererClass == RENDERER_D3D11 &amp;&amp;
+                                      translated-&gt;indexRange.end == 0xFFFF &amp;&amp;
+                                      type == GL_UNSIGNED_SHORT;
+
+    if (primitiveRestartWorkaround)
+    {
+        destinationIndexType = GL_UNSIGNED_INT;
+        directStorage = false;
+    }
+
+    const gl::Type &amp;destTypeInfo = gl::GetTypeInfo(destinationIndexType);
+
+    if (directStorage)
+    {
+        streamOffset = offset;
+    }
+    else if (staticBuffer &amp;&amp;
+             staticBuffer-&gt;getBufferSize() != 0 &amp;&amp;
+             alignedOffset &amp;&amp;
+             staticBuffer-&gt;getIndexType() == destinationIndexType)
+    {
+        indexBuffer = staticBuffer;
+
+        // Using bit-shift here is faster than using division.
+        streamOffset = (offset &gt;&gt; typeInfo.bytesShift) &lt;&lt; destTypeInfo.bytesShift;
+    }
+
+    if (!directStorage &amp;&amp; !indexBuffer)
+    {
+        gl::Error error = getStreamingIndexBuffer(destinationIndexType, &amp;indexBuffer);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        unsigned int convertCount = count;
+
+        if (staticBuffer)
+        {
+            if (staticBuffer-&gt;getBufferSize() == 0 &amp;&amp; alignedOffset)
+            {
+                indexBuffer = staticBuffer;
+                // Using bit-shift here is faster than using division.
+                convertCount = storage-&gt;getSize() &gt;&gt; typeInfo.bytesShift;
+            }
+            else
+            {
+                storage-&gt;invalidateStaticData();
+                staticBuffer = NULL;
+            }
+        }
+
+        ASSERT(indexBuffer);
+
+        // Using bit-shift here is faster than using division.
+        if (convertCount &gt; (std::numeric_limits&lt;unsigned int&gt;::max() &gt;&gt; destTypeInfo.bytesShift))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Reserving %u indices of %u bytes each exceeds the maximum buffer size.&quot;,
+                             convertCount, destTypeInfo.bytes);
+        }
+
+        unsigned int bufferSizeRequired = convertCount &lt;&lt; destTypeInfo.bytesShift;
+        error = indexBuffer-&gt;reserveBufferSpace(bufferSizeRequired, destinationIndexType);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        void* output = NULL;
+        error = indexBuffer-&gt;mapBuffer(bufferSizeRequired, &amp;output, &amp;streamOffset);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        const uint8_t *dataPointer = reinterpret_cast&lt;const uint8_t*&gt;(indices);
+        if (staticBuffer)
+        {
+            error = storage-&gt;getData(&amp;dataPointer);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+        ConvertIndices(type, destinationIndexType, dataPointer, convertCount, output);
+
+        error = indexBuffer-&gt;unmapBuffer();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (staticBuffer)
+        {
+            // Using bit-shift here is faster than using division.
+            streamOffset = (offset &gt;&gt; typeInfo.bytesShift) &lt;&lt; destTypeInfo.bytesShift;
+        }
+    }
+
+    translated-&gt;storage = directStorage ? storage : NULL;
+    translated-&gt;indexBuffer = indexBuffer ? indexBuffer-&gt;getIndexBuffer() : NULL;
+    translated-&gt;serial = directStorage ? storage-&gt;getSerial() : indexBuffer-&gt;getSerial();
+    // Using bit-shift here is faster than using division.
+    translated-&gt;startIndex = (streamOffset &gt;&gt; destTypeInfo.bytesShift);
+    translated-&gt;startOffset = streamOffset;
+    translated-&gt;indexType = destinationIndexType;
+
+    if (storage)
+    {
+        storage-&gt;promoteStaticUsage(count &lt;&lt; typeInfo.bytesShift);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error IndexDataManager::getStreamingIndexBuffer(GLenum destinationIndexType, IndexBufferInterface **outBuffer)
+{
+    ASSERT(outBuffer);
+    if (destinationIndexType == GL_UNSIGNED_INT)
+    {
+        if (!mStreamingBufferInt)
+        {
+            mStreamingBufferInt = new StreamingIndexBufferInterface(mFactory);
+            gl::Error error = mStreamingBufferInt-&gt;reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
+            if (error.isError())
+            {
+                SafeDelete(mStreamingBufferInt);
+                return error;
+            }
+        }
+
+        *outBuffer = mStreamingBufferInt;
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        ASSERT(destinationIndexType == GL_UNSIGNED_SHORT);
+
+        if (!mStreamingBufferShort)
+        {
+            mStreamingBufferShort = new StreamingIndexBufferInterface(mFactory);
+            gl::Error error = mStreamingBufferShort-&gt;reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_SHORT);
+            if (error.isError())
+            {
+                SafeDelete(mStreamingBufferShort);
+                return error;
+            }
+        }
+
+        *outBuffer = mStreamingBufferShort;
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dIndexDataManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/IndexDataManager.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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 LIBANGLE_INDEXDATAMANAGER_H_
+#define LIBANGLE_INDEXDATAMANAGER_H_
+
+#include &lt;GLES2/gl2.h&gt;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/mathutil.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+
+namespace
+{
+    enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
+}
+
+namespace gl
+{
+class Buffer;
+}
+
+namespace rx
+{
+class IndexBufferInterface;
+class StaticIndexBufferInterface;
+class StreamingIndexBufferInterface;
+class IndexBuffer;
+class BufferD3D;
+class RendererD3D;
+
+struct TranslatedIndexData
+{
+    RangeUI indexRange;
+    unsigned int startIndex;
+    unsigned int startOffset;   // In bytes
+
+    IndexBuffer *indexBuffer;
+    BufferD3D *storage;
+    GLenum indexType;
+    unsigned int serial;
+};
+
+class IndexDataManager : angle::NonCopyable
+{
+  public:
+    explicit IndexDataManager(BufferFactoryD3D *factory, RendererClass rendererClass);
+    virtual ~IndexDataManager();
+
+    gl::Error prepareIndexData(GLenum type, GLsizei count, gl::Buffer *arrayElementBuffer, const GLvoid *indices, TranslatedIndexData *translated);
+
+  private:
+    gl::Error getStreamingIndexBuffer(GLenum destinationIndexType, IndexBufferInterface **outBuffer);
+
+    BufferFactoryD3D *const mFactory;
+    RendererClass mRendererClass;
+    StreamingIndexBufferInterface *mStreamingBufferShort;
+    StreamingIndexBufferInterface *mStreamingBufferInt;
+};
+
+}
+
+#endif   // LIBANGLE_INDEXDATAMANAGER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dProgramD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,2029 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// ProgramD3D.cpp: Defines the rx::ProgramD3D class which implements rx::ProgramImpl.
+
+#include &quot;libANGLE/renderer/d3d/ProgramD3D.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/features.h&quot;
+#include &quot;libANGLE/renderer/d3d/DynamicHLSL.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/ShaderD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/ShaderExecutableD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/VertexDataManager.h&quot;
+
+namespace rx
+{
+
+namespace
+{
+
+GLenum GetTextureType(GLenum samplerType)
+{
+    switch (samplerType)
+    {
+      case GL_SAMPLER_2D:
+      case GL_INT_SAMPLER_2D:
+      case GL_UNSIGNED_INT_SAMPLER_2D:
+      case GL_SAMPLER_2D_SHADOW:
+        return GL_TEXTURE_2D;
+      case GL_SAMPLER_3D:
+      case GL_INT_SAMPLER_3D:
+      case GL_UNSIGNED_INT_SAMPLER_3D:
+        return GL_TEXTURE_3D;
+      case GL_SAMPLER_CUBE:
+      case GL_SAMPLER_CUBE_SHADOW:
+        return GL_TEXTURE_CUBE_MAP;
+      case GL_INT_SAMPLER_CUBE:
+      case GL_UNSIGNED_INT_SAMPLER_CUBE:
+        return GL_TEXTURE_CUBE_MAP;
+      case GL_SAMPLER_2D_ARRAY:
+      case GL_INT_SAMPLER_2D_ARRAY:
+      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
+      case GL_SAMPLER_2D_ARRAY_SHADOW:
+        return GL_TEXTURE_2D_ARRAY;
+      default: UNREACHABLE();
+    }
+
+    return GL_TEXTURE_2D;
+}
+
+void GetDefaultInputLayoutFromShader(const std::vector&lt;sh::Attribute&gt; &amp;shaderAttributes, gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS])
+{
+    size_t layoutIndex = 0;
+    for (size_t attributeIndex = 0; attributeIndex &lt; shaderAttributes.size(); attributeIndex++)
+    {
+        ASSERT(layoutIndex &lt; gl::MAX_VERTEX_ATTRIBS);
+
+        const sh::Attribute &amp;shaderAttr = shaderAttributes[attributeIndex];
+
+        if (shaderAttr.type != GL_NONE)
+        {
+            GLenum transposedType = gl::TransposeMatrixType(shaderAttr.type);
+
+            for (size_t rowIndex = 0; static_cast&lt;int&gt;(rowIndex) &lt; gl::VariableRowCount(transposedType); rowIndex++, layoutIndex++)
+            {
+                gl::VertexFormat *defaultFormat = &amp;inputLayout[layoutIndex];
+
+                defaultFormat-&gt;mType = gl::VariableComponentType(transposedType);
+                defaultFormat-&gt;mNormalized = false;
+                defaultFormat-&gt;mPureInteger = (defaultFormat-&gt;mType != GL_FLOAT); // note: inputs can not be bool
+                defaultFormat-&gt;mComponents = gl::VariableColumnCount(transposedType);
+            }
+        }
+    }
+}
+
+std::vector&lt;GLenum&gt; GetDefaultOutputLayoutFromShader(const std::vector&lt;PixelShaderOutputVariable&gt; &amp;shaderOutputVars)
+{
+    std::vector&lt;GLenum&gt; defaultPixelOutput;
+
+    if (!shaderOutputVars.empty())
+    {
+        defaultPixelOutput.push_back(GL_COLOR_ATTACHMENT0 + shaderOutputVars[0].outputIndex);
+    }
+
+    return defaultPixelOutput;
+}
+
+bool IsRowMajorLayout(const sh::InterfaceBlockField &amp;var)
+{
+    return var.isRowMajorLayout;
+}
+
+bool IsRowMajorLayout(const sh::ShaderVariable &amp;var)
+{
+    return false;
+}
+
+struct AttributeSorter
+{
+    AttributeSorter(const ProgramImpl::SemanticIndexArray &amp;semanticIndices)
+        : originalIndices(&amp;semanticIndices)
+    {
+    }
+
+    bool operator()(int a, int b)
+    {
+        int indexA = (*originalIndices)[a];
+        int indexB = (*originalIndices)[b];
+
+        if (indexA == -1) return false;
+        if (indexB == -1) return true;
+        return (indexA &lt; indexB);
+    }
+
+    const ProgramImpl::SemanticIndexArray *originalIndices;
+};
+
+}
+
+ProgramD3D::VertexExecutable::VertexExecutable(const gl::VertexFormat inputLayout[],
+                                               const GLenum signature[],
+                                               ShaderExecutableD3D *shaderExecutable)
+    : mShaderExecutable(shaderExecutable)
+{
+    for (size_t attributeIndex = 0; attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+    {
+        mInputs[attributeIndex] = inputLayout[attributeIndex];
+        mSignature[attributeIndex] = signature[attributeIndex];
+    }
+}
+
+ProgramD3D::VertexExecutable::~VertexExecutable()
+{
+    SafeDelete(mShaderExecutable);
+}
+
+bool ProgramD3D::VertexExecutable::matchesSignature(const GLenum signature[]) const
+{
+    for (size_t attributeIndex = 0; attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+    {
+        if (mSignature[attributeIndex] != signature[attributeIndex])
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+ProgramD3D::PixelExecutable::PixelExecutable(const std::vector&lt;GLenum&gt; &amp;outputSignature, ShaderExecutableD3D *shaderExecutable)
+    : mOutputSignature(outputSignature),
+      mShaderExecutable(shaderExecutable)
+{
+}
+
+ProgramD3D::PixelExecutable::~PixelExecutable()
+{
+    SafeDelete(mShaderExecutable);
+}
+
+ProgramD3D::Sampler::Sampler() : active(false), logicalTextureUnit(0), textureType(GL_TEXTURE_2D)
+{
+}
+
+unsigned int ProgramD3D::mCurrentSerial = 1;
+
+ProgramD3D::ProgramD3D(RendererD3D *renderer)
+    : ProgramImpl(),
+      mRenderer(renderer),
+      mDynamicHLSL(NULL),
+      mGeometryExecutable(NULL),
+      mUsesPointSize(false),
+      mVertexUniformStorage(NULL),
+      mFragmentUniformStorage(NULL),
+      mUsedVertexSamplerRange(0),
+      mUsedPixelSamplerRange(0),
+      mDirtySamplerMapping(true),
+      mTextureUnitTypesCache(renderer-&gt;getRendererCaps().maxCombinedTextureImageUnits),
+      mShaderVersion(100),
+      mSerial(issueSerial())
+{
+    mDynamicHLSL = new DynamicHLSL(renderer);
+}
+
+ProgramD3D::~ProgramD3D()
+{
+    reset();
+    SafeDelete(mDynamicHLSL);
+}
+
+bool ProgramD3D::usesPointSpriteEmulation() const
+{
+    return mUsesPointSize &amp;&amp; mRenderer-&gt;getMajorShaderModel() &gt;= 4;
+}
+
+bool ProgramD3D::usesGeometryShader() const
+{
+    return usesPointSpriteEmulation() &amp;&amp; !usesInstancedPointSpriteEmulation();
+}
+
+bool ProgramD3D::usesInstancedPointSpriteEmulation() const
+{
+    return mRenderer-&gt;getWorkarounds().useInstancedPointSpriteEmulation;
+}
+
+GLint ProgramD3D::getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &amp;caps) const
+{
+    GLint logicalTextureUnit = -1;
+
+    switch (type)
+    {
+      case gl::SAMPLER_PIXEL:
+        ASSERT(samplerIndex &lt; caps.maxTextureImageUnits);
+        if (samplerIndex &lt; mSamplersPS.size() &amp;&amp; mSamplersPS[samplerIndex].active)
+        {
+            logicalTextureUnit = mSamplersPS[samplerIndex].logicalTextureUnit;
+        }
+        break;
+      case gl::SAMPLER_VERTEX:
+        ASSERT(samplerIndex &lt; caps.maxVertexTextureImageUnits);
+        if (samplerIndex &lt; mSamplersVS.size() &amp;&amp; mSamplersVS[samplerIndex].active)
+        {
+            logicalTextureUnit = mSamplersVS[samplerIndex].logicalTextureUnit;
+        }
+        break;
+      default: UNREACHABLE();
+    }
+
+    if (logicalTextureUnit &gt;= 0 &amp;&amp; logicalTextureUnit &lt; static_cast&lt;GLint&gt;(caps.maxCombinedTextureImageUnits))
+    {
+        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).
+GLenum ProgramD3D::getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const
+{
+    switch (type)
+    {
+      case gl::SAMPLER_PIXEL:
+        ASSERT(samplerIndex &lt; mSamplersPS.size());
+        ASSERT(mSamplersPS[samplerIndex].active);
+        return mSamplersPS[samplerIndex].textureType;
+      case gl::SAMPLER_VERTEX:
+        ASSERT(samplerIndex &lt; mSamplersVS.size());
+        ASSERT(mSamplersVS[samplerIndex].active);
+        return mSamplersVS[samplerIndex].textureType;
+      default: UNREACHABLE();
+    }
+
+    return GL_TEXTURE_2D;
+}
+
+GLint ProgramD3D::getUsedSamplerRange(gl::SamplerType type) const
+{
+    switch (type)
+    {
+      case gl::SAMPLER_PIXEL:
+        return mUsedPixelSamplerRange;
+      case gl::SAMPLER_VERTEX:
+        return mUsedVertexSamplerRange;
+      default:
+        UNREACHABLE();
+        return 0;
+    }
+}
+
+void ProgramD3D::updateSamplerMapping()
+{
+    if (!mDirtySamplerMapping)
+    {
+        return;
+    }
+
+    mDirtySamplerMapping = false;
+
+    // Retrieve sampler uniform values
+    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
+    {
+        gl::LinkedUniform *targetUniform = mUniforms[uniformIndex];
+
+        if (targetUniform-&gt;dirty)
+        {
+            if (gl::IsSamplerType(targetUniform-&gt;type))
+            {
+                int count = targetUniform-&gt;elementCount();
+                GLint (*v)[4] = reinterpret_cast&lt;GLint(*)[4]&gt;(targetUniform-&gt;data);
+
+                if (targetUniform-&gt;isReferencedByFragmentShader())
+                {
+                    unsigned int firstIndex = targetUniform-&gt;psRegisterIndex;
+
+                    for (int i = 0; i &lt; count; i++)
+                    {
+                        unsigned int samplerIndex = firstIndex + i;
+
+                        if (samplerIndex &lt; mSamplersPS.size())
+                        {
+                            ASSERT(mSamplersPS[samplerIndex].active);
+                            mSamplersPS[samplerIndex].logicalTextureUnit = v[i][0];
+                        }
+                    }
+                }
+
+                if (targetUniform-&gt;isReferencedByVertexShader())
+                {
+                    unsigned int firstIndex = targetUniform-&gt;vsRegisterIndex;
+
+                    for (int i = 0; i &lt; count; i++)
+                    {
+                        unsigned int samplerIndex = firstIndex + i;
+
+                        if (samplerIndex &lt; mSamplersVS.size())
+                        {
+                            ASSERT(mSamplersVS[samplerIndex].active);
+                            mSamplersVS[samplerIndex].logicalTextureUnit = v[i][0];
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+
+bool ProgramD3D::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &amp;caps)
+{
+    // Skip cache if we're using an infolog, so we get the full error.
+    // Also skip the cache if the sample mapping has changed, or if we haven't ever validated.
+    if (!mDirtySamplerMapping &amp;&amp; infoLog == nullptr &amp;&amp; mCachedValidateSamplersResult.valid())
+    {
+        return mCachedValidateSamplersResult.value();
+    }
+
+    // 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.
+    updateSamplerMapping();
+
+    std::fill(mTextureUnitTypesCache.begin(), mTextureUnitTypesCache.end(), GL_NONE);
+
+    for (unsigned int i = 0; i &lt; mUsedPixelSamplerRange; ++i)
+    {
+        if (mSamplersPS[i].active)
+        {
+            unsigned int unit = mSamplersPS[i].logicalTextureUnit;
+
+            if (unit &gt;= caps.maxCombinedTextureImageUnits)
+            {
+                if (infoLog)
+                {
+                    infoLog-&gt;append(&quot;Sampler uniform (%d) exceeds GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)&quot;, unit, caps.maxCombinedTextureImageUnits);
+                }
+
+                mCachedValidateSamplersResult = false;
+                return false;
+            }
+
+            if (mTextureUnitTypesCache[unit] != GL_NONE)
+            {
+                if (mSamplersPS[i].textureType != mTextureUnitTypesCache[unit])
+                {
+                    if (infoLog)
+                    {
+                        infoLog-&gt;append(&quot;Samplers of conflicting types refer to the same texture image unit (%d).&quot;, unit);
+                    }
+
+                    mCachedValidateSamplersResult = false;
+                    return false;
+                }
+            }
+            else
+            {
+                mTextureUnitTypesCache[unit] = mSamplersPS[i].textureType;
+            }
+        }
+    }
+
+    for (unsigned int i = 0; i &lt; mUsedVertexSamplerRange; ++i)
+    {
+        if (mSamplersVS[i].active)
+        {
+            unsigned int unit = mSamplersVS[i].logicalTextureUnit;
+
+            if (unit &gt;= caps.maxCombinedTextureImageUnits)
+            {
+                if (infoLog)
+                {
+                    infoLog-&gt;append(&quot;Sampler uniform (%d) exceeds GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)&quot;, unit, caps.maxCombinedTextureImageUnits);
+                }
+
+                mCachedValidateSamplersResult = false;
+                return false;
+            }
+
+            if (mTextureUnitTypesCache[unit] != GL_NONE)
+            {
+                if (mSamplersVS[i].textureType != mTextureUnitTypesCache[unit])
+                {
+                    if (infoLog)
+                    {
+                        infoLog-&gt;append(&quot;Samplers of conflicting types refer to the same texture image unit (%d).&quot;, unit);
+                    }
+
+                    mCachedValidateSamplersResult = false;
+                    return false;
+                }
+            }
+            else
+            {
+                mTextureUnitTypesCache[unit] = mSamplersVS[i].textureType;
+            }
+        }
+    }
+
+    mCachedValidateSamplersResult = true;
+    return true;
+}
+
+LinkResult ProgramD3D::load(gl::InfoLog &amp;infoLog, gl::BinaryInputStream *stream)
+{
+    int compileFlags = stream-&gt;readInt&lt;int&gt;();
+    if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+    {
+        infoLog.append(&quot;Mismatched compilation flags.&quot;);
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    stream-&gt;readInt(&amp;mShaderVersion);
+
+    const unsigned int psSamplerCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    for (unsigned int i = 0; i &lt; psSamplerCount; ++i)
+    {
+        Sampler sampler;
+        stream-&gt;readBool(&amp;sampler.active);
+        stream-&gt;readInt(&amp;sampler.logicalTextureUnit);
+        stream-&gt;readInt(&amp;sampler.textureType);
+        mSamplersPS.push_back(sampler);
+    }
+    const unsigned int vsSamplerCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    for (unsigned int i = 0; i &lt; vsSamplerCount; ++i)
+    {
+        Sampler sampler;
+        stream-&gt;readBool(&amp;sampler.active);
+        stream-&gt;readInt(&amp;sampler.logicalTextureUnit);
+        stream-&gt;readInt(&amp;sampler.textureType);
+        mSamplersVS.push_back(sampler);
+    }
+
+    stream-&gt;readInt(&amp;mUsedVertexSamplerRange);
+    stream-&gt;readInt(&amp;mUsedPixelSamplerRange);
+
+    const unsigned int uniformCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    if (stream-&gt;error())
+    {
+        infoLog.append(&quot;Invalid program binary.&quot;);
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    mUniforms.resize(uniformCount);
+    for (unsigned int uniformIndex = 0; uniformIndex &lt; uniformCount; uniformIndex++)
+    {
+        GLenum type = stream-&gt;readInt&lt;GLenum&gt;();
+        GLenum precision = stream-&gt;readInt&lt;GLenum&gt;();
+        std::string name = stream-&gt;readString();
+        unsigned int arraySize = stream-&gt;readInt&lt;unsigned int&gt;();
+        int blockIndex = stream-&gt;readInt&lt;int&gt;();
+
+        int offset = stream-&gt;readInt&lt;int&gt;();
+        int arrayStride = stream-&gt;readInt&lt;int&gt;();
+        int matrixStride = stream-&gt;readInt&lt;int&gt;();
+        bool isRowMajorMatrix = stream-&gt;readBool();
+
+        const sh::BlockMemberInfo blockInfo(offset, arrayStride, matrixStride, isRowMajorMatrix);
+
+        gl::LinkedUniform *uniform = new gl::LinkedUniform(type, precision, name, arraySize, blockIndex, blockInfo);
+
+        stream-&gt;readInt(&amp;uniform-&gt;psRegisterIndex);
+        stream-&gt;readInt(&amp;uniform-&gt;vsRegisterIndex);
+        stream-&gt;readInt(&amp;uniform-&gt;registerCount);
+        stream-&gt;readInt(&amp;uniform-&gt;registerElement);
+
+        mUniforms[uniformIndex] = uniform;
+    }
+
+    const unsigned int uniformIndexCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    if (stream-&gt;error())
+    {
+        infoLog.append(&quot;Invalid program binary.&quot;);
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    mUniformIndex.resize(uniformIndexCount);
+    for (unsigned int uniformIndexIndex = 0; uniformIndexIndex &lt; uniformIndexCount; uniformIndexIndex++)
+    {
+        stream-&gt;readString(&amp;mUniformIndex[uniformIndexIndex].name);
+        stream-&gt;readInt(&amp;mUniformIndex[uniformIndexIndex].element);
+        stream-&gt;readInt(&amp;mUniformIndex[uniformIndexIndex].index);
+    }
+
+    unsigned int uniformBlockCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    if (stream-&gt;error())
+    {
+        infoLog.append(&quot;Invalid program binary.&quot;);
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    mUniformBlocks.resize(uniformBlockCount);
+    for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; uniformBlockCount; ++uniformBlockIndex)
+    {
+        std::string name = stream-&gt;readString();
+        unsigned int elementIndex = stream-&gt;readInt&lt;unsigned int&gt;();
+        unsigned int dataSize = stream-&gt;readInt&lt;unsigned int&gt;();
+
+        gl::UniformBlock *uniformBlock = new gl::UniformBlock(name, elementIndex, dataSize);
+
+        stream-&gt;readInt(&amp;uniformBlock-&gt;psRegisterIndex);
+        stream-&gt;readInt(&amp;uniformBlock-&gt;vsRegisterIndex);
+
+        unsigned int numMembers = stream-&gt;readInt&lt;unsigned int&gt;();
+        uniformBlock-&gt;memberUniformIndexes.resize(numMembers);
+        for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; numMembers; blockMemberIndex++)
+        {
+            stream-&gt;readInt(&amp;uniformBlock-&gt;memberUniformIndexes[blockMemberIndex]);
+        }
+
+        mUniformBlocks[uniformBlockIndex] = uniformBlock;
+    }
+
+    stream-&gt;readInt(&amp;mTransformFeedbackBufferMode);
+    const unsigned int transformFeedbackVaryingCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    mTransformFeedbackLinkedVaryings.resize(transformFeedbackVaryingCount);
+    for (unsigned int varyingIndex = 0; varyingIndex &lt; transformFeedbackVaryingCount; varyingIndex++)
+    {
+        gl::LinkedVarying &amp;varying = mTransformFeedbackLinkedVaryings[varyingIndex];
+
+        stream-&gt;readString(&amp;varying.name);
+        stream-&gt;readInt(&amp;varying.type);
+        stream-&gt;readInt(&amp;varying.size);
+        stream-&gt;readString(&amp;varying.semanticName);
+        stream-&gt;readInt(&amp;varying.semanticIndex);
+        stream-&gt;readInt(&amp;varying.semanticIndexCount);
+    }
+
+    stream-&gt;readString(&amp;mVertexHLSL);
+    stream-&gt;readBytes(reinterpret_cast&lt;unsigned char*&gt;(&amp;mVertexWorkarounds), sizeof(D3DCompilerWorkarounds));
+    stream-&gt;readString(&amp;mPixelHLSL);
+    stream-&gt;readBytes(reinterpret_cast&lt;unsigned char*&gt;(&amp;mPixelWorkarounds), sizeof(D3DCompilerWorkarounds));
+    stream-&gt;readBool(&amp;mUsesFragDepth);
+    stream-&gt;readBool(&amp;mUsesPointSize);
+
+    const size_t pixelShaderKeySize = stream-&gt;readInt&lt;unsigned int&gt;();
+    mPixelShaderKey.resize(pixelShaderKeySize);
+    for (size_t pixelShaderKeyIndex = 0; pixelShaderKeyIndex &lt; pixelShaderKeySize; pixelShaderKeyIndex++)
+    {
+        stream-&gt;readInt(&amp;mPixelShaderKey[pixelShaderKeyIndex].type);
+        stream-&gt;readString(&amp;mPixelShaderKey[pixelShaderKeyIndex].name);
+        stream-&gt;readString(&amp;mPixelShaderKey[pixelShaderKeyIndex].source);
+        stream-&gt;readInt(&amp;mPixelShaderKey[pixelShaderKeyIndex].outputIndex);
+    }
+
+    const unsigned char* binary = reinterpret_cast&lt;const unsigned char*&gt;(stream-&gt;data());
+
+    const unsigned int vertexShaderCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    for (unsigned int vertexShaderIndex = 0; vertexShaderIndex &lt; vertexShaderCount; vertexShaderIndex++)
+    {
+        gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS];
+
+        for (size_t inputIndex = 0; inputIndex &lt; gl::MAX_VERTEX_ATTRIBS; inputIndex++)
+        {
+            gl::VertexFormat *vertexInput = &amp;inputLayout[inputIndex];
+            stream-&gt;readInt(&amp;vertexInput-&gt;mType);
+            stream-&gt;readInt(&amp;vertexInput-&gt;mNormalized);
+            stream-&gt;readInt(&amp;vertexInput-&gt;mComponents);
+            stream-&gt;readBool(&amp;vertexInput-&gt;mPureInteger);
+        }
+
+        unsigned int vertexShaderSize = stream-&gt;readInt&lt;unsigned int&gt;();
+        const unsigned char *vertexShaderFunction = binary + stream-&gt;offset();
+
+        ShaderExecutableD3D *shaderExecutable = NULL;
+        gl::Error error = mRenderer-&gt;loadExecutable(vertexShaderFunction, vertexShaderSize,
+                                                    SHADER_VERTEX,
+                                                    mTransformFeedbackLinkedVaryings,
+                                                    (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+                                                    &amp;shaderExecutable);
+        if (error.isError())
+        {
+            return LinkResult(false, error);
+        }
+
+        if (!shaderExecutable)
+        {
+            infoLog.append(&quot;Could not create vertex shader.&quot;);
+            return LinkResult(false, gl::Error(GL_NO_ERROR));
+        }
+
+        // generated converted input layout
+        GLenum signature[gl::MAX_VERTEX_ATTRIBS];
+        getInputLayoutSignature(inputLayout, signature);
+
+        // add new binary
+        mVertexExecutables.push_back(new VertexExecutable(inputLayout, signature, shaderExecutable));
+
+        stream-&gt;skip(vertexShaderSize);
+    }
+
+    const size_t pixelShaderCount = stream-&gt;readInt&lt;unsigned int&gt;();
+    for (size_t pixelShaderIndex = 0; pixelShaderIndex &lt; pixelShaderCount; pixelShaderIndex++)
+    {
+        const size_t outputCount = stream-&gt;readInt&lt;unsigned int&gt;();
+        std::vector&lt;GLenum&gt; outputs(outputCount);
+        for (size_t outputIndex = 0; outputIndex &lt; outputCount; outputIndex++)
+        {
+            stream-&gt;readInt(&amp;outputs[outputIndex]);
+        }
+
+        const size_t pixelShaderSize = stream-&gt;readInt&lt;unsigned int&gt;();
+        const unsigned char *pixelShaderFunction = binary + stream-&gt;offset();
+        ShaderExecutableD3D *shaderExecutable = NULL;
+        gl::Error error = mRenderer-&gt;loadExecutable(pixelShaderFunction, pixelShaderSize, SHADER_PIXEL,
+                                                    mTransformFeedbackLinkedVaryings,
+                                                    (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+                                                    &amp;shaderExecutable);
+        if (error.isError())
+        {
+            return LinkResult(false, error);
+        }
+
+        if (!shaderExecutable)
+        {
+            infoLog.append(&quot;Could not create pixel shader.&quot;);
+            return LinkResult(false, gl::Error(GL_NO_ERROR));
+        }
+
+        // add new binary
+        mPixelExecutables.push_back(new PixelExecutable(outputs, shaderExecutable));
+
+        stream-&gt;skip(pixelShaderSize);
+    }
+
+    unsigned int geometryShaderSize = stream-&gt;readInt&lt;unsigned int&gt;();
+
+    if (geometryShaderSize &gt; 0)
+    {
+        const unsigned char *geometryShaderFunction = binary + stream-&gt;offset();
+        gl::Error error = mRenderer-&gt;loadExecutable(geometryShaderFunction, geometryShaderSize, SHADER_GEOMETRY,
+                                                    mTransformFeedbackLinkedVaryings,
+                                                    (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+                                                    &amp;mGeometryExecutable);
+        if (error.isError())
+        {
+            return LinkResult(false, error);
+        }
+
+        if (!mGeometryExecutable)
+        {
+            infoLog.append(&quot;Could not create geometry shader.&quot;);
+            return LinkResult(false, gl::Error(GL_NO_ERROR));
+        }
+        stream-&gt;skip(geometryShaderSize);
+    }
+
+    GUID binaryIdentifier = {0};
+    stream-&gt;readBytes(reinterpret_cast&lt;unsigned char*&gt;(&amp;binaryIdentifier), sizeof(GUID));
+
+    GUID identifier = mRenderer-&gt;getAdapterIdentifier();
+    if (memcmp(&amp;identifier, &amp;binaryIdentifier, sizeof(GUID)) != 0)
+    {
+        infoLog.append(&quot;Invalid program binary.&quot;);
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    initializeUniformStorage();
+    initAttributesByLayout();
+
+    return LinkResult(true, gl::Error(GL_NO_ERROR));
+}
+
+gl::Error ProgramD3D::save(gl::BinaryOutputStream *stream)
+{
+    stream-&gt;writeInt(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
+
+    stream-&gt;writeInt(mShaderVersion);
+
+    stream-&gt;writeInt(mSamplersPS.size());
+    for (unsigned int i = 0; i &lt; mSamplersPS.size(); ++i)
+    {
+        stream-&gt;writeInt(mSamplersPS[i].active);
+        stream-&gt;writeInt(mSamplersPS[i].logicalTextureUnit);
+        stream-&gt;writeInt(mSamplersPS[i].textureType);
+    }
+
+    stream-&gt;writeInt(mSamplersVS.size());
+    for (unsigned int i = 0; i &lt; mSamplersVS.size(); ++i)
+    {
+        stream-&gt;writeInt(mSamplersVS[i].active);
+        stream-&gt;writeInt(mSamplersVS[i].logicalTextureUnit);
+        stream-&gt;writeInt(mSamplersVS[i].textureType);
+    }
+
+    stream-&gt;writeInt(mUsedVertexSamplerRange);
+    stream-&gt;writeInt(mUsedPixelSamplerRange);
+
+    stream-&gt;writeInt(mUniforms.size());
+    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); ++uniformIndex)
+    {
+        const gl::LinkedUniform &amp;uniform = *mUniforms[uniformIndex];
+
+        stream-&gt;writeInt(uniform.type);
+        stream-&gt;writeInt(uniform.precision);
+        stream-&gt;writeString(uniform.name);
+        stream-&gt;writeInt(uniform.arraySize);
+        stream-&gt;writeInt(uniform.blockIndex);
+
+        stream-&gt;writeInt(uniform.blockInfo.offset);
+        stream-&gt;writeInt(uniform.blockInfo.arrayStride);
+        stream-&gt;writeInt(uniform.blockInfo.matrixStride);
+        stream-&gt;writeInt(uniform.blockInfo.isRowMajorMatrix);
+
+        stream-&gt;writeInt(uniform.psRegisterIndex);
+        stream-&gt;writeInt(uniform.vsRegisterIndex);
+        stream-&gt;writeInt(uniform.registerCount);
+        stream-&gt;writeInt(uniform.registerElement);
+    }
+
+    stream-&gt;writeInt(mUniformIndex.size());
+    for (size_t i = 0; i &lt; mUniformIndex.size(); ++i)
+    {
+        stream-&gt;writeString(mUniformIndex[i].name);
+        stream-&gt;writeInt(mUniformIndex[i].element);
+        stream-&gt;writeInt(mUniformIndex[i].index);
+    }
+
+    stream-&gt;writeInt(mUniformBlocks.size());
+    for (size_t uniformBlockIndex = 0; uniformBlockIndex &lt; mUniformBlocks.size(); ++uniformBlockIndex)
+    {
+        const gl::UniformBlock&amp; uniformBlock = *mUniformBlocks[uniformBlockIndex];
+
+        stream-&gt;writeString(uniformBlock.name);
+        stream-&gt;writeInt(uniformBlock.elementIndex);
+        stream-&gt;writeInt(uniformBlock.dataSize);
+
+        stream-&gt;writeInt(uniformBlock.memberUniformIndexes.size());
+        for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
+        {
+            stream-&gt;writeInt(uniformBlock.memberUniformIndexes[blockMemberIndex]);
+        }
+
+        stream-&gt;writeInt(uniformBlock.psRegisterIndex);
+        stream-&gt;writeInt(uniformBlock.vsRegisterIndex);
+    }
+
+    stream-&gt;writeInt(mTransformFeedbackBufferMode);
+    stream-&gt;writeInt(mTransformFeedbackLinkedVaryings.size());
+    for (size_t i = 0; i &lt; mTransformFeedbackLinkedVaryings.size(); i++)
+    {
+        const gl::LinkedVarying &amp;varying = mTransformFeedbackLinkedVaryings[i];
+
+        stream-&gt;writeString(varying.name);
+        stream-&gt;writeInt(varying.type);
+        stream-&gt;writeInt(varying.size);
+        stream-&gt;writeString(varying.semanticName);
+        stream-&gt;writeInt(varying.semanticIndex);
+        stream-&gt;writeInt(varying.semanticIndexCount);
+    }
+
+    stream-&gt;writeString(mVertexHLSL);
+    stream-&gt;writeBytes(reinterpret_cast&lt;unsigned char*&gt;(&amp;mVertexWorkarounds), sizeof(D3DCompilerWorkarounds));
+    stream-&gt;writeString(mPixelHLSL);
+    stream-&gt;writeBytes(reinterpret_cast&lt;unsigned char*&gt;(&amp;mPixelWorkarounds), sizeof(D3DCompilerWorkarounds));
+    stream-&gt;writeInt(mUsesFragDepth);
+    stream-&gt;writeInt(mUsesPointSize);
+
+    const std::vector&lt;PixelShaderOutputVariable&gt; &amp;pixelShaderKey = mPixelShaderKey;
+    stream-&gt;writeInt(pixelShaderKey.size());
+    for (size_t pixelShaderKeyIndex = 0; pixelShaderKeyIndex &lt; pixelShaderKey.size(); pixelShaderKeyIndex++)
+    {
+        const PixelShaderOutputVariable &amp;variable = pixelShaderKey[pixelShaderKeyIndex];
+        stream-&gt;writeInt(variable.type);
+        stream-&gt;writeString(variable.name);
+        stream-&gt;writeString(variable.source);
+        stream-&gt;writeInt(variable.outputIndex);
+    }
+
+    stream-&gt;writeInt(mVertexExecutables.size());
+    for (size_t vertexExecutableIndex = 0; vertexExecutableIndex &lt; mVertexExecutables.size(); vertexExecutableIndex++)
+    {
+        VertexExecutable *vertexExecutable = mVertexExecutables[vertexExecutableIndex];
+
+        for (size_t inputIndex = 0; inputIndex &lt; gl::MAX_VERTEX_ATTRIBS; inputIndex++)
+        {
+            const gl::VertexFormat &amp;vertexInput = vertexExecutable-&gt;inputs()[inputIndex];
+            stream-&gt;writeInt(vertexInput.mType);
+            stream-&gt;writeInt(vertexInput.mNormalized);
+            stream-&gt;writeInt(vertexInput.mComponents);
+            stream-&gt;writeInt(vertexInput.mPureInteger);
+        }
+
+        size_t vertexShaderSize = vertexExecutable-&gt;shaderExecutable()-&gt;getLength();
+        stream-&gt;writeInt(vertexShaderSize);
+
+        const uint8_t *vertexBlob = vertexExecutable-&gt;shaderExecutable()-&gt;getFunction();
+        stream-&gt;writeBytes(vertexBlob, vertexShaderSize);
+    }
+
+    stream-&gt;writeInt(mPixelExecutables.size());
+    for (size_t pixelExecutableIndex = 0; pixelExecutableIndex &lt; mPixelExecutables.size(); pixelExecutableIndex++)
+    {
+        PixelExecutable *pixelExecutable = mPixelExecutables[pixelExecutableIndex];
+
+        const std::vector&lt;GLenum&gt; outputs = pixelExecutable-&gt;outputSignature();
+        stream-&gt;writeInt(outputs.size());
+        for (size_t outputIndex = 0; outputIndex &lt; outputs.size(); outputIndex++)
+        {
+            stream-&gt;writeInt(outputs[outputIndex]);
+        }
+
+        size_t pixelShaderSize = pixelExecutable-&gt;shaderExecutable()-&gt;getLength();
+        stream-&gt;writeInt(pixelShaderSize);
+
+        const uint8_t *pixelBlob = pixelExecutable-&gt;shaderExecutable()-&gt;getFunction();
+        stream-&gt;writeBytes(pixelBlob, pixelShaderSize);
+    }
+
+    size_t geometryShaderSize = (mGeometryExecutable != NULL) ? mGeometryExecutable-&gt;getLength() : 0;
+    stream-&gt;writeInt(geometryShaderSize);
+
+    if (mGeometryExecutable != NULL &amp;&amp; geometryShaderSize &gt; 0)
+    {
+        const uint8_t *geometryBlob = mGeometryExecutable-&gt;getFunction();
+        stream-&gt;writeBytes(geometryBlob, geometryShaderSize);
+    }
+
+    GUID binaryIdentifier = mRenderer-&gt;getAdapterIdentifier();
+    stream-&gt;writeBytes(reinterpret_cast&lt;unsigned char*&gt;(&amp;binaryIdentifier), sizeof(GUID));
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error ProgramD3D::getPixelExecutableForFramebuffer(const gl::Framebuffer *fbo, ShaderExecutableD3D **outExecutable)
+{
+    mPixelShaderOutputFormatCache.clear();
+
+    const FramebufferD3D *fboD3D = GetImplAs&lt;FramebufferD3D&gt;(fbo);
+    const gl::AttachmentList &amp;colorbuffers = fboD3D-&gt;getColorAttachmentsForRender(mRenderer-&gt;getWorkarounds());
+
+    for (size_t colorAttachment = 0; colorAttachment &lt; colorbuffers.size(); ++colorAttachment)
+    {
+        const gl::FramebufferAttachment *colorbuffer = colorbuffers[colorAttachment];
+
+        if (colorbuffer)
+        {
+            mPixelShaderOutputFormatCache.push_back(colorbuffer-&gt;getBinding() == GL_BACK ? GL_COLOR_ATTACHMENT0 : colorbuffer-&gt;getBinding());
+        }
+        else
+        {
+            mPixelShaderOutputFormatCache.push_back(GL_NONE);
+        }
+    }
+
+    return getPixelExecutableForOutputLayout(mPixelShaderOutputFormatCache, outExecutable, nullptr);
+}
+
+gl::Error ProgramD3D::getPixelExecutableForOutputLayout(const std::vector&lt;GLenum&gt; &amp;outputSignature,
+                                                        ShaderExecutableD3D **outExectuable,
+                                                        gl::InfoLog *infoLog)
+{
+    for (size_t executableIndex = 0; executableIndex &lt; mPixelExecutables.size(); executableIndex++)
+    {
+        if (mPixelExecutables[executableIndex]-&gt;matchesSignature(outputSignature))
+        {
+            *outExectuable = mPixelExecutables[executableIndex]-&gt;shaderExecutable();
+            return gl::Error(GL_NO_ERROR);
+        }
+    }
+
+    std::string finalPixelHLSL = mDynamicHLSL-&gt;generatePixelShaderForOutputSignature(mPixelHLSL, mPixelShaderKey, mUsesFragDepth,
+                                                                                     outputSignature);
+
+    // Generate new pixel executable
+    ShaderExecutableD3D *pixelExecutable = NULL;
+
+    gl::InfoLog tempInfoLog;
+    gl::InfoLog *currentInfoLog = infoLog ? infoLog : &amp;tempInfoLog;
+
+    gl::Error error = mRenderer-&gt;compileToExecutable(*currentInfoLog, finalPixelHLSL, SHADER_PIXEL,
+                                                     mTransformFeedbackLinkedVaryings,
+                                                     (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+                                                     mPixelWorkarounds, &amp;pixelExecutable);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (pixelExecutable)
+    {
+        mPixelExecutables.push_back(new PixelExecutable(outputSignature, pixelExecutable));
+    }
+    else if (!infoLog)
+    {
+        std::vector&lt;char&gt; tempCharBuffer(tempInfoLog.getLength() + 3);
+        tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &amp;tempCharBuffer[0]);
+        ERR(&quot;Error compiling dynamic pixel executable:\n%s\n&quot;, &amp;tempCharBuffer[0]);
+    }
+
+    *outExectuable = pixelExecutable;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error ProgramD3D::getVertexExecutableForInputLayout(const gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS],
+                                                        ShaderExecutableD3D **outExectuable,
+                                                        gl::InfoLog *infoLog)
+{
+    GLenum signature[gl::MAX_VERTEX_ATTRIBS];
+    getInputLayoutSignature(inputLayout, signature);
+
+    for (size_t executableIndex = 0; executableIndex &lt; mVertexExecutables.size(); executableIndex++)
+    {
+        if (mVertexExecutables[executableIndex]-&gt;matchesSignature(signature))
+        {
+            *outExectuable = mVertexExecutables[executableIndex]-&gt;shaderExecutable();
+            return gl::Error(GL_NO_ERROR);
+        }
+    }
+
+    // Generate new dynamic layout with attribute conversions
+    std::string finalVertexHLSL = mDynamicHLSL-&gt;generateVertexShaderForInputLayout(mVertexHLSL, inputLayout, getShaderAttributes());
+
+    // Generate new vertex executable
+    ShaderExecutableD3D *vertexExecutable = NULL;
+
+    gl::InfoLog tempInfoLog;
+    gl::InfoLog *currentInfoLog = infoLog ? infoLog : &amp;tempInfoLog;
+
+    gl::Error error = mRenderer-&gt;compileToExecutable(*currentInfoLog, finalVertexHLSL, SHADER_VERTEX,
+                                                     mTransformFeedbackLinkedVaryings,
+                                                     (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+                                                     mVertexWorkarounds, &amp;vertexExecutable);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (vertexExecutable)
+    {
+        mVertexExecutables.push_back(new VertexExecutable(inputLayout, signature, vertexExecutable));
+    }
+    else if (!infoLog)
+    {
+        std::vector&lt;char&gt; tempCharBuffer(tempInfoLog.getLength() + 3);
+        tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &amp;tempCharBuffer[0]);
+        ERR(&quot;Error compiling dynamic vertex executable:\n%s\n&quot;, &amp;tempCharBuffer[0]);
+    }
+
+    *outExectuable = vertexExecutable;
+    return gl::Error(GL_NO_ERROR);
+}
+
+LinkResult ProgramD3D::compileProgramExecutables(gl::InfoLog &amp;infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                                                 int registers)
+{
+    ShaderD3D *vertexShaderD3D = GetImplAs&lt;ShaderD3D&gt;(vertexShader);
+    ShaderD3D *fragmentShaderD3D = GetImplAs&lt;ShaderD3D&gt;(fragmentShader);
+
+    gl::VertexFormat defaultInputLayout[gl::MAX_VERTEX_ATTRIBS];
+    GetDefaultInputLayoutFromShader(vertexShader-&gt;getActiveAttributes(), defaultInputLayout);
+    ShaderExecutableD3D *defaultVertexExecutable = NULL;
+    gl::Error error = getVertexExecutableForInputLayout(defaultInputLayout, &amp;defaultVertexExecutable, &amp;infoLog);
+    if (error.isError())
+    {
+        return LinkResult(false, error);
+    }
+
+    std::vector&lt;GLenum&gt; defaultPixelOutput = GetDefaultOutputLayoutFromShader(getPixelShaderKey());
+    ShaderExecutableD3D *defaultPixelExecutable = NULL;
+    error = getPixelExecutableForOutputLayout(defaultPixelOutput, &amp;defaultPixelExecutable, &amp;infoLog);
+    if (error.isError())
+    {
+        return LinkResult(false, error);
+    }
+
+    if (usesGeometryShader())
+    {
+        std::string geometryHLSL = mDynamicHLSL-&gt;generateGeometryShaderHLSL(registers, fragmentShaderD3D, vertexShaderD3D);
+
+
+        error = mRenderer-&gt;compileToExecutable(infoLog, geometryHLSL, SHADER_GEOMETRY, mTransformFeedbackLinkedVaryings,
+                                               (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
+                                               D3DCompilerWorkarounds(), &amp;mGeometryExecutable);
+        if (error.isError())
+        {
+            return LinkResult(false, error);
+        }
+    }
+
+#if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED
+    if (usesGeometryShader() &amp;&amp; mGeometryExecutable)
+    {
+        // Geometry shaders are currently only used internally, so there is no corresponding shader object at the interface level
+        // For now the geometry shader debug info is pre-pended to the vertex shader, this is a bit of a clutch
+        vertexShaderD3D-&gt;appendDebugInfo(&quot;// GEOMETRY SHADER BEGIN\n\n&quot;);
+        vertexShaderD3D-&gt;appendDebugInfo(mGeometryExecutable-&gt;getDebugInfo());
+        vertexShaderD3D-&gt;appendDebugInfo(&quot;\nGEOMETRY SHADER END\n\n\n&quot;);
+    }
+
+    if (defaultVertexExecutable)
+    {
+        vertexShaderD3D-&gt;appendDebugInfo(defaultVertexExecutable-&gt;getDebugInfo());
+    }
+
+    if (defaultPixelExecutable)
+    {
+        fragmentShaderD3D-&gt;appendDebugInfo(defaultPixelExecutable-&gt;getDebugInfo());
+    }
+#endif
+
+    bool linkSuccess = (defaultVertexExecutable &amp;&amp; defaultPixelExecutable &amp;&amp; (!usesGeometryShader() || mGeometryExecutable));
+    return LinkResult(linkSuccess, gl::Error(GL_NO_ERROR));
+}
+
+LinkResult ProgramD3D::link(const gl::Data &amp;data, gl::InfoLog &amp;infoLog,
+                            gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                            const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings,
+                            GLenum transformFeedbackBufferMode,
+                            int *registers, std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings,
+                            std::map&lt;int, gl::VariableLocation&gt; *outputVariables)
+{
+    ShaderD3D *vertexShaderD3D = GetImplAs&lt;ShaderD3D&gt;(vertexShader);
+    ShaderD3D *fragmentShaderD3D = GetImplAs&lt;ShaderD3D&gt;(fragmentShader);
+
+    mSamplersPS.resize(data.caps-&gt;maxTextureImageUnits);
+    mSamplersVS.resize(data.caps-&gt;maxVertexTextureImageUnits);
+
+    mTransformFeedbackBufferMode = transformFeedbackBufferMode;
+
+    mPixelHLSL = fragmentShaderD3D-&gt;getTranslatedSource();
+    fragmentShaderD3D-&gt;generateWorkarounds(&amp;mPixelWorkarounds);
+
+    mVertexHLSL = vertexShaderD3D-&gt;getTranslatedSource();
+    vertexShaderD3D-&gt;generateWorkarounds(&amp;mVertexWorkarounds);
+    mShaderVersion = vertexShaderD3D-&gt;getShaderVersion();
+
+    // Map the varyings to the register file
+    VaryingPacking packing = { NULL };
+    *registers = mDynamicHLSL-&gt;packVaryings(infoLog, packing, fragmentShaderD3D, vertexShaderD3D, transformFeedbackVaryings);
+
+    if (*registers &lt; 0)
+    {
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    if (!gl::Program::linkVaryings(infoLog, fragmentShader, vertexShader))
+    {
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    if (!mDynamicHLSL-&gt;generateShaderLinkHLSL(data, infoLog, *registers, packing, mPixelHLSL, mVertexHLSL,
+                                              fragmentShaderD3D, vertexShaderD3D, transformFeedbackVaryings,
+                                              linkedVaryings, outputVariables, &amp;mPixelShaderKey, &amp;mUsesFragDepth))
+    {
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    mUsesPointSize = vertexShaderD3D-&gt;usesPointSize();
+
+    initAttributesByLayout();
+
+    return LinkResult(true, gl::Error(GL_NO_ERROR));
+}
+
+void ProgramD3D::getInputLayoutSignature(const gl::VertexFormat inputLayout[], GLenum signature[]) const
+{
+    mDynamicHLSL-&gt;getInputLayoutSignature(inputLayout, signature);
+}
+
+void ProgramD3D::initializeUniformStorage()
+{
+    // Compute total default block size
+    unsigned int vertexRegisters = 0;
+    unsigned int fragmentRegisters = 0;
+    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
+    {
+        const gl::LinkedUniform &amp;uniform = *mUniforms[uniformIndex];
+
+        if (!gl::IsSamplerType(uniform.type))
+        {
+            if (uniform.isReferencedByVertexShader())
+            {
+                vertexRegisters = std::max(vertexRegisters, uniform.vsRegisterIndex + uniform.registerCount);
+            }
+            if (uniform.isReferencedByFragmentShader())
+            {
+                fragmentRegisters = std::max(fragmentRegisters, uniform.psRegisterIndex + uniform.registerCount);
+            }
+        }
+    }
+
+    mVertexUniformStorage = mRenderer-&gt;createUniformStorage(vertexRegisters * 16u);
+    mFragmentUniformStorage = mRenderer-&gt;createUniformStorage(fragmentRegisters * 16u);
+}
+
+gl::Error ProgramD3D::applyUniforms()
+{
+    updateSamplerMapping();
+
+    gl::Error error = mRenderer-&gt;applyUniforms(*this, mUniforms);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
+    {
+        mUniforms[uniformIndex]-&gt;dirty = false;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error ProgramD3D::applyUniformBuffers(const gl::Data &amp;data, GLuint uniformBlockBindings[])
+{
+    GLint vertexUniformBuffers[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
+    GLint fragmentUniformBuffers[gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS];
+
+    for (unsigned int registerIndex = 0; registerIndex &lt; gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; ++registerIndex)
+    {
+        vertexUniformBuffers[registerIndex] = -1;
+    }
+
+    for (unsigned int registerIndex = 0; registerIndex &lt; gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS; ++registerIndex)
+    {
+        fragmentUniformBuffers[registerIndex] = -1;
+    }
+
+    const unsigned int reservedBuffersInVS = mRenderer-&gt;getReservedVertexUniformBuffers();
+    const unsigned int reservedBuffersInFS = mRenderer-&gt;getReservedFragmentUniformBuffers();
+
+    for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; mUniformBlocks.size(); uniformBlockIndex++)
+    {
+        gl::UniformBlock *uniformBlock = mUniformBlocks[uniformBlockIndex];
+        GLuint blockBinding = uniformBlockBindings[uniformBlockIndex];
+
+        ASSERT(uniformBlock);
+
+        // Unnecessary to apply an unreferenced standard or shared UBO
+        if (!uniformBlock-&gt;isReferencedByVertexShader() &amp;&amp; !uniformBlock-&gt;isReferencedByFragmentShader())
+        {
+            continue;
+        }
+
+        if (uniformBlock-&gt;isReferencedByVertexShader())
+        {
+            unsigned int registerIndex = uniformBlock-&gt;vsRegisterIndex - reservedBuffersInVS;
+            ASSERT(vertexUniformBuffers[registerIndex] == -1);
+            ASSERT(registerIndex &lt; data.caps-&gt;maxVertexUniformBlocks);
+            vertexUniformBuffers[registerIndex] = blockBinding;
+        }
+
+        if (uniformBlock-&gt;isReferencedByFragmentShader())
+        {
+            unsigned int registerIndex = uniformBlock-&gt;psRegisterIndex - reservedBuffersInFS;
+            ASSERT(fragmentUniformBuffers[registerIndex] == -1);
+            ASSERT(registerIndex &lt; data.caps-&gt;maxFragmentUniformBlocks);
+            fragmentUniformBuffers[registerIndex] = blockBinding;
+        }
+    }
+
+    return mRenderer-&gt;setUniformBuffers(data, vertexUniformBuffers, fragmentUniformBuffers);
+}
+
+bool ProgramD3D::assignUniformBlockRegister(gl::InfoLog &amp;infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
+                                            unsigned int registerIndex, const gl::Caps &amp;caps)
+{
+    if (shader == GL_VERTEX_SHADER)
+    {
+        uniformBlock-&gt;vsRegisterIndex = registerIndex;
+        if (registerIndex - mRenderer-&gt;getReservedVertexUniformBuffers() &gt;= caps.maxVertexUniformBlocks)
+        {
+            infoLog.append(&quot;Vertex shader uniform block count exceed GL_MAX_VERTEX_UNIFORM_BLOCKS (%u)&quot;, caps.maxVertexUniformBlocks);
+            return false;
+        }
+    }
+    else if (shader == GL_FRAGMENT_SHADER)
+    {
+        uniformBlock-&gt;psRegisterIndex = registerIndex;
+        if (registerIndex - mRenderer-&gt;getReservedFragmentUniformBuffers() &gt;= caps.maxFragmentUniformBlocks)
+        {
+            infoLog.append(&quot;Fragment shader uniform block count exceed GL_MAX_FRAGMENT_UNIFORM_BLOCKS (%u)&quot;, caps.maxFragmentUniformBlocks);
+            return false;
+        }
+    }
+    else UNREACHABLE();
+
+    return true;
+}
+
+void ProgramD3D::dirtyAllUniforms()
+{
+    unsigned int numUniforms = mUniforms.size();
+    for (unsigned int index = 0; index &lt; numUniforms; index++)
+    {
+        mUniforms[index]-&gt;dirty = true;
+    }
+}
+
+void ProgramD3D::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    setUniform(location, count, v, GL_FLOAT);
+}
+
+void ProgramD3D::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    setUniform(location, count, v, GL_FLOAT_VEC2);
+}
+
+void ProgramD3D::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    setUniform(location, count, v, GL_FLOAT_VEC3);
+}
+
+void ProgramD3D::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    setUniform(location, count, v, GL_FLOAT_VEC4);
+}
+
+void ProgramD3D::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;2, 2&gt;(location, count, transpose, value, GL_FLOAT_MAT2);
+}
+
+void ProgramD3D::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;3, 3&gt;(location, count, transpose, value, GL_FLOAT_MAT3);
+}
+
+void ProgramD3D::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;4, 4&gt;(location, count, transpose, value, GL_FLOAT_MAT4);
+}
+
+void ProgramD3D::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;2, 3&gt;(location, count, transpose, value, GL_FLOAT_MAT2x3);
+}
+
+void ProgramD3D::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;3, 2&gt;(location, count, transpose, value, GL_FLOAT_MAT3x2);
+}
+
+void ProgramD3D::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;2, 4&gt;(location, count, transpose, value, GL_FLOAT_MAT2x4);
+}
+
+void ProgramD3D::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;4, 2&gt;(location, count, transpose, value, GL_FLOAT_MAT4x2);
+}
+
+void ProgramD3D::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;3, 4&gt;(location, count, transpose, value, GL_FLOAT_MAT3x4);
+}
+
+void ProgramD3D::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    setUniformMatrixfv&lt;4, 3&gt;(location, count, transpose, value, GL_FLOAT_MAT4x3);
+}
+
+void ProgramD3D::setUniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+    setUniform(location, count, v, GL_INT);
+}
+
+void ProgramD3D::setUniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+    setUniform(location, count, v, GL_INT_VEC2);
+}
+
+void ProgramD3D::setUniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+    setUniform(location, count, v, GL_INT_VEC3);
+}
+
+void ProgramD3D::setUniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+    setUniform(location, count, v, GL_INT_VEC4);
+}
+
+void ProgramD3D::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    setUniform(location, count, v, GL_UNSIGNED_INT);
+}
+
+void ProgramD3D::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    setUniform(location, count, v, GL_UNSIGNED_INT_VEC2);
+}
+
+void ProgramD3D::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    setUniform(location, count, v, GL_UNSIGNED_INT_VEC3);
+}
+
+void ProgramD3D::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    setUniform(location, count, v, GL_UNSIGNED_INT_VEC4);
+}
+
+void ProgramD3D::getUniformfv(GLint location, GLfloat *params)
+{
+    getUniformv(location, params, GL_FLOAT);
+}
+
+void ProgramD3D::getUniformiv(GLint location, GLint *params)
+{
+    getUniformv(location, params, GL_INT);
+}
+
+void ProgramD3D::getUniformuiv(GLint location, GLuint *params)
+{
+    getUniformv(location, params, GL_UNSIGNED_INT);
+}
+
+bool ProgramD3D::linkUniforms(gl::InfoLog &amp;infoLog, const gl::Shader &amp;vertexShader, const gl::Shader &amp;fragmentShader,
+                              const gl::Caps &amp;caps)
+{
+    const ShaderD3D *vertexShaderD3D = GetImplAs&lt;ShaderD3D&gt;(&amp;vertexShader);
+    const ShaderD3D *fragmentShaderD3D = GetImplAs&lt;ShaderD3D&gt;(&amp;fragmentShader);
+
+    const std::vector&lt;sh::Uniform&gt; &amp;vertexUniforms = vertexShader.getUniforms();
+    const std::vector&lt;sh::Uniform&gt; &amp;fragmentUniforms = fragmentShader.getUniforms();
+
+    // Check that uniforms defined in the vertex and fragment shaders are identical
+    typedef std::map&lt;std::string, const sh::Uniform*&gt; UniformMap;
+    UniformMap linkedUniforms;
+
+    for (unsigned int vertexUniformIndex = 0; vertexUniformIndex &lt; vertexUniforms.size(); vertexUniformIndex++)
+    {
+        const sh::Uniform &amp;vertexUniform = vertexUniforms[vertexUniformIndex];
+        linkedUniforms[vertexUniform.name] = &amp;vertexUniform;
+    }
+
+    for (unsigned int fragmentUniformIndex = 0; fragmentUniformIndex &lt; fragmentUniforms.size(); fragmentUniformIndex++)
+    {
+        const sh::Uniform &amp;fragmentUniform = fragmentUniforms[fragmentUniformIndex];
+        UniformMap::const_iterator entry = linkedUniforms.find(fragmentUniform.name);
+        if (entry != linkedUniforms.end())
+        {
+            const sh::Uniform &amp;vertexUniform = *entry-&gt;second;
+            const std::string &amp;uniformName = &quot;uniform '&quot; + vertexUniform.name + &quot;'&quot;;
+            if (!gl::Program::linkValidateUniforms(infoLog, uniformName, vertexUniform, fragmentUniform))
+            {
+                return false;
+            }
+        }
+    }
+
+    for (unsigned int uniformIndex = 0; uniformIndex &lt; vertexUniforms.size(); uniformIndex++)
+    {
+        const sh::Uniform &amp;uniform = vertexUniforms[uniformIndex];
+
+        if (uniform.staticUse)
+        {
+            unsigned int registerBase = uniform.isBuiltIn() ? GL_INVALID_INDEX :
+                vertexShaderD3D-&gt;getUniformRegister(uniform.name);
+            defineUniformBase(vertexShaderD3D, uniform, registerBase);
+        }
+    }
+
+    for (unsigned int uniformIndex = 0; uniformIndex &lt; fragmentUniforms.size(); uniformIndex++)
+    {
+        const sh::Uniform &amp;uniform = fragmentUniforms[uniformIndex];
+
+        if (uniform.staticUse)
+        {
+            unsigned int registerBase = uniform.isBuiltIn() ? GL_INVALID_INDEX :
+                fragmentShaderD3D-&gt;getUniformRegister(uniform.name);
+            defineUniformBase(fragmentShaderD3D, uniform, registerBase);
+        }
+    }
+
+    if (!indexUniforms(infoLog, caps))
+    {
+        return false;
+    }
+
+    initializeUniformStorage();
+
+    return true;
+}
+
+void ProgramD3D::defineUniformBase(const ShaderD3D *shader, const sh::Uniform &amp;uniform, unsigned int uniformRegister)
+{
+    if (uniformRegister == GL_INVALID_INDEX)
+    {
+        defineUniform(shader, uniform, uniform.name, nullptr);
+        return;
+    }
+
+    ShShaderOutput outputType = shader-&gt;getCompilerOutputType();
+    sh::HLSLBlockEncoder encoder(sh::HLSLBlockEncoder::GetStrategyFor(outputType));
+    encoder.skipRegisters(uniformRegister);
+
+    defineUniform(shader, uniform, uniform.name, &amp;encoder);
+}
+
+void ProgramD3D::defineUniform(const ShaderD3D *shader, const sh::ShaderVariable &amp;uniform,
+                               const std::string &amp;fullName, sh::HLSLBlockEncoder *encoder)
+{
+    if (uniform.isStruct())
+    {
+        for (unsigned int elementIndex = 0; elementIndex &lt; uniform.elementCount(); elementIndex++)
+        {
+            const std::string &amp;elementString = (uniform.isArray() ? ArrayString(elementIndex) : &quot;&quot;);
+
+            if (encoder)
+                encoder-&gt;enterAggregateType();
+
+            for (size_t fieldIndex = 0; fieldIndex &lt; uniform.fields.size(); fieldIndex++)
+            {
+                const sh::ShaderVariable &amp;field = uniform.fields[fieldIndex];
+                const std::string &amp;fieldFullName = (fullName + elementString + &quot;.&quot; + field.name);
+
+                defineUniform(shader, field, fieldFullName, encoder);
+            }
+
+            if (encoder)
+                encoder-&gt;exitAggregateType();
+        }
+    }
+    else // Not a struct
+    {
+        // Arrays are treated as aggregate types
+        if (uniform.isArray() &amp;&amp; encoder)
+        {
+            encoder-&gt;enterAggregateType();
+        }
+
+        gl::LinkedUniform *linkedUniform = getUniformByName(fullName);
+
+        // Advance the uniform offset, to track registers allocation for structs
+        sh::BlockMemberInfo blockInfo = encoder ?
+            encoder-&gt;encodeType(uniform.type, uniform.arraySize, false) :
+            sh::BlockMemberInfo::getDefaultBlockInfo();
+
+        if (!linkedUniform)
+        {
+            linkedUniform = new gl::LinkedUniform(uniform.type, uniform.precision, fullName, uniform.arraySize,
+                                                  -1, sh::BlockMemberInfo::getDefaultBlockInfo());
+            ASSERT(linkedUniform);
+
+            if (encoder)
+                linkedUniform-&gt;registerElement = sh::HLSLBlockEncoder::getBlockRegisterElement(blockInfo);
+            mUniforms.push_back(linkedUniform);
+        }
+
+        if (encoder)
+        {
+            if (shader-&gt;getShaderType() == GL_FRAGMENT_SHADER)
+            {
+                linkedUniform-&gt;psRegisterIndex = sh::HLSLBlockEncoder::getBlockRegister(blockInfo);
+            }
+            else if (shader-&gt;getShaderType() == GL_VERTEX_SHADER)
+            {
+                linkedUniform-&gt;vsRegisterIndex = sh::HLSLBlockEncoder::getBlockRegister(blockInfo);
+            }
+            else UNREACHABLE();
+        }
+
+        // Arrays are treated as aggregate types
+        if (uniform.isArray() &amp;&amp; encoder)
+        {
+            encoder-&gt;exitAggregateType();
+        }
+    }
+}
+
+template &lt;typename T&gt;
+static inline void SetIfDirty(T *dest, const T&amp; source, bool *dirtyFlag)
+{
+    ASSERT(dest != NULL);
+    ASSERT(dirtyFlag != NULL);
+
+    *dirtyFlag = *dirtyFlag || (memcmp(dest, &amp;source, sizeof(T)) != 0);
+    *dest = source;
+}
+
+template &lt;typename T&gt;
+void ProgramD3D::setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType)
+{
+    const int components = gl::VariableComponentCount(targetUniformType);
+    const GLenum targetBoolType = gl::VariableBoolVectorType(targetUniformType);
+
+    gl::LinkedUniform *targetUniform = getUniformByLocation(location);
+
+    int elementCount = targetUniform-&gt;elementCount();
+
+    count = std::min(elementCount - (int)mUniformIndex[location].element, count);
+
+    if (targetUniform-&gt;type == targetUniformType)
+    {
+        T *target = reinterpret_cast&lt;T*&gt;(targetUniform-&gt;data) + mUniformIndex[location].element * 4;
+
+        for (int i = 0; i &lt; count; i++)
+        {
+            T *dest = target + (i * 4);
+            const T *source = v + (i * components);
+
+            for (int c = 0; c &lt; components; c++)
+            {
+                SetIfDirty(dest + c, source[c], &amp;targetUniform-&gt;dirty);
+            }
+            for (int c = components; c &lt; 4; c++)
+            {
+                SetIfDirty(dest + c, T(0), &amp;targetUniform-&gt;dirty);
+            }
+        }
+    }
+    else if (targetUniform-&gt;type == targetBoolType)
+    {
+        GLint *boolParams = reinterpret_cast&lt;GLint*&gt;(targetUniform-&gt;data) + mUniformIndex[location].element * 4;
+
+        for (int i = 0; i &lt; count; i++)
+        {
+            GLint *dest = boolParams + (i * 4);
+            const T *source = v + (i * components);
+
+            for (int c = 0; c &lt; components; c++)
+            {
+                SetIfDirty(dest + c, (source[c] == static_cast&lt;T&gt;(0)) ? GL_FALSE : GL_TRUE, &amp;targetUniform-&gt;dirty);
+            }
+            for (int c = components; c &lt; 4; c++)
+            {
+                SetIfDirty(dest + c, GL_FALSE, &amp;targetUniform-&gt;dirty);
+            }
+        }
+    }
+    else if (gl::IsSamplerType(targetUniform-&gt;type))
+    {
+        ASSERT(targetUniformType == GL_INT);
+
+        GLint *target = reinterpret_cast&lt;GLint*&gt;(targetUniform-&gt;data) + mUniformIndex[location].element * 4;
+
+        bool wasDirty = targetUniform-&gt;dirty;
+
+        for (int i = 0; i &lt; count; i++)
+        {
+            GLint *dest = target + (i * 4);
+            const GLint *source = reinterpret_cast&lt;const GLint*&gt;(v) + (i * components);
+
+            SetIfDirty(dest + 0, source[0], &amp;targetUniform-&gt;dirty);
+            SetIfDirty(dest + 1, 0, &amp;targetUniform-&gt;dirty);
+            SetIfDirty(dest + 2, 0, &amp;targetUniform-&gt;dirty);
+            SetIfDirty(dest + 3, 0, &amp;targetUniform-&gt;dirty);
+        }
+
+        if (!wasDirty &amp;&amp; targetUniform-&gt;dirty)
+        {
+            mDirtySamplerMapping = true;
+        }
+    }
+    else UNREACHABLE();
+}
+
+template&lt;typename T&gt;
+bool transposeMatrix(T *target, const GLfloat *value, int targetWidth, int targetHeight, int srcWidth, int srcHeight)
+{
+    bool dirty = false;
+    int copyWidth = std::min(targetHeight, srcWidth);
+    int copyHeight = std::min(targetWidth, srcHeight);
+
+    for (int x = 0; x &lt; copyWidth; x++)
+    {
+        for (int y = 0; y &lt; copyHeight; y++)
+        {
+            SetIfDirty(target + (x * targetWidth + y), static_cast&lt;T&gt;(value[y * srcWidth + x]), &amp;dirty);
+        }
+    }
+    // clear unfilled right side
+    for (int y = 0; y &lt; copyWidth; y++)
+    {
+        for (int x = copyHeight; x &lt; targetWidth; x++)
+        {
+            SetIfDirty(target + (y * targetWidth + x), static_cast&lt;T&gt;(0), &amp;dirty);
+        }
+    }
+    // clear unfilled bottom.
+    for (int y = copyWidth; y &lt; targetHeight; y++)
+    {
+        for (int x = 0; x &lt; targetWidth; x++)
+        {
+            SetIfDirty(target + (y * targetWidth + x), static_cast&lt;T&gt;(0), &amp;dirty);
+        }
+    }
+
+    return dirty;
+}
+
+template&lt;typename T&gt;
+bool expandMatrix(T *target, const GLfloat *value, int targetWidth, int targetHeight, int srcWidth, int srcHeight)
+{
+    bool dirty = false;
+    int copyWidth = std::min(targetWidth, srcWidth);
+    int copyHeight = std::min(targetHeight, srcHeight);
+
+    for (int y = 0; y &lt; copyHeight; y++)
+    {
+        for (int x = 0; x &lt; copyWidth; x++)
+        {
+            SetIfDirty(target + (y * targetWidth + x), static_cast&lt;T&gt;(value[y * srcWidth + x]), &amp;dirty);
+        }
+    }
+    // clear unfilled right side
+    for (int y = 0; y &lt; copyHeight; y++)
+    {
+        for (int x = copyWidth; x &lt; targetWidth; x++)
+        {
+            SetIfDirty(target + (y * targetWidth + x), static_cast&lt;T&gt;(0), &amp;dirty);
+        }
+    }
+    // clear unfilled bottom.
+    for (int y = copyHeight; y &lt; targetHeight; y++)
+    {
+        for (int x = 0; x &lt; targetWidth; x++)
+        {
+            SetIfDirty(target + (y * targetWidth + x), static_cast&lt;T&gt;(0), &amp;dirty);
+        }
+    }
+
+    return dirty;
+}
+
+template &lt;int cols, int rows&gt;
+void ProgramD3D::setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType)
+{
+    gl::LinkedUniform *targetUniform = getUniformByLocation(location);
+
+    int elementCount = targetUniform-&gt;elementCount();
+
+    count = std::min(elementCount - (int)mUniformIndex[location].element, count);
+    const unsigned int targetMatrixStride = (4 * rows);
+    GLfloat *target = (GLfloat*)(targetUniform-&gt;data + mUniformIndex[location].element * sizeof(GLfloat) * targetMatrixStride);
+
+    for (int i = 0; i &lt; count; i++)
+    {
+        // Internally store matrices as transposed versions to accomodate HLSL matrix indexing
+        if (transpose == GL_FALSE)
+        {
+            targetUniform-&gt;dirty = transposeMatrix&lt;GLfloat&gt;(target, value, 4, rows, rows, cols) || targetUniform-&gt;dirty;
+        }
+        else
+        {
+            targetUniform-&gt;dirty = expandMatrix&lt;GLfloat&gt;(target, value, 4, rows, cols, rows) || targetUniform-&gt;dirty;
+        }
+        target += targetMatrixStride;
+        value += cols * rows;
+    }
+}
+
+template &lt;typename T&gt;
+void ProgramD3D::getUniformv(GLint location, T *params, GLenum uniformType)
+{
+    gl::LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
+
+    if (gl::IsMatrixType(targetUniform-&gt;type))
+    {
+        const int rows = gl::VariableRowCount(targetUniform-&gt;type);
+        const int cols = gl::VariableColumnCount(targetUniform-&gt;type);
+        transposeMatrix(params, (GLfloat*)targetUniform-&gt;data + mUniformIndex[location].element * 4 * rows, rows, cols, 4, rows);
+    }
+    else if (uniformType == gl::VariableComponentType(targetUniform-&gt;type))
+    {
+        unsigned int size = gl::VariableComponentCount(targetUniform-&gt;type);
+        memcpy(params, targetUniform-&gt;data + mUniformIndex[location].element * 4 * sizeof(T),
+                size * sizeof(T));
+    }
+    else
+    {
+        unsigned int size = gl::VariableComponentCount(targetUniform-&gt;type);
+        switch (gl::VariableComponentType(targetUniform-&gt;type))
+        {
+          case GL_BOOL:
+            {
+                GLint *boolParams = (GLint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
+
+                for (unsigned int i = 0; i &lt; size; i++)
+                {
+                    params[i] = (boolParams[i] == GL_FALSE) ? static_cast&lt;T&gt;(0) : static_cast&lt;T&gt;(1);
+                }
+            }
+            break;
+
+          case GL_FLOAT:
+            {
+                GLfloat *floatParams = (GLfloat*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
+
+                for (unsigned int i = 0; i &lt; size; i++)
+                {
+                    params[i] = static_cast&lt;T&gt;(floatParams[i]);
+                }
+            }
+            break;
+
+          case GL_INT:
+            {
+                GLint *intParams = (GLint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
+
+                for (unsigned int i = 0; i &lt; size; i++)
+                {
+                    params[i] = static_cast&lt;T&gt;(intParams[i]);
+                }
+            }
+            break;
+
+          case GL_UNSIGNED_INT:
+            {
+                GLuint *uintParams = (GLuint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
+
+                for (unsigned int i = 0; i &lt; size; i++)
+                {
+                    params[i] = static_cast&lt;T&gt;(uintParams[i]);
+                }
+            }
+            break;
+
+          default: UNREACHABLE();
+        }
+    }
+}
+
+template &lt;typename VarT&gt;
+void ProgramD3D::defineUniformBlockMembers(const std::vector&lt;VarT&gt; &amp;fields, const std::string &amp;prefix, int blockIndex,
+                                           sh::BlockLayoutEncoder *encoder, std::vector&lt;unsigned int&gt; *blockUniformIndexes,
+                                           bool inRowMajorLayout)
+{
+    for (unsigned int uniformIndex = 0; uniformIndex &lt; fields.size(); uniformIndex++)
+    {
+        const VarT &amp;field = fields[uniformIndex];
+        const std::string &amp;fieldName = (prefix.empty() ? field.name : prefix + &quot;.&quot; + field.name);
+
+        if (field.isStruct())
+        {
+            bool rowMajorLayout = (inRowMajorLayout || IsRowMajorLayout(field));
+
+            for (unsigned int arrayElement = 0; arrayElement &lt; field.elementCount(); arrayElement++)
+            {
+                encoder-&gt;enterAggregateType();
+
+                const std::string uniformElementName = fieldName + (field.isArray() ? ArrayString(arrayElement) : &quot;&quot;);
+                defineUniformBlockMembers(field.fields, uniformElementName, blockIndex, encoder, blockUniformIndexes, rowMajorLayout);
+
+                encoder-&gt;exitAggregateType();
+            }
+        }
+        else
+        {
+            bool isRowMajorMatrix = (gl::IsMatrixType(field.type) &amp;&amp; inRowMajorLayout);
+
+            sh::BlockMemberInfo memberInfo = encoder-&gt;encodeType(field.type, field.arraySize, isRowMajorMatrix);
+
+            gl::LinkedUniform *newUniform = new gl::LinkedUniform(field.type, field.precision, fieldName, field.arraySize,
+                                                          blockIndex, memberInfo);
+
+            // add to uniform list, but not index, since uniform block uniforms have no location
+            blockUniformIndexes-&gt;push_back(mUniforms.size());
+            mUniforms.push_back(newUniform);
+        }
+    }
+}
+
+bool ProgramD3D::defineUniformBlock(gl::InfoLog &amp;infoLog, const gl::Shader &amp;shader, const sh::InterfaceBlock &amp;interfaceBlock,
+                                    const gl::Caps &amp;caps)
+{
+    const ShaderD3D* shaderD3D = GetImplAs&lt;ShaderD3D&gt;(&amp;shader);
+
+    // create uniform block entries if they do not exist
+    if (getUniformBlockIndex(interfaceBlock.name) == GL_INVALID_INDEX)
+    {
+        std::vector&lt;unsigned int&gt; blockUniformIndexes;
+        const unsigned int blockIndex = mUniformBlocks.size();
+
+        // define member uniforms
+        sh::BlockLayoutEncoder *encoder = NULL;
+
+        if (interfaceBlock.layout == sh::BLOCKLAYOUT_STANDARD)
+        {
+            encoder = new sh::Std140BlockEncoder;
+        }
+        else
+        {
+            encoder = new sh::HLSLBlockEncoder(sh::HLSLBlockEncoder::ENCODE_PACKED);
+        }
+        ASSERT(encoder);
+
+        defineUniformBlockMembers(interfaceBlock.fields, &quot;&quot;, blockIndex, encoder, &amp;blockUniformIndexes, interfaceBlock.isRowMajorLayout);
+
+        size_t dataSize = encoder-&gt;getBlockSize();
+
+        // create all the uniform blocks
+        if (interfaceBlock.arraySize &gt; 0)
+        {
+            for (unsigned int uniformBlockElement = 0; uniformBlockElement &lt; interfaceBlock.arraySize; uniformBlockElement++)
+            {
+                gl::UniformBlock *newUniformBlock = new gl::UniformBlock(interfaceBlock.name, uniformBlockElement, dataSize);
+                newUniformBlock-&gt;memberUniformIndexes = blockUniformIndexes;
+                mUniformBlocks.push_back(newUniformBlock);
+            }
+        }
+        else
+        {
+            gl::UniformBlock *newUniformBlock = new gl::UniformBlock(interfaceBlock.name, GL_INVALID_INDEX, dataSize);
+            newUniformBlock-&gt;memberUniformIndexes = blockUniformIndexes;
+            mUniformBlocks.push_back(newUniformBlock);
+        }
+    }
+
+    if (interfaceBlock.staticUse)
+    {
+        // Assign registers to the uniform blocks
+        const GLuint blockIndex = getUniformBlockIndex(interfaceBlock.name);
+        const unsigned int elementCount = std::max(1u, interfaceBlock.arraySize);
+        ASSERT(blockIndex != GL_INVALID_INDEX);
+        ASSERT(blockIndex + elementCount &lt;= mUniformBlocks.size());
+
+        unsigned int interfaceBlockRegister = shaderD3D-&gt;getInterfaceBlockRegister(interfaceBlock.name);
+
+        for (unsigned int uniformBlockElement = 0; uniformBlockElement &lt; elementCount; uniformBlockElement++)
+        {
+            gl::UniformBlock *uniformBlock = mUniformBlocks[blockIndex + uniformBlockElement];
+            ASSERT(uniformBlock-&gt;name == interfaceBlock.name);
+
+            if (!assignUniformBlockRegister(infoLog, uniformBlock, shader.getType(),
+                                            interfaceBlockRegister + uniformBlockElement, caps))
+            {
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
+bool ProgramD3D::assignSamplers(unsigned int startSamplerIndex,
+                                   GLenum samplerType,
+                                   unsigned int samplerCount,
+                                   std::vector&lt;Sampler&gt; &amp;outSamplers,
+                                   GLuint *outUsedRange)
+{
+    unsigned int samplerIndex = startSamplerIndex;
+
+    do
+    {
+        if (samplerIndex &lt; outSamplers.size())
+        {
+            Sampler&amp; sampler = outSamplers[samplerIndex];
+            sampler.active = true;
+            sampler.textureType = GetTextureType(samplerType);
+            sampler.logicalTextureUnit = 0;
+            *outUsedRange = std::max(samplerIndex + 1, *outUsedRange);
+        }
+        else
+        {
+            return false;
+        }
+
+        samplerIndex++;
+    } while (samplerIndex &lt; startSamplerIndex + samplerCount);
+
+    return true;
+}
+
+bool ProgramD3D::indexSamplerUniform(const gl::LinkedUniform &amp;uniform, gl::InfoLog &amp;infoLog, const gl::Caps &amp;caps)
+{
+    ASSERT(gl::IsSamplerType(uniform.type));
+    ASSERT(uniform.vsRegisterIndex != GL_INVALID_INDEX || uniform.psRegisterIndex != GL_INVALID_INDEX);
+
+    if (uniform.vsRegisterIndex != GL_INVALID_INDEX)
+    {
+        if (!assignSamplers(uniform.vsRegisterIndex, uniform.type, uniform.arraySize, mSamplersVS,
+                            &amp;mUsedVertexSamplerRange))
+        {
+            infoLog.append(&quot;Vertex shader sampler count exceeds the maximum vertex texture units (%d).&quot;,
+                           mSamplersVS.size());
+            return false;
+        }
+
+        unsigned int maxVertexVectors = mRenderer-&gt;getReservedVertexUniformVectors() + caps.maxVertexUniformVectors;
+        if (uniform.vsRegisterIndex + uniform.registerCount &gt; maxVertexVectors)
+        {
+            infoLog.append(&quot;Vertex shader active uniforms exceed GL_MAX_VERTEX_UNIFORM_VECTORS (%u)&quot;,
+                           caps.maxVertexUniformVectors);
+            return false;
+        }
+    }
+
+    if (uniform.psRegisterIndex != GL_INVALID_INDEX)
+    {
+        if (!assignSamplers(uniform.psRegisterIndex, uniform.type, uniform.arraySize, mSamplersPS,
+                            &amp;mUsedPixelSamplerRange))
+        {
+            infoLog.append(&quot;Pixel shader sampler count exceeds MAX_TEXTURE_IMAGE_UNITS (%d).&quot;,
+                           mSamplersPS.size());
+            return false;
+        }
+
+        unsigned int maxFragmentVectors = mRenderer-&gt;getReservedFragmentUniformVectors() + caps.maxFragmentUniformVectors;
+        if (uniform.psRegisterIndex + uniform.registerCount &gt; maxFragmentVectors)
+        {
+            infoLog.append(&quot;Fragment shader active uniforms exceed GL_MAX_FRAGMENT_UNIFORM_VECTORS (%u)&quot;,
+                           caps.maxFragmentUniformVectors);
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool ProgramD3D::indexUniforms(gl::InfoLog &amp;infoLog, const gl::Caps &amp;caps)
+{
+    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
+    {
+        const gl::LinkedUniform &amp;uniform = *mUniforms[uniformIndex];
+
+        if (gl::IsSamplerType(uniform.type))
+        {
+            if (!indexSamplerUniform(uniform, infoLog, caps))
+            {
+                return false;
+            }
+        }
+
+        for (unsigned int arrayIndex = 0; arrayIndex &lt; uniform.elementCount(); arrayIndex++)
+        {
+            if (!uniform.isBuiltIn())
+            {
+                mUniformIndex.push_back(gl::VariableLocation(uniform.name, arrayIndex, uniformIndex));
+            }
+        }
+    }
+
+    return true;
+}
+
+void ProgramD3D::reset()
+{
+    ProgramImpl::reset();
+
+    SafeDeleteContainer(mVertexExecutables);
+    SafeDeleteContainer(mPixelExecutables);
+    SafeDelete(mGeometryExecutable);
+
+    mTransformFeedbackBufferMode = GL_NONE;
+
+    mVertexHLSL.clear();
+    mVertexWorkarounds.reset();
+    mShaderVersion = 100;
+
+    mPixelHLSL.clear();
+    mPixelWorkarounds.reset();
+    mUsesFragDepth = false;
+    mPixelShaderKey.clear();
+    mUsesPointSize = false;
+
+    SafeDelete(mVertexUniformStorage);
+    SafeDelete(mFragmentUniformStorage);
+
+    mSamplersPS.clear();
+    mSamplersVS.clear();
+
+    mUsedVertexSamplerRange = 0;
+    mUsedPixelSamplerRange = 0;
+    mDirtySamplerMapping = true;
+
+    std::fill(mAttributesByLayout, mAttributesByLayout + ArraySize(mAttributesByLayout), -1);
+}
+
+unsigned int ProgramD3D::getSerial() const
+{
+    return mSerial;
+}
+
+unsigned int ProgramD3D::issueSerial()
+{
+    return mCurrentSerial++;
+}
+
+void ProgramD3D::initAttributesByLayout()
+{
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        mAttributesByLayout[i] = i;
+    }
+
+    std::sort(&amp;mAttributesByLayout[0], &amp;mAttributesByLayout[gl::MAX_VERTEX_ATTRIBS], AttributeSorter(mSemanticIndex));
+}
+
+void ProgramD3D::sortAttributesByLayout(rx::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS],
+                                        int sortedSemanticIndices[gl::MAX_VERTEX_ATTRIBS]) const
+{
+    rx::TranslatedAttribute oldTranslatedAttributes[gl::MAX_VERTEX_ATTRIBS];
+
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        oldTranslatedAttributes[i] = attributes[i];
+    }
+
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        int oldIndex = mAttributesByLayout[i];
+        sortedSemanticIndices[i] = mSemanticIndex[oldIndex];
+        attributes[i] = oldTranslatedAttributes[oldIndex];
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dProgramD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ProgramD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,247 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// ProgramD3D.h: Defines the rx::ProgramD3D class which implements rx::ProgramImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_PROGRAMD3D_H_
+#define LIBANGLE_RENDERER_D3D_PROGRAMD3D_H_
+
+#include &quot;common/Optional.h&quot;
+#include &quot;compiler/translator/blocklayoutHLSL.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/renderer/ProgramImpl.h&quot;
+#include &quot;libANGLE/renderer/Workarounds.h&quot;
+#include &quot;libANGLE/renderer/d3d/DynamicHLSL.h&quot;
+
+#include &lt;string&gt;
+#include &lt;vector&gt;
+
+namespace gl
+{
+struct LinkedUniform;
+struct VariableLocation;
+struct VertexFormat;
+}
+
+namespace rx
+{
+class RendererD3D;
+class UniformStorageD3D;
+class ShaderExecutableD3D;
+
+#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+// WARNING: D3DCOMPILE_OPTIMIZATION_LEVEL3 may lead to a DX9 shader compiler hang.
+// It should only be used selectively to work around specific bugs.
+#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL1
+#endif
+
+class ProgramD3D : public ProgramImpl
+{
+  public:
+    ProgramD3D(RendererD3D *renderer);
+    virtual ~ProgramD3D();
+
+    const std::vector&lt;PixelShaderOutputVariable&gt; &amp;getPixelShaderKey() { return mPixelShaderKey; }
+    int getShaderVersion() const { return mShaderVersion; }
+    GLenum getTransformFeedbackBufferMode() const { return mTransformFeedbackBufferMode; }
+
+    GLint getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &amp;caps) const;
+    GLenum getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const;
+    GLint getUsedSamplerRange(gl::SamplerType type) const;
+    void updateSamplerMapping();
+    bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &amp;caps);
+
+    bool usesPointSize() const { return mUsesPointSize; }
+    bool usesPointSpriteEmulation() const;
+    bool usesGeometryShader() const;
+    bool usesInstancedPointSpriteEmulation() const;
+
+    GLenum getBinaryFormat() { return GL_PROGRAM_BINARY_ANGLE; }
+    LinkResult load(gl::InfoLog &amp;infoLog, gl::BinaryInputStream *stream);
+    gl::Error save(gl::BinaryOutputStream *stream);
+
+    gl::Error getPixelExecutableForFramebuffer(const gl::Framebuffer *fbo, ShaderExecutableD3D **outExectuable);
+    gl::Error getPixelExecutableForOutputLayout(const std::vector&lt;GLenum&gt; &amp;outputLayout, ShaderExecutableD3D **outExectuable, gl::InfoLog *infoLog);
+    gl::Error getVertexExecutableForInputLayout(const gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS], ShaderExecutableD3D **outExectuable, gl::InfoLog *infoLog);
+    ShaderExecutableD3D *getGeometryExecutable() const { return mGeometryExecutable; }
+
+    LinkResult compileProgramExecutables(gl::InfoLog &amp;infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                                         int registers);
+
+    LinkResult link(const gl::Data &amp;data, gl::InfoLog &amp;infoLog,
+                    gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                    const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings,
+                    GLenum transformFeedbackBufferMode,
+                    int *registers, std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings,
+                    std::map&lt;int, gl::VariableLocation&gt; *outputVariables);
+
+    void getInputLayoutSignature(const gl::VertexFormat inputLayout[], GLenum signature[]) const;
+
+    void initializeUniformStorage();
+    gl::Error applyUniforms();
+    gl::Error applyUniformBuffers(const gl::Data &amp;data, GLuint uniformBlockBindings[]) override;
+    bool assignUniformBlockRegister(gl::InfoLog &amp;infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
+                                    unsigned int registerIndex, const gl::Caps &amp;caps);
+    void dirtyAllUniforms();
+
+    void setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
+    void setUniform1iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform2iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform3iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform4iv(GLint location, GLsizei count, const GLint *v);
+    void setUniform1uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
+    void setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+    void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+
+    void getUniformfv(GLint location, GLfloat *params);
+    void getUniformiv(GLint location, GLint *params);
+    void getUniformuiv(GLint location, GLuint *params);
+
+    const UniformStorageD3D &amp;getVertexUniformStorage() const { return *mVertexUniformStorage; }
+    const UniformStorageD3D &amp;getFragmentUniformStorage() const { return *mFragmentUniformStorage; }
+
+    bool linkUniforms(gl::InfoLog &amp;infoLog, const gl::Shader &amp;vertexShader, const gl::Shader &amp;fragmentShader,
+                      const gl::Caps &amp;caps);
+    bool defineUniformBlock(gl::InfoLog &amp;infoLog, const gl::Shader &amp;shader, const sh::InterfaceBlock &amp;interfaceBlock, const gl::Caps &amp;caps);
+
+    void reset();
+
+    unsigned int getSerial() const;
+
+    void initAttributesByLayout();
+    void sortAttributesByLayout(rx::TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS],
+                                int sortedSemanticIndices[gl::MAX_VERTEX_ATTRIBS]) const;
+
+  private:
+    class VertexExecutable
+    {
+      public:
+        VertexExecutable(const gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS],
+                         const GLenum signature[gl::MAX_VERTEX_ATTRIBS],
+                         ShaderExecutableD3D *shaderExecutable);
+        ~VertexExecutable();
+
+        bool matchesSignature(const GLenum convertedLayout[gl::MAX_VERTEX_ATTRIBS]) const;
+
+        const gl::VertexFormat *inputs() const { return mInputs; }
+        const GLenum *signature() const { return mSignature; }
+        ShaderExecutableD3D *shaderExecutable() const { return mShaderExecutable; }
+
+      private:
+        gl::VertexFormat mInputs[gl::MAX_VERTEX_ATTRIBS];
+        GLenum mSignature[gl::MAX_VERTEX_ATTRIBS];
+        ShaderExecutableD3D *mShaderExecutable;
+    };
+
+    class PixelExecutable
+    {
+      public:
+        PixelExecutable(const std::vector&lt;GLenum&gt; &amp;outputSignature, ShaderExecutableD3D *shaderExecutable);
+        ~PixelExecutable();
+
+        bool matchesSignature(const std::vector&lt;GLenum&gt; &amp;signature) const { return mOutputSignature == signature; }
+
+        const std::vector&lt;GLenum&gt; &amp;outputSignature() const { return mOutputSignature; }
+        ShaderExecutableD3D *shaderExecutable() const { return mShaderExecutable; }
+
+      private:
+        std::vector&lt;GLenum&gt; mOutputSignature;
+        ShaderExecutableD3D *mShaderExecutable;
+    };
+
+    struct Sampler
+    {
+        Sampler();
+
+        bool active;
+        GLint logicalTextureUnit;
+        GLenum textureType;
+    };
+
+    void defineUniformBase(const ShaderD3D *shader, const sh::Uniform &amp;uniform, unsigned int uniformRegister);
+    void defineUniform(const ShaderD3D *shader, const sh::ShaderVariable &amp;uniform, const std::string &amp;fullName,
+                       sh::HLSLBlockEncoder *encoder);
+    bool indexSamplerUniform(const gl::LinkedUniform &amp;uniform, gl::InfoLog &amp;infoLog, const gl::Caps &amp;caps);
+    bool indexUniforms(gl::InfoLog &amp;infoLog, const gl::Caps &amp;caps);
+    static bool assignSamplers(unsigned int startSamplerIndex, GLenum samplerType, unsigned int samplerCount,
+                               std::vector&lt;Sampler&gt; &amp;outSamplers, GLuint *outUsedRange);
+
+    template &lt;typename T&gt;
+    void setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType);
+
+    template &lt;int cols, int rows&gt;
+    void setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType);
+
+    template &lt;typename T&gt;
+    void getUniformv(GLint location, T *params, GLenum uniformType);
+
+    template &lt;typename VarT&gt;
+    void defineUniformBlockMembers(const std::vector&lt;VarT&gt; &amp;fields, const std::string &amp;prefix, int blockIndex,
+                                   sh::BlockLayoutEncoder *encoder, std::vector&lt;unsigned int&gt; *blockUniformIndexes,
+                                   bool inRowMajorLayout);
+
+    RendererD3D *mRenderer;
+    DynamicHLSL *mDynamicHLSL;
+
+    std::vector&lt;VertexExecutable *&gt; mVertexExecutables;
+    std::vector&lt;PixelExecutable *&gt; mPixelExecutables;
+    ShaderExecutableD3D *mGeometryExecutable;
+
+    std::string mVertexHLSL;
+    D3DCompilerWorkarounds mVertexWorkarounds;
+
+    std::string mPixelHLSL;
+    D3DCompilerWorkarounds mPixelWorkarounds;
+    bool mUsesFragDepth;
+    std::vector&lt;PixelShaderOutputVariable&gt; mPixelShaderKey;
+
+    bool mUsesPointSize;
+
+    UniformStorageD3D *mVertexUniformStorage;
+    UniformStorageD3D *mFragmentUniformStorage;
+
+    GLenum mTransformFeedbackBufferMode;
+
+    std::vector&lt;Sampler&gt; mSamplersPS;
+    std::vector&lt;Sampler&gt; mSamplersVS;
+    GLuint mUsedVertexSamplerRange;
+    GLuint mUsedPixelSamplerRange;
+    bool mDirtySamplerMapping;
+
+    // Cache for validateSamplers
+    std::vector&lt;GLenum&gt; mTextureUnitTypesCache;
+
+    // Cache for getPixelExecutableForFramebuffer
+    std::vector&lt;GLenum&gt; mPixelShaderOutputFormatCache;
+
+    int mShaderVersion;
+
+    int mAttributesByLayout[gl::MAX_VERTEX_ATTRIBS];
+
+    unsigned int mSerial;
+
+    Optional&lt;bool&gt; mCachedValidateSamplersResult;
+
+    static unsigned int issueSerial();
+    static unsigned int mCurrentSerial;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_PROGRAMD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderTargetD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+//
+// Copyright (c) 2012-2015 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.
+//
+
+// RenderTargetD3D.cpp: Implements serial handling for rx::RenderTargetD3D
+
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+
+namespace rx
+{
+unsigned int RenderTargetD3D::mCurrentSerial = 1;
+
+RenderTargetD3D::RenderTargetD3D()
+    : mSerial(issueSerials(1))
+{
+}
+
+RenderTargetD3D::~RenderTargetD3D()
+{
+}
+
+unsigned int RenderTargetD3D::getSerial() const
+{
+    return mSerial;
+}
+
+unsigned int RenderTargetD3D::issueSerials(unsigned int count)
+{
+    unsigned int firstSerial = mCurrentSerial;
+    mCurrentSerial += count;
+    return firstSerial;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderTargetD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderTargetD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+//
+// Copyright (c) 2012-2015 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.
+//
+
+// RenderTargetD3D.h: Defines an abstract wrapper class to manage IDirect3DSurface9
+// and ID3D11View objects belonging to renderbuffers and renderable textures.
+
+#ifndef LIBANGLE_RENDERER_D3D_RENDERTARGETD3D_H_
+#define LIBANGLE_RENDERER_D3D_RENDERTARGETD3D_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+namespace rx
+{
+
+class RenderTargetD3D : public FramebufferAttachmentRenderTarget
+{
+  public:
+    RenderTargetD3D();
+    virtual ~RenderTargetD3D();
+
+    virtual GLsizei getWidth() const = 0;
+    virtual GLsizei getHeight() const = 0;
+    virtual GLsizei getDepth() const = 0;
+    virtual GLenum getInternalFormat() const = 0;
+    virtual GLsizei getSamples() const = 0;
+    gl::Extents getExtents() const { return gl::Extents(getWidth(), getHeight(), getDepth()); }
+
+    virtual unsigned int getSerial() const;
+    static unsigned int issueSerials(unsigned int count);
+
+  private:
+    const unsigned int mSerial;
+    static unsigned int mCurrentSerial;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_RENDERTARGETD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderbufferD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// RenderbufferD3d.cpp: Implements the RenderbufferD3D class, a specialization of RenderbufferImpl
+
+
+#include &quot;libANGLE/renderer/d3d/RenderbufferD3D.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+
+namespace rx
+{
+RenderbufferD3D::RenderbufferD3D(RendererD3D *renderer) : mRenderer(renderer)
+{
+    mRenderTarget = NULL;
+}
+
+RenderbufferD3D::~RenderbufferD3D()
+{
+    SafeDelete(mRenderTarget);
+}
+
+gl::Error RenderbufferD3D::setStorage(GLenum internalformat, size_t width, size_t height)
+{
+    return setStorageMultisample(0, internalformat, width, height);
+}
+
+gl::Error RenderbufferD3D::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height)
+{
+    // If the renderbuffer parameters are queried, the calling function
+    // will expect one of the valid renderbuffer formats for use in
+    // glRenderbufferStorage, but we should create depth and stencil buffers
+    // as DEPTH24_STENCIL8
+    GLenum creationFormat = internalformat;
+    if (internalformat == GL_DEPTH_COMPONENT16 || internalformat == GL_STENCIL_INDEX8)
+    {
+        creationFormat = GL_DEPTH24_STENCIL8_OES;
+    }
+
+    // ANGLE_framebuffer_multisample states GL_OUT_OF_MEMORY is generated on a failure to create
+    // the specified storage.
+    // Because ES 3.0 already knows the exact number of supported samples, it would already have been
+    // validated and generated GL_INVALID_VALUE.
+    const gl::TextureCaps &amp;formatCaps = mRenderer-&gt;getRendererTextureCaps().get(creationFormat);
+    if (samples &gt; formatCaps.getMaxSamples())
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Renderbuffer format does not support %u samples, %u is the maximum.&quot;,
+                         samples, formatCaps.getMaxSamples());
+    }
+
+    RenderTargetD3D *newRT = NULL;
+    gl::Error error = mRenderer-&gt;createRenderTarget(width, height, creationFormat, samples, &amp;newRT);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    SafeDelete(mRenderTarget);
+    mRenderTarget = newRT;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+RenderTargetD3D *RenderbufferD3D::getRenderTarget()
+{
+    return mRenderTarget;
+}
+
+unsigned int RenderbufferD3D::getRenderTargetSerial() const
+{
+    return (mRenderTarget ? mRenderTarget-&gt;getSerial() : 0);
+}
+
+gl::Error RenderbufferD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                                     FramebufferAttachmentRenderTarget **rtOut)
+{
+    *rtOut = mRenderTarget;
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRenderbufferD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RenderbufferD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// RenderbufferD3d.h: Defines the RenderbufferD3D class which implements RenderbufferImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_RENDERBUFFERD3D_H_
+#define LIBANGLE_RENDERER_D3D_RENDERBUFFERD3D_H_
+
+#include &quot;angle_gl.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/renderer/RenderbufferImpl.h&quot;
+
+namespace rx
+{
+class RendererD3D;
+class RenderTargetD3D;
+class SwapChainD3D;
+
+class RenderbufferD3D : public RenderbufferImpl
+{
+  public:
+    RenderbufferD3D(RendererD3D *renderer);
+    virtual ~RenderbufferD3D();
+
+    virtual gl::Error setStorage(GLenum internalformat, size_t width, size_t height) override;
+    virtual gl::Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) override;
+
+    RenderTargetD3D *getRenderTarget();
+    unsigned int getRenderTargetSerial() const;
+
+    gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                        FramebufferAttachmentRenderTarget **rtOut) override;
+
+  private:
+    RendererD3D *mRenderer;
+    RenderTargetD3D *mRenderTarget;
+};
+}
+
+#endif // LIBANGLE_RENDERER_D3D_RENDERBUFFERD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRendererD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,621 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// RendererD3D.cpp: Implementation of the base D3D Renderer.
+
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+
+#include &quot;common/MemoryBuffer.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/ResourceManager.h&quot;
+#include &quot;libANGLE/State.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/DisplayD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/IndexDataManager.h&quot;
+
+namespace rx
+{
+
+namespace
+{
+// If we request a scratch buffer requesting a smaller size this many times,
+// release and recreate the scratch buffer. This ensures we don't have a
+// degenerate case where we are stuck hogging memory.
+const int ScratchMemoryBufferLifetime = 1000;
+}
+
+RendererD3D::RendererD3D(egl::Display *display)
+    : mDisplay(display),
+      mDeviceLost(false),
+      mScratchMemoryBufferResetCounter(0)
+{
+}
+
+RendererD3D::~RendererD3D()
+{
+    cleanup();
+}
+
+void RendererD3D::cleanup()
+{
+    mScratchMemoryBuffer.resize(0);
+    for (auto &amp;incompleteTexture : mIncompleteTextures)
+    {
+        incompleteTexture.second.set(NULL);
+    }
+    mIncompleteTextures.clear();
+}
+
+gl::Error RendererD3D::drawElements(const gl::Data &amp;data,
+                                    GLenum mode, GLsizei count, GLenum type,
+                                    const GLvoid *indices, GLsizei instances,
+                                    const RangeUI &amp;indexRange)
+{
+    if (data.state-&gt;isPrimitiveRestartEnabled())
+    {
+        UNIMPLEMENTED();
+        return gl::Error(GL_INVALID_OPERATION, &quot;Primitive restart not implemented&quot;);
+    }
+
+    gl::Program *program = data.state-&gt;getProgram();
+    ASSERT(program != NULL);
+
+    program-&gt;updateSamplerMapping();
+
+    gl::Error error = generateSwizzles(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!applyPrimitiveType(mode, count, program-&gt;usesPointSize()))
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    error = applyRenderTarget(data, mode, false);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = applyState(data, mode);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    gl::VertexArray *vao = data.state-&gt;getVertexArray();
+    TranslatedIndexData indexInfo;
+    indexInfo.indexRange = indexRange;
+    error = applyIndexBuffer(indices, vao-&gt;getElementArrayBuffer(), count, mode, type, &amp;indexInfo);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    applyTransformFeedbackBuffers(*data.state);
+    // Transform feedback is not allowed for DrawElements, this error should have been caught at the API validation
+    // layer.
+    ASSERT(!data.state-&gt;isTransformFeedbackActiveUnpaused());
+
+    GLsizei vertexCount = indexInfo.indexRange.length() + 1;
+    error = applyVertexBuffer(*data.state, mode, indexInfo.indexRange.start, vertexCount, instances);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = applyShaders(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = applyTextures(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = program-&gt;applyUniformBuffers(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!skipDraw(data, mode))
+    {
+        error = drawElements(mode, count, type, indices, vao-&gt;getElementArrayBuffer(), indexInfo, instances);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RendererD3D::drawArrays(const gl::Data &amp;data,
+                                  GLenum mode, GLint first,
+                                  GLsizei count, GLsizei instances)
+{
+    gl::Program *program = data.state-&gt;getProgram();
+    ASSERT(program != NULL);
+
+    program-&gt;updateSamplerMapping();
+
+    gl::Error error = generateSwizzles(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!applyPrimitiveType(mode, count, program-&gt;usesPointSize()))
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    error = applyRenderTarget(data, mode, false);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = applyState(data, mode);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    applyTransformFeedbackBuffers(*data.state);
+
+    error = applyVertexBuffer(*data.state, mode, first, count, instances);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = applyShaders(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = applyTextures(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = program-&gt;applyUniformBuffers(data);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!skipDraw(data, mode))
+    {
+        error = drawArrays(data, mode, count, instances, program-&gt;usesPointSize());
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (data.state-&gt;isTransformFeedbackActiveUnpaused())
+        {
+            markTransformFeedbackUsage(data);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RendererD3D::generateSwizzles(const gl::Data &amp;data, gl::SamplerType type)
+{
+    gl::Program *program = data.state-&gt;getProgram();
+
+    size_t samplerRange = program-&gt;getUsedSamplerRange(type);
+
+    for (size_t i = 0; i &lt; samplerRange; i++)
+    {
+        GLenum textureType = program-&gt;getSamplerTextureType(type, i);
+        GLint textureUnit = program-&gt;getSamplerMapping(type, i, *data.caps);
+        if (textureUnit != -1)
+        {
+            gl::Texture *texture = data.state-&gt;getSamplerTexture(textureUnit, textureType);
+            ASSERT(texture);
+            if (texture-&gt;getSamplerState().swizzleRequired())
+            {
+                gl::Error error = generateSwizzle(texture);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RendererD3D::generateSwizzles(const gl::Data &amp;data)
+{
+    gl::Error error = generateSwizzles(data, gl::SAMPLER_VERTEX);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = generateSwizzles(data, gl::SAMPLER_PIXEL);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+// Applies the render target surface, depth stencil surface, viewport rectangle and
+// scissor rectangle to the renderer
+gl::Error RendererD3D::applyRenderTarget(const gl::Data &amp;data, GLenum drawMode, bool ignoreViewport)
+{
+    const gl::Framebuffer *framebufferObject = data.state-&gt;getDrawFramebuffer();
+    ASSERT(framebufferObject &amp;&amp; framebufferObject-&gt;checkStatus(data) == GL_FRAMEBUFFER_COMPLETE);
+
+    gl::Error error = applyRenderTarget(framebufferObject);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    float nearZ = data.state-&gt;getNearPlane();
+    float farZ = data.state-&gt;getFarPlane();
+    setViewport(data.state-&gt;getViewport(), nearZ, farZ, drawMode,
+                data.state-&gt;getRasterizerState().frontFace, ignoreViewport);
+
+    setScissorRectangle(data.state-&gt;getScissor(), data.state-&gt;isScissorTestEnabled());
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+// Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D device
+gl::Error RendererD3D::applyState(const gl::Data &amp;data, GLenum drawMode)
+{
+    const gl::Framebuffer *framebufferObject = data.state-&gt;getDrawFramebuffer();
+    int samples = framebufferObject-&gt;getSamples(data);
+
+    gl::RasterizerState rasterizer = data.state-&gt;getRasterizerState();
+    rasterizer.pointDrawMode = (drawMode == GL_POINTS);
+    rasterizer.multiSample = (samples != 0);
+
+    gl::Error error = setRasterizerState(rasterizer);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    unsigned int mask = 0;
+    if (data.state-&gt;isSampleCoverageEnabled())
+    {
+        GLclampf coverageValue = data.state-&gt;getSampleCoverageValue();
+        if (coverageValue != 0)
+        {
+            float threshold = 0.5f;
+
+            for (int i = 0; i &lt; samples; ++i)
+            {
+                mask &lt;&lt;= 1;
+
+                if ((i + 1) * coverageValue &gt;= threshold)
+                {
+                    threshold += 1.0f;
+                    mask |= 1;
+                }
+            }
+        }
+
+        bool coverageInvert = data.state-&gt;getSampleCoverageInvert();
+        if (coverageInvert)
+        {
+            mask = ~mask;
+        }
+    }
+    else
+    {
+        mask = 0xFFFFFFFF;
+    }
+    error = setBlendState(framebufferObject, data.state-&gt;getBlendState(), data.state-&gt;getBlendColor(), mask);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = setDepthStencilState(data.state-&gt;getDepthStencilState(), data.state-&gt;getStencilRef(),
+                                 data.state-&gt;getStencilBackRef(), rasterizer.frontFace == GL_CCW);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+// Applies the shaders and shader constants to the Direct3D device
+gl::Error RendererD3D::applyShaders(const gl::Data &amp;data)
+{
+    gl::Program *program = data.state-&gt;getProgram();
+
+    gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS];
+    gl::VertexFormat::GetInputLayout(inputLayout, program, *data.state);
+
+    const gl::Framebuffer *fbo = data.state-&gt;getDrawFramebuffer();
+
+    gl::Error error = applyShaders(program, inputLayout, fbo, data.state-&gt;getRasterizerState().rasterizerDiscard, data.state-&gt;isTransformFeedbackActiveUnpaused());
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return program-&gt;applyUniforms();
+}
+
+// For each Direct3D 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).
+gl::Error RendererD3D::applyTextures(const gl::Data &amp;data, gl::SamplerType shaderType,
+                                     const FramebufferTextureSerialArray &amp;framebufferSerials, size_t framebufferSerialCount)
+{
+    gl::Program *program = data.state-&gt;getProgram();
+
+    size_t samplerRange = program-&gt;getUsedSamplerRange(shaderType);
+    for (size_t samplerIndex = 0; samplerIndex &lt; samplerRange; samplerIndex++)
+    {
+        GLenum textureType = program-&gt;getSamplerTextureType(shaderType, samplerIndex);
+        GLint textureUnit = program-&gt;getSamplerMapping(shaderType, samplerIndex, *data.caps);
+        if (textureUnit != -1)
+        {
+            gl::Texture *texture = data.state-&gt;getSamplerTexture(textureUnit, textureType);
+            ASSERT(texture);
+            gl::SamplerState sampler = texture-&gt;getSamplerState();
+
+            gl::Sampler *samplerObject = data.state-&gt;getSampler(textureUnit);
+            if (samplerObject)
+            {
+                samplerObject-&gt;getState(&amp;sampler);
+            }
+
+            // TODO: std::binary_search may become unavailable using older versions of GCC
+            if (texture-&gt;isSamplerComplete(sampler, data) &amp;&amp;
+                !std::binary_search(framebufferSerials.begin(), framebufferSerials.begin() + framebufferSerialCount, texture-&gt;getTextureSerial()))
+            {
+                gl::Error error = setSamplerState(shaderType, samplerIndex, texture, sampler);
+                if (error.isError())
+                {
+                    return error;
+                }
+
+                error = setTexture(shaderType, samplerIndex, texture);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+            else
+            {
+                // Texture is not sampler complete or it is in use by the framebuffer.  Bind the incomplete texture.
+                gl::Texture *incompleteTexture = getIncompleteTexture(textureType);
+                gl::Error error = setTexture(shaderType, samplerIndex, incompleteTexture);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+        else
+        {
+            // No texture bound to this slot even though it is used by the shader, bind a NULL texture
+            gl::Error error = setTexture(shaderType, samplerIndex, NULL);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    // Set all the remaining textures to NULL
+    size_t samplerCount = (shaderType == gl::SAMPLER_PIXEL) ? data.caps-&gt;maxTextureImageUnits
+                                                            : data.caps-&gt;maxVertexTextureImageUnits;
+    for (size_t samplerIndex = samplerRange; samplerIndex &lt; samplerCount; samplerIndex++)
+    {
+        gl::Error error = setTexture(shaderType, samplerIndex, NULL);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RendererD3D::applyTextures(const gl::Data &amp;data)
+{
+    FramebufferTextureSerialArray framebufferSerials;
+    size_t framebufferSerialCount = getBoundFramebufferTextureSerials(data, &amp;framebufferSerials);
+
+    gl::Error error = applyTextures(data, gl::SAMPLER_VERTEX, framebufferSerials, framebufferSerialCount);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = applyTextures(data, gl::SAMPLER_PIXEL, framebufferSerials, framebufferSerialCount);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool RendererD3D::skipDraw(const gl::Data &amp;data, GLenum drawMode)
+{
+    if (drawMode == GL_POINTS)
+    {
+        // ProgramBinary assumes non-point rendering if gl_PointSize isn't written,
+        // which affects varying interpolation. Since the value of gl_PointSize is
+        // undefined when not written, just skip drawing to avoid unexpected results.
+        if (!data.state-&gt;getProgram()-&gt;usesPointSize() &amp;&amp; !data.state-&gt;isTransformFeedbackActiveUnpaused())
+        {
+            // This is stictly speaking not an error, but developers should be
+            // notified of risking undefined behavior.
+            ERR(&quot;Point rendering without writing to gl_PointSize.&quot;);
+
+            return true;
+        }
+    }
+    else if (gl::IsTriangleMode(drawMode))
+    {
+        if (data.state-&gt;getRasterizerState().cullFace &amp;&amp; data.state-&gt;getRasterizerState().cullMode == GL_FRONT_AND_BACK)
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+void RendererD3D::markTransformFeedbackUsage(const gl::Data &amp;data)
+{
+    const gl::TransformFeedback *transformFeedback = data.state-&gt;getCurrentTransformFeedback();
+    for (size_t i = 0; i &lt; transformFeedback-&gt;getIndexedBufferCount(); i++)
+    {
+        const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding = transformFeedback-&gt;getIndexedBuffer(i);
+        if (binding.get() != nullptr)
+        {
+            BufferD3D *bufferD3D = GetImplAs&lt;BufferD3D&gt;(binding.get());
+            bufferD3D-&gt;markTransformFeedbackUsage();
+        }
+    }
+}
+
+size_t RendererD3D::getBoundFramebufferTextureSerials(const gl::Data &amp;data,
+                                                      FramebufferTextureSerialArray *outSerialArray)
+{
+    size_t serialCount = 0;
+
+    const gl::Framebuffer *drawFramebuffer = data.state-&gt;getDrawFramebuffer();
+    for (unsigned int i = 0; i &lt; data.caps-&gt;maxColorAttachments; i++)
+    {
+        const gl::FramebufferAttachment *attachment = drawFramebuffer-&gt;getColorbuffer(i);
+        if (attachment &amp;&amp; attachment-&gt;type() == GL_TEXTURE)
+        {
+            gl::Texture *texture = attachment-&gt;getTexture();
+            (*outSerialArray)[serialCount++] = texture-&gt;getTextureSerial();
+        }
+    }
+
+    const gl::FramebufferAttachment *depthStencilAttachment = drawFramebuffer-&gt;getDepthOrStencilbuffer();
+    if (depthStencilAttachment &amp;&amp; depthStencilAttachment-&gt;type() == GL_TEXTURE)
+    {
+        gl::Texture *depthStencilTexture = depthStencilAttachment-&gt;getTexture();
+        (*outSerialArray)[serialCount++] = depthStencilTexture-&gt;getTextureSerial();
+    }
+
+    std::sort(outSerialArray-&gt;begin(), outSerialArray-&gt;begin() + serialCount);
+
+    return serialCount;
+}
+
+gl::Texture *RendererD3D::getIncompleteTexture(GLenum type)
+{
+    if (mIncompleteTextures.find(type) == mIncompleteTextures.end())
+    {
+        const GLubyte color[] = { 0, 0, 0, 255 };
+        const gl::Extents colorSize(1, 1, 1);
+        const gl::PixelUnpackState incompleteUnpackState(1, 0);
+
+        gl::Texture* t = new gl::Texture(createTexture(type), gl::Texture::INCOMPLETE_TEXTURE_ID, type);
+
+        if (type == GL_TEXTURE_CUBE_MAP)
+        {
+            for (GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face &lt;= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; face++)
+            {
+                t-&gt;setImage(face, 0, GL_RGBA, colorSize, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+            }
+        }
+        else
+        {
+            t-&gt;setImage(type, 0, GL_RGBA, colorSize, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
+        }
+
+        mIncompleteTextures[type].set(t);
+    }
+
+    return mIncompleteTextures[type].get();
+}
+
+bool RendererD3D::isDeviceLost() const
+{
+    return mDeviceLost;
+}
+
+void RendererD3D::notifyDeviceLost()
+{
+    mDeviceLost = true;
+    mDisplay-&gt;notifyDeviceLost();
+}
+
+std::string RendererD3D::getVendorString() const
+{
+    LUID adapterLuid = { 0 };
+
+    if (getLUID(&amp;adapterLuid))
+    {
+        char adapterLuidString[64];
+        sprintf_s(adapterLuidString, sizeof(adapterLuidString), &quot;(adapter LUID: %08x%08x)&quot;, adapterLuid.HighPart, adapterLuid.LowPart);
+        return std::string(adapterLuidString);
+    }
+
+    return std::string(&quot;&quot;);
+}
+
+gl::Error RendererD3D::getScratchMemoryBuffer(size_t requestedSize, MemoryBuffer **bufferOut)
+{
+    if (mScratchMemoryBuffer.size() == requestedSize)
+    {
+        mScratchMemoryBufferResetCounter = ScratchMemoryBufferLifetime;
+        *bufferOut = &amp;mScratchMemoryBuffer;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    if (mScratchMemoryBuffer.size() &gt; requestedSize)
+    {
+        mScratchMemoryBufferResetCounter--;
+    }
+
+    if (mScratchMemoryBufferResetCounter &lt;= 0 || mScratchMemoryBuffer.size() &lt; requestedSize)
+    {
+        mScratchMemoryBuffer.resize(0);
+        if (!mScratchMemoryBuffer.resize(requestedSize))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal buffer.&quot;);
+        }
+        mScratchMemoryBufferResetCounter = ScratchMemoryBufferLifetime;
+    }
+
+    ASSERT(mScratchMemoryBuffer.size() &gt;= requestedSize);
+
+    *bufferOut = &amp;mScratchMemoryBuffer;
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dRendererD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/RendererD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,241 @@
</span><ins>+
+// Copyright (c) 2014 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.
+//
+
+// RendererD3D.h: Defines a back-end specific class for the DirectX renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
+#define LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
+
+#include &quot;common/MemoryBuffer.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+#include &quot;libANGLE/renderer/d3d/formatutilsD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+
+//FIXME(jmadill): std::array is currently prohibited by Chromium style guide
+#include &lt;array&gt;
+
+namespace egl
+{
+class ConfigSet;
+}
+
+namespace gl
+{
+class InfoLog;
+struct LinkedVarying;
+class Texture;
+}
+
+namespace rx
+{
+class ImageD3D;
+class IndexBuffer;
+class RenderTargetD3D;
+class ShaderExecutableD3D;
+class SwapChainD3D;
+class TextureStorage;
+class UniformStorageD3D;
+class VertexBuffer;
+
+enum ShaderType
+{
+    SHADER_VERTEX,
+    SHADER_PIXEL,
+    SHADER_GEOMETRY
+};
+
+enum RendererClass
+{
+    RENDERER_D3D11,
+    RENDERER_D3D9
+};
+
+// Useful for unit testing
+class BufferFactoryD3D
+{
+  public:
+    BufferFactoryD3D() {}
+    virtual ~BufferFactoryD3D() {}
+
+    virtual VertexBuffer *createVertexBuffer() = 0;
+    virtual IndexBuffer *createIndexBuffer() = 0;
+
+    // TODO(jmadill): add VertexFormatCaps
+    virtual VertexConversionType getVertexConversionType(const gl::VertexFormat &amp;vertexFormat) const = 0;
+    virtual GLenum getVertexComponentType(const gl::VertexFormat &amp;vertexFormat) const = 0;
+};
+
+class RendererD3D : public Renderer, public BufferFactoryD3D
+{
+  public:
+    explicit RendererD3D(egl::Display *display);
+    virtual ~RendererD3D();
+
+    virtual egl::Error initialize() = 0;
+
+    virtual egl::ConfigSet generateConfigs() const = 0;
+
+    gl::Error drawArrays(const gl::Data &amp;data,
+                         GLenum mode, GLint first,
+                         GLsizei count, GLsizei instances) override;
+
+    gl::Error drawElements(const gl::Data &amp;data,
+                           GLenum mode, GLsizei count, GLenum type,
+                           const GLvoid *indices, GLsizei instances,
+                           const RangeUI &amp;indexRange) override;
+
+    bool isDeviceLost() const override;
+    std::string getVendorString() const override;
+
+    virtual int getMinorShaderModel() const = 0;
+    virtual std::string getShaderModelSuffix() const = 0;
+
+    // Direct3D Specific methods
+    virtual GUID getAdapterIdentifier() const = 0;
+
+    virtual bool shouldCreateChildWindowForSurface(EGLNativeWindowType window) const = 0;
+    virtual SwapChainD3D *createSwapChain(NativeWindow nativeWindow, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat) = 0;
+
+    virtual gl::Error generateSwizzle(gl::Texture *texture) = 0;
+    virtual gl::Error setSamplerState(gl::SamplerType type, int index, gl::Texture *texture, const gl::SamplerState &amp;sampler) = 0;
+    virtual gl::Error setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
+
+    virtual gl::Error setUniformBuffers(const gl::Data &amp;data,
+                                        const GLint vertexUniformBuffers[],
+                                        const GLint fragmentUniformBuffers[]) = 0;
+
+    virtual gl::Error setRasterizerState(const gl::RasterizerState &amp;rasterState) = 0;
+    virtual gl::Error setBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &amp;blendState, const gl::ColorF &amp;blendColor,
+                                    unsigned int sampleMask) = 0;
+    virtual gl::Error setDepthStencilState(const gl::DepthStencilState &amp;depthStencilState, int stencilRef,
+                                           int stencilBackRef, bool frontFaceCCW) = 0;
+
+    virtual void setScissorRectangle(const gl::Rectangle &amp;scissor, bool enabled) = 0;
+    virtual void setViewport(const gl::Rectangle &amp;viewport, float zNear, float zFar, GLenum drawMode, GLenum frontFace,
+                             bool ignoreViewport) = 0;
+
+    virtual gl::Error applyRenderTarget(const gl::Framebuffer *frameBuffer) = 0;
+    virtual gl::Error applyShaders(gl::Program *program, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
+                                   bool rasterizerDiscard, bool transformFeedbackActive) = 0;
+    virtual gl::Error applyUniforms(const ProgramImpl &amp;program, const std::vector&lt;gl::LinkedUniform*&gt; &amp;uniformArray) = 0;
+    virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount, bool usesPointSize) = 0;
+    virtual gl::Error applyVertexBuffer(const gl::State &amp;state, GLenum mode, GLint first, GLsizei count, GLsizei instances) = 0;
+    virtual gl::Error applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo) = 0;
+    virtual void applyTransformFeedbackBuffers(const gl::State&amp; state) = 0;
+
+    virtual void markAllStateDirty() = 0;
+
+    virtual unsigned int getReservedVertexUniformVectors() const = 0;
+    virtual unsigned int getReservedFragmentUniformVectors() const = 0;
+    virtual unsigned int getReservedVertexUniformBuffers() const = 0;
+    virtual unsigned int getReservedFragmentUniformBuffers() const = 0;
+    virtual bool getShareHandleSupport() const = 0;
+    virtual bool getPostSubBufferSupport() const = 0;
+
+    virtual int getMajorShaderModel() const = 0;
+
+    // Pixel operations
+    virtual gl::Error copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                 const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level) = 0;
+    virtual gl::Error copyImageCube(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                    const gl::Offset &amp;destOffset, TextureStorage *storage, GLenum target, GLint level) = 0;
+    virtual gl::Error copyImage3D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                  const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level) = 0;
+    virtual gl::Error copyImage2DArray(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                       const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level) = 0;
+
+    // RenderTarget creation
+    virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT) = 0;
+
+    // Shader operations
+    virtual gl::Error loadExecutable(const void *function, size_t length, ShaderType type,
+                                     const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                     bool separatedOutputBuffers, ShaderExecutableD3D **outExecutable) = 0;
+    virtual gl::Error compileToExecutable(gl::InfoLog &amp;infoLog, const std::string &amp;shaderHLSL, ShaderType type,
+                                          const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                          bool separatedOutputBuffers, const D3DCompilerWorkarounds &amp;workarounds,
+                                          ShaderExecutableD3D **outExectuable) = 0;
+    virtual UniformStorageD3D *createUniformStorage(size_t storageSize) = 0;
+
+    // Image operations
+    virtual ImageD3D *createImage() = 0;
+    virtual gl::Error generateMipmap(ImageD3D *dest, ImageD3D *source) = 0;
+    virtual gl::Error generateMipmapsUsingD3D(TextureStorage *storage, const gl::SamplerState &amp;samplerState) = 0;
+    virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain) = 0;
+    virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly) = 0;
+    virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly) = 0;
+    virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
+    virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels) = 0;
+
+    // Buffer-to-texture and Texture-to-buffer copies
+    virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const = 0;
+    virtual gl::Error fastCopyBufferToTexture(const gl::PixelUnpackState &amp;unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+                                              GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &amp;destArea) = 0;
+
+    // Device lost
+    void notifyDeviceLost() override;
+    virtual bool resetDevice() = 0;
+    virtual RendererClass getRendererClass() const = 0;
+    virtual void *getD3DDevice() = 0;
+
+    gl::Error getScratchMemoryBuffer(size_t requestedSize, MemoryBuffer **bufferOut);
+
+  protected:
+    virtual gl::Error drawArrays(const gl::Data &amp;data, GLenum mode, GLsizei count, GLsizei instances, bool usesPointSize) = 0;
+    virtual gl::Error drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+                                   gl::Buffer *elementArrayBuffer, const TranslatedIndexData &amp;indexInfo, GLsizei instances) = 0;
+
+    virtual bool getLUID(LUID *adapterLuid) const = 0;
+
+    void cleanup();
+
+    egl::Display *mDisplay;
+    bool mDeviceLost;
+
+  private:
+    //FIXME(jmadill): std::array is currently prohibited by Chromium style guide
+    typedef std::array&lt;unsigned int, gl::IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS&gt; FramebufferTextureSerialArray;
+
+    gl::Error generateSwizzles(const gl::Data &amp;data, gl::SamplerType type);
+    gl::Error generateSwizzles(const gl::Data &amp;data);
+
+    gl::Error applyRenderTarget(const gl::Data &amp;data, GLenum drawMode, bool ignoreViewport);
+    gl::Error applyState(const gl::Data &amp;data, GLenum drawMode);
+    gl::Error applyShaders(const gl::Data &amp;data);
+    gl::Error applyTextures(const gl::Data &amp;data, gl::SamplerType shaderType,
+                            const FramebufferTextureSerialArray &amp;framebufferSerials, size_t framebufferSerialCount);
+    gl::Error applyTextures(const gl::Data &amp;data);
+
+    bool skipDraw(const gl::Data &amp;data, GLenum drawMode);
+    void markTransformFeedbackUsage(const gl::Data &amp;data);
+
+    size_t getBoundFramebufferTextureSerials(const gl::Data &amp;data,
+                                             FramebufferTextureSerialArray *outSerialArray);
+    gl::Texture *getIncompleteTexture(GLenum type);
+
+    gl::TextureMap mIncompleteTextures;
+    MemoryBuffer mScratchMemoryBuffer;
+    unsigned int mScratchMemoryBufferResetCounter;
+};
+
+struct dx_VertexConstants
+{
+    float depthRange[4];
+    float viewAdjust[4];
+    float viewCoords[4];
+};
+
+struct dx_PixelConstants
+{
+    float depthRange[4];
+    float viewCoords[4];
+    float depthFront[4];
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_RENDERERD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,376 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// ShaderD3D.cpp: Defines the rx::ShaderD3D class which implements rx::ShaderImpl.
+
+#include &quot;libANGLE/Shader.h&quot;
+#include &quot;libANGLE/Compiler.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/ShaderD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/CompilerD3D.h&quot;
+#include &quot;libANGLE/features.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+// Definitions local to the translation unit
+namespace
+{
+
+const char *GetShaderTypeString(GLenum type)
+{
+    switch (type)
+    {
+      case GL_VERTEX_SHADER:
+        return &quot;VERTEX&quot;;
+
+      case GL_FRAGMENT_SHADER:
+        return &quot;FRAGMENT&quot;;
+
+      default:
+        UNREACHABLE();
+        return &quot;&quot;;
+    }
+}
+
+}
+
+namespace rx
+{
+
+template &lt;typename VarT&gt;
+void FilterInactiveVariables(std::vector&lt;VarT&gt; *variableList)
+{
+    ASSERT(variableList);
+
+    for (size_t varIndex = 0; varIndex &lt; variableList-&gt;size();)
+    {
+        if (!(*variableList)[varIndex].staticUse)
+        {
+            variableList-&gt;erase(variableList-&gt;begin() + varIndex);
+        }
+        else
+        {
+            varIndex++;
+        }
+    }
+}
+
+template &lt;typename VarT&gt;
+const std::vector&lt;VarT&gt; *GetShaderVariables(const std::vector&lt;VarT&gt; *variableList)
+{
+    ASSERT(variableList);
+    return variableList;
+}
+
+ShaderD3D::ShaderD3D(GLenum type)
+    : mShaderType(type),
+      mShaderVersion(100)
+{
+    uncompile();
+}
+
+ShaderD3D::~ShaderD3D()
+{
+}
+
+std::string ShaderD3D::getDebugInfo() const
+{
+    return mDebugInfo + std::string(&quot;\n// &quot;) + GetShaderTypeString(mShaderType) + &quot; SHADER END\n&quot;;
+}
+
+
+void ShaderD3D::parseVaryings(ShHandle compiler)
+{
+    if (!mTranslatedSource.empty())
+    {
+        const std::vector&lt;sh::Varying&gt; *varyings = ShGetVaryings(compiler);
+        ASSERT(varyings);
+
+        for (size_t varyingIndex = 0; varyingIndex &lt; varyings-&gt;size(); varyingIndex++)
+        {
+            mVaryings.push_back(gl::PackedVarying((*varyings)[varyingIndex]));
+        }
+
+        mUsesMultipleRenderTargets   = mTranslatedSource.find(&quot;GL_USES_MRT&quot;)                          != std::string::npos;
+        mUsesFragColor               = mTranslatedSource.find(&quot;GL_USES_FRAG_COLOR&quot;)                   != std::string::npos;
+        mUsesFragData                = mTranslatedSource.find(&quot;GL_USES_FRAG_DATA&quot;)                    != std::string::npos;
+        mUsesFragCoord               = mTranslatedSource.find(&quot;GL_USES_FRAG_COORD&quot;)                   != std::string::npos;
+        mUsesFrontFacing             = mTranslatedSource.find(&quot;GL_USES_FRONT_FACING&quot;)                 != std::string::npos;
+        mUsesPointSize               = mTranslatedSource.find(&quot;GL_USES_POINT_SIZE&quot;)                   != std::string::npos;
+        mUsesPointCoord              = mTranslatedSource.find(&quot;GL_USES_POINT_COORD&quot;)                  != std::string::npos;
+        mUsesDepthRange              = mTranslatedSource.find(&quot;GL_USES_DEPTH_RANGE&quot;)                  != std::string::npos;
+        mUsesFragDepth               = mTranslatedSource.find(&quot;GL_USES_FRAG_DEPTH&quot;)                   != std::string::npos;
+        mUsesDiscardRewriting        = mTranslatedSource.find(&quot;ANGLE_USES_DISCARD_REWRITING&quot;)         != std::string::npos;
+        mUsesNestedBreak             = mTranslatedSource.find(&quot;ANGLE_USES_NESTED_BREAK&quot;)              != std::string::npos;
+        mUsesDeferredInit            = mTranslatedSource.find(&quot;ANGLE_USES_DEFERRED_INIT&quot;)             != std::string::npos;
+        mRequiresIEEEStrictCompiling = mTranslatedSource.find(&quot;ANGLE_REQUIRES_IEEE_STRICT_COMPILING&quot;) != std::string::npos;
+    }
+}
+
+void ShaderD3D::resetVaryingsRegisterAssignment()
+{
+    for (size_t varyingIndex = 0; varyingIndex &lt; mVaryings.size(); varyingIndex++)
+    {
+        mVaryings[varyingIndex].resetRegisterAssignment();
+    }
+}
+
+// initialize/clean up previous state
+void ShaderD3D::uncompile()
+{
+    // set by compileToHLSL
+    mCompilerOutputType = SH_ESSL_OUTPUT;
+    mTranslatedSource.clear();
+    mInfoLog.clear();
+
+    mUsesMultipleRenderTargets = false;
+    mUsesFragColor = false;
+    mUsesFragData = false;
+    mUsesFragCoord = false;
+    mUsesFrontFacing = false;
+    mUsesPointSize = false;
+    mUsesPointCoord = false;
+    mUsesDepthRange = false;
+    mUsesFragDepth = false;
+    mShaderVersion = 100;
+    mUsesDiscardRewriting = false;
+    mUsesNestedBreak = false;
+    mUsesDeferredInit = false;
+    mRequiresIEEEStrictCompiling = false;
+
+    mVaryings.clear();
+    mUniforms.clear();
+    mInterfaceBlocks.clear();
+    mActiveAttributes.clear();
+    mActiveOutputVariables.clear();
+    mDebugInfo.clear();
+}
+
+void ShaderD3D::compileToHLSL(ShHandle compiler, const std::string &amp;source)
+{
+    int compileOptions = (SH_OBJECT_CODE | SH_VARIABLES);
+    std::string sourcePath;
+
+#if !defined (ANGLE_ENABLE_WINDOWS_STORE)
+    if (gl::DebugAnnotationsActive())
+    {
+        sourcePath = getTempPath();
+        writeFile(sourcePath.c_str(), source.c_str(), source.length());
+        compileOptions |= SH_LINE_DIRECTIVES;
+    }
+#endif
+
+    int result;
+    if (sourcePath.empty())
+    {
+        const char* sourceStrings[] =
+        {
+            source.c_str(),
+        };
+
+        result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions);
+    }
+    else
+    {
+        const char* sourceStrings[] =
+        {
+            sourcePath.c_str(),
+            source.c_str(),
+        };
+
+        result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH);
+    }
+
+    mShaderVersion = ShGetShaderVersion(compiler);
+
+    if (result)
+    {
+        mTranslatedSource = ShGetObjectCode(compiler);
+
+#ifdef _DEBUG
+        // Prefix hlsl shader with commented out glsl shader
+        // Useful in diagnostics tools like pix which capture the hlsl shaders
+        std::ostringstream hlslStream;
+        hlslStream &lt;&lt; &quot;// GLSL\n&quot;;
+        hlslStream &lt;&lt; &quot;//\n&quot;;
+
+        size_t curPos = 0;
+        while (curPos != std::string::npos)
+        {
+            size_t nextLine = source.find(&quot;\n&quot;, curPos);
+            size_t len = (nextLine == std::string::npos) ? std::string::npos : (nextLine - curPos + 1);
+
+            hlslStream &lt;&lt; &quot;// &quot; &lt;&lt; source.substr(curPos, len);
+
+            curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1);
+        }
+        hlslStream &lt;&lt; &quot;\n\n&quot;;
+        hlslStream &lt;&lt; mTranslatedSource;
+        mTranslatedSource = hlslStream.str();
+#endif
+
+        mUniforms = *GetShaderVariables(ShGetUniforms(compiler));
+
+        for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
+        {
+            const sh::Uniform &amp;uniform = mUniforms[uniformIndex];
+
+            if (uniform.staticUse &amp;&amp; !uniform.isBuiltIn())
+            {
+                unsigned int index = static_cast&lt;unsigned int&gt;(-1);
+                bool getUniformRegisterResult = ShGetUniformRegister(compiler, uniform.name, &amp;index);
+                UNUSED_ASSERTION_VARIABLE(getUniformRegisterResult);
+                ASSERT(getUniformRegisterResult);
+
+                mUniformRegisterMap[uniform.name] = index;
+            }
+        }
+
+        mInterfaceBlocks = *GetShaderVariables(ShGetInterfaceBlocks(compiler));
+
+        for (size_t blockIndex = 0; blockIndex &lt; mInterfaceBlocks.size(); blockIndex++)
+        {
+            const sh::InterfaceBlock &amp;interfaceBlock = mInterfaceBlocks[blockIndex];
+
+            if (interfaceBlock.staticUse)
+            {
+                unsigned int index = static_cast&lt;unsigned int&gt;(-1);
+                bool blockRegisterResult = ShGetInterfaceBlockRegister(compiler, interfaceBlock.name, &amp;index);
+                UNUSED_ASSERTION_VARIABLE(blockRegisterResult);
+                ASSERT(blockRegisterResult);
+
+                mInterfaceBlockRegisterMap[interfaceBlock.name] = index;
+            }
+        }
+    }
+    else
+    {
+        mInfoLog = ShGetInfoLog(compiler);
+
+        TRACE(&quot;\n%s&quot;, mInfoLog.c_str());
+    }
+}
+
+void ShaderD3D::generateWorkarounds(D3DCompilerWorkarounds *workarounds) const
+{
+    if (mUsesDiscardRewriting)
+    {
+        // ANGLE issue 486:
+        // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by disabling optimization
+        workarounds-&gt;skipOptimization = true;
+    }
+    else if (mUsesNestedBreak)
+    {
+        // ANGLE issue 603:
+        // Work-around a D3D9 compiler bug that presents itself when using break in a nested loop, by maximizing optimization
+        // We want to keep the use of ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION minimal to prevent hangs, so usesDiscard takes precedence
+        workarounds-&gt;useMaxOptimization = true;
+    }
+
+    if (mRequiresIEEEStrictCompiling)
+    {
+        // IEEE Strictness for D3D compiler needs to be enabled for NaNs to work.
+        workarounds-&gt;enableIEEEStrictness = true;
+    }
+}
+
+// true if varying x has a higher priority in packing than y
+bool ShaderD3D::compareVarying(const gl::PackedVarying &amp;x, const gl::PackedVarying &amp;y)
+{
+    if (x.type == y.type)
+    {
+        return x.arraySize &gt; y.arraySize;
+    }
+
+    // Special case for handling structs: we sort these to the end of the list
+    if (x.type == GL_STRUCT_ANGLEX)
+    {
+        return false;
+    }
+
+    if (y.type == GL_STRUCT_ANGLEX)
+    {
+        return true;
+    }
+
+    return gl::VariableSortOrder(x.type) &lt; gl::VariableSortOrder(y.type);
+}
+
+unsigned int ShaderD3D::getUniformRegister(const std::string &amp;uniformName) const
+{
+    ASSERT(mUniformRegisterMap.count(uniformName) &gt; 0);
+    return mUniformRegisterMap.find(uniformName)-&gt;second;
+}
+
+unsigned int ShaderD3D::getInterfaceBlockRegister(const std::string &amp;blockName) const
+{
+    ASSERT(mInterfaceBlockRegisterMap.count(blockName) &gt; 0);
+    return mInterfaceBlockRegisterMap.find(blockName)-&gt;second;
+}
+
+GLenum ShaderD3D::getShaderType() const
+{
+    return mShaderType;
+}
+
+ShShaderOutput ShaderD3D::getCompilerOutputType() const
+{
+    return mCompilerOutputType;
+}
+
+bool ShaderD3D::compile(gl::Compiler *compiler, const std::string &amp;source)
+{
+    uncompile();
+
+    CompilerD3D *compilerD3D = GetImplAs&lt;CompilerD3D&gt;(compiler);
+    ShHandle compilerHandle = compilerD3D-&gt;getCompilerHandle(mShaderType);
+
+    mCompilerOutputType = ShGetShaderOutputType(compilerHandle);
+
+    compileToHLSL(compilerHandle, source);
+
+    if (mShaderType == GL_VERTEX_SHADER)
+    {
+        parseAttributes(compilerHandle);
+    }
+
+    parseVaryings(compilerHandle);
+
+    if (mShaderType == GL_FRAGMENT_SHADER)
+    {
+        std::sort(mVaryings.begin(), mVaryings.end(), compareVarying);
+
+        const std::string &amp;hlsl = getTranslatedSource();
+        if (!hlsl.empty())
+        {
+            mActiveOutputVariables = *GetShaderVariables(ShGetOutputVariables(compilerHandle));
+            FilterInactiveVariables(&amp;mActiveOutputVariables);
+        }
+    }
+
+#if ANGLE_SHADER_DEBUG_INFO == ANGLE_ENABLED
+    mDebugInfo += std::string(&quot;// &quot;) + GetShaderTypeString(mShaderType) + &quot; SHADER BEGIN\n&quot;;
+    mDebugInfo += &quot;\n// GLSL BEGIN\n\n&quot; + source + &quot;\n\n// GLSL END\n\n\n&quot;;
+    mDebugInfo += &quot;// INITIAL HLSL BEGIN\n\n&quot; + getTranslatedSource() + &quot;\n// INITIAL HLSL END\n\n\n&quot;;
+    // Successive steps will append more info
+#else
+    mDebugInfo += getTranslatedSource();
+#endif
+
+    return !getTranslatedSource().empty();
+}
+
+void ShaderD3D::parseAttributes(ShHandle compiler)
+{
+    const std::string &amp;hlsl = getTranslatedSource();
+    if (!hlsl.empty())
+    {
+        mActiveAttributes = *GetShaderVariables(ShGetAttributes(compiler));
+        FilterInactiveVariables(&amp;mActiveAttributes);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// ShaderD3D.h: Defines the rx::ShaderD3D class which implements rx::ShaderImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_SHADERD3D_H_
+#define LIBANGLE_RENDERER_D3D_SHADERD3D_H_
+
+#include &quot;libANGLE/renderer/ShaderImpl.h&quot;
+#include &quot;libANGLE/renderer/Workarounds.h&quot;
+#include &quot;libANGLE/Shader.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+class DynamicHLSL;
+class RendererD3D;
+
+class ShaderD3D : public ShaderImpl
+{
+    friend class DynamicHLSL;
+
+  public:
+    ShaderD3D(GLenum type);
+    virtual ~ShaderD3D();
+
+    // ShaderImpl implementation
+    virtual std::string getDebugInfo() const;
+
+    // D3D-specific methods
+    virtual void uncompile();
+    void resetVaryingsRegisterAssignment();
+    unsigned int getUniformRegister(const std::string &amp;uniformName) const;
+    unsigned int getInterfaceBlockRegister(const std::string &amp;blockName) const;
+    void appendDebugInfo(const std::string &amp;info) { mDebugInfo += info; }
+
+    void generateWorkarounds(D3DCompilerWorkarounds *workarounds) const;
+    int getShaderVersion() const { return mShaderVersion; }
+    bool usesDepthRange() const { return mUsesDepthRange; }
+    bool usesPointSize() const { return mUsesPointSize; }
+    bool usesDeferredInit() const { return mUsesDeferredInit; }
+
+    GLenum getShaderType() const;
+    ShShaderOutput getCompilerOutputType() const;
+
+    virtual bool compile(gl::Compiler *compiler, const std::string &amp;source);
+
+  private:
+    void compileToHLSL(ShHandle compiler, const std::string &amp;source);
+    void parseVaryings(ShHandle compiler);
+
+    void parseAttributes(ShHandle compiler);
+
+    static bool compareVarying(const gl::PackedVarying &amp;x, const gl::PackedVarying &amp;y);
+
+    GLenum mShaderType;
+
+    int mShaderVersion;
+
+    bool mUsesMultipleRenderTargets;
+    bool mUsesFragColor;
+    bool mUsesFragData;
+    bool mUsesFragCoord;
+    bool mUsesFrontFacing;
+    bool mUsesPointSize;
+    bool mUsesPointCoord;
+    bool mUsesDepthRange;
+    bool mUsesFragDepth;
+    bool mUsesDiscardRewriting;
+    bool mUsesNestedBreak;
+    bool mUsesDeferredInit;
+    bool mRequiresIEEEStrictCompiling;
+
+    ShShaderOutput mCompilerOutputType;
+    std::string mDebugInfo;
+    std::map&lt;std::string, unsigned int&gt; mUniformRegisterMap;
+    std::map&lt;std::string, unsigned int&gt; mInterfaceBlockRegisterMap;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_SHADERD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderExecutableD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+//
+// Copyright (c) 2012-2015 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.
+//
+
+// ShaderExecutable.cpp: Implements a class to contain D3D shader executable
+// implementation details.
+
+#include &quot;libANGLE/renderer/d3d/ShaderExecutableD3D.h&quot;
+
+#include &quot;common/angleutils.h&quot;
+
+namespace rx
+{
+
+ShaderExecutableD3D::ShaderExecutableD3D(const void *function, size_t length)
+    : mFunctionBuffer(length)
+{
+    memcpy(mFunctionBuffer.data(), function, length);
+}
+
+ShaderExecutableD3D::~ShaderExecutableD3D()
+{
+}
+
+const uint8_t *ShaderExecutableD3D::getFunction() const
+{
+    return mFunctionBuffer.data();
+}
+
+size_t ShaderExecutableD3D::getLength() const
+{
+    return mFunctionBuffer.size();
+}
+
+const std::string &amp;ShaderExecutableD3D::getDebugInfo() const
+{
+    return mDebugInfo;
+}
+
+void ShaderExecutableD3D::appendDebugInfo(const std::string &amp;info)
+{
+    mDebugInfo += info;
+}
+
+
+UniformStorageD3D::UniformStorageD3D(size_t initialSize) : mSize(initialSize)
+{
+}
+
+UniformStorageD3D::~UniformStorageD3D()
+{
+}
+
+size_t UniformStorageD3D::size() const
+{
+    return mSize;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dShaderExecutableD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/ShaderExecutableD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+//
+// Copyright (c) 2012-2015 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.
+//
+
+// ShaderExecutable.h: Defines a class to contain D3D shader executable
+// implementation details.
+
+#ifndef LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_
+#define LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_
+
+#include &quot;common/debug.h&quot;
+
+#include &lt;vector&gt;
+#include &lt;cstdint&gt;
+
+namespace rx
+{
+
+class ShaderExecutableD3D : angle::NonCopyable
+{
+  public:
+    ShaderExecutableD3D(const void *function, size_t length);
+    virtual ~ShaderExecutableD3D();
+
+    const uint8_t *getFunction() const;
+
+    size_t getLength() const;
+
+    const std::string &amp;getDebugInfo() const;
+
+    void appendDebugInfo(const std::string &amp;info);
+
+  private:
+    std::vector&lt;uint8_t&gt; mFunctionBuffer;
+    std::string mDebugInfo;
+};
+
+class UniformStorageD3D : angle::NonCopyable
+{
+  public:
+    UniformStorageD3D(size_t initialSize);
+    virtual ~UniformStorageD3D();
+
+    size_t size() const;
+
+  private:
+    size_t mSize;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_SHADEREXECUTABLED3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dSurfaceD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,378 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// SurfaceD3D.cpp: D3D implementation of an EGL surface
+
+#include &quot;libANGLE/renderer/d3d/SurfaceD3D.h&quot;
+
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/renderer/d3d/DisplayD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SwapChainD3D.h&quot;
+
+#include &lt;tchar.h&gt;
+#include &lt;EGL/eglext.h&gt;
+#include &lt;algorithm&gt;
+
+namespace rx
+{
+
+SurfaceD3D *SurfaceD3D::createOffscreen(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLClientBuffer shareHandle,
+                                        EGLint width, EGLint height)
+{
+    return new SurfaceD3D(renderer, display, config, width, height, EGL_TRUE, shareHandle, NULL);
+}
+
+SurfaceD3D *SurfaceD3D::createFromWindow(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLNativeWindowType window,
+                                         EGLint fixedSize, EGLint width, EGLint height)
+{
+    return new SurfaceD3D(renderer, display, config, width, height, fixedSize, static_cast&lt;EGLClientBuffer&gt;(0), window);
+}
+
+SurfaceD3D::SurfaceD3D(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLint width, EGLint height, EGLint fixedSize,
+                       EGLClientBuffer shareHandle, EGLNativeWindowType window)
+    : SurfaceImpl(),
+      mRenderer(renderer),
+      mDisplay(display),
+      mFixedSize(fixedSize == EGL_TRUE),
+      mRenderTargetFormat(config-&gt;renderTargetFormat),
+      mDepthStencilFormat(config-&gt;depthStencilFormat),
+      mSwapChain(nullptr),
+      mSwapIntervalDirty(true),
+      mNativeWindow(window),
+      mWidth(width),
+      mHeight(height),
+      mChildWindow(nullptr),
+      mSwapInterval(1),
+      mShareHandle(reinterpret_cast&lt;HANDLE*&gt;(shareHandle))
+{
+}
+
+SurfaceD3D::~SurfaceD3D()
+{
+    releaseSwapChain();
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    if (mChildWindow.getNativeWindow() != nullptr)
+    {
+        DestroyWindow(mChildWindow.getNativeWindow());
+    }
+#endif
+}
+
+void SurfaceD3D::releaseSwapChain()
+{
+    SafeDelete(mSwapChain);
+}
+
+egl::Error SurfaceD3D::initialize()
+{
+    if (mNativeWindow.getNativeWindow())
+    {
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+        if (mRenderer-&gt;shouldCreateChildWindowForSurface(mNativeWindow.getNativeWindow()))
+        {
+            RECT rect;
+            if (!mNativeWindow.getClientRect(&amp;rect))
+            {
+                return egl::Error(EGL_BAD_NATIVE_WINDOW, &quot;Failed to get the size of the native window.&quot;);
+            }
+
+            DisplayD3D *displayD3D = GetImplAs&lt;DisplayD3D&gt;(mDisplay);
+            ATOM windowClass = displayD3D-&gt;getChildWindowClass();
+
+            HWND childWindow = CreateWindowExA(WS_EX_NOPARENTNOTIFY,
+                                               reinterpret_cast&lt;const char*&gt;(windowClass),
+                                               &quot;ANGLE Intermediate Surface Window&quot;,
+                                               WS_CHILDWINDOW | WS_DISABLED | WS_VISIBLE,
+                                               0,
+                                               0,
+                                               rect.right - rect.left,
+                                               rect.bottom - rect.top,
+                                               mNativeWindow.getNativeWindow(),
+                                               nullptr,
+                                               nullptr,
+                                               nullptr);
+            if (!childWindow)
+            {
+                return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to create child window.&quot;);
+            }
+
+            mChildWindow = NativeWindow(childWindow);
+
+            if (!mChildWindow.initialize())
+            {
+                return egl::Error(EGL_BAD_SURFACE);
+            }
+        }
+#endif
+
+        if (!mNativeWindow.initialize())
+        {
+            return egl::Error(EGL_BAD_SURFACE);
+        }
+    }
+
+    egl::Error error = resetSwapChain();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceD3D::bindTexImage(EGLint)
+{
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceD3D::releaseTexImage(EGLint)
+{
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceD3D::resetSwapChain()
+{
+    ASSERT(!mSwapChain);
+
+    int width;
+    int height;
+
+    if (!mFixedSize)
+    {
+        RECT windowRect;
+        if (!mNativeWindow.getClientRect(&amp;windowRect))
+        {
+            ASSERT(false);
+
+            return egl::Error(EGL_BAD_SURFACE, &quot;Could not retrieve the window dimensions&quot;);
+        }
+
+        width = windowRect.right - windowRect.left;
+        height = windowRect.bottom - windowRect.top;
+    }
+    else
+    {
+        // non-window surface - size is determined at creation
+        width = mWidth;
+        height = mHeight;
+    }
+
+    const NativeWindow &amp;window = (mChildWindow.getNativeWindow() != nullptr) ? mChildWindow : mNativeWindow;
+    mSwapChain = mRenderer-&gt;createSwapChain(window, mShareHandle, mRenderTargetFormat, mDepthStencilFormat);
+    if (!mSwapChain)
+    {
+        return egl::Error(EGL_BAD_ALLOC);
+    }
+
+    egl::Error error = resetSwapChain(width, height);
+    if (error.isError())
+    {
+        SafeDelete(mSwapChain);
+        return error;
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceD3D::resizeSwapChain(int backbufferWidth, int backbufferHeight)
+{
+    ASSERT(backbufferWidth &gt;= 0 &amp;&amp; backbufferHeight &gt;= 0);
+    ASSERT(mSwapChain);
+
+    EGLint status = mSwapChain-&gt;resize(std::max(1, backbufferWidth), std::max(1, backbufferHeight));
+
+    if (status == EGL_CONTEXT_LOST)
+    {
+        mDisplay-&gt;notifyDeviceLost();
+        return egl::Error(status);
+    }
+    else if (status != EGL_SUCCESS)
+    {
+        return egl::Error(status);
+    }
+
+    mWidth = backbufferWidth;
+    mHeight = backbufferHeight;
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    if (mChildWindow.getNativeWindow())
+    {
+        // Resize the child window
+        if (!MoveWindow(mChildWindow.getNativeWindow(), 0, 0, mWidth, mHeight, FALSE))
+        {
+            return egl::Error(EGL_BAD_SURFACE, &quot;Failed to move the child window.&quot;);
+        }
+    }
+#endif
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceD3D::resetSwapChain(int backbufferWidth, int backbufferHeight)
+{
+    ASSERT(backbufferWidth &gt;= 0 &amp;&amp; backbufferHeight &gt;= 0);
+    ASSERT(mSwapChain);
+
+    EGLint status = mSwapChain-&gt;reset(std::max(1, backbufferWidth), std::max(1, backbufferHeight), mSwapInterval);
+
+    if (status == EGL_CONTEXT_LOST)
+    {
+        mRenderer-&gt;notifyDeviceLost();
+        return egl::Error(status);
+    }
+    else if (status != EGL_SUCCESS)
+    {
+        return egl::Error(status);
+    }
+
+    mWidth = backbufferWidth;
+    mHeight = backbufferHeight;
+    mSwapIntervalDirty = false;
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error SurfaceD3D::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    if (!mSwapChain)
+    {
+        return egl::Error(EGL_SUCCESS);
+    }
+
+    if (x + width &gt; mWidth)
+    {
+        width = mWidth - x;
+    }
+
+    if (y + height &gt; mHeight)
+    {
+        height = mHeight - y;
+    }
+
+    if (width != 0 &amp;&amp; height != 0)
+    {
+        EGLint status = mSwapChain-&gt;swapRect(x, y, width, height);
+
+        if (status == EGL_CONTEXT_LOST)
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return egl::Error(status);
+        }
+        else if (status != EGL_SUCCESS)
+        {
+            return egl::Error(status);
+        }
+    }
+
+    checkForOutOfDateSwapChain();
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+bool SurfaceD3D::checkForOutOfDateSwapChain()
+{
+    RECT client;
+    int clientWidth = getWidth();
+    int clientHeight = getHeight();
+    bool sizeDirty = false;
+    if (!mFixedSize &amp;&amp; !mNativeWindow.isIconic())
+    {
+        // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized
+        // because that's not a useful size to render to.
+        if (!mNativeWindow.getClientRect(&amp;client))
+        {
+            ASSERT(false);
+            return false;
+        }
+
+        // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
+        clientWidth = client.right - client.left;
+        clientHeight = client.bottom - client.top;
+        sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
+    }
+
+    bool wasDirty = (mSwapIntervalDirty || sizeDirty);
+
+    if (mSwapIntervalDirty)
+    {
+        resetSwapChain(clientWidth, clientHeight);
+    }
+    else if (sizeDirty)
+    {
+        resizeSwapChain(clientWidth, clientHeight);
+    }
+
+    return wasDirty;
+}
+
+egl::Error SurfaceD3D::swap()
+{
+    return swapRect(0, 0, mWidth, mHeight);
+}
+
+egl::Error SurfaceD3D::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    return swapRect(x, y, width, height);
+}
+
+rx::SwapChainD3D *SurfaceD3D::getSwapChain() const
+{
+    return mSwapChain;
+}
+
+void SurfaceD3D::setSwapInterval(EGLint interval)
+{
+    if (mSwapInterval == interval)
+    {
+        return;
+    }
+
+    mSwapInterval = interval;
+    mSwapIntervalDirty = true;
+}
+
+EGLint SurfaceD3D::getWidth() const
+{
+    return mWidth;
+}
+
+EGLint SurfaceD3D::getHeight() const
+{
+    return mHeight;
+}
+
+EGLint SurfaceD3D::isPostSubBufferSupported() const
+{
+    // post sub buffer is always possible on D3D surfaces
+    return EGL_TRUE;
+}
+
+egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+    ASSERT(attribute == EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE);
+    *value = mSwapChain-&gt;getShareHandle();
+    return egl::Error(EGL_SUCCESS);
+}
+
+gl::Error SurfaceD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                                FramebufferAttachmentRenderTarget **rtOut)
+{
+    if (target.binding() == GL_BACK)
+    {
+        *rtOut = mSwapChain-&gt;getColorRenderTarget();
+    }
+    else
+    {
+        *rtOut = mSwapChain-&gt;getDepthStencilRenderTarget();
+    }
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dSurfaceD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SurfaceD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// SurfaceD3D.h: D3D implementation of an EGL surface
+
+#ifndef LIBANGLE_RENDERER_D3D_SURFACED3D_H_
+#define LIBANGLE_RENDERER_D3D_SURFACED3D_H_
+
+#include &quot;libANGLE/renderer/SurfaceImpl.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+
+namespace egl
+{
+class Surface;
+}
+
+namespace rx
+{
+class SwapChainD3D;
+class RendererD3D;
+
+class SurfaceD3D : public SurfaceImpl
+{
+  public:
+    static SurfaceD3D *createFromWindow(RendererD3D *renderer, egl::Display *display, const egl::Config *config,
+                                        EGLNativeWindowType window, EGLint fixedSize, EGLint width, EGLint height);
+    static SurfaceD3D *createOffscreen(RendererD3D *renderer, egl::Display *display, const egl::Config *config,
+                                       EGLClientBuffer shareHandle, EGLint width, EGLint height);
+    ~SurfaceD3D() override;
+    void releaseSwapChain();
+
+    egl::Error initialize() override;
+
+    egl::Error swap() override;
+    egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override;
+    egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
+    egl::Error bindTexImage(EGLint buffer) override;
+    egl::Error releaseTexImage(EGLint buffer) override;
+    void setSwapInterval(EGLint interval) override;
+
+    EGLint getWidth() const override;
+    EGLint getHeight() const override;
+
+    EGLint isPostSubBufferSupported() const override;
+
+    // D3D implementations
+    SwapChainD3D *getSwapChain() const;
+
+    egl::Error resetSwapChain();
+
+    // Returns true if swapchain changed due to resize or interval update
+    bool checkForOutOfDateSwapChain();
+
+    gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                        FramebufferAttachmentRenderTarget **rtOut) override;
+
+  private:
+    SurfaceD3D(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLint width, EGLint height,
+               EGLint fixedSize, EGLClientBuffer shareHandle, EGLNativeWindowType window);
+
+    egl::Error swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
+    egl::Error resetSwapChain(int backbufferWidth, int backbufferHeight);
+    egl::Error resizeSwapChain(int backbufferWidth, int backbufferHeight);
+
+    RendererD3D *mRenderer;
+    egl::Display *mDisplay;
+
+    bool mFixedSize;
+
+    GLenum mRenderTargetFormat;
+    GLenum mDepthStencilFormat;
+
+    SwapChainD3D *mSwapChain;
+    bool mSwapIntervalDirty;
+
+    NativeWindow mNativeWindow;   // Handler for the Window that the surface is created for.
+    EGLint mWidth;
+    EGLint mHeight;
+
+    NativeWindow mChildWindow;
+
+    EGLint mSwapInterval;
+
+    HANDLE mShareHandle;
+};
+
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_SURFACED3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dSwapChainD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SwapChainD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SwapChainD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/SwapChainD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+//
+// 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.
+//
+
+// SwapChainD3D.h: Defines a back-end specific class that hides the details of the
+// implementation-specific swapchain.
+
+#ifndef LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_
+#define LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_
+
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;EGL/egl.h&gt;
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/platform.h&quot;
+
+// TODO: move out of D3D11
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+
+#if !defined(ANGLE_FORCE_VSYNC_OFF)
+#define ANGLE_FORCE_VSYNC_OFF 0
+#endif
+
+namespace rx
+{
+class RenderTargetD3D;
+
+class SwapChainD3D : angle::NonCopyable
+{
+  public:
+    SwapChainD3D(rx::NativeWindow nativeWindow, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
+        : mNativeWindow(nativeWindow), mShareHandle(shareHandle), mBackBufferFormat(backBufferFormat), mDepthBufferFormat(depthBufferFormat)
+    {
+    }
+
+    virtual ~SwapChainD3D() {};
+
+    virtual EGLint resize(EGLint backbufferWidth, EGLint backbufferSize) = 0;
+    virtual EGLint reset(EGLint backbufferWidth, EGLint backbufferHeight, EGLint swapInterval) = 0;
+    virtual EGLint swapRect(EGLint x, EGLint y, EGLint width, EGLint height) = 0;
+    virtual void recreate() = 0;
+
+    virtual RenderTargetD3D *getColorRenderTarget() = 0;
+    virtual RenderTargetD3D *getDepthStencilRenderTarget() = 0;
+
+    GLenum GetBackBufferInternalFormat() const { return mBackBufferFormat; }
+    GLenum GetDepthBufferInternalFormat() const { return mDepthBufferFormat; }
+
+    HANDLE getShareHandle() { return mShareHandle; }
+
+  protected:
+    rx::NativeWindow mNativeWindow;  // Handler for the Window that the surface is created for.
+    const GLenum mBackBufferFormat;
+    const GLenum mDepthBufferFormat;
+
+    HANDLE mShareHandle;
+};
+
+}
+#endif // LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,2957 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// TextureD3D.cpp: Implementations of the Texture interfaces shared betweeen the D3D backends.
+
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/BufferImpl.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/ImageD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SurfaceD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureStorage.h&quot;
+
+namespace rx
+{
+
+namespace
+{
+
+gl::Error GetUnpackPointer(const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels,
+                           ptrdiff_t layerOffset, const uint8_t **pointerOut)
+{
+    if (unpack.pixelBuffer.id() != 0)
+    {
+        // Do a CPU readback here, if we have an unpack buffer bound and the fast GPU path is not supported
+        gl::Buffer *pixelBuffer = unpack.pixelBuffer.get();
+        ptrdiff_t offset = reinterpret_cast&lt;ptrdiff_t&gt;(pixels);
+
+        // TODO: this is the only place outside of renderer that asks for a buffers raw data.
+        // This functionality should be moved into renderer and the getData method of BufferImpl removed.
+        BufferD3D *bufferD3D = GetImplAs&lt;BufferD3D&gt;(pixelBuffer);
+        ASSERT(bufferD3D);
+        const uint8_t *bufferData = NULL;
+        gl::Error error = bufferD3D-&gt;getData(&amp;bufferData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        *pointerOut = bufferData + offset;
+    }
+    else
+    {
+        *pointerOut = pixels;
+    }
+
+    // Offset the pointer for 2D array layer (if it's valid)
+    if (*pointerOut != nullptr)
+    {
+        *pointerOut += layerOffset;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool IsRenderTargetUsage(GLenum usage)
+{
+    return (usage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
+}
+
+}
+
+TextureD3D::TextureD3D(RendererD3D *renderer)
+    : mRenderer(renderer),
+      mUsage(GL_NONE),
+      mDirtyImages(true),
+      mImmutable(false),
+      mTexStorage(NULL)
+{
+}
+
+TextureD3D::~TextureD3D()
+{
+}
+
+gl::Error TextureD3D::getNativeTexture(TextureStorage **outStorage)
+{
+    // ensure the underlying texture is created
+    gl::Error error = initializeStorage(false);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (mTexStorage)
+    {
+        error = updateStorage();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    ASSERT(outStorage);
+
+    *outStorage = mTexStorage;
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLint TextureD3D::getBaseLevelWidth() const
+{
+    const ImageD3D *baseImage = getBaseLevelImage();
+    return (baseImage ? baseImage-&gt;getWidth() : 0);
+}
+
+GLint TextureD3D::getBaseLevelHeight() const
+{
+    const ImageD3D *baseImage = getBaseLevelImage();
+    return (baseImage ? baseImage-&gt;getHeight() : 0);
+}
+
+GLint TextureD3D::getBaseLevelDepth() const
+{
+    const ImageD3D *baseImage = getBaseLevelImage();
+    return (baseImage ? baseImage-&gt;getDepth() : 0);
+}
+
+// Note: &quot;base level image&quot; is loosely defined to be any image from the base level,
+// where in the base of 2D array textures and cube maps there are several. Don't use
+// the base level image for anything except querying texture format and size.
+GLenum TextureD3D::getBaseLevelInternalFormat() const
+{
+    const ImageD3D *baseImage = getBaseLevelImage();
+    return (baseImage ? baseImage-&gt;getInternalFormat() : GL_NONE);
+}
+
+bool TextureD3D::shouldUseSetData(const ImageD3D *image) const
+{
+    if (!mRenderer-&gt;getWorkarounds().setDataFasterThanImageUpload)
+    {
+        return false;
+    }
+
+    gl::InternalFormat internalFormat = gl::GetInternalFormatInfo(image-&gt;getInternalFormat());
+
+    // We can only handle full updates for depth-stencil textures, so to avoid complications
+    // disable them entirely.
+    if (internalFormat.depthBits &gt; 0 || internalFormat.stencilBits &gt; 0)
+    {
+        return false;
+    }
+
+    // TODO(jmadill): Handle compressed internal formats
+    return (mTexStorage &amp;&amp; !internalFormat.compressed);
+}
+
+gl::Error TextureD3D::setImage(const gl::ImageIndex &amp;index, GLenum type,
+                               const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels,
+                               ptrdiff_t layerOffset)
+{
+    if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
+    {
+        UNIMPLEMENTED();
+        return gl::Error(GL_INVALID_OPERATION, &quot;unimplemented pixel store state&quot;);
+    }
+
+    ImageD3D *image = getImage(index);
+    ASSERT(image);
+
+    // No-op
+    if (image-&gt;getWidth() == 0 || image-&gt;getHeight() == 0 || image-&gt;getDepth() == 0)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    // We no longer need the &quot;GLenum format&quot; parameter to TexImage to determine what data format &quot;pixels&quot; contains.
+    // From our image internal format we know how many channels to expect, and &quot;type&quot; gives the format of pixel's components.
+    const uint8_t *pixelData = NULL;
+    gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &amp;pixelData);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (pixelData != NULL)
+    {
+        if (shouldUseSetData(image))
+        {
+            error = mTexStorage-&gt;setData(index, image, NULL, type, unpack, pixelData);
+        }
+        else
+        {
+            gl::Box fullImageArea(0, 0, 0, image-&gt;getWidth(), image-&gt;getHeight(), image-&gt;getDepth());
+            error = image-&gt;loadData(fullImageArea, unpack, type, pixelData);
+        }
+
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D::subImage(const gl::ImageIndex &amp;index, const gl::Box &amp;area, GLenum format, GLenum type,
+                               const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels, ptrdiff_t layerOffset)
+{
+    // CPU readback &amp; copy where direct GPU copy is not supported
+    const uint8_t *pixelData = NULL;
+    gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &amp;pixelData);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (pixelData != NULL)
+    {
+        ImageD3D *image = getImage(index);
+        ASSERT(image);
+
+        if (shouldUseSetData(image))
+        {
+            return mTexStorage-&gt;setData(index, image, &amp;area, type, unpack, pixelData);
+        }
+
+        error = image-&gt;loadData(area, unpack, type, pixelData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        error = commitRegion(index, area);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D::setCompressedImage(const gl::ImageIndex &amp;index, const gl::PixelUnpackState &amp;unpack,
+                                         const uint8_t *pixels, ptrdiff_t layerOffset)
+{
+    if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
+    {
+        UNIMPLEMENTED();
+        return gl::Error(GL_INVALID_OPERATION, &quot;unimplemented pixel store state&quot;);
+    }
+
+    // We no longer need the &quot;GLenum format&quot; parameter to TexImage to determine what data format &quot;pixels&quot; contains.
+    // From our image internal format we know how many channels to expect, and &quot;type&quot; gives the format of pixel's components.
+    const uint8_t *pixelData = NULL;
+    gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &amp;pixelData);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (pixelData != NULL)
+    {
+        ImageD3D *image = getImage(index);
+        ASSERT(image);
+
+        gl::Box fullImageArea(0, 0, 0, image-&gt;getWidth(), image-&gt;getHeight(), image-&gt;getDepth());
+        error = image-&gt;loadCompressedData(fullImageArea, pixelData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D::subImageCompressed(const gl::ImageIndex &amp;index, const gl::Box &amp;area, GLenum format,
+                                         const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels,
+                                         ptrdiff_t layerOffset)
+{
+    if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
+    {
+        UNIMPLEMENTED();
+        return gl::Error(GL_INVALID_OPERATION, &quot;unimplemented pixel store state&quot;);
+    }
+
+    const uint8_t *pixelData = NULL;
+    gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &amp;pixelData);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (pixelData != NULL)
+    {
+        ImageD3D *image = getImage(index);
+        ASSERT(image);
+
+        error = image-&gt;loadCompressedData(area, pixelData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool TextureD3D::isFastUnpackable(const gl::PixelUnpackState &amp;unpack, GLenum sizedInternalFormat)
+{
+    return unpack.pixelBuffer.id() != 0 &amp;&amp; mRenderer-&gt;supportsFastCopyBufferToTexture(sizedInternalFormat);
+}
+
+gl::Error TextureD3D::fastUnpackPixels(const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels, const gl::Box &amp;destArea,
+                                       GLenum sizedInternalFormat, GLenum type, RenderTargetD3D *destRenderTarget)
+{
+    // No-op
+    if (destArea.width &lt;= 0 &amp;&amp; destArea.height &lt;= 0 &amp;&amp; destArea.depth &lt;= 0)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    // In order to perform the fast copy through the shader, we must have the right format, and be able
+    // to create a render target.
+    ASSERT(mRenderer-&gt;supportsFastCopyBufferToTexture(sizedInternalFormat));
+
+    uintptr_t offset = reinterpret_cast&lt;uintptr_t&gt;(pixels);
+
+    gl::Error error = mRenderer-&gt;fastCopyBufferToTexture(unpack, static_cast&lt;unsigned int&gt;(offset), destRenderTarget, sizedInternalFormat, type, destArea);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLint TextureD3D::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
+{
+    if ((gl::isPow2(width) &amp;&amp; gl::isPow2(height) &amp;&amp; gl::isPow2(depth)) || mRenderer-&gt;getRendererExtensions().textureNPOT)
+    {
+        // Maximum number of levels
+        return gl::log2(std::max(std::max(width, height), depth)) + 1;
+    }
+    else
+    {
+        // OpenGL ES 2.0 without GL_OES_texture_npot does not permit NPOT mipmaps.
+        return 1;
+    }
+}
+
+int TextureD3D::mipLevels() const
+{
+    return gl::log2(std::max(std::max(getBaseLevelWidth(), getBaseLevelHeight()), getBaseLevelDepth())) + 1;
+}
+
+TextureStorage *TextureD3D::getStorage()
+{
+    ASSERT(mTexStorage);
+    return mTexStorage;
+}
+
+ImageD3D *TextureD3D::getBaseLevelImage() const
+{
+    return getImage(getImageIndex(0, 0));
+}
+
+gl::Error TextureD3D::generateMipmaps(const gl::SamplerState &amp;samplerState)
+{
+    GLint mipCount = mipLevels();
+
+    if (mipCount == 1)
+    {
+        return gl::Error(GL_NO_ERROR); // no-op
+    }
+
+    if (mTexStorage &amp;&amp; mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        // Switch to using the mipmapped texture.
+        TextureStorage *textureStorage = NULL;
+        gl::Error error = getNativeTexture(&amp;textureStorage);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        error = textureStorage-&gt;useLevelZeroWorkaroundTexture(false);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    // Set up proper mipmap chain in our Image array.
+    initMipmapsImages();
+
+    if (mTexStorage &amp;&amp; mTexStorage-&gt;supportsNativeMipmapFunction())
+    {
+        gl::Error error = updateStorage();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // Generate the mipmap chain using the ad-hoc DirectX function.
+        error = mRenderer-&gt;generateMipmapsUsingD3D(mTexStorage, samplerState);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+    else
+    {
+        // Generate the mipmap chain, one level at a time.
+        gl::Error error = generateMipmapsUsingImages();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D::generateMipmapsUsingImages()
+{
+    GLint mipCount = mipLevels();
+
+    // We know that all layers have the same dimension, for the texture to be complete
+    GLint layerCount = static_cast&lt;GLint&gt;(getLayerCount(0));
+
+    // When making mipmaps with the setData workaround enabled, the texture storage has
+    // the image data already. For non-render-target storage, we have to pull it out into
+    // an image layer.
+    if (mRenderer-&gt;getWorkarounds().setDataFasterThanImageUpload &amp;&amp; mTexStorage)
+    {
+        if (!mTexStorage-&gt;isRenderTarget())
+        {
+            // Copy from the storage mip 0 to Image mip 0
+            for (GLint layer = 0; layer &lt; layerCount; ++layer)
+            {
+                gl::ImageIndex srcIndex = getImageIndex(0, layer);
+
+                ImageD3D *image = getImage(srcIndex);
+                gl::Box area(0, 0, 0, image-&gt;getWidth(), image-&gt;getHeight(), image-&gt;getDepth());
+                gl::Offset offset(0, 0, 0);
+                gl::Error error = image-&gt;copy(offset, area, srcIndex, mTexStorage);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+        else
+        {
+            gl::Error error = updateStorage();
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    // TODO: Decouple this from zeroMaxLodWorkaround. This is a 9_3 restriction, unrelated to zeroMaxLodWorkaround.
+    // The restriction is because Feature Level 9_3 can't create SRVs on individual levels of the texture.
+    // As a result, even if the storage is a rendertarget, we can't use the GPU to generate the mipmaps without further work.
+    // The D3D9 renderer works around this by copying each level of the texture into its own single-layer GPU texture (in Blit9::boxFilter).
+    // Feature Level 9_3 could do something similar, or it could continue to use CPU-side mipmap generation, or something else.
+    bool renderableStorage = (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget() &amp;&amp; !(mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround));
+
+    for (GLint layer = 0; layer &lt; layerCount; ++layer)
+    {
+        for (GLint mip = 1; mip &lt; mipCount; ++mip)
+        {
+            ASSERT(getLayerCount(mip) == layerCount);
+
+            gl::ImageIndex sourceIndex = getImageIndex(mip - 1, layer);
+            gl::ImageIndex destIndex = getImageIndex(mip, layer);
+
+            if (renderableStorage)
+            {
+                // GPU-side mipmapping
+                gl::Error error = mTexStorage-&gt;generateMipmap(sourceIndex, destIndex);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+            else
+            {
+                // CPU-side mipmapping
+                gl::Error error = mRenderer-&gt;generateMipmap(getImage(destIndex), getImage(sourceIndex));
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    if (mTexStorage)
+    {
+        updateStorage();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool TextureD3D::isBaseImageZeroSize() const
+{
+    ImageD3D *baseImage = getBaseLevelImage();
+
+    if (!baseImage || baseImage-&gt;getWidth() &lt;= 0)
+    {
+        return true;
+    }
+
+    if (!gl::IsCubeMapTextureTarget(baseImage-&gt;getTarget()) &amp;&amp; baseImage-&gt;getHeight() &lt;= 0)
+    {
+        return true;
+    }
+
+    if (baseImage-&gt;getTarget() == GL_TEXTURE_3D &amp;&amp; baseImage-&gt;getDepth() &lt;= 0)
+    {
+        return true;
+    }
+
+    if (baseImage-&gt;getTarget() == GL_TEXTURE_2D_ARRAY &amp;&amp; getLayerCount(0) &lt;= 0)
+    {
+        return true;
+    }
+
+    return false;
+}
+
+gl::Error TextureD3D::ensureRenderTarget()
+{
+    gl::Error error = initializeStorage(true);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!isBaseImageZeroSize())
+    {
+        ASSERT(mTexStorage);
+        if (!mTexStorage-&gt;isRenderTarget())
+        {
+            TextureStorage *newRenderTargetStorage = NULL;
+            error = createCompleteStorage(true, &amp;newRenderTargetStorage);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            error = mTexStorage-&gt;copyToStorage(newRenderTargetStorage);
+            if (error.isError())
+            {
+                SafeDelete(newRenderTargetStorage);
+                return error;
+            }
+
+            error = setCompleteTexStorage(newRenderTargetStorage);
+            if (error.isError())
+            {
+                SafeDelete(newRenderTargetStorage);
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool TextureD3D::canCreateRenderTargetForImage(const gl::ImageIndex &amp;index) const
+{
+    ImageD3D *image = getImage(index);
+    bool levelsComplete = (isImageComplete(index) &amp;&amp; isImageComplete(getImageIndex(0, 0)));
+    return (image-&gt;isRenderableFormat() &amp;&amp; levelsComplete);
+}
+
+gl::Error TextureD3D::commitRegion(const gl::ImageIndex &amp;index, const gl::Box &amp;region)
+{
+    if (mTexStorage)
+    {
+        ASSERT(isValidIndex(index));
+        ImageD3D *image = getImage(index);
+        gl::Error error = image-&gt;copyToStorage(mTexStorage, index, region);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        image-&gt;markClean();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                                FramebufferAttachmentRenderTarget **rtOut)
+{
+    RenderTargetD3D *rtD3D = nullptr;
+    gl::Error error = getRenderTarget(target.textureIndex(), &amp;rtD3D);
+    *rtOut = static_cast&lt;FramebufferAttachmentRenderTarget *&gt;(rtD3D);
+    return error;
+}
+
+TextureD3D_2D::TextureD3D_2D(RendererD3D *renderer)
+    : TextureD3D(renderer)
+{
+    for (int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+    {
+        mImageArray[i] = renderer-&gt;createImage();
+    }
+}
+
+TextureD3D_2D::~TextureD3D_2D()
+{
+    // Delete the Images before the TextureStorage.
+    // Images might be relying on the TextureStorage for some of their data.
+    // If TextureStorage is deleted before the Images, then their data will be wastefully copied back from the GPU before we delete the Images.
+    for (int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+    {
+        delete mImageArray[i];
+    }
+
+    SafeDelete(mTexStorage);
+}
+
+ImageD3D *TextureD3D_2D::getImage(int level, int layer) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(layer == 0);
+    return mImageArray[level];
+}
+
+ImageD3D *TextureD3D_2D::getImage(const gl::ImageIndex &amp;index) const
+{
+    ASSERT(index.mipIndex &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(!index.hasLayer());
+    ASSERT(index.type == GL_TEXTURE_2D);
+    return mImageArray[index.mipIndex];
+}
+
+GLsizei TextureD3D_2D::getLayerCount(int level) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    return 1;
+}
+
+GLsizei TextureD3D_2D::getWidth(GLint level) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[level]-&gt;getWidth();
+    else
+        return 0;
+}
+
+GLsizei TextureD3D_2D::getHeight(GLint level) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[level]-&gt;getHeight();
+    else
+        return 0;
+}
+
+GLenum TextureD3D_2D::getInternalFormat(GLint level) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[level]-&gt;getInternalFormat();
+    else
+        return GL_NONE;
+}
+
+bool TextureD3D_2D::isDepth(GLint level) const
+{
+    return gl::GetInternalFormatInfo(getInternalFormat(level)).depthBits &gt; 0;
+}
+
+gl::Error TextureD3D_2D::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                                  const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D &amp;&amp; size.depth == 1);
+
+    GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
+
+    bool fastUnpacked = false;
+
+    redefineImage(level, sizedInternalFormat, size);
+
+    gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+
+    // Attempt a fast gpu copy of the pixel data to the surface
+    if (isFastUnpackable(unpack, sizedInternalFormat) &amp;&amp; isLevelComplete(level))
+    {
+        // Will try to create RT storage if it does not exist
+        RenderTargetD3D *destRenderTarget = NULL;
+        gl::Error error = getRenderTarget(index, &amp;destRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        gl::Box destArea(0, 0, 0, getWidth(level), getHeight(level), 1);
+
+        error = fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // Ensure we don't overwrite our newly initialized data
+        mImageArray[level]-&gt;markClean();
+
+        fastUnpacked = true;
+    }
+
+    if (!fastUnpacked)
+    {
+        gl::Error error = TextureD3D::setImage(index, type, unpack, pixels, 0);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2D::setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                                     const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D &amp;&amp; area.depth == 1 &amp;&amp; area.z == 0);
+
+    if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
+    {
+        UNIMPLEMENTED();
+        return gl::Error(GL_INVALID_OPERATION, &quot;unimplemented pixel store state&quot;);
+    }
+
+    gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+    if (isFastUnpackable(unpack, getInternalFormat(level)) &amp;&amp; isLevelComplete(level))
+    {
+        RenderTargetD3D *renderTarget = NULL;
+        gl::Error error = getRenderTarget(index, &amp;renderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ASSERT(!mImageArray[level]-&gt;isDirty());
+
+        return fastUnpackPixels(unpack, pixels, area, getInternalFormat(level), type, renderTarget);
+    }
+    else
+    {
+        return TextureD3D::subImage(index, area, format, type, unpack, pixels, 0);
+    }
+}
+
+
+gl::Error TextureD3D_2D::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                            const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D &amp;&amp; size.depth == 1);
+
+    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
+    redefineImage(level, internalFormat, size);
+
+    return TextureD3D::setCompressedImage(gl::ImageIndex::Make2D(level), unpack, pixels, 0);
+}
+
+gl::Error TextureD3D_2D::setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                               const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D &amp;&amp; area.depth == 1 &amp;&amp; area.z == 0);
+
+    gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+    gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return commitRegion(index, area);
+}
+
+gl::Error TextureD3D_2D::copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                                   const gl::Framebuffer *source)
+{
+    ASSERT(target == GL_TEXTURE_2D);
+
+    GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, GL_UNSIGNED_BYTE);
+    redefineImage(level, sizedInternalFormat, gl::Extents(sourceArea.width, sourceArea.height, 1));
+
+    gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+    gl::Offset destOffset(0, 0, 0);
+
+    // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
+    // so we should use the non-rendering copy path.
+    if (!canCreateRenderTargetForImage(index) || mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        gl::Error error = mImageArray[level]-&gt;copy(destOffset, sourceArea, source);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+    else
+    {
+        gl::Error error = ensureRenderTarget();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mImageArray[level]-&gt;markClean();
+
+        if (sourceArea.width != 0 &amp;&amp; sourceArea.height != 0 &amp;&amp; isValidLevel(level))
+        {
+            error = mRenderer-&gt;copyImage2D(source, sourceArea, internalFormat, destOffset, mTexStorage, level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2D::copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                                      const gl::Framebuffer *source)
+{
+    ASSERT(target == GL_TEXTURE_2D &amp;&amp; destOffset.z == 0);
+
+    // can only make our texture storage to a render target if level 0 is defined (with a width &amp; height) and
+    // the current level we're copying to is defined (with appropriate format, width &amp; height)
+
+    gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+
+    // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
+    // so we should use the non-rendering copy path.
+    if (!canCreateRenderTargetForImage(index) || mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        gl::Error error = mImageArray[level]-&gt;copy(destOffset, sourceArea, source);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+    else
+    {
+        gl::Error error = ensureRenderTarget();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (isValidLevel(level))
+        {
+            error = updateStorageLevel(level);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            error = mRenderer-&gt;copyImage2D(source, sourceArea,
+                                           gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
+                                           destOffset, mTexStorage, level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2D::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size)
+{
+    ASSERT(GL_TEXTURE_2D &amp;&amp; size.depth == 1);
+
+    for (size_t level = 0; level &lt; levels; level++)
+    {
+        gl::Extents levelSize(std::max(1, size.width &gt;&gt; level),
+                              std::max(1, size.height &gt;&gt; level),
+                              1);
+        mImageArray[level]-&gt;redefine(GL_TEXTURE_2D, internalFormat, levelSize, true);
+    }
+
+    for (int level = levels; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        mImageArray[level]-&gt;redefine(GL_TEXTURE_2D, GL_NONE, gl::Extents(0, 0, 0), true);
+    }
+
+    // TODO(geofflang): Verify storage creation had no errors
+    bool renderTarget = IsRenderTargetUsage(mUsage);
+    TextureStorage *storage = mRenderer-&gt;createTextureStorage2D(internalFormat, renderTarget, size.width, size.height, levels, false);
+
+    gl::Error error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    error = updateStorage();
+
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mImmutable = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureD3D_2D::bindTexImage(egl::Surface *surface)
+{
+    GLenum internalformat = surface-&gt;getConfig()-&gt;renderTargetFormat;
+
+    gl::Extents size(surface-&gt;getWidth(), surface-&gt;getHeight(), 1);
+    mImageArray[0]-&gt;redefine(GL_TEXTURE_2D, internalformat, size, true);
+
+    if (mTexStorage)
+    {
+        SafeDelete(mTexStorage);
+    }
+
+    SurfaceD3D *surfaceD3D = GetImplAs&lt;SurfaceD3D&gt;(surface);
+    ASSERT(surfaceD3D);
+
+    mTexStorage = mRenderer-&gt;createTextureStorage2D(surfaceD3D-&gt;getSwapChain());
+
+    mDirtyImages = true;
+}
+
+void TextureD3D_2D::releaseTexImage()
+{
+    if (mTexStorage)
+    {
+        SafeDelete(mTexStorage);
+    }
+
+    for (int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        mImageArray[i]-&gt;redefine(GL_TEXTURE_2D, GL_NONE, gl::Extents(0, 0, 0), true);
+    }
+}
+
+void TextureD3D_2D::initMipmapsImages()
+{
+    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+    int levelCount = mipLevels();
+    for (int level = 1; level &lt; levelCount; level++)
+    {
+        gl::Extents levelSize(std::max(getBaseLevelWidth() &gt;&gt; level, 1),
+                              std::max(getBaseLevelHeight() &gt;&gt; level, 1),
+                              1);
+
+        redefineImage(level, getBaseLevelInternalFormat(), levelSize);
+    }
+}
+
+unsigned int TextureD3D_2D::getRenderTargetSerial(const gl::ImageIndex &amp;index)
+{
+    ASSERT(!index.hasLayer());
+    return (!ensureRenderTarget().isError() ? mTexStorage-&gt;getRenderTargetSerial(index) : 0);
+}
+
+gl::Error TextureD3D_2D::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    ASSERT(!index.hasLayer());
+
+    // ensure the underlying texture is created
+    gl::Error error = ensureRenderTarget();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = updateStorageLevel(index.mipIndex);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return mTexStorage-&gt;getRenderTarget(index, outRT);
+}
+
+bool TextureD3D_2D::isValidLevel(int level) const
+{
+    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : false);
+}
+
+bool TextureD3D_2D::isLevelComplete(int level) const
+{
+    if (isImmutable())
+    {
+        return true;
+    }
+
+    const ImageD3D *baseImage = getBaseLevelImage();
+
+    GLsizei width = baseImage-&gt;getWidth();
+    GLsizei height = baseImage-&gt;getHeight();
+
+    if (width &lt;= 0 || height &lt;= 0)
+    {
+        return false;
+    }
+
+    // The base image level is complete if the width and height are positive
+    if (level == 0)
+    {
+        return true;
+    }
+
+    ASSERT(level &gt;= 1 &amp;&amp; level &lt;= (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
+    ImageD3D *image = mImageArray[level];
+
+    if (image-&gt;getInternalFormat() != baseImage-&gt;getInternalFormat())
+    {
+        return false;
+    }
+
+    if (image-&gt;getWidth() != std::max(1, width &gt;&gt; level))
+    {
+        return false;
+    }
+
+    if (image-&gt;getHeight() != std::max(1, height &gt;&gt; level))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool TextureD3D_2D::isImageComplete(const gl::ImageIndex &amp;index) const
+{
+    return isLevelComplete(index.mipIndex);
+}
+
+// Constructs a native texture resource from the texture images
+gl::Error TextureD3D_2D::initializeStorage(bool renderTarget)
+{
+    // Only initialize the first time this texture is used as a render target or shader resource
+    if (mTexStorage)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    // do not attempt to create storage for nonexistant data
+    if (!isLevelComplete(0))
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
+
+    TextureStorage *storage = NULL;
+    gl::Error error = createCompleteStorage(createRenderTarget, &amp;storage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    ASSERT(mTexStorage);
+
+    // flush image data to the storage
+    error = updateStorage();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2D::createCompleteStorage(bool renderTarget, TextureStorage **outTexStorage) const
+{
+    GLsizei width = getBaseLevelWidth();
+    GLsizei height = getBaseLevelHeight();
+    GLenum internalFormat = getBaseLevelInternalFormat();
+
+    ASSERT(width &gt; 0 &amp;&amp; height &gt; 0);
+
+    // use existing storage level count, when previously specified by TexStorage*D
+    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(width, height, 1));
+
+    bool hintLevelZeroOnly = false;
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        // If any of the CPU images (levels &gt;= 1) are dirty, then the textureStorage2D should use the mipped texture to begin with.
+        // Otherwise, it should use the level-zero-only texture.
+        hintLevelZeroOnly = true;
+        for (int level = 1; level &lt; levels &amp;&amp; hintLevelZeroOnly; level++)
+        {
+            hintLevelZeroOnly = !(mImageArray[level]-&gt;isDirty() &amp;&amp; isLevelComplete(level));
+        }
+    }
+
+    // TODO(geofflang): Determine if the texture creation succeeded
+    *outTexStorage = mRenderer-&gt;createTextureStorage2D(internalFormat, renderTarget, width, height, levels, hintLevelZeroOnly);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2D::setCompleteTexStorage(TextureStorage *newCompleteTexStorage)
+{
+    if (newCompleteTexStorage &amp;&amp; newCompleteTexStorage-&gt;isManaged())
+    {
+        for (int level = 0; level &lt; newCompleteTexStorage-&gt;getLevelCount(); level++)
+        {
+            gl::Error error = mImageArray[level]-&gt;setManagedSurface2D(newCompleteTexStorage, level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    SafeDelete(mTexStorage);
+    mTexStorage = newCompleteTexStorage;
+
+    mDirtyImages = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2D::updateStorage()
+{
+    ASSERT(mTexStorage != NULL);
+    GLint storageLevels = mTexStorage-&gt;getLevelCount();
+    for (int level = 0; level &lt; storageLevels; level++)
+    {
+        if (mImageArray[level]-&gt;isDirty() &amp;&amp; isLevelComplete(level))
+        {
+            gl::Error error = updateStorageLevel(level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2D::updateStorageLevel(int level)
+{
+    ASSERT(level &lt;= (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
+    ASSERT(isLevelComplete(level));
+
+    if (mImageArray[level]-&gt;isDirty())
+    {
+        gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+        gl::Box region(0, 0, 0, getWidth(level), getHeight(level), 1);
+        gl::Error error = commitRegion(index, region);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureD3D_2D::redefineImage(GLint level, GLenum internalformat, const gl::Extents &amp;size)
+{
+    ASSERT(size.depth == 1);
+
+    // If there currently is a corresponding storage texture image, it has these parameters
+    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
+    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
+    const GLenum storageFormat = getBaseLevelInternalFormat();
+
+    mImageArray[level]-&gt;redefine(GL_TEXTURE_2D, internalformat, size, false);
+
+    if (mTexStorage)
+    {
+        const int storageLevels = mTexStorage-&gt;getLevelCount();
+
+        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
+            size.width != storageWidth ||
+            size.height != storageHeight ||
+            internalformat != storageFormat)   // Discard mismatched storage
+        {
+            for (int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+            {
+                mImageArray[i]-&gt;markDirty();
+            }
+
+            SafeDelete(mTexStorage);
+            mDirtyImages = true;
+        }
+    }
+}
+
+gl::ImageIndexIterator TextureD3D_2D::imageIterator() const
+{
+    return gl::ImageIndexIterator::Make2D(0, mTexStorage-&gt;getLevelCount());
+}
+
+gl::ImageIndex TextureD3D_2D::getImageIndex(GLint mip, GLint /*layer*/) const
+{
+    // &quot;layer&quot; does not apply to 2D Textures.
+    return gl::ImageIndex::Make2D(mip);
+}
+
+bool TextureD3D_2D::isValidIndex(const gl::ImageIndex &amp;index) const
+{
+    return (mTexStorage &amp;&amp; index.type == GL_TEXTURE_2D &amp;&amp;
+            index.mipIndex &gt;= 0 &amp;&amp; index.mipIndex &lt; mTexStorage-&gt;getLevelCount());
+}
+
+TextureD3D_Cube::TextureD3D_Cube(RendererD3D *renderer)
+    : TextureD3D(renderer)
+{
+    for (int i = 0; i &lt; 6; i++)
+    {
+        for (int j = 0; j &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
+        {
+            mImageArray[i][j] = renderer-&gt;createImage();
+        }
+    }
+}
+
+TextureD3D_Cube::~TextureD3D_Cube()
+{
+    // Delete the Images before the TextureStorage.
+    // Images might be relying on the TextureStorage for some of their data.
+    // If TextureStorage is deleted before the Images, then their data will be wastefully copied back from the GPU before we delete the Images.
+    for (int i = 0; i &lt; 6; i++)
+    {
+        for (int j = 0; j &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
+        {
+            SafeDelete(mImageArray[i][j]);
+        }
+    }
+
+    SafeDelete(mTexStorage);
+}
+
+ImageD3D *TextureD3D_Cube::getImage(int level, int layer) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(layer &gt;= 0 &amp;&amp; layer &lt; 6);
+    return mImageArray[layer][level];
+}
+
+ImageD3D *TextureD3D_Cube::getImage(const gl::ImageIndex &amp;index) const
+{
+    ASSERT(index.mipIndex &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(index.layerIndex &gt;= 0 &amp;&amp; index.layerIndex &lt; 6);
+    return mImageArray[index.layerIndex][index.mipIndex];
+}
+
+GLsizei TextureD3D_Cube::getLayerCount(int level) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    return 6;
+}
+
+GLenum TextureD3D_Cube::getInternalFormat(GLint level, GLint layer) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[layer][level]-&gt;getInternalFormat();
+    else
+        return GL_NONE;
+}
+
+bool TextureD3D_Cube::isDepth(GLint level, GLint layer) const
+{
+    return gl::GetInternalFormatInfo(getInternalFormat(level, layer)).depthBits &gt; 0;
+}
+
+gl::Error TextureD3D_Cube::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(size.depth == 1);
+
+    GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
+    gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+
+    redefineImage(index.layerIndex, level, sizedInternalFormat, size);
+
+    return TextureD3D::setImage(index, type, unpack, pixels, 0);
+}
+
+gl::Error TextureD3D_Cube::setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(area.depth == 1 &amp;&amp; area.z == 0);
+
+    gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+    return TextureD3D::subImage(index, area, format, type, unpack, pixels, 0);
+}
+
+gl::Error TextureD3D_Cube::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                              const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(size.depth == 1);
+
+    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
+    size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
+
+    redefineImage(faceIndex, level, internalFormat, size);
+
+    gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+    return TextureD3D::setCompressedImage(index, unpack, pixels, 0);
+}
+
+gl::Error TextureD3D_Cube::setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(area.depth == 1 &amp;&amp; area.z == 0);
+
+    gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+
+    gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return commitRegion(index, area);
+}
+
+gl::Error TextureD3D_Cube::copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                                     const gl::Framebuffer *source)
+{
+    size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
+    GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, GL_UNSIGNED_BYTE);
+
+    gl::Extents size(sourceArea.width, sourceArea.height, 1);
+    redefineImage(faceIndex, level, sizedInternalFormat, size);
+
+    gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+    gl::Offset destOffset(0, 0, 0);
+
+    // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
+    // so we should use the non-rendering copy path.
+    if (!canCreateRenderTargetForImage(index) || mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        gl::Error error = mImageArray[faceIndex][level]-&gt;copy(destOffset, sourceArea, source);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+    else
+    {
+        gl::Error error = ensureRenderTarget();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mImageArray[faceIndex][level]-&gt;markClean();
+
+        ASSERT(size.width == size.height);
+
+        if (size.width &gt; 0 &amp;&amp; isValidFaceLevel(faceIndex, level))
+        {
+            error = mRenderer-&gt;copyImageCube(source, sourceArea, internalFormat, destOffset, mTexStorage, target, level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_Cube::copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                                        const gl::Framebuffer *source)
+{
+    size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target);
+
+    gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+
+    // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders,
+    // so we should use the non-rendering copy path.
+    if (!canCreateRenderTargetForImage(index) || mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        gl::Error error = mImageArray[faceIndex][level]-&gt;copy(destOffset, sourceArea, source);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+    else
+    {
+        gl::Error error = ensureRenderTarget();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (isValidFaceLevel(faceIndex, level))
+        {
+            error = updateStorageFaceLevel(faceIndex, level);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            error = mRenderer-&gt;copyImageCube(source, sourceArea, gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
+                                             destOffset, mTexStorage, target, level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_Cube::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size)
+{
+    ASSERT(size.width == size.height);
+    ASSERT(size.depth == 1);
+
+    for (size_t level = 0; level &lt; levels; level++)
+    {
+        GLsizei mipSize = std::max(1, size.width &gt;&gt; level);
+        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
+        {
+            mImageArray[faceIndex][level]-&gt;redefine(GL_TEXTURE_CUBE_MAP, internalFormat, gl::Extents(mipSize, mipSize, 1), true);
+        }
+    }
+
+    for (int level = levels; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
+        {
+            mImageArray[faceIndex][level]-&gt;redefine(GL_TEXTURE_CUBE_MAP, GL_NONE, gl::Extents(0, 0, 0), true);
+        }
+    }
+
+    // TODO(geofflang): Verify storage creation had no errors
+    bool renderTarget = IsRenderTargetUsage(mUsage);
+
+    TextureStorage *storage = mRenderer-&gt;createTextureStorageCube(internalFormat, renderTarget, size.width, levels, false);
+
+    gl::Error error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    error = updateStorage();
+
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mImmutable = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
+bool TextureD3D_Cube::isCubeComplete() const
+{
+    int    baseWidth  = getBaseLevelWidth();
+    int    baseHeight = getBaseLevelHeight();
+    GLenum baseFormat = getBaseLevelInternalFormat();
+
+    if (baseWidth &lt;= 0 || baseWidth != baseHeight)
+    {
+        return false;
+    }
+
+    for (int faceIndex = 1; faceIndex &lt; 6; faceIndex++)
+    {
+        const ImageD3D &amp;faceBaseImage = *mImageArray[faceIndex][0];
+
+        if (faceBaseImage.getWidth()          != baseWidth  ||
+            faceBaseImage.getHeight()         != baseHeight ||
+            faceBaseImage.getInternalFormat() != baseFormat )
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+void TextureD3D_Cube::bindTexImage(egl::Surface *surface)
+{
+    UNREACHABLE();
+}
+
+void TextureD3D_Cube::releaseTexImage()
+{
+    UNREACHABLE();
+}
+
+
+void TextureD3D_Cube::initMipmapsImages()
+{
+    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+    int levelCount = mipLevels();
+    for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
+    {
+        for (int level = 1; level &lt; levelCount; level++)
+        {
+            int faceLevelSize = (std::max(mImageArray[faceIndex][0]-&gt;getWidth() &gt;&gt; level, 1));
+            redefineImage(faceIndex, level, mImageArray[faceIndex][0]-&gt;getInternalFormat(),
+                          gl::Extents(faceLevelSize, faceLevelSize, 1));
+        }
+    }
+}
+
+unsigned int TextureD3D_Cube::getRenderTargetSerial(const gl::ImageIndex &amp;index)
+{
+    return (!ensureRenderTarget().isError() ? mTexStorage-&gt;getRenderTargetSerial(index) : 0);
+}
+
+gl::Error TextureD3D_Cube::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    ASSERT(gl::IsCubeMapTextureTarget(index.type));
+
+    // ensure the underlying texture is created
+    gl::Error error = ensureRenderTarget();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = updateStorageFaceLevel(index.layerIndex, index.mipIndex);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return mTexStorage-&gt;getRenderTarget(index, outRT);
+}
+
+gl::Error TextureD3D_Cube::initializeStorage(bool renderTarget)
+{
+    // Only initialize the first time this texture is used as a render target or shader resource
+    if (mTexStorage)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    // do not attempt to create storage for nonexistant data
+    if (!isFaceLevelComplete(0, 0))
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
+
+    TextureStorage *storage = NULL;
+    gl::Error error = createCompleteStorage(createRenderTarget, &amp;storage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    ASSERT(mTexStorage);
+
+    // flush image data to the storage
+    error = updateStorage();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_Cube::createCompleteStorage(bool renderTarget, TextureStorage **outTexStorage) const
+{
+    GLsizei size = getBaseLevelWidth();
+
+    ASSERT(size &gt; 0);
+
+    // use existing storage level count, when previously specified by TexStorage*D
+    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(size, size, 1));
+
+    bool hintLevelZeroOnly = false;
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        // If any of the CPU images (levels &gt;= 1) are dirty, then the textureStorage should use the mipped texture to begin with.
+        // Otherwise, it should use the level-zero-only texture.
+        hintLevelZeroOnly = true;
+        for (int faceIndex = 0; faceIndex &lt; 6 &amp;&amp; hintLevelZeroOnly; faceIndex++)
+        {
+            for (int level = 1; level &lt; levels &amp;&amp; hintLevelZeroOnly; level++)
+            {
+                hintLevelZeroOnly = !(mImageArray[faceIndex][level]-&gt;isDirty() &amp;&amp; isFaceLevelComplete(faceIndex, level));
+            }
+        }
+    }
+
+    // TODO (geofflang): detect if storage creation succeeded
+    *outTexStorage = mRenderer-&gt;createTextureStorageCube(getBaseLevelInternalFormat(), renderTarget, size, levels, hintLevelZeroOnly);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_Cube::setCompleteTexStorage(TextureStorage *newCompleteTexStorage)
+{
+    if (newCompleteTexStorage &amp;&amp; newCompleteTexStorage-&gt;isManaged())
+    {
+        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
+        {
+            for (int level = 0; level &lt; newCompleteTexStorage-&gt;getLevelCount(); level++)
+            {
+                gl::Error error = mImageArray[faceIndex][level]-&gt;setManagedSurfaceCube(newCompleteTexStorage, faceIndex, level);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    SafeDelete(mTexStorage);
+    mTexStorage = newCompleteTexStorage;
+
+    mDirtyImages = true;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_Cube::updateStorage()
+{
+    ASSERT(mTexStorage != NULL);
+    GLint storageLevels = mTexStorage-&gt;getLevelCount();
+    for (int face = 0; face &lt; 6; face++)
+    {
+        for (int level = 0; level &lt; storageLevels; level++)
+        {
+            if (mImageArray[face][level]-&gt;isDirty() &amp;&amp; isFaceLevelComplete(face, level))
+            {
+                gl::Error error = updateStorageFaceLevel(face, level);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool TextureD3D_Cube::isValidFaceLevel(int faceIndex, int level) const
+{
+    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : 0);
+}
+
+bool TextureD3D_Cube::isFaceLevelComplete(int faceIndex, int level) const
+{
+    ASSERT(level &gt;= 0 &amp;&amp; faceIndex &lt; 6 &amp;&amp; level &lt; (int)ArraySize(mImageArray[faceIndex]) &amp;&amp; mImageArray[faceIndex][level] != NULL);
+
+    if (isImmutable())
+    {
+        return true;
+    }
+
+    int baseSize = getBaseLevelWidth();
+
+    if (baseSize &lt;= 0)
+    {
+        return false;
+    }
+
+    // &quot;isCubeComplete&quot; checks for base level completeness and we must call that
+    // to determine if any face at level 0 is complete. We omit that check here
+    // to avoid re-checking cube-completeness for every face at level 0.
+    if (level == 0)
+    {
+        return true;
+    }
+
+    // Check that non-zero levels are consistent with the base level.
+    const ImageD3D *faceLevelImage = mImageArray[faceIndex][level];
+
+    if (faceLevelImage-&gt;getInternalFormat() != getBaseLevelInternalFormat())
+    {
+        return false;
+    }
+
+    if (faceLevelImage-&gt;getWidth() != std::max(1, baseSize &gt;&gt; level))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool TextureD3D_Cube::isImageComplete(const gl::ImageIndex &amp;index) const
+{
+    return isFaceLevelComplete(index.layerIndex, index.mipIndex);
+}
+
+gl::Error TextureD3D_Cube::updateStorageFaceLevel(int faceIndex, int level)
+{
+    ASSERT(level &gt;= 0 &amp;&amp; faceIndex &lt; 6 &amp;&amp; level &lt; (int)ArraySize(mImageArray[faceIndex]) &amp;&amp; mImageArray[faceIndex][level] != NULL);
+    ImageD3D *image = mImageArray[faceIndex][level];
+
+    if (image-&gt;isDirty())
+    {
+        GLenum faceTarget = gl::LayerIndexToCubeMapTextureTarget(faceIndex);
+        gl::ImageIndex index = gl::ImageIndex::MakeCube(faceTarget, level);
+        gl::Box region(0, 0, 0, image-&gt;getWidth(), image-&gt;getHeight(), 1);
+        gl::Error error = commitRegion(index, region);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureD3D_Cube::redefineImage(int faceIndex, GLint level, GLenum internalformat, const gl::Extents &amp;size)
+{
+    // If there currently is a corresponding storage texture image, it has these parameters
+    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
+    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
+    const GLenum storageFormat = getBaseLevelInternalFormat();
+
+    mImageArray[faceIndex][level]-&gt;redefine(GL_TEXTURE_CUBE_MAP, internalformat, size, false);
+
+    if (mTexStorage)
+    {
+        const int storageLevels = mTexStorage-&gt;getLevelCount();
+
+        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
+            size.width != storageWidth ||
+            size.height != storageHeight ||
+            internalformat != storageFormat)   // Discard mismatched storage
+        {
+            for (int dirtyLevel = 0; dirtyLevel &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; dirtyLevel++)
+            {
+                for (int dirtyFace = 0; dirtyFace &lt; 6; dirtyFace++)
+                {
+                    mImageArray[dirtyFace][dirtyLevel]-&gt;markDirty();
+                }
+            }
+
+            SafeDelete(mTexStorage);
+
+            mDirtyImages = true;
+        }
+    }
+}
+
+gl::ImageIndexIterator TextureD3D_Cube::imageIterator() const
+{
+    return gl::ImageIndexIterator::MakeCube(0, mTexStorage-&gt;getLevelCount());
+}
+
+gl::ImageIndex TextureD3D_Cube::getImageIndex(GLint mip, GLint layer) const
+{
+    // The &quot;layer&quot; of the image index corresponds to the cube face
+    return gl::ImageIndex::MakeCube(gl::LayerIndexToCubeMapTextureTarget(layer), mip);
+}
+
+bool TextureD3D_Cube::isValidIndex(const gl::ImageIndex &amp;index) const
+{
+    return (mTexStorage &amp;&amp; gl::IsCubeMapTextureTarget(index.type) &amp;&amp;
+            index.mipIndex &gt;= 0 &amp;&amp; index.mipIndex &lt; mTexStorage-&gt;getLevelCount());
+}
+
+TextureD3D_3D::TextureD3D_3D(RendererD3D *renderer)
+    : TextureD3D(renderer)
+{
+    for (int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+    {
+        mImageArray[i] = renderer-&gt;createImage();
+    }
+}
+
+TextureD3D_3D::~TextureD3D_3D()
+{
+    // Delete the Images before the TextureStorage.
+    // Images might be relying on the TextureStorage for some of their data.
+    // If TextureStorage is deleted before the Images, then their data will be wastefully copied back from the GPU before we delete the Images.
+    for (int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
+    {
+        delete mImageArray[i];
+    }
+
+    SafeDelete(mTexStorage);
+}
+
+ImageD3D *TextureD3D_3D::getImage(int level, int layer) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(layer == 0);
+    return mImageArray[level];
+}
+
+ImageD3D *TextureD3D_3D::getImage(const gl::ImageIndex &amp;index) const
+{
+    ASSERT(index.mipIndex &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(!index.hasLayer());
+    ASSERT(index.type == GL_TEXTURE_3D);
+    return mImageArray[index.mipIndex];
+}
+
+GLsizei TextureD3D_3D::getLayerCount(int level) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    return 1;
+}
+
+GLsizei TextureD3D_3D::getWidth(GLint level) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[level]-&gt;getWidth();
+    else
+        return 0;
+}
+
+GLsizei TextureD3D_3D::getHeight(GLint level) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[level]-&gt;getHeight();
+    else
+        return 0;
+}
+
+GLsizei TextureD3D_3D::getDepth(GLint level) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[level]-&gt;getDepth();
+    else
+        return 0;
+}
+
+GLenum TextureD3D_3D::getInternalFormat(GLint level) const
+{
+    if (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+        return mImageArray[level]-&gt;getInternalFormat();
+    else
+        return GL_NONE;
+}
+
+bool TextureD3D_3D::isDepth(GLint level) const
+{
+    return gl::GetInternalFormatInfo(getInternalFormat(level)).depthBits &gt; 0;
+}
+
+gl::Error TextureD3D_3D::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                                  const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_3D);
+    GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
+
+    redefineImage(level, sizedInternalFormat, size);
+
+    bool fastUnpacked = false;
+
+    gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+
+    // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
+    if (isFastUnpackable(unpack, sizedInternalFormat) &amp;&amp; !size.empty())
+    {
+        // Will try to create RT storage if it does not exist
+        RenderTargetD3D *destRenderTarget = NULL;
+        gl::Error error = getRenderTarget(index, &amp;destRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        gl::Box destArea(0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
+
+        error = fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // Ensure we don't overwrite our newly initialized data
+        mImageArray[level]-&gt;markClean();
+
+        fastUnpacked = true;
+    }
+
+    if (!fastUnpacked)
+    {
+        gl::Error error = TextureD3D::setImage(index, type, unpack, pixels, 0);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_3D::setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                                     const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_3D);
+
+    gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+
+    // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
+    if (isFastUnpackable(unpack, getInternalFormat(level)))
+    {
+        RenderTargetD3D *destRenderTarget = NULL;
+        gl::Error error = getRenderTarget(index, &amp;destRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ASSERT(!mImageArray[level]-&gt;isDirty());
+
+        return fastUnpackPixels(unpack, pixels, area, getInternalFormat(level), type, destRenderTarget);
+    }
+    else
+    {
+        return TextureD3D::subImage(index, area, format, type, unpack, pixels, 0);
+    }
+}
+
+gl::Error TextureD3D_3D::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                            const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_3D);
+
+    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
+    redefineImage(level, internalFormat, size);
+
+    gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+    return TextureD3D::setCompressedImage(index, unpack, pixels, 0);
+}
+
+gl::Error TextureD3D_3D::setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                               const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_3D);
+
+    gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+    gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return commitRegion(index, area);
+}
+
+gl::Error TextureD3D_3D::copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                                   const gl::Framebuffer *source)
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION, &quot;Copying 3D textures is unimplemented.&quot;);
+}
+
+gl::Error TextureD3D_3D::copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                                      const gl::Framebuffer *source)
+{
+    ASSERT(target == GL_TEXTURE_3D);
+
+    gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+
+    if (canCreateRenderTargetForImage(index))
+    {
+        gl::Error error = mImageArray[level]-&gt;copy(destOffset, sourceArea, source);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+    else
+    {
+        gl::Error error = ensureRenderTarget();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (isValidLevel(level))
+        {
+            error = updateStorageLevel(level);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            error = mRenderer-&gt;copyImage3D(source, sourceArea,
+                                           gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
+                                           destOffset, mTexStorage, level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_3D::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size)
+{
+    ASSERT(target == GL_TEXTURE_3D);
+
+    for (size_t level = 0; level &lt; levels; level++)
+    {
+        gl::Extents levelSize(std::max(1, size.width &gt;&gt; level),
+                              std::max(1, size.height &gt;&gt; level),
+                              std::max(1, size.depth &gt;&gt; level));
+        mImageArray[level]-&gt;redefine(GL_TEXTURE_3D, internalFormat, levelSize, true);
+    }
+
+    for (int level = levels; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        mImageArray[level]-&gt;redefine(GL_TEXTURE_3D, GL_NONE, gl::Extents(0, 0, 0), true);
+    }
+
+    // TODO(geofflang): Verify storage creation had no errors
+    bool renderTarget = IsRenderTargetUsage(mUsage);
+    TextureStorage *storage = mRenderer-&gt;createTextureStorage3D(internalFormat, renderTarget, size.width, size.height, size.depth, levels);
+
+    gl::Error error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    error = updateStorage();
+
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mImmutable = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureD3D_3D::bindTexImage(egl::Surface *surface)
+{
+    UNREACHABLE();
+}
+
+void TextureD3D_3D::releaseTexImage()
+{
+    UNREACHABLE();
+}
+
+
+void TextureD3D_3D::initMipmapsImages()
+{
+    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+    int levelCount = mipLevels();
+    for (int level = 1; level &lt; levelCount; level++)
+    {
+        gl::Extents levelSize(std::max(getBaseLevelWidth() &gt;&gt; level, 1),
+                              std::max(getBaseLevelHeight() &gt;&gt; level, 1),
+                              std::max(getBaseLevelDepth() &gt;&gt; level, 1));
+        redefineImage(level, getBaseLevelInternalFormat(), levelSize);
+    }
+}
+
+unsigned int TextureD3D_3D::getRenderTargetSerial(const gl::ImageIndex &amp;index)
+{
+    return (!ensureRenderTarget().isError() ? mTexStorage-&gt;getRenderTargetSerial(index) : 0);
+}
+
+gl::Error TextureD3D_3D::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    // ensure the underlying texture is created
+    gl::Error error = ensureRenderTarget();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (index.hasLayer())
+    {
+        error = updateStorage();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+    else
+    {
+        error = updateStorageLevel(index.mipIndex);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return mTexStorage-&gt;getRenderTarget(index, outRT);
+}
+
+gl::Error TextureD3D_3D::initializeStorage(bool renderTarget)
+{
+    // Only initialize the first time this texture is used as a render target or shader resource
+    if (mTexStorage)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    // do not attempt to create storage for nonexistant data
+    if (!isLevelComplete(0))
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
+
+    TextureStorage *storage = NULL;
+    gl::Error error = createCompleteStorage(createRenderTarget, &amp;storage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    ASSERT(mTexStorage);
+
+    // flush image data to the storage
+    error = updateStorage();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_3D::createCompleteStorage(bool renderTarget, TextureStorage **outStorage) const
+{
+    GLsizei width = getBaseLevelWidth();
+    GLsizei height = getBaseLevelHeight();
+    GLsizei depth = getBaseLevelDepth();
+    GLenum internalFormat = getBaseLevelInternalFormat();
+
+    ASSERT(width &gt; 0 &amp;&amp; height &gt; 0 &amp;&amp; depth &gt; 0);
+
+    // use existing storage level count, when previously specified by TexStorage*D
+    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(width, height, depth));
+
+    // TODO: Verify creation of the storage succeeded
+    *outStorage = mRenderer-&gt;createTextureStorage3D(internalFormat, renderTarget, width, height, depth, levels);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_3D::setCompleteTexStorage(TextureStorage *newCompleteTexStorage)
+{
+    SafeDelete(mTexStorage);
+    mTexStorage = newCompleteTexStorage;
+    mDirtyImages = true;
+
+    // We do not support managed 3D storage, as that is D3D9/ES2-only
+    ASSERT(!mTexStorage-&gt;isManaged());
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_3D::updateStorage()
+{
+    ASSERT(mTexStorage != NULL);
+    GLint storageLevels = mTexStorage-&gt;getLevelCount();
+    for (int level = 0; level &lt; storageLevels; level++)
+    {
+        if (mImageArray[level]-&gt;isDirty() &amp;&amp; isLevelComplete(level))
+        {
+            gl::Error error = updateStorageLevel(level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool TextureD3D_3D::isValidLevel(int level) const
+{
+    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : 0);
+}
+
+bool TextureD3D_3D::isLevelComplete(int level) const
+{
+    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
+
+    if (isImmutable())
+    {
+        return true;
+    }
+
+    GLsizei width = getBaseLevelWidth();
+    GLsizei height = getBaseLevelHeight();
+    GLsizei depth = getBaseLevelDepth();
+
+    if (width &lt;= 0 || height &lt;= 0 || depth &lt;= 0)
+    {
+        return false;
+    }
+
+    if (level == 0)
+    {
+        return true;
+    }
+
+    ImageD3D *levelImage = mImageArray[level];
+
+    if (levelImage-&gt;getInternalFormat() != getBaseLevelInternalFormat())
+    {
+        return false;
+    }
+
+    if (levelImage-&gt;getWidth() != std::max(1, width &gt;&gt; level))
+    {
+        return false;
+    }
+
+    if (levelImage-&gt;getHeight() != std::max(1, height &gt;&gt; level))
+    {
+        return false;
+    }
+
+    if (levelImage-&gt;getDepth() != std::max(1, depth &gt;&gt; level))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool TextureD3D_3D::isImageComplete(const gl::ImageIndex &amp;index) const
+{
+    return isLevelComplete(index.mipIndex);
+}
+
+gl::Error TextureD3D_3D::updateStorageLevel(int level)
+{
+    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
+    ASSERT(isLevelComplete(level));
+
+    if (mImageArray[level]-&gt;isDirty())
+    {
+        gl::ImageIndex index = gl::ImageIndex::Make3D(level);
+        gl::Box region(0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
+        gl::Error error = commitRegion(index, region);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureD3D_3D::redefineImage(GLint level, GLenum internalformat, const gl::Extents &amp;size)
+{
+    // If there currently is a corresponding storage texture image, it has these parameters
+    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
+    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
+    const int storageDepth = std::max(1, getBaseLevelDepth() &gt;&gt; level);
+    const GLenum storageFormat = getBaseLevelInternalFormat();
+
+    mImageArray[level]-&gt;redefine(GL_TEXTURE_3D, internalformat, size, false);
+
+    if (mTexStorage)
+    {
+        const int storageLevels = mTexStorage-&gt;getLevelCount();
+
+        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
+            size.width != storageWidth ||
+            size.height != storageHeight ||
+            size.depth != storageDepth ||
+            internalformat != storageFormat)   // Discard mismatched storage
+        {
+            for (int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+            {
+                mImageArray[i]-&gt;markDirty();
+            }
+
+            SafeDelete(mTexStorage);
+            mDirtyImages = true;
+        }
+    }
+}
+
+gl::ImageIndexIterator TextureD3D_3D::imageIterator() const
+{
+    return gl::ImageIndexIterator::Make3D(0, mTexStorage-&gt;getLevelCount(),
+                                          gl::ImageIndex::ENTIRE_LEVEL, gl::ImageIndex::ENTIRE_LEVEL);
+}
+
+gl::ImageIndex TextureD3D_3D::getImageIndex(GLint mip, GLint /*layer*/) const
+{
+    // The &quot;layer&quot; here does not apply to 3D images. We use one Image per mip.
+    return gl::ImageIndex::Make3D(mip);
+}
+
+bool TextureD3D_3D::isValidIndex(const gl::ImageIndex &amp;index) const
+{
+    return (mTexStorage &amp;&amp; index.type == GL_TEXTURE_3D &amp;&amp;
+            index.mipIndex &gt;= 0 &amp;&amp; index.mipIndex &lt; mTexStorage-&gt;getLevelCount());
+}
+
+TextureD3D_2DArray::TextureD3D_2DArray(RendererD3D *renderer)
+    : TextureD3D(renderer)
+{
+    for (int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
+    {
+        mLayerCounts[level] = 0;
+        mImageArray[level] = NULL;
+    }
+}
+
+TextureD3D_2DArray::~TextureD3D_2DArray()
+{
+    // Delete the Images before the TextureStorage.
+    // Images might be relying on the TextureStorage for some of their data.
+    // If TextureStorage is deleted before the Images, then their data will be wastefully copied back from the GPU before we delete the Images.
+    deleteImages();
+    SafeDelete(mTexStorage);
+}
+
+ImageD3D *TextureD3D_2DArray::getImage(int level, int layer) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT((layer == 0 &amp;&amp; mLayerCounts[level] == 0) ||
+           layer &lt; mLayerCounts[level]);
+    return (mImageArray[level] ? mImageArray[level][layer] : NULL);
+}
+
+ImageD3D *TextureD3D_2DArray::getImage(const gl::ImageIndex &amp;index) const
+{
+    ASSERT(index.mipIndex &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT((index.layerIndex == 0 &amp;&amp; mLayerCounts[index.mipIndex] == 0) ||
+           index.layerIndex &lt; mLayerCounts[index.mipIndex]);
+    ASSERT(index.type == GL_TEXTURE_2D_ARRAY);
+    return (mImageArray[index.mipIndex] ? mImageArray[index.mipIndex][index.layerIndex] : NULL);
+}
+
+GLsizei TextureD3D_2DArray::getLayerCount(int level) const
+{
+    ASSERT(level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    return mLayerCounts[level];
+}
+
+GLsizei TextureD3D_2DArray::getWidth(GLint level) const
+{
+    return (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mImageArray[level][0]-&gt;getWidth() : 0;
+}
+
+GLsizei TextureD3D_2DArray::getHeight(GLint level) const
+{
+    return (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mImageArray[level][0]-&gt;getHeight() : 0;
+}
+
+GLenum TextureD3D_2DArray::getInternalFormat(GLint level) const
+{
+    return (level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mImageArray[level][0]-&gt;getInternalFormat() : GL_NONE;
+}
+
+bool TextureD3D_2DArray::isDepth(GLint level) const
+{
+    return gl::GetInternalFormatInfo(getInternalFormat(level)).depthBits &gt; 0;
+}
+
+gl::Error TextureD3D_2DArray::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D_ARRAY);
+
+    GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
+
+    redefineImage(level, sizedInternalFormat, size);
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
+    GLsizei inputDepthPitch = formatInfo.computeDepthPitch(type, size.width, size.height, unpack.alignment, unpack.rowLength);
+
+    for (int i = 0; i &lt; size.depth; i++)
+    {
+        const ptrdiff_t layerOffset = (inputDepthPitch * i);
+        gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, i);
+        gl::Error error = TextureD3D::setImage(index, type, unpack, pixels, layerOffset);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                                          const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D_ARRAY);
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(getInternalFormat(level));
+    GLsizei inputDepthPitch = formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment, unpack.rowLength);
+
+    for (int i = 0; i &lt; area.depth; i++)
+    {
+        int layer = area.z + i;
+        const ptrdiff_t layerOffset = (inputDepthPitch * i);
+
+        gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1);
+
+        gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
+        gl::Error error = TextureD3D::subImage(index, layerArea, format, type, unpack, pixels, layerOffset);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D_ARRAY);
+
+    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
+    redefineImage(level, internalFormat, size);
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalFormat);
+    GLsizei inputDepthPitch = formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height, 1, 0);
+
+    for (int i = 0; i &lt; size.depth; i++)
+    {
+        const ptrdiff_t layerOffset = (inputDepthPitch * i);
+
+        gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, i);
+        gl::Error error = TextureD3D::setCompressedImage(index, unpack, pixels, layerOffset);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(target == GL_TEXTURE_2D_ARRAY);
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(format);
+    GLsizei inputDepthPitch = formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0);
+
+    for (int i = 0; i &lt; area.depth; i++)
+    {
+        int layer = area.z + i;
+        const ptrdiff_t layerOffset = (inputDepthPitch * i);
+
+        gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1);
+
+        gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
+        gl::Error error = TextureD3D::subImageCompressed(index, layerArea, format, unpack, pixels, layerOffset);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        error = commitRegion(index, layerArea);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                                        const gl::Framebuffer *source)
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION, &quot;Copying 2D array textures is unimplemented.&quot;);
+}
+
+gl::Error TextureD3D_2DArray::copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                                           const gl::Framebuffer *source)
+{
+    ASSERT(target == GL_TEXTURE_2D_ARRAY);
+
+    gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z);
+
+    if (canCreateRenderTargetForImage(index))
+    {
+        gl::Offset destLayerOffset(destOffset.x, destOffset.y, 0);
+        gl::Error error = mImageArray[level][destOffset.z]-&gt;copy(destLayerOffset, sourceArea, source);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDirtyImages = true;
+    }
+    else
+    {
+        gl::Error error = ensureRenderTarget();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (isValidLevel(level))
+        {
+            error = updateStorageLevel(level);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            error = mRenderer-&gt;copyImage2DArray(source, sourceArea, gl::GetInternalFormatInfo(getInternalFormat(0)).format,
+                                                destOffset, mTexStorage, level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size)
+{
+    ASSERT(target == GL_TEXTURE_2D_ARRAY);
+
+    deleteImages();
+
+    for (size_t level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        gl::Extents levelLayerSize(std::max(1, size.width &gt;&gt; level),
+                                   std::max(1, size.height &gt;&gt; level),
+                                   1);
+
+        mLayerCounts[level] = (level &lt; levels ? size.depth : 0);
+
+        if (mLayerCounts[level] &gt; 0)
+        {
+            // Create new images for this level
+            mImageArray[level] = new ImageD3D*[mLayerCounts[level]];
+
+            for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
+            {
+                mImageArray[level][layer] = mRenderer-&gt;createImage();
+                mImageArray[level][layer]-&gt;redefine(GL_TEXTURE_2D_ARRAY, internalFormat, levelLayerSize, true);
+            }
+        }
+    }
+
+    // TODO(geofflang): Verify storage creation had no errors
+    bool renderTarget = IsRenderTargetUsage(mUsage);
+    TextureStorage *storage = mRenderer-&gt;createTextureStorage2DArray(internalFormat, renderTarget, size.width, size.height, size.depth, levels);
+
+    gl::Error error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    error = updateStorage();
+
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mImmutable = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureD3D_2DArray::bindTexImage(egl::Surface *surface)
+{
+    UNREACHABLE();
+}
+
+void TextureD3D_2DArray::releaseTexImage()
+{
+    UNREACHABLE();
+}
+
+
+void TextureD3D_2DArray::initMipmapsImages()
+{
+    int baseWidth = getBaseLevelWidth();
+    int baseHeight = getBaseLevelHeight();
+    int baseDepth = getLayerCount(0);
+    GLenum baseFormat = getBaseLevelInternalFormat();
+
+    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
+    int levelCount = mipLevels();
+    for (int level = 1; level &lt; levelCount; level++)
+    {
+        gl::Extents levelLayerSize(std::max(baseWidth &gt;&gt; level, 1),
+                                   std::max(baseHeight &gt;&gt; level, 1),
+                                   baseDepth);
+        redefineImage(level, baseFormat, levelLayerSize);
+    }
+}
+
+unsigned int TextureD3D_2DArray::getRenderTargetSerial(const gl::ImageIndex &amp;index)
+{
+    return (!ensureRenderTarget().isError() ? mTexStorage-&gt;getRenderTargetSerial(index) : 0);
+}
+
+gl::Error TextureD3D_2DArray::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    // ensure the underlying texture is created
+    gl::Error error = ensureRenderTarget();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = updateStorageLevel(index.mipIndex);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return mTexStorage-&gt;getRenderTarget(index, outRT);
+}
+
+gl::Error TextureD3D_2DArray::initializeStorage(bool renderTarget)
+{
+    // Only initialize the first time this texture is used as a render target or shader resource
+    if (mTexStorage)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    // do not attempt to create storage for nonexistant data
+    if (!isLevelComplete(0))
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
+
+    TextureStorage *storage = NULL;
+    gl::Error error = createCompleteStorage(createRenderTarget, &amp;storage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = setCompleteTexStorage(storage);
+    if (error.isError())
+    {
+        SafeDelete(storage);
+        return error;
+    }
+
+    ASSERT(mTexStorage);
+
+    // flush image data to the storage
+    error = updateStorage();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::createCompleteStorage(bool renderTarget, TextureStorage **outStorage) const
+{
+    GLsizei width = getBaseLevelWidth();
+    GLsizei height = getBaseLevelHeight();
+    GLsizei depth = getLayerCount(0);
+    GLenum internalFormat = getBaseLevelInternalFormat();
+
+    ASSERT(width &gt; 0 &amp;&amp; height &gt; 0 &amp;&amp; depth &gt; 0);
+
+    // use existing storage level count, when previously specified by TexStorage*D
+    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(width, height, 1));
+
+    // TODO(geofflang): Verify storage creation succeeds
+    *outStorage = mRenderer-&gt;createTextureStorage2DArray(internalFormat, renderTarget, width, height, depth, levels);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::setCompleteTexStorage(TextureStorage *newCompleteTexStorage)
+{
+    SafeDelete(mTexStorage);
+    mTexStorage = newCompleteTexStorage;
+    mDirtyImages = true;
+
+    // We do not support managed 2D array storage, as managed storage is ES2/D3D9 only
+    ASSERT(!mTexStorage-&gt;isManaged());
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureD3D_2DArray::updateStorage()
+{
+    ASSERT(mTexStorage != NULL);
+    GLint storageLevels = mTexStorage-&gt;getLevelCount();
+    for (int level = 0; level &lt; storageLevels; level++)
+    {
+        if (isLevelComplete(level))
+        {
+            gl::Error error = updateStorageLevel(level);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool TextureD3D_2DArray::isValidLevel(int level) const
+{
+    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : 0);
+}
+
+bool TextureD3D_2DArray::isLevelComplete(int level) const
+{
+    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mImageArray));
+
+    if (isImmutable())
+    {
+        return true;
+    }
+
+    GLsizei width = getBaseLevelWidth();
+    GLsizei height = getBaseLevelHeight();
+    GLsizei layers = getLayerCount(0);
+
+    if (width &lt;= 0 || height &lt;= 0 || layers &lt;= 0)
+    {
+        return false;
+    }
+
+    if (level == 0)
+    {
+        return true;
+    }
+
+    if (getInternalFormat(level) != getInternalFormat(0))
+    {
+        return false;
+    }
+
+    if (getWidth(level) != std::max(1, width &gt;&gt; level))
+    {
+        return false;
+    }
+
+    if (getHeight(level) != std::max(1, height &gt;&gt; level))
+    {
+        return false;
+    }
+
+    if (getLayerCount(level) != layers)
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool TextureD3D_2DArray::isImageComplete(const gl::ImageIndex &amp;index) const
+{
+    return isLevelComplete(index.mipIndex);
+}
+
+gl::Error TextureD3D_2DArray::updateStorageLevel(int level)
+{
+    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mLayerCounts));
+    ASSERT(isLevelComplete(level));
+
+    for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
+    {
+        ASSERT(mImageArray[level] != NULL &amp;&amp; mImageArray[level][layer] != NULL);
+        if (mImageArray[level][layer]-&gt;isDirty())
+        {
+            gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
+            gl::Box region(0, 0, 0, getWidth(level), getHeight(level), 1);
+            gl::Error error = commitRegion(index, region);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureD3D_2DArray::deleteImages()
+{
+    for (int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
+    {
+        for (int layer = 0; layer &lt; mLayerCounts[level]; ++layer)
+        {
+            delete mImageArray[level][layer];
+        }
+        delete[] mImageArray[level];
+        mImageArray[level] = NULL;
+        mLayerCounts[level] = 0;
+    }
+}
+
+void TextureD3D_2DArray::redefineImage(GLint level, GLenum internalformat, const gl::Extents &amp;size)
+{
+    // If there currently is a corresponding storage texture image, it has these parameters
+    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
+    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
+    const int storageDepth = getLayerCount(0);
+    const GLenum storageFormat = getBaseLevelInternalFormat();
+
+    for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
+    {
+        delete mImageArray[level][layer];
+    }
+    delete[] mImageArray[level];
+    mImageArray[level] = NULL;
+    mLayerCounts[level] = size.depth;
+
+    if (size.depth &gt; 0)
+    {
+        mImageArray[level] = new ImageD3D*[size.depth]();
+
+        for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
+        {
+            mImageArray[level][layer] = mRenderer-&gt;createImage();
+            mImageArray[level][layer]-&gt;redefine(GL_TEXTURE_2D_ARRAY, internalformat,
+                                                gl::Extents(size.width, size.height, 1), false);
+        }
+    }
+
+    if (mTexStorage)
+    {
+        const int storageLevels = mTexStorage-&gt;getLevelCount();
+
+        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
+            size.width != storageWidth ||
+            size.height != storageHeight ||
+            size.depth != storageDepth ||
+            internalformat != storageFormat)   // Discard mismatched storage
+        {
+            for (int dirtyLevel = 0; dirtyLevel &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; dirtyLevel++)
+            {
+                for (int dirtyLayer = 0; dirtyLayer &lt; mLayerCounts[dirtyLevel]; dirtyLayer++)
+                {
+                    mImageArray[dirtyLevel][dirtyLayer]-&gt;markDirty();
+                }
+            }
+
+            delete mTexStorage;
+            mTexStorage = NULL;
+            mDirtyImages = true;
+        }
+    }
+}
+
+gl::ImageIndexIterator TextureD3D_2DArray::imageIterator() const
+{
+    return gl::ImageIndexIterator::Make2DArray(0, mTexStorage-&gt;getLevelCount(), mLayerCounts);
+}
+
+gl::ImageIndex TextureD3D_2DArray::getImageIndex(GLint mip, GLint layer) const
+{
+    return gl::ImageIndex::Make2DArray(mip, layer);
+}
+
+bool TextureD3D_2DArray::isValidIndex(const gl::ImageIndex &amp;index) const
+{
+    // Check for having a storage and the right type of index
+    if (!mTexStorage || index.type != GL_TEXTURE_2D_ARRAY)
+    {
+        return false;
+    }
+
+    // Check the mip index
+    if (index.mipIndex &lt; 0 || index.mipIndex &gt;= mTexStorage-&gt;getLevelCount())
+    {
+        return false;
+    }
+
+    // Check the layer index
+    return (!index.hasLayer() || (index.layerIndex &gt;= 0 &amp;&amp; index.layerIndex &lt; mLayerCounts[index.mipIndex]));
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,369 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// TextureD3D.h: Implementations of the Texture interfaces shared betweeen the D3D backends.
+
+#ifndef LIBANGLE_RENDERER_D3D_TEXTURED3D_H_
+#define LIBANGLE_RENDERER_D3D_TEXTURED3D_H_
+
+#include &quot;libANGLE/renderer/TextureImpl.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Constants.h&quot;
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace rx
+{
+
+class ImageD3D;
+class ImageD3D;
+class RendererD3D;
+class RenderTargetD3D;
+class TextureStorage;
+
+class TextureD3D : public TextureImpl
+{
+  public:
+    TextureD3D(RendererD3D *renderer);
+    virtual ~TextureD3D();
+
+    gl::Error getNativeTexture(TextureStorage **outStorage);
+
+    virtual void setUsage(GLenum usage) { mUsage = usage; }
+    bool hasDirtyImages() const { return mDirtyImages; }
+    void resetDirty() { mDirtyImages = false; }
+
+    virtual ImageD3D *getImage(const gl::ImageIndex &amp;index) const = 0;
+    virtual GLsizei getLayerCount(int level) const = 0;
+
+    GLint getBaseLevelWidth() const;
+    GLint getBaseLevelHeight() const;
+    GLint getBaseLevelDepth() const;
+    GLenum getBaseLevelInternalFormat() const;
+
+    bool isImmutable() const { return mImmutable; }
+
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT) = 0;
+    virtual unsigned int getRenderTargetSerial(const gl::ImageIndex &amp;index) = 0;
+
+    // Returns an iterator over all &quot;Images&quot; for this particular Texture.
+    virtual gl::ImageIndexIterator imageIterator() const = 0;
+
+    // Returns an ImageIndex for a particular &quot;Image&quot;. 3D Textures do not have images for
+    // slices of their depth texures, so 3D textures ignore the layer parameter.
+    virtual gl::ImageIndex getImageIndex(GLint mip, GLint layer) const = 0;
+    virtual bool isValidIndex(const gl::ImageIndex &amp;index) const = 0;
+
+    virtual gl::Error generateMipmaps(const gl::SamplerState &amp;samplerState);
+    TextureStorage *getStorage();
+    ImageD3D *getBaseLevelImage() const;
+
+    gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                        FramebufferAttachmentRenderTarget **rtOut) override;
+
+  protected:
+    gl::Error setImage(const gl::ImageIndex &amp;index, GLenum type,
+                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels,
+                       ptrdiff_t layerOffset);
+    gl::Error subImage(const gl::ImageIndex &amp;index, const gl::Box &amp;area, GLenum format, GLenum type,
+                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels, ptrdiff_t layerOffset);
+    gl::Error setCompressedImage(const gl::ImageIndex &amp;index, const gl::PixelUnpackState &amp;unpack,
+                                 const uint8_t *pixels, ptrdiff_t layerOffset);
+    gl::Error subImageCompressed(const gl::ImageIndex &amp;index, const gl::Box &amp;area, GLenum format,
+                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels, ptrdiff_t layerOffset);
+    bool isFastUnpackable(const gl::PixelUnpackState &amp;unpack, GLenum sizedInternalFormat);
+    gl::Error fastUnpackPixels(const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels, const gl::Box &amp;destArea,
+                               GLenum sizedInternalFormat, GLenum type, RenderTargetD3D *destRenderTarget);
+
+    GLint creationLevels(GLsizei width, GLsizei height, GLsizei depth) const;
+    int mipLevels() const;
+    virtual void initMipmapsImages() = 0;
+    bool isBaseImageZeroSize() const;
+    virtual bool isImageComplete(const gl::ImageIndex &amp;index) const = 0;
+
+    bool canCreateRenderTargetForImage(const gl::ImageIndex &amp;index) const;
+    virtual gl::Error ensureRenderTarget();
+
+    virtual gl::Error createCompleteStorage(bool renderTarget, TextureStorage **outTexStorage) const = 0;
+    virtual gl::Error setCompleteTexStorage(TextureStorage *newCompleteTexStorage) = 0;
+    gl::Error commitRegion(const gl::ImageIndex &amp;index, const gl::Box &amp;region);
+
+    RendererD3D *mRenderer;
+
+    GLenum mUsage;
+
+    bool mDirtyImages;
+
+    bool mImmutable;
+    TextureStorage *mTexStorage;
+
+  private:
+    virtual gl::Error initializeStorage(bool renderTarget) = 0;
+
+    virtual gl::Error updateStorage() = 0;
+
+    bool shouldUseSetData(const ImageD3D *image) const;
+
+    gl::Error generateMipmapsUsingImages();
+};
+
+class TextureD3D_2D : public TextureD3D
+{
+  public:
+    TextureD3D_2D(RendererD3D *renderer);
+    virtual ~TextureD3D_2D();
+
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &amp;index) const;
+    virtual GLsizei getLayerCount(int level) const;
+
+    GLsizei getWidth(GLint level) const;
+    GLsizei getHeight(GLint level) const;
+    GLenum getInternalFormat(GLint level) const;
+    bool isDepth(GLint level) const;
+
+    gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                          const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                        const gl::Framebuffer *source) override;
+    gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                           const gl::Framebuffer *source) override;
+
+    gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size) override;
+
+    virtual void bindTexImage(egl::Surface *surface);
+    virtual void releaseTexImage();
+
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+    virtual unsigned int getRenderTargetSerial(const gl::ImageIndex &amp;index);
+
+    virtual gl::ImageIndexIterator imageIterator() const;
+    virtual gl::ImageIndex getImageIndex(GLint mip, GLint layer) const;
+    virtual bool isValidIndex(const gl::ImageIndex &amp;index) const;
+
+  private:
+    virtual gl::Error initializeStorage(bool renderTarget);
+    virtual gl::Error createCompleteStorage(bool renderTarget, TextureStorage **outTexStorage) const;
+    virtual gl::Error setCompleteTexStorage(TextureStorage *newCompleteTexStorage);
+
+    virtual gl::Error updateStorage();
+    virtual void initMipmapsImages();
+
+    bool isValidLevel(int level) const;
+    bool isLevelComplete(int level) const;
+    virtual bool isImageComplete(const gl::ImageIndex &amp;index) const;
+
+    gl::Error updateStorageLevel(int level);
+
+    void redefineImage(GLint level, GLenum internalformat, const gl::Extents &amp;size);
+
+    ImageD3D *mImageArray[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureD3D_Cube : public TextureD3D
+{
+  public:
+    TextureD3D_Cube(RendererD3D *renderer);
+    virtual ~TextureD3D_Cube();
+
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &amp;index) const;
+    virtual GLsizei getLayerCount(int level) const;
+
+    virtual bool hasDirtyImages() const { return mDirtyImages; }
+    virtual void resetDirty() { mDirtyImages = false; }
+    virtual void setUsage(GLenum usage) { mUsage = usage; }
+
+    GLenum getInternalFormat(GLint level, GLint layer) const;
+    bool isDepth(GLint level, GLint layer) const;
+
+    gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                          const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                        const gl::Framebuffer *source) override;
+    gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                           const gl::Framebuffer *source) override;
+
+    gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size) override;
+
+    virtual void bindTexImage(egl::Surface *surface);
+    virtual void releaseTexImage();
+
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+    virtual unsigned int getRenderTargetSerial(const gl::ImageIndex &amp;index);
+
+    virtual gl::ImageIndexIterator imageIterator() const;
+    virtual gl::ImageIndex getImageIndex(GLint mip, GLint layer) const;
+    virtual bool isValidIndex(const gl::ImageIndex &amp;index) const;
+
+  private:
+    virtual gl::Error initializeStorage(bool renderTarget);
+    virtual gl::Error createCompleteStorage(bool renderTarget, TextureStorage **outTexStorage) const;
+    virtual gl::Error setCompleteTexStorage(TextureStorage *newCompleteTexStorage);
+
+    virtual gl::Error updateStorage();
+    virtual void initMipmapsImages();
+
+    bool isValidFaceLevel(int faceIndex, int level) const;
+    bool isFaceLevelComplete(int faceIndex, int level) const;
+    bool isCubeComplete() const;
+    virtual bool isImageComplete(const gl::ImageIndex &amp;index) const;
+    gl::Error updateStorageFaceLevel(int faceIndex, int level);
+
+    void redefineImage(int faceIndex, GLint level, GLenum internalformat, const gl::Extents &amp;size);
+
+    ImageD3D *mImageArray[6][gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureD3D_3D : public TextureD3D
+{
+  public:
+    TextureD3D_3D(RendererD3D *renderer);
+    virtual ~TextureD3D_3D();
+
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &amp;index) const;
+    virtual GLsizei getLayerCount(int level) const;
+
+    GLsizei getWidth(GLint level) const;
+    GLsizei getHeight(GLint level) const;
+    GLsizei getDepth(GLint level) const;
+    GLenum getInternalFormat(GLint level) const;
+    bool isDepth(GLint level) const;
+
+    gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                          const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                        const gl::Framebuffer *source) override;
+    gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                           const gl::Framebuffer *source) override;
+
+    gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size) override;
+
+    virtual void bindTexImage(egl::Surface *surface);
+    virtual void releaseTexImage();
+
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+    virtual unsigned int getRenderTargetSerial(const gl::ImageIndex &amp;index);
+
+    virtual gl::ImageIndexIterator imageIterator() const;
+    virtual gl::ImageIndex getImageIndex(GLint mip, GLint layer) const;
+    virtual bool isValidIndex(const gl::ImageIndex &amp;index) const;
+
+  private:
+    virtual gl::Error initializeStorage(bool renderTarget);
+    virtual gl::Error createCompleteStorage(bool renderTarget, TextureStorage **outStorage) const;
+    virtual gl::Error setCompleteTexStorage(TextureStorage *newCompleteTexStorage);
+
+    virtual gl::Error updateStorage();
+    virtual void initMipmapsImages();
+
+    bool isValidLevel(int level) const;
+    bool isLevelComplete(int level) const;
+    virtual bool isImageComplete(const gl::ImageIndex &amp;index) const;
+    gl::Error updateStorageLevel(int level);
+
+    void redefineImage(GLint level, GLenum internalformat, const gl::Extents &amp;size);
+
+    ImageD3D *mImageArray[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureD3D_2DArray : public TextureD3D
+{
+  public:
+    TextureD3D_2DArray(RendererD3D *renderer);
+    virtual ~TextureD3D_2DArray();
+
+    virtual ImageD3D *getImage(int level, int layer) const;
+    virtual ImageD3D *getImage(const gl::ImageIndex &amp;index) const;
+    virtual GLsizei getLayerCount(int level) const;
+
+    GLsizei getWidth(GLint level) const;
+    GLsizei getHeight(GLint level) const;
+    GLenum getInternalFormat(GLint level) const;
+    bool isDepth(GLint level) const;
+
+    gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                          const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                        const gl::Framebuffer *source) override;
+    gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                           const gl::Framebuffer *source) override;
+
+    gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size) override;
+
+    virtual void bindTexImage(egl::Surface *surface);
+    virtual void releaseTexImage();
+
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+    virtual unsigned int getRenderTargetSerial(const gl::ImageIndex &amp;index);
+
+    virtual gl::ImageIndexIterator imageIterator() const;
+    virtual gl::ImageIndex getImageIndex(GLint mip, GLint layer) const;
+    virtual bool isValidIndex(const gl::ImageIndex &amp;index) const;
+
+  private:
+    virtual gl::Error initializeStorage(bool renderTarget);
+    virtual gl::Error createCompleteStorage(bool renderTarget, TextureStorage **outStorage) const;
+    virtual gl::Error setCompleteTexStorage(TextureStorage *newCompleteTexStorage);
+
+    virtual gl::Error updateStorage();
+    virtual void initMipmapsImages();
+
+    bool isValidLevel(int level) const;
+    bool isLevelComplete(int level) const;
+    virtual bool isImageComplete(const gl::ImageIndex &amp;index) const;
+    gl::Error updateStorageLevel(int level);
+
+    void deleteImages();
+    void redefineImage(GLint level, GLenum internalformat, const gl::Extents &amp;size);
+
+    // Storing images as an array of single depth textures since D3D11 treats each array level of a
+    // Texture2D object as a separate subresource.  Each layer would have to be looped over
+    // to update all the texture layers since they cannot all be updated at once and it makes the most
+    // sense for the Image class to not have to worry about layer subresource as well as mip subresources.
+    GLsizei mLayerCounts[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+    ImageD3D **mImageArray[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_TEXTURED3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureStoragecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage.cpp: Shared members of abstract rx::TextureStorage class.
+
+#include &quot;libANGLE/renderer/d3d/TextureStorage.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/mathutil.h&quot;
+
+namespace rx
+{
+
+TextureStorage::TextureStorage()
+    : mFirstRenderTargetSerial(0),
+      mRenderTargetSerialsLayerStride(0)
+{}
+
+void TextureStorage::initializeSerials(unsigned int rtSerialsToReserve, unsigned int rtSerialsLayerStride)
+{
+    mFirstRenderTargetSerial = RenderTargetD3D::issueSerials(rtSerialsToReserve);
+    mRenderTargetSerialsLayerStride = rtSerialsLayerStride;
+}
+
+unsigned int TextureStorage::getRenderTargetSerial(const gl::ImageIndex &amp;index) const
+{
+    unsigned int layerOffset = (index.hasLayer() ? (static_cast&lt;unsigned int&gt;(index.layerIndex) * mRenderTargetSerialsLayerStride) : 0);
+    return mFirstRenderTargetSerial + static_cast&lt;unsigned int&gt;(index.mipIndex) + layerOffset;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTextureStorageh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TextureStorage.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+//
+// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+// TextureStorage.h: Defines the abstract rx::TextureStorage class.
+
+#ifndef LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
+#define LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;stdint.h&gt;
+
+namespace gl
+{
+struct ImageIndex;
+struct Box;
+struct PixelUnpackState;
+}
+
+namespace rx
+{
+class SwapChainD3D;
+class RenderTargetD3D;
+class ImageD3D;
+
+class TextureStorage : angle::NonCopyable
+{
+  public:
+    TextureStorage();
+    virtual ~TextureStorage() {};
+
+    virtual int getTopLevel() const = 0;
+    virtual bool isRenderTarget() const = 0;
+    virtual bool isManaged() const = 0;
+    virtual bool supportsNativeMipmapFunction() const = 0;
+    virtual int getLevelCount() const = 0;
+
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT) = 0;
+    virtual gl::Error generateMipmap(const gl::ImageIndex &amp;sourceIndex, const gl::ImageIndex &amp;destIndex) = 0;
+
+    virtual gl::Error copyToStorage(TextureStorage *destStorage) = 0;
+    virtual gl::Error setData(const gl::ImageIndex &amp;index, ImageD3D *image, const gl::Box *destBox, GLenum type,
+                              const gl::PixelUnpackState &amp;unpack, const uint8_t *pixelData) = 0;
+
+    unsigned int getRenderTargetSerial(const gl::ImageIndex &amp;index) const;
+    unsigned int getTextureSerial() const;
+
+    // This is a no-op for most implementations of TextureStorage. Some (e.g. TextureStorage11_2D) might override it.
+    virtual gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture) { return gl::Error(GL_NO_ERROR); }
+
+  protected:
+    void initializeSerials(unsigned int rtSerialsToReserve, unsigned int rtSerialsLayerStride);
+
+  private:
+    unsigned int mFirstRenderTargetSerial;
+    unsigned int mRenderTargetSerialsLayerStride;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_TEXTURESTORAGE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTransformFeedbackD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// TransformFeedbackD3D.cpp is a no-op implementation for both the D3D9 and D3D11 renderers.
+
+#include &quot;libANGLE/renderer/d3d/TransformFeedbackD3D.h&quot;
+
+namespace rx
+{
+
+TransformFeedbackD3D::TransformFeedbackD3D()
+{
+}
+
+TransformFeedbackD3D::~TransformFeedbackD3D()
+{
+}
+
+void TransformFeedbackD3D::begin(GLenum primitiveMode)
+{
+}
+
+void TransformFeedbackD3D::end()
+{
+}
+
+void TransformFeedbackD3D::pause()
+{
+}
+
+void TransformFeedbackD3D::resume()
+{
+}
+
+void TransformFeedbackD3D::bindGenericBuffer(const BindingPointer&lt;gl::Buffer&gt; &amp;binding)
+{
+}
+
+void TransformFeedbackD3D::bindIndexedBuffer(size_t index, const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding)
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dTransformFeedbackD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/TransformFeedbackD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// TransformFeedbackD3D.h: Implements the abstract rx::TransformFeedbackImpl class.
+
+#ifndef LIBANGLE_RENDERER_D3D_TRANSFORMFEEDBACKD3D_H_
+#define LIBANGLE_RENDERER_D3D_TRANSFORMFEEDBACKD3D_H_
+
+#include &quot;libANGLE/renderer/TransformFeedbackImpl.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+namespace rx
+{
+
+class TransformFeedbackD3D : public TransformFeedbackImpl
+{
+  public:
+    TransformFeedbackD3D();
+    virtual ~TransformFeedbackD3D();
+
+    void begin(GLenum primitiveMode) override;
+    void end() override;
+    void pause() override;
+    void resume() override;
+
+    void bindGenericBuffer(const BindingPointer&lt;gl::Buffer&gt; &amp;binding) override;
+    void bindIndexedBuffer(size_t index, const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding) override;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_TRANSFORMFEEDBACKD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexBuffercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,311 @@
</span><ins>+//
+// 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.
+//
+
+// VertexBuffer.cpp: Defines the abstract VertexBuffer class and VertexBufferInterface
+// class with derivations, classes that perform graphics API agnostic vertex buffer operations.
+
+#include &quot;libANGLE/renderer/d3d/VertexBuffer.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+
+namespace rx
+{
+
+unsigned int VertexBuffer::mNextSerial = 1;
+
+VertexBuffer::VertexBuffer()
+{
+    updateSerial();
+}
+
+VertexBuffer::~VertexBuffer()
+{
+}
+
+void VertexBuffer::updateSerial()
+{
+    mSerial = mNextSerial++;
+}
+
+unsigned int VertexBuffer::getSerial() const
+{
+    return mSerial;
+}
+
+VertexBufferInterface::VertexBufferInterface(BufferFactoryD3D *factory, bool dynamic)
+    : mFactory(factory)
+{
+    mDynamic = dynamic;
+    mWritePosition = 0;
+    mReservedSpace = 0;
+
+    mVertexBuffer = factory-&gt;createVertexBuffer();
+}
+
+VertexBufferInterface::~VertexBufferInterface()
+{
+    delete mVertexBuffer;
+}
+
+unsigned int VertexBufferInterface::getSerial() const
+{
+    return mVertexBuffer-&gt;getSerial();
+}
+
+unsigned int VertexBufferInterface::getBufferSize() const
+{
+    return mVertexBuffer-&gt;getBufferSize();
+}
+
+gl::Error VertexBufferInterface::setBufferSize(unsigned int size)
+{
+    if (mVertexBuffer-&gt;getBufferSize() == 0)
+    {
+        return mVertexBuffer-&gt;initialize(size, mDynamic);
+    }
+    else
+    {
+        return mVertexBuffer-&gt;setBufferSize(size);
+    }
+}
+
+unsigned int VertexBufferInterface::getWritePosition() const
+{
+    return mWritePosition;
+}
+
+void VertexBufferInterface::setWritePosition(unsigned int writePosition)
+{
+    mWritePosition = writePosition;
+}
+
+gl::Error VertexBufferInterface::discard()
+{
+    return mVertexBuffer-&gt;discard();
+}
+
+gl::Error VertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                                       GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset)
+{
+    gl::Error error(GL_NO_ERROR);
+
+    unsigned int spaceRequired;
+    error = mVertexBuffer-&gt;getSpaceRequired(attrib, count, instances, &amp;spaceRequired);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (mWritePosition + spaceRequired &lt; mWritePosition)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal error, new vertex buffer write position would overflow.&quot;);
+    }
+
+    error = reserveSpace(mReservedSpace);
+    if (error.isError())
+    {
+        return error;
+    }
+    mReservedSpace = 0;
+
+    error = mVertexBuffer-&gt;storeVertexAttributes(attrib, currentValue, start, count, instances, mWritePosition);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (outStreamOffset)
+    {
+        *outStreamOffset = mWritePosition;
+    }
+
+    mWritePosition += spaceRequired;
+
+    // Align to 16-byte boundary
+    mWritePosition = roundUp(mWritePosition, 16u);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexBufferInterface::reserveVertexSpace(const gl::VertexAttribute &amp;attrib, GLsizei count, GLsizei instances)
+{
+    gl::Error error(GL_NO_ERROR);
+
+    unsigned int requiredSpace;
+    error = mVertexBuffer-&gt;getSpaceRequired(attrib, count, instances, &amp;requiredSpace);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // Protect against integer overflow
+    if (mReservedSpace + requiredSpace &lt; mReservedSpace)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Unable to reserve %u extra bytes in internal vertex buffer, &quot;
+                         &quot;it would result in an overflow.&quot;, requiredSpace);
+    }
+
+    mReservedSpace += requiredSpace;
+
+    // Align to 16-byte boundary
+    mReservedSpace = roundUp(mReservedSpace, 16u);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+VertexBuffer* VertexBufferInterface::getVertexBuffer() const
+{
+    return mVertexBuffer;
+}
+
+bool VertexBufferInterface::directStoragePossible(const gl::VertexAttribute &amp;attrib,
+                                                  const gl::VertexAttribCurrentValueData &amp;currentValue) const
+{
+    gl::Buffer *buffer = attrib.buffer.get();
+    BufferD3D *storage = buffer ? GetImplAs&lt;BufferD3D&gt;(buffer) : NULL;
+
+    if (!storage || !storage-&gt;supportsDirectBinding())
+    {
+        return false;
+    }
+
+    // Alignment restrictions: In D3D, vertex data must be aligned to
+    //  the format stride, or to a 4-byte boundary, whichever is smaller.
+    //  (Undocumented, and experimentally confirmed)
+    size_t alignment = 4;
+    bool requiresConversion = false;
+
+    if (attrib.type != GL_FLOAT)
+    {
+        gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+
+        unsigned int outputElementSize;
+        getVertexBuffer()-&gt;getSpaceRequired(attrib, 1, 0, &amp;outputElementSize);
+        alignment = std::min&lt;size_t&gt;(outputElementSize, 4);
+
+        // TODO(jmadill): add VertexFormatCaps
+        requiresConversion = (mFactory-&gt;getVertexConversionType(vertexFormat) &amp; VERTEX_CONVERT_CPU) != 0;
+    }
+
+    bool isAligned = (static_cast&lt;size_t&gt;(ComputeVertexAttributeStride(attrib)) % alignment == 0) &amp;&amp;
+                     (static_cast&lt;size_t&gt;(attrib.offset) % alignment == 0);
+
+    return !requiresConversion &amp;&amp; isAligned;
+}
+
+StreamingVertexBufferInterface::StreamingVertexBufferInterface(BufferFactoryD3D *factory, std::size_t initialSize)
+    : VertexBufferInterface(factory, true)
+{
+    setBufferSize(initialSize);
+}
+
+StreamingVertexBufferInterface::~StreamingVertexBufferInterface()
+{
+}
+
+gl::Error StreamingVertexBufferInterface::reserveSpace(unsigned int size)
+{
+    unsigned int curBufferSize = getBufferSize();
+    if (size &gt; curBufferSize)
+    {
+        gl::Error error = setBufferSize(std::max(size, 3 * curBufferSize / 2));
+        if (error.isError())
+        {
+            return error;
+        }
+        setWritePosition(0);
+    }
+    else if (getWritePosition() + size &gt; curBufferSize)
+    {
+        gl::Error error = discard();
+        if (error.isError())
+        {
+            return error;
+        }
+        setWritePosition(0);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+StaticVertexBufferInterface::StaticVertexBufferInterface(BufferFactoryD3D *factory)
+    : VertexBufferInterface(factory, false)
+{
+}
+
+StaticVertexBufferInterface::~StaticVertexBufferInterface()
+{
+}
+
+bool StaticVertexBufferInterface::lookupAttribute(const gl::VertexAttribute &amp;attrib, unsigned int *outStreamOffset)
+{
+    for (unsigned int element = 0; element &lt; mCache.size(); element++)
+    {
+        if (mCache[element].type == attrib.type &amp;&amp;
+            mCache[element].size == attrib.size &amp;&amp;
+            mCache[element].stride == ComputeVertexAttributeStride(attrib) &amp;&amp;
+            mCache[element].normalized == attrib.normalized &amp;&amp;
+            mCache[element].pureInteger == attrib.pureInteger)
+        {
+            size_t offset = (static_cast&lt;size_t&gt;(attrib.offset) % ComputeVertexAttributeStride(attrib));
+            if (mCache[element].attributeOffset == offset)
+            {
+                if (outStreamOffset)
+                {
+                    *outStreamOffset = mCache[element].streamOffset;
+                }
+                return true;
+            }
+        }
+    }
+
+    return false;
+}
+
+gl::Error StaticVertexBufferInterface::reserveSpace(unsigned int size)
+{
+    unsigned int curSize = getBufferSize();
+    if (curSize == 0)
+    {
+        return setBufferSize(size);
+    }
+    else if (curSize &gt;= size)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION, &quot;Internal error, Static vertex buffers can't be resized.&quot;);
+    }
+}
+
+gl::Error StaticVertexBufferInterface::storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                                             GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset)
+{
+    unsigned int streamOffset;
+    gl::Error error = VertexBufferInterface::storeVertexAttributes(attrib, currentValue, start, count, instances, &amp;streamOffset);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    size_t attributeOffset = static_cast&lt;size_t&gt;(attrib.offset) % ComputeVertexAttributeStride(attrib);
+    VertexElement element = { attrib.type, attrib.size, static_cast&lt;GLuint&gt;(ComputeVertexAttributeStride(attrib)), attrib.normalized, attrib.pureInteger, attributeOffset, streamOffset };
+    mCache.push_back(element);
+
+    if (outStreamOffset)
+    {
+        *outStreamOffset = streamOffset;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexBufferh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexBuffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+//
+// 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.
+//
+
+// VertexBuffer.h: Defines the abstract VertexBuffer class and VertexBufferInterface
+// class with derivations, classes that perform graphics API agnostic vertex buffer operations.
+
+#ifndef LIBANGLE_RENDERER_D3D_VERTEXBUFFER_H_
+#define LIBANGLE_RENDERER_D3D_VERTEXBUFFER_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+
+#include &lt;cstddef&gt;
+#include &lt;vector&gt;
+
+namespace gl
+{
+struct VertexAttribute;
+struct VertexAttribCurrentValueData;
+}
+
+namespace rx
+{
+class BufferFactoryD3D;
+
+class VertexBuffer : angle::NonCopyable
+{
+  public:
+    VertexBuffer();
+    virtual ~VertexBuffer();
+
+    virtual gl::Error initialize(unsigned int size, bool dynamicUsage) = 0;
+
+    virtual gl::Error storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                            GLint start, GLsizei count, GLsizei instances, unsigned int offset) = 0;
+    virtual gl::Error getSpaceRequired(const gl::VertexAttribute &amp;attrib, GLsizei count, GLsizei instances,
+                                       unsigned int *outSpaceRequired) const = 0;
+
+    virtual unsigned int getBufferSize() const = 0;
+    virtual gl::Error setBufferSize(unsigned int size) = 0;
+    virtual gl::Error discard() = 0;
+
+    unsigned int getSerial() const;
+
+    // This may be overridden (e.g. by VertexBuffer11) if necessary.
+    virtual void hintUnmapResource() { };
+
+  protected:
+    void updateSerial();
+
+  private:
+    unsigned int mSerial;
+    static unsigned int mNextSerial;
+};
+
+class VertexBufferInterface : angle::NonCopyable
+{
+  public:
+    VertexBufferInterface(BufferFactoryD3D *factory, bool dynamic);
+    virtual ~VertexBufferInterface();
+
+    gl::Error reserveVertexSpace(const gl::VertexAttribute &amp;attribute, GLsizei count, GLsizei instances);
+
+    unsigned int getBufferSize() const;
+
+    unsigned int getSerial() const;
+
+    virtual gl::Error storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                            GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset);
+
+    bool directStoragePossible(const gl::VertexAttribute &amp;attrib,
+                               const gl::VertexAttribCurrentValueData &amp;currentValue) const;
+
+    VertexBuffer* getVertexBuffer() const;
+
+  protected:
+    virtual gl::Error reserveSpace(unsigned int size) = 0;
+
+    unsigned int getWritePosition() const;
+    void setWritePosition(unsigned int writePosition);
+
+    gl::Error discard();
+
+    gl::Error setBufferSize(unsigned int size);
+
+  private:
+    BufferFactoryD3D *const mFactory;
+
+    VertexBuffer* mVertexBuffer;
+
+    unsigned int mWritePosition;
+    unsigned int mReservedSpace;
+    bool mDynamic;
+};
+
+class StreamingVertexBufferInterface : public VertexBufferInterface
+{
+  public:
+    StreamingVertexBufferInterface(BufferFactoryD3D *factory, std::size_t initialSize);
+    ~StreamingVertexBufferInterface();
+
+  protected:
+    gl::Error reserveSpace(unsigned int size);
+};
+
+class StaticVertexBufferInterface : public VertexBufferInterface
+{
+  public:
+    explicit StaticVertexBufferInterface(BufferFactoryD3D *factory);
+    ~StaticVertexBufferInterface();
+
+    gl::Error storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                    GLint start, GLsizei count, GLsizei instances, unsigned int *outStreamOffset);
+
+    bool lookupAttribute(const gl::VertexAttribute &amp;attribute, unsigned int* outStreamFffset);
+
+  protected:
+    gl::Error reserveSpace(unsigned int size);
+
+  private:
+    struct VertexElement
+    {
+        GLenum type;
+        GLuint size;
+        GLuint stride;
+        bool normalized;
+        bool pureInteger;
+        size_t attributeOffset;
+
+        unsigned int streamOffset;
+    };
+
+    std::vector&lt;VertexElement&gt; mCache;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_VERTEXBUFFER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexDataManagercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,396 @@
</span><ins>+//
+// 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 &quot;libANGLE/renderer/d3d/VertexDataManager.h&quot;
+
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/State.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/VertexBuffer.h&quot;
+
+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 rx
+{
+
+static int ElementsInBuffer(const gl::VertexAttribute &amp;attrib, unsigned int size)
+{
+    // Size cannot be larger than a GLsizei
+    if (size &gt; static_cast&lt;unsigned int&gt;(std::numeric_limits&lt;int&gt;::max()))
+    {
+        size = static_cast&lt;unsigned int&gt;(std::numeric_limits&lt;int&gt;::max());
+    }
+
+    GLsizei stride = ComputeVertexAttributeStride(attrib);
+    return (size - attrib.offset % stride + (stride - ComputeVertexAttributeTypeSize(attrib))) / stride;
+}
+
+static int StreamingBufferElementCount(const gl::VertexAttribute &amp;attrib, int vertexDrawCount, int instanceDrawCount)
+{
+    // For instanced rendering, we draw &quot;instanceDrawCount&quot; sets of &quot;vertexDrawCount&quot; vertices.
+    //
+    // A vertex attribute with a positive divisor loads one instanced vertex for every set of
+    // non-instanced vertices, and the instanced vertex index advances once every &quot;mDivisor&quot; instances.
+    if (instanceDrawCount &gt; 0 &amp;&amp; attrib.divisor &gt; 0)
+    {
+        // When instanceDrawCount is not a multiple attrib.divisor, the division must round up.
+        // For instance, with 5 non-instanced vertices and a divisor equal to 3, we need 2 instanced vertices.
+        return (instanceDrawCount + attrib.divisor - 1) / attrib.divisor;
+    }
+
+    return vertexDrawCount;
+}
+
+VertexDataManager::VertexDataManager(BufferFactoryD3D *factory)
+    : mFactory(factory)
+{
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        mCurrentValue[i].FloatValues[0] = std::numeric_limits&lt;float&gt;::quiet_NaN();
+        mCurrentValue[i].FloatValues[1] = std::numeric_limits&lt;float&gt;::quiet_NaN();
+        mCurrentValue[i].FloatValues[2] = std::numeric_limits&lt;float&gt;::quiet_NaN();
+        mCurrentValue[i].FloatValues[3] = std::numeric_limits&lt;float&gt;::quiet_NaN();
+        mCurrentValue[i].Type = GL_FLOAT;
+        mCurrentValueBuffer[i] = NULL;
+        mCurrentValueOffsets[i] = 0;
+    }
+
+    mStreamingBuffer = new StreamingVertexBufferInterface(factory, INITIAL_STREAM_BUFFER_SIZE);
+
+    if (!mStreamingBuffer)
+    {
+        ERR(&quot;Failed to allocate the streaming vertex buffer.&quot;);
+    }
+}
+
+VertexDataManager::~VertexDataManager()
+{
+    delete mStreamingBuffer;
+
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        delete mCurrentValueBuffer[i];
+    }
+}
+
+void VertexDataManager::hintUnmapAllResources(const std::vector&lt;gl::VertexAttribute&gt; &amp;vertexAttributes)
+{
+    mStreamingBuffer-&gt;getVertexBuffer()-&gt;hintUnmapResource();
+
+    for (size_t i = 0; i &lt; vertexAttributes.size(); i++)
+    {
+        const gl::VertexAttribute &amp;attrib = vertexAttributes[i];
+        if (attrib.enabled)
+        {
+            gl::Buffer *buffer = attrib.buffer.get();
+            BufferD3D *storage = buffer ? GetImplAs&lt;BufferD3D&gt;(buffer) : NULL;
+            StaticVertexBufferInterface *staticBuffer = storage ? storage-&gt;getStaticVertexBuffer() : NULL;
+
+            if (staticBuffer)
+            {
+                staticBuffer-&gt;getVertexBuffer()-&gt;hintUnmapResource();
+            }
+        }
+    }
+
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        if (mCurrentValueBuffer[i] != NULL)
+        {
+            mCurrentValueBuffer[i]-&gt;getVertexBuffer()-&gt;hintUnmapResource();
+        }
+    }
+}
+
+gl::Error VertexDataManager::prepareVertexData(const gl::State &amp;state, GLint start, GLsizei count,
+                                               TranslatedAttribute *translated, GLsizei instances)
+{
+    if (!mStreamingBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal streaming vertex buffer is unexpectedly NULL.&quot;);
+    }
+
+    const gl::VertexArray *vertexArray = state.getVertexArray();
+    const std::vector&lt;gl::VertexAttribute&gt; &amp;vertexAttributes = vertexArray-&gt;getVertexAttributes();
+
+    // Invalidate static buffers that don't contain matching attributes
+    for (int attributeIndex = 0; attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+    {
+        translated[attributeIndex].active = (state.getProgram()-&gt;getSemanticIndex(attributeIndex) != -1);
+        if (translated[attributeIndex].active &amp;&amp; vertexAttributes[attributeIndex].enabled)
+        {
+            invalidateMatchingStaticData(vertexAttributes[attributeIndex], state.getVertexAttribCurrentValue(attributeIndex));
+        }
+    }
+
+    // Reserve the required space in the buffers
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        if (translated[i].active &amp;&amp; vertexAttributes[i].enabled)
+        {
+            gl::Error error = reserveSpaceForAttrib(vertexAttributes[i], state.getVertexAttribCurrentValue(i), count, instances);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    // Perform the vertex data translations
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        const gl::VertexAttribute &amp;curAttrib = vertexAttributes[i];
+        if (translated[i].active)
+        {
+            if (curAttrib.enabled)
+            {
+                gl::Error error = storeAttribute(curAttrib, state.getVertexAttribCurrentValue(i),
+                                                 &amp;translated[i], start, count, instances);
+
+                if (error.isError())
+                {
+                    hintUnmapAllResources(vertexAttributes);
+                    return error;
+                }
+            }
+            else
+            {
+                if (!mCurrentValueBuffer[i])
+                {
+                    mCurrentValueBuffer[i] = new StreamingVertexBufferInterface(mFactory, CONSTANT_VERTEX_BUFFER_SIZE);
+                }
+
+                gl::Error error = storeCurrentValue(curAttrib, state.getVertexAttribCurrentValue(i), &amp;translated[i],
+                                                    &amp;mCurrentValue[i], &amp;mCurrentValueOffsets[i],
+                                                    mCurrentValueBuffer[i]);
+                if (error.isError())
+                {
+                    hintUnmapAllResources(vertexAttributes);
+                    return error;
+                }
+            }
+        }
+    }
+
+    // Hint to unmap all the resources
+    hintUnmapAllResources(vertexAttributes);
+
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        const gl::VertexAttribute &amp;curAttrib = vertexAttributes[i];
+        if (translated[i].active &amp;&amp; curAttrib.enabled)
+        {
+            gl::Buffer *buffer = curAttrib.buffer.get();
+
+            if (buffer)
+            {
+                BufferD3D *bufferImpl = GetImplAs&lt;BufferD3D&gt;(buffer);
+                bufferImpl-&gt;promoteStaticUsage(count * ComputeVertexAttributeTypeSize(curAttrib));
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void VertexDataManager::invalidateMatchingStaticData(const gl::VertexAttribute &amp;attrib,
+                                                     const gl::VertexAttribCurrentValueData &amp;currentValue) const
+{
+    gl::Buffer *buffer = attrib.buffer.get();
+
+    if (buffer)
+    {
+        BufferD3D *bufferImpl = GetImplAs&lt;BufferD3D&gt;(buffer);
+        StaticVertexBufferInterface *staticBuffer = bufferImpl-&gt;getStaticVertexBuffer();
+
+        if (staticBuffer &amp;&amp;
+            staticBuffer-&gt;getBufferSize() &gt; 0 &amp;&amp;
+            !staticBuffer-&gt;lookupAttribute(attrib, NULL) &amp;&amp;
+            !staticBuffer-&gt;directStoragePossible(attrib, currentValue))
+        {
+            bufferImpl-&gt;invalidateStaticData();
+        }
+    }
+}
+
+gl::Error VertexDataManager::reserveSpaceForAttrib(const gl::VertexAttribute &amp;attrib,
+                                                   const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                                   GLsizei count,
+                                                   GLsizei instances) const
+{
+    gl::Buffer *buffer = attrib.buffer.get();
+    BufferD3D *bufferImpl = buffer ? GetImplAs&lt;BufferD3D&gt;(buffer) : NULL;
+    StaticVertexBufferInterface *staticBuffer = bufferImpl ? bufferImpl-&gt;getStaticVertexBuffer() : NULL;
+    VertexBufferInterface *vertexBuffer = staticBuffer ? staticBuffer : static_cast&lt;VertexBufferInterface*&gt;(mStreamingBuffer);
+
+    if (!vertexBuffer-&gt;directStoragePossible(attrib, currentValue))
+    {
+        if (staticBuffer)
+        {
+            if (staticBuffer-&gt;getBufferSize() == 0)
+            {
+                int totalCount = ElementsInBuffer(attrib, bufferImpl-&gt;getSize());
+                gl::Error error = staticBuffer-&gt;reserveVertexSpace(attrib, totalCount, 0);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+        else
+        {
+            int totalCount = StreamingBufferElementCount(attrib, count, instances);
+            ASSERT(!bufferImpl || ElementsInBuffer(attrib, bufferImpl-&gt;getSize()) &gt;= totalCount);
+
+            gl::Error error = mStreamingBuffer-&gt;reserveVertexSpace(attrib, totalCount, instances);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexDataManager::storeAttribute(const gl::VertexAttribute &amp;attrib,
+                                            const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                            TranslatedAttribute *translated,
+                                            GLint start,
+                                            GLsizei count,
+                                            GLsizei instances)
+{
+    gl::Buffer *buffer = attrib.buffer.get();
+    ASSERT(buffer || attrib.pointer);
+
+    BufferD3D *storage = buffer ? GetImplAs&lt;BufferD3D&gt;(buffer) : NULL;
+    StaticVertexBufferInterface *staticBuffer = storage ? storage-&gt;getStaticVertexBuffer() : NULL;
+    VertexBufferInterface *vertexBuffer = staticBuffer ? staticBuffer : static_cast&lt;VertexBufferInterface*&gt;(mStreamingBuffer);
+    bool directStorage = vertexBuffer-&gt;directStoragePossible(attrib, currentValue);
+
+    unsigned int streamOffset = 0;
+    unsigned int outputElementSize = 0;
+
+    // Instanced vertices do not apply the 'start' offset
+    GLint firstVertexIndex = (instances &gt; 0 &amp;&amp; attrib.divisor &gt; 0 ? 0 : start);
+
+    if (directStorage)
+    {
+        outputElementSize = ComputeVertexAttributeStride(attrib);
+        streamOffset = static_cast&lt;unsigned int&gt;(attrib.offset + outputElementSize * firstVertexIndex);
+    }
+    else if (staticBuffer)
+    {
+        gl::Error error = staticBuffer-&gt;getVertexBuffer()-&gt;getSpaceRequired(attrib, 1, 0, &amp;outputElementSize);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (!staticBuffer-&gt;lookupAttribute(attrib, &amp;streamOffset))
+        {
+            // Convert the entire buffer
+            int totalCount = ElementsInBuffer(attrib, storage-&gt;getSize());
+            int startIndex = attrib.offset / ComputeVertexAttributeStride(attrib);
+
+            error = staticBuffer-&gt;storeVertexAttributes(attrib, currentValue, -startIndex, totalCount,
+                                                        0, &amp;streamOffset);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+
+        unsigned int firstElementOffset = (attrib.offset / ComputeVertexAttributeStride(attrib)) * outputElementSize;
+        unsigned int startOffset = (instances == 0 || attrib.divisor == 0) ? firstVertexIndex * outputElementSize : 0;
+        if (streamOffset + firstElementOffset + startOffset &lt; streamOffset)
+        {
+            return gl::Error(GL_OUT_OF_MEMORY);
+        }
+
+        streamOffset += firstElementOffset + startOffset;
+    }
+    else
+    {
+        int totalCount = StreamingBufferElementCount(attrib, count, instances);
+        gl::Error error = mStreamingBuffer-&gt;getVertexBuffer()-&gt;getSpaceRequired(attrib, 1, 0, &amp;outputElementSize);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        error = mStreamingBuffer-&gt;storeVertexAttributes(attrib, currentValue, firstVertexIndex,
+                                                        totalCount, instances, &amp;streamOffset);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    translated-&gt;storage = directStorage ? storage : NULL;
+    translated-&gt;vertexBuffer = vertexBuffer-&gt;getVertexBuffer();
+    translated-&gt;serial = directStorage ? storage-&gt;getSerial() : vertexBuffer-&gt;getSerial();
+    translated-&gt;divisor = attrib.divisor;
+
+    translated-&gt;attribute = &amp;attrib;
+    translated-&gt;currentValueType = currentValue.Type;
+    translated-&gt;stride = outputElementSize;
+    translated-&gt;offset = streamOffset;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexDataManager::storeCurrentValue(const gl::VertexAttribute &amp;attrib,
+                                               const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                               TranslatedAttribute *translated,
+                                               gl::VertexAttribCurrentValueData *cachedValue,
+                                               size_t *cachedOffset,
+                                               StreamingVertexBufferInterface *buffer)
+{
+    if (*cachedValue != currentValue)
+    {
+        gl::Error error = buffer-&gt;reserveVertexSpace(attrib, 1, 0);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        unsigned int streamOffset;
+        error = buffer-&gt;storeVertexAttributes(attrib, currentValue, 0, 1, 0, &amp;streamOffset);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        *cachedValue = currentValue;
+        *cachedOffset = streamOffset;
+    }
+
+    translated-&gt;storage = NULL;
+    translated-&gt;vertexBuffer = buffer-&gt;getVertexBuffer();
+    translated-&gt;serial = buffer-&gt;getSerial();
+    translated-&gt;divisor = 0;
+
+    translated-&gt;attribute = &amp;attrib;
+    translated-&gt;currentValueType = currentValue.Type;
+    translated-&gt;stride = 0;
+    translated-&gt;offset = *cachedOffset;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dVertexDataManagerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/VertexDataManager.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+//
+// 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 LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
+#define LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
+
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;common/angleutils.h&quot;
+
+namespace gl
+{
+class State;
+struct VertexAttribute;
+struct VertexAttribCurrentValueData;
+}
+
+namespace rx
+{
+class BufferD3D;
+class BufferFactoryD3D;
+class StreamingVertexBufferInterface;
+class VertexBuffer;
+
+struct TranslatedAttribute
+{
+    TranslatedAttribute() : active(false), attribute(NULL), currentValueType(GL_NONE),
+                            offset(0), stride(0), vertexBuffer(NULL), storage(NULL),
+                            serial(0), divisor(0) {};
+    bool active;
+
+    const gl::VertexAttribute *attribute;
+    GLenum currentValueType;
+    unsigned int offset;
+    unsigned int stride;   // 0 means not to advance the read pointer at all
+
+    VertexBuffer *vertexBuffer;
+    BufferD3D *storage;
+    unsigned int serial;
+    unsigned int divisor;
+};
+
+class VertexDataManager : angle::NonCopyable
+{
+  public:
+    VertexDataManager(BufferFactoryD3D *factory);
+    virtual ~VertexDataManager();
+
+    gl::Error prepareVertexData(const gl::State &amp;state, GLint start, GLsizei count,
+                                TranslatedAttribute *outAttribs, GLsizei instances);
+
+  private:
+    gl::Error reserveSpaceForAttrib(const gl::VertexAttribute &amp;attrib,
+                                    const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                    GLsizei count,
+                                    GLsizei instances) const;
+
+    void invalidateMatchingStaticData(const gl::VertexAttribute &amp;attrib,
+                                      const gl::VertexAttribCurrentValueData &amp;currentValue) const;
+
+    gl::Error storeAttribute(const gl::VertexAttribute &amp;attrib,
+                             const gl::VertexAttribCurrentValueData &amp;currentValue,
+                             TranslatedAttribute *translated,
+                             GLint start,
+                             GLsizei count,
+                             GLsizei instances);
+
+    gl::Error storeCurrentValue(const gl::VertexAttribute &amp;attrib,
+                                const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                TranslatedAttribute *translated,
+                                gl::VertexAttribCurrentValueData *cachedValue,
+                                size_t *cachedOffset,
+                                StreamingVertexBufferInterface *buffer);
+
+    void hintUnmapAllResources(const std::vector&lt;gl::VertexAttribute&gt; &amp;vertexAttributes);
+
+    BufferFactoryD3D *const mFactory;
+
+    StreamingVertexBufferInterface *mStreamingBuffer;
+
+    gl::VertexAttribCurrentValueData mCurrentValue[gl::MAX_VERTEX_ATTRIBS];
+
+    StreamingVertexBufferInterface *mCurrentValueBuffer[gl::MAX_VERTEX_ATTRIBS];
+    std::size_t mCurrentValueOffsets[gl::MAX_VERTEX_ATTRIBS];
+};
+
+}
+
+#endif   // LIBANGLE_RENDERER_D3D_VERTEXDATAMANAGER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dcopyimagecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// copyimage.cpp: Defines image copying functions
+
+#include &quot;libANGLE/renderer/d3d/copyimage.h&quot;
+
+namespace rx
+{
+
+void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest)
+{
+    uint32_t argb = *reinterpret_cast&lt;const uint32_t*&gt;(source);
+    *reinterpret_cast&lt;uint32_t*&gt;(dest) = (argb &amp; 0xFF00FF00) |       // Keep alpha and green
+                                         (argb &amp; 0x00FF0000) &gt;&gt; 16 | // Move red to blue
+                                         (argb &amp; 0x000000FF) &lt;&lt; 16;  // Move blue to red
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dcopyimageh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// copyimage.h: Defines image copying functions
+
+#ifndef LIBANGLE_RENDERER_D3D_COPYIMAGE_H_
+#define LIBANGLE_RENDERER_D3D_COPYIMAGE_H_
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &lt;stdint.h&gt;
+
+namespace rx
+{
+
+template &lt;typename sourceType, typename colorDataType&gt;
+void ReadColor(const uint8_t *source, uint8_t *dest);
+
+template &lt;typename destType, typename colorDataType&gt;
+void WriteColor(const uint8_t *source, uint8_t *dest);
+
+template &lt;typename sourceType, typename destType, typename colorDataType&gt;
+void CopyPixel(const uint8_t *source, uint8_t *dest);
+
+void CopyBGRA8ToRGBA8(const uint8_t *source, uint8_t *dest);
+
+}
+
+#include &quot;copyimage.inl&quot;
+
+#endif // LIBANGLE_RENDERER_D3D_COPYIMAGE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dcopyimageinl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.inl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.inl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/copyimage.inl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// copyimage.inl: Defines image copying functions
+
+namespace rx
+{
+
+template &lt;typename sourceType, typename colorDataType&gt;
+inline void ReadColor(const uint8_t *source, uint8_t *dest)
+{
+    sourceType::readColor(reinterpret_cast&lt;gl::Color&lt;colorDataType&gt;*&gt;(dest), reinterpret_cast&lt;const sourceType*&gt;(source));
+}
+
+template &lt;typename destType, typename colorDataType&gt;
+inline void WriteColor(const uint8_t *source, uint8_t *dest)
+{
+    destType::writeColor(reinterpret_cast&lt;destType*&gt;(dest), reinterpret_cast&lt;const gl::Color&lt;colorDataType&gt;*&gt;(source));
+}
+
+template &lt;typename sourceType, typename destType, typename colorDataType&gt;
+inline void CopyPixel(const uint8_t *source, uint8_t *dest)
+{
+    colorDataType temp;
+    ReadColor&lt;sourceType, colorDataType&gt;(source, &amp;temp);
+    WriteColor&lt;destType, colorDataType&gt;(&amp;temp, dest);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Blit11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1286 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Blit11.cpp: Texture copy utility class.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Blit11.h&quot;
+
+#include &lt;float.h&gt;
+
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;third_party/trace_event/trace_event.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h&quot;
+
+namespace rx
+{
+
+namespace
+{
+
+DXGI_FORMAT GetTextureFormat(ID3D11Resource *resource)
+{
+    ID3D11Texture2D *texture = d3d11::DynamicCastComObject&lt;ID3D11Texture2D&gt;(resource);
+    if (!texture)
+    {
+        return DXGI_FORMAT_UNKNOWN;
+    }
+
+    D3D11_TEXTURE2D_DESC desc;
+    texture-&gt;GetDesc(&amp;desc);
+
+    SafeRelease(texture);
+
+    return desc.Format;
+}
+
+ID3D11Resource *CreateStagingTexture(ID3D11Device *device, ID3D11DeviceContext *context,
+                                     ID3D11Resource *source, unsigned int subresource,
+                                     const gl::Extents &amp;size, unsigned int cpuAccessFlags)
+{
+    D3D11_TEXTURE2D_DESC stagingDesc;
+    stagingDesc.Width = size.width;
+    stagingDesc.Height = size.height;
+    stagingDesc.MipLevels = 1;
+    stagingDesc.ArraySize = 1;
+    stagingDesc.Format = GetTextureFormat(source);
+    stagingDesc.SampleDesc.Count = 1;
+    stagingDesc.SampleDesc.Quality = 0;
+    stagingDesc.Usage = D3D11_USAGE_STAGING;
+    stagingDesc.CPUAccessFlags = cpuAccessFlags;
+    stagingDesc.MiscFlags = 0;
+    stagingDesc.BindFlags = 0;
+
+    ID3D11Texture2D *stagingTexture = NULL;
+    HRESULT result = device-&gt;CreateTexture2D(&amp;stagingDesc, NULL, &amp;stagingTexture);
+    if (FAILED(result))
+    {
+        ERR(&quot;Failed to create staging texture for depth stencil blit. HRESULT: 0x%X.&quot;, result);
+        return NULL;
+    }
+
+    context-&gt;CopySubresourceRegion(stagingTexture, 0, 0, 0, 0, source, subresource, NULL);
+
+    return stagingTexture;
+}
+
+inline void GenerateVertexCoords(const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                                 const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                                 float *x1, float *y1, float *x2, float *y2,
+                                 float *u1, float *v1, float *u2, float *v2)
+{
+    *x1 = (destArea.x / float(destSize.width)) * 2.0f - 1.0f;
+    *y1 = ((destSize.height - destArea.y - destArea.height) / float(destSize.height)) * 2.0f - 1.0f;
+    *x2 = ((destArea.x + destArea.width) / float(destSize.width)) * 2.0f - 1.0f;
+    *y2 = ((destSize.height - destArea.y) / float(destSize.height)) * 2.0f - 1.0f;
+
+    *u1 = sourceArea.x / float(sourceSize.width);
+    *v1 = sourceArea.y / float(sourceSize.height);
+    *u2 = (sourceArea.x + sourceArea.width) / float(sourceSize.width);
+    *v2 = (sourceArea.y + sourceArea.height) / float(sourceSize.height);
+}
+
+void Write2DVertices(const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                     const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                     void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
+                     D3D11_PRIMITIVE_TOPOLOGY *outTopology)
+{
+    float x1, y1, x2, y2, u1, v1, u2, v2;
+    GenerateVertexCoords(sourceArea, sourceSize, destArea, destSize, &amp;x1, &amp;y1, &amp;x2, &amp;y2, &amp;u1, &amp;v1, &amp;u2, &amp;v2);
+
+    d3d11::PositionTexCoordVertex *vertices = static_cast&lt;d3d11::PositionTexCoordVertex*&gt;(outVertices);
+
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[0], x1, y1, u1, v2);
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[1], x1, y2, u1, v1);
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[2], x2, y1, u2, v2);
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[3], x2, y2, u2, v1);
+
+    *outStride = sizeof(d3d11::PositionTexCoordVertex);
+    *outVertexCount = 4;
+    *outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
+}
+
+void Write3DVertices(const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                     const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                     void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
+                     D3D11_PRIMITIVE_TOPOLOGY *outTopology)
+{
+    ASSERT(sourceSize.depth &gt; 0 &amp;&amp; destSize.depth &gt; 0);
+
+    float x1, y1, x2, y2, u1, v1, u2, v2;
+    GenerateVertexCoords(sourceArea, sourceSize, destArea, destSize, &amp;x1, &amp;y1, &amp;x2, &amp;y2, &amp;u1, &amp;v1, &amp;u2, &amp;v2);
+
+    d3d11::PositionLayerTexCoord3DVertex *vertices = static_cast&lt;d3d11::PositionLayerTexCoord3DVertex*&gt;(outVertices);
+
+    for (int i = 0; i &lt; destSize.depth; i++)
+    {
+        float readDepth = (float)i / std::max(destSize.depth - 1, 1);
+
+        d3d11::SetPositionLayerTexCoord3DVertex(&amp;vertices[i * 6 + 0], x1, y1, i, u1, v2, readDepth);
+        d3d11::SetPositionLayerTexCoord3DVertex(&amp;vertices[i * 6 + 1], x1, y2, i, u1, v1, readDepth);
+        d3d11::SetPositionLayerTexCoord3DVertex(&amp;vertices[i * 6 + 2], x2, y1, i, u2, v2, readDepth);
+
+        d3d11::SetPositionLayerTexCoord3DVertex(&amp;vertices[i * 6 + 3], x1, y2, i, u1, v1, readDepth);
+        d3d11::SetPositionLayerTexCoord3DVertex(&amp;vertices[i * 6 + 4], x2, y2, i, u2, v1, readDepth);
+        d3d11::SetPositionLayerTexCoord3DVertex(&amp;vertices[i * 6 + 5], x2, y1, i, u2, v2, readDepth);
+    }
+
+    *outStride = sizeof(d3d11::PositionLayerTexCoord3DVertex);
+    *outVertexCount = destSize.depth * 6;
+    *outTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+}
+
+inline unsigned int GetSwizzleIndex(GLenum swizzle)
+{
+    unsigned int colorIndex = 0;
+
+    switch (swizzle)
+    {
+      case GL_RED:   colorIndex = 0; break;
+      case GL_GREEN: colorIndex = 1; break;
+      case GL_BLUE:  colorIndex = 2; break;
+      case GL_ALPHA: colorIndex = 3; break;
+      case GL_ZERO:  colorIndex = 4; break;
+      case GL_ONE:   colorIndex = 5; break;
+      default:       UNREACHABLE();  break;
+    }
+
+    return colorIndex;
+}
+
+} // namespace
+
+Blit11::Blit11(Renderer11 *renderer)
+    : mRenderer(renderer),
+      mVertexBuffer(NULL),
+      mPointSampler(NULL),
+      mLinearSampler(NULL),
+      mScissorEnabledRasterizerState(NULL),
+      mScissorDisabledRasterizerState(NULL),
+      mDepthStencilState(NULL),
+      mQuad2DIL(NULL),
+      mQuad2DVS(NULL),
+      mDepthPS(NULL),
+      mQuad3DIL(NULL),
+      mQuad3DVS(NULL),
+      mQuad3DGS(NULL),
+      mSwizzleCB(NULL)
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Blit11::Blit11&quot;);
+
+    HRESULT result;
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    D3D11_BUFFER_DESC vbDesc;
+    vbDesc.ByteWidth = std::max(sizeof(d3d11::PositionLayerTexCoord3DVertex), sizeof(d3d11::PositionTexCoordVertex)) *
+                       6 * renderer-&gt;getRendererCaps().max3DTextureSize;
+    vbDesc.Usage = D3D11_USAGE_DYNAMIC;
+    vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+    vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+    vbDesc.MiscFlags = 0;
+    vbDesc.StructureByteStride = 0;
+
+    result = device-&gt;CreateBuffer(&amp;vbDesc, NULL, &amp;mVertexBuffer);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mVertexBuffer, &quot;Blit11 vertex buffer&quot;);
+
+    D3D11_SAMPLER_DESC pointSamplerDesc;
+    pointSamplerDesc.Filter = D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR;
+    pointSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+    pointSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+    pointSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+    pointSamplerDesc.MipLODBias = 0.0f;
+    pointSamplerDesc.MaxAnisotropy = 0;
+    pointSamplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+    pointSamplerDesc.BorderColor[0] = 0.0f;
+    pointSamplerDesc.BorderColor[1] = 0.0f;
+    pointSamplerDesc.BorderColor[2] = 0.0f;
+    pointSamplerDesc.BorderColor[3] = 0.0f;
+    pointSamplerDesc.MinLOD = 0.0f;
+    pointSamplerDesc.MaxLOD = FLT_MAX;
+
+    result = device-&gt;CreateSamplerState(&amp;pointSamplerDesc, &amp;mPointSampler);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mPointSampler, &quot;Blit11 point sampler&quot;);
+
+    D3D11_SAMPLER_DESC linearSamplerDesc;
+    linearSamplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
+    linearSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+    linearSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+    linearSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+    linearSamplerDesc.MipLODBias = 0.0f;
+    linearSamplerDesc.MaxAnisotropy = 0;
+    linearSamplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+    linearSamplerDesc.BorderColor[0] = 0.0f;
+    linearSamplerDesc.BorderColor[1] = 0.0f;
+    linearSamplerDesc.BorderColor[2] = 0.0f;
+    linearSamplerDesc.BorderColor[3] = 0.0f;
+    linearSamplerDesc.MinLOD = 0.0f;
+    linearSamplerDesc.MaxLOD = FLT_MAX;
+
+    result = device-&gt;CreateSamplerState(&amp;linearSamplerDesc, &amp;mLinearSampler);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mLinearSampler, &quot;Blit11 linear sampler&quot;);
+
+    // Use a rasterizer state that will not cull so that inverted quads will not be culled
+    D3D11_RASTERIZER_DESC rasterDesc;
+    rasterDesc.FillMode = D3D11_FILL_SOLID;
+    rasterDesc.CullMode = D3D11_CULL_NONE;
+    rasterDesc.FrontCounterClockwise = FALSE;
+    rasterDesc.DepthBias = 0;
+    rasterDesc.SlopeScaledDepthBias = 0.0f;
+    rasterDesc.DepthBiasClamp = 0.0f;
+    rasterDesc.DepthClipEnable = TRUE;
+    rasterDesc.MultisampleEnable = FALSE;
+    rasterDesc.AntialiasedLineEnable = FALSE;
+
+    rasterDesc.ScissorEnable = TRUE;
+    result = device-&gt;CreateRasterizerState(&amp;rasterDesc, &amp;mScissorEnabledRasterizerState);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mScissorEnabledRasterizerState, &quot;Blit11 scissoring rasterizer state&quot;);
+
+    rasterDesc.ScissorEnable = FALSE;
+    result = device-&gt;CreateRasterizerState(&amp;rasterDesc, &amp;mScissorDisabledRasterizerState);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mScissorDisabledRasterizerState, &quot;Blit11 no scissoring rasterizer state&quot;);
+
+    D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
+    depthStencilDesc.DepthEnable = true;
+    depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+    depthStencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+    depthStencilDesc.StencilEnable = FALSE;
+    depthStencilDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+    depthStencilDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+    depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+    depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+    result = device-&gt;CreateDepthStencilState(&amp;depthStencilDesc, &amp;mDepthStencilState);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mDepthStencilState, &quot;Blit11 depth stencil state&quot;);
+
+    D3D11_INPUT_ELEMENT_DESC quad2DLayout[] =
+    {
+        { &quot;POSITION&quot;, 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+        { &quot;TEXCOORD&quot;, 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+    };
+
+    result = device-&gt;CreateInputLayout(quad2DLayout, ArraySize(quad2DLayout), g_VS_Passthrough2D, ArraySize(g_VS_Passthrough2D), &amp;mQuad2DIL);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mQuad2DIL, &quot;Blit11 2D input layout&quot;);
+
+    result = device-&gt;CreateVertexShader(g_VS_Passthrough2D, ArraySize(g_VS_Passthrough2D), NULL, &amp;mQuad2DVS);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mQuad2DVS, &quot;Blit11 2D vertex shader&quot;);
+
+    if (renderer-&gt;isES3Capable())
+    {
+        result = device-&gt;CreatePixelShader(g_PS_PassthroughDepth2D, ArraySize(g_PS_PassthroughDepth2D), NULL, &amp;mDepthPS);
+        ASSERT(SUCCEEDED(result));
+        d3d11::SetDebugName(mDepthPS, &quot;Blit11 2D depth pixel shader&quot;);
+
+        D3D11_INPUT_ELEMENT_DESC quad3DLayout[] =
+        {
+            { &quot;POSITION&quot;, 0, DXGI_FORMAT_R32G32_FLOAT,    0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+            { &quot;LAYER&quot;,    0, DXGI_FORMAT_R32_UINT,        0,  8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+            { &quot;TEXCOORD&quot;, 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+        };
+
+        result = device-&gt;CreateInputLayout(quad3DLayout, ArraySize(quad3DLayout), g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), &amp;mQuad3DIL);
+        ASSERT(SUCCEEDED(result));
+        d3d11::SetDebugName(mQuad3DIL, &quot;Blit11 3D input layout&quot;);
+
+        result = device-&gt;CreateVertexShader(g_VS_Passthrough3D, ArraySize(g_VS_Passthrough3D), NULL, &amp;mQuad3DVS);
+        ASSERT(SUCCEEDED(result));
+        d3d11::SetDebugName(mQuad3DVS, &quot;Blit11 3D vertex shader&quot;);
+
+        result = device-&gt;CreateGeometryShader(g_GS_Passthrough3D, ArraySize(g_GS_Passthrough3D), NULL, &amp;mQuad3DGS);
+        ASSERT(SUCCEEDED(result));
+        d3d11::SetDebugName(mQuad3DGS, &quot;Renderer11 copy 3D texture geometry shader&quot;);
+    }
+
+    D3D11_BUFFER_DESC swizzleBufferDesc;
+    swizzleBufferDesc.ByteWidth = sizeof(unsigned int) * 4;
+    swizzleBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+    swizzleBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+    swizzleBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+    swizzleBufferDesc.MiscFlags = 0;
+    swizzleBufferDesc.StructureByteStride = 0;
+
+    result = device-&gt;CreateBuffer(&amp;swizzleBufferDesc, NULL, &amp;mSwizzleCB);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mSwizzleCB, &quot;Blit11 swizzle constant buffer&quot;);
+}
+
+Blit11::~Blit11()
+{
+    SafeRelease(mVertexBuffer);
+    SafeRelease(mPointSampler);
+    SafeRelease(mLinearSampler);
+    SafeRelease(mScissorEnabledRasterizerState);
+    SafeRelease(mScissorDisabledRasterizerState);
+    SafeRelease(mDepthStencilState);
+
+    SafeRelease(mQuad2DIL);
+    SafeRelease(mQuad2DVS);
+    SafeRelease(mDepthPS);
+
+    SafeRelease(mQuad3DIL);
+    SafeRelease(mQuad3DVS);
+    SafeRelease(mQuad3DGS);
+
+    SafeRelease(mSwizzleCB);
+
+    clearShaderMap();
+}
+
+// static
+Blit11::BlitShaderType Blit11::GetBlitShaderType(GLenum destinationFormat, bool isSigned, bool is3D)
+{
+    if (is3D)
+    {
+        if (isSigned)
+        {
+            switch (destinationFormat)
+            {
+              case GL_RGBA_INTEGER: return BLITSHADER_3D_RGBAI;
+              case GL_RGB_INTEGER:  return BLITSHADER_3D_RGBI;
+              case GL_RG_INTEGER:   return BLITSHADER_3D_RGI;
+              case GL_RED:          return BLITSHADER_3D_RI;
+              default:
+                UNREACHABLE();
+                return BLITSHADER_INVALID;
+            }
+        }
+        else
+        {
+            switch (destinationFormat)
+            {
+              case GL_RGBA:             return BLITSHADER_3D_RGBAF;
+              case GL_RGBA_INTEGER:     return BLITSHADER_3D_RGBAUI;
+              case GL_BGRA_EXT:         return BLITSHADER_3D_BGRAF;
+              case GL_RGB:              return BLITSHADER_3D_RGBF;
+              case GL_RGB_INTEGER:      return BLITSHADER_3D_RGBUI;
+              case GL_RG:               return BLITSHADER_3D_RGF;
+              case GL_RG_INTEGER:       return BLITSHADER_3D_RGUI;
+              case GL_RED:              return BLITSHADER_3D_RF;
+              case GL_RED_INTEGER:      return BLITSHADER_3D_RUI;
+              case GL_ALPHA:            return BLITSHADER_3D_ALPHA;
+              case GL_LUMINANCE:        return BLITSHADER_3D_LUMA;
+              case GL_LUMINANCE_ALPHA:  return BLITSHADER_3D_LUMAALPHA;
+              default:
+                UNREACHABLE();
+                return BLITSHADER_INVALID;
+            }
+        }
+    }
+    else if (isSigned)
+    {
+        switch (destinationFormat)
+        {
+          case GL_RGBA_INTEGER: return BLITSHADER_2D_RGBAI;
+          case GL_RGB_INTEGER:  return BLITSHADER_2D_RGBI;
+          case GL_RG_INTEGER:   return BLITSHADER_2D_RGI;
+          case GL_RED:          return BLITSHADER_2D_RI;
+          default:
+            UNREACHABLE();
+            return BLITSHADER_INVALID;
+        }
+    }
+    else
+    {
+        switch (destinationFormat)
+        {
+          case GL_RGBA:             return BLITSHADER_2D_RGBAF;
+          case GL_RGBA_INTEGER:     return BLITSHADER_2D_RGBAUI;
+          case GL_BGRA_EXT:         return BLITSHADER_2D_BGRAF;
+          case GL_RGB:              return BLITSHADER_2D_RGBF;
+          case GL_RGB_INTEGER:      return BLITSHADER_2D_RGBUI;
+          case GL_RG:               return BLITSHADER_2D_RGF;
+          case GL_RG_INTEGER:       return BLITSHADER_2D_RGUI;
+          case GL_RED:              return BLITSHADER_2D_RF;
+          case GL_RED_INTEGER:      return BLITSHADER_2D_RUI;
+          case GL_ALPHA:            return BLITSHADER_2D_ALPHA;
+          case GL_LUMINANCE:        return BLITSHADER_2D_LUMA;
+          case GL_LUMINANCE_ALPHA:  return BLITSHADER_2D_LUMAALPHA;
+          default:
+            UNREACHABLE();
+            return BLITSHADER_INVALID;
+        }
+    }
+}
+
+// static
+Blit11::SwizzleShaderType Blit11::GetSwizzleShaderType(GLenum type, D3D11_SRV_DIMENSION dimensionality)
+{
+    switch (dimensionality)
+    {
+      case D3D11_SRV_DIMENSION_TEXTURE2D:
+        switch (type)
+        {
+          case GL_FLOAT:        return SWIZZLESHADER_2D_FLOAT;
+          case GL_UNSIGNED_INT: return SWIZZLESHADER_2D_UINT;
+          case GL_INT:          return SWIZZLESHADER_2D_INT;
+          default:
+            UNREACHABLE();
+            return SWIZZLESHADER_INVALID;
+        }
+      case D3D11_SRV_DIMENSION_TEXTURECUBE:
+        switch (type)
+        {
+          case GL_FLOAT:        return SWIZZLESHADER_CUBE_FLOAT;
+          case GL_UNSIGNED_INT: return SWIZZLESHADER_CUBE_UINT;
+          case GL_INT:          return SWIZZLESHADER_CUBE_INT;
+          default:
+            UNREACHABLE();
+            return SWIZZLESHADER_INVALID;
+        }
+      case D3D11_SRV_DIMENSION_TEXTURE3D:
+        switch (type)
+        {
+          case GL_FLOAT:        return SWIZZLESHADER_3D_FLOAT;
+          case GL_UNSIGNED_INT: return SWIZZLESHADER_3D_UINT;
+          case GL_INT:          return SWIZZLESHADER_3D_INT;
+          default:
+            UNREACHABLE();
+            return SWIZZLESHADER_INVALID;
+        }
+      case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
+        switch (type)
+        {
+          case GL_FLOAT:        return SWIZZLESHADER_ARRAY_FLOAT;
+          case GL_UNSIGNED_INT: return SWIZZLESHADER_ARRAY_UINT;
+          case GL_INT:          return SWIZZLESHADER_ARRAY_INT;
+          default:
+            UNREACHABLE();
+            return SWIZZLESHADER_INVALID;
+        }
+      default:
+        UNREACHABLE();
+        return SWIZZLESHADER_INVALID;
+    }
+}
+
+gl::Error Blit11::swizzleTexture(ID3D11ShaderResourceView *source, ID3D11RenderTargetView *dest, const gl::Extents &amp;size,
+                                 GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
+{
+    HRESULT result;
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+    D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
+    source-&gt;GetDesc(&amp;sourceSRVDesc);
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(sourceSRVDesc.Format);
+    const gl::InternalFormat &amp;sourceFormatInfo = gl::GetInternalFormatInfo(dxgiFormatInfo.internalFormat);
+
+    GLenum shaderType = GL_NONE;
+    switch (sourceFormatInfo.componentType)
+    {
+      case GL_UNSIGNED_NORMALIZED:
+      case GL_SIGNED_NORMALIZED:
+      case GL_FLOAT:
+        shaderType = GL_FLOAT;
+        break;
+      case GL_INT:
+        shaderType = GL_INT;
+        break;
+      case GL_UNSIGNED_INT:
+        shaderType = GL_UNSIGNED_INT;
+        break;
+      default:
+        UNREACHABLE();
+        break;
+    }
+
+    const Shader *shader = nullptr;
+    gl::Error error = getSwizzleShader(shaderType, sourceSRVDesc.ViewDimension, &amp;shader);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // Set vertices
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    result = deviceContext-&gt;Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal vertex buffer for swizzle, HRESULT: 0x%X.&quot;, result);
+    }
+
+    UINT stride = 0;
+    UINT startIdx = 0;
+    UINT drawCount = 0;
+    D3D11_PRIMITIVE_TOPOLOGY topology;
+
+    gl::Box area(0, 0, 0, size.width, size.height, size.depth);
+    shader-&gt;mVertexWriteFunction(area, size, area, size, mappedResource.pData, &amp;stride, &amp;drawCount, &amp;topology);
+
+    deviceContext-&gt;Unmap(mVertexBuffer, 0);
+
+    // Set constant buffer
+    result = deviceContext-&gt;Map(mSwizzleCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal constant buffer for swizzle, HRESULT: 0x%X.&quot;, result);
+    }
+
+    unsigned int *swizzleIndices = reinterpret_cast&lt;unsigned int*&gt;(mappedResource.pData);
+    swizzleIndices[0] = GetSwizzleIndex(swizzleRed);
+    swizzleIndices[1] = GetSwizzleIndex(swizzleGreen);
+    swizzleIndices[2] = GetSwizzleIndex(swizzleBlue);
+    swizzleIndices[3] = GetSwizzleIndex(swizzleAlpha);
+
+    deviceContext-&gt;Unmap(mSwizzleCB, 0);
+
+    // Apply vertex buffer
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;mVertexBuffer, &amp;stride, &amp;startIdx);
+
+    // Apply constant buffer
+    deviceContext-&gt;PSSetConstantBuffers(0, 1, &amp;mSwizzleCB);
+
+    // Apply state
+    deviceContext-&gt;OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+    deviceContext-&gt;OMSetDepthStencilState(NULL, 0xFFFFFFFF);
+    deviceContext-&gt;RSSetState(mScissorDisabledRasterizerState);
+
+    // Apply shaders
+    deviceContext-&gt;IASetInputLayout(shader-&gt;mInputLayout);
+    deviceContext-&gt;IASetPrimitiveTopology(topology);
+    deviceContext-&gt;VSSetShader(shader-&gt;mVertexShader, NULL, 0);
+
+    deviceContext-&gt;PSSetShader(shader-&gt;mPixelShader, NULL, 0);
+    deviceContext-&gt;GSSetShader(shader-&gt;mGeometryShader, NULL, 0);
+
+    // Unset the currently bound shader resource to avoid conflicts
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+
+    // Apply render target
+    mRenderer-&gt;setOneTimeRenderTarget(dest);
+
+    // Set the viewport
+    D3D11_VIEWPORT viewport;
+    viewport.TopLeftX = 0;
+    viewport.TopLeftY = 0;
+    viewport.Width = static_cast&lt;FLOAT&gt;(size.width);
+    viewport.Height = static_cast&lt;FLOAT&gt;(size.height);
+    viewport.MinDepth = 0.0f;
+    viewport.MaxDepth = 1.0f;
+    deviceContext-&gt;RSSetViewports(1, &amp;viewport);
+
+    // Apply textures
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, source);
+
+    // Apply samplers
+    deviceContext-&gt;PSSetSamplers(0, 1, &amp;mPointSampler);
+
+    // Draw the quad
+    deviceContext-&gt;Draw(drawCount, 0);
+
+    // Unbind textures and render targets and vertex buffer
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+
+    mRenderer-&gt;unapplyRenderTargets();
+
+    UINT zero = 0;
+    ID3D11Buffer *const nullBuffer = NULL;
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;nullBuffer, &amp;zero, &amp;zero);
+
+    mRenderer-&gt;markAllStateDirty();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Blit11::copyTexture(ID3D11ShaderResourceView *source, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                              ID3D11RenderTargetView *dest, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                              const gl::Rectangle *scissor, GLenum destFormat, GLenum filter)
+{
+    HRESULT result;
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+    // Determine if the source format is a signed integer format, the destFormat will already
+    // be GL_XXXX_INTEGER but it does not tell us if it is signed or unsigned.
+    D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
+    source-&gt;GetDesc(&amp;sourceSRVDesc);
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(sourceSRVDesc.Format);
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(dxgiFormatInfo.internalFormat);
+
+    bool isSigned = (internalFormatInfo.componentType == GL_INT);
+    bool is3D = (sourceSRVDesc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE3D);
+
+    const Shader *shader = nullptr;
+    gl::Error error = getBlitShader(destFormat, isSigned, is3D, &amp;shader);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // Set vertices
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    result = deviceContext-&gt;Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal vertex buffer for texture copy, HRESULT: 0x%X.&quot;, result);
+    }
+
+    UINT stride = 0;
+    UINT startIdx = 0;
+    UINT drawCount = 0;
+    D3D11_PRIMITIVE_TOPOLOGY topology;
+
+    shader-&gt;mVertexWriteFunction(sourceArea, sourceSize, destArea, destSize, mappedResource.pData,
+                                 &amp;stride, &amp;drawCount, &amp;topology);
+
+    deviceContext-&gt;Unmap(mVertexBuffer, 0);
+
+    // Apply vertex buffer
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;mVertexBuffer, &amp;stride, &amp;startIdx);
+
+    // Apply state
+    deviceContext-&gt;OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+    deviceContext-&gt;OMSetDepthStencilState(NULL, 0xFFFFFFFF);
+
+    if (scissor)
+    {
+        D3D11_RECT scissorRect;
+        scissorRect.left = scissor-&gt;x;
+        scissorRect.right = scissor-&gt;x + scissor-&gt;width;
+        scissorRect.top = scissor-&gt;y;
+        scissorRect.bottom = scissor-&gt;y + scissor-&gt;height;
+
+        deviceContext-&gt;RSSetScissorRects(1, &amp;scissorRect);
+        deviceContext-&gt;RSSetState(mScissorEnabledRasterizerState);
+    }
+    else
+    {
+        deviceContext-&gt;RSSetState(mScissorDisabledRasterizerState);
+    }
+
+    // Apply shaders
+    deviceContext-&gt;IASetInputLayout(shader-&gt;mInputLayout);
+    deviceContext-&gt;IASetPrimitiveTopology(topology);
+    deviceContext-&gt;VSSetShader(shader-&gt;mVertexShader, NULL, 0);
+
+    deviceContext-&gt;PSSetShader(shader-&gt;mPixelShader, NULL, 0);
+    deviceContext-&gt;GSSetShader(shader-&gt;mGeometryShader, NULL, 0);
+
+    // Unset the currently bound shader resource to avoid conflicts
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+
+    // Apply render target
+    mRenderer-&gt;setOneTimeRenderTarget(dest);
+
+    // Set the viewport
+    D3D11_VIEWPORT viewport;
+    viewport.TopLeftX = 0;
+    viewport.TopLeftY = 0;
+    viewport.Width = static_cast&lt;FLOAT&gt;(destSize.width);
+    viewport.Height = static_cast&lt;FLOAT&gt;(destSize.height);
+    viewport.MinDepth = 0.0f;
+    viewport.MaxDepth = 1.0f;
+    deviceContext-&gt;RSSetViewports(1, &amp;viewport);
+
+    // Apply textures
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, source);
+
+    // Apply samplers
+    ID3D11SamplerState *sampler = NULL;
+    switch (filter)
+    {
+      case GL_NEAREST: sampler = mPointSampler;  break;
+      case GL_LINEAR:  sampler = mLinearSampler; break;
+
+      default:
+        UNREACHABLE();
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal error, unknown blit filter mode.&quot;);
+    }
+    deviceContext-&gt;PSSetSamplers(0, 1, &amp;sampler);
+
+    // Draw the quad
+    deviceContext-&gt;Draw(drawCount, 0);
+
+    // Unbind textures and render targets and vertex buffer
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+
+    mRenderer-&gt;unapplyRenderTargets();
+
+    UINT zero = 0;
+    ID3D11Buffer *const nullBuffer = NULL;
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;nullBuffer, &amp;zero, &amp;zero);
+
+    mRenderer-&gt;markAllStateDirty();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Blit11::copyStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                              ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                              const gl::Rectangle *scissor)
+{
+    return copyDepthStencil(source, sourceSubresource, sourceArea, sourceSize,
+                            dest, destSubresource, destArea, destSize,
+                            scissor, true);
+}
+
+gl::Error Blit11::copyDepth(ID3D11ShaderResourceView *source, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                            ID3D11DepthStencilView *dest, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                            const gl::Rectangle *scissor)
+{
+    HRESULT result;
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+    // Set vertices
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    result = deviceContext-&gt;Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal vertex buffer for texture copy, HRESULT: 0x%X.&quot;, result);
+    }
+
+    UINT stride = 0;
+    UINT startIdx = 0;
+    UINT drawCount = 0;
+    D3D11_PRIMITIVE_TOPOLOGY topology;
+
+    Write2DVertices(sourceArea, sourceSize, destArea, destSize, mappedResource.pData,
+                    &amp;stride, &amp;drawCount, &amp;topology);
+
+    deviceContext-&gt;Unmap(mVertexBuffer, 0);
+
+    // Apply vertex buffer
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;mVertexBuffer, &amp;stride, &amp;startIdx);
+
+    // Apply state
+    deviceContext-&gt;OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+    deviceContext-&gt;OMSetDepthStencilState(mDepthStencilState, 0xFFFFFFFF);
+
+    if (scissor)
+    {
+        D3D11_RECT scissorRect;
+        scissorRect.left = scissor-&gt;x;
+        scissorRect.right = scissor-&gt;x + scissor-&gt;width;
+        scissorRect.top = scissor-&gt;y;
+        scissorRect.bottom = scissor-&gt;y + scissor-&gt;height;
+
+        deviceContext-&gt;RSSetScissorRects(1, &amp;scissorRect);
+        deviceContext-&gt;RSSetState(mScissorEnabledRasterizerState);
+    }
+    else
+    {
+        deviceContext-&gt;RSSetState(mScissorDisabledRasterizerState);
+    }
+
+    // Apply shaders
+    deviceContext-&gt;IASetInputLayout(mQuad2DIL);
+    deviceContext-&gt;IASetPrimitiveTopology(topology);
+    deviceContext-&gt;VSSetShader(mQuad2DVS, NULL, 0);
+
+    deviceContext-&gt;PSSetShader(mDepthPS, NULL, 0);
+    deviceContext-&gt;GSSetShader(NULL, NULL, 0);
+
+    // Unset the currently bound shader resource to avoid conflicts
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+
+    // Apply render target
+    deviceContext-&gt;OMSetRenderTargets(0, NULL, dest);
+
+    // Set the viewport
+    D3D11_VIEWPORT viewport;
+    viewport.TopLeftX = 0;
+    viewport.TopLeftY = 0;
+    viewport.Width = static_cast&lt;FLOAT&gt;(destSize.width);
+    viewport.Height = static_cast&lt;FLOAT&gt;(destSize.height);
+    viewport.MinDepth = 0.0f;
+    viewport.MaxDepth = 1.0f;
+    deviceContext-&gt;RSSetViewports(1, &amp;viewport);
+
+    // Apply textures
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, source);
+
+    // Apply samplers
+    deviceContext-&gt;PSSetSamplers(0, 1, &amp;mPointSampler);
+
+    // Draw the quad
+    deviceContext-&gt;Draw(drawCount, 0);
+
+    // Unbind textures and render targets and vertex buffer
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+
+    mRenderer-&gt;unapplyRenderTargets();
+
+    UINT zero = 0;
+    ID3D11Buffer *const nullBuffer = NULL;
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;nullBuffer, &amp;zero, &amp;zero);
+
+    mRenderer-&gt;markAllStateDirty();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Blit11::copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                                   ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                                   const gl::Rectangle *scissor)
+{
+    return copyDepthStencil(source, sourceSubresource, sourceArea, sourceSize,
+                            dest, destSubresource, destArea, destSize,
+                            scissor, false);
+}
+
+gl::Error Blit11::copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                                   ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                                   const gl::Rectangle *scissor, bool stencilOnly)
+{
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+    ID3D11Resource *sourceStaging = CreateStagingTexture(device, deviceContext, source, sourceSubresource, sourceSize, D3D11_CPU_ACCESS_READ);
+    // HACK: Create the destination staging buffer as a read/write texture so ID3D11DevicContext::UpdateSubresource can be called
+    //       using it's mapped data as a source
+    ID3D11Resource *destStaging = CreateStagingTexture(device, deviceContext, dest, destSubresource, destSize, D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE);
+
+    if (!sourceStaging || !destStaging)
+    {
+        SafeRelease(sourceStaging);
+        SafeRelease(destStaging);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal staging textures for depth stencil blit.&quot;);
+    }
+
+    DXGI_FORMAT format = GetTextureFormat(source);
+    ASSERT(format == GetTextureFormat(dest));
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(format);
+    unsigned int pixelSize = dxgiFormatInfo.pixelBytes;
+    unsigned int copyOffset = 0;
+    unsigned int copySize = pixelSize;
+    if (stencilOnly)
+    {
+        copyOffset = dxgiFormatInfo.depthBits / 8;
+        copySize = dxgiFormatInfo.stencilBits / 8;
+
+        // It would be expensive to have non-byte sized stencil sizes since it would
+        // require reading from the destination, currently there aren't any though.
+        ASSERT(dxgiFormatInfo.stencilBits % 8 == 0 &amp;&amp;
+               dxgiFormatInfo.depthBits   % 8 == 0);
+    }
+
+    D3D11_MAPPED_SUBRESOURCE sourceMapping;
+    HRESULT result = deviceContext-&gt;Map(sourceStaging, 0, D3D11_MAP_READ, 0, &amp;sourceMapping);
+    if (FAILED(result))
+    {
+        SafeRelease(sourceStaging);
+        SafeRelease(destStaging);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal source staging texture for depth stencil blit, HRESULT: 0x%X.&quot;, result);
+    }
+
+    D3D11_MAPPED_SUBRESOURCE destMapping;
+    result = deviceContext-&gt;Map(destStaging, 0, D3D11_MAP_WRITE, 0, &amp;destMapping);
+    if (FAILED(result))
+    {
+        deviceContext-&gt;Unmap(sourceStaging, 0);
+        SafeRelease(sourceStaging);
+        SafeRelease(destStaging);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal destination staging texture for depth stencil blit, HRESULT: 0x%X.&quot;, result);
+    }
+
+    gl::Rectangle clippedDestArea(destArea.x, destArea.y, destArea.width, destArea.height);
+
+    // Clip dest area to the destination size
+    gl::ClipRectangle(clippedDestArea, gl::Rectangle(0, 0, destSize.width, destSize.height), &amp;clippedDestArea);
+
+    // Clip dest area to the scissor
+    if (scissor)
+    {
+        gl::ClipRectangle(clippedDestArea, *scissor, &amp;clippedDestArea);
+    }
+
+    // Determine if entire rows can be copied at once instead of each individual pixel, requires that there is
+    // no out of bounds lookups required, the entire pixel is copied and no stretching
+    bool wholeRowCopy = sourceArea.width == clippedDestArea.width &amp;&amp;
+                        sourceArea.x &gt;= 0 &amp;&amp; sourceArea.x + sourceArea.width &lt;= sourceSize.width &amp;&amp;
+                        copySize == pixelSize;
+
+    for (int y = clippedDestArea.y; y &lt; clippedDestArea.y + clippedDestArea.height; y++)
+    {
+        float yPerc = static_cast&lt;float&gt;(y - destArea.y) / (destArea.height - 1);
+
+        // Interpolate using the original source rectangle to determine which row to sample from while clamping to the edges
+        unsigned int readRow = static_cast&lt;unsigned int&gt;(gl::clamp(sourceArea.y + floor(yPerc * (sourceArea.height - 1) + 0.5f), 0, sourceSize.height - 1));
+        unsigned int writeRow = y;
+
+        if (wholeRowCopy)
+        {
+            void *sourceRow = reinterpret_cast&lt;char*&gt;(sourceMapping.pData) +
+                              readRow * sourceMapping.RowPitch +
+                              sourceArea.x * pixelSize;
+
+            void *destRow = reinterpret_cast&lt;char*&gt;(destMapping.pData) +
+                            writeRow * destMapping.RowPitch +
+                            destArea.x * pixelSize;
+
+            memcpy(destRow, sourceRow, pixelSize * destArea.width);
+        }
+        else
+        {
+            for (int x = clippedDestArea.x; x &lt; clippedDestArea.x + clippedDestArea.width; x++)
+            {
+                float xPerc = static_cast&lt;float&gt;(x - destArea.x) / (destArea.width - 1);
+
+                // Interpolate the original source rectangle to determine which column to sample from while clamping to the edges
+                unsigned int readColumn = static_cast&lt;unsigned int&gt;(gl::clamp(sourceArea.x + floor(xPerc * (sourceArea.width - 1) + 0.5f), 0, sourceSize.width - 1));
+                unsigned int writeColumn = x;
+
+                void *sourcePixel = reinterpret_cast&lt;char*&gt;(sourceMapping.pData) +
+                                    readRow * sourceMapping.RowPitch +
+                                    readColumn * pixelSize +
+                                    copyOffset;
+
+                void *destPixel = reinterpret_cast&lt;char*&gt;(destMapping.pData) +
+                                  writeRow * destMapping.RowPitch +
+                                  writeColumn * pixelSize +
+                                  copyOffset;
+
+                memcpy(destPixel, sourcePixel, copySize);
+            }
+        }
+    }
+
+    // HACK: Use ID3D11DevicContext::UpdateSubresource which causes an extra copy compared to ID3D11DevicContext::CopySubresourceRegion
+    //       according to MSDN.
+    deviceContext-&gt;UpdateSubresource(dest, destSubresource, NULL, destMapping.pData, destMapping.RowPitch, destMapping.DepthPitch);
+
+    deviceContext-&gt;Unmap(sourceStaging, 0);
+    deviceContext-&gt;Unmap(destStaging, 0);
+
+    // TODO: Determine why this call to ID3D11DevicContext::CopySubresourceRegion causes a TDR timeout on some
+    //       systems when called repeatedly.
+    // deviceContext-&gt;CopySubresourceRegion(dest, destSubresource, 0, 0, 0, destStaging, 0, NULL);
+
+    SafeRelease(sourceStaging);
+    SafeRelease(destStaging);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Blit11::add2DBlitShaderToMap(BlitShaderType blitShaderType, ID3D11PixelShader *ps)
+{
+    ASSERT(mBlitShaderMap.find(blitShaderType) == mBlitShaderMap.end());
+    ASSERT(ps);
+
+    Shader shader;
+    shader.mVertexWriteFunction = Write2DVertices;
+    shader.mInputLayout = mQuad2DIL;
+    shader.mVertexShader = mQuad2DVS;
+    shader.mGeometryShader = NULL;
+    shader.mPixelShader = ps;
+
+    mBlitShaderMap[blitShaderType] = shader;
+}
+
+void Blit11::add3DBlitShaderToMap(BlitShaderType blitShaderType, ID3D11PixelShader *ps)
+{
+    ASSERT(mBlitShaderMap.find(blitShaderType) == mBlitShaderMap.end());
+    ASSERT(ps);
+
+    Shader shader;
+    shader.mVertexWriteFunction = Write3DVertices;
+    shader.mInputLayout = mQuad3DIL;
+    shader.mVertexShader = mQuad3DVS;
+    shader.mGeometryShader = mQuad3DGS;
+    shader.mPixelShader = ps;
+
+    mBlitShaderMap[blitShaderType] = shader;
+}
+
+void Blit11::addSwizzleShaderToMap(SwizzleShaderType swizzleShaderType, bool is2D, ID3D11PixelShader *ps)
+{
+    ASSERT(mSwizzleShaderMap.find(swizzleShaderType) == mSwizzleShaderMap.end());
+    ASSERT(ps);
+
+    Shader shader;
+    if (is2D)
+    {
+        shader.mVertexWriteFunction = Write2DVertices;
+        shader.mInputLayout = mQuad2DIL;
+        shader.mVertexShader = mQuad2DVS;
+        shader.mGeometryShader = NULL;
+    }
+    else
+    {
+        shader.mVertexWriteFunction = Write3DVertices;
+        shader.mInputLayout = mQuad3DIL;
+        shader.mVertexShader = mQuad3DVS;
+        shader.mGeometryShader = mQuad3DGS;
+    }
+    shader.mPixelShader = ps;
+
+    mSwizzleShaderMap[swizzleShaderType] = shader;
+}
+
+void Blit11::clearShaderMap()
+{
+    for (auto &amp;blitShader : mBlitShaderMap)
+    {
+        SafeRelease(blitShader.second.mPixelShader);
+    }
+    mBlitShaderMap.clear();
+
+    for (auto &amp;swizzleShader : mSwizzleShaderMap)
+    {
+        SafeRelease(swizzleShader.second.mPixelShader);
+    }
+    mSwizzleShaderMap.clear();
+}
+
+gl::Error Blit11::getBlitShader(GLenum destFormat, bool isSigned, bool is3D, const Shader **shader)
+{
+    BlitShaderType blitShaderType = GetBlitShaderType(destFormat, isSigned, is3D);
+
+    if (blitShaderType == BLITSHADER_INVALID)
+    {
+        return gl::Error(GL_INVALID_OPERATION, &quot;Internal blit shader type mismatch&quot;);
+    }
+
+    auto blitShaderIt = mBlitShaderMap.find(blitShaderType);
+    if (blitShaderIt != mBlitShaderMap.end())
+    {
+        *shader = &amp;blitShaderIt-&gt;second;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    ASSERT(!is3D || mRenderer-&gt;isES3Capable());
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    switch (blitShaderType)
+    {
+      case BLITSHADER_2D_RGBAF:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, &quot;Blit11 2D RGBA pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_BGRAF:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, &quot;Blit11 2D BGRA pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGBF:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGB2D, &quot;Blit11 2D RGB pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGF:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRG2D, &quot;Blit11 2D RG pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RF:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughR2D, &quot;Blit11 2D R pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_ALPHA:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA2D, &quot;Blit11 2D alpha pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_LUMA:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughLum2D, &quot;Blit11 2D lum pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_LUMAALPHA:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha2D, &quot;Blit11 2D luminance alpha pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGBAUI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DUI, &quot;Blit11 2D RGBA UI pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGBAI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA2DI, &quot;Blit11 2D RGBA I pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGBUI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGB2DUI, &quot;Blit11 2D RGB UI pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGBI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGB2DI, &quot;Blit11 2D RGB I pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGUI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRG2DUI, &quot;Blit11 2D RG UI pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RGI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRG2DI, &quot;Blit11 2D RG I pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RUI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughR2DUI, &quot;Blit11 2D R UI pixel shader&quot;));
+        break;
+      case BLITSHADER_2D_RI:
+        add2DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughR2DI, &quot;Blit11 2D R I pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGBAF:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, &quot;Blit11 3D RGBA pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGBAUI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DUI, &quot;Blit11 3D UI RGBA pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGBAI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA3DI, &quot;Blit11 3D I RGBA pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_BGRAF:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, &quot;Blit11 3D BGRA pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGBF:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGB3D, &quot;Blit11 3D RGB pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGBUI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGB3DUI, &quot;Blit11 3D RGB UI pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGBI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGB3DI, &quot;Blit11 3D RGB I pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGF:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRG3D, &quot;Blit11 3D RG pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGUI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRG3DUI, &quot;Blit11 3D RG UI pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RGI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRG3DI, &quot;Blit11 3D RG I pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RF:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughR3D, &quot;Blit11 3D R pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RUI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughR3DUI, &quot;Blit11 3D R UI pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_RI:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughR3DI, &quot;Blit11 3D R I pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_ALPHA:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughRGBA3D, &quot;Blit11 3D alpha pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_LUMA:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughLum3D, &quot;Blit11 3D luminance pixel shader&quot;));
+        break;
+      case BLITSHADER_3D_LUMAALPHA:
+        add3DBlitShaderToMap(blitShaderType, d3d11::CompilePS(device, g_PS_PassthroughLumAlpha3D, &quot;Blit11 3D luminance alpha pixel shader&quot;));
+        break;
+      default:
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION, &quot;Internal error&quot;);
+    }
+
+    blitShaderIt = mBlitShaderMap.find(blitShaderType);
+    ASSERT(blitShaderIt != mBlitShaderMap.end());
+    *shader = &amp;blitShaderIt-&gt;second;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Blit11::getSwizzleShader(GLenum type, D3D11_SRV_DIMENSION viewDimension, const Shader **shader)
+{
+    SwizzleShaderType swizzleShaderType = GetSwizzleShaderType(type, viewDimension);
+
+    if (swizzleShaderType == SWIZZLESHADER_INVALID)
+    {
+        return gl::Error(GL_INVALID_OPERATION, &quot;Swizzle shader type not found&quot;);
+    }
+
+    auto swizzleShaderIt = mSwizzleShaderMap.find(swizzleShaderType);
+    if (swizzleShaderIt != mSwizzleShaderMap.end())
+    {
+        *shader = &amp;swizzleShaderIt-&gt;second;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    // Swizzling shaders (OpenGL ES 3+)
+    ASSERT(mRenderer-&gt;isES3Capable());
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    switch (swizzleShaderType)
+    {
+      case SWIZZLESHADER_2D_FLOAT:
+        addSwizzleShaderToMap(swizzleShaderType, true, d3d11::CompilePS(device, g_PS_SwizzleF2D, &quot;Blit11 2D F swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_2D_UINT:
+        addSwizzleShaderToMap(swizzleShaderType, true, d3d11::CompilePS(device, g_PS_SwizzleUI2D, &quot;Blit11 2D UI swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_2D_INT:
+        addSwizzleShaderToMap(swizzleShaderType, true, d3d11::CompilePS(device, g_PS_SwizzleI2D, &quot;Blit11 2D I swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_CUBE_FLOAT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleF2DArray, &quot;Blit11 2D Cube F swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_CUBE_UINT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleUI2DArray, &quot;Blit11 2D Cube UI swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_CUBE_INT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleI2DArray, &quot;Blit11 2D Cube I swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_3D_FLOAT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleF3D, &quot;Blit11 3D F swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_3D_UINT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleUI3D, &quot;Blit11 3D UI swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_3D_INT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleI3D, &quot;Blit11 3D I swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_ARRAY_FLOAT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleF2DArray, &quot;Blit11 2D Array F swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_ARRAY_UINT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleUI2DArray, &quot;Blit11 2D Array UI swizzle pixel shader&quot;));
+        break;
+      case SWIZZLESHADER_ARRAY_INT:
+        addSwizzleShaderToMap(swizzleShaderType, false, d3d11::CompilePS(device, g_PS_SwizzleI2DArray, &quot;Blit11 2D Array I swizzle pixel shader&quot;));
+        break;
+      default:
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION, &quot;Internal error&quot;);
+    }
+
+    swizzleShaderIt = mSwizzleShaderMap.find(swizzleShaderType);
+    ASSERT(swizzleShaderIt != mSwizzleShaderMap.end());
+    *shader = &amp;swizzleShaderIt-&gt;second;
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Blit11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Blit11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,159 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Blit11.cpp: Texture copy utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+class Renderer11;
+
+class Blit11 : angle::NonCopyable
+{
+  public:
+    explicit Blit11(Renderer11 *renderer);
+    ~Blit11();
+
+    gl::Error swizzleTexture(ID3D11ShaderResourceView *source, ID3D11RenderTargetView *dest, const gl::Extents &amp;size,
+                             GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+
+    gl::Error copyTexture(ID3D11ShaderResourceView *source, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                          ID3D11RenderTargetView *dest, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                          const gl::Rectangle *scissor, GLenum destFormat, GLenum filter);
+
+    gl::Error copyStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                          ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                          const gl::Rectangle *scissor);
+
+    gl::Error copyDepth(ID3D11ShaderResourceView *source, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                        ID3D11DepthStencilView *dest, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                        const gl::Rectangle *scissor);
+
+    gl::Error copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                               ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                               const gl::Rectangle *scissor);
+
+  private:
+    enum BlitShaderType
+    {
+        BLITSHADER_INVALID,
+        BLITSHADER_2D_RGBAF,
+        BLITSHADER_2D_BGRAF,
+        BLITSHADER_2D_RGBF,
+        BLITSHADER_2D_RGF,
+        BLITSHADER_2D_RF,
+        BLITSHADER_2D_ALPHA,
+        BLITSHADER_2D_LUMA,
+        BLITSHADER_2D_LUMAALPHA,
+        BLITSHADER_2D_RGBAUI,
+        BLITSHADER_2D_RGBAI,
+        BLITSHADER_2D_RGBUI,
+        BLITSHADER_2D_RGBI,
+        BLITSHADER_2D_RGUI,
+        BLITSHADER_2D_RGI,
+        BLITSHADER_2D_RUI,
+        BLITSHADER_2D_RI,
+        BLITSHADER_3D_RGBAF,
+        BLITSHADER_3D_RGBAUI,
+        BLITSHADER_3D_RGBAI,
+        BLITSHADER_3D_BGRAF,
+        BLITSHADER_3D_RGBF,
+        BLITSHADER_3D_RGBUI,
+        BLITSHADER_3D_RGBI,
+        BLITSHADER_3D_RGF,
+        BLITSHADER_3D_RGUI,
+        BLITSHADER_3D_RGI,
+        BLITSHADER_3D_RF,
+        BLITSHADER_3D_RUI,
+        BLITSHADER_3D_RI,
+        BLITSHADER_3D_ALPHA,
+        BLITSHADER_3D_LUMA,
+        BLITSHADER_3D_LUMAALPHA,
+    };
+
+    static BlitShaderType GetBlitShaderType(GLenum destinationFormat, bool isSigned, bool is3D);
+
+    enum SwizzleShaderType
+    {
+        SWIZZLESHADER_INVALID,
+        SWIZZLESHADER_2D_FLOAT,
+        SWIZZLESHADER_2D_UINT,
+        SWIZZLESHADER_2D_INT,
+        SWIZZLESHADER_CUBE_FLOAT,
+        SWIZZLESHADER_CUBE_UINT,
+        SWIZZLESHADER_CUBE_INT,
+        SWIZZLESHADER_3D_FLOAT,
+        SWIZZLESHADER_3D_UINT,
+        SWIZZLESHADER_3D_INT,
+        SWIZZLESHADER_ARRAY_FLOAT,
+        SWIZZLESHADER_ARRAY_UINT,
+        SWIZZLESHADER_ARRAY_INT,
+    };
+
+    static SwizzleShaderType GetSwizzleShaderType(GLenum type, D3D11_SRV_DIMENSION dimensionality);
+
+    gl::Error copyDepthStencil(ID3D11Resource *source, unsigned int sourceSubresource, const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                               ID3D11Resource *dest, unsigned int destSubresource, const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                               const gl::Rectangle *scissor, bool stencilOnly);
+
+    typedef void (*WriteVertexFunction)(const gl::Box &amp;sourceArea, const gl::Extents &amp;sourceSize,
+                                        const gl::Box &amp;destArea, const gl::Extents &amp;destSize,
+                                        void *outVertices, unsigned int *outStride, unsigned int *outVertexCount,
+                                        D3D11_PRIMITIVE_TOPOLOGY *outTopology);
+
+    struct Shader
+    {
+        WriteVertexFunction mVertexWriteFunction;
+        ID3D11InputLayout *mInputLayout;
+        ID3D11VertexShader *mVertexShader;
+        ID3D11GeometryShader *mGeometryShader;
+        ID3D11PixelShader *mPixelShader;
+    };
+
+    void add2DBlitShaderToMap(BlitShaderType blitShaderType, ID3D11PixelShader *ps);
+    void add3DBlitShaderToMap(BlitShaderType blitShaderType, ID3D11PixelShader *ps);
+
+    gl::Error getBlitShader(GLenum destFormat, bool isSigned, bool is3D, const Shader **shaderOut);
+    gl::Error getSwizzleShader(GLenum type, D3D11_SRV_DIMENSION viewDimension, const Shader **shaderOut);
+
+    void addSwizzleShaderToMap(SwizzleShaderType swizzleShaderType, bool is2D, ID3D11PixelShader *ps);
+
+    void clearShaderMap();
+
+    Renderer11 *mRenderer;
+
+    std::map&lt;BlitShaderType, Shader&gt; mBlitShaderMap;
+    std::map&lt;SwizzleShaderType, Shader&gt; mSwizzleShaderMap;
+
+    ID3D11Buffer *mVertexBuffer;
+    ID3D11SamplerState *mPointSampler;
+    ID3D11SamplerState *mLinearSampler;
+    ID3D11RasterizerState *mScissorEnabledRasterizerState;
+    ID3D11RasterizerState *mScissorDisabledRasterizerState;
+    ID3D11DepthStencilState *mDepthStencilState;
+
+    ID3D11InputLayout *mQuad2DIL;
+    ID3D11VertexShader *mQuad2DVS;
+    ID3D11PixelShader *mDepthPS;
+
+    ID3D11InputLayout *mQuad3DIL;
+    ID3D11VertexShader *mQuad3DVS;
+    ID3D11GeometryShader *mQuad3DGS;
+
+    ID3D11Buffer *mSwizzleCB;
+};
+
+}
+
+#endif   // LIBANGLE_RENDERER_D3D_D3D11_BLIT11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Buffer11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1162 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Buffer11.cpp Defines the Buffer11 class.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Buffer11.h&quot;
+
+#include &quot;common/MemoryBuffer.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+
+namespace rx
+{
+
+PackPixelsParams::PackPixelsParams()
+  : format(GL_NONE),
+    type(GL_NONE),
+    outputPitch(0),
+    packBuffer(NULL),
+    offset(0)
+{}
+
+PackPixelsParams::PackPixelsParams(const gl::Rectangle &amp;areaIn, GLenum formatIn, GLenum typeIn, GLuint outputPitchIn,
+                                   const gl::PixelPackState &amp;packIn, ptrdiff_t offsetIn)
+  : area(areaIn),
+    format(formatIn),
+    type(typeIn),
+    outputPitch(outputPitchIn),
+    packBuffer(packIn.pixelBuffer.get()),
+    pack(packIn.alignment, packIn.reverseRowOrder),
+    offset(offsetIn)
+{}
+
+namespace gl_d3d11
+{
+
+D3D11_MAP GetD3DMapTypeFromBits(GLbitfield access)
+{
+    bool readBit = ((access &amp; GL_MAP_READ_BIT) != 0);
+    bool writeBit = ((access &amp; GL_MAP_WRITE_BIT) != 0);
+
+    ASSERT(readBit || writeBit);
+
+    // Note : we ignore the discard bit, because in D3D11, staging buffers
+    //  don't accept the map-discard flag (discard only works for DYNAMIC usage)
+
+    if (readBit &amp;&amp; !writeBit)
+    {
+        return D3D11_MAP_READ;
+    }
+    else if (writeBit &amp;&amp; !readBit)
+    {
+        return D3D11_MAP_WRITE;
+    }
+    else if (writeBit &amp;&amp; readBit)
+    {
+        return D3D11_MAP_READ_WRITE;
+    }
+    else
+    {
+        UNREACHABLE();
+        return D3D11_MAP_READ;
+    }
+}
+
+}
+
+// Each instance of Buffer11::BufferStorage is specialized for a class of D3D binding points
+// - vertex/transform feedback buffers
+// - index buffers
+// - pixel unpack buffers
+// - uniform buffers
+class Buffer11::BufferStorage : angle::NonCopyable
+{
+  public:
+    virtual ~BufferStorage() {}
+
+    DataRevision getDataRevision() const { return mRevision; }
+    BufferUsage getUsage() const { return mUsage; }
+    size_t getSize() const { return mBufferSize; }
+    void setDataRevision(DataRevision rev) { mRevision = rev; }
+
+    virtual bool isMappable() const = 0;
+
+    virtual bool copyFromStorage(BufferStorage *source, size_t sourceOffset,
+                                 size_t size, size_t destOffset) = 0;
+    virtual gl::Error resize(size_t size, bool preserveData) = 0;
+
+    virtual uint8_t *map(size_t offset, size_t length, GLbitfield access) = 0;
+    virtual void unmap() = 0;
+
+    gl::Error setData(const uint8_t *data, size_t offset, size_t size);
+
+  protected:
+    BufferStorage(Renderer11 *renderer, BufferUsage usage);
+
+    Renderer11 *mRenderer;
+    DataRevision mRevision;
+    const BufferUsage mUsage;
+    size_t mBufferSize;
+};
+
+// A native buffer storage represents an underlying D3D11 buffer for a particular
+// type of storage.
+class Buffer11::NativeStorage : public Buffer11::BufferStorage
+{
+  public:
+    NativeStorage(Renderer11 *renderer, BufferUsage usage);
+    ~NativeStorage() override;
+
+    bool isMappable() const override { return mUsage == BUFFER_USAGE_STAGING; }
+
+    ID3D11Buffer *getNativeStorage() const { return mNativeStorage; }
+
+    bool copyFromStorage(BufferStorage *source, size_t sourceOffset,
+                         size_t size, size_t destOffset) override;
+    gl::Error resize(size_t size, bool preserveData) override;
+
+    uint8_t *map(size_t offset, size_t length, GLbitfield access) override;
+    void unmap() override;
+
+  private:
+    static void fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer11 *renderer, BufferUsage usage, unsigned int bufferSize);
+
+    ID3D11Buffer *mNativeStorage;
+};
+
+// Pack storage represents internal storage for pack buffers. We implement pack buffers
+// as CPU memory, tied to a staging texture, for asynchronous texture readback.
+class Buffer11::PackStorage : public Buffer11::BufferStorage
+{
+  public:
+    explicit PackStorage(Renderer11 *renderer);
+    ~PackStorage() override;
+
+    bool isMappable() const override { return true; }
+
+    bool copyFromStorage(BufferStorage *source, size_t sourceOffset,
+                         size_t size, size_t destOffset) override;
+    gl::Error resize(size_t size, bool preserveData) override;
+
+    uint8_t *map(size_t offset, size_t length, GLbitfield access) override;
+    void unmap() override;
+
+    gl::Error packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &amp;params);
+
+  private:
+    gl::Error flushQueuedPackCommand();
+
+    ID3D11Texture2D *mStagingTexture;
+    DXGI_FORMAT mTextureFormat;
+    gl::Extents mTextureSize;
+    MemoryBuffer mMemoryBuffer;
+    PackPixelsParams *mQueuedPackCommand;
+    PackPixelsParams mPackParams;
+    bool mDataModified;
+};
+
+// System memory storage stores a CPU memory buffer with our buffer data.
+// For dynamic data, it's much faster to update the CPU memory buffer than
+// it is to update a D3D staging buffer and read it back later.
+class Buffer11::SystemMemoryStorage : public Buffer11::BufferStorage
+{
+  public:
+    explicit SystemMemoryStorage(Renderer11 *renderer);
+    ~SystemMemoryStorage() override {}
+
+    bool isMappable() const override { return true; }
+
+    bool copyFromStorage(BufferStorage *source, size_t sourceOffset,
+                         size_t size, size_t destOffset) override;
+    gl::Error resize(size_t size, bool preserveData) override;
+
+    uint8_t *map(size_t offset, size_t length, GLbitfield access) override;
+    void unmap() override;
+
+    MemoryBuffer *getSystemCopy() { return &amp;mSystemCopy; }
+
+  protected:
+    MemoryBuffer mSystemCopy;
+};
+
+Buffer11::Buffer11(Renderer11 *renderer)
+    : BufferD3D(renderer),
+      mRenderer(renderer),
+      mSize(0),
+      mMappedStorage(NULL),
+      mConstantBufferStorageAdditionalSize(0),
+      mMaxConstantBufferLruCount(0),
+      mReadUsageCount(0),
+      mHasSystemMemoryStorage(false)
+{}
+
+Buffer11::~Buffer11()
+{
+    for (auto &amp;p : mBufferStorages)
+    {
+        SafeDelete(p.second);
+    }
+
+    for (auto &amp;p : mConstantBufferRangeStoragesCache)
+    {
+        SafeDelete(p.second.storage);
+    }
+}
+
+gl::Error Buffer11::setData(const void *data, size_t size, GLenum usage)
+{
+    gl::Error error = setSubData(data, size, 0);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (usage == GL_STATIC_DRAW)
+    {
+        initializeStaticData();
+    }
+
+    return error;
+}
+
+gl::Error Buffer11::getData(const uint8_t **outData)
+{
+    SystemMemoryStorage *systemMemoryStorage = nullptr;
+    gl::Error error = getSystemMemoryStorage(&amp;systemMemoryStorage);
+
+    if (error.isError())
+    {
+        *outData = nullptr;
+        return error;
+    }
+
+    mReadUsageCount = 0;
+
+    ASSERT(systemMemoryStorage-&gt;getSize() &gt;= mSize);
+
+    *outData = systemMemoryStorage-&gt;getSystemCopy()-&gt;data();
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer11::getSystemMemoryStorage(SystemMemoryStorage **storageOut)
+{
+    BufferStorage *memStorageUntyped = getBufferStorage(BUFFER_USAGE_SYSTEM_MEMORY);
+
+    if (memStorageUntyped == nullptr)
+    {
+        // TODO(jmadill): convert all to errors
+        return gl::Error(GL_OUT_OF_MEMORY);
+    }
+
+    *storageOut = GetAs&lt;SystemMemoryStorage&gt;(memStorageUntyped);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer11::setSubData(const void *data, size_t size, size_t offset)
+{
+    size_t requiredSize = size + offset;
+
+    if (data &amp;&amp; size &gt; 0)
+    {
+        // Use system memory storage for dynamic buffers.
+
+        BufferStorage *writeBuffer = nullptr;
+        if (supportsDirectBinding())
+        {
+            writeBuffer = getStagingStorage();
+
+            if (!writeBuffer)
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal buffer.&quot;);
+            }
+        }
+        else
+        {
+            SystemMemoryStorage *systemMemoryStorage = nullptr;
+            gl::Error error = getSystemMemoryStorage(&amp;systemMemoryStorage);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            writeBuffer = systemMemoryStorage;
+        }
+
+        ASSERT(writeBuffer);
+
+        // Explicitly resize the staging buffer, preserving data if the new data will not
+        // completely fill the buffer
+        if (writeBuffer-&gt;getSize() &lt; requiredSize)
+        {
+            bool preserveData = (offset &gt; 0);
+            gl::Error error = writeBuffer-&gt;resize(requiredSize, preserveData);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+
+        writeBuffer-&gt;setData(static_cast&lt;const uint8_t *&gt;(data), offset, size);
+        writeBuffer-&gt;setDataRevision(writeBuffer-&gt;getDataRevision() + 1);
+    }
+
+    mSize = std::max(mSize, requiredSize);
+    invalidateStaticData();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer11::copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
+{
+    Buffer11 *sourceBuffer = GetAs&lt;Buffer11&gt;(source);
+    ASSERT(sourceBuffer != NULL);
+
+    BufferStorage *copyDest = getLatestBufferStorage();
+    if (!copyDest)
+    {
+        copyDest = getStagingStorage();
+    }
+
+    BufferStorage *copySource = sourceBuffer-&gt;getLatestBufferStorage();
+
+    if (!copySource || !copyDest)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal staging buffer.&quot;);
+    }
+
+    // If copying to/from a pixel pack buffer, we must have a staging or
+    // pack buffer partner, because other native buffers can't be mapped
+    if (copyDest-&gt;getUsage() == BUFFER_USAGE_PIXEL_PACK &amp;&amp; !copySource-&gt;isMappable())
+    {
+        copySource = sourceBuffer-&gt;getStagingStorage();
+    }
+    else if (copySource-&gt;getUsage() == BUFFER_USAGE_PIXEL_PACK &amp;&amp; !copyDest-&gt;isMappable())
+    {
+        copyDest = getStagingStorage();
+    }
+
+    // D3D11 does not allow overlapped copies until 11.1, and only if the
+    // device supports D3D11_FEATURE_DATA_D3D11_OPTIONS::CopyWithOverlap
+    // Get around this via a different source buffer
+    if (copySource == copyDest)
+    {
+        if (copySource-&gt;getUsage() == BUFFER_USAGE_STAGING)
+        {
+            copySource = getBufferStorage(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+        }
+        else
+        {
+            copySource = getStagingStorage();
+        }
+    }
+
+    copyDest-&gt;copyFromStorage(copySource, sourceOffset, size, destOffset);
+    copyDest-&gt;setDataRevision(copyDest-&gt;getDataRevision() + 1);
+
+    mSize = std::max&lt;size_t&gt;(mSize, destOffset + size);
+    invalidateStaticData();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer11::map(GLenum access, GLvoid **mapPtr)
+{
+    // GL_OES_mapbuffer uses an enum instead of a bitfield for it's access, convert to a bitfield
+    // and call mapRange.
+    ASSERT(access == GL_WRITE_ONLY_OES);
+    return mapRange(0, mSize, GL_MAP_WRITE_BIT, mapPtr);
+}
+
+gl::Error Buffer11::mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr)
+{
+    ASSERT(!mMappedStorage);
+
+    BufferStorage *latestStorage = getLatestBufferStorage();
+    if (latestStorage &amp;&amp;
+        (latestStorage-&gt;getUsage() == BUFFER_USAGE_PIXEL_PACK ||
+         latestStorage-&gt;getUsage() == BUFFER_USAGE_STAGING))
+    {
+        // Latest storage is mappable.
+        mMappedStorage = latestStorage;
+    }
+    else
+    {
+        // Fall back to using the staging buffer if the latest storage does
+        // not exist or is not CPU-accessible.
+        mMappedStorage = getStagingStorage();
+    }
+
+    if (!mMappedStorage)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate mappable internal buffer.&quot;);
+    }
+
+    if ((access &amp; GL_MAP_WRITE_BIT) &gt; 0)
+    {
+        // Update the data revision immediately, since the data might be changed at any time
+        mMappedStorage-&gt;setDataRevision(mMappedStorage-&gt;getDataRevision() + 1);
+    }
+
+    uint8_t *mappedBuffer = mMappedStorage-&gt;map(offset, length, access);
+    if (!mappedBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal buffer.&quot;);
+    }
+
+    *mapPtr = static_cast&lt;GLvoid *&gt;(mappedBuffer);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer11::unmap(GLboolean *result)
+{
+    ASSERT(mMappedStorage);
+    mMappedStorage-&gt;unmap();
+    mMappedStorage = NULL;
+
+    // TODO: detect if we had corruption. if so, return false.
+    *result = GL_TRUE;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Buffer11::markTransformFeedbackUsage()
+{
+    BufferStorage *transformFeedbackStorage = getBufferStorage(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+
+    if (transformFeedbackStorage)
+    {
+        transformFeedbackStorage-&gt;setDataRevision(transformFeedbackStorage-&gt;getDataRevision() + 1);
+    }
+
+    invalidateStaticData();
+}
+
+void Buffer11::markBufferUsage()
+{
+    mReadUsageCount++;
+
+    // Free the system memory storage if we decide it isn't being used very often.
+    const unsigned int usageLimit = 5;
+
+    if (mReadUsageCount &gt; usageLimit &amp;&amp; mHasSystemMemoryStorage)
+    {
+        auto systemMemoryStorageIt = mBufferStorages.find(BUFFER_USAGE_SYSTEM_MEMORY);
+        ASSERT(systemMemoryStorageIt != mBufferStorages.end());
+
+        if (getLatestBufferStorage() != systemMemoryStorageIt-&gt;second)
+        {
+            SafeDelete(systemMemoryStorageIt-&gt;second);
+            mBufferStorages.erase(systemMemoryStorageIt);
+            mHasSystemMemoryStorage = false;
+        }
+    }
+}
+
+ID3D11Buffer *Buffer11::getBuffer(BufferUsage usage)
+{
+    markBufferUsage();
+
+    BufferStorage *bufferStorage = getBufferStorage(usage);
+
+    if (!bufferStorage)
+    {
+        // Storage out-of-memory
+        return NULL;
+    }
+
+    return GetAs&lt;NativeStorage&gt;(bufferStorage)-&gt;getNativeStorage();
+}
+
+ID3D11Buffer *Buffer11::getConstantBufferRange(GLintptr offset, GLsizeiptr size)
+{
+    markBufferUsage();
+
+    BufferStorage *bufferStorage;
+
+    if (offset == 0)
+    {
+        bufferStorage = getBufferStorage(BUFFER_USAGE_UNIFORM);
+    }
+    else
+    {
+        bufferStorage = getContantBufferRangeStorage(offset, size);
+    }
+
+    if (!bufferStorage)
+    {
+        // Storage out-of-memory
+        return NULL;
+    }
+
+    return GetAs&lt;NativeStorage&gt;(bufferStorage)-&gt;getNativeStorage();
+}
+
+ID3D11ShaderResourceView *Buffer11::getSRV(DXGI_FORMAT srvFormat)
+{
+    BufferStorage *storage = getBufferStorage(BUFFER_USAGE_PIXEL_UNPACK);
+
+    if (!storage)
+    {
+        // Storage out-of-memory
+        return NULL;
+    }
+
+    ID3D11Buffer *buffer = GetAs&lt;NativeStorage&gt;(storage)-&gt;getNativeStorage();
+
+    auto bufferSRVIt = mBufferResourceViews.find(srvFormat);
+
+    if (bufferSRVIt != mBufferResourceViews.end())
+    {
+        if (bufferSRVIt-&gt;second.first == buffer)
+        {
+            return bufferSRVIt-&gt;second.second;
+        }
+        else
+        {
+            // The underlying buffer has changed since the SRV was created: recreate the SRV.
+            SafeRelease(bufferSRVIt-&gt;second.second);
+        }
+    }
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    ID3D11ShaderResourceView *bufferSRV = NULL;
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(srvFormat);
+
+    D3D11_SHADER_RESOURCE_VIEW_DESC bufferSRVDesc;
+    bufferSRVDesc.Buffer.ElementOffset = 0;
+    bufferSRVDesc.Buffer.ElementWidth = mSize / dxgiFormatInfo.pixelBytes;
+    bufferSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
+    bufferSRVDesc.Format = srvFormat;
+
+    HRESULT result = device-&gt;CreateShaderResourceView(buffer, &amp;bufferSRVDesc, &amp;bufferSRV);
+    UNUSED_ASSERTION_VARIABLE(result);
+    ASSERT(SUCCEEDED(result));
+
+    mBufferResourceViews[srvFormat] = BufferSRVPair(buffer, bufferSRV);
+
+    return bufferSRV;
+}
+
+gl::Error Buffer11::packPixels(ID3D11Texture2D *srcTexture, UINT srcSubresource, const PackPixelsParams &amp;params)
+{
+    PackStorage *packStorage = getPackStorage();
+    BufferStorage *latestStorage = getLatestBufferStorage();
+
+    if (packStorage)
+    {
+        gl::Error error = packStorage-&gt;packPixels(srcTexture, srcSubresource, params);
+        if (error.isError())
+        {
+            return error;
+        }
+        packStorage-&gt;setDataRevision(latestStorage ? latestStorage-&gt;getDataRevision() + 1 : 1);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+Buffer11::BufferStorage *Buffer11::getBufferStorage(BufferUsage usage)
+{
+    BufferStorage *newStorage = NULL;
+    auto directBufferIt = mBufferStorages.find(usage);
+    if (directBufferIt != mBufferStorages.end())
+    {
+        newStorage = directBufferIt-&gt;second;
+    }
+
+    if (!newStorage)
+    {
+        if (usage == BUFFER_USAGE_PIXEL_PACK)
+        {
+            newStorage = new PackStorage(mRenderer);
+        }
+        else if (usage == BUFFER_USAGE_SYSTEM_MEMORY)
+        {
+            newStorage = new SystemMemoryStorage(mRenderer);
+            mHasSystemMemoryStorage = true;
+        }
+        else
+        {
+            // buffer is not allocated, create it
+            newStorage = new NativeStorage(mRenderer, usage);
+        }
+
+        mBufferStorages.insert(std::make_pair(usage, newStorage));
+    }
+
+    // resize buffer
+    if (newStorage-&gt;getSize() &lt; mSize)
+    {
+        if (newStorage-&gt;resize(mSize, true).isError())
+        {
+            // Out of memory error
+            return NULL;
+        }
+    }
+
+    updateBufferStorage(newStorage, 0, mSize);
+
+    return newStorage;
+}
+
+Buffer11::BufferStorage *Buffer11::getContantBufferRangeStorage(GLintptr offset, GLsizeiptr size)
+{
+    BufferStorage *newStorage;
+
+    {
+        // Keep the cacheEntry in a limited scope because it may be invalidated later in the code if we need to reclaim some space.
+        ConstantBufferCacheEntry *cacheEntry = &amp;mConstantBufferRangeStoragesCache[offset];
+
+        if (!cacheEntry-&gt;storage)
+        {
+            cacheEntry-&gt;storage = new NativeStorage(mRenderer, BUFFER_USAGE_UNIFORM);
+            cacheEntry-&gt;lruCount = ++mMaxConstantBufferLruCount;
+        }
+
+        cacheEntry-&gt;lruCount = ++mMaxConstantBufferLruCount;
+        newStorage = cacheEntry-&gt;storage;
+    }
+
+    if (newStorage-&gt;getSize() &lt; static_cast&lt;size_t&gt;(size))
+    {
+        size_t maximumAllowedAdditionalSize = 2 * getSize();
+
+        size_t sizeDelta = size - newStorage-&gt;getSize();
+
+        while (mConstantBufferStorageAdditionalSize + sizeDelta &gt; maximumAllowedAdditionalSize)
+        {
+            auto iter = std::min_element(std::begin(mConstantBufferRangeStoragesCache), std::end(mConstantBufferRangeStoragesCache),
+                [](const ConstantBufferCache::value_type &amp;a, const ConstantBufferCache::value_type &amp;b)
+                {
+                    return a.second.lruCount &lt; b.second.lruCount;
+                });
+
+            ASSERT(iter-&gt;second.storage != newStorage);
+            ASSERT(mConstantBufferStorageAdditionalSize &gt;= iter-&gt;second.storage-&gt;getSize());
+
+            mConstantBufferStorageAdditionalSize -= iter-&gt;second.storage-&gt;getSize();
+            SafeDelete(iter-&gt;second.storage);
+            mConstantBufferRangeStoragesCache.erase(iter);
+        }
+
+        if (newStorage-&gt;resize(size, false).isError())
+        {
+            // Out of memory error
+            return nullptr;
+        }
+
+        mConstantBufferStorageAdditionalSize += sizeDelta;
+
+        // We don't copy the old data when resizing the constant buffer because the data may be out-of-date
+        // therefore we reset the data revision and let updateBufferStorage() handle the copy.
+        newStorage-&gt;setDataRevision(0);
+    }
+
+    updateBufferStorage(newStorage, offset, size);
+
+    return newStorage;
+}
+
+void Buffer11::updateBufferStorage(BufferStorage *storage, size_t sourceOffset, size_t storageSize)
+{
+    BufferStorage *latestBuffer = getLatestBufferStorage();
+    if (latestBuffer &amp;&amp; latestBuffer-&gt;getDataRevision() &gt; storage-&gt;getDataRevision())
+    {
+        // Copy through a staging buffer if we're copying from or to a non-staging, mappable
+        // buffer storage. This is because we can't map a GPU buffer, and copy CPU
+        // data directly. If we're already using a staging buffer we're fine.
+        if (latestBuffer-&gt;getUsage() != BUFFER_USAGE_STAGING &amp;&amp;
+            storage-&gt;getUsage() != BUFFER_USAGE_STAGING &amp;&amp;
+            (!latestBuffer-&gt;isMappable() || !storage-&gt;isMappable()))
+        {
+            NativeStorage *stagingBuffer = getStagingStorage();
+
+            stagingBuffer-&gt;copyFromStorage(latestBuffer, 0, latestBuffer-&gt;getSize(), 0);
+            stagingBuffer-&gt;setDataRevision(latestBuffer-&gt;getDataRevision());
+
+            latestBuffer = stagingBuffer;
+        }
+
+        // if copyFromStorage returns true, the D3D buffer has been recreated
+        // and we should update our serial
+        if (storage-&gt;copyFromStorage(latestBuffer, sourceOffset, storageSize, 0))
+        {
+            updateSerial();
+        }
+        storage-&gt;setDataRevision(latestBuffer-&gt;getDataRevision());
+    }
+}
+
+Buffer11::BufferStorage *Buffer11::getLatestBufferStorage() const
+{
+    // Even though we iterate over all the direct buffers, it is expected that only
+    // 1 or 2 will be present.
+    BufferStorage *latestStorage = NULL;
+    DataRevision latestRevision = 0;
+    for (auto it = mBufferStorages.begin(); it != mBufferStorages.end(); it++)
+    {
+        BufferStorage *storage = it-&gt;second;
+        if (!latestStorage || storage-&gt;getDataRevision() &gt; latestRevision)
+        {
+            latestStorage = storage;
+            latestRevision = storage-&gt;getDataRevision();
+        }
+    }
+
+    // resize buffer
+    if (latestStorage &amp;&amp; latestStorage-&gt;getSize() &lt; mSize)
+    {
+        if (latestStorage-&gt;resize(mSize, true).isError())
+        {
+            // Out of memory error
+            return NULL;
+        }
+    }
+
+    return latestStorage;
+}
+
+Buffer11::NativeStorage *Buffer11::getStagingStorage()
+{
+    BufferStorage *stagingStorage = getBufferStorage(BUFFER_USAGE_STAGING);
+
+    if (!stagingStorage)
+    {
+        // Out-of-memory
+        return NULL;
+    }
+
+    return GetAs&lt;NativeStorage&gt;(stagingStorage);
+}
+
+Buffer11::PackStorage *Buffer11::getPackStorage()
+{
+    BufferStorage *packStorage = getBufferStorage(BUFFER_USAGE_PIXEL_PACK);
+
+    if (!packStorage)
+    {
+        // Out-of-memory
+        return NULL;
+    }
+
+    return GetAs&lt;PackStorage&gt;(packStorage);
+}
+
+bool Buffer11::supportsDirectBinding() const
+{
+    // Do not support direct buffers for dynamic data. The streaming buffer
+    // offers better performance for data which changes every frame.
+    // Check for absence of static buffer interfaces to detect dynamic data.
+    return (mStaticVertexBuffer &amp;&amp; mStaticIndexBuffer);
+}
+
+Buffer11::BufferStorage::BufferStorage(Renderer11 *renderer, BufferUsage usage)
+    : mRenderer(renderer),
+      mUsage(usage),
+      mRevision(0),
+      mBufferSize(0)
+{
+}
+
+gl::Error Buffer11::BufferStorage::setData(const uint8_t *data, size_t offset, size_t size)
+{
+    ASSERT(isMappable());
+
+    uint8_t *writePointer = map(offset, size, GL_MAP_WRITE_BIT);
+    if (!writePointer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal buffer.&quot;);
+    }
+
+    memcpy(writePointer, data, size);
+
+    unmap();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+Buffer11::NativeStorage::NativeStorage(Renderer11 *renderer, BufferUsage usage)
+    : BufferStorage(renderer, usage),
+      mNativeStorage(NULL)
+{
+}
+
+Buffer11::NativeStorage::~NativeStorage()
+{
+    SafeRelease(mNativeStorage);
+}
+
+// Returns true if it recreates the direct buffer
+bool Buffer11::NativeStorage::copyFromStorage(BufferStorage *source, size_t sourceOffset,
+                                               size_t size, size_t destOffset)
+{
+    ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+
+    size_t requiredSize = destOffset + size;
+    bool createBuffer = !mNativeStorage || mBufferSize &lt; requiredSize;
+
+    // (Re)initialize D3D buffer if needed
+    if (createBuffer)
+    {
+        bool preserveData = (destOffset &gt; 0);
+        resize(requiredSize, preserveData);
+    }
+
+    if (source-&gt;getUsage() == BUFFER_USAGE_PIXEL_PACK ||
+        source-&gt;getUsage() == BUFFER_USAGE_SYSTEM_MEMORY)
+    {
+        ASSERT(source-&gt;isMappable());
+
+        uint8_t *sourcePointer = source-&gt;map(sourceOffset, size, GL_MAP_READ_BIT);
+
+        D3D11_MAPPED_SUBRESOURCE mappedResource;
+        HRESULT hr = context-&gt;Map(mNativeStorage, 0, D3D11_MAP_WRITE, 0, &amp;mappedResource);
+        UNUSED_ASSERTION_VARIABLE(hr);
+        ASSERT(SUCCEEDED(hr));
+
+        uint8_t *destPointer = static_cast&lt;uint8_t *&gt;(mappedResource.pData) + destOffset;
+
+        // Offset bounds are validated at the API layer
+        ASSERT(sourceOffset + size &lt;= destOffset + mBufferSize);
+        memcpy(destPointer, sourcePointer, size);
+
+        context-&gt;Unmap(mNativeStorage, 0);
+        source-&gt;unmap();
+    }
+    else
+    {
+        D3D11_BOX srcBox;
+        srcBox.left = sourceOffset;
+        srcBox.right = sourceOffset + size;
+        srcBox.top = 0;
+        srcBox.bottom = 1;
+        srcBox.front = 0;
+        srcBox.back = 1;
+
+        ID3D11Buffer *sourceBuffer = GetAs&lt;NativeStorage&gt;(source)-&gt;getNativeStorage();
+
+        context-&gt;CopySubresourceRegion(mNativeStorage, 0, destOffset, 0, 0, sourceBuffer, 0, &amp;srcBox);
+    }
+
+    return createBuffer;
+}
+
+gl::Error Buffer11::NativeStorage::resize(size_t size, bool preserveData)
+{
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+
+    D3D11_BUFFER_DESC bufferDesc;
+    fillBufferDesc(&amp;bufferDesc, mRenderer, mUsage, size);
+
+    ID3D11Buffer *newBuffer;
+    HRESULT result = device-&gt;CreateBuffer(&amp;bufferDesc, NULL, &amp;newBuffer);
+
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal buffer, result: 0x%X.&quot;, result);
+    }
+
+    d3d11::SetDebugName(newBuffer, &quot;Buffer11::NativeStorage&quot;);
+
+    if (mNativeStorage &amp;&amp; preserveData)
+    {
+        // We don't call resize if the buffer is big enough already.
+        ASSERT(mBufferSize &lt;= size);
+
+        D3D11_BOX srcBox;
+        srcBox.left = 0;
+        srcBox.right = mBufferSize;
+        srcBox.top = 0;
+        srcBox.bottom = 1;
+        srcBox.front = 0;
+        srcBox.back = 1;
+
+        context-&gt;CopySubresourceRegion(newBuffer, 0, 0, 0, 0, mNativeStorage, 0, &amp;srcBox);
+    }
+
+    // No longer need the old buffer
+    SafeRelease(mNativeStorage);
+    mNativeStorage = newBuffer;
+
+    mBufferSize = bufferDesc.ByteWidth;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Buffer11::NativeStorage::fillBufferDesc(D3D11_BUFFER_DESC* bufferDesc, Renderer11 *renderer,
+                                                     BufferUsage usage, unsigned int bufferSize)
+{
+    bufferDesc-&gt;ByteWidth = bufferSize;
+    bufferDesc-&gt;MiscFlags = 0;
+    bufferDesc-&gt;StructureByteStride = 0;
+
+    switch (usage)
+    {
+      case BUFFER_USAGE_STAGING:
+        bufferDesc-&gt;Usage = D3D11_USAGE_STAGING;
+        bufferDesc-&gt;BindFlags = 0;
+        bufferDesc-&gt;CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+        break;
+
+      case BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK:
+        bufferDesc-&gt;Usage = D3D11_USAGE_DEFAULT;
+        bufferDesc-&gt;BindFlags = D3D11_BIND_VERTEX_BUFFER;
+
+        if (renderer-&gt;isES3Capable())
+        {
+            bufferDesc-&gt;BindFlags |= D3D11_BIND_STREAM_OUTPUT;
+        }
+
+        bufferDesc-&gt;CPUAccessFlags = 0;
+        break;
+
+      case BUFFER_USAGE_INDEX:
+        bufferDesc-&gt;Usage = D3D11_USAGE_DEFAULT;
+        bufferDesc-&gt;BindFlags = D3D11_BIND_INDEX_BUFFER;
+        bufferDesc-&gt;CPUAccessFlags = 0;
+        break;
+
+      case BUFFER_USAGE_PIXEL_UNPACK:
+        bufferDesc-&gt;Usage = D3D11_USAGE_DEFAULT;
+        bufferDesc-&gt;BindFlags = D3D11_BIND_SHADER_RESOURCE;
+        bufferDesc-&gt;CPUAccessFlags = 0;
+        break;
+
+      case BUFFER_USAGE_UNIFORM:
+        bufferDesc-&gt;Usage = D3D11_USAGE_DYNAMIC;
+        bufferDesc-&gt;BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+        bufferDesc-&gt;CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+
+        // Constant buffers must be of a limited size, and aligned to 16 byte boundaries
+        // For our purposes we ignore any buffer data past the maximum constant buffer size
+        bufferDesc-&gt;ByteWidth = roundUp(bufferDesc-&gt;ByteWidth, 16u);
+        bufferDesc-&gt;ByteWidth = std::min&lt;UINT&gt;(bufferDesc-&gt;ByteWidth, static_cast&lt;UINT&gt;(renderer-&gt;getRendererCaps().maxUniformBlockSize));
+        break;
+
+      default:
+        UNREACHABLE();
+    }
+}
+
+uint8_t *Buffer11::NativeStorage::map(size_t offset, size_t length, GLbitfield access)
+{
+    ASSERT(mUsage == BUFFER_USAGE_STAGING);
+
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+    D3D11_MAP d3dMapType = gl_d3d11::GetD3DMapTypeFromBits(access);
+    UINT d3dMapFlag = ((access &amp; GL_MAP_UNSYNCHRONIZED_BIT) != 0 ? D3D11_MAP_FLAG_DO_NOT_WAIT : 0);
+
+    HRESULT result = context-&gt;Map(mNativeStorage, 0, d3dMapType, d3dMapFlag, &amp;mappedResource);
+    UNUSED_ASSERTION_VARIABLE(result);
+    ASSERT(SUCCEEDED(result));
+
+    return static_cast&lt;uint8_t*&gt;(mappedResource.pData) + offset;
+}
+
+void Buffer11::NativeStorage::unmap()
+{
+    ASSERT(mUsage == BUFFER_USAGE_STAGING);
+    ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+    context-&gt;Unmap(mNativeStorage, 0);
+}
+
+Buffer11::PackStorage::PackStorage(Renderer11 *renderer)
+    : BufferStorage(renderer, BUFFER_USAGE_PIXEL_PACK),
+      mStagingTexture(NULL),
+      mTextureFormat(DXGI_FORMAT_UNKNOWN),
+      mQueuedPackCommand(NULL),
+      mDataModified(false)
+{
+}
+
+Buffer11::PackStorage::~PackStorage()
+{
+    SafeRelease(mStagingTexture);
+    SafeDelete(mQueuedPackCommand);
+}
+
+bool Buffer11::PackStorage::copyFromStorage(BufferStorage *source, size_t sourceOffset,
+                                              size_t size, size_t destOffset)
+{
+    // We copy through a staging buffer when drawing with a pack buffer,
+    // or for other cases where we access the pack buffer
+    UNREACHABLE();
+    return false;
+}
+
+gl::Error Buffer11::PackStorage::resize(size_t size, bool preserveData)
+{
+    if (size != mBufferSize)
+    {
+        if (!mMemoryBuffer.resize(size))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to resize internal buffer storage.&quot;);
+        }
+        mBufferSize = size;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+uint8_t *Buffer11::PackStorage::map(size_t offset, size_t length, GLbitfield access)
+{
+    ASSERT(offset + length &lt;= getSize());
+    // TODO: fast path
+    //  We might be able to optimize out one or more memcpy calls by detecting when
+    //  and if D3D packs the staging texture memory identically to how we would fill
+    //  the pack buffer according to the current pack state.
+
+    gl::Error error = flushQueuedPackCommand();
+    if (error.isError())
+    {
+        return NULL;
+    }
+
+    mDataModified = (mDataModified || (access &amp; GL_MAP_WRITE_BIT) != 0);
+
+    return mMemoryBuffer.data() + offset;
+}
+
+void Buffer11::PackStorage::unmap()
+{
+    // No-op
+}
+
+gl::Error Buffer11::PackStorage::packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &amp;params)
+{
+    gl::Error error = flushQueuedPackCommand();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mQueuedPackCommand = new PackPixelsParams(params);
+
+    D3D11_TEXTURE2D_DESC textureDesc;
+    srcTexure-&gt;GetDesc(&amp;textureDesc);
+
+    if (mStagingTexture != NULL &amp;&amp;
+        (mTextureFormat != textureDesc.Format ||
+         mTextureSize.width != params.area.width ||
+         mTextureSize.height != params.area.height))
+    {
+        SafeRelease(mStagingTexture);
+        mTextureSize.width = 0;
+        mTextureSize.height = 0;
+        mTextureFormat = DXGI_FORMAT_UNKNOWN;
+    }
+
+    if (mStagingTexture == NULL)
+    {
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+        HRESULT hr;
+
+        mTextureSize.width = params.area.width;
+        mTextureSize.height = params.area.height;
+        mTextureFormat = textureDesc.Format;
+
+        D3D11_TEXTURE2D_DESC stagingDesc;
+        stagingDesc.Width = params.area.width;
+        stagingDesc.Height = params.area.height;
+        stagingDesc.MipLevels = 1;
+        stagingDesc.ArraySize = 1;
+        stagingDesc.Format = mTextureFormat;
+        stagingDesc.SampleDesc.Count = 1;
+        stagingDesc.SampleDesc.Quality = 0;
+        stagingDesc.Usage = D3D11_USAGE_STAGING;
+        stagingDesc.BindFlags = 0;
+        stagingDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+        stagingDesc.MiscFlags = 0;
+
+        hr = device-&gt;CreateTexture2D(&amp;stagingDesc, NULL, &amp;mStagingTexture);
+        if (FAILED(hr))
+        {
+            ASSERT(hr == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal staging texture.&quot;);
+        }
+    }
+
+    // ReadPixels from multisampled FBOs isn't supported in current GL
+    ASSERT(textureDesc.SampleDesc.Count &lt;= 1);
+
+    ID3D11DeviceContext *immediateContext = mRenderer-&gt;getDeviceContext();
+    D3D11_BOX srcBox;
+    srcBox.left   = params.area.x;
+    srcBox.right  = params.area.x + params.area.width;
+    srcBox.top    = params.area.y;
+    srcBox.bottom = params.area.y + params.area.height;
+    srcBox.front  = 0;
+    srcBox.back   = 1;
+
+    // Asynchronous copy
+    immediateContext-&gt;CopySubresourceRegion(mStagingTexture, 0, 0, 0, 0, srcTexure, srcSubresource, &amp;srcBox);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer11::PackStorage::flushQueuedPackCommand()
+{
+    ASSERT(mMemoryBuffer.size() &gt; 0);
+
+    if (mQueuedPackCommand)
+    {
+        gl::Error error = mRenderer-&gt;packPixels(mStagingTexture, *mQueuedPackCommand, mMemoryBuffer.data());
+        SafeDelete(mQueuedPackCommand);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+Buffer11::SystemMemoryStorage::SystemMemoryStorage(Renderer11 *renderer)
+    : Buffer11::BufferStorage(renderer, BUFFER_USAGE_SYSTEM_MEMORY)
+{}
+
+bool Buffer11::SystemMemoryStorage::copyFromStorage(BufferStorage *source, size_t sourceOffset,
+                                                    size_t size, size_t destOffset)
+{
+    ASSERT(source-&gt;isMappable());
+    const uint8_t *sourceData = source-&gt;map(sourceOffset, size, GL_MAP_READ_BIT);
+    ASSERT(destOffset + size &lt;= mSystemCopy.size());
+    memcpy(mSystemCopy.data() + destOffset, sourceData, size);
+    source-&gt;unmap();
+    return true;
+}
+
+gl::Error Buffer11::SystemMemoryStorage::resize(size_t size, bool preserveData)
+{
+    if (mSystemCopy.size() &lt; size)
+    {
+        if (!mSystemCopy.resize(size))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to resize SystemMemoryStorage&quot;);
+        }
+        mBufferSize = size;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+uint8_t *Buffer11::SystemMemoryStorage::map(size_t offset, size_t length, GLbitfield access)
+{
+    ASSERT(!mSystemCopy.empty() &amp;&amp; offset + length &lt;= mSystemCopy.size());
+    return mSystemCopy.data() + offset;
+}
+
+void Buffer11::SystemMemoryStorage::unmap()
+{
+    // No-op
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Buffer11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Buffer11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Buffer11.h: Defines the rx::Buffer11 class which implements rx::BufferImpl via rx::BufferD3D.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+enum BufferUsage
+{
+    BUFFER_USAGE_STAGING,
+    BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK,
+    BUFFER_USAGE_INDEX,
+    BUFFER_USAGE_PIXEL_UNPACK,
+    BUFFER_USAGE_PIXEL_PACK,
+    BUFFER_USAGE_UNIFORM,
+    BUFFER_USAGE_SYSTEM_MEMORY,
+};
+
+struct PackPixelsParams
+{
+    PackPixelsParams();
+    PackPixelsParams(const gl::Rectangle &amp;area, GLenum format, GLenum type, GLuint outputPitch,
+                     const gl::PixelPackState &amp;pack, ptrdiff_t offset);
+
+    gl::Rectangle area;
+    GLenum format;
+    GLenum type;
+    GLuint outputPitch;
+    gl::Buffer *packBuffer;
+    gl::PixelPackState pack;
+    ptrdiff_t offset;
+};
+
+typedef size_t DataRevision;
+
+class Buffer11 : public BufferD3D
+{
+  public:
+    Buffer11(Renderer11 *renderer);
+    virtual ~Buffer11();
+
+    ID3D11Buffer *getBuffer(BufferUsage usage);
+    ID3D11Buffer *getConstantBufferRange(GLintptr offset, GLsizeiptr size);
+    ID3D11ShaderResourceView *getSRV(DXGI_FORMAT srvFormat);
+    bool isMapped() const { return mMappedStorage != NULL; }
+    gl::Error packPixels(ID3D11Texture2D *srcTexure, UINT srcSubresource, const PackPixelsParams &amp;params);
+
+    // BufferD3D implementation
+    virtual size_t getSize() const { return mSize; }
+    virtual bool supportsDirectBinding() const;
+
+    // BufferImpl implementation
+    virtual gl::Error setData(const void* data, size_t size, GLenum usage);
+    gl::Error getData(const uint8_t **outData) override;
+    virtual gl::Error setSubData(const void* data, size_t size, size_t offset);
+    virtual gl::Error copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
+    virtual gl::Error map(GLenum access, GLvoid **mapPtr);
+    virtual gl::Error mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr);
+    virtual gl::Error unmap(GLboolean *result);
+    virtual void markTransformFeedbackUsage();
+
+  private:
+    class BufferStorage;
+    class NativeStorage;
+    class PackStorage;
+    class SystemMemoryStorage;
+
+    Renderer11 *mRenderer;
+    size_t mSize;
+
+    BufferStorage *mMappedStorage;
+
+    std::map&lt;BufferUsage, BufferStorage*&gt; mBufferStorages;
+
+    struct ConstantBufferCacheEntry
+    {
+        ConstantBufferCacheEntry() : storage(nullptr), lruCount(0) { }
+
+        BufferStorage *storage;
+        unsigned int lruCount;
+    };
+
+    // Cache of D3D11 constant buffer for specific ranges of buffer data.
+    // This is used to emulate UBO ranges on 11.0 devices.
+    // Constant buffers are indexed by there start offset.
+    typedef std::map&lt;GLintptr /*offset*/, ConstantBufferCacheEntry&gt; ConstantBufferCache;
+    ConstantBufferCache mConstantBufferRangeStoragesCache;
+    size_t mConstantBufferStorageAdditionalSize;
+    unsigned int mMaxConstantBufferLruCount;
+
+    typedef std::pair&lt;ID3D11Buffer *, ID3D11ShaderResourceView *&gt; BufferSRVPair;
+    std::map&lt;DXGI_FORMAT, BufferSRVPair&gt; mBufferResourceViews;
+
+    unsigned int mReadUsageCount;
+    bool mHasSystemMemoryStorage;
+
+    void markBufferUsage();
+    NativeStorage *getStagingStorage();
+    PackStorage *getPackStorage();
+    gl::Error getSystemMemoryStorage(SystemMemoryStorage **storageOut);
+
+    void updateBufferStorage(BufferStorage *storage, size_t sourceOffset, size_t storageSize);
+    BufferStorage *getBufferStorage(BufferUsage usage);
+    BufferStorage *getLatestBufferStorage() const;
+
+    BufferStorage *getContantBufferRangeStorage(GLintptr offset, GLsizeiptr size);
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Clear11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,613 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Clear11.cpp: Framebuffer clear utility class.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Clear11.h&quot;
+
+#include &lt;algorithm&gt;
+
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;third_party/trace_event/trace_event.h&quot;
+
+// Precompiled shaders
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h&quot;
+
+namespace rx
+{
+
+template &lt;typename T&gt;
+static void ApplyVertices(const gl::Extents &amp;framebufferSize, const gl::Rectangle *scissor, const gl::Color&lt;T&gt; &amp;color, float depth, void *buffer)
+{
+    d3d11::PositionDepthColorVertex&lt;T&gt; *vertices = reinterpret_cast&lt;d3d11::PositionDepthColorVertex&lt;T&gt;*&gt;(buffer);
+
+    float depthClear = gl::clamp01(depth);
+    float left = -1.0f;
+    float right = 1.0f;
+    float top = -1.0f;
+    float bottom = 1.0f;
+
+    // Clip the quad coordinates to the scissor if needed
+    if (scissor != NULL)
+    {
+        left = std::max(left, (scissor-&gt;x / float(framebufferSize.width)) * 2.0f - 1.0f);
+        right = std::min(right, ((scissor-&gt;x + scissor-&gt;width) / float(framebufferSize.width)) * 2.0f - 1.0f);
+        top = std::max(top, ((framebufferSize.height - scissor-&gt;y - scissor-&gt;height) / float(framebufferSize.height)) * 2.0f - 1.0f);
+        bottom = std::min(bottom, ((framebufferSize.height - scissor-&gt;y) / float(framebufferSize.height)) * 2.0f - 1.0f);
+    }
+
+    d3d11::SetPositionDepthColorVertex&lt;T&gt;(vertices + 0, left,  bottom, depthClear, color);
+    d3d11::SetPositionDepthColorVertex&lt;T&gt;(vertices + 1, left,  top,    depthClear, color);
+    d3d11::SetPositionDepthColorVertex&lt;T&gt;(vertices + 2, right, bottom, depthClear, color);
+    d3d11::SetPositionDepthColorVertex&lt;T&gt;(vertices + 3, right, top,    depthClear, color);
+}
+
+template &lt;unsigned int vsSize, unsigned int psSize&gt;
+Clear11::ClearShader Clear11::CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE (&amp;vsByteCode)[vsSize], const BYTE (&amp;psByteCode)[psSize])
+{
+    HRESULT result;
+
+    ClearShader shader = { 0 };
+
+    D3D11_INPUT_ELEMENT_DESC quadLayout[] =
+    {
+        { &quot;POSITION&quot;, 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,  0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+        { &quot;COLOR&quot;,    0, colorType,                   0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+    };
+
+    result = device-&gt;CreateInputLayout(quadLayout, ArraySize(quadLayout), vsByteCode, vsSize, &amp;shader.inputLayout);
+    ASSERT(SUCCEEDED(result));
+
+    result = device-&gt;CreateVertexShader(vsByteCode, vsSize, NULL, &amp;shader.vertexShader);
+    ASSERT(SUCCEEDED(result));
+
+    result = device-&gt;CreatePixelShader(psByteCode, psSize, NULL, &amp;shader.pixelShader);
+    ASSERT(SUCCEEDED(result));
+
+    return shader;
+}
+
+Clear11::Clear11(Renderer11 *renderer)
+    : mRenderer(renderer), mClearBlendStates(StructLessThan&lt;ClearBlendInfo&gt;), mClearDepthStencilStates(StructLessThan&lt;ClearDepthStencilInfo&gt;),
+      mVertexBuffer(NULL), mRasterizerState(NULL), mSupportsClearView(false)
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Clear11::Clear11&quot;);
+
+    HRESULT result;
+    ID3D11Device *device = renderer-&gt;getDevice();
+
+    D3D11_BUFFER_DESC vbDesc;
+    vbDesc.ByteWidth = sizeof(d3d11::PositionDepthColorVertex&lt;float&gt;) * 4;
+    vbDesc.Usage = D3D11_USAGE_DYNAMIC;
+    vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+    vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+    vbDesc.MiscFlags = 0;
+    vbDesc.StructureByteStride = 0;
+
+    result = device-&gt;CreateBuffer(&amp;vbDesc, NULL, &amp;mVertexBuffer);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mVertexBuffer, &quot;Clear11 masked clear vertex buffer&quot;);
+
+    D3D11_RASTERIZER_DESC rsDesc;
+    rsDesc.FillMode = D3D11_FILL_SOLID;
+    rsDesc.CullMode = D3D11_CULL_NONE;
+    rsDesc.FrontCounterClockwise = FALSE;
+    rsDesc.DepthBias = 0;
+    rsDesc.DepthBiasClamp = 0.0f;
+    rsDesc.SlopeScaledDepthBias = 0.0f;
+    rsDesc.DepthClipEnable = TRUE;
+    rsDesc.ScissorEnable = FALSE;
+    rsDesc.MultisampleEnable = FALSE;
+    rsDesc.AntialiasedLineEnable = FALSE;
+
+    result = device-&gt;CreateRasterizerState(&amp;rsDesc, &amp;mRasterizerState);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mRasterizerState, &quot;Clear11 masked clear rasterizer state&quot;);
+
+    if (renderer-&gt;getFeatureLevel() &lt;= D3D_FEATURE_LEVEL_9_3)
+    {
+        mFloatClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_FLOAT, g_VS_ClearFloat, g_PS_ClearFloat_FL9);
+    }
+    else
+    {
+        mFloatClearShader = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_FLOAT, g_VS_ClearFloat, g_PS_ClearFloat);
+    }
+
+    if (renderer-&gt;isES3Capable())
+    {
+        mUintClearShader  = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_UINT,  g_VS_ClearUint,  g_PS_ClearUint );
+        mIntClearShader   = CreateClearShader(device, DXGI_FORMAT_R32G32B32A32_SINT,  g_VS_ClearSint,  g_PS_ClearSint );
+    }
+
+    if (renderer-&gt;getDeviceContext1IfSupported())
+    {
+        D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11Options;
+        device-&gt;CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &amp;d3d11Options, sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS));
+        mSupportsClearView = (d3d11Options.ClearView != FALSE);
+    }
+}
+
+Clear11::~Clear11()
+{
+    for (ClearBlendStateMap::iterator i = mClearBlendStates.begin(); i != mClearBlendStates.end(); i++)
+    {
+        SafeRelease(i-&gt;second);
+    }
+    mClearBlendStates.clear();
+
+    SafeRelease(mFloatClearShader.inputLayout);
+    SafeRelease(mFloatClearShader.vertexShader);
+    SafeRelease(mFloatClearShader.pixelShader);
+
+    if (mRenderer-&gt;isES3Capable())
+    {
+        SafeRelease(mUintClearShader.inputLayout);
+        SafeRelease(mUintClearShader.vertexShader);
+        SafeRelease(mUintClearShader.pixelShader);
+
+        SafeRelease(mIntClearShader.inputLayout);
+        SafeRelease(mIntClearShader.vertexShader);
+        SafeRelease(mIntClearShader.pixelShader);
+    }
+
+    for (ClearDepthStencilStateMap::iterator i = mClearDepthStencilStates.begin(); i != mClearDepthStencilStates.end(); i++)
+    {
+        SafeRelease(i-&gt;second);
+    }
+    mClearDepthStencilStates.clear();
+
+    SafeRelease(mVertexBuffer);
+    SafeRelease(mRasterizerState);
+}
+
+gl::Error Clear11::clearFramebuffer(const ClearParameters &amp;clearParams, const gl::Framebuffer::Data &amp;fboData)
+{
+    const auto &amp;colorAttachments = fboData.getColorAttachments();
+    const auto &amp;drawBufferStates = fboData.getDrawBufferStates();
+    const auto *depthAttachment = fboData.getDepthAttachment();
+    const auto *stencilAttachment = fboData.getStencilAttachment();
+
+    ASSERT(colorAttachments.size() == drawBufferStates.size());
+
+    // Iterate over the color buffers which require clearing and determine if they can be
+    // cleared with ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView.
+    // This requires:
+    // 1) The render target is being cleared to a float value (will be cast to integer when clearing integer
+    //    render targets as expected but does not work the other way around)
+    // 2) The format of the render target has no color channels that are currently masked out.
+    // Clear the easy-to-clear buffers on the spot and accumulate the ones that require special work.
+    //
+    // If these conditions are met, and:
+    // - No scissored clear is needed, then clear using ID3D11DeviceContext::ClearRenderTargetView.
+    // - A scissored clear is needed then clear using ID3D11DeviceContext1::ClearView if available.
+    //   Otherwise draw a quad.
+    //
+    // Also determine if the depth stencil can be cleared with ID3D11DeviceContext::ClearDepthStencilView
+    // by checking if the stencil write mask covers the entire stencil.
+    //
+    // To clear the remaining buffers, quads must be drawn containing an int, uint or float vertex color
+    // attribute.
+
+    gl::Extents framebufferSize;
+
+    const gl::FramebufferAttachment *colorAttachment = fboData.getFirstColorAttachment();
+    if (colorAttachment != nullptr)
+    {
+        framebufferSize.width = colorAttachment-&gt;getWidth();
+        framebufferSize.height = colorAttachment-&gt;getHeight();
+        framebufferSize.depth = 1;
+    }
+    else if (depthAttachment != nullptr)
+    {
+        framebufferSize.width = depthAttachment-&gt;getWidth();
+        framebufferSize.height = depthAttachment-&gt;getHeight();
+        framebufferSize.depth = 1;
+    }
+    else if (stencilAttachment != nullptr)
+    {
+        framebufferSize.width = stencilAttachment-&gt;getWidth();
+        framebufferSize.height = stencilAttachment-&gt;getHeight();
+        framebufferSize.depth = 1;
+    }
+    else
+    {
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION);
+    }
+
+    if (clearParams.scissorEnabled &amp;&amp; (clearParams.scissor.x &gt;= framebufferSize.width || 
+                                       clearParams.scissor.y &gt;= framebufferSize.height ||
+                                       clearParams.scissor.x + clearParams.scissor.width &lt;= 0 ||
+                                       clearParams.scissor.y + clearParams.scissor.height &lt;= 0))
+    {
+        // Scissor is enabled and the scissor rectangle is outside the renderbuffer
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    bool needScissoredClear = clearParams.scissorEnabled &amp;&amp; (clearParams.scissor.x &gt; 0 || clearParams.scissor.y &gt; 0 ||
+                                                             clearParams.scissor.x + clearParams.scissor.width &lt; framebufferSize.width ||
+                                                             clearParams.scissor.y + clearParams.scissor.height &lt; framebufferSize.height);
+
+    std::vector&lt;MaskedRenderTarget&gt; maskedClearRenderTargets;
+    RenderTarget11* maskedClearDepthStencil = NULL;
+
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+    ID3D11DeviceContext1 *deviceContext1 = mRenderer-&gt;getDeviceContext1IfSupported();
+
+    for (size_t colorAttachment = 0; colorAttachment &lt; colorAttachments.size(); colorAttachment++)
+    {
+        const gl::FramebufferAttachment &amp;attachment = colorAttachments[colorAttachment];
+
+        if (clearParams.clearColor[colorAttachment] &amp;&amp;
+            attachment.isAttached() &amp;&amp;
+            drawBufferStates[colorAttachment] != GL_NONE)
+        {
+            RenderTarget11 *renderTarget = NULL;
+            gl::Error error = attachment.getRenderTarget(&amp;renderTarget);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(attachment.getInternalFormat());
+
+            if (clearParams.colorClearType == GL_FLOAT &amp;&amp;
+                !(formatInfo.componentType == GL_FLOAT || formatInfo.componentType == GL_UNSIGNED_NORMALIZED || formatInfo.componentType == GL_SIGNED_NORMALIZED))
+            {
+                ERR(&quot;It is undefined behaviour to clear a render buffer which is not normalized fixed point or floating-&quot;
+                    &quot;point to floating point values (color attachment %u has internal format 0x%X).&quot;, colorAttachment,
+                    attachment.getInternalFormat());
+            }
+
+            if ((formatInfo.redBits == 0 || !clearParams.colorMaskRed) &amp;&amp;
+                (formatInfo.greenBits == 0 || !clearParams.colorMaskGreen) &amp;&amp;
+                (formatInfo.blueBits == 0 || !clearParams.colorMaskBlue) &amp;&amp;
+                (formatInfo.alphaBits == 0 || !clearParams.colorMaskAlpha))
+            {
+                // Every channel either does not exist in the render target or is masked out
+                continue;
+            }
+            else if ((!mSupportsClearView &amp;&amp; needScissoredClear) || clearParams.colorClearType != GL_FLOAT ||
+                     (formatInfo.redBits   &gt; 0 &amp;&amp; !clearParams.colorMaskRed)   ||
+                     (formatInfo.greenBits &gt; 0 &amp;&amp; !clearParams.colorMaskGreen) ||
+                     (formatInfo.blueBits  &gt; 0 &amp;&amp; !clearParams.colorMaskBlue) ||
+                     (formatInfo.alphaBits &gt; 0 &amp;&amp; !clearParams.colorMaskAlpha))
+            {
+                // A masked clear is required, or a scissored clear is required and ID3D11DeviceContext1::ClearView is unavailable
+                MaskedRenderTarget maskAndRt;
+                bool clearColor = clearParams.clearColor[colorAttachment];
+                maskAndRt.colorMask[0] = (clearColor &amp;&amp; clearParams.colorMaskRed);
+                maskAndRt.colorMask[1] = (clearColor &amp;&amp; clearParams.colorMaskGreen);
+                maskAndRt.colorMask[2] = (clearColor &amp;&amp; clearParams.colorMaskBlue);
+                maskAndRt.colorMask[3] = (clearColor &amp;&amp; clearParams.colorMaskAlpha);
+                maskAndRt.renderTarget = renderTarget;
+                maskedClearRenderTargets.push_back(maskAndRt);
+            }
+            else
+            {
+                 // ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView is possible
+
+                ID3D11RenderTargetView *framebufferRTV = renderTarget-&gt;getRenderTargetView();
+                if (!framebufferRTV)
+                {
+                    return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal render target view pointer unexpectedly null.&quot;);
+                }
+
+                const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(renderTarget-&gt;getDXGIFormat());
+
+                // Check if the actual format has a channel that the internal format does not and set them to the
+                // default values
+                const float clearValues[4] =
+                {
+                    ((formatInfo.redBits   == 0 &amp;&amp; dxgiFormatInfo.redBits   &gt; 0) ? 0.0f : clearParams.colorFClearValue.red),
+                    ((formatInfo.greenBits == 0 &amp;&amp; dxgiFormatInfo.greenBits &gt; 0) ? 0.0f : clearParams.colorFClearValue.green),
+                    ((formatInfo.blueBits  == 0 &amp;&amp; dxgiFormatInfo.blueBits  &gt; 0) ? 0.0f : clearParams.colorFClearValue.blue),
+                    ((formatInfo.alphaBits == 0 &amp;&amp; dxgiFormatInfo.alphaBits &gt; 0) ? 1.0f : clearParams.colorFClearValue.alpha),
+                };
+
+                if (needScissoredClear)
+                {
+                    // We shouldn't reach here if deviceContext1 is unavailable.
+                    ASSERT(deviceContext1);
+
+                    D3D11_RECT rect;
+                    rect.left = clearParams.scissor.x;
+                    rect.right = clearParams.scissor.x + clearParams.scissor.width;
+                    rect.top = clearParams.scissor.y;
+                    rect.bottom = clearParams.scissor.y + clearParams.scissor.height;
+
+                    deviceContext1-&gt;ClearView(framebufferRTV, clearValues, &amp;rect, 1);
+                }
+                else
+                {
+                    deviceContext-&gt;ClearRenderTargetView(framebufferRTV, clearValues);
+                }
+            }
+        }
+    }
+
+    if (clearParams.clearDepth || clearParams.clearStencil)
+    {
+        const gl::FramebufferAttachment *attachment = (depthAttachment != nullptr) ? depthAttachment : stencilAttachment;
+        ASSERT(attachment != nullptr);
+
+        RenderTarget11 *renderTarget = NULL;
+        gl::Error error = attachment-&gt;getRenderTarget(&amp;renderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(renderTarget-&gt;getDXGIFormat());
+
+        unsigned int stencilUnmasked = (stencilAttachment != nullptr) ? (1 &lt;&lt; dxgiFormatInfo.stencilBits) - 1 : 0;
+        bool needMaskedStencilClear = clearParams.clearStencil &amp;&amp; (clearParams.stencilWriteMask &amp; stencilUnmasked) != stencilUnmasked;
+
+        if (needScissoredClear || needMaskedStencilClear)
+        {
+            maskedClearDepthStencil = renderTarget;
+        }
+        else
+        {
+            ID3D11DepthStencilView *framebufferDSV = renderTarget-&gt;getDepthStencilView();
+            if (!framebufferDSV)
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal depth stencil view pointer unexpectedly null.&quot;);
+            }
+
+            UINT clearFlags = (clearParams.clearDepth   ? D3D11_CLEAR_DEPTH   : 0) |
+                                (clearParams.clearStencil ? D3D11_CLEAR_STENCIL : 0);
+            FLOAT depthClear = gl::clamp01(clearParams.depthClearValue);
+            UINT8 stencilClear = clearParams.stencilClearValue &amp; 0xFF;
+
+            deviceContext-&gt;ClearDepthStencilView(framebufferDSV, clearFlags, depthClear, stencilClear);
+        }
+    }
+
+    if (maskedClearRenderTargets.size() &gt; 0 || maskedClearDepthStencil)
+    {
+        // To clear the render targets and depth stencil in one pass:
+        //
+        // Render a quad clipped to the scissor rectangle which draws the clear color and a blend
+        // state that will perform the required color masking.
+        //
+        // The quad's depth is equal to the depth clear value with a depth stencil state that
+        // will enable or disable depth test/writes if the depth buffer should be cleared or not.
+        //
+        // The rasterizer state's stencil is set to always pass or fail based on if the stencil
+        // should be cleared or not with a stencil write mask of the stencil clear value.
+        //
+        // ======================================================================================
+        //
+        // Luckily, the gl spec (ES 3.0.2 pg 183) states that the results of clearing a render-
+        // buffer that is not normalized fixed point or floating point with floating point values
+        // are undefined so we can just write floats to them and D3D11 will bit cast them to
+        // integers.
+        //
+        // Also, we don't have to worry about attempting to clear a normalized fixed/floating point
+        // buffer with integer values because there is no gl API call which would allow it,
+        // glClearBuffer* calls only clear a single renderbuffer at a time which is verified to
+        // be a compatible clear type.
+
+        // Bind all the render targets which need clearing
+        ASSERT(maskedClearRenderTargets.size() &lt;= mRenderer-&gt;getRendererCaps().maxDrawBuffers);
+        std::vector&lt;ID3D11RenderTargetView*&gt; rtvs(maskedClearRenderTargets.size());
+        for (unsigned int i = 0; i &lt; maskedClearRenderTargets.size(); i++)
+        {
+            RenderTarget11 *renderTarget = maskedClearRenderTargets[i].renderTarget;
+            ID3D11RenderTargetView *rtv = renderTarget-&gt;getRenderTargetView();
+            if (!rtv)
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal render target view pointer unexpectedly null.&quot;);
+            }
+
+            rtvs[i] = rtv;
+        }
+        ID3D11DepthStencilView *dsv = maskedClearDepthStencil ? maskedClearDepthStencil-&gt;getDepthStencilView() : NULL;
+
+        ID3D11BlendState *blendState = getBlendState(maskedClearRenderTargets);
+        const FLOAT blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
+        const UINT sampleMask = 0xFFFFFFFF;
+
+        ID3D11DepthStencilState *dsState = getDepthStencilState(clearParams);
+        const UINT stencilClear = clearParams.stencilClearValue &amp; 0xFF;
+
+        // Set the vertices
+        UINT vertexStride = 0;
+        const UINT startIdx = 0;
+        const ClearShader* shader = NULL;
+        D3D11_MAPPED_SUBRESOURCE mappedResource;
+        HRESULT result = deviceContext-&gt;Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal masked clear vertex buffer, HRESULT: 0x%X.&quot;, result);
+        }
+
+        const gl::Rectangle *scissorPtr = clearParams.scissorEnabled ? &amp;clearParams.scissor : NULL;
+        switch (clearParams.colorClearType)
+        {
+          case GL_FLOAT:
+            ApplyVertices(framebufferSize, scissorPtr, clearParams.colorFClearValue, clearParams.depthClearValue, mappedResource.pData);
+            vertexStride = sizeof(d3d11::PositionDepthColorVertex&lt;float&gt;);
+            shader = &amp;mFloatClearShader;
+            break;
+
+          case GL_UNSIGNED_INT:
+            ApplyVertices(framebufferSize, scissorPtr, clearParams.colorUIClearValue, clearParams.depthClearValue, mappedResource.pData);
+            vertexStride = sizeof(d3d11::PositionDepthColorVertex&lt;unsigned int&gt;);
+            shader = &amp;mUintClearShader;
+            break;
+
+          case GL_INT:
+            ApplyVertices(framebufferSize, scissorPtr, clearParams.colorIClearValue, clearParams.depthClearValue, mappedResource.pData);
+            vertexStride = sizeof(d3d11::PositionDepthColorVertex&lt;int&gt;);
+            shader = &amp;mIntClearShader;
+            break;
+
+          default:
+            UNREACHABLE();
+            break;
+        }
+
+        deviceContext-&gt;Unmap(mVertexBuffer, 0);
+
+        // Set the viewport to be the same size as the framebuffer
+        D3D11_VIEWPORT viewport;
+        viewport.TopLeftX = 0;
+        viewport.TopLeftY = 0;
+        viewport.Width = static_cast&lt;FLOAT&gt;(framebufferSize.width);
+        viewport.Height = static_cast&lt;FLOAT&gt;(framebufferSize.height);
+        viewport.MinDepth = 0;
+        viewport.MaxDepth = 1;
+        deviceContext-&gt;RSSetViewports(1, &amp;viewport);
+
+        // Apply state
+        deviceContext-&gt;OMSetBlendState(blendState, blendFactors, sampleMask);
+        deviceContext-&gt;OMSetDepthStencilState(dsState, stencilClear);
+        deviceContext-&gt;RSSetState(mRasterizerState);
+
+        // Apply shaders
+        deviceContext-&gt;IASetInputLayout(shader-&gt;inputLayout);
+        deviceContext-&gt;VSSetShader(shader-&gt;vertexShader, NULL, 0);
+        deviceContext-&gt;PSSetShader(shader-&gt;pixelShader, NULL, 0);
+        deviceContext-&gt;GSSetShader(NULL, NULL, 0);
+
+        // Apply vertex buffer
+        deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;mVertexBuffer, &amp;vertexStride, &amp;startIdx);
+        deviceContext-&gt;IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+
+        // Apply render targets
+        deviceContext-&gt;OMSetRenderTargets(rtvs.size(), (rtvs.empty() ? NULL : &amp;rtvs[0]), dsv);
+
+        // Draw the clear quad
+        deviceContext-&gt;Draw(4, 0);
+
+        // Clean up
+        mRenderer-&gt;markAllStateDirty();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+ID3D11BlendState *Clear11::getBlendState(const std::vector&lt;MaskedRenderTarget&gt;&amp; rts)
+{
+    ClearBlendInfo blendKey = { 0 };
+    for (unsigned int i = 0; i &lt; D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+    {
+        if (i &lt; rts.size())
+        {
+            RenderTarget11 *rt = rts[i].renderTarget;
+            const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(rt-&gt;getInternalFormat());
+
+            blendKey.maskChannels[i][0] = (rts[i].colorMask[0] &amp;&amp; formatInfo.redBits   &gt; 0);
+            blendKey.maskChannels[i][1] = (rts[i].colorMask[1] &amp;&amp; formatInfo.greenBits &gt; 0);
+            blendKey.maskChannels[i][2] = (rts[i].colorMask[2] &amp;&amp; formatInfo.blueBits  &gt; 0);
+            blendKey.maskChannels[i][3] = (rts[i].colorMask[3] &amp;&amp; formatInfo.alphaBits &gt; 0);
+        }
+        else
+        {
+            blendKey.maskChannels[i][0] = false;
+            blendKey.maskChannels[i][1] = false;
+            blendKey.maskChannels[i][2] = false;
+            blendKey.maskChannels[i][3] = false;
+        }
+    }
+
+    ClearBlendStateMap::const_iterator i = mClearBlendStates.find(blendKey);
+    if (i != mClearBlendStates.end())
+    {
+        return i-&gt;second;
+    }
+    else
+    {
+        D3D11_BLEND_DESC blendDesc = { 0 };
+        blendDesc.AlphaToCoverageEnable = FALSE;
+        blendDesc.IndependentBlendEnable = (rts.size() &gt; 1) ? TRUE : FALSE;
+
+        for (unsigned int j = 0; j &lt; D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; j++)
+        {
+            blendDesc.RenderTarget[j].BlendEnable = FALSE;
+            blendDesc.RenderTarget[j].RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendKey.maskChannels[j][0],
+                                                                                         blendKey.maskChannels[j][1],
+                                                                                         blendKey.maskChannels[j][2],
+                                                                                         blendKey.maskChannels[j][3]);
+        }
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+        ID3D11BlendState* blendState = NULL;
+        HRESULT result = device-&gt;CreateBlendState(&amp;blendDesc, &amp;blendState);
+        if (FAILED(result) || !blendState)
+        {
+            ERR(&quot;Unable to create a ID3D11BlendState, HRESULT: 0x%X.&quot;, result);
+            return NULL;
+        }
+
+        mClearBlendStates[blendKey] = blendState;
+
+        return blendState;
+    }
+}
+
+ID3D11DepthStencilState *Clear11::getDepthStencilState(const ClearParameters &amp;clearParams)
+{
+    ClearDepthStencilInfo dsKey = { 0 };
+    dsKey.clearDepth = clearParams.clearDepth;
+    dsKey.clearStencil = clearParams.clearStencil;
+    dsKey.stencilWriteMask = clearParams.stencilWriteMask &amp; 0xFF;
+
+    ClearDepthStencilStateMap::const_iterator i = mClearDepthStencilStates.find(dsKey);
+    if (i != mClearDepthStencilStates.end())
+    {
+        return i-&gt;second;
+    }
+    else
+    {
+        D3D11_DEPTH_STENCIL_DESC dsDesc = { 0 };
+        dsDesc.DepthEnable = dsKey.clearDepth ? TRUE : FALSE;
+        dsDesc.DepthWriteMask = dsKey.clearDepth ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
+        dsDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+        dsDesc.StencilEnable = dsKey.clearStencil ? TRUE : FALSE;
+        dsDesc.StencilReadMask = 0;
+        dsDesc.StencilWriteMask = dsKey.stencilWriteMask;
+        dsDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
+        dsDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
+        dsDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
+        dsDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+        dsDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
+        dsDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
+        dsDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
+        dsDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+        ID3D11DepthStencilState* dsState = NULL;
+        HRESULT result = device-&gt;CreateDepthStencilState(&amp;dsDesc, &amp;dsState);
+        if (FAILED(result) || !dsState)
+        {
+            ERR(&quot;Unable to create a ID3D11DepthStencilState, HRESULT: 0x%X.&quot;, result);
+            return NULL;
+        }
+
+        mClearDepthStencilStates[dsKey] = dsState;
+
+        return dsState;
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Clear11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Clear11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Clear11.h: Framebuffer clear utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
+
+#include &lt;map&gt;
+#include &lt;vector&gt;
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+
+namespace rx
+{
+class Renderer11;
+class RenderTarget11;
+struct ClearParameters;
+
+class Clear11 : angle::NonCopyable
+{
+  public:
+    explicit Clear11(Renderer11 *renderer);
+    ~Clear11();
+
+    // Clears the framebuffer with the supplied clear parameters, assumes that the framebuffer is currently applied.
+    gl::Error clearFramebuffer(const ClearParameters &amp;clearParams, const gl::Framebuffer::Data &amp;fboData);
+
+  private:
+    struct MaskedRenderTarget
+    {
+        bool colorMask[4];
+        RenderTarget11 *renderTarget;
+    };
+
+    ID3D11BlendState *getBlendState(const std::vector&lt;MaskedRenderTarget&gt; &amp;rts);
+    ID3D11DepthStencilState *getDepthStencilState(const ClearParameters &amp;clearParams);
+
+    struct ClearShader
+    {
+        ID3D11InputLayout *inputLayout;
+        ID3D11VertexShader *vertexShader;
+        ID3D11PixelShader *pixelShader;
+    };
+
+    template &lt;unsigned int vsSize, unsigned int psSize&gt;
+    static ClearShader CreateClearShader(ID3D11Device *device, DXGI_FORMAT colorType, const BYTE(&amp;vsByteCode)[vsSize], const BYTE(&amp;psByteCode)[psSize]);
+
+    Renderer11 *mRenderer;
+
+    struct ClearBlendInfo
+    {
+        bool maskChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
+    };
+    typedef bool(*ClearBlendInfoComparisonFunction)(const ClearBlendInfo&amp;, const ClearBlendInfo &amp;);
+    typedef std::map&lt;ClearBlendInfo, ID3D11BlendState*, ClearBlendInfoComparisonFunction&gt; ClearBlendStateMap;
+    ClearBlendStateMap mClearBlendStates;
+
+    ClearShader mFloatClearShader;
+    ClearShader mUintClearShader;
+    ClearShader mIntClearShader;
+
+    struct ClearDepthStencilInfo
+    {
+        bool clearDepth;
+        bool clearStencil;
+        UINT8 stencilWriteMask;
+    };
+    typedef bool (*ClearDepthStencilInfoComparisonFunction)(const ClearDepthStencilInfo&amp;, const ClearDepthStencilInfo &amp;);
+    typedef std::map&lt;ClearDepthStencilInfo, ID3D11DepthStencilState*, ClearDepthStencilInfoComparisonFunction&gt; ClearDepthStencilStateMap;
+    ClearDepthStencilStateMap mClearDepthStencilStates;
+
+    ID3D11Buffer *mVertexBuffer;
+    ID3D11RasterizerState *mRasterizerState;
+
+    bool mSupportsClearView;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_CLEAR11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11DebugAnnotator11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// DebugAnnotator11.cpp: D3D11 helpers for adding trace annotations.
+//
+
+#include &quot;libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+
+namespace rx
+{
+
+DebugAnnotator11::DebugAnnotator11()
+    : mInitialized(false),
+      mD3d11Module(nullptr),
+      mUserDefinedAnnotation(nullptr)
+{
+    // D3D11 devices can't be created during DllMain.
+    // We defer device creation until the object is actually used.
+}
+
+DebugAnnotator11::~DebugAnnotator11()
+{
+    if (mInitialized)
+    {
+        SafeRelease(mUserDefinedAnnotation);
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+        FreeLibrary(mD3d11Module);
+#endif // !ANGLE_ENABLE_WINDOWS_STORE
+    }
+}
+
+void DebugAnnotator11::beginEvent(const std::wstring &amp;eventName)
+{
+    initializeDevice();
+
+    mUserDefinedAnnotation-&gt;BeginEvent(eventName.c_str());
+}
+
+void DebugAnnotator11::endEvent()
+{
+    initializeDevice();
+
+    mUserDefinedAnnotation-&gt;EndEvent();
+}
+
+void DebugAnnotator11::setMarker(const std::wstring &amp;markerName)
+{
+    initializeDevice();
+
+    mUserDefinedAnnotation-&gt;SetMarker(markerName.c_str());
+}
+
+bool DebugAnnotator11::getStatus()
+{
+    // ID3DUserDefinedAnnotation::GetStatus doesn't work with the Graphics Diagnostics tools in Visual Studio 2013.
+
+#if defined(_DEBUG) &amp;&amp; defined(ANGLE_ENABLE_WINDOWS_STORE)
+    // In the Windows Store, we can use IDXGraphicsAnalysis. The call to GetDebugInterface1 only succeeds if the app is under capture.
+    // This should only be called in DEBUG mode.
+    // If an app links against DXGIGetDebugInterface1 in release mode then it will fail Windows Store ingestion checks.
+    IDXGraphicsAnalysis *graphicsAnalysis;
+    DXGIGetDebugInterface1(0, IID_PPV_ARGS(&amp;graphicsAnalysis));
+    bool underCapture = (graphicsAnalysis != nullptr);
+    SafeRelease(graphicsAnalysis);
+    return underCapture;
+#endif // _DEBUG &amp;&amp; !ANGLE_ENABLE_WINDOWS_STORE
+
+    // Otherwise, we have to return true here.
+    return true;
+}
+
+void DebugAnnotator11::initializeDevice()
+{
+    if (!mInitialized)
+    {
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+        mD3d11Module = LoadLibrary(TEXT(&quot;d3d11.dll&quot;));
+        ASSERT(mD3d11Module);
+
+        PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, &quot;D3D11CreateDevice&quot;);
+        ASSERT(D3D11CreateDevice != nullptr);
+#endif // !ANGLE_ENABLE_WINDOWS_STORE
+
+        ID3D11Device *device = nullptr;
+        ID3D11DeviceContext *context = nullptr;
+
+        HRESULT hr = E_FAIL;
+
+        // Create a D3D_DRIVER_TYPE_NULL device, which is much cheaper than other types of device.
+        hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_NULL, nullptr, 0, nullptr, 0, D3D11_SDK_VERSION, &amp;device, nullptr, &amp;context);
+        ASSERT(SUCCEEDED(hr));
+
+        mUserDefinedAnnotation = d3d11::DynamicCastComObject&lt;ID3DUserDefinedAnnotation&gt;(context);
+        ASSERT(mUserDefinedAnnotation != nullptr);
+
+        SafeRelease(device);
+        SafeRelease(context);
+
+        mInitialized = true;
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11DebugAnnotator11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// DebugAnnotator11.h: D3D11 helpers for adding trace annotations.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+class DebugAnnotator11 : public gl::DebugAnnotator
+{
+  public:
+    DebugAnnotator11();
+    ~DebugAnnotator11() override;
+    void beginEvent(const std::wstring &amp;eventName) override;
+    void endEvent() override;
+    void setMarker(const std::wstring &amp;markerName) override;
+    bool getStatus() override;
+
+  private:
+    void initializeDevice();
+
+    bool mInitialized;
+    HMODULE mD3d11Module;
+    ID3DUserDefinedAnnotation *mUserDefinedAnnotation;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_DEBUGANNOTATOR11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Fence11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,231 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Fence11.cpp: Defines the rx::FenceNV11 and rx::FenceSync11 classes which implement rx::FenceNVImpl and rx::FenceSyncImpl.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Fence11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+namespace rx
+{
+
+//
+// Template helpers for set and test operations.
+//
+
+template&lt;class FenceClass&gt;
+gl::Error FenceSetHelper(FenceClass *fence)
+{
+    if (!fence-&gt;mQuery)
+    {
+        D3D11_QUERY_DESC queryDesc;
+        queryDesc.Query = D3D11_QUERY_EVENT;
+        queryDesc.MiscFlags = 0;
+
+        HRESULT result = fence-&gt;mRenderer-&gt;getDevice()-&gt;CreateQuery(&amp;queryDesc, &amp;fence-&gt;mQuery);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create event query, result: 0x%X.&quot;, result);
+        }
+    }
+
+    fence-&gt;mRenderer-&gt;getDeviceContext()-&gt;End(fence-&gt;mQuery);
+    return gl::Error(GL_NO_ERROR);
+}
+
+template &lt;class FenceClass&gt;
+gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean *outFinished)
+{
+    ASSERT(fence-&gt;mQuery);
+
+    UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH);
+    HRESULT result = fence-&gt;mRenderer-&gt;getDeviceContext()-&gt;GetData(fence-&gt;mQuery, NULL, 0, getDataFlags);
+
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get query data, result: 0x%X.&quot;, result);
+    }
+    else if (fence-&gt;mRenderer-&gt;isDeviceLost())
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Device was lost while querying result of an event query.&quot;);
+    }
+
+    ASSERT(result == S_OK || result == S_FALSE);
+    *outFinished = ((result == S_OK) ? GL_TRUE : GL_FALSE);
+    return gl::Error(GL_NO_ERROR);
+}
+
+//
+// FenceNV11
+//
+
+FenceNV11::FenceNV11(Renderer11 *renderer)
+    : FenceNVImpl(),
+      mRenderer(renderer),
+      mQuery(NULL)
+{
+}
+
+FenceNV11::~FenceNV11()
+{
+    SafeRelease(mQuery);
+}
+
+gl::Error FenceNV11::set(GLenum condition)
+{
+    return FenceSetHelper(this);
+}
+
+gl::Error FenceNV11::test(GLboolean *outFinished)
+{
+    return FenceTestHelper(this, true, outFinished);
+}
+
+gl::Error FenceNV11::finish()
+{
+    GLboolean finished = GL_FALSE;
+    while (finished != GL_TRUE)
+    {
+        gl::Error error = FenceTestHelper(this, true, &amp;finished);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ScheduleYield();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+//
+// FenceSync11
+//
+
+// Important note on accurate timers in Windows:
+//
+// QueryPerformanceCounter has a few major issues, including being 10x as expensive to call
+// as timeGetTime on laptops and &quot;jumping&quot; during certain hardware events.
+//
+// See the comments at the top of the Chromium source file &quot;chromium/src/base/time/time_win.cc&quot;
+//   https://code.google.com/p/chromium/codesearch#chromium/src/base/time/time_win.cc
+//
+// We still opt to use QPC. In the present and moving forward, most newer systems will not suffer
+// from buggy implementations.
+
+FenceSync11::FenceSync11(Renderer11 *renderer)
+    : FenceSyncImpl(),
+      mRenderer(renderer),
+      mQuery(NULL)
+{
+    LARGE_INTEGER counterFreqency = { 0 };
+    BOOL success = QueryPerformanceFrequency(&amp;counterFreqency);
+    UNUSED_ASSERTION_VARIABLE(success);
+    ASSERT(success);
+
+    mCounterFrequency = counterFreqency.QuadPart;
+}
+
+FenceSync11::~FenceSync11()
+{
+    SafeRelease(mQuery);
+}
+
+gl::Error FenceSync11::set(GLenum condition, GLbitfield flags)
+{
+    ASSERT(condition == GL_SYNC_GPU_COMMANDS_COMPLETE &amp;&amp; flags == 0);
+    return FenceSetHelper(this);
+}
+
+gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult)
+{
+    ASSERT(outResult);
+
+    bool flushCommandBuffer = ((flags &amp; GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
+
+    GLboolean result = GL_FALSE;
+    gl::Error error = FenceTestHelper(this, flushCommandBuffer, &amp;result);
+    if (error.isError())
+    {
+        *outResult = GL_WAIT_FAILED;
+        return error;
+    }
+
+    if (result == GL_TRUE)
+    {
+        *outResult = GL_ALREADY_SIGNALED;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    if (timeout == 0)
+    {
+        *outResult = GL_TIMEOUT_EXPIRED;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    LARGE_INTEGER currentCounter = { 0 };
+    BOOL success = QueryPerformanceCounter(&amp;currentCounter);
+    UNUSED_ASSERTION_VARIABLE(success);
+    ASSERT(success);
+
+    LONGLONG timeoutInSeconds = static_cast&lt;LONGLONG&gt;(timeout) * static_cast&lt;LONGLONG&gt;(1000000ll);
+    LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
+
+    while (currentCounter.QuadPart &lt; endCounter &amp;&amp; !result)
+    {
+        ScheduleYield();
+        success = QueryPerformanceCounter(&amp;currentCounter);
+        UNUSED_ASSERTION_VARIABLE(success);
+        ASSERT(success);
+
+        error = FenceTestHelper(this, flushCommandBuffer, &amp;result);
+        if (error.isError())
+        {
+            *outResult = GL_WAIT_FAILED;
+            return error;
+        }
+    }
+
+    if (currentCounter.QuadPart &gt;= endCounter)
+    {
+        *outResult = GL_TIMEOUT_EXPIRED;
+    }
+    else
+    {
+        *outResult = GL_CONDITION_SATISFIED;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceSync11::serverWait(GLbitfield flags, GLuint64 timeout)
+{
+    // Because our API is currently designed to be called from a single thread, we don't need to do
+    // extra work for a server-side fence. GPU commands issued after the fence is created will always
+    // be processed after the fence is signaled.
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceSync11::getStatus(GLint *outResult)
+{
+    GLboolean result = GL_FALSE;
+    gl::Error error = FenceTestHelper(this, false, &amp;result);
+    if (error.isError())
+    {
+        // The spec does not specify any way to report errors during the status test (e.g. device lost)
+        // so we report the fence is unblocked in case of error or signaled.
+        *outResult = GL_SIGNALED;
+
+        return error;
+    }
+
+    *outResult = (result ? GL_SIGNALED : GL_UNSIGNALED);
+    return gl::Error(GL_NO_ERROR);
+}
+
+} // namespace rx
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Fence11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Fence11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Fence11.h: Defines the rx::FenceNV11 and rx::FenceSync11 classes which implement rx::FenceNVImpl and rx::FenceSyncImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_FENCE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_FENCE11_H_
+
+#include &quot;libANGLE/renderer/FenceNVImpl.h&quot;
+#include &quot;libANGLE/renderer/FenceSyncImpl.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+class FenceNV11 : public FenceNVImpl
+{
+  public:
+    explicit FenceNV11(Renderer11 *renderer);
+    ~FenceNV11() override;
+
+    gl::Error set(GLenum condition) override;
+    gl::Error test(GLboolean *outFinished) override;
+    gl::Error finish() override;
+
+  private:
+    template&lt;class T&gt; friend gl::Error FenceSetHelper(T *fence);
+    template&lt;class T&gt; friend gl::Error FenceTestHelper(T *fence, bool flushCommandBuffer, GLboolean *outFinished);
+
+    Renderer11 *mRenderer;
+    ID3D11Query *mQuery;
+};
+
+class FenceSync11 : public FenceSyncImpl
+{
+  public:
+    explicit FenceSync11(Renderer11 *renderer);
+    ~FenceSync11() override;
+
+    gl::Error set(GLenum condition, GLbitfield flags) override;
+    gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) override;
+    gl::Error serverWait(GLbitfield flags, GLuint64 timeout) override;
+    gl::Error getStatus(GLint *outResult) override;
+
+  private:
+    template&lt;class T&gt; friend gl::Error FenceSetHelper(T *fence);
+    template&lt;class T&gt; friend gl::Error FenceTestHelper(T *fence, bool flushCommandBuffer, GLboolean *outFinished);
+
+    Renderer11 *mRenderer;
+    ID3D11Query *mQuery;
+    LONGLONG mCounterFrequency;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_FENCE11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Framebuffer11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,275 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Framebuffer11.cpp: Implements the Framebuffer11 class.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Framebuffer11.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Buffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Clear11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/TextureStorage11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+
+namespace rx
+{
+
+Framebuffer11::Framebuffer11(const gl::Framebuffer::Data &amp;data, Renderer11 *renderer)
+    : FramebufferD3D(data, renderer),
+      mRenderer(renderer)
+{
+    ASSERT(mRenderer != nullptr);
+}
+
+Framebuffer11::~Framebuffer11()
+{
+}
+
+static gl::Error InvalidateAttachmentSwizzles(const gl::FramebufferAttachment *attachment)
+{
+    if (attachment &amp;&amp; attachment-&gt;type() == GL_TEXTURE)
+    {
+        gl::Texture *texture = attachment-&gt;getTexture();
+
+        TextureD3D *textureD3D = GetImplAs&lt;TextureD3D&gt;(texture);
+
+        TextureStorage *texStorage = nullptr;
+        gl::Error error = textureD3D-&gt;getNativeTexture(&amp;texStorage);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (texStorage)
+        {
+            TextureStorage11 *texStorage11 = GetAs&lt;TextureStorage11&gt;(texStorage);
+            ASSERT(texStorage11);
+
+            texStorage11-&gt;invalidateSwizzleCacheLevel(attachment-&gt;mipLevel());
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Framebuffer11::invalidateSwizzles() const
+{
+    for (const auto &amp;colorAttachment : mData.getColorAttachments())
+    {
+        if (colorAttachment.isAttached())
+        {
+            gl::Error error = InvalidateAttachmentSwizzles(&amp;colorAttachment);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    gl::Error error = InvalidateAttachmentSwizzles(mData.getDepthAttachment());
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = InvalidateAttachmentSwizzles(mData.getStencilAttachment());
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Framebuffer11::clear(const gl::State &amp;state, const ClearParameters &amp;clearParams)
+{
+    Clear11 *clearer = mRenderer-&gt;getClearer();
+    gl::Error error = clearer-&gt;clearFramebuffer(clearParams, mData);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = invalidateSwizzles();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+static gl::Error getRenderTargetResource(const gl::FramebufferAttachment *colorbuffer, unsigned int *subresourceIndexOut,
+                                         ID3D11Texture2D **texture2DOut)
+{
+    ASSERT(colorbuffer);
+
+    RenderTarget11 *renderTarget = nullptr;
+    gl::Error error = colorbuffer-&gt;getRenderTarget(&amp;renderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ID3D11Resource *renderTargetResource = renderTarget-&gt;getTexture();
+    ASSERT(renderTargetResource);
+
+    *subresourceIndexOut = renderTarget-&gt;getSubresourceIndex();
+    *texture2DOut = d3d11::DynamicCastComObject&lt;ID3D11Texture2D&gt;(renderTargetResource);
+
+    if (!(*texture2DOut))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to query the ID3D11Texture2D from a RenderTarget&quot;);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Framebuffer11::readPixels(const gl::Rectangle &amp;area, GLenum format, GLenum type, size_t outputPitch, const gl::PixelPackState &amp;pack, uint8_t *pixels) const
+{
+    ID3D11Texture2D *colorBufferTexture = nullptr;
+    unsigned int subresourceIndex = 0;
+
+    const gl::FramebufferAttachment *colorbuffer = mData.getReadAttachment();
+    ASSERT(colorbuffer);
+
+    gl::Error error = getRenderTargetResource(colorbuffer, &amp;subresourceIndex, &amp;colorBufferTexture);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    gl::Buffer *packBuffer = pack.pixelBuffer.get();
+    if (packBuffer != nullptr)
+    {
+        Buffer11 *packBufferStorage = GetImplAs&lt;Buffer11&gt;(packBuffer);
+        PackPixelsParams packParams(area, format, type, outputPitch, pack, reinterpret_cast&lt;ptrdiff_t&gt;(pixels));
+
+        error = packBufferStorage-&gt;packPixels(colorBufferTexture, subresourceIndex, packParams);
+        if (error.isError())
+        {
+            SafeRelease(colorBufferTexture);
+            return error;
+        }
+
+        packBuffer-&gt;getIndexRangeCache()-&gt;clear();
+    }
+    else
+    {
+        error = mRenderer-&gt;readTextureData(colorBufferTexture, subresourceIndex, area, format, type, outputPitch, pack, pixels);
+        if (error.isError())
+        {
+            SafeRelease(colorBufferTexture);
+            return error;
+        }
+    }
+
+    SafeRelease(colorBufferTexture);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Framebuffer11::blit(const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea, const gl::Rectangle *scissor,
+                              bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
+                              const gl::Framebuffer *sourceFramebuffer)
+{
+    if (blitRenderTarget)
+    {
+        const gl::FramebufferAttachment *readBuffer = sourceFramebuffer-&gt;getReadColorbuffer();
+        ASSERT(readBuffer);
+
+        RenderTargetD3D *readRenderTarget = nullptr;
+        gl::Error error = readBuffer-&gt;getRenderTarget(&amp;readRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(readRenderTarget);
+
+        const auto &amp;colorAttachments = mData.getColorAttachments();
+        const auto &amp;drawBufferStates = mData.getDrawBufferStates();
+
+        for (size_t colorAttachment = 0; colorAttachment &lt; colorAttachments.size(); colorAttachment++)
+        {
+            const gl::FramebufferAttachment &amp;drawBuffer = colorAttachments[colorAttachment];
+
+            if (drawBuffer.isAttached() &amp;&amp;
+                drawBufferStates[colorAttachment] != GL_NONE)
+            {
+                RenderTargetD3D *drawRenderTarget = nullptr;
+                error = drawBuffer.getRenderTarget(&amp;drawRenderTarget);
+                if (error.isError())
+                {
+                    return error;
+                }
+                ASSERT(drawRenderTarget);
+
+                error = mRenderer-&gt;blitRenderbufferRect(sourceArea, destArea, readRenderTarget, drawRenderTarget,
+                                                        filter, scissor, blitRenderTarget, false, false);
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    if (blitDepth || blitStencil)
+    {
+        const gl::FramebufferAttachment *readBuffer = sourceFramebuffer-&gt;getDepthOrStencilbuffer();
+        ASSERT(readBuffer);
+
+        RenderTargetD3D *readRenderTarget = nullptr;
+        gl::Error error = readBuffer-&gt;getRenderTarget(&amp;readRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(readRenderTarget);
+
+        const gl::FramebufferAttachment *drawBuffer = mData.getDepthOrStencilAttachment();
+        ASSERT(drawBuffer);
+
+        RenderTargetD3D *drawRenderTarget = nullptr;
+        error = drawBuffer-&gt;getRenderTarget(&amp;drawRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(drawRenderTarget);
+
+        error = mRenderer-&gt;blitRenderbufferRect(sourceArea, destArea, readRenderTarget, drawRenderTarget, filter, scissor,
+                                                false, blitDepth, blitStencil);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    gl::Error error = invalidateSwizzles();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
+{
+    RenderTarget11 *renderTarget11 = GetAs&lt;RenderTarget11&gt;(renderTarget);
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(renderTarget11-&gt;getDXGIFormat());
+    return dxgiFormatInfo.internalFormat;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Framebuffer11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Framebuffer11.h: Defines the Framebuffer11 class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
+
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+class Framebuffer11 : public FramebufferD3D
+{
+  public:
+    Framebuffer11(const gl::Framebuffer::Data &amp;data, Renderer11 *renderer);
+    virtual ~Framebuffer11();
+
+    // Invalidate the cached swizzles of all bound texture attachments.
+    gl::Error invalidateSwizzles() const;
+
+  private:
+    gl::Error clear(const gl::State &amp;state, const ClearParameters &amp;clearParams) override;
+
+    gl::Error readPixels(const gl::Rectangle &amp;area, GLenum format, GLenum type, size_t outputPitch,
+                         const gl::PixelPackState &amp;pack, uint8_t *pixels) const override;
+
+    gl::Error blit(const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea, const gl::Rectangle *scissor,
+                   bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
+                   const gl::Framebuffer *sourceFramebuffer) override;
+
+
+    GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
+
+    Renderer11 *const mRenderer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Image11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,658 @@
</span><ins>+//
+// 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.
+//
+
+// Image11.h: Implements the rx::Image11 class, which acts as the interface to
+// the actual underlying resources of a Texture
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Image11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/TextureStorage11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+
+#include &quot;common/utilities.h&quot;
+
+namespace rx
+{
+
+Image11::Image11(Renderer11 *renderer)
+    : mRenderer(renderer),
+      mDXGIFormat(DXGI_FORMAT_UNKNOWN),
+      mStagingTexture(NULL),
+      mStagingSubresource(0),
+      mRecoverFromStorage(false),
+      mAssociatedStorage(NULL),
+      mAssociatedImageIndex(gl::ImageIndex::MakeInvalid()),
+      mRecoveredFromStorageCount(0)
+{
+    // mRenderer should remain unchanged during the lifetime of the Image11 object.
+    // This lets us safely use mRenderer (and its Feature Level) in Image11's methods.
+    mFeatureLevel = renderer-&gt;getFeatureLevel();
+}
+
+Image11::~Image11()
+{
+    disassociateStorage();
+    releaseStagingTexture();
+}
+
+gl::Error Image11::generateMipmap(Image11 *dest, Image11 *src)
+{
+    ASSERT(src-&gt;getDXGIFormat() == dest-&gt;getDXGIFormat());
+    ASSERT(src-&gt;getWidth() == 1 || src-&gt;getWidth() / 2 == dest-&gt;getWidth());
+    ASSERT(src-&gt;getHeight() == 1 || src-&gt;getHeight() / 2 == dest-&gt;getHeight());
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(src-&gt;getDXGIFormat());
+    ASSERT(dxgiFormatInfo.mipGenerationFunction != NULL);
+
+    D3D11_MAPPED_SUBRESOURCE destMapped;
+    gl::Error error = dest-&gt;map(D3D11_MAP_WRITE, &amp;destMapped);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    D3D11_MAPPED_SUBRESOURCE srcMapped;
+    error = src-&gt;map(D3D11_MAP_READ, &amp;srcMapped);
+    if (error.isError())
+    {
+        dest-&gt;unmap();
+        return error;
+    }
+
+    const uint8_t *sourceData = reinterpret_cast&lt;const uint8_t*&gt;(srcMapped.pData);
+    uint8_t *destData = reinterpret_cast&lt;uint8_t*&gt;(destMapped.pData);
+
+    dxgiFormatInfo.mipGenerationFunction(src-&gt;getWidth(), src-&gt;getHeight(), src-&gt;getDepth(),
+                                         sourceData, srcMapped.RowPitch, srcMapped.DepthPitch,
+                                         destData, destMapped.RowPitch, destMapped.DepthPitch);
+
+    dest-&gt;unmap();
+    src-&gt;unmap();
+
+    dest-&gt;markDirty();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool Image11::isDirty() const
+{
+    // If mDirty is true
+    // AND mStagingTexture doesn't exist AND mStagingTexture doesn't need to be recovered from TextureStorage
+    // AND the texture doesn't require init data (i.e. a blank new texture will suffice)
+    // then isDirty should still return false.
+    if (mDirty &amp;&amp; !mStagingTexture &amp;&amp; !mRecoverFromStorage &amp;&amp; !(d3d11::GetTextureFormatInfo(mInternalFormat, mFeatureLevel).dataInitializerFunction != NULL))
+    {
+        return false;
+    }
+
+    return mDirty;
+}
+
+gl::Error Image11::copyToStorage(TextureStorage *storage, const gl::ImageIndex &amp;index, const gl::Box &amp;region)
+{
+    TextureStorage11 *storage11 = GetAs&lt;TextureStorage11&gt;(storage);
+
+    // If an app's behavior results in an Image11 copying its data to/from to a TextureStorage multiple times,
+    // then we should just keep the staging texture around to prevent the copying from impacting perf.
+    // We allow the Image11 to copy its data to/from TextureStorage once.
+    // This accounts for an app making a late call to glGenerateMipmap.
+    bool attemptToReleaseStagingTexture = (mRecoveredFromStorageCount &lt; 2);
+
+    if (attemptToReleaseStagingTexture)
+    {
+        // If another image is relying on this Storage for its data, then we must let it recover its data before we overwrite it.
+        gl::Error error = storage11-&gt;releaseAssociatedImage(index, this);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    ID3D11Resource *stagingTexture = NULL;
+    unsigned int stagingSubresourceIndex = 0;
+    gl::Error error = getStagingTexture(&amp;stagingTexture, &amp;stagingSubresourceIndex);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = storage11-&gt;updateSubresourceLevel(stagingTexture, stagingSubresourceIndex, index, region);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // Once the image data has been copied into the Storage, we can release it locally.
+    if (attemptToReleaseStagingTexture)
+    {
+        storage11-&gt;associateImage(this, index);
+        releaseStagingTexture();
+        mRecoverFromStorage = true;
+        mAssociatedStorage = storage11;
+        mAssociatedImageIndex = index;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool Image11::isAssociatedStorageValid(TextureStorage11* textureStorage) const
+{
+    return (mAssociatedStorage == textureStorage);
+}
+
+gl::Error Image11::recoverFromAssociatedStorage()
+{
+    if (mRecoverFromStorage)
+    {
+        gl::Error error = createStagingTexture();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        bool textureStorageCorrect = mAssociatedStorage-&gt;isAssociatedImageValid(mAssociatedImageIndex, this);
+
+        // This means that the cached TextureStorage has been modified after this Image11 released its copy of its data. 
+        // This should not have happened. The TextureStorage should have told this Image11 to recover its data before it was overwritten.
+        ASSERT(textureStorageCorrect);
+
+        if (textureStorageCorrect)
+        {
+            // CopySubResource from the Storage to the Staging texture
+            gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
+            error = mAssociatedStorage-&gt;copySubresourceLevel(mStagingTexture, mStagingSubresource, mAssociatedImageIndex, region);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            mRecoveredFromStorageCount += 1;
+        }
+
+        // Reset all the recovery parameters, even if the texture storage association is broken.
+        disassociateStorage();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Image11::disassociateStorage()
+{
+    if (mRecoverFromStorage)
+    {
+        // Make the texturestorage release the Image11 too
+        mAssociatedStorage-&gt;disassociateImage(mAssociatedImageIndex, this);
+
+        mRecoverFromStorage = false;
+        mAssociatedStorage = NULL;
+        mAssociatedImageIndex = gl::ImageIndex::MakeInvalid();
+    }
+}
+
+bool Image11::redefine(GLenum target, GLenum internalformat, const gl::Extents &amp;size, bool forceRelease)
+{
+    if (mWidth != size.width ||
+        mHeight != size.height ||
+        mInternalFormat != internalformat ||
+        forceRelease)
+    {
+        // End the association with the TextureStorage, since that data will be out of date.
+        // Also reset mRecoveredFromStorageCount since this Image is getting completely redefined.
+        disassociateStorage();
+        mRecoveredFromStorageCount = 0;
+
+        mWidth = size.width;
+        mHeight = size.height;
+        mDepth = size.depth;
+        mInternalFormat = internalformat;
+        mTarget = target;
+
+        // compute the d3d format that will be used
+        const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalformat, mFeatureLevel);
+        mDXGIFormat = formatInfo.texFormat;
+        mRenderable = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
+
+        releaseStagingTexture();
+        mDirty = (formatInfo.dataInitializerFunction != NULL);
+
+        return true;
+    }
+
+    return false;
+}
+
+DXGI_FORMAT Image11::getDXGIFormat() const
+{
+    // this should only happen if the image hasn't been redefined first
+    // which would be a bug by the caller
+    ASSERT(mDXGIFormat != DXGI_FORMAT_UNKNOWN);
+
+    return mDXGIFormat;
+}
+
+// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
+// into the target pixel rectangle.
+gl::Error Image11::loadData(const gl::Box &amp;area, const gl::PixelUnpackState &amp;unpack, GLenum type, const void *input)
+{
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
+    GLsizei inputRowPitch = formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength);
+    GLsizei inputDepthPitch = formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment, unpack.rowLength);
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mDXGIFormat);
+    GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
+
+    const d3d11::TextureFormat &amp;d3dFormatInfo = d3d11::GetTextureFormatInfo(mInternalFormat, mFeatureLevel);
+    LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(type);
+
+    D3D11_MAPPED_SUBRESOURCE mappedImage;
+    gl::Error error = map(D3D11_MAP_WRITE, &amp;mappedImage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    uint8_t *offsetMappedData = (reinterpret_cast&lt;uint8_t*&gt;(mappedImage.pData) + (area.y * mappedImage.RowPitch + area.x * outputPixelSize + area.z * mappedImage.DepthPitch));
+    loadFunction(area.width, area.height, area.depth,
+                 reinterpret_cast&lt;const uint8_t*&gt;(input), inputRowPitch, inputDepthPitch,
+                 offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
+
+    unmap();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image11::loadCompressedData(const gl::Box &amp;area, const void *input)
+{
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
+    GLsizei inputRowPitch = formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0);
+    GLsizei inputDepthPitch = formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0);
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mDXGIFormat);
+    GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
+    GLuint outputBlockWidth = dxgiFormatInfo.blockWidth;
+    GLuint outputBlockHeight = dxgiFormatInfo.blockHeight;
+
+    ASSERT(area.x % outputBlockWidth == 0);
+    ASSERT(area.y % outputBlockHeight == 0);
+
+    const d3d11::TextureFormat &amp;d3dFormatInfo = d3d11::GetTextureFormatInfo(mInternalFormat, mFeatureLevel);
+    LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(GL_UNSIGNED_BYTE);
+
+    D3D11_MAPPED_SUBRESOURCE mappedImage;
+    gl::Error error = map(D3D11_MAP_WRITE, &amp;mappedImage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    uint8_t* offsetMappedData = reinterpret_cast&lt;uint8_t*&gt;(mappedImage.pData) + ((area.y / outputBlockHeight) * mappedImage.RowPitch +
+                                                                           (area.x / outputBlockWidth) * outputPixelSize +
+                                                                           area.z * mappedImage.DepthPitch);
+
+    loadFunction(area.width, area.height, area.depth,
+                 reinterpret_cast&lt;const uint8_t*&gt;(input), inputRowPitch, inputDepthPitch,
+                 offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
+
+    unmap();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image11::copy(const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea, RenderTargetD3D *source)
+{
+    RenderTarget11 *sourceRenderTarget = GetAs&lt;RenderTarget11&gt;(source);
+    ASSERT(sourceRenderTarget-&gt;getTexture());
+
+    ID3D11Resource *resource = sourceRenderTarget-&gt;getTexture();
+    UINT subresourceIndex = sourceRenderTarget-&gt;getSubresourceIndex();
+
+    gl::Box sourceBox(sourceArea.x, sourceArea.y, 0, sourceArea.width, sourceArea.height, 1);
+    gl::Error error = copy(destOffset, sourceBox, resource, subresourceIndex);
+
+    SafeRelease(resource);
+
+    return error;
+}
+
+gl::Error Image11::copy(const gl::Offset &amp;destOffset, const gl::Box &amp;sourceArea, const gl::ImageIndex &amp;sourceIndex, TextureStorage *source)
+{
+    TextureStorage11 *sourceStorage11 = GetAs&lt;TextureStorage11&gt;(source);
+
+    UINT subresourceIndex = sourceStorage11-&gt;getSubresourceIndex(sourceIndex);
+    ID3D11Resource *resource = NULL;
+    gl::Error error = sourceStorage11-&gt;getResource(&amp;resource);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = copy(destOffset, sourceArea, resource, subresourceIndex);
+
+    SafeRelease(resource);
+
+    return error;
+}
+
+gl::Error Image11::copy(const gl::Offset &amp;destOffset, const gl::Box &amp;sourceArea, ID3D11Resource *source, UINT sourceSubResource)
+{
+    D3D11_RESOURCE_DIMENSION dim;
+    source-&gt;GetType(&amp;dim);
+
+    DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
+    gl::Extents extents;
+    UINT sampleCount = 0;
+
+    ID3D11Texture2D *source2D = NULL;
+
+    if (dim == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
+    {
+        D3D11_TEXTURE2D_DESC textureDesc2D;
+        source2D = d3d11::DynamicCastComObject&lt;ID3D11Texture2D&gt;(source);
+        ASSERT(source2D);
+        source2D-&gt;GetDesc(&amp;textureDesc2D);
+
+        format = textureDesc2D.Format;
+        extents = gl::Extents(textureDesc2D.Width, textureDesc2D.Height, 1);
+        sampleCount = textureDesc2D.SampleDesc.Count;
+    }
+    else if (dim == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
+    {
+        D3D11_TEXTURE3D_DESC textureDesc3D;
+        ID3D11Texture3D *source3D = d3d11::DynamicCastComObject&lt;ID3D11Texture3D&gt;(source);
+        ASSERT(source3D);
+        source3D-&gt;GetDesc(&amp;textureDesc3D);
+
+        format = textureDesc3D.Format;
+        extents = gl::Extents(textureDesc3D.Width, textureDesc3D.Height, textureDesc3D.Depth);
+        sampleCount = 1;
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    if (format == mDXGIFormat)
+    {
+        // No conversion needed-- use copyback fastpath
+        ID3D11Resource *stagingTexture = NULL;
+        unsigned int stagingSubresourceIndex = 0;
+        gl::Error error = getStagingTexture(&amp;stagingTexture, &amp;stagingSubresourceIndex);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+        ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+        UINT subresourceAfterResolve = sourceSubResource;
+
+        ID3D11Resource *srcTex = NULL;
+
+        bool needResolve = (dim == D3D11_RESOURCE_DIMENSION_TEXTURE2D &amp;&amp; sampleCount &gt; 1);
+
+        if (needResolve)
+        {
+            D3D11_TEXTURE2D_DESC resolveDesc;
+            resolveDesc.Width = extents.width;
+            resolveDesc.Height = extents.height;
+            resolveDesc.MipLevels = 1;
+            resolveDesc.ArraySize = 1;
+            resolveDesc.Format = format;
+            resolveDesc.SampleDesc.Count = 1;
+            resolveDesc.SampleDesc.Quality = 0;
+            resolveDesc.Usage = D3D11_USAGE_DEFAULT;
+            resolveDesc.BindFlags = 0;
+            resolveDesc.CPUAccessFlags = 0;
+            resolveDesc.MiscFlags = 0;
+
+            ID3D11Texture2D *srcTex2D = NULL;
+            HRESULT result = device-&gt;CreateTexture2D(&amp;resolveDesc, NULL, &amp;srcTex2D);
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create resolve texture for Image11::copy, HRESULT: 0x%X.&quot;, result);
+            }
+            srcTex = srcTex2D;
+
+            deviceContext-&gt;ResolveSubresource(srcTex, 0, source, sourceSubResource, format);
+            subresourceAfterResolve = 0;
+        }
+        else
+        {
+            srcTex = source;
+        }
+
+        D3D11_BOX srcBox;
+        srcBox.left = sourceArea.x;
+        srcBox.right = sourceArea.x + sourceArea.width;
+        srcBox.top = sourceArea.y;
+        srcBox.bottom = sourceArea.y + sourceArea.height;
+        srcBox.front = sourceArea.z;
+        srcBox.back = sourceArea.z + sourceArea.depth;
+
+        deviceContext-&gt;CopySubresourceRegion(stagingTexture, stagingSubresourceIndex, destOffset.x, destOffset.y,
+                                             destOffset.z, srcTex, subresourceAfterResolve, &amp;srcBox);
+
+        if (needResolve)
+        {
+            SafeRelease(srcTex);
+        }
+    }
+    else
+    {
+        // This format requires conversion, so we must copy the texture to staging and manually convert via readPixels
+        D3D11_MAPPED_SUBRESOURCE mappedImage;
+        gl::Error error = map(D3D11_MAP_WRITE, &amp;mappedImage);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // determine the offset coordinate into the destination buffer
+        const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mDXGIFormat);
+        GLsizei rowOffset = dxgiFormatInfo.pixelBytes * destOffset.x;
+        uint8_t *dataOffset = static_cast&lt;uint8_t*&gt;(mappedImage.pData) + mappedImage.RowPitch * destOffset.y + rowOffset + destOffset.z * mappedImage.DepthPitch;
+
+        const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
+
+        // Currently in ANGLE, the source data may only need to be converted if the source is the current framebuffer
+        // and OpenGL ES framebuffers must be 2D textures therefore we should not need to convert 3D textures between different formats.
+        ASSERT(dim == D3D11_RESOURCE_DIMENSION_TEXTURE2D);
+        ASSERT(sourceArea.z == 0 &amp;&amp; sourceArea.depth == 1);
+        gl::Rectangle sourceRect(sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height);
+        error = mRenderer-&gt;readTextureData(source2D, sourceSubResource, sourceRect, formatInfo.format, formatInfo.type, mappedImage.RowPitch, gl::PixelPackState(), dataOffset);
+
+        unmap();
+
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    mDirty = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image11::getStagingTexture(ID3D11Resource **outStagingTexture, unsigned int *outSubresourceIndex)
+{
+    gl::Error error = createStagingTexture();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    *outStagingTexture = mStagingTexture;
+    *outSubresourceIndex = mStagingSubresource;
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Image11::releaseStagingTexture()
+{
+    SafeRelease(mStagingTexture);
+}
+
+gl::Error Image11::createStagingTexture()
+{
+    if (mStagingTexture)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    ASSERT(mWidth &gt; 0 &amp;&amp; mHeight &gt; 0 &amp;&amp; mDepth &gt; 0);
+
+    const DXGI_FORMAT dxgiFormat = getDXGIFormat();
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    HRESULT result;
+
+    int lodOffset = 1;
+    GLsizei width = mWidth;
+    GLsizei height = mHeight;
+
+    // adjust size if needed for compressed textures
+    d3d11::MakeValidSize(false, dxgiFormat, &amp;width, &amp;height, &amp;lodOffset);
+
+    if (mTarget == GL_TEXTURE_3D)
+    {
+        ID3D11Texture3D *newTexture = NULL;
+
+        D3D11_TEXTURE3D_DESC desc;
+        desc.Width = width;
+        desc.Height = height;
+        desc.Depth = mDepth;
+        desc.MipLevels = lodOffset + 1;
+        desc.Format = dxgiFormat;
+        desc.Usage = D3D11_USAGE_STAGING;
+        desc.BindFlags = 0;
+        desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+        desc.MiscFlags = 0;
+
+        if (d3d11::GetTextureFormatInfo(mInternalFormat, mFeatureLevel).dataInitializerFunction != NULL)
+        {
+            std::vector&lt;D3D11_SUBRESOURCE_DATA&gt; initialData;
+            std::vector&lt; std::vector&lt;BYTE&gt; &gt; textureData;
+            d3d11::GenerateInitialTextureData(mInternalFormat, mFeatureLevel, width, height, mDepth,
+                                              lodOffset + 1, &amp;initialData, &amp;textureData);
+
+            result = device-&gt;CreateTexture3D(&amp;desc, initialData.data(), &amp;newTexture);
+        }
+        else
+        {
+            result = device-&gt;CreateTexture3D(&amp;desc, NULL, &amp;newTexture);
+        }
+
+        if (FAILED(result))
+        {
+            ASSERT(result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create staging texture, result: 0x%X.&quot;, result);
+        }
+
+        mStagingTexture = newTexture;
+        mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
+    }
+    else if (mTarget == GL_TEXTURE_2D || mTarget == GL_TEXTURE_2D_ARRAY || mTarget == GL_TEXTURE_CUBE_MAP)
+    {
+        ID3D11Texture2D *newTexture = NULL;
+
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = width;
+        desc.Height = height;
+        desc.MipLevels = lodOffset + 1;
+        desc.ArraySize = 1;
+        desc.Format = dxgiFormat;
+        desc.SampleDesc.Count = 1;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_STAGING;
+        desc.BindFlags = 0;
+        desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+        desc.MiscFlags = 0;
+
+        if (d3d11::GetTextureFormatInfo(mInternalFormat, mFeatureLevel).dataInitializerFunction != NULL)
+        {
+            std::vector&lt;D3D11_SUBRESOURCE_DATA&gt; initialData;
+            std::vector&lt; std::vector&lt;BYTE&gt; &gt; textureData;
+            d3d11::GenerateInitialTextureData(mInternalFormat, mFeatureLevel, width, height, 1,
+                                              lodOffset + 1, &amp;initialData, &amp;textureData);
+
+            result = device-&gt;CreateTexture2D(&amp;desc, initialData.data(), &amp;newTexture);
+        }
+        else
+        {
+            result = device-&gt;CreateTexture2D(&amp;desc, NULL, &amp;newTexture);
+        }
+
+        if (FAILED(result))
+        {
+            ASSERT(result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create staging texture, result: 0x%X.&quot;, result);
+        }
+
+        mStagingTexture = newTexture;
+        mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    mDirty = false;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
+{
+    // We must recover from the TextureStorage if necessary, even for D3D11_MAP_WRITE.
+    gl::Error error = recoverFromAssociatedStorage();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ID3D11Resource *stagingTexture = NULL;
+    unsigned int subresourceIndex = 0;
+    error = getStagingTexture(&amp;stagingTexture, &amp;subresourceIndex);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+    ASSERT(mStagingTexture);
+    HRESULT result = deviceContext-&gt;Map(stagingTexture, subresourceIndex, mapType, 0, map);
+
+    // this can fail if the device is removed (from TDR)
+    if (d3d11::isDeviceLostError(result))
+    {
+        mRenderer-&gt;notifyDeviceLost();
+    }
+    else if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map staging texture, result: 0x%X.&quot;, result);
+    }
+
+    mDirty = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Image11::unmap()
+{
+    if (mStagingTexture)
+    {
+        ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+        deviceContext-&gt;Unmap(mStagingTexture, mStagingSubresource);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Image11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Image11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+//
+// 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.
+//
+
+// Image11.h: Defines the rx::Image11 class, which acts as the interface to
+// the actual underlying resources of a Texture
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
+
+#include &quot;libANGLE/renderer/d3d/ImageD3D.h&quot;
+#include &quot;libANGLE/ImageIndex.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace rx
+{
+class Renderer11;
+class TextureStorage11;
+
+class Image11 : public ImageD3D
+{
+  public:
+    Image11(Renderer11 *renderer);
+    virtual ~Image11();
+
+    static gl::Error generateMipmap(Image11 *dest, Image11 *src);
+
+    virtual bool isDirty() const;
+
+    virtual gl::Error copyToStorage(TextureStorage *storage, const gl::ImageIndex &amp;index, const gl::Box &amp;region);
+
+    bool redefine(GLenum target, GLenum internalformat, const gl::Extents &amp;size, bool forceRelease) override;
+
+    DXGI_FORMAT getDXGIFormat() const;
+
+    virtual gl::Error loadData(const gl::Box &amp;area, const gl::PixelUnpackState &amp;unpack, GLenum type, const void *input);
+    virtual gl::Error loadCompressedData(const gl::Box &amp;area, const void *input);
+
+    virtual gl::Error copy(const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea, RenderTargetD3D *source);
+    virtual gl::Error copy(const gl::Offset &amp;destOffset, const gl::Box &amp;sourceArea,
+                           const gl::ImageIndex &amp;sourceIndex, TextureStorage *source);
+
+    gl::Error recoverFromAssociatedStorage();
+    bool isAssociatedStorageValid(TextureStorage11* textureStorage) const;
+    void disassociateStorage();
+
+  protected:
+    gl::Error map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map);
+    void unmap();
+
+  private:
+    gl::Error copyToStorageImpl(TextureStorage11 *storage11, const gl::ImageIndex &amp;index, const gl::Box &amp;region);
+    gl::Error copy(const gl::Offset &amp;destOffset, const gl::Box &amp;sourceArea, ID3D11Resource *source, UINT sourceSubResource);
+
+    gl::Error getStagingTexture(ID3D11Resource **outStagingTexture, unsigned int *outSubresourceIndex);
+    gl::Error createStagingTexture();
+    void releaseStagingTexture();
+
+    Renderer11 *mRenderer;
+    D3D_FEATURE_LEVEL mFeatureLevel;
+
+    DXGI_FORMAT mDXGIFormat;
+    ID3D11Resource *mStagingTexture;
+    unsigned int mStagingSubresource;
+
+    bool mRecoverFromStorage;
+    TextureStorage11 *mAssociatedStorage;
+    gl::ImageIndex mAssociatedImageIndex;
+    unsigned int mRecoveredFromStorageCount;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_IMAGE11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11IndexBuffer11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+//
+// 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.
+//
+
+// IndexBuffer11.cpp: Defines the D3D11 IndexBuffer implementation.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/IndexBuffer11.h&quot;
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+
+namespace rx
+{
+
+IndexBuffer11::IndexBuffer11(Renderer11 *const renderer) : mRenderer(renderer)
+{
+    mBuffer = NULL;
+    mBufferSize = 0;
+    mDynamicUsage = false;
+}
+
+IndexBuffer11::~IndexBuffer11()
+{
+    SafeRelease(mBuffer);
+}
+
+gl::Error IndexBuffer11::initialize(unsigned int bufferSize, GLenum indexType, bool dynamic)
+{
+    SafeRelease(mBuffer);
+
+    updateSerial();
+
+    if (bufferSize &gt; 0)
+    {
+        ID3D11Device* dxDevice = mRenderer-&gt;getDevice();
+
+        D3D11_BUFFER_DESC bufferDesc;
+        bufferDesc.ByteWidth = bufferSize;
+        bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+        bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+        bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+        bufferDesc.MiscFlags = 0;
+        bufferDesc.StructureByteStride = 0;
+
+        HRESULT result = dxDevice-&gt;CreateBuffer(&amp;bufferDesc, NULL, &amp;mBuffer);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal index buffer of size, %lu.&quot;, bufferSize);
+        }
+
+        if (dynamic)
+        {
+            d3d11::SetDebugName(mBuffer, &quot;IndexBuffer11 (dynamic)&quot;);
+        }
+        else
+        {
+            d3d11::SetDebugName(mBuffer, &quot;IndexBuffer11 (static)&quot;);
+        }
+    }
+
+    mBufferSize = bufferSize;
+    mIndexType = indexType;
+    mDynamicUsage = dynamic;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error IndexBuffer11::mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory)
+{
+    if (!mBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal index buffer is not initialized.&quot;);
+    }
+
+    // Check for integer overflows and out-out-bounds map requests
+    if (offset + size &lt; offset || offset + size &gt; mBufferSize)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Index buffer map range is not inside the buffer.&quot;);
+    }
+
+    ID3D11DeviceContext *dxContext = mRenderer-&gt;getDeviceContext();
+
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    HRESULT result = dxContext-&gt;Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal index buffer, HRESULT: 0x%08x.&quot;, result);
+    }
+
+    *outMappedMemory = reinterpret_cast&lt;char*&gt;(mappedResource.pData) + offset;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error IndexBuffer11::unmapBuffer()
+{
+    if (!mBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal index buffer is not initialized.&quot;);
+    }
+
+    ID3D11DeviceContext *dxContext = mRenderer-&gt;getDeviceContext();
+    dxContext-&gt;Unmap(mBuffer, 0);
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLenum IndexBuffer11::getIndexType() const
+{
+    return mIndexType;
+}
+
+unsigned int IndexBuffer11::getBufferSize() const
+{
+    return mBufferSize;
+}
+
+gl::Error IndexBuffer11::setSize(unsigned int bufferSize, GLenum indexType)
+{
+    if (bufferSize &gt; mBufferSize || indexType != mIndexType)
+    {
+        return initialize(bufferSize, indexType, mDynamicUsage);
+    }
+    else
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error IndexBuffer11::discard()
+{
+    if (!mBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal index buffer is not initialized.&quot;);
+    }
+
+    ID3D11DeviceContext *dxContext = mRenderer-&gt;getDeviceContext();
+
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    HRESULT result = dxContext-&gt;Map(mBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal index buffer, HRESULT: 0x%08x.&quot;, result);
+    }
+
+    dxContext-&gt;Unmap(mBuffer, 0);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+DXGI_FORMAT IndexBuffer11::getIndexFormat() const
+{
+    switch (mIndexType)
+    {
+      case GL_UNSIGNED_BYTE:    return DXGI_FORMAT_R16_UINT;
+      case GL_UNSIGNED_SHORT:   return DXGI_FORMAT_R16_UINT;
+      case GL_UNSIGNED_INT:     return DXGI_FORMAT_R32_UINT;
+      default: UNREACHABLE();   return DXGI_FORMAT_UNKNOWN;
+    }
+}
+
+ID3D11Buffer *IndexBuffer11::getBuffer() const
+{
+    return mBuffer;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11IndexBuffer11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/IndexBuffer11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+//
+// 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.
+//
+
+// IndexBuffer11.h: Defines the D3D11 IndexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
+
+#include &quot;libANGLE/renderer/d3d/IndexBuffer.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+class IndexBuffer11 : public IndexBuffer
+{
+  public:
+    explicit IndexBuffer11(Renderer11 *const renderer);
+    virtual ~IndexBuffer11();
+
+    virtual gl::Error initialize(unsigned int bufferSize, GLenum indexType, bool dynamic);
+
+    virtual gl::Error mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory);
+    virtual gl::Error unmapBuffer();
+
+    virtual GLenum getIndexType() const;
+    virtual unsigned int getBufferSize() const;
+    virtual gl::Error setSize(unsigned int bufferSize, GLenum indexType);
+
+    virtual gl::Error discard();
+
+    DXGI_FORMAT getIndexFormat() const;
+    ID3D11Buffer *getBuffer() const;
+
+  private:
+    Renderer11 *const mRenderer;
+
+    ID3D11Buffer *mBuffer;
+    unsigned int mBufferSize;
+    GLenum mIndexType;
+    bool mDynamicUsage;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_INDEXBUFFER11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11InputLayoutCachecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,430 @@
</span><ins>+//
+// 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.
+//
+
+// InputLayoutCache.cpp: Defines InputLayoutCache, a class that builds and caches
+// D3D11 input layouts.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/InputLayoutCache.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/VertexBuffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Buffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/ProgramD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/VertexDataManager.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+
+#include &quot;third_party/murmurhash/MurmurHash3.h&quot;
+
+namespace rx
+{
+
+static void GetInputLayout(const TranslatedAttribute translatedAttributes[gl::MAX_VERTEX_ATTRIBS],
+                           gl::VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS])
+{
+    for (unsigned int attributeIndex = 0; attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
+    {
+        const TranslatedAttribute &amp;translatedAttribute = translatedAttributes[attributeIndex];
+
+        if (translatedAttributes[attributeIndex].active)
+        {
+            inputLayout[attributeIndex] = gl::VertexFormat(*translatedAttribute.attribute,
+                                                           translatedAttribute.currentValueType);
+        }
+    }
+}
+
+const unsigned int InputLayoutCache::kMaxInputLayouts = 1024;
+
+InputLayoutCache::InputLayoutCache() : mInputLayoutMap(kMaxInputLayouts, hashInputLayout, compareInputLayouts)
+{
+    mCounter = 0;
+    mDevice = NULL;
+    mDeviceContext = NULL;
+    mCurrentIL = NULL;
+    for (unsigned int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        mCurrentBuffers[i] = NULL;
+        mCurrentVertexStrides[i] = static_cast&lt;UINT&gt;(-1);
+        mCurrentVertexOffsets[i] = static_cast&lt;UINT&gt;(-1);
+    }
+    mPointSpriteVertexBuffer = NULL;
+    mPointSpriteIndexBuffer = NULL;
+}
+
+InputLayoutCache::~InputLayoutCache()
+{
+    clear();
+}
+
+void InputLayoutCache::initialize(ID3D11Device *device, ID3D11DeviceContext *context)
+{
+    clear();
+    mDevice = device;
+    mDeviceContext = context;
+    mFeatureLevel = device-&gt;GetFeatureLevel();
+}
+
+void InputLayoutCache::clear()
+{
+    for (InputLayoutMap::iterator i = mInputLayoutMap.begin(); i != mInputLayoutMap.end(); i++)
+    {
+        SafeRelease(i-&gt;second.inputLayout);
+    }
+    mInputLayoutMap.clear();
+    SafeRelease(mPointSpriteVertexBuffer);
+    SafeRelease(mPointSpriteIndexBuffer);
+    markDirty();
+}
+
+void InputLayoutCache::markDirty()
+{
+    mCurrentIL = NULL;
+    for (unsigned int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        mCurrentBuffers[i] = NULL;
+        mCurrentVertexStrides[i] = static_cast&lt;UINT&gt;(-1);
+        mCurrentVertexOffsets[i] = static_cast&lt;UINT&gt;(-1);
+    }
+}
+
+gl::Error InputLayoutCache::applyVertexBuffers(TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS],
+                                               GLenum mode, gl::Program *program)
+{
+    ProgramD3D *programD3D = GetImplAs&lt;ProgramD3D&gt;(program);
+
+    int sortedSemanticIndices[gl::MAX_VERTEX_ATTRIBS];
+    programD3D-&gt;sortAttributesByLayout(attributes, sortedSemanticIndices);
+    bool programUsesInstancedPointSprites = programD3D-&gt;usesPointSize() &amp;&amp; programD3D-&gt;usesInstancedPointSpriteEmulation();
+    bool instancedPointSpritesActive = programUsesInstancedPointSprites &amp;&amp; (mode == GL_POINTS);
+
+    if (!mDevice || !mDeviceContext)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal input layout cache is not initialized.&quot;);
+    }
+
+    InputLayoutKey ilKey = { 0 };
+
+    static const char* semanticName = &quot;TEXCOORD&quot;;
+
+    unsigned int firstIndexedElement = gl::MAX_VERTEX_ATTRIBS;
+    unsigned int firstInstancedElement = gl::MAX_VERTEX_ATTRIBS;
+    unsigned int nextAvailableInputSlot = 0;
+
+    for (unsigned int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        if (attributes[i].active)
+        {
+            D3D11_INPUT_CLASSIFICATION inputClass = attributes[i].divisor &gt; 0 ? D3D11_INPUT_PER_INSTANCE_DATA : D3D11_INPUT_PER_VERTEX_DATA;
+            // If rendering points and instanced pointsprite emulation is being used, the inputClass is required to be configured as per instance data
+            inputClass = instancedPointSpritesActive ? D3D11_INPUT_PER_INSTANCE_DATA : inputClass;
+
+            gl::VertexFormat vertexFormat(*attributes[i].attribute, attributes[i].currentValueType);
+            const d3d11::VertexFormat &amp;vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormat, mFeatureLevel);
+
+            // Record the type of the associated vertex shader vector in our key
+            // This will prevent mismatched vertex shaders from using the same input layout
+            GLint attributeSize;
+            program-&gt;getActiveAttribute(ilKey.elementCount, 0, NULL, &amp;attributeSize, &amp;ilKey.elements[ilKey.elementCount].glslElementType, NULL);
+
+            ilKey.elements[ilKey.elementCount].desc.SemanticName = semanticName;
+            ilKey.elements[ilKey.elementCount].desc.SemanticIndex = sortedSemanticIndices[i];
+            ilKey.elements[ilKey.elementCount].desc.Format = vertexFormatInfo.nativeFormat;
+            ilKey.elements[ilKey.elementCount].desc.InputSlot = i;
+            ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
+            ilKey.elements[ilKey.elementCount].desc.InputSlotClass = inputClass;
+            ilKey.elements[ilKey.elementCount].desc.InstanceDataStepRate = instancedPointSpritesActive ? 1 : attributes[i].divisor;
+
+            if (inputClass == D3D11_INPUT_PER_VERTEX_DATA &amp;&amp; firstIndexedElement == gl::MAX_VERTEX_ATTRIBS)
+            {
+                firstIndexedElement = ilKey.elementCount;
+            }
+            else if (inputClass == D3D11_INPUT_PER_INSTANCE_DATA &amp;&amp; firstInstancedElement == gl::MAX_VERTEX_ATTRIBS)
+            {
+                firstInstancedElement = ilKey.elementCount;
+            }
+
+            ilKey.elementCount++;
+            nextAvailableInputSlot = i + 1;
+        }
+    }
+
+    // Instanced PointSprite emulation requires additional entries in the
+    // inputlayout to support the vertices that make up the pointsprite quad.
+    // We do this even if mode != GL_POINTS, since the shader signature has these inputs, and the input layout must match the shader
+    if (programUsesInstancedPointSprites)
+    {
+        ilKey.elements[ilKey.elementCount].desc.SemanticName = &quot;SPRITEPOSITION&quot;;
+        ilKey.elements[ilKey.elementCount].desc.SemanticIndex = 0;
+        ilKey.elements[ilKey.elementCount].desc.Format = DXGI_FORMAT_R32G32B32_FLOAT;
+        ilKey.elements[ilKey.elementCount].desc.InputSlot = nextAvailableInputSlot;
+        ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = 0;
+        ilKey.elements[ilKey.elementCount].desc.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
+        ilKey.elements[ilKey.elementCount].desc.InstanceDataStepRate = 0;
+
+        // The new elements are D3D11_INPUT_PER_VERTEX_DATA data so the indexed element
+        // tracking must be applied.  This ensures that the instancing specific
+        // buffer swapping logic continues to work.
+        if (firstIndexedElement == gl::MAX_VERTEX_ATTRIBS)
+        {
+            firstIndexedElement = ilKey.elementCount;
+        }
+
+        ilKey.elementCount++;
+
+        ilKey.elements[ilKey.elementCount].desc.SemanticName = &quot;SPRITETEXCOORD&quot;;
+        ilKey.elements[ilKey.elementCount].desc.SemanticIndex = 0;
+        ilKey.elements[ilKey.elementCount].desc.Format = DXGI_FORMAT_R32G32_FLOAT;
+        ilKey.elements[ilKey.elementCount].desc.InputSlot = nextAvailableInputSlot;
+        ilKey.elements[ilKey.elementCount].desc.AlignedByteOffset = sizeof(float) * 3;
+        ilKey.elements[ilKey.elementCount].desc.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
+        ilKey.elements[ilKey.elementCount].desc.InstanceDataStepRate = 0;
+
+        ilKey.elementCount++;
+    }
+
+    // On 9_3, we must ensure that slot 0 contains non-instanced data.
+    // If slot 0 currently contains instanced data then we swap it with a non-instanced element.
+    // Note that instancing is only available on 9_3 via ANGLE_instanced_arrays, since 9_3 doesn't support OpenGL ES 3.0.
+    // As per the spec for ANGLE_instanced_arrays, not all attributes can be instanced simultaneously, so a non-instanced element must exist.
+    ASSERT(!(mFeatureLevel &lt;= D3D_FEATURE_LEVEL_9_3 &amp;&amp; firstIndexedElement == gl::MAX_VERTEX_ATTRIBS));
+    bool moveFirstIndexedIntoSlotZero = mFeatureLevel &lt;= D3D_FEATURE_LEVEL_9_3 &amp;&amp; firstInstancedElement == 0 &amp;&amp; firstIndexedElement != gl::MAX_VERTEX_ATTRIBS;
+
+    if (moveFirstIndexedIntoSlotZero)
+    {
+        ilKey.elements[firstInstancedElement].desc.InputSlot = ilKey.elements[firstIndexedElement].desc.InputSlot;
+        ilKey.elements[firstIndexedElement].desc.InputSlot = 0;
+
+        // Instanced PointSprite emulation uses multiple layout entries across a single vertex buffer.
+        // If an index swap is performed, we need to ensure that all elements get the proper InputSlot.
+        if (programUsesInstancedPointSprites)
+        {
+            ilKey.elements[firstIndexedElement + 1].desc.InputSlot = 0;
+        }
+    }
+
+    ID3D11InputLayout *inputLayout = NULL;
+
+    InputLayoutMap::iterator keyIter = mInputLayoutMap.find(ilKey);
+    if (keyIter != mInputLayoutMap.end())
+    {
+        inputLayout = keyIter-&gt;second.inputLayout;
+        keyIter-&gt;second.lastUsedTime = mCounter++;
+    }
+    else
+    {
+        gl::VertexFormat shaderInputLayout[gl::MAX_VERTEX_ATTRIBS];
+        GetInputLayout(attributes, shaderInputLayout);
+
+        ShaderExecutableD3D *shader = NULL;
+        gl::Error error = programD3D-&gt;getVertexExecutableForInputLayout(shaderInputLayout, &amp;shader, nullptr);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ShaderExecutableD3D *shader11 = GetAs&lt;ShaderExecutable11&gt;(shader);
+
+        D3D11_INPUT_ELEMENT_DESC descs[gl::MAX_VERTEX_ATTRIBS];
+        for (unsigned int j = 0; j &lt; ilKey.elementCount; ++j)
+        {
+            descs[j] = ilKey.elements[j].desc;
+        }
+
+        HRESULT result = mDevice-&gt;CreateInputLayout(descs, ilKey.elementCount, shader11-&gt;getFunction(), shader11-&gt;getLength(), &amp;inputLayout);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal input layout, HRESULT: 0x%08x&quot;, result);
+        }
+
+        if (mInputLayoutMap.size() &gt;= kMaxInputLayouts)
+        {
+            TRACE(&quot;Overflowed the limit of %u input layouts, removing the least recently used &quot;
+                  &quot;to make room.&quot;, kMaxInputLayouts);
+
+            InputLayoutMap::iterator leastRecentlyUsed = mInputLayoutMap.begin();
+            for (InputLayoutMap::iterator i = mInputLayoutMap.begin(); i != mInputLayoutMap.end(); i++)
+            {
+                if (i-&gt;second.lastUsedTime &lt; leastRecentlyUsed-&gt;second.lastUsedTime)
+                {
+                    leastRecentlyUsed = i;
+                }
+            }
+            SafeRelease(leastRecentlyUsed-&gt;second.inputLayout);
+            mInputLayoutMap.erase(leastRecentlyUsed);
+        }
+
+        InputLayoutCounterPair inputCounterPair;
+        inputCounterPair.inputLayout = inputLayout;
+        inputCounterPair.lastUsedTime = mCounter++;
+
+        mInputLayoutMap.insert(std::make_pair(ilKey, inputCounterPair));
+    }
+
+    if (inputLayout != mCurrentIL)
+    {
+        mDeviceContext-&gt;IASetInputLayout(inputLayout);
+        mCurrentIL = inputLayout;
+    }
+
+    bool dirtyBuffers = false;
+    size_t minDiff = gl::MAX_VERTEX_ATTRIBS;
+    size_t maxDiff = 0;
+    unsigned int nextAvailableIndex = 0;
+
+    for (unsigned int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        ID3D11Buffer *buffer = NULL;
+
+        if (attributes[i].active)
+        {
+            VertexBuffer11 *vertexBuffer = GetAs&lt;VertexBuffer11&gt;(attributes[i].vertexBuffer);
+            Buffer11 *bufferStorage = attributes[i].storage ? GetAs&lt;Buffer11&gt;(attributes[i].storage) : NULL;
+
+            buffer = bufferStorage ? bufferStorage-&gt;getBuffer(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK)
+                                   : vertexBuffer-&gt;getBuffer();
+        }
+
+        UINT vertexStride = attributes[i].stride;
+        UINT vertexOffset = attributes[i].offset;
+
+        if (buffer != mCurrentBuffers[i] || vertexStride != mCurrentVertexStrides[i] ||
+            vertexOffset != mCurrentVertexOffsets[i])
+        {
+            dirtyBuffers = true;
+            minDiff = std::min(minDiff, static_cast&lt;size_t&gt;(i));
+            maxDiff = std::max(maxDiff, static_cast&lt;size_t&gt;(i));
+
+            mCurrentBuffers[i] = buffer;
+            mCurrentVertexStrides[i] = vertexStride;
+            mCurrentVertexOffsets[i] = vertexOffset;
+
+            // If a non null ID3D11Buffer is being assigned to mCurrentBuffers,
+            // then the next available index needs to be tracked to ensure 
+            // that any instanced pointsprite emulation buffers will be properly packed.
+            if (buffer)
+            {
+                nextAvailableIndex = i + 1;
+            }
+        }
+    }
+
+    // Instanced PointSprite emulation requires two additional ID3D11Buffers.
+    // A vertex buffer needs to be created and added to the list of current buffers, 
+    // strides and offsets collections.  This buffer contains the vertices for a single
+    // PointSprite quad.
+    // An index buffer also needs to be created and applied because rendering instanced
+    // data on D3D11 FL9_3 requires DrawIndexedInstanced() to be used.
+    if (instancedPointSpritesActive)
+    {
+        HRESULT result = S_OK;
+        const UINT pointSpriteVertexStride = sizeof(float) * 5;
+
+        if (!mPointSpriteVertexBuffer)
+        {
+            static const float pointSpriteVertices[] =
+            {
+                // Position        // TexCoord
+               -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
+               -1.0f,  1.0f, 0.0f, 0.0f, 0.0f,
+                1.0f,  1.0f, 0.0f, 1.0f, 0.0f,
+                1.0f, -1.0f, 0.0f, 1.0f, 1.0f,
+               -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
+                1.0f,  1.0f, 0.0f, 1.0f, 0.0f,
+            };
+
+            D3D11_SUBRESOURCE_DATA vertexBufferData = { pointSpriteVertices, 0, 0 };
+            D3D11_BUFFER_DESC vertexBufferDesc;
+            vertexBufferDesc.ByteWidth = sizeof(pointSpriteVertices);
+            vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+            vertexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
+            vertexBufferDesc.CPUAccessFlags = 0;
+            vertexBufferDesc.MiscFlags = 0;
+            vertexBufferDesc.StructureByteStride = 0;
+
+            result = mDevice-&gt;CreateBuffer(&amp;vertexBufferDesc, &amp;vertexBufferData, &amp;mPointSpriteVertexBuffer);
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create instanced pointsprite emulation vertex buffer, HRESULT: 0x%08x&quot;, result);
+            }
+        }
+
+        mCurrentBuffers[nextAvailableIndex] = mPointSpriteVertexBuffer;
+        mCurrentVertexStrides[nextAvailableIndex] = pointSpriteVertexStride;
+        mCurrentVertexOffsets[nextAvailableIndex] = 0;
+
+        if (!mPointSpriteIndexBuffer)
+        {
+            // Create an index buffer and set it for pointsprite rendering
+            static const unsigned short pointSpriteIndices[] =
+            {
+                0, 1, 2, 3, 4, 5,
+            };
+
+            D3D11_SUBRESOURCE_DATA indexBufferData = { pointSpriteIndices, 0, 0 };
+            D3D11_BUFFER_DESC indexBufferDesc;
+            indexBufferDesc.ByteWidth = sizeof(pointSpriteIndices);
+            indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
+            indexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
+            indexBufferDesc.CPUAccessFlags = 0;
+            indexBufferDesc.MiscFlags = 0;
+            indexBufferDesc.StructureByteStride = 0;
+
+            result = mDevice-&gt;CreateBuffer(&amp;indexBufferDesc, &amp;indexBufferData, &amp;mPointSpriteIndexBuffer);
+            if (FAILED(result))
+            {
+                SafeRelease(mPointSpriteVertexBuffer);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create instanced pointsprite emulation index buffer, HRESULT: 0x%08x&quot;, result);
+            }
+        }
+
+        // The index buffer is applied here because Instanced PointSprite emulation uses
+        // the a non-indexed rendering path in ANGLE (DrawArrays).  This means that applyIndexBuffer()
+        // on the renderer will not be called and setting this buffer here ensures that the rendering
+        // path will contain the correct index buffers.
+        mDeviceContext-&gt;IASetIndexBuffer(mPointSpriteIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
+    }
+
+    if (moveFirstIndexedIntoSlotZero)
+    {
+        // In this case, we swapped the slots of the first instanced element and the first indexed element, to ensure
+        // that the first slot contains non-instanced data (required by Feature Level 9_3).
+        // We must also swap the corresponding buffers sent to IASetVertexBuffers so that the correct data is sent to each slot.
+        std::swap(mCurrentBuffers[firstIndexedElement], mCurrentBuffers[firstInstancedElement]);
+        std::swap(mCurrentVertexStrides[firstIndexedElement], mCurrentVertexStrides[firstInstancedElement]);
+        std::swap(mCurrentVertexOffsets[firstIndexedElement], mCurrentVertexOffsets[firstInstancedElement]);
+    }
+
+    if (dirtyBuffers)
+    {
+        ASSERT(minDiff &lt;= maxDiff &amp;&amp; maxDiff &lt; gl::MAX_VERTEX_ATTRIBS);
+        mDeviceContext-&gt;IASetVertexBuffers(minDiff, maxDiff - minDiff + 1, mCurrentBuffers + minDiff,
+                                           mCurrentVertexStrides + minDiff, mCurrentVertexOffsets + minDiff);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+std::size_t InputLayoutCache::hashInputLayout(const InputLayoutKey &amp;inputLayout)
+{
+    static const unsigned int seed = 0xDEADBEEF;
+
+    std::size_t hash = 0;
+    MurmurHash3_x86_32(inputLayout.begin(), static_cast&lt;int&gt;(inputLayout.end() - inputLayout.begin()), seed, &amp;hash);
+    return hash;
+}
+
+bool InputLayoutCache::compareInputLayouts(const InputLayoutKey &amp;a, const InputLayoutKey &amp;b)
+{
+    if (a.elementCount != b.elementCount)
+    {
+        return false;
+    }
+
+    return std::equal(a.begin(), a.end(), b.begin());
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11InputLayoutCacheh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+//
+// 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.
+//
+
+// InputLayoutCache.h: Defines InputLayoutCache, a class that builds and caches
+// D3D11 input layouts.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
+
+#include &quot;libANGLE/Constants.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+
+#include &lt;cstddef&gt;
+#include &lt;unordered_map&gt;
+
+namespace gl
+{
+class Program;
+}
+
+namespace rx
+{
+struct TranslatedAttribute;
+
+class InputLayoutCache : angle::NonCopyable
+{
+  public:
+    InputLayoutCache();
+    virtual ~InputLayoutCache();
+
+    void initialize(ID3D11Device *device, ID3D11DeviceContext *context);
+    void clear();
+    void markDirty();
+
+    gl::Error applyVertexBuffers(TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS],
+                                 GLenum mode, gl::Program *program);
+
+  private:
+    struct InputLayoutElement
+    {
+        D3D11_INPUT_ELEMENT_DESC desc;
+        GLenum glslElementType;
+    };
+
+    struct InputLayoutKey
+    {
+        unsigned int elementCount;
+        InputLayoutElement elements[gl::MAX_VERTEX_ATTRIBS];
+
+        const char *begin() const
+        {
+            return reinterpret_cast&lt;const char*&gt;(&amp;elementCount);
+        }
+
+        const char *end() const
+        {
+            return reinterpret_cast&lt;const char*&gt;(&amp;elements[elementCount]);
+        }
+    };
+
+    struct InputLayoutCounterPair
+    {
+        ID3D11InputLayout *inputLayout;
+        unsigned long long lastUsedTime;
+    };
+
+    ID3D11InputLayout *mCurrentIL;
+    ID3D11Buffer *mCurrentBuffers[gl::MAX_VERTEX_ATTRIBS];
+    UINT mCurrentVertexStrides[gl::MAX_VERTEX_ATTRIBS];
+    UINT mCurrentVertexOffsets[gl::MAX_VERTEX_ATTRIBS];
+
+    ID3D11Buffer *mPointSpriteVertexBuffer;
+    ID3D11Buffer *mPointSpriteIndexBuffer;
+
+    static std::size_t hashInputLayout(const InputLayoutKey &amp;inputLayout);
+    static bool compareInputLayouts(const InputLayoutKey &amp;a, const InputLayoutKey &amp;b);
+
+    typedef std::size_t (*InputLayoutHashFunction)(const InputLayoutKey &amp;);
+    typedef bool (*InputLayoutEqualityFunction)(const InputLayoutKey &amp;, const InputLayoutKey &amp;);
+    typedef std::unordered_map&lt;InputLayoutKey,
+                               InputLayoutCounterPair,
+                               InputLayoutHashFunction,
+                               InputLayoutEqualityFunction&gt; InputLayoutMap;
+    InputLayoutMap mInputLayoutMap;
+
+    static const unsigned int kMaxInputLayouts;
+
+    unsigned long long mCounter;
+
+    ID3D11Device *mDevice;
+    ID3D11DeviceContext *mDeviceContext;
+    D3D_FEATURE_LEVEL mFeatureLevel;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_INPUTLAYOUTCACHE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11NativeWindowh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/NativeWindow.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/NativeWindow.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/NativeWindow.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// NativeWindow.h: Defines NativeWindow, a class for managing and
+// performing operations on an EGLNativeWindowType.
+// It is used for HWND (Desktop Windows) and IInspectable objects
+//(Windows Store Applications).
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW_H_
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/platform.h&quot;
+
+#include &lt;EGL/eglplatform.h&gt;
+
+// DXGISwapChain and DXGIFactory are typedef'd to specific required
+// types. The HWND NativeWindow implementation requires IDXGISwapChain
+// and IDXGIFactory and the Windows Store NativeWindow
+// implementation requires IDXGISwapChain1 and IDXGIFactory2.
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+typedef IDXGISwapChain1 DXGISwapChain;
+typedef IDXGIFactory2 DXGIFactory;
+
+#include &lt;wrl.h&gt;
+#include &lt;wrl/wrappers/corewrappers.h&gt;
+#include &lt;windows.applicationmodel.core.h&gt;
+#include &lt;memory&gt;
+
+namespace rx
+{
+class InspectableNativeWindow;
+}
+
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Wrappers;
+
+#else
+typedef IDXGISwapChain DXGISwapChain;
+typedef IDXGIFactory DXGIFactory;
+#endif
+
+namespace rx
+{
+
+class NativeWindow
+{
+  public:
+    explicit NativeWindow(EGLNativeWindowType window);
+
+    bool initialize();
+    bool getClientRect(LPRECT rect);
+    bool isIconic();
+    static bool isValidNativeWindow(EGLNativeWindowType window);
+
+    HRESULT createSwapChain(ID3D11Device* device, DXGIFactory* factory,
+                            DXGI_FORMAT format, UINT width, UINT height,
+                            DXGISwapChain** swapChain);
+
+    inline EGLNativeWindowType getNativeWindow() const { return mWindow; }
+
+  private:
+    EGLNativeWindowType mWindow;
+
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+    std::shared_ptr&lt;InspectableNativeWindow&gt; mImpl;
+#endif
+
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_NATIVEWINDOW_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11PixelTransfer11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,302 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// PixelTransfer11.cpp:
+//   Implementation for buffer-to-texture and texture-to-buffer copies.
+//   Used to implement pixel transfers from unpack and to pack buffers.
+//
+
+#include &quot;libANGLE/renderer/d3d/d3d11/PixelTransfer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Buffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/TextureStorage11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+
+// Precompiled shaders
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h&quot;
+
+namespace rx
+{
+
+PixelTransfer11::PixelTransfer11(Renderer11 *renderer)
+    : mRenderer(renderer),
+      mResourcesLoaded(false),
+      mBufferToTextureVS(NULL),
+      mBufferToTextureGS(NULL),
+      mParamsConstantBuffer(NULL),
+      mCopyRasterizerState(NULL),
+      mCopyDepthStencilState(NULL)
+{
+}
+
+PixelTransfer11::~PixelTransfer11()
+{
+    for (auto shaderMapIt = mBufferToTexturePSMap.begin(); shaderMapIt != mBufferToTexturePSMap.end(); shaderMapIt++)
+    {
+        SafeRelease(shaderMapIt-&gt;second);
+    }
+
+    mBufferToTexturePSMap.clear();
+
+    SafeRelease(mBufferToTextureVS);
+    SafeRelease(mBufferToTextureGS);
+    SafeRelease(mParamsConstantBuffer);
+    SafeRelease(mCopyRasterizerState);
+    SafeRelease(mCopyDepthStencilState);
+}
+
+gl::Error PixelTransfer11::loadResources()
+{
+    if (mResourcesLoaded)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    HRESULT result = S_OK;
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    D3D11_RASTERIZER_DESC rasterDesc;
+    rasterDesc.FillMode = D3D11_FILL_SOLID;
+    rasterDesc.CullMode = D3D11_CULL_NONE;
+    rasterDesc.FrontCounterClockwise = FALSE;
+    rasterDesc.DepthBias = 0;
+    rasterDesc.SlopeScaledDepthBias = 0.0f;
+    rasterDesc.DepthBiasClamp = 0.0f;
+    rasterDesc.DepthClipEnable = TRUE;
+    rasterDesc.ScissorEnable = FALSE;
+    rasterDesc.MultisampleEnable = FALSE;
+    rasterDesc.AntialiasedLineEnable = FALSE;
+
+    result = device-&gt;CreateRasterizerState(&amp;rasterDesc, &amp;mCopyRasterizerState);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal pixel transfer rasterizer state, result: 0x%X.&quot;, result);
+    }
+
+    D3D11_DEPTH_STENCIL_DESC depthStencilDesc;
+    depthStencilDesc.DepthEnable = true;
+    depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+    depthStencilDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+    depthStencilDesc.StencilEnable = FALSE;
+    depthStencilDesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+    depthStencilDesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+    depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+    depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+    depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+    result = device-&gt;CreateDepthStencilState(&amp;depthStencilDesc, &amp;mCopyDepthStencilState);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal pixel transfer depth stencil state, result: 0x%X.&quot;, result);
+    }
+
+    D3D11_BUFFER_DESC constantBufferDesc = { 0 };
+    constantBufferDesc.ByteWidth = roundUp&lt;UINT&gt;(sizeof(CopyShaderParams), 32u);
+    constantBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+    constantBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+    constantBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+    constantBufferDesc.MiscFlags = 0;
+    constantBufferDesc.StructureByteStride = 0;
+
+    result = device-&gt;CreateBuffer(&amp;constantBufferDesc, NULL, &amp;mParamsConstantBuffer);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal pixel transfer constant buffer, result: 0x%X.&quot;, result);
+    }
+    d3d11::SetDebugName(mParamsConstantBuffer, &quot;PixelTransfer11 constant buffer&quot;);
+
+    // init shaders
+    mBufferToTextureVS = d3d11::CompileVS(device, g_VS_BufferToTexture, &quot;BufferToTexture VS&quot;);
+    if (!mBufferToTextureVS)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal buffer to texture vertex shader.&quot;);
+    }
+
+    mBufferToTextureGS = d3d11::CompileGS(device, g_GS_BufferToTexture, &quot;BufferToTexture GS&quot;);
+    if (!mBufferToTextureGS)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal buffer to texture geometry shader.&quot;);
+    }
+
+    gl::Error error = buildShaderMap();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    StructZero(&amp;mParamsData);
+
+    mResourcesLoaded = true;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void PixelTransfer11::setBufferToTextureCopyParams(const gl::Box &amp;destArea, const gl::Extents &amp;destSize, GLenum internalFormat,
+                                                   const gl::PixelUnpackState &amp;unpack, unsigned int offset, CopyShaderParams *parametersOut)
+{
+    StructZero(parametersOut);
+
+    float texelCenterX = 0.5f / static_cast&lt;float&gt;(destSize.width - 1);
+    float texelCenterY = 0.5f / static_cast&lt;float&gt;(destSize.height - 1);
+
+    unsigned int bytesPerPixel = gl::GetInternalFormatInfo(internalFormat).pixelBytes;
+    unsigned int alignmentBytes = static_cast&lt;unsigned int&gt;(unpack.alignment);
+    unsigned int alignmentPixels = (alignmentBytes &lt;= bytesPerPixel ? 1 : alignmentBytes / bytesPerPixel);
+
+    parametersOut-&gt;FirstPixelOffset     = offset / bytesPerPixel;
+    parametersOut-&gt;PixelsPerRow         = static_cast&lt;unsigned int&gt;((unpack.rowLength &gt; 0) ? unpack.rowLength : destArea.width);
+    parametersOut-&gt;RowStride            = roundUp(parametersOut-&gt;PixelsPerRow, alignmentPixels);
+    parametersOut-&gt;RowsPerSlice         = static_cast&lt;unsigned int&gt;(destArea.height);
+    parametersOut-&gt;PositionOffset[0]    = texelCenterX + (destArea.x / float(destSize.width)) * 2.0f - 1.0f;
+    parametersOut-&gt;PositionOffset[1]    = texelCenterY + ((destSize.height - destArea.y - 1) / float(destSize.height)) * 2.0f - 1.0f;
+    parametersOut-&gt;PositionScale[0]     = 2.0f / static_cast&lt;float&gt;(destSize.width);
+    parametersOut-&gt;PositionScale[1]     = -2.0f / static_cast&lt;float&gt;(destSize.height);
+    parametersOut-&gt;FirstSlice           = destArea.z;
+}
+
+gl::Error PixelTransfer11::copyBufferToTexture(const gl::PixelUnpackState &amp;unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+                                               GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &amp;destArea)
+{
+    gl::Error error = loadResources();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    gl::Extents destSize = destRenderTarget-&gt;getExtents();
+
+    ASSERT(destArea.x &gt;= 0 &amp;&amp; destArea.x + destArea.width  &lt;= destSize.width  &amp;&amp;
+           destArea.y &gt;= 0 &amp;&amp; destArea.y + destArea.height &lt;= destSize.height &amp;&amp;
+           destArea.z &gt;= 0 &amp;&amp; destArea.z + destArea.depth  &lt;= destSize.depth  );
+
+    const gl::Buffer &amp;sourceBuffer = *unpack.pixelBuffer.get();
+
+    ASSERT(mRenderer-&gt;supportsFastCopyBufferToTexture(destinationFormat));
+
+    ID3D11PixelShader *pixelShader = findBufferToTexturePS(destinationFormat);
+    ASSERT(pixelShader);
+
+    // The SRV must be in the proper read format, which may be different from the destination format
+    // EG: for half float data, we can load full precision floats with implicit conversion
+    GLenum unsizedFormat = gl::GetInternalFormatInfo(destinationFormat).format;
+    GLenum sourceFormat = gl::GetSizedInternalFormat(unsizedFormat, sourcePixelsType);
+
+    const d3d11::TextureFormat &amp;sourceFormatInfo = d3d11::GetTextureFormatInfo(sourceFormat, mRenderer-&gt;getFeatureLevel());
+    DXGI_FORMAT srvFormat = sourceFormatInfo.srvFormat;
+    ASSERT(srvFormat != DXGI_FORMAT_UNKNOWN);
+    Buffer11 *bufferStorage11 = GetAs&lt;Buffer11&gt;(sourceBuffer.getImplementation());
+    ID3D11ShaderResourceView *bufferSRV = bufferStorage11-&gt;getSRV(srvFormat);
+    ASSERT(bufferSRV != NULL);
+
+    ID3D11RenderTargetView *textureRTV = GetAs&lt;RenderTarget11&gt;(destRenderTarget)-&gt;getRenderTargetView();
+    ASSERT(textureRTV != NULL);
+
+    CopyShaderParams shaderParams;
+    setBufferToTextureCopyParams(destArea, destSize, sourceFormat, unpack, offset, &amp;shaderParams);
+
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+    ID3D11Buffer *nullBuffer = NULL;
+    UINT zero = 0;
+
+    // Are we doing a 2D or 3D copy?
+    ID3D11GeometryShader *geometryShader = ((destSize.depth &gt; 1) ? mBufferToTextureGS : NULL);
+
+    deviceContext-&gt;VSSetShader(mBufferToTextureVS, NULL, 0);
+    deviceContext-&gt;GSSetShader(geometryShader, NULL, 0);
+    deviceContext-&gt;PSSetShader(pixelShader, NULL, 0);
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, bufferSRV);
+    deviceContext-&gt;IASetInputLayout(NULL);
+    deviceContext-&gt;IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
+
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;nullBuffer, &amp;zero, &amp;zero);
+    deviceContext-&gt;OMSetBlendState(NULL, NULL, 0xFFFFFFF);
+    deviceContext-&gt;OMSetDepthStencilState(mCopyDepthStencilState, 0xFFFFFFFF);
+    deviceContext-&gt;RSSetState(mCopyRasterizerState);
+
+    mRenderer-&gt;setOneTimeRenderTarget(textureRTV);
+
+    if (!StructEquals(mParamsData, shaderParams))
+    {
+        d3d11::SetBufferData(deviceContext, mParamsConstantBuffer, shaderParams);
+        mParamsData = shaderParams;
+    }
+
+    deviceContext-&gt;VSSetConstantBuffers(0, 1, &amp;mParamsConstantBuffer);
+
+    // Set the viewport
+    D3D11_VIEWPORT viewport;
+    viewport.TopLeftX = 0;
+    viewport.TopLeftY = 0;
+    viewport.Width = static_cast&lt;FLOAT&gt;(destSize.width);
+    viewport.Height = static_cast&lt;FLOAT&gt;(destSize.height);
+    viewport.MinDepth = 0.0f;
+    viewport.MaxDepth = 1.0f;
+    deviceContext-&gt;RSSetViewports(1, &amp;viewport);
+
+    UINT numPixels = (destArea.width * destArea.height * destArea.depth);
+    deviceContext-&gt;Draw(numPixels, 0);
+
+    // Unbind textures and render targets and vertex buffer
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+    deviceContext-&gt;VSSetConstantBuffers(0, 1, &amp;nullBuffer);
+
+    mRenderer-&gt;markAllStateDirty();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error PixelTransfer11::buildShaderMap()
+{
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    mBufferToTexturePSMap[GL_FLOAT]        = d3d11::CompilePS(device, g_PS_BufferToTexture_4F,  &quot;BufferToTexture RGBA ps&quot;);
+    mBufferToTexturePSMap[GL_INT]          = d3d11::CompilePS(device, g_PS_BufferToTexture_4I,  &quot;BufferToTexture RGBA-I ps&quot;);
+    mBufferToTexturePSMap[GL_UNSIGNED_INT] = d3d11::CompilePS(device, g_PS_BufferToTexture_4UI, &quot;BufferToTexture RGBA-UI ps&quot;);
+
+    // Check that all the shaders were created successfully
+    for (auto shaderMapIt = mBufferToTexturePSMap.begin(); shaderMapIt != mBufferToTexturePSMap.end(); shaderMapIt++)
+    {
+        if (shaderMapIt-&gt;second == NULL)
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal buffer to texture pixel shader.&quot;);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+ID3D11PixelShader *PixelTransfer11::findBufferToTexturePS(GLenum internalFormat) const
+{
+    GLenum componentType = gl::GetInternalFormatInfo(internalFormat).componentType;
+    if (componentType == GL_SIGNED_NORMALIZED || componentType == GL_UNSIGNED_NORMALIZED)
+    {
+        componentType = GL_FLOAT;
+    }
+
+    auto shaderMapIt = mBufferToTexturePSMap.find(componentType);
+    return (shaderMapIt == mBufferToTexturePSMap.end() ? NULL : shaderMapIt-&gt;second);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11PixelTransfer11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// PixelTransfer11.h:
+//   Buffer-to-Texture and Texture-to-Buffer data transfers.
+//   Used to implement pixel unpack and pixel pack buffers in ES3.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_PIXELTRANSFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_PIXELTRANSFER11_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/platform.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+
+#include &lt;map&gt;
+
+namespace gl
+{
+
+class Buffer;
+struct Box;
+struct Extents;
+struct PixelUnpackState;
+
+}
+
+namespace rx
+{
+class Renderer11;
+class RenderTargetD3D;
+
+class PixelTransfer11
+{
+  public:
+    explicit PixelTransfer11(Renderer11 *renderer);
+    ~PixelTransfer11();
+
+    // unpack: the source buffer is stored in the unpack state, and buffer strides
+    // offset: the start of the data within the unpack buffer
+    // destRenderTarget: individual slice/layer of a target texture
+    // destinationFormat/sourcePixelsType: determines shaders + shader parameters
+    // destArea: the sub-section of destRenderTarget to copy to
+    gl::Error copyBufferToTexture(const gl::PixelUnpackState &amp;unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+                                  GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &amp;destArea);
+
+  private:
+
+    struct CopyShaderParams
+    {
+        unsigned int FirstPixelOffset;
+        unsigned int PixelsPerRow;
+        unsigned int RowStride;
+        unsigned int RowsPerSlice;
+        float PositionOffset[2];
+        float PositionScale[2];
+        int TexLocationOffset[2];
+        int TexLocationScale[2];
+        unsigned int FirstSlice;
+    };
+
+    static void setBufferToTextureCopyParams(const gl::Box &amp;destArea, const gl::Extents &amp;destSize, GLenum internalFormat,
+                                             const gl::PixelUnpackState &amp;unpack, unsigned int offset, CopyShaderParams *parametersOut);
+
+    gl::Error loadResources();
+    gl::Error buildShaderMap();
+    ID3D11PixelShader *findBufferToTexturePS(GLenum internalFormat) const;
+
+    Renderer11 *mRenderer;
+
+    bool mResourcesLoaded;
+    std::map&lt;GLenum, ID3D11PixelShader *&gt; mBufferToTexturePSMap;
+    ID3D11VertexShader *mBufferToTextureVS;
+    ID3D11GeometryShader *mBufferToTextureGS;
+    ID3D11Buffer *mParamsConstantBuffer;
+    CopyShaderParams mParamsData;
+
+    ID3D11RasterizerState *mCopyRasterizerState;
+    ID3D11DepthStencilState *mCopyDepthStencilState;
+
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_PIXELTRANSFER11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Query11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,157 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Query11.cpp: Defines the rx::Query11 class which implements rx::QueryImpl.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Query11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;common/utilities.h&quot;
+
+#include &lt;GLES2/gl2ext.h&gt;
+
+namespace rx
+{
+
+Query11::Query11(Renderer11 *renderer, GLenum type)
+    : QueryImpl(type),
+      mResult(0),
+      mQueryFinished(false),
+      mRenderer(renderer),
+      mQuery(NULL)
+{
+}
+
+Query11::~Query11()
+{
+    SafeRelease(mQuery);
+}
+
+gl::Error Query11::begin()
+{
+    if (mQuery == NULL)
+    {
+        D3D11_QUERY_DESC queryDesc;
+        queryDesc.Query = gl_d3d11::ConvertQueryType(getType());
+        queryDesc.MiscFlags = 0;
+
+        HRESULT result = mRenderer-&gt;getDevice()-&gt;CreateQuery(&amp;queryDesc, &amp;mQuery);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal query creation failed, result: 0x%X.&quot;, result);
+        }
+    }
+
+    mRenderer-&gt;getDeviceContext()-&gt;Begin(mQuery);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query11::end()
+{
+    ASSERT(mQuery);
+    mRenderer-&gt;getDeviceContext()-&gt;End(mQuery);
+
+    mQueryFinished = false;
+    mResult = GL_FALSE;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query11::getResult(GLuint *params)
+{
+    while (!mQueryFinished)
+    {
+        gl::Error error = testQuery();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (!mQueryFinished)
+        {
+            ScheduleYield();
+        }
+    }
+
+    ASSERT(mQueryFinished);
+    *params = mResult;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query11::isResultAvailable(GLuint *available)
+{
+    gl::Error error = testQuery();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    *available = (mQueryFinished ? GL_TRUE : GL_FALSE);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query11::testQuery()
+{
+    if (!mQueryFinished)
+    {
+        ASSERT(mQuery);
+
+        ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+        switch (getType())
+        {
+          case GL_ANY_SAMPLES_PASSED_EXT:
+          case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+            {
+                UINT64 numPixels = 0;
+                HRESULT result = context-&gt;GetData(mQuery, &amp;numPixels, sizeof(numPixels), 0);
+                if (FAILED(result))
+                {
+                    return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get the data of an internal query, result: 0x%X.&quot;, result);
+                }
+
+                if (result == S_OK)
+                {
+                    mQueryFinished = true;
+                    mResult = (numPixels &gt; 0) ? GL_TRUE : GL_FALSE;
+                }
+            }
+            break;
+
+          case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+            {
+                D3D11_QUERY_DATA_SO_STATISTICS soStats = { 0 };
+                HRESULT result = context-&gt;GetData(mQuery, &amp;soStats, sizeof(soStats), 0);
+                if (FAILED(result))
+                {
+                    return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get the data of an internal query, result: 0x%X.&quot;, result);
+                }
+
+                if (result == S_OK)
+                {
+                    mQueryFinished = true;
+                    mResult = static_cast&lt;GLuint&gt;(soStats.NumPrimitivesWritten);
+                }
+            }
+            break;
+
+        default:
+            UNREACHABLE();
+            break;
+        }
+
+        if (!mQueryFinished &amp;&amp; mRenderer-&gt;testDeviceLost())
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to test get query result, device is lost.&quot;);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Query11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Query11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Query11.h: Defines the rx::Query11 class which implements rx::QueryImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_
+
+#include &quot;libANGLE/renderer/QueryImpl.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+class Query11 : public QueryImpl
+{
+  public:
+    Query11(Renderer11 *renderer, GLenum type);
+    virtual ~Query11();
+
+    virtual gl::Error begin();
+    virtual gl::Error end();
+    virtual gl::Error getResult(GLuint *params);
+    virtual gl::Error isResultAvailable(GLuint *available);
+
+  private:
+    gl::Error testQuery();
+
+    GLuint mResult;
+
+    bool mQueryFinished;
+
+    Renderer11 *mRenderer;
+    ID3D11Query *mQuery;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_QUERY11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderStateCachecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,452 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// RenderStateCache.cpp: Defines rx::RenderStateCache, a cache of Direct3D render
+// state objects.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderStateCache.h&quot;
+
+#include &lt;float.h&gt;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;third_party/murmurhash/MurmurHash3.h&quot;
+
+namespace rx
+{
+
+template &lt;typename mapType&gt;
+static void ClearStateMap(mapType &amp;map)
+{
+    for (typename mapType::iterator i = map.begin(); i != map.end(); i++)
+    {
+        SafeRelease(i-&gt;second.first);
+    }
+    map.clear();
+}
+
+// MSDN's documentation of ID3D11Device::CreateBlendState, ID3D11Device::CreateRasterizerState,
+// ID3D11Device::CreateDepthStencilState and ID3D11Device::CreateSamplerState claims the maximum
+// number of unique states of each type an application can create is 4096
+const unsigned int RenderStateCache::kMaxBlendStates = 4096;
+const unsigned int RenderStateCache::kMaxRasterizerStates = 4096;
+const unsigned int RenderStateCache::kMaxDepthStencilStates = 4096;
+const unsigned int RenderStateCache::kMaxSamplerStates = 4096;
+
+RenderStateCache::RenderStateCache(Renderer11 *renderer)
+    : mRenderer(renderer),
+      mDevice(NULL),
+      mCounter(0),
+      mBlendStateCache(kMaxBlendStates, hashBlendState, compareBlendStates),
+      mRasterizerStateCache(kMaxRasterizerStates, hashRasterizerState, compareRasterizerStates),
+      mDepthStencilStateCache(kMaxDepthStencilStates, hashDepthStencilState, compareDepthStencilStates),
+      mSamplerStateCache(kMaxSamplerStates, hashSamplerState, compareSamplerStates)
+{
+}
+
+RenderStateCache::~RenderStateCache()
+{
+    clear();
+}
+
+void RenderStateCache::initialize(ID3D11Device *device)
+{
+    clear();
+    mDevice = device;
+}
+
+void RenderStateCache::clear()
+{
+    ClearStateMap(mBlendStateCache);
+    ClearStateMap(mRasterizerStateCache);
+    ClearStateMap(mDepthStencilStateCache);
+    ClearStateMap(mSamplerStateCache);
+}
+
+std::size_t RenderStateCache::hashBlendState(const BlendStateKey &amp;blendState)
+{
+    static const unsigned int seed = 0xABCDEF98;
+
+    std::size_t hash = 0;
+    MurmurHash3_x86_32(&amp;blendState, sizeof(gl::BlendState), seed, &amp;hash);
+    return hash;
+}
+
+bool RenderStateCache::compareBlendStates(const BlendStateKey &amp;a, const BlendStateKey &amp;b)
+{
+    return memcmp(&amp;a, &amp;b, sizeof(BlendStateKey)) == 0;
+}
+
+gl::Error RenderStateCache::getBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &amp;blendState,
+                                          ID3D11BlendState **outBlendState)
+{
+    if (!mDevice)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal error, RenderStateCache is not initialized.&quot;);
+    }
+
+    bool mrt = false;
+
+    const FramebufferD3D *framebufferD3D = GetImplAs&lt;FramebufferD3D&gt;(framebuffer);
+    const gl::AttachmentList &amp;colorbuffers = framebufferD3D-&gt;getColorAttachmentsForRender(mRenderer-&gt;getWorkarounds());
+
+    BlendStateKey key = { 0 };
+    key.blendState = blendState;
+    for (size_t colorAttachment = 0; colorAttachment &lt; colorbuffers.size(); ++colorAttachment)
+    {
+        const gl::FramebufferAttachment *attachment = colorbuffers[colorAttachment];
+
+        auto rtChannels = key.rtChannels[colorAttachment];
+
+        if (attachment)
+        {
+            if (colorAttachment &gt; 0)
+            {
+                mrt = true;
+            }
+
+            rtChannels[0] = attachment-&gt;getRedSize()   &gt; 0;
+            rtChannels[1] = attachment-&gt;getGreenSize() &gt; 0;
+            rtChannels[2] = attachment-&gt;getBlueSize()  &gt; 0;
+            rtChannels[3] = attachment-&gt;getAlphaSize() &gt; 0;
+        }
+    }
+
+    BlendStateMap::iterator keyIter = mBlendStateCache.find(key);
+    if (keyIter != mBlendStateCache.end())
+    {
+        BlendStateCounterPair &amp;state = keyIter-&gt;second;
+        state.second = mCounter++;
+        *outBlendState = state.first;
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        if (mBlendStateCache.size() &gt;= kMaxBlendStates)
+        {
+            TRACE(&quot;Overflowed the limit of %u blend states, removing the least recently used &quot;
+                  &quot;to make room.&quot;, kMaxBlendStates);
+
+            BlendStateMap::iterator leastRecentlyUsed = mBlendStateCache.begin();
+            for (BlendStateMap::iterator i = mBlendStateCache.begin(); i != mBlendStateCache.end(); i++)
+            {
+                if (i-&gt;second.second &lt; leastRecentlyUsed-&gt;second.second)
+                {
+                    leastRecentlyUsed = i;
+                }
+            }
+            SafeRelease(leastRecentlyUsed-&gt;second.first);
+            mBlendStateCache.erase(leastRecentlyUsed);
+        }
+
+        // Create a new blend state and insert it into the cache
+        D3D11_BLEND_DESC blendDesc = { 0 };
+        blendDesc.AlphaToCoverageEnable = blendState.sampleAlphaToCoverage;
+        blendDesc.IndependentBlendEnable = mrt ? TRUE : FALSE;
+
+        for (unsigned int i = 0; i &lt; D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
+        {
+            D3D11_RENDER_TARGET_BLEND_DESC &amp;rtBlend = blendDesc.RenderTarget[i];
+
+            rtBlend.BlendEnable = blendState.blend;
+            if (blendState.blend)
+            {
+                rtBlend.SrcBlend = gl_d3d11::ConvertBlendFunc(blendState.sourceBlendRGB, false);
+                rtBlend.DestBlend = gl_d3d11::ConvertBlendFunc(blendState.destBlendRGB, false);
+                rtBlend.BlendOp = gl_d3d11::ConvertBlendOp(blendState.blendEquationRGB);
+
+                rtBlend.SrcBlendAlpha = gl_d3d11::ConvertBlendFunc(blendState.sourceBlendAlpha, true);
+                rtBlend.DestBlendAlpha = gl_d3d11::ConvertBlendFunc(blendState.destBlendAlpha, true);
+                rtBlend.BlendOpAlpha = gl_d3d11::ConvertBlendOp(blendState.blendEquationAlpha);
+            }
+
+            rtBlend.RenderTargetWriteMask = gl_d3d11::ConvertColorMask(key.rtChannels[i][0] &amp;&amp; blendState.colorMaskRed,
+                                                                       key.rtChannels[i][1] &amp;&amp; blendState.colorMaskGreen,
+                                                                       key.rtChannels[i][2] &amp;&amp; blendState.colorMaskBlue,
+                                                                       key.rtChannels[i][3] &amp;&amp; blendState.colorMaskAlpha);
+        }
+
+        ID3D11BlendState *dx11BlendState = NULL;
+        HRESULT result = mDevice-&gt;CreateBlendState(&amp;blendDesc, &amp;dx11BlendState);
+        if (FAILED(result) || !dx11BlendState)
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Unable to create a ID3D11BlendState, HRESULT: 0x%X.&quot;, result);
+        }
+
+        mBlendStateCache.insert(std::make_pair(key, std::make_pair(dx11BlendState, mCounter++)));
+
+        *outBlendState = dx11BlendState;
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+std::size_t RenderStateCache::hashRasterizerState(const RasterizerStateKey &amp;rasterState)
+{
+    static const unsigned int seed = 0xABCDEF98;
+
+    std::size_t hash = 0;
+    MurmurHash3_x86_32(&amp;rasterState, sizeof(RasterizerStateKey), seed, &amp;hash);
+    return hash;
+}
+
+bool RenderStateCache::compareRasterizerStates(const RasterizerStateKey &amp;a, const RasterizerStateKey &amp;b)
+{
+    return memcmp(&amp;a, &amp;b, sizeof(RasterizerStateKey)) == 0;
+}
+
+gl::Error RenderStateCache::getRasterizerState(const gl::RasterizerState &amp;rasterState, bool scissorEnabled,
+                                               ID3D11RasterizerState **outRasterizerState)
+{
+    if (!mDevice)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal error, RenderStateCache is not initialized.&quot;);
+    }
+
+    RasterizerStateKey key = { 0 };
+    key.rasterizerState = rasterState;
+    key.scissorEnabled = scissorEnabled;
+
+    RasterizerStateMap::iterator keyIter = mRasterizerStateCache.find(key);
+    if (keyIter != mRasterizerStateCache.end())
+    {
+        RasterizerStateCounterPair &amp;state = keyIter-&gt;second;
+        state.second = mCounter++;
+        *outRasterizerState = state.first;
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        if (mRasterizerStateCache.size() &gt;= kMaxRasterizerStates)
+        {
+            TRACE(&quot;Overflowed the limit of %u rasterizer states, removing the least recently used &quot;
+                  &quot;to make room.&quot;, kMaxRasterizerStates);
+
+            RasterizerStateMap::iterator leastRecentlyUsed = mRasterizerStateCache.begin();
+            for (RasterizerStateMap::iterator i = mRasterizerStateCache.begin(); i != mRasterizerStateCache.end(); i++)
+            {
+                if (i-&gt;second.second &lt; leastRecentlyUsed-&gt;second.second)
+                {
+                    leastRecentlyUsed = i;
+                }
+            }
+            SafeRelease(leastRecentlyUsed-&gt;second.first);
+            mRasterizerStateCache.erase(leastRecentlyUsed);
+        }
+
+        D3D11_CULL_MODE cullMode = gl_d3d11::ConvertCullMode(rasterState.cullFace, rasterState.cullMode);
+
+        // Disable culling if drawing points
+        if (rasterState.pointDrawMode)
+        {
+            cullMode = D3D11_CULL_NONE;
+        }
+
+        D3D11_RASTERIZER_DESC rasterDesc;
+        rasterDesc.FillMode = D3D11_FILL_SOLID;
+        rasterDesc.CullMode = cullMode;
+        rasterDesc.FrontCounterClockwise = (rasterState.frontFace == GL_CCW) ? FALSE: TRUE;
+        rasterDesc.DepthBiasClamp = 0.0f; // MSDN documentation of DepthBiasClamp implies a value of zero will preform no clamping, must be tested though.
+        rasterDesc.DepthClipEnable = TRUE;
+        rasterDesc.ScissorEnable = scissorEnabled ? TRUE : FALSE;
+        rasterDesc.MultisampleEnable = rasterState.multiSample;
+        rasterDesc.AntialiasedLineEnable = FALSE;
+
+        if (rasterState.polygonOffsetFill)
+        {
+            rasterDesc.SlopeScaledDepthBias = rasterState.polygonOffsetFactor;
+            rasterDesc.DepthBias = (INT)rasterState.polygonOffsetUnits;
+        }
+        else
+        {
+            rasterDesc.SlopeScaledDepthBias = 0.0f;
+            rasterDesc.DepthBias = 0;
+        }
+
+        ID3D11RasterizerState *dx11RasterizerState = NULL;
+        HRESULT result = mDevice-&gt;CreateRasterizerState(&amp;rasterDesc, &amp;dx11RasterizerState);
+        if (FAILED(result) || !dx11RasterizerState)
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Unable to create a ID3D11RasterizerState, HRESULT: 0x%X.&quot;, result);
+        }
+
+        mRasterizerStateCache.insert(std::make_pair(key, std::make_pair(dx11RasterizerState, mCounter++)));
+
+        *outRasterizerState = dx11RasterizerState;
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+std::size_t RenderStateCache::hashDepthStencilState(const gl::DepthStencilState &amp;dsState)
+{
+    static const unsigned int seed = 0xABCDEF98;
+
+    std::size_t hash = 0;
+    MurmurHash3_x86_32(&amp;dsState, sizeof(gl::DepthStencilState), seed, &amp;hash);
+    return hash;
+}
+
+bool RenderStateCache::compareDepthStencilStates(const gl::DepthStencilState &amp;a, const gl::DepthStencilState &amp;b)
+{
+    return memcmp(&amp;a, &amp;b, sizeof(gl::DepthStencilState)) == 0;
+}
+
+gl::Error RenderStateCache::getDepthStencilState(const gl::DepthStencilState &amp;dsState, ID3D11DepthStencilState **outDSState)
+{
+    if (!mDevice)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal error, RenderStateCache is not initialized.&quot;);
+    }
+
+    DepthStencilStateMap::iterator keyIter = mDepthStencilStateCache.find(dsState);
+    if (keyIter != mDepthStencilStateCache.end())
+    {
+        DepthStencilStateCounterPair &amp;state = keyIter-&gt;second;
+        state.second = mCounter++;
+        *outDSState = state.first;
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        if (mDepthStencilStateCache.size() &gt;= kMaxDepthStencilStates)
+        {
+            TRACE(&quot;Overflowed the limit of %u depth stencil states, removing the least recently used &quot;
+                  &quot;to make room.&quot;, kMaxDepthStencilStates);
+
+            DepthStencilStateMap::iterator leastRecentlyUsed = mDepthStencilStateCache.begin();
+            for (DepthStencilStateMap::iterator i = mDepthStencilStateCache.begin(); i != mDepthStencilStateCache.end(); i++)
+            {
+                if (i-&gt;second.second &lt; leastRecentlyUsed-&gt;second.second)
+                {
+                    leastRecentlyUsed = i;
+                }
+            }
+            SafeRelease(leastRecentlyUsed-&gt;second.first);
+            mDepthStencilStateCache.erase(leastRecentlyUsed);
+        }
+
+        D3D11_DEPTH_STENCIL_DESC dsDesc = { 0 };
+        dsDesc.DepthEnable = dsState.depthTest ? TRUE : FALSE;
+        dsDesc.DepthWriteMask = gl_d3d11::ConvertDepthMask(dsState.depthMask);
+        dsDesc.DepthFunc = gl_d3d11::ConvertComparison(dsState.depthFunc);
+        dsDesc.StencilEnable = dsState.stencilTest ? TRUE : FALSE;
+        dsDesc.StencilReadMask = gl_d3d11::ConvertStencilMask(dsState.stencilMask);
+        dsDesc.StencilWriteMask = gl_d3d11::ConvertStencilMask(dsState.stencilWritemask);
+        dsDesc.FrontFace.StencilFailOp = gl_d3d11::ConvertStencilOp(dsState.stencilFail);
+        dsDesc.FrontFace.StencilDepthFailOp = gl_d3d11::ConvertStencilOp(dsState.stencilPassDepthFail);
+        dsDesc.FrontFace.StencilPassOp = gl_d3d11::ConvertStencilOp(dsState.stencilPassDepthPass);
+        dsDesc.FrontFace.StencilFunc = gl_d3d11::ConvertComparison(dsState.stencilFunc);
+        dsDesc.BackFace.StencilFailOp = gl_d3d11::ConvertStencilOp(dsState.stencilBackFail);
+        dsDesc.BackFace.StencilDepthFailOp = gl_d3d11::ConvertStencilOp(dsState.stencilBackPassDepthFail);
+        dsDesc.BackFace.StencilPassOp = gl_d3d11::ConvertStencilOp(dsState.stencilBackPassDepthPass);
+        dsDesc.BackFace.StencilFunc = gl_d3d11::ConvertComparison(dsState.stencilBackFunc);
+
+        ID3D11DepthStencilState *dx11DepthStencilState = NULL;
+        HRESULT result = mDevice-&gt;CreateDepthStencilState(&amp;dsDesc, &amp;dx11DepthStencilState);
+        if (FAILED(result) || !dx11DepthStencilState)
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Unable to create a ID3D11DepthStencilState, HRESULT: 0x%X.&quot;, result);
+        }
+
+        mDepthStencilStateCache.insert(std::make_pair(dsState, std::make_pair(dx11DepthStencilState, mCounter++)));
+
+        *outDSState = dx11DepthStencilState;
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+std::size_t RenderStateCache::hashSamplerState(const gl::SamplerState &amp;samplerState)
+{
+    static const unsigned int seed = 0xABCDEF98;
+
+    std::size_t hash = 0;
+    MurmurHash3_x86_32(&amp;samplerState, sizeof(gl::SamplerState), seed, &amp;hash);
+    return hash;
+}
+
+bool RenderStateCache::compareSamplerStates(const gl::SamplerState &amp;a, const gl::SamplerState &amp;b)
+{
+    return memcmp(&amp;a, &amp;b, sizeof(gl::SamplerState)) == 0;
+}
+
+gl::Error RenderStateCache::getSamplerState(const gl::SamplerState &amp;samplerState, ID3D11SamplerState **outSamplerState)
+{
+    if (!mDevice)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal error, RenderStateCache is not initialized.&quot;);
+    }
+
+    SamplerStateMap::iterator keyIter = mSamplerStateCache.find(samplerState);
+    if (keyIter != mSamplerStateCache.end())
+    {
+        SamplerStateCounterPair &amp;state = keyIter-&gt;second;
+        state.second = mCounter++;
+        *outSamplerState = state.first;
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        if (mSamplerStateCache.size() &gt;= kMaxSamplerStates)
+        {
+            TRACE(&quot;Overflowed the limit of %u sampler states, removing the least recently used &quot;
+                  &quot;to make room.&quot;, kMaxSamplerStates);
+
+            SamplerStateMap::iterator leastRecentlyUsed = mSamplerStateCache.begin();
+            for (SamplerStateMap::iterator i = mSamplerStateCache.begin(); i != mSamplerStateCache.end(); i++)
+            {
+                if (i-&gt;second.second &lt; leastRecentlyUsed-&gt;second.second)
+                {
+                    leastRecentlyUsed = i;
+                }
+            }
+            SafeRelease(leastRecentlyUsed-&gt;second.first);
+            mSamplerStateCache.erase(leastRecentlyUsed);
+        }
+
+        D3D11_SAMPLER_DESC samplerDesc;
+        samplerDesc.Filter = gl_d3d11::ConvertFilter(samplerState.minFilter, samplerState.magFilter,
+                                                     samplerState.maxAnisotropy, samplerState.compareMode);
+        samplerDesc.AddressU = gl_d3d11::ConvertTextureWrap(samplerState.wrapS);
+        samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT);
+        samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR);
+        samplerDesc.MipLODBias = 0;
+        samplerDesc.MaxAnisotropy = static_cast&lt;UINT&gt;(samplerState.maxAnisotropy);
+        samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.compareFunc);
+        samplerDesc.BorderColor[0] = 0.0f;
+        samplerDesc.BorderColor[1] = 0.0f;
+        samplerDesc.BorderColor[2] = 0.0f;
+        samplerDesc.BorderColor[3] = 0.0f;
+        samplerDesc.MinLOD = samplerState.minLod;
+        samplerDesc.MaxLOD = samplerState.maxLod;
+
+        if (mRenderer-&gt;getFeatureLevel() &lt;= D3D_FEATURE_LEVEL_9_3)
+        {
+            // Check that maxLOD is nearly FLT_MAX (1000.0f is the default), since 9_3 doesn't support anything other than FLT_MAX.
+            // Note that Feature Level 9_* only supports GL ES 2.0, so the consumer of ANGLE can't modify the Max LOD themselves.
+            ASSERT(samplerState.maxLod &gt;= 999.9f);
+
+            // Now just set MaxLOD to FLT_MAX. Other parts of the renderer (e.g. the non-zero max LOD workaround) should take account of this.
+            samplerDesc.MaxLOD = FLT_MAX;
+        }
+
+        ID3D11SamplerState *dx11SamplerState = NULL;
+        HRESULT result = mDevice-&gt;CreateSamplerState(&amp;samplerDesc, &amp;dx11SamplerState);
+        if (FAILED(result) || !dx11SamplerState)
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Unable to create a ID3D11SamplerState, HRESULT: 0x%X.&quot;, result);
+        }
+
+        mSamplerStateCache.insert(std::make_pair(samplerState, std::make_pair(dx11SamplerState, mCounter++)));
+
+        *outSamplerState = dx11SamplerState;
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderStateCacheh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,111 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// RenderStateCache.h: Defines rx::RenderStateCache, a cache of Direct3D render
+// state objects.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERSTATECACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERSTATECACHE_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;common/angleutils.h&quot;
+
+#include &lt;unordered_map&gt;
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace rx
+{
+class Renderer11;
+
+class RenderStateCache : angle::NonCopyable
+{
+  public:
+    RenderStateCache(Renderer11 *renderer);
+    virtual ~RenderStateCache();
+
+    void initialize(ID3D11Device *device);
+    void clear();
+
+    gl::Error getBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &amp;blendState, ID3D11BlendState **outBlendState);
+    gl::Error getRasterizerState(const gl::RasterizerState &amp;rasterState, bool scissorEnabled, ID3D11RasterizerState **outRasterizerState);
+    gl::Error getDepthStencilState(const gl::DepthStencilState &amp;dsState, ID3D11DepthStencilState **outDSState);
+    gl::Error getSamplerState(const gl::SamplerState &amp;samplerState, ID3D11SamplerState **outSamplerState);
+
+  private:
+    Renderer11 *mRenderer;
+    unsigned long long mCounter;
+
+    // Blend state cache
+    struct BlendStateKey
+    {
+        gl::BlendState blendState;
+        bool rtChannels[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT][4];
+    };
+    static std::size_t hashBlendState(const BlendStateKey &amp;blendState);
+    static bool compareBlendStates(const BlendStateKey &amp;a, const BlendStateKey &amp;b);
+    static const unsigned int kMaxBlendStates;
+
+    typedef std::size_t (*BlendStateHashFunction)(const BlendStateKey &amp;);
+    typedef bool (*BlendStateEqualityFunction)(const BlendStateKey &amp;, const BlendStateKey &amp;);
+    typedef std::pair&lt;ID3D11BlendState*, unsigned long long&gt; BlendStateCounterPair;
+    typedef std::unordered_map&lt;BlendStateKey, BlendStateCounterPair, BlendStateHashFunction, BlendStateEqualityFunction&gt; BlendStateMap;
+    BlendStateMap mBlendStateCache;
+
+    // Rasterizer state cache
+    struct RasterizerStateKey
+    {
+        gl::RasterizerState rasterizerState;
+        bool scissorEnabled;
+    };
+    static std::size_t hashRasterizerState(const RasterizerStateKey &amp;rasterState);
+    static bool compareRasterizerStates(const RasterizerStateKey &amp;a, const RasterizerStateKey &amp;b);
+    static const unsigned int kMaxRasterizerStates;
+
+    typedef std::size_t (*RasterizerStateHashFunction)(const RasterizerStateKey &amp;);
+    typedef bool (*RasterizerStateEqualityFunction)(const RasterizerStateKey &amp;, const RasterizerStateKey &amp;);
+    typedef std::pair&lt;ID3D11RasterizerState*, unsigned long long&gt; RasterizerStateCounterPair;
+    typedef std::unordered_map&lt;RasterizerStateKey, RasterizerStateCounterPair, RasterizerStateHashFunction, RasterizerStateEqualityFunction&gt; RasterizerStateMap;
+    RasterizerStateMap mRasterizerStateCache;
+
+    // Depth stencil state cache
+    static std::size_t hashDepthStencilState(const gl::DepthStencilState &amp;dsState);
+    static bool compareDepthStencilStates(const gl::DepthStencilState &amp;a, const gl::DepthStencilState &amp;b);
+    static const unsigned int kMaxDepthStencilStates;
+
+    typedef std::size_t (*DepthStencilStateHashFunction)(const gl::DepthStencilState &amp;);
+    typedef bool (*DepthStencilStateEqualityFunction)(const gl::DepthStencilState &amp;, const gl::DepthStencilState &amp;);
+    typedef std::pair&lt;ID3D11DepthStencilState*, unsigned long long&gt; DepthStencilStateCounterPair;
+    typedef std::unordered_map&lt;gl::DepthStencilState,
+                               DepthStencilStateCounterPair,
+                               DepthStencilStateHashFunction,
+                               DepthStencilStateEqualityFunction&gt; DepthStencilStateMap;
+    DepthStencilStateMap mDepthStencilStateCache;
+
+    // Sample state cache
+    static std::size_t hashSamplerState(const gl::SamplerState &amp;samplerState);
+    static bool compareSamplerStates(const gl::SamplerState &amp;a, const gl::SamplerState &amp;b);
+    static const unsigned int kMaxSamplerStates;
+
+    typedef std::size_t (*SamplerStateHashFunction)(const gl::SamplerState &amp;);
+    typedef bool (*SamplerStateEqualityFunction)(const gl::SamplerState &amp;, const gl::SamplerState &amp;);
+    typedef std::pair&lt;ID3D11SamplerState*, unsigned long long&gt; SamplerStateCounterPair;
+    typedef std::unordered_map&lt;gl::SamplerState,
+                               SamplerStateCounterPair,
+                               SamplerStateHashFunction,
+                               SamplerStateEqualityFunction&gt; SamplerStateMap;
+    SamplerStateMap mSamplerStateCache;
+
+    ID3D11Device *mDevice;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERSTATECACHE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderTarget11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,388 @@
</span><ins>+//
+// 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.
+//
+
+// RenderTarget11.cpp: Implements a DX11-specific wrapper for ID3D11View pointers
+// retained by Renderbuffers.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/SwapChain11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+
+namespace rx
+{
+
+static bool getTextureProperties(ID3D11Resource *resource, unsigned int *mipLevels, unsigned int *samples)
+{
+    ID3D11Texture1D *texture1D = d3d11::DynamicCastComObject&lt;ID3D11Texture1D&gt;(resource);
+    if (texture1D)
+    {
+        D3D11_TEXTURE1D_DESC texDesc;
+        texture1D-&gt;GetDesc(&amp;texDesc);
+        SafeRelease(texture1D);
+
+        *mipLevels = texDesc.MipLevels;
+        *samples = 0;
+
+        return true;
+    }
+
+    ID3D11Texture2D *texture2D = d3d11::DynamicCastComObject&lt;ID3D11Texture2D&gt;(resource);
+    if (texture2D)
+    {
+        D3D11_TEXTURE2D_DESC texDesc;
+        texture2D-&gt;GetDesc(&amp;texDesc);
+        SafeRelease(texture2D);
+
+        *mipLevels = texDesc.MipLevels;
+        *samples = texDesc.SampleDesc.Count &gt; 1 ? texDesc.SampleDesc.Count : 0;
+
+        return true;
+    }
+
+    ID3D11Texture3D *texture3D = d3d11::DynamicCastComObject&lt;ID3D11Texture3D&gt;(resource);
+    if (texture3D)
+    {
+        D3D11_TEXTURE3D_DESC texDesc;
+        texture3D-&gt;GetDesc(&amp;texDesc);
+        SafeRelease(texture3D);
+
+        *mipLevels = texDesc.MipLevels;
+        *samples = 0;
+
+        return true;
+    }
+
+    return false;
+}
+
+static unsigned int getRTVSubresourceIndex(ID3D11Resource *resource, ID3D11RenderTargetView *view)
+{
+    D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+    view-&gt;GetDesc(&amp;rtvDesc);
+
+    unsigned int mipSlice = 0;
+    unsigned int arraySlice = 0;
+
+    switch (rtvDesc.ViewDimension)
+    {
+      case D3D11_RTV_DIMENSION_TEXTURE1D:
+        mipSlice = rtvDesc.Texture1D.MipSlice;
+        arraySlice = 0;
+        break;
+
+      case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
+        mipSlice = rtvDesc.Texture1DArray.MipSlice;
+        arraySlice = rtvDesc.Texture1DArray.FirstArraySlice;
+        break;
+
+      case D3D11_RTV_DIMENSION_TEXTURE2D:
+        mipSlice = rtvDesc.Texture2D.MipSlice;
+        arraySlice = 0;
+        break;
+
+      case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
+        mipSlice = rtvDesc.Texture2DArray.MipSlice;
+        arraySlice = rtvDesc.Texture2DArray.FirstArraySlice;
+        break;
+
+      case D3D11_RTV_DIMENSION_TEXTURE2DMS:
+        mipSlice = 0;
+        arraySlice = 0;
+        break;
+
+      case D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY:
+        mipSlice = 0;
+        arraySlice = rtvDesc.Texture2DMSArray.FirstArraySlice;
+        break;
+
+      case D3D11_RTV_DIMENSION_TEXTURE3D:
+        mipSlice = rtvDesc.Texture3D.MipSlice;
+        arraySlice = 0;
+        break;
+
+      case D3D11_RTV_DIMENSION_UNKNOWN:
+      case D3D11_RTV_DIMENSION_BUFFER:
+        UNIMPLEMENTED();
+        break;
+
+      default:
+        UNREACHABLE();
+        break;
+    }
+
+    unsigned int mipLevels, samples;
+    getTextureProperties(resource,  &amp;mipLevels, &amp;samples);
+
+    return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
+}
+
+static unsigned int getDSVSubresourceIndex(ID3D11Resource *resource, ID3D11DepthStencilView *view)
+{
+    D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+    view-&gt;GetDesc(&amp;dsvDesc);
+
+    unsigned int mipSlice = 0;
+    unsigned int arraySlice = 0;
+
+    switch (dsvDesc.ViewDimension)
+    {
+      case D3D11_DSV_DIMENSION_TEXTURE1D:
+        mipSlice = dsvDesc.Texture1D.MipSlice;
+        arraySlice = 0;
+        break;
+
+      case D3D11_DSV_DIMENSION_TEXTURE1DARRAY:
+        mipSlice = dsvDesc.Texture1DArray.MipSlice;
+        arraySlice = dsvDesc.Texture1DArray.FirstArraySlice;
+        break;
+
+      case D3D11_DSV_DIMENSION_TEXTURE2D:
+        mipSlice = dsvDesc.Texture2D.MipSlice;
+        arraySlice = 0;
+        break;
+
+      case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
+        mipSlice = dsvDesc.Texture2DArray.MipSlice;
+        arraySlice = dsvDesc.Texture2DArray.FirstArraySlice;
+        break;
+
+      case D3D11_DSV_DIMENSION_TEXTURE2DMS:
+        mipSlice = 0;
+        arraySlice = 0;
+        break;
+
+      case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
+        mipSlice = 0;
+        arraySlice = dsvDesc.Texture2DMSArray.FirstArraySlice;
+        break;
+
+      case D3D11_DSV_DIMENSION_UNKNOWN:
+        UNIMPLEMENTED();
+        break;
+
+      default:
+        UNREACHABLE();
+        break;
+    }
+
+    unsigned int mipLevels, samples;
+    getTextureProperties(resource, &amp;mipLevels, &amp;samples);
+
+    return D3D11CalcSubresource(mipSlice, arraySlice, mipLevels);
+}
+
+TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv,
+                                             GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei samples)
+    : mWidth(width),
+      mHeight(height),
+      mDepth(depth),
+      mInternalFormat(internalFormat),
+      mDXGIFormat(DXGI_FORMAT_UNKNOWN),
+      mSamples(samples),
+      mSubresourceIndex(0),
+      mTexture(resource),
+      mRenderTarget(rtv),
+      mDepthStencil(NULL),
+      mShaderResource(srv)
+{
+    if (mTexture)
+    {
+        mTexture-&gt;AddRef();
+    }
+
+    if (mRenderTarget)
+    {
+        mRenderTarget-&gt;AddRef();
+    }
+
+    if (mShaderResource)
+    {
+        mShaderResource-&gt;AddRef();
+    }
+
+    if (mRenderTarget &amp;&amp; mTexture)
+    {
+        mSubresourceIndex = getRTVSubresourceIndex(mTexture, mRenderTarget);
+
+        D3D11_RENDER_TARGET_VIEW_DESC desc;
+        mRenderTarget-&gt;GetDesc(&amp;desc);
+        mDXGIFormat = desc.Format;
+    }
+}
+
+TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv,
+                                             GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei samples)
+    : mWidth(width),
+      mHeight(height),
+      mDepth(depth),
+      mInternalFormat(internalFormat),
+      mDXGIFormat(DXGI_FORMAT_UNKNOWN),
+      mSamples(samples),
+      mSubresourceIndex(0),
+      mTexture(resource),
+      mRenderTarget(NULL),
+      mDepthStencil(dsv),
+      mShaderResource(srv)
+{
+    if (mTexture)
+    {
+        mTexture-&gt;AddRef();
+    }
+
+    if (mDepthStencil)
+    {
+        mDepthStencil-&gt;AddRef();
+    }
+
+    if (mShaderResource)
+    {
+        mShaderResource-&gt;AddRef();
+    }
+
+    if (mDepthStencil &amp;&amp; mTexture)
+    {
+        mSubresourceIndex = getDSVSubresourceIndex(mTexture, mDepthStencil);
+
+        D3D11_DEPTH_STENCIL_VIEW_DESC desc;
+        mDepthStencil-&gt;GetDesc(&amp;desc);
+        mDXGIFormat = desc.Format;
+    }
+}
+
+TextureRenderTarget11::~TextureRenderTarget11()
+{
+    SafeRelease(mTexture);
+    SafeRelease(mRenderTarget);
+    SafeRelease(mDepthStencil);
+    SafeRelease(mShaderResource);
+}
+
+ID3D11Resource *TextureRenderTarget11::getTexture() const
+{
+    return mTexture;
+}
+
+ID3D11RenderTargetView *TextureRenderTarget11::getRenderTargetView() const
+{
+    return mRenderTarget;
+}
+
+ID3D11DepthStencilView *TextureRenderTarget11::getDepthStencilView() const
+{
+    return mDepthStencil;
+}
+
+ID3D11ShaderResourceView *TextureRenderTarget11::getShaderResourceView() const
+{
+    return mShaderResource;
+}
+
+GLsizei TextureRenderTarget11::getWidth() const
+{
+    return mWidth;
+}
+
+GLsizei TextureRenderTarget11::getHeight() const
+{
+    return mHeight;
+}
+
+GLsizei TextureRenderTarget11::getDepth() const
+{
+    return mDepth;
+}
+
+GLenum TextureRenderTarget11::getInternalFormat() const
+{
+    return mInternalFormat;
+}
+
+GLsizei TextureRenderTarget11::getSamples() const
+{
+    return mSamples;
+}
+
+unsigned int TextureRenderTarget11::getSubresourceIndex() const
+{
+    return mSubresourceIndex;
+}
+
+DXGI_FORMAT TextureRenderTarget11::getDXGIFormat() const
+{
+    return mDXGIFormat;
+}
+
+SurfaceRenderTarget11::SurfaceRenderTarget11(SwapChain11 *swapChain, Renderer11 *renderer, bool depth)
+    : mSwapChain(swapChain),
+      mRenderer(renderer),
+      mDepth(depth)
+{
+    ASSERT(mSwapChain);
+}
+
+SurfaceRenderTarget11::~SurfaceRenderTarget11()
+{
+}
+
+GLsizei SurfaceRenderTarget11::getWidth() const
+{
+    return mSwapChain-&gt;getWidth();
+}
+
+GLsizei SurfaceRenderTarget11::getHeight() const
+{
+    return mSwapChain-&gt;getHeight();
+}
+
+GLsizei SurfaceRenderTarget11::getDepth() const
+{
+    return 1;
+}
+
+GLenum SurfaceRenderTarget11::getInternalFormat() const
+{
+    return (mDepth ? mSwapChain-&gt;GetDepthBufferInternalFormat() : mSwapChain-&gt;GetBackBufferInternalFormat());
+}
+
+GLsizei SurfaceRenderTarget11::getSamples() const
+{
+    // Our EGL surfaces do not support multisampling.
+    return 0;
+}
+
+ID3D11Resource *SurfaceRenderTarget11::getTexture() const
+{
+    return (mDepth ? mSwapChain-&gt;getDepthStencilTexture() : mSwapChain-&gt;getOffscreenTexture());
+}
+
+ID3D11RenderTargetView *SurfaceRenderTarget11::getRenderTargetView() const
+{
+    return (mDepth ? NULL : mSwapChain-&gt;getRenderTarget());
+}
+
+ID3D11DepthStencilView *SurfaceRenderTarget11::getDepthStencilView() const
+{
+    return (mDepth ? mSwapChain-&gt;getDepthStencil() : NULL);
+}
+
+ID3D11ShaderResourceView *SurfaceRenderTarget11::getShaderResourceView() const
+{
+    return (mDepth ? mSwapChain-&gt;getDepthStencilShaderResource() : mSwapChain-&gt;getRenderTargetShaderResource());
+}
+
+unsigned int SurfaceRenderTarget11::getSubresourceIndex() const
+{
+    return 0;
+}
+
+DXGI_FORMAT SurfaceRenderTarget11::getDXGIFormat() const
+{
+    return d3d11::GetTextureFormatInfo(getInternalFormat(), mRenderer-&gt;getFeatureLevel()).texFormat;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11RenderTarget11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,108 @@
</span><ins>+//
+// 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.
+//
+
+// RenderTarget11.h: Defines a DX11-specific wrapper for ID3D11View pointers
+// retained by Renderbuffers.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERTARGET11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERTARGET11_H_
+
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+
+namespace rx
+{
+class SwapChain11;
+class Renderer11;
+
+class RenderTarget11 : public RenderTargetD3D
+{
+  public:
+    RenderTarget11() { }
+    virtual ~RenderTarget11() { }
+
+    virtual ID3D11Resource *getTexture() const = 0;
+    virtual ID3D11RenderTargetView *getRenderTargetView() const = 0;
+    virtual ID3D11DepthStencilView *getDepthStencilView() const = 0;
+    virtual ID3D11ShaderResourceView *getShaderResourceView() const = 0;
+
+    virtual unsigned int getSubresourceIndex() const = 0;
+
+    virtual DXGI_FORMAT getDXGIFormat() const = 0;
+
+  private:
+    D3D_FEATURE_LEVEL mFeatureLevel;
+};
+
+class TextureRenderTarget11 : public RenderTarget11
+{
+  public:
+    // TextureRenderTarget11 takes ownership of any D3D11 resources it is given and will AddRef them
+    TextureRenderTarget11(ID3D11RenderTargetView *rtv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv,
+                           GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei samples);
+    TextureRenderTarget11(ID3D11DepthStencilView *dsv, ID3D11Resource *resource, ID3D11ShaderResourceView *srv,
+                           GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei samples);
+    virtual ~TextureRenderTarget11();
+
+    GLsizei getWidth() const override;
+    GLsizei getHeight() const override;
+    GLsizei getDepth() const override;
+    GLenum getInternalFormat() const override;
+    GLsizei getSamples() const override;
+
+    ID3D11Resource *getTexture() const override;
+    ID3D11RenderTargetView *getRenderTargetView() const override;
+    ID3D11DepthStencilView *getDepthStencilView() const override;
+    ID3D11ShaderResourceView *getShaderResourceView() const override;
+
+    unsigned int getSubresourceIndex() const override;
+
+    DXGI_FORMAT getDXGIFormat() const override;
+
+  private:
+    GLsizei mWidth;
+    GLsizei mHeight;
+    GLsizei mDepth;
+    GLenum mInternalFormat;
+    DXGI_FORMAT mDXGIFormat;
+    GLsizei mSamples;
+
+    unsigned int mSubresourceIndex;
+    ID3D11Resource *mTexture;
+    ID3D11RenderTargetView *mRenderTarget;
+    ID3D11DepthStencilView *mDepthStencil;
+    ID3D11ShaderResourceView *mShaderResource;
+};
+
+class SurfaceRenderTarget11 : public RenderTarget11
+{
+  public:
+    SurfaceRenderTarget11(SwapChain11 *swapChain, Renderer11 *renderer, bool depth);
+    virtual ~SurfaceRenderTarget11();
+
+    GLsizei getWidth() const override;
+    GLsizei getHeight() const override;
+    GLsizei getDepth() const override;
+    GLenum getInternalFormat() const override;
+    GLsizei getSamples() const override;
+
+    ID3D11Resource *getTexture() const override;
+    ID3D11RenderTargetView *getRenderTargetView() const override;
+    ID3D11DepthStencilView *getDepthStencilView() const override;
+    ID3D11ShaderResourceView *getShaderResourceView() const override;
+
+    unsigned int getSubresourceIndex() const override;
+
+    DXGI_FORMAT getDXGIFormat() const override;
+
+  private:
+    SwapChain11 *mSwapChain;
+    Renderer11 *mRenderer;
+    bool mDepth;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERTARGET11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Renderer11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,3614 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// Renderer11.cpp: Implements a back-end specific class for the D3D11 renderer.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+
+#include &lt;sstream&gt;
+#include &lt;EGL/eglext.h&gt;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;common/tls.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/State.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/histogram_macros.h&quot;
+#include &quot;libANGLE/renderer/d3d/CompilerD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/IndexDataManager.h&quot;
+#include &quot;libANGLE/renderer/d3d/ProgramD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderbufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/ShaderD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SurfaceD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/TransformFeedbackD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/VertexDataManager.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Blit11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Buffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Clear11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Fence11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Framebuffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Image11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/IndexBuffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/PixelTransfer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Query11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/SwapChain11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/TextureStorage11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Trim11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/VertexArray11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/VertexBuffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;third_party/trace_event/trace_event.h&quot;
+
+// Enable ANGLE_SKIP_DXGI_1_2_CHECK if there is not a possibility of using cross-process
+// HWNDs or the Windows 7 Platform Update (KB2670838) is expected to be installed.
+#ifndef ANGLE_SKIP_DXGI_1_2_CHECK
+#define ANGLE_SKIP_DXGI_1_2_CHECK 0
+#endif
+
+#ifdef _DEBUG
+// this flag enables suppressing some spurious warnings that pop up in certain WebGL samples
+// and conformance tests. to enable all warnings, remove this define.
+#define ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS 1
+#endif
+
+namespace rx
+{
+
+namespace
+{
+
+enum
+{
+    MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16
+};
+
+// dirtyPointer is a special value that will make the comparison with any valid pointer fail and force the renderer to re-apply the state.
+static const uintptr_t DirtyPointer = static_cast&lt;uintptr_t&gt;(-1);
+
+static bool ImageIndexConflictsWithSRV(const gl::ImageIndex &amp;index, D3D11_SHADER_RESOURCE_VIEW_DESC desc)
+{
+    unsigned mipLevel = index.mipIndex;
+    unsigned layerIndex = index.layerIndex;
+    GLenum type = index.type;
+
+    switch (desc.ViewDimension)
+    {
+      case D3D11_SRV_DIMENSION_TEXTURE2D:
+        {
+            unsigned maxSrvMip = desc.Texture2D.MipLevels + desc.Texture2D.MostDetailedMip;
+            maxSrvMip = (desc.Texture2D.MipLevels == -1) ? INT_MAX : maxSrvMip;
+
+            unsigned mipMin = index.mipIndex;
+            unsigned mipMax = (layerIndex == -1) ? INT_MAX : layerIndex;
+
+            return type == GL_TEXTURE_2D &amp;&amp; RangeUI(mipMin, mipMax).intersects(RangeUI(desc.Texture2D.MostDetailedMip, maxSrvMip));
+        }
+
+      case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
+        {
+            unsigned maxSrvMip = desc.Texture2DArray.MipLevels + desc.Texture2DArray.MostDetailedMip;
+            maxSrvMip = (desc.Texture2DArray.MipLevels == -1) ? INT_MAX : maxSrvMip;
+
+            unsigned maxSlice = desc.Texture2DArray.FirstArraySlice + desc.Texture2DArray.ArraySize;
+
+            // Cube maps can be mapped to Texture2DArray SRVs
+            return (type == GL_TEXTURE_2D_ARRAY || gl::IsCubeMapTextureTarget(type)) &amp;&amp;
+                   desc.Texture2DArray.MostDetailedMip &lt;= mipLevel &amp;&amp; mipLevel &lt; maxSrvMip &amp;&amp;
+                   desc.Texture2DArray.FirstArraySlice &lt;= layerIndex &amp;&amp; layerIndex &lt; maxSlice;
+        }
+
+      case D3D11_SRV_DIMENSION_TEXTURECUBE:
+        {
+            unsigned maxSrvMip = desc.TextureCube.MipLevels + desc.TextureCube.MostDetailedMip;
+            maxSrvMip = (desc.TextureCube.MipLevels == -1) ? INT_MAX : maxSrvMip;
+
+            return gl::IsCubeMapTextureTarget(type) &amp;&amp;
+                   desc.TextureCube.MostDetailedMip &lt;= mipLevel &amp;&amp; mipLevel &lt; maxSrvMip;
+        }
+
+      case D3D11_SRV_DIMENSION_TEXTURE3D:
+        {
+            unsigned maxSrvMip = desc.Texture3D.MipLevels + desc.Texture3D.MostDetailedMip;
+            maxSrvMip = (desc.Texture3D.MipLevels == -1) ? INT_MAX : maxSrvMip;
+
+            return type == GL_TEXTURE_3D &amp;&amp;
+                   desc.Texture3D.MostDetailedMip &lt;= mipLevel &amp;&amp; mipLevel &lt; maxSrvMip;
+        }
+      default:
+        // We only handle the cases corresponding to valid image indexes
+        UNIMPLEMENTED();
+    }
+
+    return false;
+}
+
+// Does *not* increment the resource ref count!!
+ID3D11Resource *GetViewResource(ID3D11View *view)
+{
+    ID3D11Resource *resource = NULL;
+    ASSERT(view);
+    view-&gt;GetResource(&amp;resource);
+    resource-&gt;Release();
+    return resource;
+}
+
+void CalculateConstantBufferParams(GLintptr offset, GLsizeiptr size, UINT *outFirstConstant, UINT *outNumConstants)
+{
+    // The offset must be aligned to 256 bytes (should have been enforced by glBindBufferRange).
+    ASSERT(offset % 256 == 0);
+
+    // firstConstant and numConstants are expressed in constants of 16-bytes. Furthermore they must be a multiple of 16 constants.
+    *outFirstConstant = static_cast&lt;UINT&gt;(offset / 16);
+
+    // The GL size is not required to be aligned to a 256 bytes boundary.
+    // Round the size up to a 256 bytes boundary then express the results in constants of 16-bytes.
+    *outNumConstants = static_cast&lt;UINT&gt;(rx::roundUp(size, static_cast&lt;GLsizeiptr&gt;(256)) / 16);
+
+    // Since the size is rounded up, firstConstant + numConstants may be bigger than the actual size of the buffer.
+    // This behaviour is explictly allowed according to the documentation on ID3D11DeviceContext1::PSSetConstantBuffers1
+    // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx
+}
+
+egl::Error GenerateD3D11CreateDeviceErr(HRESULT errorCode)
+{
+    return egl::Error(EGL_NOT_INITIALIZED, errorCode, &quot;Could not create D3D11 device.&quot;);
+}
+
+}
+
+Renderer11::Renderer11(egl::Display *display)
+    : RendererD3D(display),
+      mStateCache(this),
+      mDebug(nullptr)
+{
+    // Initialize global annotator
+    gl::InitializeDebugAnnotations(&amp;mAnnotator);
+
+    mVertexDataManager = NULL;
+    mIndexDataManager = NULL;
+
+    mLineLoopIB = NULL;
+    mTriangleFanIB = NULL;
+
+    mBlit = NULL;
+    mPixelTransfer = NULL;
+
+    mClear = NULL;
+
+    mTrim = NULL;
+
+    mSyncQuery = NULL;
+
+    mSupportsConstantBufferOffsets = false;
+
+    mD3d11Module = NULL;
+    mDxgiModule = NULL;
+
+    mDevice = NULL;
+    mDeviceContext = NULL;
+    mDeviceContext1 = NULL;
+    mDxgiAdapter = NULL;
+    mDxgiFactory = NULL;
+
+    mDriverConstantBufferVS = NULL;
+    mDriverConstantBufferPS = NULL;
+
+    mAppliedVertexShader = NULL;
+    mAppliedGeometryShader = NULL;
+    mAppliedPixelShader = NULL;
+
+    mAppliedNumXFBBindings = static_cast&lt;size_t&gt;(-1);
+
+    const auto &amp;attributes = mDisplay-&gt;getAttributeMap();
+
+    EGLint requestedMajorVersion = attributes.get(EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, EGL_DONT_CARE);
+    EGLint requestedMinorVersion = attributes.get(EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, EGL_DONT_CARE);
+
+    if (requestedMajorVersion == EGL_DONT_CARE || requestedMajorVersion &gt;= 11)
+    {
+        if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion &gt;= 0)
+        {
+            mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_11_0);
+        }
+    }
+
+    if (requestedMajorVersion == EGL_DONT_CARE || requestedMajorVersion &gt;= 10)
+    {
+        if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion &gt;= 1)
+        {
+            mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_10_1);
+        }
+        if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion &gt;= 0)
+        {
+            mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_10_0);
+        }
+    }
+
+    if (requestedMajorVersion == 9 &amp;&amp; requestedMinorVersion == 3)
+    {
+        mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+    }
+
+    EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
+                                                EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+    switch (requestedDeviceType)
+    {
+      case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
+        mDriverType = D3D_DRIVER_TYPE_HARDWARE;
+        break;
+
+      case EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE:
+        mDriverType = D3D_DRIVER_TYPE_WARP;
+        break;
+
+      case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
+        mDriverType = D3D_DRIVER_TYPE_REFERENCE;
+        break;
+
+      case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
+        mDriverType = D3D_DRIVER_TYPE_NULL;
+        break;
+
+      default:
+        UNREACHABLE();
+    }
+}
+
+Renderer11::~Renderer11()
+{
+    release();
+
+    gl::UninitializeDebugAnnotations();
+}
+
+#ifndef __d3d11_1_h__
+#define D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET ((D3D11_MESSAGE_ID)3146081)
+#endif
+
+egl::Error Renderer11::initialize()
+{
+    if (!mCompiler.initialize())
+    {
+        return egl::Error(EGL_NOT_INITIALIZED,
+                          D3D11_INIT_COMPILER_ERROR,
+                          &quot;Failed to initialize compiler.&quot;);
+    }
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = nullptr;
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Renderer11::initialize (Load DLLs)&quot;);
+        mDxgiModule = LoadLibrary(TEXT(&quot;dxgi.dll&quot;));
+        mD3d11Module = LoadLibrary(TEXT(&quot;d3d11.dll&quot;));
+
+        if (mD3d11Module == nullptr || mDxgiModule == nullptr)
+        {
+            return egl::Error(EGL_NOT_INITIALIZED,
+                              D3D11_INIT_MISSING_DEP,
+                              &quot;Could not load D3D11 or DXGI library.&quot;);
+        }
+
+        // create the D3D11 device
+        ASSERT(mDevice == nullptr);
+        D3D11CreateDevice = reinterpret_cast&lt;PFN_D3D11_CREATE_DEVICE&gt;(GetProcAddress(mD3d11Module, &quot;D3D11CreateDevice&quot;));
+
+        if (D3D11CreateDevice == nullptr)
+        {
+            return egl::Error(EGL_NOT_INITIALIZED,
+                              D3D11_INIT_MISSING_DEP,
+                              &quot;Could not retrieve D3D11CreateDevice address.&quot;);
+        }
+    }
+#endif
+
+    HRESULT result = S_OK;
+#ifdef _DEBUG
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;D3D11CreateDevice (Debug)&quot;);
+        result = D3D11CreateDevice(NULL,
+                                   mDriverType,
+                                   NULL,
+                                   D3D11_CREATE_DEVICE_DEBUG,
+                                   mAvailableFeatureLevels.data(),
+                                   mAvailableFeatureLevels.size(),
+                                   D3D11_SDK_VERSION,
+                                   &amp;mDevice,
+                                   &amp;mFeatureLevel,
+                                   &amp;mDeviceContext);
+    }
+
+    if (!mDevice || FAILED(result))
+    {
+        ERR(&quot;Failed creating Debug D3D11 device - falling back to release runtime.\n&quot;);
+    }
+
+    if (!mDevice || FAILED(result))
+#endif
+    {
+        double createDeviceBegin = ANGLEPlatformCurrent()-&gt;currentTime();
+
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;D3D11CreateDevice&quot;);
+        result = D3D11CreateDevice(NULL,
+                                   mDriverType,
+                                   NULL,
+                                   0,
+                                   mAvailableFeatureLevels.data(),
+                                   mAvailableFeatureLevels.size(),
+                                   D3D11_SDK_VERSION,
+                                   &amp;mDevice,
+                                   &amp;mFeatureLevel,
+                                   &amp;mDeviceContext);
+
+        // Cleanup done by destructor
+        if (FAILED(result))
+        {
+            // Most likely error codes, see
+            // https://msdn.microsoft.com/en-us/library/windows/desktop/ff476082%28v=vs.85%29.aspx
+            // And https://msdn.microsoft.com/en-us/library/windows/desktop/ff476174(v=vs.85).aspx
+            switch (result)
+            {
+              case E_INVALIDARG:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_INVALIDARG);
+              case E_FAIL:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_FAIL);
+              case E_NOTIMPL:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_NOTIMPL);
+              case E_OUTOFMEMORY:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_OUTOFMEMORY);
+              case DXGI_ERROR_INVALID_CALL:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_INVALIDCALL);
+              case DXGI_ERROR_SDK_COMPONENT_MISSING:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_COMPONENTMISSING);
+              case DXGI_ERROR_WAS_STILL_DRAWING:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_WASSTILLDRAWING);
+              case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_NOTAVAILABLE);
+              case DXGI_ERROR_DEVICE_HUNG:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_DEVICEHUNG);
+              default:
+                return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_ERROR);
+            }
+        }
+
+        if (!mDevice)
+        {
+            return GenerateD3D11CreateDeviceErr(D3D11_INIT_CREATEDEVICE_NULL);
+        }
+
+        double createDeviceSec = ANGLEPlatformCurrent()-&gt;currentTime() - createDeviceBegin;
+        int createDeviceMS = static_cast&lt;int&gt;(createDeviceSec * 1000);
+        ANGLE_HISTOGRAM_TIMES(&quot;GPU.ANGLE.D3D11CreateDeviceMS&quot;, createDeviceMS);
+    }
+
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Renderer11::initialize (ComQueries)&quot;);
+        // Cast the DeviceContext to a DeviceContext1.
+        // This could fail on Windows 7 without the Platform Update.
+        // Don't error in this case- just don't use mDeviceContext1.
+        mDeviceContext1 = d3d11::DynamicCastComObject&lt;ID3D11DeviceContext1&gt;(mDeviceContext);
+
+        IDXGIDevice *dxgiDevice = NULL;
+        result = mDevice-&gt;QueryInterface(__uuidof(IDXGIDevice), (void**)&amp;dxgiDevice);
+
+        if (FAILED(result))
+        {
+            return egl::Error(EGL_NOT_INITIALIZED,
+                              D3D11_INIT_OTHER_ERROR,
+                              &quot;Could not query DXGI device.&quot;);
+        }
+
+        result = dxgiDevice-&gt;GetParent(__uuidof(IDXGIAdapter), (void**)&amp;mDxgiAdapter);
+
+        if (FAILED(result))
+        {
+            return egl::Error(EGL_NOT_INITIALIZED,
+                              D3D11_INIT_OTHER_ERROR,
+                              &quot;Could not retrieve DXGI adapter&quot;);
+        }
+
+        SafeRelease(dxgiDevice);
+
+        IDXGIAdapter2 *dxgiAdapter2 = d3d11::DynamicCastComObject&lt;IDXGIAdapter2&gt;(mDxgiAdapter);
+
+        // On D3D_FEATURE_LEVEL_9_*, IDXGIAdapter::GetDesc returns &quot;Software Adapter&quot; for the description string.
+        // If DXGI1.2 is available then IDXGIAdapter2::GetDesc2 can be used to get the actual hardware values.
+        if (mFeatureLevel &lt;= D3D_FEATURE_LEVEL_9_3 &amp;&amp; dxgiAdapter2 != NULL)
+        {
+            DXGI_ADAPTER_DESC2 adapterDesc2 = { 0 };
+            dxgiAdapter2-&gt;GetDesc2(&amp;adapterDesc2);
+
+            // Copy the contents of the DXGI_ADAPTER_DESC2 into mAdapterDescription (a DXGI_ADAPTER_DESC).
+            memcpy(mAdapterDescription.Description, adapterDesc2.Description, sizeof(mAdapterDescription.Description));
+            mAdapterDescription.VendorId = adapterDesc2.VendorId;
+            mAdapterDescription.DeviceId = adapterDesc2.DeviceId;
+            mAdapterDescription.SubSysId = adapterDesc2.SubSysId;
+            mAdapterDescription.Revision = adapterDesc2.Revision;
+            mAdapterDescription.DedicatedVideoMemory = adapterDesc2.DedicatedVideoMemory;
+            mAdapterDescription.DedicatedSystemMemory = adapterDesc2.DedicatedSystemMemory;
+            mAdapterDescription.SharedSystemMemory = adapterDesc2.SharedSystemMemory;
+            mAdapterDescription.AdapterLuid = adapterDesc2.AdapterLuid;
+        }
+        else
+        {
+            mDxgiAdapter-&gt;GetDesc(&amp;mAdapterDescription);
+        }
+
+        SafeRelease(dxgiAdapter2);
+
+        memset(mDescription, 0, sizeof(mDescription));
+        wcstombs(mDescription, mAdapterDescription.Description, sizeof(mDescription) - 1);
+
+        result = mDxgiAdapter-&gt;GetParent(__uuidof(IDXGIFactory), (void**)&amp;mDxgiFactory);
+
+        if (!mDxgiFactory || FAILED(result))
+        {
+            return egl::Error(EGL_NOT_INITIALIZED,
+                              D3D11_INIT_OTHER_ERROR,
+                              &quot;Could not create DXGI factory.&quot;);
+        }
+    }
+
+    // Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
+#if defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) &amp;&amp; defined(_DEBUG)
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Renderer11::initialize (HideWarnings)&quot;);
+        ID3D11InfoQueue *infoQueue;
+        result = mDevice-&gt;QueryInterface(__uuidof(ID3D11InfoQueue), (void **)&amp;infoQueue);
+
+        if (SUCCEEDED(result))
+        {
+            D3D11_MESSAGE_ID hideMessages[] =
+            {
+                D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET
+            };
+
+            D3D11_INFO_QUEUE_FILTER filter = { 0 };
+            filter.DenyList.NumIDs = ArraySize(hideMessages);
+            filter.DenyList.pIDList = hideMessages;
+
+            infoQueue-&gt;AddStorageFilterEntries(&amp;filter);
+            SafeRelease(infoQueue);
+        }
+    }
+#endif
+
+#if !defined(NDEBUG)
+    mDebug = d3d11::DynamicCastComObject&lt;ID3D11Debug&gt;(mDevice);
+#endif
+
+    initializeDevice();
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+// 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 Renderer11::initializeDevice()
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Renderer11::initializeDevice&quot;);
+
+    mStateCache.initialize(mDevice);
+    mInputLayoutCache.initialize(mDevice, mDeviceContext);
+
+    ASSERT(!mVertexDataManager &amp;&amp; !mIndexDataManager);
+    mVertexDataManager = new VertexDataManager(this);
+    mIndexDataManager = new IndexDataManager(this, getRendererClass());
+
+    ASSERT(!mBlit);
+    mBlit = new Blit11(this);
+
+    ASSERT(!mClear);
+    mClear = new Clear11(this);
+
+    const auto &amp;attributes = mDisplay-&gt;getAttributeMap();
+    // If automatic trim is enabled, DXGIDevice3::Trim( ) is called for the application
+    // automatically when an application is suspended by the OS. This feature is currently
+    // only supported for Windows Store applications.
+    EGLint enableAutoTrim = attributes.get(EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_FALSE);
+
+    if (enableAutoTrim == EGL_TRUE)
+    {
+        ASSERT(!mTrim);
+        mTrim = new Trim11(this);
+    }
+
+    ASSERT(!mPixelTransfer);
+    mPixelTransfer = new PixelTransfer11(this);
+
+    const gl::Caps &amp;rendererCaps = getRendererCaps();
+
+    if (getDeviceContext1IfSupported())
+    {
+        D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11Options;
+        mDevice-&gt;CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &amp;d3d11Options, sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS));
+        mSupportsConstantBufferOffsets = (d3d11Options.ConstantBufferOffsetting != FALSE);
+    }
+
+    mForceSetVertexSamplerStates.resize(rendererCaps.maxVertexTextureImageUnits);
+    mCurVertexSamplerStates.resize(rendererCaps.maxVertexTextureImageUnits);
+
+    mForceSetPixelSamplerStates.resize(rendererCaps.maxTextureImageUnits);
+    mCurPixelSamplerStates.resize(rendererCaps.maxTextureImageUnits);
+
+    mCurVertexSRVs.resize(rendererCaps.maxVertexTextureImageUnits);
+    mCurPixelSRVs.resize(rendererCaps.maxTextureImageUnits);
+
+    markAllStateDirty();
+}
+
+egl::ConfigSet Renderer11::generateConfigs() const
+{
+    static const GLenum colorBufferFormats[] =
+    {
+        GL_BGRA8_EXT,
+        GL_RGBA8_OES,
+    };
+
+    static const GLenum depthStencilBufferFormats[] =
+    {
+        GL_NONE,
+        GL_DEPTH24_STENCIL8_OES,
+        GL_DEPTH_COMPONENT16,
+    };
+
+    const gl::Caps &amp;rendererCaps = getRendererCaps();
+    const gl::TextureCapsMap &amp;rendererTextureCaps = getRendererTextureCaps();
+
+    egl::ConfigSet configs;
+    for (size_t formatIndex = 0; formatIndex &lt; ArraySize(colorBufferFormats); formatIndex++)
+    {
+        GLenum colorBufferInternalFormat = colorBufferFormats[formatIndex];
+        const gl::TextureCaps &amp;colorBufferFormatCaps = rendererTextureCaps.get(colorBufferInternalFormat);
+        if (colorBufferFormatCaps.renderable)
+        {
+            for (size_t depthStencilIndex = 0; depthStencilIndex &lt; ArraySize(depthStencilBufferFormats); depthStencilIndex++)
+            {
+                GLenum depthStencilBufferInternalFormat = depthStencilBufferFormats[depthStencilIndex];
+                const gl::TextureCaps &amp;depthStencilBufferFormatCaps = rendererTextureCaps.get(depthStencilBufferInternalFormat);
+                if (depthStencilBufferFormatCaps.renderable || depthStencilBufferInternalFormat == GL_NONE)
+                {
+                    const gl::InternalFormat &amp;colorBufferFormatInfo = gl::GetInternalFormatInfo(colorBufferInternalFormat);
+                    const gl::InternalFormat &amp;depthStencilBufferFormatInfo = gl::GetInternalFormatInfo(depthStencilBufferInternalFormat);
+
+                    egl::Config config;
+                    config.renderTargetFormat = colorBufferInternalFormat;
+                    config.depthStencilFormat = depthStencilBufferInternalFormat;
+                    config.bufferSize = colorBufferFormatInfo.pixelBytes * 8;
+                    config.redSize = colorBufferFormatInfo.redBits;
+                    config.greenSize = colorBufferFormatInfo.greenBits;
+                    config.blueSize = colorBufferFormatInfo.blueBits;
+                    config.luminanceSize = colorBufferFormatInfo.luminanceBits;
+                    config.alphaSize = colorBufferFormatInfo.alphaBits;
+                    config.alphaMaskSize = 0;
+                    config.bindToTextureRGB = (colorBufferFormatInfo.format == GL_RGB);
+                    config.bindToTextureRGBA = (colorBufferFormatInfo.format == GL_RGBA || colorBufferFormatInfo.format == GL_BGRA_EXT);
+                    config.colorBufferType = EGL_RGB_BUFFER;
+                    config.configCaveat = EGL_NONE;
+                    config.configID = static_cast&lt;EGLint&gt;(configs.size() + 1);
+                    // Can only support a conformant ES2 with feature level greater than 10.0.
+                    config.conformant = (mFeatureLevel &gt;= D3D_FEATURE_LEVEL_10_0) ? (EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT_KHR) : EGL_NONE;
+                    config.depthSize = depthStencilBufferFormatInfo.depthBits;
+                    config.level = 0;
+                    config.matchNativePixmap = EGL_NONE;
+                    config.maxPBufferWidth = rendererCaps.max2DTextureSize;
+                    config.maxPBufferHeight = rendererCaps.max2DTextureSize;
+                    config.maxPBufferPixels = rendererCaps.max2DTextureSize * rendererCaps.max2DTextureSize;
+                    config.maxSwapInterval = 4;
+                    config.minSwapInterval = 0;
+                    config.nativeRenderable = EGL_FALSE;
+                    config.nativeVisualID = 0;
+                    config.nativeVisualType = EGL_NONE;
+                    // Can't support ES3 at all without feature level 10.0
+                    config.renderableType = EGL_OPENGL_ES2_BIT | ((mFeatureLevel &gt;= D3D_FEATURE_LEVEL_10_0) ? EGL_OPENGL_ES3_BIT_KHR : 0);
+                    config.sampleBuffers = 0; // FIXME: enumerate multi-sampling
+                    config.samples = 0;
+                    config.stencilSize = depthStencilBufferFormatInfo.stencilBits;
+                    config.surfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+                    config.transparentType = EGL_NONE;
+                    config.transparentRedValue = 0;
+                    config.transparentGreenValue = 0;
+                    config.transparentBlueValue = 0;
+
+                    configs.add(config);
+                }
+            }
+        }
+    }
+
+    ASSERT(configs.size() &gt; 0);
+    return configs;
+}
+
+gl::Error Renderer11::flush()
+{
+    mDeviceContext-&gt;Flush();
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::finish()
+{
+    HRESULT result;
+
+    if (!mSyncQuery)
+    {
+        D3D11_QUERY_DESC queryDesc;
+        queryDesc.Query = D3D11_QUERY_EVENT;
+        queryDesc.MiscFlags = 0;
+
+        result = mDevice-&gt;CreateQuery(&amp;queryDesc, &amp;mSyncQuery);
+        ASSERT(SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create event query, result: 0x%X.&quot;, result);
+        }
+    }
+
+    mDeviceContext-&gt;End(mSyncQuery);
+    mDeviceContext-&gt;Flush();
+
+    do
+    {
+        result = mDeviceContext-&gt;GetData(mSyncQuery, NULL, 0, D3D11_ASYNC_GETDATA_DONOTFLUSH);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get event query data, result: 0x%X.&quot;, result);
+        }
+
+        // Keep polling, but allow other threads to do something useful first
+        ScheduleYield();
+
+        if (testDeviceLost())
+        {
+            mDisplay-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Device was lost while waiting for sync.&quot;);
+        }
+    }
+    while (result == S_FALSE);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool Renderer11::shouldCreateChildWindowForSurface(EGLNativeWindowType window) const
+{
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+    // In order to create a swap chain for an HWND owned by another process, DXGI 1.2 is required.
+    // The easiest way to check is to query for a IDXGIDevice2.
+    DWORD currentProcessId = GetCurrentProcessId();
+    DWORD wndProcessId;
+    GetWindowThreadProcessId(window, &amp;wndProcessId);
+    if (currentProcessId == wndProcessId)
+    {
+        // Window is from this process, can always create a swap chain for it
+        return false;
+    }
+
+    IDXGIDevice2 *dxgiDevice2 = d3d11::DynamicCastComObject&lt;IDXGIDevice2&gt;(mDevice);
+    if (dxgiDevice2 != nullptr)
+    {
+        // DXGI 1.2 is available, can create a swap chain for this cross-process window
+        SafeRelease(dxgiDevice2);
+        return false;
+    }
+
+    // DXGI 1.2 is not available, need to create a child window.
+    return true;
+#else
+    return false;
+#endif
+}
+
+SwapChainD3D *Renderer11::createSwapChain(NativeWindow nativeWindow, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
+{
+    return new SwapChain11(this, nativeWindow, shareHandle, backBufferFormat, depthBufferFormat);
+}
+
+void *Renderer11::getD3DDevice()
+{
+    return reinterpret_cast&lt;void*&gt;(mDevice);
+}
+
+gl::Error Renderer11::generateSwizzle(gl::Texture *texture)
+{
+    if (texture)
+    {
+        TextureD3D *textureD3D = GetImplAs&lt;TextureD3D&gt;(texture);
+        ASSERT(textureD3D);
+
+        TextureStorage *texStorage = nullptr;
+        gl::Error error = textureD3D-&gt;getNativeTexture(&amp;texStorage);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (texStorage)
+        {
+            TextureStorage11 *storage11 = GetAs&lt;TextureStorage11&gt;(texStorage);
+            error = storage11-&gt;generateSwizzles(texture-&gt;getSamplerState().swizzleRed,
+                                                texture-&gt;getSamplerState().swizzleGreen,
+                                                texture-&gt;getSamplerState().swizzleBlue,
+                                                texture-&gt;getSamplerState().swizzleAlpha);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::setSamplerState(gl::SamplerType type, int index, gl::Texture *texture, const gl::SamplerState &amp;samplerStateParam)
+{
+    // Make sure to add the level offset for our tiny compressed texture workaround
+    TextureD3D *textureD3D = GetImplAs&lt;TextureD3D&gt;(texture);
+    gl::SamplerState samplerStateInternal = samplerStateParam;
+
+    TextureStorage *storage = nullptr;
+    gl::Error error = textureD3D-&gt;getNativeTexture(&amp;storage);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // Storage should exist, texture should be complete
+    ASSERT(storage);
+
+    samplerStateInternal.baseLevel += storage-&gt;getTopLevel();
+
+    if (type == gl::SAMPLER_PIXEL)
+    {
+        ASSERT(static_cast&lt;unsigned int&gt;(index) &lt; getRendererCaps().maxTextureImageUnits);
+
+        if (mForceSetPixelSamplerStates[index] || memcmp(&amp;samplerStateInternal, &amp;mCurPixelSamplerStates[index], sizeof(gl::SamplerState)) != 0)
+        {
+            ID3D11SamplerState *dxSamplerState = NULL;
+            error = mStateCache.getSamplerState(samplerStateInternal, &amp;dxSamplerState);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ASSERT(dxSamplerState != NULL);
+            mDeviceContext-&gt;PSSetSamplers(index, 1, &amp;dxSamplerState);
+
+            mCurPixelSamplerStates[index] = samplerStateInternal;
+        }
+
+        mForceSetPixelSamplerStates[index] = false;
+    }
+    else if (type == gl::SAMPLER_VERTEX)
+    {
+        ASSERT(static_cast&lt;unsigned int&gt;(index) &lt; getRendererCaps().maxVertexTextureImageUnits);
+
+        if (mForceSetVertexSamplerStates[index] || memcmp(&amp;samplerStateInternal, &amp;mCurVertexSamplerStates[index], sizeof(gl::SamplerState)) != 0)
+        {
+            ID3D11SamplerState *dxSamplerState = NULL;
+            error = mStateCache.getSamplerState(samplerStateInternal, &amp;dxSamplerState);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ASSERT(dxSamplerState != NULL);
+            mDeviceContext-&gt;VSSetSamplers(index, 1, &amp;dxSamplerState);
+
+            mCurVertexSamplerStates[index] = samplerStateInternal;
+        }
+
+        mForceSetVertexSamplerStates[index] = false;
+    }
+    else UNREACHABLE();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *texture)
+{
+    ID3D11ShaderResourceView *textureSRV = NULL;
+
+    if (texture)
+    {
+        TextureD3D *textureImpl = GetImplAs&lt;TextureD3D&gt;(texture);
+
+        TextureStorage *texStorage = nullptr;
+        gl::Error error = textureImpl-&gt;getNativeTexture(&amp;texStorage);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // Texture should be complete and have a storage
+        ASSERT(texStorage);
+
+        TextureStorage11 *storage11 = GetAs&lt;TextureStorage11&gt;(texStorage);
+
+        // Make sure to add the level offset for our tiny compressed texture workaround
+        gl::SamplerState samplerState = texture-&gt;getSamplerState();
+        samplerState.baseLevel += storage11-&gt;getTopLevel();
+
+        error = storage11-&gt;getSRV(samplerState, &amp;textureSRV);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // If we get NULL back from getSRV here, something went wrong in the texture class and we're unexpectedly
+        // missing the shader resource view
+        ASSERT(textureSRV != NULL);
+
+        textureImpl-&gt;resetDirty();
+    }
+
+    ASSERT((type == gl::SAMPLER_PIXEL &amp;&amp; static_cast&lt;unsigned int&gt;(index) &lt; getRendererCaps().maxTextureImageUnits) ||
+           (type == gl::SAMPLER_VERTEX &amp;&amp; static_cast&lt;unsigned int&gt;(index) &lt; getRendererCaps().maxVertexTextureImageUnits));
+
+    setShaderResource(type, index, textureSRV);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::setUniformBuffers(const gl::Data &amp;data,
+                                        const GLint vertexUniformBuffers[],
+                                        const GLint fragmentUniformBuffers[])
+{
+    for (unsigned int uniformBufferIndex = 0; uniformBufferIndex &lt; data.caps-&gt;maxVertexUniformBlocks; uniformBufferIndex++)
+    {
+        GLint binding = vertexUniformBuffers[uniformBufferIndex];
+
+        if (binding == -1)
+        {
+            continue;
+        }
+
+        gl::Buffer *uniformBuffer = data.state-&gt;getIndexedUniformBuffer(binding);
+        GLintptr uniformBufferOffset = data.state-&gt;getIndexedUniformBufferOffset(binding);
+        GLsizeiptr uniformBufferSize = data.state-&gt;getIndexedUniformBufferSize(binding);
+
+        if (uniformBuffer)
+        {
+            Buffer11 *bufferStorage = GetImplAs&lt;Buffer11&gt;(uniformBuffer);
+            ID3D11Buffer *constantBuffer;
+
+            if (mSupportsConstantBufferOffsets)
+            {
+                constantBuffer = bufferStorage-&gt;getBuffer(BUFFER_USAGE_UNIFORM);
+            }
+            else
+            {
+                constantBuffer = bufferStorage-&gt;getConstantBufferRange(uniformBufferOffset, uniformBufferSize);
+            }
+
+            if (!constantBuffer)
+            {
+                return gl::Error(GL_OUT_OF_MEMORY);
+            }
+
+            if (mCurrentConstantBufferVS[uniformBufferIndex] != bufferStorage-&gt;getSerial() ||
+                mCurrentConstantBufferVSOffset[uniformBufferIndex] != uniformBufferOffset ||
+                mCurrentConstantBufferVSSize[uniformBufferIndex] != uniformBufferSize)
+            {
+                if (mSupportsConstantBufferOffsets &amp;&amp; uniformBufferSize != 0)
+                {
+                    UINT firstConstant = 0, numConstants = 0;
+                    CalculateConstantBufferParams(uniformBufferOffset, uniformBufferSize, &amp;firstConstant, &amp;numConstants);
+                    mDeviceContext1-&gt;VSSetConstantBuffers1(getReservedVertexUniformBuffers() + uniformBufferIndex,
+                                                           1, &amp;constantBuffer, &amp;firstConstant, &amp;numConstants);
+                }
+                else
+                {
+                    mDeviceContext-&gt;VSSetConstantBuffers(getReservedVertexUniformBuffers() + uniformBufferIndex,
+                                                         1, &amp;constantBuffer);
+                }
+
+                mCurrentConstantBufferVS[uniformBufferIndex] = bufferStorage-&gt;getSerial();
+                mCurrentConstantBufferVSOffset[uniformBufferIndex] = uniformBufferOffset;
+                mCurrentConstantBufferVSSize[uniformBufferIndex] = uniformBufferSize;
+            }
+        }
+    }
+
+    for (unsigned int uniformBufferIndex = 0; uniformBufferIndex &lt; data.caps-&gt;maxFragmentUniformBlocks; uniformBufferIndex++)
+    {
+        GLint binding = fragmentUniformBuffers[uniformBufferIndex];
+
+        if (binding == -1)
+        {
+            continue;
+        }
+
+        gl::Buffer *uniformBuffer = data.state-&gt;getIndexedUniformBuffer(binding);
+        GLintptr uniformBufferOffset = data.state-&gt;getIndexedUniformBufferOffset(binding);
+        GLsizeiptr uniformBufferSize = data.state-&gt;getIndexedUniformBufferSize(binding);
+
+        if (uniformBuffer)
+        {
+            Buffer11 *bufferStorage = GetImplAs&lt;Buffer11&gt;(uniformBuffer);
+            ID3D11Buffer *constantBuffer;
+
+            if (mSupportsConstantBufferOffsets)
+            {
+                constantBuffer = bufferStorage-&gt;getBuffer(BUFFER_USAGE_UNIFORM);
+            }
+            else
+            {
+                constantBuffer = bufferStorage-&gt;getConstantBufferRange(uniformBufferOffset, uniformBufferSize);
+            }
+
+            if (!constantBuffer)
+            {
+                return gl::Error(GL_OUT_OF_MEMORY);
+            }
+
+            if (mCurrentConstantBufferPS[uniformBufferIndex] != bufferStorage-&gt;getSerial() ||
+                mCurrentConstantBufferPSOffset[uniformBufferIndex] != uniformBufferOffset ||
+                mCurrentConstantBufferPSSize[uniformBufferIndex] != uniformBufferSize)
+            {
+                if (mSupportsConstantBufferOffsets &amp;&amp; uniformBufferSize != 0)
+                {
+                    UINT firstConstant = 0, numConstants = 0;
+                    CalculateConstantBufferParams(uniformBufferOffset, uniformBufferSize, &amp;firstConstant, &amp;numConstants);
+                    mDeviceContext1-&gt;PSSetConstantBuffers1(getReservedFragmentUniformBuffers() + uniformBufferIndex,
+                                                           1, &amp;constantBuffer, &amp;firstConstant, &amp;numConstants);
+                }
+                else
+                {
+                    mDeviceContext-&gt;PSSetConstantBuffers(getReservedFragmentUniformBuffers() + uniformBufferIndex,
+                                                         1, &amp;constantBuffer);
+                }
+
+                mCurrentConstantBufferPS[uniformBufferIndex] = bufferStorage-&gt;getSerial();
+                mCurrentConstantBufferPSOffset[uniformBufferIndex] = uniformBufferOffset;
+                mCurrentConstantBufferPSSize[uniformBufferIndex] = uniformBufferSize;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::setRasterizerState(const gl::RasterizerState &amp;rasterState)
+{
+    if (mForceSetRasterState || memcmp(&amp;rasterState, &amp;mCurRasterState, sizeof(gl::RasterizerState)) != 0)
+    {
+        ID3D11RasterizerState *dxRasterState = NULL;
+        gl::Error error = mStateCache.getRasterizerState(rasterState, mScissorEnabled, &amp;dxRasterState);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mDeviceContext-&gt;RSSetState(dxRasterState);
+
+        mCurRasterState = rasterState;
+    }
+
+    mForceSetRasterState = false;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::setBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &amp;blendState, const gl::ColorF &amp;blendColor,
+                                    unsigned int sampleMask)
+{
+    if (mForceSetBlendState ||
+        memcmp(&amp;blendState, &amp;mCurBlendState, sizeof(gl::BlendState)) != 0 ||
+        memcmp(&amp;blendColor, &amp;mCurBlendColor, sizeof(gl::ColorF)) != 0 ||
+        sampleMask != mCurSampleMask)
+    {
+        ID3D11BlendState *dxBlendState = NULL;
+        gl::Error error = mStateCache.getBlendState(framebuffer, blendState, &amp;dxBlendState);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ASSERT(dxBlendState != NULL);
+
+        float blendColors[4] = {0.0f};
+        if (blendState.sourceBlendRGB != GL_CONSTANT_ALPHA &amp;&amp; blendState.sourceBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA &amp;&amp;
+            blendState.destBlendRGB != GL_CONSTANT_ALPHA &amp;&amp; blendState.destBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA)
+        {
+            blendColors[0] = blendColor.red;
+            blendColors[1] = blendColor.green;
+            blendColors[2] = blendColor.blue;
+            blendColors[3] = blendColor.alpha;
+        }
+        else
+        {
+            blendColors[0] = blendColor.alpha;
+            blendColors[1] = blendColor.alpha;
+            blendColors[2] = blendColor.alpha;
+            blendColors[3] = blendColor.alpha;
+        }
+
+        mDeviceContext-&gt;OMSetBlendState(dxBlendState, blendColors, sampleMask);
+
+        mCurBlendState = blendState;
+        mCurBlendColor = blendColor;
+        mCurSampleMask = sampleMask;
+    }
+
+    mForceSetBlendState = false;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::setDepthStencilState(const gl::DepthStencilState &amp;depthStencilState, int stencilRef,
+                                           int stencilBackRef, bool frontFaceCCW)
+{
+    if (mForceSetDepthStencilState ||
+        memcmp(&amp;depthStencilState, &amp;mCurDepthStencilState, sizeof(gl::DepthStencilState)) != 0 ||
+        stencilRef != mCurStencilRef || stencilBackRef != mCurStencilBackRef)
+    {
+        ASSERT(depthStencilState.stencilWritemask == depthStencilState.stencilBackWritemask);
+        ASSERT(stencilRef == stencilBackRef);
+        ASSERT(depthStencilState.stencilMask == depthStencilState.stencilBackMask);
+
+        ID3D11DepthStencilState *dxDepthStencilState = NULL;
+        gl::Error error = mStateCache.getDepthStencilState(depthStencilState, &amp;dxDepthStencilState);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ASSERT(dxDepthStencilState);
+
+        // Max D3D11 stencil reference value is 0xFF, corresponding to the max 8 bits in a stencil buffer
+        // GL specifies we should clamp the ref value to the nearest bit depth when doing stencil ops
+        static_assert(D3D11_DEFAULT_STENCIL_READ_MASK == 0xFF, &quot;Unexpected value of D3D11_DEFAULT_STENCIL_READ_MASK&quot;);
+        static_assert(D3D11_DEFAULT_STENCIL_WRITE_MASK == 0xFF, &quot;Unexpected value of D3D11_DEFAULT_STENCIL_WRITE_MASK&quot;);
+        UINT dxStencilRef = std::min&lt;UINT&gt;(stencilRef, 0xFFu);
+
+        mDeviceContext-&gt;OMSetDepthStencilState(dxDepthStencilState, dxStencilRef);
+
+        mCurDepthStencilState = depthStencilState;
+        mCurStencilRef = stencilRef;
+        mCurStencilBackRef = stencilBackRef;
+    }
+
+    mForceSetDepthStencilState = false;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer11::setScissorRectangle(const gl::Rectangle &amp;scissor, bool enabled)
+{
+    if (mForceSetScissor || memcmp(&amp;scissor, &amp;mCurScissor, sizeof(gl::Rectangle)) != 0 ||
+        enabled != mScissorEnabled)
+    {
+        if (enabled)
+        {
+            D3D11_RECT rect;
+            rect.left = std::max(0, scissor.x);
+            rect.top = std::max(0, scissor.y);
+            rect.right = scissor.x + std::max(0, scissor.width);
+            rect.bottom = scissor.y + std::max(0, scissor.height);
+
+            mDeviceContext-&gt;RSSetScissorRects(1, &amp;rect);
+        }
+
+        if (enabled != mScissorEnabled)
+        {
+            mForceSetRasterState = true;
+        }
+
+        mCurScissor = scissor;
+        mScissorEnabled = enabled;
+    }
+
+    mForceSetScissor = false;
+}
+
+void Renderer11::setViewport(const gl::Rectangle &amp;viewport, float zNear, float zFar, GLenum drawMode, GLenum frontFace,
+                             bool ignoreViewport)
+{
+    gl::Rectangle actualViewport = viewport;
+    float actualZNear = gl::clamp01(zNear);
+    float actualZFar = gl::clamp01(zFar);
+    if (ignoreViewport)
+    {
+        actualViewport.x = 0;
+        actualViewport.y = 0;
+        actualViewport.width = mRenderTargetDesc.width;
+        actualViewport.height = mRenderTargetDesc.height;
+        actualZNear = 0.0f;
+        actualZFar = 1.0f;
+    }
+
+    bool viewportChanged = mForceSetViewport || memcmp(&amp;actualViewport, &amp;mCurViewport, sizeof(gl::Rectangle)) != 0 ||
+                           actualZNear != mCurNear || actualZFar != mCurFar;
+
+    if (viewportChanged)
+    {
+        const gl::Caps&amp; caps = getRendererCaps();
+
+        int dxMaxViewportBoundsX = static_cast&lt;int&gt;(caps.maxViewportWidth);
+        int dxMaxViewportBoundsY = static_cast&lt;int&gt;(caps.maxViewportHeight);
+        int dxMinViewportBoundsX = -dxMaxViewportBoundsX;
+        int dxMinViewportBoundsY = -dxMaxViewportBoundsY;
+
+        if (mFeatureLevel &lt;= D3D_FEATURE_LEVEL_9_3)
+        {
+            // Feature Level 9 viewports shouldn't exceed the dimensions of the rendertarget.
+            dxMaxViewportBoundsX = mRenderTargetDesc.width;
+            dxMaxViewportBoundsY = mRenderTargetDesc.height;
+            dxMinViewportBoundsX = 0;
+            dxMinViewportBoundsY = 0;
+        }
+
+        int dxViewportTopLeftX = gl::clamp(actualViewport.x, dxMinViewportBoundsX, dxMaxViewportBoundsX);
+        int dxViewportTopLeftY = gl::clamp(actualViewport.y, dxMinViewportBoundsY, dxMaxViewportBoundsY);
+        int dxViewportWidth =    gl::clamp(actualViewport.width, 0, dxMaxViewportBoundsX - dxViewportTopLeftX);
+        int dxViewportHeight =   gl::clamp(actualViewport.height, 0, dxMaxViewportBoundsY - dxViewportTopLeftY);
+
+        D3D11_VIEWPORT dxViewport;
+        dxViewport.TopLeftX = static_cast&lt;float&gt;(dxViewportTopLeftX);
+        dxViewport.TopLeftY = static_cast&lt;float&gt;(dxViewportTopLeftY);
+        dxViewport.Width =    static_cast&lt;float&gt;(dxViewportWidth);
+        dxViewport.Height =   static_cast&lt;float&gt;(dxViewportHeight);
+        dxViewport.MinDepth = actualZNear;
+        dxViewport.MaxDepth = actualZFar;
+
+        mDeviceContext-&gt;RSSetViewports(1, &amp;dxViewport);
+
+        mCurViewport = actualViewport;
+        mCurNear = actualZNear;
+        mCurFar = actualZFar;
+
+        // On Feature Level 9_*, we must emulate large and/or negative viewports in the shaders using viewAdjust (like the D3D9 renderer).
+        if (mFeatureLevel &lt;= D3D_FEATURE_LEVEL_9_3)
+        {
+            mVertexConstants.viewAdjust[0] = static_cast&lt;float&gt;((actualViewport.width  - dxViewportWidth)  + 2 * (actualViewport.x - dxViewportTopLeftX)) / dxViewport.Width;
+            mVertexConstants.viewAdjust[1] = static_cast&lt;float&gt;((actualViewport.height - dxViewportHeight) + 2 * (actualViewport.y - dxViewportTopLeftY)) / dxViewport.Height;
+            mVertexConstants.viewAdjust[2] = static_cast&lt;float&gt;(actualViewport.width) / dxViewport.Width;
+            mVertexConstants.viewAdjust[3] = static_cast&lt;float&gt;(actualViewport.height) / dxViewport.Height;
+        }
+
+        mPixelConstants.viewCoords[0] = actualViewport.width  * 0.5f;
+        mPixelConstants.viewCoords[1] = actualViewport.height * 0.5f;
+        mPixelConstants.viewCoords[2] = actualViewport.x + (actualViewport.width  * 0.5f);
+        mPixelConstants.viewCoords[3] = actualViewport.y + (actualViewport.height * 0.5f);
+
+        // Instanced pointsprite emulation requires ViewCoords to be defined in the
+        // the vertex shader.
+        mVertexConstants.viewCoords[0] = mPixelConstants.viewCoords[0];
+        mVertexConstants.viewCoords[1] = mPixelConstants.viewCoords[1];
+        mVertexConstants.viewCoords[2] = mPixelConstants.viewCoords[2];
+        mVertexConstants.viewCoords[3] = mPixelConstants.viewCoords[3];
+
+        mPixelConstants.depthFront[0] = (actualZFar - actualZNear) * 0.5f;
+        mPixelConstants.depthFront[1] = (actualZNear + actualZFar) * 0.5f;
+
+        mVertexConstants.depthRange[0] = actualZNear;
+        mVertexConstants.depthRange[1] = actualZFar;
+        mVertexConstants.depthRange[2] = actualZFar - actualZNear;
+
+        mPixelConstants.depthRange[0] = actualZNear;
+        mPixelConstants.depthRange[1] = actualZFar;
+        mPixelConstants.depthRange[2] = actualZFar - actualZNear;
+    }
+
+    mForceSetViewport = false;
+}
+
+bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize)
+{
+    D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
+
+    GLsizei minCount = 0;
+
+    switch (mode)
+    {
+      case GL_POINTS:         primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;   minCount = 1; break;
+      case GL_LINES:          primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINELIST;      minCount = 2; break;
+      case GL_LINE_LOOP:      primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;     minCount = 2; break;
+      case GL_LINE_STRIP:     primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;     minCount = 2; break;
+      case GL_TRIANGLES:      primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;  minCount = 3; break;
+      case GL_TRIANGLE_STRIP: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; minCount = 3; break;
+          // emulate fans via rewriting index buffer
+      case GL_TRIANGLE_FAN:   primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;  minCount = 3; break;
+      default:
+        UNREACHABLE();
+        return false;
+    }
+
+    // If instanced pointsprite emulation is being used and  If gl_PointSize is used in the shader,
+    // GL_POINTS mode is expected to render pointsprites.
+    // Instanced PointSprite emulation requires that the topology to be D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST.
+    if (mode == GL_POINTS &amp;&amp; usesPointSize &amp;&amp; getWorkarounds().useInstancedPointSpriteEmulation)
+    {
+        primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
+    }
+
+    if (primitiveTopology != mCurrentPrimitiveTopology)
+    {
+        mDeviceContext-&gt;IASetPrimitiveTopology(primitiveTopology);
+        mCurrentPrimitiveTopology = primitiveTopology;
+    }
+
+    return count &gt;= minCount;
+}
+
+void Renderer11::unsetConflictingSRVs(gl::SamplerType samplerType, uintptr_t resource, const gl::ImageIndex &amp;index)
+{
+    auto &amp;currentSRVs = (samplerType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
+
+    for (size_t resourceIndex = 0; resourceIndex &lt; currentSRVs.size(); ++resourceIndex)
+    {
+        auto &amp;record = currentSRVs[resourceIndex];
+
+        if (record.srv &amp;&amp; record.resource == resource &amp;&amp; ImageIndexConflictsWithSRV(index, record.desc))
+        {
+            setShaderResource(samplerType, static_cast&lt;UINT&gt;(resourceIndex), NULL);
+        }
+    }
+}
+
+gl::Error Renderer11::applyRenderTarget(const gl::Framebuffer *framebuffer)
+{
+    // Get the color render buffer and serial
+    // Also extract the render target dimensions and view
+    unsigned int renderTargetWidth = 0;
+    unsigned int renderTargetHeight = 0;
+    DXGI_FORMAT renderTargetFormat = DXGI_FORMAT_UNKNOWN;
+    ID3D11RenderTargetView* framebufferRTVs[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS] = {NULL};
+    bool missingColorRenderTarget = true;
+
+    const FramebufferD3D *framebufferD3D = GetImplAs&lt;FramebufferD3D&gt;(framebuffer);
+    const gl::AttachmentList &amp;colorbuffers = framebufferD3D-&gt;getColorAttachmentsForRender(getWorkarounds());
+
+    for (size_t colorAttachment = 0; colorAttachment &lt; colorbuffers.size(); ++colorAttachment)
+    {
+        const gl::FramebufferAttachment *colorbuffer = colorbuffers[colorAttachment];
+
+        if (colorbuffer)
+        {
+            // the draw buffer must be either &quot;none&quot;, &quot;back&quot; for the default buffer or the same index as this color (in order)
+
+            // check for zero-sized default framebuffer, which is a special case.
+            // in this case we do not wish to modify any state and just silently return false.
+            // this will not report any gl error but will cause the calling method to return.
+            if (colorbuffer-&gt;getWidth() == 0 || colorbuffer-&gt;getHeight() == 0)
+            {
+                return gl::Error(GL_NO_ERROR);
+            }
+
+            // Extract the render target dimensions and view
+            RenderTarget11 *renderTarget = NULL;
+            gl::Error error = colorbuffer-&gt;getRenderTarget(&amp;renderTarget);
+            if (error.isError())
+            {
+                return error;
+            }
+            ASSERT(renderTarget);
+
+            framebufferRTVs[colorAttachment] = renderTarget-&gt;getRenderTargetView();
+            ASSERT(framebufferRTVs[colorAttachment]);
+
+            if (missingColorRenderTarget)
+            {
+                renderTargetWidth = renderTarget-&gt;getWidth();
+                renderTargetHeight = renderTarget-&gt;getHeight();
+                renderTargetFormat = renderTarget-&gt;getDXGIFormat();
+                missingColorRenderTarget = false;
+            }
+
+            // Unbind render target SRVs from the shader here to prevent D3D11 warnings.
+            if (colorbuffer-&gt;type() == GL_TEXTURE)
+            {
+                uintptr_t rtResource = reinterpret_cast&lt;uintptr_t&gt;(GetViewResource(framebufferRTVs[colorAttachment]));
+                const gl::ImageIndex &amp;index = colorbuffer-&gt;getTextureImageIndex();
+                // The index doesn't need to be corrected for the small compressed texture workaround
+                // because a rendertarget is never compressed.
+                unsetConflictingSRVs(gl::SAMPLER_VERTEX, rtResource, index);
+                unsetConflictingSRVs(gl::SAMPLER_PIXEL, rtResource, index);
+            }
+        }
+    }
+
+    // Get the depth stencil buffers
+    ID3D11DepthStencilView* framebufferDSV = NULL;
+    const gl::FramebufferAttachment *depthStencil = framebuffer-&gt;getDepthOrStencilbuffer();
+    if (depthStencil)
+    {
+        RenderTarget11 *depthStencilRenderTarget = NULL;
+        gl::Error error = depthStencil-&gt;getRenderTarget(&amp;depthStencilRenderTarget);
+        if (error.isError())
+        {
+            SafeRelease(framebufferRTVs);
+            return error;
+        }
+        ASSERT(depthStencilRenderTarget);
+
+        framebufferDSV = depthStencilRenderTarget-&gt;getDepthStencilView();
+        ASSERT(framebufferDSV);
+
+        // If there is no render buffer, the width, height and format values come from
+        // the depth stencil
+        if (missingColorRenderTarget)
+        {
+            renderTargetWidth = depthStencilRenderTarget-&gt;getWidth();
+            renderTargetHeight = depthStencilRenderTarget-&gt;getHeight();
+            renderTargetFormat = depthStencilRenderTarget-&gt;getDXGIFormat();
+        }
+
+        // Unbind render target SRVs from the shader here to prevent D3D11 warnings.
+        if (depthStencil-&gt;type() == GL_TEXTURE)
+        {
+            uintptr_t depthStencilResource = reinterpret_cast&lt;uintptr_t&gt;(GetViewResource(framebufferDSV));
+            const gl::ImageIndex &amp;index = depthStencil-&gt;getTextureImageIndex();
+            // The index doesn't need to be corrected for the small compressed texture workaround
+            // because a rendertarget is never compressed.
+            unsetConflictingSRVs(gl::SAMPLER_VERTEX, depthStencilResource, index);
+            unsetConflictingSRVs(gl::SAMPLER_PIXEL, depthStencilResource, index);
+        }
+    }
+
+    // Apply the render target and depth stencil
+    if (!mRenderTargetDescInitialized || !mDepthStencilInitialized ||
+        memcmp(framebufferRTVs, mAppliedRTVs, sizeof(framebufferRTVs)) != 0 ||
+        reinterpret_cast&lt;uintptr_t&gt;(framebufferDSV) != mAppliedDSV)
+    {
+        mDeviceContext-&gt;OMSetRenderTargets(getRendererCaps().maxDrawBuffers, framebufferRTVs, framebufferDSV);
+
+        mRenderTargetDesc.width = renderTargetWidth;
+        mRenderTargetDesc.height = renderTargetHeight;
+        mRenderTargetDesc.format = renderTargetFormat;
+        mForceSetViewport = true;
+        mForceSetScissor = true;
+        mForceSetBlendState = true;
+
+        if (!mDepthStencilInitialized)
+        {
+            mForceSetRasterState = true;
+        }
+
+        for (size_t rtIndex = 0; rtIndex &lt; ArraySize(framebufferRTVs); rtIndex++)
+        {
+            mAppliedRTVs[rtIndex] = reinterpret_cast&lt;uintptr_t&gt;(framebufferRTVs[rtIndex]);
+        }
+        mAppliedDSV = reinterpret_cast&lt;uintptr_t&gt;(framebufferDSV);
+        mRenderTargetDescInitialized = true;
+        mDepthStencilInitialized = true;
+    }
+
+    const Framebuffer11 *framebuffer11 = GetImplAs&lt;Framebuffer11&gt;(framebuffer);
+    gl::Error error = framebuffer11-&gt;invalidateSwizzles();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::applyVertexBuffer(const gl::State &amp;state, GLenum mode, GLint first, GLsizei count, GLsizei instances)
+{
+    TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
+    gl::Error error = mVertexDataManager-&gt;prepareVertexData(state, first, count, attributes, instances);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return mInputLayoutCache.applyVertexBuffers(attributes, mode, state.getProgram());
+}
+
+gl::Error Renderer11::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
+{
+    gl::Error error = mIndexDataManager-&gt;prepareIndexData(type, count, elementArrayBuffer, indices, indexInfo);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ID3D11Buffer *buffer = NULL;
+    DXGI_FORMAT bufferFormat = (indexInfo-&gt;indexType == GL_UNSIGNED_INT) ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
+
+    if (indexInfo-&gt;storage)
+    {
+        Buffer11 *storage = GetAs&lt;Buffer11&gt;(indexInfo-&gt;storage);
+        buffer = storage-&gt;getBuffer(BUFFER_USAGE_INDEX);
+    }
+    else
+    {
+        IndexBuffer11* indexBuffer = GetAs&lt;IndexBuffer11&gt;(indexInfo-&gt;indexBuffer);
+        buffer = indexBuffer-&gt;getBuffer();
+    }
+
+    if (buffer != mAppliedIB || bufferFormat != mAppliedIBFormat || indexInfo-&gt;startOffset != mAppliedIBOffset)
+    {
+        mDeviceContext-&gt;IASetIndexBuffer(buffer, bufferFormat, indexInfo-&gt;startOffset);
+
+        mAppliedIB = buffer;
+        mAppliedIBFormat = bufferFormat;
+        mAppliedIBOffset = indexInfo-&gt;startOffset;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer11::applyTransformFeedbackBuffers(const gl::State &amp;state)
+{
+    size_t numXFBBindings = 0;
+    bool requiresUpdate = false;
+
+    if (state.isTransformFeedbackActiveUnpaused())
+    {
+        const gl::TransformFeedback *transformFeedback = state.getCurrentTransformFeedback();
+        numXFBBindings = transformFeedback-&gt;getIndexedBufferCount();
+        ASSERT(numXFBBindings &lt;= gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS);
+
+        for (size_t i = 0; i &lt; numXFBBindings; i++)
+        {
+            const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding = transformFeedback-&gt;getIndexedBuffer(i);
+
+            ID3D11Buffer *d3dBuffer = NULL;
+            if (binding.get() != nullptr)
+            {
+                Buffer11 *storage = GetImplAs&lt;Buffer11&gt;(binding.get());
+                d3dBuffer = storage-&gt;getBuffer(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+            }
+
+            // TODO: mAppliedTFBuffers and friends should also be kept in a vector.
+            if (d3dBuffer != mAppliedTFBuffers[i] || binding.getOffset() != mAppliedTFOffsets[i])
+            {
+                requiresUpdate = true;
+            }
+        }
+    }
+
+    if (requiresUpdate || numXFBBindings != mAppliedNumXFBBindings)
+    {
+        const gl::TransformFeedback *transformFeedback = state.getCurrentTransformFeedback();
+        for (size_t i = 0; i &lt; numXFBBindings; ++i)
+        {
+            const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding = transformFeedback-&gt;getIndexedBuffer(i);
+            if (binding.get() != nullptr)
+            {
+                Buffer11 *storage = GetImplAs&lt;Buffer11&gt;(binding.get());
+                ID3D11Buffer *d3dBuffer = storage-&gt;getBuffer(BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK);
+
+                mCurrentD3DOffsets[i] = (mAppliedTFBuffers[i] != d3dBuffer || mAppliedTFOffsets[i] != binding.getOffset()) ?
+                                        static_cast&lt;UINT&gt;(binding.getOffset()) : -1;
+                mAppliedTFBuffers[i] = d3dBuffer;
+            }
+            else
+            {
+                mAppliedTFBuffers[i] = NULL;
+                mCurrentD3DOffsets[i] = 0;
+            }
+            mAppliedTFOffsets[i] = binding.getOffset();
+        }
+
+        mAppliedNumXFBBindings = numXFBBindings;
+
+        mDeviceContext-&gt;SOSetTargets(numXFBBindings, mAppliedTFBuffers, mCurrentD3DOffsets);
+    }
+}
+
+gl::Error Renderer11::drawArrays(const gl::Data &amp;data, GLenum mode, GLsizei count, GLsizei instances, bool usesPointSize)
+{
+    bool useInstancedPointSpriteEmulation = usesPointSize &amp;&amp; getWorkarounds().useInstancedPointSpriteEmulation;
+    if (mode == GL_POINTS &amp;&amp; data.state-&gt;isTransformFeedbackActiveUnpaused())
+    {
+        // Since point sprites are generated with a geometry shader, too many vertices will
+        // be written if transform feedback is active.  To work around this, draw only the points
+        // with the stream out shader and no pixel shader to feed the stream out buffers and then 
+        // draw again with the point sprite geometry shader to rasterize the point sprites.
+
+        mDeviceContext-&gt;PSSetShader(NULL, NULL, 0);
+
+        if (instances &gt; 0)
+        {
+            mDeviceContext-&gt;DrawInstanced(count, instances, 0, 0);
+        }
+        else
+        {
+            mDeviceContext-&gt;Draw(count, 0);
+        }
+
+        ProgramD3D *programD3D = GetImplAs&lt;ProgramD3D&gt;(data.state-&gt;getProgram());
+
+        rx::ShaderExecutableD3D *pixelExe = NULL;
+        gl::Error error = programD3D-&gt;getPixelExecutableForFramebuffer(data.state-&gt;getDrawFramebuffer(), &amp;pixelExe);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // Skip this step if we're doing rasterizer discard.
+        if (pixelExe &amp;&amp; !data.state-&gt;getRasterizerState().rasterizerDiscard &amp;&amp; usesPointSize)
+        {
+            ID3D11PixelShader *pixelShader = GetAs&lt;ShaderExecutable11&gt;(pixelExe)-&gt;getPixelShader();
+            ASSERT(reinterpret_cast&lt;uintptr_t&gt;(pixelShader) == mAppliedPixelShader);
+            mDeviceContext-&gt;PSSetShader(pixelShader, NULL, 0);
+
+            // Retrieve the point sprite geometry shader
+            rx::ShaderExecutableD3D *geometryExe = programD3D-&gt;getGeometryExecutable();
+            ID3D11GeometryShader *geometryShader = (geometryExe ? GetAs&lt;ShaderExecutable11&gt;(geometryExe)-&gt;getGeometryShader() : NULL);
+            mAppliedGeometryShader = reinterpret_cast&lt;uintptr_t&gt;(geometryShader);
+            ASSERT(geometryShader);
+            mDeviceContext-&gt;GSSetShader(geometryShader, NULL, 0);
+
+            if (instances &gt; 0)
+            {
+                mDeviceContext-&gt;DrawInstanced(count, instances, 0, 0);
+            }
+            else
+            {
+                mDeviceContext-&gt;Draw(count, 0);
+            }
+        }
+
+        return gl::Error(GL_NO_ERROR);
+    }
+    else if (mode == GL_LINE_LOOP)
+    {
+        return drawLineLoop(count, GL_NONE, NULL, 0, NULL);
+    }
+    else if (mode == GL_TRIANGLE_FAN)
+    {
+        return drawTriangleFan(count, GL_NONE, NULL, 0, NULL, instances);
+    }
+    else if (instances &gt; 0)
+    {
+        mDeviceContext-&gt;DrawInstanced(count, instances, 0, 0);
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        // If gl_PointSize is used and GL_POINTS is specified, then it is expected to render pointsprites.
+        // If instanced pointsprite emulation is being used the topology is expexted to be 
+        // D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST and DrawIndexedInstanced must be used.
+        if (mode == GL_POINTS &amp;&amp; useInstancedPointSpriteEmulation)
+        {
+            mDeviceContext-&gt;DrawIndexedInstanced(6, count, 0, 0, 0);
+        }
+        else
+        {
+            mDeviceContext-&gt;Draw(count, 0);
+        }
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error Renderer11::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+                                   gl::Buffer *elementArrayBuffer, const TranslatedIndexData &amp;indexInfo, GLsizei instances)
+{
+    int minIndex = static_cast&lt;int&gt;(indexInfo.indexRange.start);
+
+    if (mode == GL_LINE_LOOP)
+    {
+        return drawLineLoop(count, type, indices, minIndex, elementArrayBuffer);
+    }
+    else if (mode == GL_TRIANGLE_FAN)
+    {
+        return drawTriangleFan(count, type, indices, minIndex, elementArrayBuffer, instances);
+    }
+    else if (instances &gt; 0)
+    {
+        mDeviceContext-&gt;DrawIndexedInstanced(count, instances, 0, -minIndex, 0);
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        mDeviceContext-&gt;DrawIndexed(count, 0, -minIndex);
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error Renderer11::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
+{
+    // Get the raw indices for an indexed draw
+    if (type != GL_NONE &amp;&amp; elementArrayBuffer)
+    {
+        BufferD3D *storage = GetImplAs&lt;BufferD3D&gt;(elementArrayBuffer);
+        intptr_t offset = reinterpret_cast&lt;intptr_t&gt;(indices);
+
+        const uint8_t *bufferData = NULL;
+        gl::Error error = storage-&gt;getData(&amp;bufferData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        indices = bufferData + offset;
+    }
+
+    if (!mLineLoopIB)
+    {
+        mLineLoopIB = new StreamingIndexBufferInterface(this);
+        gl::Error error = mLineLoopIB-&gt;reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
+        if (error.isError())
+        {
+            SafeDelete(mLineLoopIB);
+            return error;
+        }
+    }
+
+    // Checked by Renderer11::applyPrimitiveType
+    ASSERT(count &gt;= 0);
+
+    if (static_cast&lt;unsigned int&gt;(count) + 1 &gt; (std::numeric_limits&lt;unsigned int&gt;::max() / sizeof(unsigned int)))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required.&quot;);
+    }
+
+    const unsigned int spaceNeeded = (static_cast&lt;unsigned int&gt;(count) + 1) * sizeof(unsigned int);
+    gl::Error error = mLineLoopIB-&gt;reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    void* mappedMemory = NULL;
+    unsigned int offset;
+    error = mLineLoopIB-&gt;mapBuffer(spaceNeeded, &amp;mappedMemory, &amp;offset);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    unsigned int *data = reinterpret_cast&lt;unsigned int*&gt;(mappedMemory);
+    unsigned int indexBufferOffset = offset;
+
+    switch (type)
+    {
+      case GL_NONE:   // Non-indexed draw
+        for (int i = 0; i &lt; count; i++)
+        {
+            data[i] = i;
+        }
+        data[count] = 0;
+        break;
+      case GL_UNSIGNED_BYTE:
+        for (int i = 0; i &lt; count; i++)
+        {
+            data[i] = static_cast&lt;const GLubyte*&gt;(indices)[i];
+        }
+        data[count] = static_cast&lt;const GLubyte*&gt;(indices)[0];
+        break;
+      case GL_UNSIGNED_SHORT:
+        for (int i = 0; i &lt; count; i++)
+        {
+            data[i] = static_cast&lt;const GLushort*&gt;(indices)[i];
+        }
+        data[count] = static_cast&lt;const GLushort*&gt;(indices)[0];
+        break;
+      case GL_UNSIGNED_INT:
+        for (int i = 0; i &lt; count; i++)
+        {
+            data[i] = static_cast&lt;const GLuint*&gt;(indices)[i];
+        }
+        data[count] = static_cast&lt;const GLuint*&gt;(indices)[0];
+        break;
+      default: UNREACHABLE();
+    }
+
+    error = mLineLoopIB-&gt;unmapBuffer();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IndexBuffer11 *indexBuffer = GetAs&lt;IndexBuffer11&gt;(mLineLoopIB-&gt;getIndexBuffer());
+    ID3D11Buffer *d3dIndexBuffer = indexBuffer-&gt;getBuffer();
+    DXGI_FORMAT indexFormat = indexBuffer-&gt;getIndexFormat();
+
+    if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat || mAppliedIBOffset != indexBufferOffset)
+    {
+        mDeviceContext-&gt;IASetIndexBuffer(d3dIndexBuffer, indexFormat, indexBufferOffset);
+        mAppliedIB = d3dIndexBuffer;
+        mAppliedIBFormat = indexFormat;
+        mAppliedIBOffset = indexBufferOffset;
+    }
+
+    mDeviceContext-&gt;DrawIndexed(count + 1, 0, -minIndex);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances)
+{
+    // Get the raw indices for an indexed draw
+    if (type != GL_NONE &amp;&amp; elementArrayBuffer)
+    {
+        BufferD3D *storage = GetImplAs&lt;BufferD3D&gt;(elementArrayBuffer);
+        intptr_t offset = reinterpret_cast&lt;intptr_t&gt;(indices);
+
+        const uint8_t *bufferData = NULL;
+        gl::Error error = storage-&gt;getData(&amp;bufferData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        indices = bufferData + offset;
+    }
+
+    if (!mTriangleFanIB)
+    {
+        mTriangleFanIB = new StreamingIndexBufferInterface(this);
+        gl::Error error = mTriangleFanIB-&gt;reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
+        if (error.isError())
+        {
+            SafeDelete(mTriangleFanIB);
+            return error;
+        }
+    }
+
+    // Checked by Renderer11::applyPrimitiveType
+    ASSERT(count &gt;= 3);
+
+    const unsigned int numTris = count - 2;
+
+    if (numTris &gt; (std::numeric_limits&lt;unsigned int&gt;::max() / (sizeof(unsigned int) * 3)))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create a scratch index buffer for GL_TRIANGLE_FAN, too many indices required.&quot;);
+    }
+
+    const unsigned int spaceNeeded = (numTris * 3) * sizeof(unsigned int);
+    gl::Error error = mTriangleFanIB-&gt;reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    void* mappedMemory = NULL;
+    unsigned int offset;
+    error = mTriangleFanIB-&gt;mapBuffer(spaceNeeded, &amp;mappedMemory, &amp;offset);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    unsigned int *data = reinterpret_cast&lt;unsigned int*&gt;(mappedMemory);
+    unsigned int indexBufferOffset = offset;
+
+    switch (type)
+    {
+      case GL_NONE:   // Non-indexed draw
+        for (unsigned int i = 0; i &lt; numTris; i++)
+        {
+            data[i*3 + 0] = 0;
+            data[i*3 + 1] = i + 1;
+            data[i*3 + 2] = i + 2;
+        }
+        break;
+      case GL_UNSIGNED_BYTE:
+        for (unsigned int i = 0; i &lt; numTris; i++)
+        {
+            data[i*3 + 0] = static_cast&lt;const GLubyte*&gt;(indices)[0];
+            data[i*3 + 1] = static_cast&lt;const GLubyte*&gt;(indices)[i + 1];
+            data[i*3 + 2] = static_cast&lt;const GLubyte*&gt;(indices)[i + 2];
+        }
+        break;
+      case GL_UNSIGNED_SHORT:
+        for (unsigned int i = 0; i &lt; numTris; i++)
+        {
+            data[i*3 + 0] = static_cast&lt;const GLushort*&gt;(indices)[0];
+            data[i*3 + 1] = static_cast&lt;const GLushort*&gt;(indices)[i + 1];
+            data[i*3 + 2] = static_cast&lt;const GLushort*&gt;(indices)[i + 2];
+        }
+        break;
+      case GL_UNSIGNED_INT:
+        for (unsigned int i = 0; i &lt; numTris; i++)
+        {
+            data[i*3 + 0] = static_cast&lt;const GLuint*&gt;(indices)[0];
+            data[i*3 + 1] = static_cast&lt;const GLuint*&gt;(indices)[i + 1];
+            data[i*3 + 2] = static_cast&lt;const GLuint*&gt;(indices)[i + 2];
+        }
+        break;
+      default: UNREACHABLE();
+    }
+
+    error = mTriangleFanIB-&gt;unmapBuffer();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IndexBuffer11 *indexBuffer = GetAs&lt;IndexBuffer11&gt;(mTriangleFanIB-&gt;getIndexBuffer());
+    ID3D11Buffer *d3dIndexBuffer = indexBuffer-&gt;getBuffer();
+    DXGI_FORMAT indexFormat = indexBuffer-&gt;getIndexFormat();
+
+    if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat || mAppliedIBOffset != indexBufferOffset)
+    {
+        mDeviceContext-&gt;IASetIndexBuffer(d3dIndexBuffer, indexFormat, indexBufferOffset);
+        mAppliedIB = d3dIndexBuffer;
+        mAppliedIBFormat = indexFormat;
+        mAppliedIBOffset = indexBufferOffset;
+    }
+
+    if (instances &gt; 0)
+    {
+        mDeviceContext-&gt;DrawIndexedInstanced(numTris * 3, instances, 0, -minIndex, 0);
+    }
+    else
+    {
+        mDeviceContext-&gt;DrawIndexed(numTris * 3, 0, -minIndex);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::applyShaders(gl::Program *program, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
+                                   bool rasterizerDiscard, bool transformFeedbackActive)
+{
+    ProgramD3D *programD3D = GetImplAs&lt;ProgramD3D&gt;(program);
+
+    ShaderExecutableD3D *vertexExe = NULL;
+    gl::Error error = programD3D-&gt;getVertexExecutableForInputLayout(inputLayout, &amp;vertexExe, nullptr);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ShaderExecutableD3D *pixelExe = NULL;
+    error = programD3D-&gt;getPixelExecutableForFramebuffer(framebuffer, &amp;pixelExe);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ShaderExecutableD3D *geometryExe = programD3D-&gt;getGeometryExecutable();
+
+    ID3D11VertexShader *vertexShader = (vertexExe ? GetAs&lt;ShaderExecutable11&gt;(vertexExe)-&gt;getVertexShader() : NULL);
+
+    ID3D11PixelShader *pixelShader = NULL;
+    // Skip pixel shader if we're doing rasterizer discard.
+    if (!rasterizerDiscard)
+    {
+        pixelShader = (pixelExe ? GetAs&lt;ShaderExecutable11&gt;(pixelExe)-&gt;getPixelShader() : NULL);
+    }
+
+    ID3D11GeometryShader *geometryShader = NULL;
+    if (transformFeedbackActive)
+    {
+        geometryShader = (vertexExe ? GetAs&lt;ShaderExecutable11&gt;(vertexExe)-&gt;getStreamOutShader() : NULL);
+    }
+    else if (mCurRasterState.pointDrawMode)
+    {
+        geometryShader = (geometryExe ? GetAs&lt;ShaderExecutable11&gt;(geometryExe)-&gt;getGeometryShader() : NULL);
+    }
+
+    bool dirtyUniforms = false;
+
+    if (reinterpret_cast&lt;uintptr_t&gt;(vertexShader) != mAppliedVertexShader)
+    {
+        mDeviceContext-&gt;VSSetShader(vertexShader, NULL, 0);
+        mAppliedVertexShader = reinterpret_cast&lt;uintptr_t&gt;(vertexShader);
+        dirtyUniforms = true;
+    }
+
+    if (reinterpret_cast&lt;uintptr_t&gt;(geometryShader) != mAppliedGeometryShader)
+    {
+        mDeviceContext-&gt;GSSetShader(geometryShader, NULL, 0);
+        mAppliedGeometryShader = reinterpret_cast&lt;uintptr_t&gt;(geometryShader);
+        dirtyUniforms = true;
+    }
+
+    if (reinterpret_cast&lt;uintptr_t&gt;(pixelShader) != mAppliedPixelShader)
+    {
+        mDeviceContext-&gt;PSSetShader(pixelShader, NULL, 0);
+        mAppliedPixelShader = reinterpret_cast&lt;uintptr_t&gt;(pixelShader);
+        dirtyUniforms = true;
+    }
+
+    if (dirtyUniforms)
+    {
+        programD3D-&gt;dirtyAllUniforms();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::applyUniforms(const ProgramImpl &amp;program, const std::vector&lt;gl::LinkedUniform*&gt; &amp;uniformArray)
+{
+    unsigned int totalRegisterCountVS = 0;
+    unsigned int totalRegisterCountPS = 0;
+
+    bool vertexUniformsDirty = false;
+    bool pixelUniformsDirty = false;
+
+    for (size_t uniformIndex = 0; uniformIndex &lt; uniformArray.size(); uniformIndex++)
+    {
+        const gl::LinkedUniform &amp;uniform = *uniformArray[uniformIndex];
+
+        if (uniform.isReferencedByVertexShader() &amp;&amp; !uniform.isSampler())
+        {
+            totalRegisterCountVS += uniform.registerCount;
+            vertexUniformsDirty = (vertexUniformsDirty || uniform.dirty);
+        }
+
+        if (uniform.isReferencedByFragmentShader() &amp;&amp; !uniform.isSampler())
+        {
+            totalRegisterCountPS += uniform.registerCount;
+            pixelUniformsDirty = (pixelUniformsDirty || uniform.dirty);
+        }
+    }
+
+    const ProgramD3D *programD3D = GetAs&lt;ProgramD3D&gt;(&amp;program);
+    const UniformStorage11 *vertexUniformStorage = GetAs&lt;UniformStorage11&gt;(&amp;programD3D-&gt;getVertexUniformStorage());
+    const UniformStorage11 *fragmentUniformStorage = GetAs&lt;UniformStorage11&gt;(&amp;programD3D-&gt;getFragmentUniformStorage());
+    ASSERT(vertexUniformStorage);
+    ASSERT(fragmentUniformStorage);
+
+    ID3D11Buffer *vertexConstantBuffer = vertexUniformStorage-&gt;getConstantBuffer();
+    ID3D11Buffer *pixelConstantBuffer = fragmentUniformStorage-&gt;getConstantBuffer();
+
+    float (*mapVS)[4] = NULL;
+    float (*mapPS)[4] = NULL;
+
+    if (totalRegisterCountVS &gt; 0 &amp;&amp; vertexUniformsDirty)
+    {
+        D3D11_MAPPED_SUBRESOURCE map = {0};
+        HRESULT result = mDeviceContext-&gt;Map(vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;map);
+        UNUSED_ASSERTION_VARIABLE(result);
+        ASSERT(SUCCEEDED(result));
+        mapVS = (float(*)[4])map.pData;
+    }
+
+    if (totalRegisterCountPS &gt; 0 &amp;&amp; pixelUniformsDirty)
+    {
+        D3D11_MAPPED_SUBRESOURCE map = {0};
+        HRESULT result = mDeviceContext-&gt;Map(pixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;map);
+        UNUSED_ASSERTION_VARIABLE(result);
+        ASSERT(SUCCEEDED(result));
+        mapPS = (float(*)[4])map.pData;
+    }
+
+    for (size_t uniformIndex = 0; uniformIndex &lt; uniformArray.size(); uniformIndex++)
+    {
+        gl::LinkedUniform *uniform = uniformArray[uniformIndex];
+
+        if (!uniform-&gt;isSampler())
+        {
+            unsigned int componentCount = (4 - uniform-&gt;registerElement);
+
+            // we assume that uniforms from structs are arranged in struct order in our uniforms list. otherwise we would
+            // overwrite previously written regions of memory.
+
+            if (uniform-&gt;isReferencedByVertexShader() &amp;&amp; mapVS)
+            {
+                memcpy(&amp;mapVS[uniform-&gt;vsRegisterIndex][uniform-&gt;registerElement], uniform-&gt;data, uniform-&gt;registerCount * sizeof(float) * componentCount);
+            }
+
+            if (uniform-&gt;isReferencedByFragmentShader() &amp;&amp; mapPS)
+            {
+                memcpy(&amp;mapPS[uniform-&gt;psRegisterIndex][uniform-&gt;registerElement], uniform-&gt;data, uniform-&gt;registerCount * sizeof(float) * componentCount);
+            }
+        }
+    }
+
+    if (mapVS)
+    {
+        mDeviceContext-&gt;Unmap(vertexConstantBuffer, 0);
+    }
+
+    if (mapPS)
+    {
+        mDeviceContext-&gt;Unmap(pixelConstantBuffer, 0);
+    }
+
+    if (mCurrentVertexConstantBuffer != vertexConstantBuffer)
+    {
+        mDeviceContext-&gt;VSSetConstantBuffers(0, 1, &amp;vertexConstantBuffer);
+        mCurrentVertexConstantBuffer = vertexConstantBuffer;
+    }
+
+    if (mCurrentPixelConstantBuffer != pixelConstantBuffer)
+    {
+        mDeviceContext-&gt;PSSetConstantBuffers(0, 1, &amp;pixelConstantBuffer);
+        mCurrentPixelConstantBuffer = pixelConstantBuffer;
+    }
+
+    // Driver uniforms
+    if (!mDriverConstantBufferVS)
+    {
+        D3D11_BUFFER_DESC constantBufferDescription = {0};
+        constantBufferDescription.ByteWidth = sizeof(dx_VertexConstants);
+        constantBufferDescription.Usage = D3D11_USAGE_DEFAULT;
+        constantBufferDescription.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+        constantBufferDescription.CPUAccessFlags = 0;
+        constantBufferDescription.MiscFlags = 0;
+        constantBufferDescription.StructureByteStride = 0;
+
+        HRESULT result = mDevice-&gt;CreateBuffer(&amp;constantBufferDescription, NULL, &amp;mDriverConstantBufferVS);
+        UNUSED_ASSERTION_VARIABLE(result);
+        ASSERT(SUCCEEDED(result));
+
+        mDeviceContext-&gt;VSSetConstantBuffers(1, 1, &amp;mDriverConstantBufferVS);
+    }
+
+    if (!mDriverConstantBufferPS)
+    {
+        D3D11_BUFFER_DESC constantBufferDescription = {0};
+        constantBufferDescription.ByteWidth = sizeof(dx_PixelConstants);
+        constantBufferDescription.Usage = D3D11_USAGE_DEFAULT;
+        constantBufferDescription.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+        constantBufferDescription.CPUAccessFlags = 0;
+        constantBufferDescription.MiscFlags = 0;
+        constantBufferDescription.StructureByteStride = 0;
+
+        HRESULT result = mDevice-&gt;CreateBuffer(&amp;constantBufferDescription, NULL, &amp;mDriverConstantBufferPS);
+        UNUSED_ASSERTION_VARIABLE(result);
+        ASSERT(SUCCEEDED(result));
+
+        mDeviceContext-&gt;PSSetConstantBuffers(1, 1, &amp;mDriverConstantBufferPS);
+    }
+
+    if (memcmp(&amp;mVertexConstants, &amp;mAppliedVertexConstants, sizeof(dx_VertexConstants)) != 0)
+    {
+        mDeviceContext-&gt;UpdateSubresource(mDriverConstantBufferVS, 0, NULL, &amp;mVertexConstants, 16, 0);
+        memcpy(&amp;mAppliedVertexConstants, &amp;mVertexConstants, sizeof(dx_VertexConstants));
+    }
+
+    if (memcmp(&amp;mPixelConstants, &amp;mAppliedPixelConstants, sizeof(dx_PixelConstants)) != 0)
+    {
+        mDeviceContext-&gt;UpdateSubresource(mDriverConstantBufferPS, 0, NULL, &amp;mPixelConstants, 16, 0);
+        memcpy(&amp;mAppliedPixelConstants, &amp;mPixelConstants, sizeof(dx_PixelConstants));
+    }
+
+    // GSSetConstantBuffers triggers device removal on 9_3, so we should only call it if necessary
+    if (programD3D-&gt;usesGeometryShader())
+    {
+        // needed for the point sprite geometry shader
+        if (mCurrentGeometryConstantBuffer != mDriverConstantBufferPS)
+        {
+            mDeviceContext-&gt;GSSetConstantBuffers(0, 1, &amp;mDriverConstantBufferPS);
+            mCurrentGeometryConstantBuffer = mDriverConstantBufferPS;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer11::markAllStateDirty()
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Renderer11::markAllStateDirty&quot;);
+
+    for (size_t rtIndex = 0; rtIndex &lt; ArraySize(mAppliedRTVs); rtIndex++)
+    {
+        mAppliedRTVs[rtIndex] = DirtyPointer;
+    }
+    mAppliedDSV = DirtyPointer;
+    mDepthStencilInitialized = false;
+    mRenderTargetDescInitialized = false;
+
+    // We reset the current SRV data because it might not be in sync with D3D's state
+    // anymore. For example when a currently used SRV is used as an RTV, D3D silently
+    // remove it from its state.
+    memset(mCurVertexSRVs.data(), 0, sizeof(SRVRecord) * mCurVertexSRVs.size());
+    memset(mCurPixelSRVs.data(), 0, sizeof(SRVRecord) * mCurPixelSRVs.size());
+
+    ASSERT(mForceSetVertexSamplerStates.size() == mCurVertexSRVs.size());
+    for (size_t vsamplerId = 0; vsamplerId &lt; mForceSetVertexSamplerStates.size(); ++vsamplerId)
+    {
+        mForceSetVertexSamplerStates[vsamplerId] = true;
+    }
+
+    ASSERT(mForceSetPixelSamplerStates.size() == mCurPixelSRVs.size());
+    for (size_t fsamplerId = 0; fsamplerId &lt; mForceSetPixelSamplerStates.size(); ++fsamplerId)
+    {
+        mForceSetPixelSamplerStates[fsamplerId] = true;
+    }
+
+    mForceSetBlendState = true;
+    mForceSetRasterState = true;
+    mForceSetDepthStencilState = true;
+    mForceSetScissor = true;
+    mForceSetViewport = true;
+
+    mAppliedIB = NULL;
+    mAppliedIBFormat = DXGI_FORMAT_UNKNOWN;
+    mAppliedIBOffset = 0;
+
+    mAppliedVertexShader = DirtyPointer;
+    mAppliedGeometryShader = DirtyPointer;
+    mAppliedPixelShader = DirtyPointer;
+
+    mAppliedNumXFBBindings = static_cast&lt;size_t&gt;(-1);
+
+    for (size_t i = 0; i &lt; gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
+    {
+        mAppliedTFBuffers[i] = NULL;
+        mAppliedTFOffsets[i] = 0;
+    }
+
+    memset(&amp;mAppliedVertexConstants, 0, sizeof(dx_VertexConstants));
+    memset(&amp;mAppliedPixelConstants, 0, sizeof(dx_PixelConstants));
+
+    mInputLayoutCache.markDirty();
+
+    for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; i++)
+    {
+        mCurrentConstantBufferVS[i] = static_cast&lt;unsigned int&gt;(-1);
+        mCurrentConstantBufferVSOffset[i] = 0;
+        mCurrentConstantBufferVSSize[i] = 0;
+        mCurrentConstantBufferPS[i] = static_cast&lt;unsigned int&gt;(-1);
+        mCurrentConstantBufferPSOffset[i] = 0;
+        mCurrentConstantBufferPSSize[i] = 0;
+    }
+
+    mCurrentVertexConstantBuffer = NULL;
+    mCurrentPixelConstantBuffer = NULL;
+    mCurrentGeometryConstantBuffer = NULL;
+
+    mCurrentPrimitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
+}
+
+void Renderer11::releaseDeviceResources()
+{
+    mStateCache.clear();
+    mInputLayoutCache.clear();
+
+    SafeDelete(mVertexDataManager);
+    SafeDelete(mIndexDataManager);
+    SafeDelete(mLineLoopIB);
+    SafeDelete(mTriangleFanIB);
+    SafeDelete(mBlit);
+    SafeDelete(mClear);
+    SafeDelete(mTrim);
+    SafeDelete(mPixelTransfer);
+
+    SafeRelease(mDriverConstantBufferVS);
+    SafeRelease(mDriverConstantBufferPS);
+    SafeRelease(mSyncQuery);
+}
+
+// set notify to true to broadcast a message to all contexts of the device loss
+bool Renderer11::testDeviceLost()
+{
+    bool isLost = false;
+
+    // GetRemovedReason is used to test if the device is removed
+    HRESULT result = mDevice-&gt;GetDeviceRemovedReason();
+    isLost = d3d11::isDeviceLostError(result);
+
+    if (isLost)
+    {
+        // Log error if this is a new device lost event
+        if (mDeviceLost == false)
+        {
+            ERR(&quot;The D3D11 device was removed: 0x%08X&quot;, result);
+        }
+
+        // ensure we note the device loss --
+        // we'll probably get this done again by notifyDeviceLost
+        // but best to remember it!
+        // Note that we don't want to clear the device loss status here
+        // -- this needs to be done by resetDevice
+        mDeviceLost = true;
+    }
+
+    return isLost;
+}
+
+bool Renderer11::testDeviceResettable()
+{
+    // determine if the device is resettable by creating a dummy device
+    PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, &quot;D3D11CreateDevice&quot;);
+
+    if (D3D11CreateDevice == NULL)
+    {
+        return false;
+    }
+
+    ID3D11Device* dummyDevice;
+    D3D_FEATURE_LEVEL dummyFeatureLevel;
+    ID3D11DeviceContext* dummyContext;
+
+    HRESULT result = D3D11CreateDevice(NULL,
+                                       mDriverType,
+                                       NULL,
+                                       #if defined(_DEBUG)
+                                       D3D11_CREATE_DEVICE_DEBUG,
+                                       #else
+                                       0,
+                                       #endif
+                                       mAvailableFeatureLevels.data(),
+                                       mAvailableFeatureLevels.size(),
+                                       D3D11_SDK_VERSION,
+                                       &amp;dummyDevice,
+                                       &amp;dummyFeatureLevel,
+                                       &amp;dummyContext);
+
+    if (!mDevice || FAILED(result))
+    {
+        return false;
+    }
+
+    SafeRelease(dummyContext);
+    SafeRelease(dummyDevice);
+
+    return true;
+}
+
+void Renderer11::release()
+{
+    RendererD3D::cleanup();
+
+    releaseDeviceResources();
+
+    SafeRelease(mDxgiFactory);
+    SafeRelease(mDxgiAdapter);
+
+    SafeRelease(mDeviceContext1);
+
+    if (mDeviceContext)
+    {
+        mDeviceContext-&gt;ClearState();
+        mDeviceContext-&gt;Flush();
+        SafeRelease(mDeviceContext);
+    }
+
+    SafeRelease(mDevice);
+    SafeRelease(mDebug);
+
+    if (mD3d11Module)
+    {
+        FreeLibrary(mD3d11Module);
+        mD3d11Module = NULL;
+    }
+
+    if (mDxgiModule)
+    {
+        FreeLibrary(mDxgiModule);
+        mDxgiModule = NULL;
+    }
+
+    mCompiler.release();
+}
+
+bool Renderer11::resetDevice()
+{
+    // recreate everything
+    release();
+    egl::Error result = initialize();
+
+    if (result.isError())
+    {
+        ERR(&quot;Could not reinitialize D3D11 device: %08X&quot;, result.getCode());
+        return false;
+    }
+
+    mDeviceLost = false;
+
+    return true;
+}
+
+VendorID Renderer11::getVendorId() const
+{
+    return static_cast&lt;VendorID&gt;(mAdapterDescription.VendorId);
+}
+
+std::string Renderer11::getRendererDescription() const
+{
+    std::ostringstream rendererString;
+
+    rendererString &lt;&lt; mDescription;
+    rendererString &lt;&lt; &quot; Direct3D11&quot;;
+
+    rendererString &lt;&lt; &quot; vs_&quot; &lt;&lt; getMajorShaderModel() &lt;&lt; &quot;_&quot; &lt;&lt; getMinorShaderModel() &lt;&lt; getShaderModelSuffix();
+    rendererString &lt;&lt; &quot; ps_&quot; &lt;&lt; getMajorShaderModel() &lt;&lt; &quot;_&quot; &lt;&lt; getMinorShaderModel() &lt;&lt; getShaderModelSuffix();
+
+    return rendererString.str();
+}
+
+GUID Renderer11::getAdapterIdentifier() const
+{
+    // Use the adapter LUID as our adapter ID
+    // This number is local to a machine is only guaranteed to be unique between restarts
+    static_assert(sizeof(LUID) &lt;= sizeof(GUID), &quot;Size of GUID must be at least as large as LUID.&quot;);
+    GUID adapterId = {0};
+    memcpy(&amp;adapterId, &amp;mAdapterDescription.AdapterLuid, sizeof(LUID));
+    return adapterId;
+}
+
+unsigned int Renderer11::getReservedVertexUniformVectors() const
+{
+    return 0;   // Driver uniforms are stored in a separate constant buffer
+}
+
+unsigned int Renderer11::getReservedFragmentUniformVectors() const
+{
+    return 0;   // Driver uniforms are stored in a separate constant buffer
+}
+
+unsigned int Renderer11::getReservedVertexUniformBuffers() const
+{
+    // we reserve one buffer for the application uniforms, and one for driver uniforms
+    return 2;
+}
+
+unsigned int Renderer11::getReservedFragmentUniformBuffers() const
+{
+    // we reserve one buffer for the application uniforms, and one for driver uniforms
+    return 2;
+}
+
+bool Renderer11::getShareHandleSupport() const
+{
+    // We only currently support share handles with BGRA surfaces, because
+    // chrome needs BGRA. Once chrome fixes this, we should always support them.
+    if (!getRendererExtensions().textureFormatBGRA8888)
+    {
+        return false;
+    }
+
+    // PIX doesn't seem to support using share handles, so disable them.
+    if (gl::DebugAnnotationsActive())
+    {
+        return false;
+    }
+
+    // Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains.
+    if (mFeatureLevel &lt;= D3D_FEATURE_LEVEL_9_3)
+    {
+        return false;
+    }
+
+    // Also disable on non-hardware drivers, since sharing doesn't work cross-driver.
+    if (mDriverType != D3D_DRIVER_TYPE_HARDWARE)
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool Renderer11::getPostSubBufferSupport() const
+{
+    // D3D11 does not support present with dirty rectangles until D3D11.1 and DXGI 1.2.
+    return false;
+}
+
+int Renderer11::getMajorShaderModel() const
+{
+    switch (mFeatureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION;   // 5
+      case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MAJOR_VERSION; // 4
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION;   // 4
+      case D3D_FEATURE_LEVEL_9_3:  return D3D10_SHADER_MAJOR_VERSION;   // 4
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+int Renderer11::getMinorShaderModel() const
+{
+    switch (mFeatureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MINOR_VERSION;   // 0
+      case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MINOR_VERSION; // 1
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MINOR_VERSION;   // 0
+      case D3D_FEATURE_LEVEL_9_3:  return D3D10_SHADER_MINOR_VERSION;   // 0
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+std::string Renderer11::getShaderModelSuffix() const
+{
+    switch (mFeatureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_0: return &quot;&quot;;
+      case D3D_FEATURE_LEVEL_10_1: return &quot;&quot;;
+      case D3D_FEATURE_LEVEL_10_0: return &quot;&quot;;
+      case D3D_FEATURE_LEVEL_9_3:  return &quot;_level_9_3&quot;;
+      default: UNREACHABLE();      return &quot;&quot;;
+    }
+}
+
+gl::Error Renderer11::copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                  const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level)
+{
+    const gl::FramebufferAttachment *colorbuffer = framebuffer-&gt;getReadColorbuffer();
+    ASSERT(colorbuffer);
+
+    RenderTarget11 *sourceRenderTarget = NULL;
+    gl::Error error = colorbuffer-&gt;getRenderTarget(&amp;sourceRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(sourceRenderTarget);
+
+    ID3D11ShaderResourceView *source = sourceRenderTarget-&gt;getShaderResourceView();
+    ASSERT(source);
+
+    TextureStorage11_2D *storage11 = GetAs&lt;TextureStorage11_2D&gt;(storage);
+    ASSERT(storage11);
+
+    gl::ImageIndex index = gl::ImageIndex::Make2D(level);
+    RenderTargetD3D *destRenderTarget = NULL;
+    error = storage11-&gt;getRenderTarget(index, &amp;destRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(destRenderTarget);
+
+    ID3D11RenderTargetView *dest = GetAs&lt;RenderTarget11&gt;(destRenderTarget)-&gt;getRenderTargetView();
+    ASSERT(dest);
+
+    gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents sourceSize(sourceRenderTarget-&gt;getWidth(), sourceRenderTarget-&gt;getHeight(), 1);
+
+    gl::Box destArea(destOffset.x, destOffset.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents destSize(destRenderTarget-&gt;getWidth(), destRenderTarget-&gt;getHeight(), 1);
+
+    // Use nearest filtering because source and destination are the same size for the direct
+    // copy
+    mBlit-&gt;copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, destFormat, GL_NEAREST);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    storage11-&gt;invalidateSwizzleCacheLevel(level);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::copyImageCube(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                    const gl::Offset &amp;destOffset, TextureStorage *storage, GLenum target, GLint level)
+{
+    const gl::FramebufferAttachment *colorbuffer = framebuffer-&gt;getReadColorbuffer();
+    ASSERT(colorbuffer);
+
+    RenderTarget11 *sourceRenderTarget = NULL;
+    gl::Error error = colorbuffer-&gt;getRenderTarget(&amp;sourceRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(sourceRenderTarget);
+
+    ID3D11ShaderResourceView *source = sourceRenderTarget-&gt;getShaderResourceView();
+    ASSERT(source);
+
+    TextureStorage11_Cube *storage11 = GetAs&lt;TextureStorage11_Cube&gt;(storage);
+    ASSERT(storage11);
+
+    gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+    RenderTargetD3D *destRenderTarget = NULL;
+    error = storage11-&gt;getRenderTarget(index, &amp;destRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(destRenderTarget);
+
+    ID3D11RenderTargetView *dest = GetAs&lt;RenderTarget11&gt;(destRenderTarget)-&gt;getRenderTargetView();
+    ASSERT(dest);
+
+    gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents sourceSize(sourceRenderTarget-&gt;getWidth(), sourceRenderTarget-&gt;getHeight(), 1);
+
+    gl::Box destArea(destOffset.x, destOffset.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents destSize(destRenderTarget-&gt;getWidth(), destRenderTarget-&gt;getHeight(), 1);
+
+    // Use nearest filtering because source and destination are the same size for the direct
+    // copy
+    error = mBlit-&gt;copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, destFormat, GL_NEAREST);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    storage11-&gt;invalidateSwizzleCacheLevel(level);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::copyImage3D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                  const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level)
+{
+    const gl::FramebufferAttachment *colorbuffer = framebuffer-&gt;getReadColorbuffer();
+    ASSERT(colorbuffer);
+
+    RenderTarget11 *sourceRenderTarget = NULL;
+    gl::Error error = colorbuffer-&gt;getRenderTarget(&amp;sourceRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(sourceRenderTarget);
+
+    ID3D11ShaderResourceView *source = sourceRenderTarget-&gt;getShaderResourceView();
+    ASSERT(source);
+
+    TextureStorage11_3D *storage11 = GetAs&lt;TextureStorage11_3D&gt;(storage);
+    ASSERT(storage11);
+
+    gl::ImageIndex index = gl::ImageIndex::Make3D(level, destOffset.z);
+    RenderTargetD3D *destRenderTarget = NULL;
+    error = storage11-&gt;getRenderTarget(index, &amp;destRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(destRenderTarget);
+
+    ID3D11RenderTargetView *dest = GetAs&lt;RenderTarget11&gt;(destRenderTarget)-&gt;getRenderTargetView();
+    ASSERT(dest);
+
+    gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents sourceSize(sourceRenderTarget-&gt;getWidth(), sourceRenderTarget-&gt;getHeight(), 1);
+
+    gl::Box destArea(destOffset.x, destOffset.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents destSize(destRenderTarget-&gt;getWidth(), destRenderTarget-&gt;getHeight(), 1);
+
+    // Use nearest filtering because source and destination are the same size for the direct
+    // copy
+    error = mBlit-&gt;copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, destFormat, GL_NEAREST);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    storage11-&gt;invalidateSwizzleCacheLevel(level);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::copyImage2DArray(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                       const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level)
+{
+    const gl::FramebufferAttachment *colorbuffer = framebuffer-&gt;getReadColorbuffer();
+    ASSERT(colorbuffer);
+
+    RenderTarget11 *sourceRenderTarget = NULL;
+    gl::Error error = colorbuffer-&gt;getRenderTarget(&amp;sourceRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(sourceRenderTarget);
+
+    ID3D11ShaderResourceView *source = sourceRenderTarget-&gt;getShaderResourceView();
+    ASSERT(source);
+
+    TextureStorage11_2DArray *storage11 = GetAs&lt;TextureStorage11_2DArray&gt;(storage);
+    ASSERT(storage11);
+
+    gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z);
+    RenderTargetD3D *destRenderTarget = NULL;
+    error = storage11-&gt;getRenderTarget(index, &amp;destRenderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(destRenderTarget);
+
+    ID3D11RenderTargetView *dest = GetAs&lt;RenderTarget11&gt;(destRenderTarget)-&gt;getRenderTargetView();
+    ASSERT(dest);
+
+    gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents sourceSize(sourceRenderTarget-&gt;getWidth(), sourceRenderTarget-&gt;getHeight(), 1);
+
+    gl::Box destArea(destOffset.x, destOffset.y, 0, sourceRect.width, sourceRect.height, 1);
+    gl::Extents destSize(destRenderTarget-&gt;getWidth(), destRenderTarget-&gt;getHeight(), 1);
+
+    // Use nearest filtering because source and destination are the same size for the direct
+    // copy
+    error = mBlit-&gt;copyTexture(source, sourceArea, sourceSize, dest, destArea, destSize, NULL, destFormat, GL_NEAREST);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    storage11-&gt;invalidateSwizzleCacheLevel(level);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer11::unapplyRenderTargets()
+{
+    setOneTimeRenderTarget(NULL);
+}
+
+// When finished with this rendertarget, markAllStateDirty must be called.
+void Renderer11::setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView)
+{
+    ID3D11RenderTargetView *rtvArray[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS] = {NULL};
+
+    rtvArray[0] = renderTargetView;
+
+    mDeviceContext-&gt;OMSetRenderTargets(getRendererCaps().maxDrawBuffers, rtvArray, NULL);
+
+    // Do not preserve the serial for this one-time-use render target
+    for (size_t rtIndex = 0; rtIndex &lt; ArraySize(mAppliedRTVs); rtIndex++)
+    {
+        mAppliedRTVs[rtIndex] = DirtyPointer;
+    }
+    mAppliedDSV = DirtyPointer;
+}
+
+gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT)
+{
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(format, mFeatureLevel);
+
+    const gl::TextureCaps &amp;textureCaps = getRendererTextureCaps().get(format);
+    GLuint supportedSamples = textureCaps.getNearestSamples(samples);
+
+    if (width &gt; 0 &amp;&amp; height &gt; 0)
+    {
+        // Create texture resource
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = width;
+        desc.Height = height;
+        desc.MipLevels = 1;
+        desc.ArraySize = 1;
+        desc.Format = formatInfo.texFormat;
+        desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = 0;
+
+        // If a rendertarget or depthstencil format exists for this texture format,
+        // we'll flag it to allow binding that way. Shader resource views are a little
+        // more complicated.
+        bool bindRTV = false, bindDSV = false, bindSRV = false;
+        bindRTV = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
+        bindDSV = (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
+        if (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            // Multisample targets flagged for binding as depth stencil cannot also be
+            // flagged for binding as SRV, so make certain not to add the SRV flag for
+            // these targets.
+            bindSRV = !(formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN &amp;&amp; desc.SampleDesc.Count &gt; 1);
+        }
+
+        desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET   : 0) |
+                         (bindDSV ? D3D11_BIND_DEPTH_STENCIL   : 0) |
+                         (bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0);
+
+        // The format must be either an RTV or a DSV
+        ASSERT(bindRTV != bindDSV);
+
+        ID3D11Texture2D *texture = NULL;
+        HRESULT result = mDevice-&gt;CreateTexture2D(&amp;desc, NULL, &amp;texture);
+        if (FAILED(result))
+        {
+            ASSERT(result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create render target texture, result: 0x%X.&quot;, result);
+        }
+
+        ID3D11ShaderResourceView *srv = NULL;
+        if (bindSRV)
+        {
+            D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+            srvDesc.Format = formatInfo.srvFormat;
+            srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+            srvDesc.Texture2D.MostDetailedMip = 0;
+            srvDesc.Texture2D.MipLevels = 1;
+
+            result = mDevice-&gt;CreateShaderResourceView(texture, &amp;srvDesc, &amp;srv);
+            if (FAILED(result))
+            {
+                ASSERT(result == E_OUTOFMEMORY);
+                SafeRelease(texture);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create render target shader resource view, result: 0x%X.&quot;, result);
+            }
+        }
+
+        if (bindDSV)
+        {
+            D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+            dsvDesc.Format = formatInfo.dsvFormat;
+            dsvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_DSV_DIMENSION_TEXTURE2D : D3D11_DSV_DIMENSION_TEXTURE2DMS;
+            dsvDesc.Texture2D.MipSlice = 0;
+            dsvDesc.Flags = 0;
+
+            ID3D11DepthStencilView *dsv = NULL;
+            result = mDevice-&gt;CreateDepthStencilView(texture, &amp;dsvDesc, &amp;dsv);
+            if (FAILED(result))
+            {
+                ASSERT(result == E_OUTOFMEMORY);
+                SafeRelease(texture);
+                SafeRelease(srv);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create render target depth stencil view, result: 0x%X.&quot;, result);
+            }
+
+            *outRT = new TextureRenderTarget11(dsv, texture, srv, format, width, height, 1, supportedSamples);
+
+            SafeRelease(dsv);
+        }
+        else if (bindRTV)
+        {
+            D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+            rtvDesc.Format = formatInfo.rtvFormat;
+            rtvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_RTV_DIMENSION_TEXTURE2D : D3D11_RTV_DIMENSION_TEXTURE2DMS;
+            rtvDesc.Texture2D.MipSlice = 0;
+
+            ID3D11RenderTargetView *rtv = NULL;
+            result = mDevice-&gt;CreateRenderTargetView(texture, &amp;rtvDesc, &amp;rtv);
+            if (FAILED(result))
+            {
+                ASSERT(result == E_OUTOFMEMORY);
+                SafeRelease(texture);
+                SafeRelease(srv);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create render target render target view, result: 0x%X.&quot;, result);
+            }
+
+            if (formatInfo.dataInitializerFunction != NULL)
+            {
+                const float clearValues[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
+                mDeviceContext-&gt;ClearRenderTargetView(rtv, clearValues);
+            }
+
+            *outRT = new TextureRenderTarget11(rtv, texture, srv, format, width, height, 1, supportedSamples);
+
+            SafeRelease(rtv);
+        }
+        else
+        {
+            UNREACHABLE();
+        }
+
+        SafeRelease(texture);
+        SafeRelease(srv);
+    }
+    else
+    {
+        *outRT = new TextureRenderTarget11(reinterpret_cast&lt;ID3D11RenderTargetView*&gt;(NULL), NULL, NULL, format, width, height, 1, supportedSamples);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+FramebufferImpl *Renderer11::createDefaultFramebuffer(const gl::Framebuffer::Data &amp;data)
+{
+    return createFramebuffer(data);
+}
+
+FramebufferImpl *Renderer11::createFramebuffer(const gl::Framebuffer::Data &amp;data)
+{
+    return new Framebuffer11(data, this);
+}
+
+CompilerImpl *Renderer11::createCompiler(const gl::Data &amp;data)
+{
+    return new CompilerD3D(data, SH_HLSL11_OUTPUT);
+}
+
+ShaderImpl *Renderer11::createShader(GLenum type)
+{
+    return new ShaderD3D(type);
+}
+
+ProgramImpl *Renderer11::createProgram()
+{
+    return new ProgramD3D(this);
+}
+
+gl::Error Renderer11::loadExecutable(const void *function, size_t length, ShaderType type,
+                                     const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                     bool separatedOutputBuffers, ShaderExecutableD3D **outExecutable)
+{
+    switch (type)
+    {
+      case SHADER_VERTEX:
+        {
+            ID3D11VertexShader *vertexShader = NULL;
+            ID3D11GeometryShader *streamOutShader = NULL;
+
+            HRESULT result = mDevice-&gt;CreateVertexShader(function, length, NULL, &amp;vertexShader);
+            ASSERT(SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create vertex shader, result: 0x%X.&quot;, result);
+            }
+
+            if (transformFeedbackVaryings.size() &gt; 0)
+            {
+                std::vector&lt;D3D11_SO_DECLARATION_ENTRY&gt; soDeclaration;
+                for (size_t i = 0; i &lt; transformFeedbackVaryings.size(); i++)
+                {
+                    const gl::LinkedVarying &amp;varying = transformFeedbackVaryings[i];
+                    GLenum transposedType = gl::TransposeMatrixType(varying.type);
+
+                    for (size_t j = 0; j &lt; varying.semanticIndexCount; j++)
+                    {
+                        D3D11_SO_DECLARATION_ENTRY entry = { 0 };
+                        entry.Stream = 0;
+                        entry.SemanticName = varying.semanticName.c_str();
+                        entry.SemanticIndex = varying.semanticIndex + j;
+                        entry.StartComponent = 0;
+                        entry.ComponentCount = static_cast&lt;BYTE&gt;(gl::VariableColumnCount(transposedType));
+                        entry.OutputSlot = static_cast&lt;BYTE&gt;((separatedOutputBuffers ? i : 0));
+                        soDeclaration.push_back(entry);
+                    }
+                }
+
+                result = mDevice-&gt;CreateGeometryShaderWithStreamOutput(function, length, soDeclaration.data(), soDeclaration.size(),
+                                                                       NULL, 0, 0, NULL, &amp;streamOutShader);
+                ASSERT(SUCCEEDED(result));
+                if (FAILED(result))
+                {
+                    return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create steam output shader, result: 0x%X.&quot;, result);
+                }
+            }
+
+            *outExecutable = new ShaderExecutable11(function, length, vertexShader, streamOutShader);
+        }
+        break;
+      case SHADER_PIXEL:
+        {
+            ID3D11PixelShader *pixelShader = NULL;
+
+            HRESULT result = mDevice-&gt;CreatePixelShader(function, length, NULL, &amp;pixelShader);
+            ASSERT(SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create pixel shader, result: 0x%X.&quot;, result);
+            }
+
+            *outExecutable = new ShaderExecutable11(function, length, pixelShader);
+        }
+        break;
+      case SHADER_GEOMETRY:
+        {
+            ID3D11GeometryShader *geometryShader = NULL;
+
+            HRESULT result = mDevice-&gt;CreateGeometryShader(function, length, NULL, &amp;geometryShader);
+            ASSERT(SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create geometry shader, result: 0x%X.&quot;, result);
+            }
+
+            *outExecutable = new ShaderExecutable11(function, length, geometryShader);
+        }
+        break;
+      default:
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::compileToExecutable(gl::InfoLog &amp;infoLog, const std::string &amp;shaderHLSL, ShaderType type,
+                                          const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                          bool separatedOutputBuffers, const D3DCompilerWorkarounds &amp;workarounds,
+                                          ShaderExecutableD3D **outExectuable)
+{
+    const char *profileType = NULL;
+    switch (type)
+    {
+      case SHADER_VERTEX:
+        profileType = &quot;vs&quot;;
+        break;
+      case SHADER_PIXEL:
+        profileType = &quot;ps&quot;;
+        break;
+      case SHADER_GEOMETRY:
+        profileType = &quot;gs&quot;;
+        break;
+      default:
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION);
+    }
+
+    std::string profile = FormatString(&quot;%s_%d_%d%s&quot;, profileType, getMajorShaderModel(), getMinorShaderModel(), getShaderModelSuffix().c_str());
+
+    UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2;
+
+    if (gl::DebugAnnotationsActive())
+    {
+#ifndef NDEBUG
+        flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+#endif
+
+        flags |= D3DCOMPILE_DEBUG;
+    }
+
+    if (workarounds.enableIEEEStrictness)
+        flags |= D3DCOMPILE_IEEE_STRICTNESS;
+
+    // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
+    // Try the default flags first and if compilation fails, try some alternatives.
+    std::vector&lt;CompileConfig&gt; configs;
+    configs.push_back(CompileConfig(flags,                                &quot;default&quot;          ));
+    configs.push_back(CompileConfig(flags | D3DCOMPILE_SKIP_VALIDATION,   &quot;skip validation&quot;  ));
+    configs.push_back(CompileConfig(flags | D3DCOMPILE_SKIP_OPTIMIZATION, &quot;skip optimization&quot;));
+
+    D3D_SHADER_MACRO loopMacros[] = { {&quot;ANGLE_ENABLE_LOOP_FLATTEN&quot;, &quot;1&quot;}, {0, 0} };
+
+    ID3DBlob *binary = NULL;
+    std::string debugInfo;
+    gl::Error error = mCompiler.compileToBinary(infoLog, shaderHLSL, profile, configs, loopMacros, &amp;binary, &amp;debugInfo);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // It's possible that binary is NULL if the compiler failed in all configurations.  Set the executable to NULL
+    // and return GL_NO_ERROR to signify that there was a link error but the internal state is still OK.
+    if (!binary)
+    {
+        *outExectuable = NULL;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    error = loadExecutable(binary-&gt;GetBufferPointer(), binary-&gt;GetBufferSize(), type,
+                           transformFeedbackVaryings, separatedOutputBuffers, outExectuable);
+
+    SafeRelease(binary);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!debugInfo.empty())
+    {
+        (*outExectuable)-&gt;appendDebugInfo(debugInfo);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+UniformStorageD3D *Renderer11::createUniformStorage(size_t storageSize)
+{
+    return new UniformStorage11(this, storageSize);
+}
+
+VertexBuffer *Renderer11::createVertexBuffer()
+{
+    return new VertexBuffer11(this);
+}
+
+IndexBuffer *Renderer11::createIndexBuffer()
+{
+    return new IndexBuffer11(this);
+}
+
+BufferImpl *Renderer11::createBuffer()
+{
+    return new Buffer11(this);
+}
+
+VertexArrayImpl *Renderer11::createVertexArray()
+{
+    return new VertexArray11(this);
+}
+
+QueryImpl *Renderer11::createQuery(GLenum type)
+{
+    return new Query11(this, type);
+}
+
+FenceNVImpl *Renderer11::createFenceNV()
+{
+    return new FenceNV11(this);
+}
+
+FenceSyncImpl *Renderer11::createFenceSync()
+{
+    return new FenceSync11(this);
+}
+
+TransformFeedbackImpl* Renderer11::createTransformFeedback()
+{
+    return new TransformFeedbackD3D();
+}
+
+bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
+{
+    ASSERT(getRendererExtensions().pixelBufferObject);
+
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+    const d3d11::TextureFormat &amp;d3d11FormatInfo = d3d11::GetTextureFormatInfo(internalFormat, mFeatureLevel);
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(d3d11FormatInfo.texFormat);
+
+    // sRGB formats do not work with D3D11 buffer SRVs
+    if (internalFormatInfo.colorEncoding == GL_SRGB)
+    {
+        return false;
+    }
+
+    // We cannot support direct copies to non-color-renderable formats
+    if (d3d11FormatInfo.rtvFormat == DXGI_FORMAT_UNKNOWN)
+    {
+        return false;
+    }
+
+    // We skip all 3-channel formats since sometimes format support is missing
+    if (internalFormatInfo.componentCount == 3)
+    {
+        return false;
+    }
+
+    // We don't support formats which we can't represent without conversion
+    if (dxgiFormatInfo.internalFormat != internalFormat)
+    {
+        return false;
+    }
+
+    return true;
+}
+
+gl::Error Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &amp;unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+                                              GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &amp;destArea)
+{
+    ASSERT(supportsFastCopyBufferToTexture(destinationFormat));
+    return mPixelTransfer-&gt;copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea);
+}
+
+ImageD3D *Renderer11::createImage()
+{
+    return new Image11(this);
+}
+
+gl::Error Renderer11::generateMipmap(ImageD3D *dest, ImageD3D *src)
+{
+    Image11 *dest11 = GetAs&lt;Image11&gt;(dest);
+    Image11 *src11 = GetAs&lt;Image11&gt;(src);
+    return Image11::generateMipmap(dest11, src11);
+}
+
+gl::Error Renderer11::generateMipmapsUsingD3D(TextureStorage *storage, const gl::SamplerState &amp;samplerState)
+{
+    TextureStorage11 *storage11 = GetAs&lt;TextureStorage11&gt;(storage);
+
+    ASSERT(storage11-&gt;isRenderTarget());
+    ASSERT(storage11-&gt;supportsNativeMipmapFunction());
+
+    ID3D11ShaderResourceView *srv;
+    gl::Error error = storage11-&gt;getSRVLevels(samplerState.baseLevel, samplerState.maxLevel, &amp;srv);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mDeviceContext-&gt;GenerateMips(srv);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+TextureStorage *Renderer11::createTextureStorage2D(SwapChainD3D *swapChain)
+{
+    SwapChain11 *swapChain11 = GetAs&lt;SwapChain11&gt;(swapChain);
+    return new TextureStorage11_2D(this, swapChain11);
+}
+
+TextureStorage *Renderer11::createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly)
+{
+    return new TextureStorage11_2D(this, internalformat, renderTarget, width, height, levels, hintLevelZeroOnly);
+}
+
+TextureStorage *Renderer11::createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly)
+{
+    return new TextureStorage11_Cube(this, internalformat, renderTarget, size, levels, hintLevelZeroOnly);
+}
+
+TextureStorage *Renderer11::createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+    return new TextureStorage11_3D(this, internalformat, renderTarget, width, height, depth, levels);
+}
+
+TextureStorage *Renderer11::createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+    return new TextureStorage11_2DArray(this, internalformat, renderTarget, width, height, depth, levels);
+}
+
+TextureImpl *Renderer11::createTexture(GLenum target)
+{
+    switch(target)
+    {
+      case GL_TEXTURE_2D: return new TextureD3D_2D(this);
+      case GL_TEXTURE_CUBE_MAP: return new TextureD3D_Cube(this);
+      case GL_TEXTURE_3D: return new TextureD3D_3D(this);
+      case GL_TEXTURE_2D_ARRAY: return new TextureD3D_2DArray(this);
+      default:
+        UNREACHABLE();
+    }
+
+    return NULL;
+}
+
+RenderbufferImpl *Renderer11::createRenderbuffer()
+{
+    RenderbufferD3D *renderbuffer = new RenderbufferD3D(this);
+    return renderbuffer;
+}
+
+gl::Error Renderer11::readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &amp;area, GLenum format,
+                                      GLenum type, GLuint outputPitch, const gl::PixelPackState &amp;pack, uint8_t *pixels)
+{
+    ASSERT(area.width &gt;= 0);
+    ASSERT(area.height &gt;= 0);
+
+    D3D11_TEXTURE2D_DESC textureDesc;
+    texture-&gt;GetDesc(&amp;textureDesc);
+
+    // Clamp read region to the defined texture boundaries, preventing out of bounds reads
+    // and reads of uninitialized data.
+    gl::Rectangle safeArea;
+    safeArea.x      = gl::clamp(area.x, 0, static_cast&lt;int&gt;(textureDesc.Width));
+    safeArea.y      = gl::clamp(area.y, 0, static_cast&lt;int&gt;(textureDesc.Height));
+    safeArea.width  = gl::clamp(area.width + std::min(area.x, 0), 0,
+                                static_cast&lt;int&gt;(textureDesc.Width) - safeArea.x);
+    safeArea.height = gl::clamp(area.height + std::min(area.y, 0), 0,
+                                static_cast&lt;int&gt;(textureDesc.Height) - safeArea.y);
+
+    ASSERT(safeArea.x &gt;= 0 &amp;&amp; safeArea.y &gt;= 0);
+    ASSERT(safeArea.x + safeArea.width  &lt;= static_cast&lt;int&gt;(textureDesc.Width));
+    ASSERT(safeArea.y + safeArea.height &lt;= static_cast&lt;int&gt;(textureDesc.Height));
+
+    if (safeArea.width == 0 || safeArea.height == 0)
+    {
+        // no work to do
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    D3D11_TEXTURE2D_DESC stagingDesc;
+    stagingDesc.Width = safeArea.width;
+    stagingDesc.Height = safeArea.height;
+    stagingDesc.MipLevels = 1;
+    stagingDesc.ArraySize = 1;
+    stagingDesc.Format = textureDesc.Format;
+    stagingDesc.SampleDesc.Count = 1;
+    stagingDesc.SampleDesc.Quality = 0;
+    stagingDesc.Usage = D3D11_USAGE_STAGING;
+    stagingDesc.BindFlags = 0;
+    stagingDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
+    stagingDesc.MiscFlags = 0;
+
+    ID3D11Texture2D* stagingTex = NULL;
+    HRESULT result = mDevice-&gt;CreateTexture2D(&amp;stagingDesc, NULL, &amp;stagingTex);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal staging texture for ReadPixels, HRESULT: 0x%X.&quot;, result);
+    }
+
+    ID3D11Texture2D* srcTex = NULL;
+    if (textureDesc.SampleDesc.Count &gt; 1)
+    {
+        D3D11_TEXTURE2D_DESC resolveDesc;
+        resolveDesc.Width = textureDesc.Width;
+        resolveDesc.Height = textureDesc.Height;
+        resolveDesc.MipLevels = 1;
+        resolveDesc.ArraySize = 1;
+        resolveDesc.Format = textureDesc.Format;
+        resolveDesc.SampleDesc.Count = 1;
+        resolveDesc.SampleDesc.Quality = 0;
+        resolveDesc.Usage = D3D11_USAGE_DEFAULT;
+        resolveDesc.BindFlags = 0;
+        resolveDesc.CPUAccessFlags = 0;
+        resolveDesc.MiscFlags = 0;
+
+        result = mDevice-&gt;CreateTexture2D(&amp;resolveDesc, NULL, &amp;srcTex);
+        if (FAILED(result))
+        {
+            SafeRelease(stagingTex);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal resolve texture for ReadPixels, HRESULT: 0x%X.&quot;, result);
+        }
+
+        mDeviceContext-&gt;ResolveSubresource(srcTex, 0, texture, subResource, textureDesc.Format);
+        subResource = 0;
+    }
+    else
+    {
+        srcTex = texture;
+        srcTex-&gt;AddRef();
+    }
+
+    D3D11_BOX srcBox;
+    srcBox.left   = static_cast&lt;UINT&gt;(safeArea.x);
+    srcBox.right  = static_cast&lt;UINT&gt;(safeArea.x + safeArea.width);
+    srcBox.top    = static_cast&lt;UINT&gt;(safeArea.y);
+    srcBox.bottom = static_cast&lt;UINT&gt;(safeArea.y + safeArea.height);
+    srcBox.front  = 0;
+    srcBox.back   = 1;
+
+    mDeviceContext-&gt;CopySubresourceRegion(stagingTex, 0, 0, 0, 0, srcTex, subResource, &amp;srcBox);
+
+    SafeRelease(srcTex);
+
+    PackPixelsParams packParams(safeArea, format, type, outputPitch, pack, 0);
+    gl::Error error = packPixels(stagingTex, packParams, pixels);
+
+    SafeRelease(stagingTex);
+
+    return error;
+}
+
+gl::Error Renderer11::packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &amp;params, uint8_t *pixelsOut)
+{
+    D3D11_TEXTURE2D_DESC textureDesc;
+    readTexture-&gt;GetDesc(&amp;textureDesc);
+
+    D3D11_MAPPED_SUBRESOURCE mapping;
+    HRESULT hr = mDeviceContext-&gt;Map(readTexture, 0, D3D11_MAP_READ, 0, &amp;mapping);
+    if (FAILED(hr))
+    {
+        ASSERT(hr == E_OUTOFMEMORY);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal texture for reading, result: 0x%X.&quot;, hr);
+    }
+
+    uint8_t *source;
+    int inputPitch;
+    if (params.pack.reverseRowOrder)
+    {
+        source = static_cast&lt;uint8_t*&gt;(mapping.pData) + mapping.RowPitch * (params.area.height - 1);
+        inputPitch = -static_cast&lt;int&gt;(mapping.RowPitch);
+    }
+    else
+    {
+        source = static_cast&lt;uint8_t*&gt;(mapping.pData);
+        inputPitch = static_cast&lt;int&gt;(mapping.RowPitch);
+    }
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(textureDesc.Format);
+    const gl::InternalFormat &amp;sourceFormatInfo = gl::GetInternalFormatInfo(dxgiFormatInfo.internalFormat);
+    if (sourceFormatInfo.format == params.format &amp;&amp; sourceFormatInfo.type == params.type)
+    {
+        uint8_t *dest = pixelsOut + params.offset;
+        for (int y = 0; y &lt; params.area.height; y++)
+        {
+            memcpy(dest + y * params.outputPitch, source + y * inputPitch, params.area.width * sourceFormatInfo.pixelBytes);
+        }
+    }
+    else
+    {
+        const d3d11::DXGIFormat &amp;sourceDXGIFormatInfo = d3d11::GetDXGIFormatInfo(textureDesc.Format);
+        ColorCopyFunction fastCopyFunc = sourceDXGIFormatInfo.getFastCopyFunction(params.format, params.type);
+
+        GLenum sizedDestInternalFormat = gl::GetSizedInternalFormat(params.format, params.type);
+        const gl::InternalFormat &amp;destFormatInfo = gl::GetInternalFormatInfo(sizedDestInternalFormat);
+
+        if (fastCopyFunc)
+        {
+            // Fast copy is possible through some special function
+            for (int y = 0; y &lt; params.area.height; y++)
+            {
+                for (int x = 0; x &lt; params.area.width; x++)
+                {
+                    uint8_t *dest = pixelsOut + params.offset + y * params.outputPitch + x * destFormatInfo.pixelBytes;
+                    const uint8_t *src = source + y * inputPitch + x * sourceFormatInfo.pixelBytes;
+
+                    fastCopyFunc(src, dest);
+                }
+            }
+        }
+        else
+        {
+            ColorReadFunction colorReadFunction = sourceDXGIFormatInfo.colorReadFunction;
+            ColorWriteFunction colorWriteFunction = GetColorWriteFunction(params.format, params.type);
+
+            uint8_t temp[16]; // Maximum size of any Color&lt;T&gt; type used.
+            static_assert(sizeof(temp) &gt;= sizeof(gl::ColorF)  &amp;&amp;
+                          sizeof(temp) &gt;= sizeof(gl::ColorUI) &amp;&amp;
+                          sizeof(temp) &gt;= sizeof(gl::ColorI),
+                          &quot;Unexpected size of gl::Color struct.&quot;);
+
+            for (int y = 0; y &lt; params.area.height; y++)
+            {
+                for (int x = 0; x &lt; params.area.width; x++)
+                {
+                    uint8_t *dest = pixelsOut + params.offset + y * params.outputPitch + x * destFormatInfo.pixelBytes;
+                    const uint8_t *src = source + y * inputPitch + x * sourceFormatInfo.pixelBytes;
+
+                    // readFunc and writeFunc will be using the same type of color, CopyTexImage
+                    // will not allow the copy otherwise.
+                    colorReadFunction(src, temp);
+                    colorWriteFunction(temp, dest);
+                }
+            }
+        }
+    }
+
+    mDeviceContext-&gt;Unmap(readTexture, 0);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &amp;readRect, const gl::Rectangle &amp;drawRect, RenderTargetD3D *readRenderTarget,
+                                           RenderTargetD3D *drawRenderTarget, GLenum filter, const gl::Rectangle *scissor,
+                                           bool colorBlit, bool depthBlit, bool stencilBlit)
+{
+    // Since blitRenderbufferRect is called for each render buffer that needs to be blitted,
+    // it should never be the case that both color and depth/stencil need to be blitted at
+    // at the same time.
+    ASSERT(colorBlit != (depthBlit || stencilBlit));
+
+    RenderTarget11 *drawRenderTarget11 = GetAs&lt;RenderTarget11&gt;(drawRenderTarget);
+    if (!drawRenderTarget)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to retrieve the internal draw render target from the draw framebuffer.&quot;);
+    }
+
+    ID3D11Resource *drawTexture = drawRenderTarget11-&gt;getTexture();
+    unsigned int drawSubresource = drawRenderTarget11-&gt;getSubresourceIndex();
+    ID3D11RenderTargetView *drawRTV = drawRenderTarget11-&gt;getRenderTargetView();
+    ID3D11DepthStencilView *drawDSV = drawRenderTarget11-&gt;getDepthStencilView();
+
+    RenderTarget11 *readRenderTarget11 = GetAs&lt;RenderTarget11&gt;(readRenderTarget);
+    if (!readRenderTarget)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to retrieve the internal read render target from the read framebuffer.&quot;);
+    }
+
+    ID3D11Resource *readTexture = NULL;
+    ID3D11ShaderResourceView *readSRV = NULL;
+    unsigned int readSubresource = 0;
+    if (readRenderTarget-&gt;getSamples() &gt; 0)
+    {
+        ID3D11Resource *unresolvedResource = readRenderTarget11-&gt;getTexture();
+        ID3D11Texture2D *unresolvedTexture = d3d11::DynamicCastComObject&lt;ID3D11Texture2D&gt;(unresolvedResource);
+
+        if (unresolvedTexture)
+        {
+            readTexture = resolveMultisampledTexture(unresolvedTexture, readRenderTarget11-&gt;getSubresourceIndex());
+            readSubresource = 0;
+
+            SafeRelease(unresolvedTexture);
+
+            HRESULT hresult = mDevice-&gt;CreateShaderResourceView(readTexture, NULL, &amp;readSRV);
+            if (FAILED(hresult))
+            {
+                SafeRelease(readTexture);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create shader resource view to resolve multisampled framebuffer.&quot;);
+            }
+        }
+    }
+    else
+    {
+        readTexture = readRenderTarget11-&gt;getTexture();
+        readTexture-&gt;AddRef();
+        readSubresource = readRenderTarget11-&gt;getSubresourceIndex();
+        readSRV = readRenderTarget11-&gt;getShaderResourceView();
+        readSRV-&gt;AddRef();
+    }
+
+    if (!readTexture || !readSRV)
+    {
+        SafeRelease(readTexture);
+        SafeRelease(readSRV);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to retrieve the internal read render target view from the read render target.&quot;);
+    }
+
+    gl::Extents readSize(readRenderTarget-&gt;getWidth(), readRenderTarget-&gt;getHeight(), 1);
+    gl::Extents drawSize(drawRenderTarget-&gt;getWidth(), drawRenderTarget-&gt;getHeight(), 1);
+
+    bool scissorNeeded = scissor &amp;&amp; gl::ClipRectangle(drawRect, *scissor, NULL);
+
+    bool wholeBufferCopy = !scissorNeeded &amp;&amp;
+                           readRect.x == 0 &amp;&amp; readRect.width == readSize.width &amp;&amp;
+                           readRect.y == 0 &amp;&amp; readRect.height == readSize.height &amp;&amp;
+                           drawRect.x == 0 &amp;&amp; drawRect.width == drawSize.width &amp;&amp;
+                           drawRect.y == 0 &amp;&amp; drawRect.height == drawSize.height;
+
+    bool stretchRequired = readRect.width != drawRect.width || readRect.height != drawRect.height;
+
+    bool flipRequired = readRect.width &lt; 0 || readRect.height &lt; 0 || drawRect.width &lt; 0 || drawRect.height &lt; 0;
+
+    bool outOfBounds = readRect.x &lt; 0 || readRect.x + readRect.width &gt; readSize.width ||
+                       readRect.y &lt; 0 || readRect.y + readRect.height &gt; readSize.height ||
+                       drawRect.x &lt; 0 || drawRect.x + drawRect.width &gt; drawSize.width ||
+                       drawRect.y &lt; 0 || drawRect.y + drawRect.height &gt; drawSize.height;
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(drawRenderTarget11-&gt;getDXGIFormat());
+    bool partialDSBlit = (dxgiFormatInfo.depthBits &gt; 0 &amp;&amp; depthBlit) != (dxgiFormatInfo.stencilBits &gt; 0 &amp;&amp; stencilBlit);
+
+    gl::Error result(GL_NO_ERROR);
+
+    if (readRenderTarget11-&gt;getDXGIFormat() == drawRenderTarget11-&gt;getDXGIFormat() &amp;&amp;
+        !stretchRequired &amp;&amp; !outOfBounds &amp;&amp; !flipRequired &amp;&amp; !partialDSBlit &amp;&amp;
+        (!(depthBlit || stencilBlit) || wholeBufferCopy))
+    {
+        UINT dstX = drawRect.x;
+        UINT dstY = drawRect.y;
+
+        D3D11_BOX readBox;
+        readBox.left = readRect.x;
+        readBox.right = readRect.x + readRect.width;
+        readBox.top = readRect.y;
+        readBox.bottom = readRect.y + readRect.height;
+        readBox.front = 0;
+        readBox.back = 1;
+
+        if (scissorNeeded)
+        {
+            // drawRect is guaranteed to have positive width and height because stretchRequired is false.
+            ASSERT(drawRect.width &gt;= 0 || drawRect.height &gt;= 0);
+
+            if (drawRect.x &lt; scissor-&gt;x)
+            {
+                dstX = scissor-&gt;x;
+                readBox.left += (scissor-&gt;x - drawRect.x);
+            }
+            if (drawRect.y &lt; scissor-&gt;y)
+            {
+                dstY = scissor-&gt;y;
+                readBox.top += (scissor-&gt;y - drawRect.y);
+            }
+            if (drawRect.x + drawRect.width &gt; scissor-&gt;x + scissor-&gt;width)
+            {
+                readBox.right -= ((drawRect.x + drawRect.width) - (scissor-&gt;x + scissor-&gt;width));
+            }
+            if (drawRect.y + drawRect.height &gt; scissor-&gt;y + scissor-&gt;height)
+            {
+                readBox.bottom -= ((drawRect.y + drawRect.height) - (scissor-&gt;y + scissor-&gt;height));
+            }
+        }
+
+        // D3D11 needs depth-stencil CopySubresourceRegions to have a NULL pSrcBox
+        // We also require complete framebuffer copies for depth-stencil blit.
+        D3D11_BOX *pSrcBox = wholeBufferCopy ? NULL : &amp;readBox;
+
+        mDeviceContext-&gt;CopySubresourceRegion(drawTexture, drawSubresource, dstX, dstY, 0,
+                                              readTexture, readSubresource, pSrcBox);
+        result = gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        gl::Box readArea(readRect.x, readRect.y, 0, readRect.width, readRect.height, 1);
+        gl::Box drawArea(drawRect.x, drawRect.y, 0, drawRect.width, drawRect.height, 1);
+
+        if (depthBlit &amp;&amp; stencilBlit)
+        {
+            result = mBlit-&gt;copyDepthStencil(readTexture, readSubresource, readArea, readSize,
+                                             drawTexture, drawSubresource, drawArea, drawSize,
+                                             scissor);
+        }
+        else if (depthBlit)
+        {
+            result = mBlit-&gt;copyDepth(readSRV, readArea, readSize, drawDSV, drawArea, drawSize,
+                                      scissor);
+        }
+        else if (stencilBlit)
+        {
+            result = mBlit-&gt;copyStencil(readTexture, readSubresource, readArea, readSize,
+                                        drawTexture, drawSubresource, drawArea, drawSize,
+                                        scissor);
+        }
+        else
+        {
+            GLenum format = gl::GetInternalFormatInfo(drawRenderTarget-&gt;getInternalFormat()).format;
+            result = mBlit-&gt;copyTexture(readSRV, readArea, readSize, drawRTV, drawArea, drawSize,
+                                        scissor, format, filter);
+        }
+    }
+
+    SafeRelease(readTexture);
+    SafeRelease(readSRV);
+
+    return result;
+}
+
+bool Renderer11::isES3Capable() const
+{
+    return (d3d11_gl::GetMaximumClientVersion(mFeatureLevel) &gt; 2);
+};
+
+ID3D11Texture2D *Renderer11::resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource)
+{
+    D3D11_TEXTURE2D_DESC textureDesc;
+    source-&gt;GetDesc(&amp;textureDesc);
+
+    if (textureDesc.SampleDesc.Count &gt; 1)
+    {
+        D3D11_TEXTURE2D_DESC resolveDesc;
+        resolveDesc.Width = textureDesc.Width;
+        resolveDesc.Height = textureDesc.Height;
+        resolveDesc.MipLevels = 1;
+        resolveDesc.ArraySize = 1;
+        resolveDesc.Format = textureDesc.Format;
+        resolveDesc.SampleDesc.Count = 1;
+        resolveDesc.SampleDesc.Quality = 0;
+        resolveDesc.Usage = textureDesc.Usage;
+        resolveDesc.BindFlags = textureDesc.BindFlags;
+        resolveDesc.CPUAccessFlags = 0;
+        resolveDesc.MiscFlags = 0;
+
+        ID3D11Texture2D *resolveTexture = NULL;
+        HRESULT result = mDevice-&gt;CreateTexture2D(&amp;resolveDesc, NULL, &amp;resolveTexture);
+        if (FAILED(result))
+        {
+            ERR(&quot;Failed to create a multisample resolve texture, HRESULT: 0x%X.&quot;, result);
+            return NULL;
+        }
+
+        mDeviceContext-&gt;ResolveSubresource(resolveTexture, 0, source, subresource, textureDesc.Format);
+        return resolveTexture;
+    }
+    else
+    {
+        source-&gt;AddRef();
+        return source;
+    }
+}
+
+bool Renderer11::getLUID(LUID *adapterLuid) const
+{
+    adapterLuid-&gt;HighPart = 0;
+    adapterLuid-&gt;LowPart = 0;
+
+    if (!mDxgiAdapter)
+    {
+        return false;
+    }
+
+    DXGI_ADAPTER_DESC adapterDesc;
+    if (FAILED(mDxgiAdapter-&gt;GetDesc(&amp;adapterDesc)))
+    {
+        return false;
+    }
+
+    *adapterLuid = adapterDesc.AdapterLuid;
+    return true;
+}
+
+VertexConversionType Renderer11::getVertexConversionType(const gl::VertexFormat &amp;vertexFormat) const
+{
+    return d3d11::GetVertexFormatInfo(vertexFormat, mFeatureLevel).conversionType;
+}
+
+GLenum Renderer11::getVertexComponentType(const gl::VertexFormat &amp;vertexFormat) const
+{
+    return d3d11::GetDXGIFormatInfo(d3d11::GetVertexFormatInfo(vertexFormat, mFeatureLevel).nativeFormat).componentType;
+}
+
+void Renderer11::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureCaps, gl::Extensions *outExtensions) const
+{
+    d3d11_gl::GenerateCaps(mDevice, mDeviceContext, outCaps, outTextureCaps, outExtensions);
+}
+
+Workarounds Renderer11::generateWorkarounds() const
+{
+    return d3d11::GenerateWorkarounds(mFeatureLevel);
+}
+
+void Renderer11::setShaderResource(gl::SamplerType shaderType, UINT resourceSlot, ID3D11ShaderResourceView *srv)
+{
+    auto &amp;currentSRVs = (shaderType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
+
+    ASSERT(static_cast&lt;size_t&gt;(resourceSlot) &lt; currentSRVs.size());
+    auto &amp;record = currentSRVs[resourceSlot];
+
+    if (record.srv != reinterpret_cast&lt;uintptr_t&gt;(srv))
+    {
+        if (shaderType == gl::SAMPLER_VERTEX)
+        {
+            mDeviceContext-&gt;VSSetShaderResources(resourceSlot, 1, &amp;srv);
+        }
+        else
+        {
+            mDeviceContext-&gt;PSSetShaderResources(resourceSlot, 1, &amp;srv);
+        }
+
+        record.srv = reinterpret_cast&lt;uintptr_t&gt;(srv);
+        if (srv)
+        {
+            record.resource = reinterpret_cast&lt;uintptr_t&gt;(GetViewResource(srv));
+            srv-&gt;GetDesc(&amp;record.desc);
+        }
+        else
+        {
+            record.resource = 0;
+        }
+    }
+}
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Renderer11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Renderer11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,418 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// Renderer11.h: Defines a back-end specific class for the D3D11 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/mathutil.h&quot;
+#include &quot;libANGLE/AttributeMap.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/d3d/HLSLCompiler.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/InputLayoutCache.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderStateCache.h&quot;
+
+namespace gl
+{
+class FramebufferAttachment;
+struct ImageIndex;
+}
+
+namespace rx
+{
+
+class VertexDataManager;
+class IndexDataManager;
+class StreamingIndexBufferInterface;
+class Blit11;
+class Clear11;
+class PixelTransfer11;
+class RenderTarget11;
+class Trim11;
+struct PackPixelsParams;
+
+enum
+{
+    MAX_VERTEX_UNIFORM_VECTORS_D3D11 = 1024,
+    MAX_FRAGMENT_UNIFORM_VECTORS_D3D11 = 1024
+};
+
+// Possible reasons RendererD3D initialize can fail
+enum D3D11InitError
+{
+    // The renderer loaded successfully
+    D3D11_INIT_SUCCESS = 0,
+    // Failed to load the ANGLE &amp; D3D compiler libraries
+    D3D11_INIT_COMPILER_ERROR,
+    // Failed to load a necessary DLL (non-compiler)
+    D3D11_INIT_MISSING_DEP,
+    // CreateDevice returned E_INVALIDARG
+    D3D11_INIT_CREATEDEVICE_INVALIDARG,
+    // CreateDevice failed with an error other than invalid arg
+    D3D11_INIT_CREATEDEVICE_ERROR,
+    // DXGI 1.2 required but not found
+    D3D11_INIT_INCOMPATIBLE_DXGI,
+    // Other initialization error
+    D3D11_INIT_OTHER_ERROR,
+    // CreateDevice returned E_FAIL
+    D3D11_INIT_CREATEDEVICE_FAIL,
+    // CreateDevice returned E_NOTIMPL
+    D3D11_INIT_CREATEDEVICE_NOTIMPL,
+    // CreateDevice returned E_OUTOFMEMORY
+    D3D11_INIT_CREATEDEVICE_OUTOFMEMORY,
+    // CreateDevice returned DXGI_ERROR_INVALID_CALL
+    D3D11_INIT_CREATEDEVICE_INVALIDCALL,
+    // CreateDevice returned DXGI_ERROR_SDK_COMPONENT_MISSING
+    D3D11_INIT_CREATEDEVICE_COMPONENTMISSING,
+    // CreateDevice returned DXGI_ERROR_WAS_STILL_DRAWING
+    D3D11_INIT_CREATEDEVICE_WASSTILLDRAWING,
+    // CreateDevice returned DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
+    D3D11_INIT_CREATEDEVICE_NOTAVAILABLE,
+    // CreateDevice returned DXGI_ERROR_DEVICE_HUNG
+    D3D11_INIT_CREATEDEVICE_DEVICEHUNG,
+    // CreateDevice returned NULL
+    D3D11_INIT_CREATEDEVICE_NULL,
+    NUM_D3D11_INIT_ERRORS
+};
+
+class Renderer11 : public RendererD3D
+{
+  public:
+    explicit Renderer11(egl::Display *display);
+    virtual ~Renderer11();
+
+    egl::Error initialize() override;
+    virtual bool resetDevice();
+
+    egl::ConfigSet generateConfigs() const override;
+
+    gl::Error flush() override;
+    gl::Error finish() override;
+
+    bool shouldCreateChildWindowForSurface(EGLNativeWindowType window) const override;
+    virtual SwapChainD3D *createSwapChain(NativeWindow nativeWindow, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat);
+
+    virtual gl::Error generateSwizzle(gl::Texture *texture);
+    virtual gl::Error setSamplerState(gl::SamplerType type, int index, gl::Texture *texture, const gl::SamplerState &amp;sampler);
+    virtual gl::Error setTexture(gl::SamplerType type, int index, gl::Texture *texture);
+
+    gl::Error setUniformBuffers(const gl::Data &amp;data,
+                                const GLint vertexUniformBuffers[],
+                                const GLint fragmentUniformBuffers[]) override;
+
+    virtual gl::Error setRasterizerState(const gl::RasterizerState &amp;rasterState);
+    gl::Error setBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &amp;blendState, const gl::ColorF &amp;blendColor,
+                            unsigned int sampleMask) override;
+    virtual gl::Error setDepthStencilState(const gl::DepthStencilState &amp;depthStencilState, int stencilRef,
+                                           int stencilBackRef, bool frontFaceCCW);
+
+    virtual void setScissorRectangle(const gl::Rectangle &amp;scissor, bool enabled);
+    virtual void setViewport(const gl::Rectangle &amp;viewport, float zNear, float zFar, GLenum drawMode, GLenum frontFace,
+                             bool ignoreViewport);
+
+    virtual bool applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize);
+    gl::Error applyRenderTarget(const gl::Framebuffer *frameBuffer) override;
+    virtual gl::Error applyShaders(gl::Program *program, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
+                                   bool rasterizerDiscard, bool transformFeedbackActive);
+
+    virtual gl::Error applyUniforms(const ProgramImpl &amp;program, const std::vector&lt;gl::LinkedUniform*&gt; &amp;uniformArray);
+    virtual gl::Error applyVertexBuffer(const gl::State &amp;state, GLenum mode, GLint first, GLsizei count, GLsizei instances);
+    virtual gl::Error applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
+    void applyTransformFeedbackBuffers(const gl::State &amp;state) override;
+
+    gl::Error drawArrays(const gl::Data &amp;data, GLenum mode, GLsizei count, GLsizei instances, bool usesPointSize) override;
+    virtual gl::Error drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+                                   gl::Buffer *elementArrayBuffer, const TranslatedIndexData &amp;indexInfo, GLsizei instances);
+
+    virtual void markAllStateDirty();
+
+    // lost device
+    bool testDeviceLost() override;
+    bool testDeviceResettable() override;
+
+    VendorID getVendorId() const override;
+    std::string getRendererDescription() const override;
+    GUID getAdapterIdentifier() const override;
+
+    virtual unsigned int getReservedVertexUniformVectors() const;
+    virtual unsigned int getReservedFragmentUniformVectors() const;
+    virtual unsigned int getReservedVertexUniformBuffers() const;
+    virtual unsigned int getReservedFragmentUniformBuffers() const;
+    virtual bool getShareHandleSupport() const;
+    virtual bool getPostSubBufferSupport() const;
+
+    virtual int getMajorShaderModel() const;
+    int getMinorShaderModel() const override;
+    std::string getShaderModelSuffix() const override;
+
+    // Pixel operations
+    virtual gl::Error copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                  const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level);
+    virtual gl::Error copyImageCube(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                    const gl::Offset &amp;destOffset, TextureStorage *storage, GLenum target, GLint level);
+    virtual gl::Error copyImage3D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                  const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level);
+    virtual gl::Error copyImage2DArray(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                       const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level);
+
+    // RenderTarget creation
+    virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT);
+
+    // Framebuffer creation
+    FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &amp;data) override;
+    FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &amp;data) override;
+
+    // Shader creation
+    virtual CompilerImpl *createCompiler(const gl::Data &amp;data);
+    virtual ShaderImpl *createShader(GLenum type);
+    virtual ProgramImpl *createProgram();
+
+    // Shader operations
+    virtual gl::Error loadExecutable(const void *function, size_t length, ShaderType type,
+                                     const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                     bool separatedOutputBuffers, ShaderExecutableD3D **outExecutable);
+    virtual gl::Error compileToExecutable(gl::InfoLog &amp;infoLog, const std::string &amp;shaderHLSL, ShaderType type,
+                                          const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                          bool separatedOutputBuffers, const D3DCompilerWorkarounds &amp;workarounds,
+                                          ShaderExecutableD3D **outExectuable);
+    virtual UniformStorageD3D *createUniformStorage(size_t storageSize);
+
+    // Image operations
+    virtual ImageD3D *createImage();
+    gl::Error generateMipmap(ImageD3D *dest, ImageD3D *source) override;
+    gl::Error generateMipmapsUsingD3D(TextureStorage *storage, const gl::SamplerState &amp;samplerState) override;
+    virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain);
+    virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly);
+    virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly);
+    virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
+    virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
+
+    // Texture creation
+    virtual TextureImpl *createTexture(GLenum target);
+
+    // Renderbuffer creation
+    virtual RenderbufferImpl *createRenderbuffer();
+
+    // Buffer creation
+    virtual BufferImpl *createBuffer();
+    virtual VertexBuffer *createVertexBuffer();
+    virtual IndexBuffer *createIndexBuffer();
+
+    // Vertex Array creation
+    virtual VertexArrayImpl *createVertexArray();
+
+    // Query and Fence creation
+    virtual QueryImpl *createQuery(GLenum type);
+    virtual FenceNVImpl *createFenceNV();
+    virtual FenceSyncImpl *createFenceSync();
+
+    // Transform Feedback creation
+    virtual TransformFeedbackImpl* createTransformFeedback();
+
+    // D3D11-renderer specific methods
+    ID3D11Device *getDevice() { return mDevice; }
+    void *getD3DDevice() override;
+    ID3D11DeviceContext *getDeviceContext() { return mDeviceContext; };
+    ID3D11DeviceContext1 *getDeviceContext1IfSupported() { return mDeviceContext1; };
+    DXGIFactory *getDxgiFactory() { return mDxgiFactory; };
+
+    Blit11 *getBlitter() { return mBlit; }
+    Clear11 *getClearer() { return mClear; }
+
+    // Buffer-to-texture and Texture-to-buffer copies
+    virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
+    virtual gl::Error fastCopyBufferToTexture(const gl::PixelUnpackState &amp;unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+                                              GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &amp;destArea);
+
+    void unapplyRenderTargets();
+    void setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView);
+    gl::Error packPixels(ID3D11Texture2D *readTexture, const PackPixelsParams &amp;params, uint8_t *pixelsOut);
+
+    bool getLUID(LUID *adapterLuid) const override;
+    virtual VertexConversionType getVertexConversionType(const gl::VertexFormat &amp;vertexFormat) const;
+    virtual GLenum getVertexComponentType(const gl::VertexFormat &amp;vertexFormat) const;
+
+    gl::Error readTextureData(ID3D11Texture2D *texture, unsigned int subResource, const gl::Rectangle &amp;area, GLenum format,
+                              GLenum type, GLuint outputPitch, const gl::PixelPackState &amp;pack, uint8_t *pixels);
+
+    void setShaderResource(gl::SamplerType shaderType, UINT resourceSlot, ID3D11ShaderResourceView *srv);
+
+    gl::Error blitRenderbufferRect(const gl::Rectangle &amp;readRect, const gl::Rectangle &amp;drawRect, RenderTargetD3D *readRenderTarget,
+                                   RenderTargetD3D *drawRenderTarget, GLenum filter, const gl::Rectangle *scissor,
+                                   bool colorBlit, bool depthBlit, bool stencilBlit);
+
+    bool isES3Capable() const;
+    D3D_FEATURE_LEVEL getFeatureLevel() const { return mFeatureLevel; };
+
+    RendererClass getRendererClass() const override { return RENDERER_D3D11; }
+
+  private:
+    void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureCaps, gl::Extensions *outExtensions) const override;
+    Workarounds generateWorkarounds() const override;
+
+    gl::Error drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
+    gl::Error drawTriangleFan(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer, int instances);
+
+    ID3D11Texture2D *resolveMultisampledTexture(ID3D11Texture2D *source, unsigned int subresource);
+    void unsetConflictingSRVs(gl::SamplerType shaderType, uintptr_t resource, const gl::ImageIndex &amp;index);
+
+    HMODULE mD3d11Module;
+    HMODULE mDxgiModule;
+    std::vector&lt;D3D_FEATURE_LEVEL&gt; mAvailableFeatureLevels;
+    D3D_DRIVER_TYPE mDriverType;
+
+    HLSLCompiler mCompiler;
+
+    void initializeDevice();
+    void releaseDeviceResources();
+    void release();
+
+    RenderStateCache mStateCache;
+
+    // current render target states
+    uintptr_t mAppliedRTVs[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
+    uintptr_t mAppliedDSV;
+    bool mDepthStencilInitialized;
+    bool mRenderTargetDescInitialized;
+
+    struct RenderTargetDesc
+    {
+        size_t width;
+        size_t height;
+        DXGI_FORMAT format;
+    };
+    RenderTargetDesc mRenderTargetDesc;
+
+    // Currently applied sampler states
+    std::vector&lt;bool&gt; mForceSetVertexSamplerStates;
+    std::vector&lt;gl::SamplerState&gt; mCurVertexSamplerStates;
+
+    std::vector&lt;bool&gt; mForceSetPixelSamplerStates;
+    std::vector&lt;gl::SamplerState&gt; mCurPixelSamplerStates;
+
+    // Currently applied textures
+    struct SRVRecord
+    {
+        uintptr_t srv;
+        uintptr_t resource;
+        D3D11_SHADER_RESOURCE_VIEW_DESC desc;
+    };
+    std::vector&lt;SRVRecord&gt; mCurVertexSRVs;
+    std::vector&lt;SRVRecord&gt; mCurPixelSRVs;
+
+    // Currently applied blend state
+    bool mForceSetBlendState;
+    gl::BlendState mCurBlendState;
+    gl::ColorF mCurBlendColor;
+    unsigned int mCurSampleMask;
+
+    // Currently applied rasterizer state
+    bool mForceSetRasterState;
+    gl::RasterizerState mCurRasterState;
+
+    // Currently applied depth stencil state
+    bool mForceSetDepthStencilState;
+    gl::DepthStencilState mCurDepthStencilState;
+    int mCurStencilRef;
+    int mCurStencilBackRef;
+
+    // Currently applied scissor rectangle
+    bool mForceSetScissor;
+    bool mScissorEnabled;
+    gl::Rectangle mCurScissor;
+
+    // Currently applied viewport
+    bool mForceSetViewport;
+    gl::Rectangle mCurViewport;
+    float mCurNear;
+    float mCurFar;
+
+    // Currently applied primitive topology
+    D3D11_PRIMITIVE_TOPOLOGY mCurrentPrimitiveTopology;
+
+    // Currently applied index buffer
+    ID3D11Buffer *mAppliedIB;
+    DXGI_FORMAT mAppliedIBFormat;
+    unsigned int mAppliedIBOffset;
+
+    // Currently applied transform feedback buffers
+    size_t mAppliedNumXFBBindings;
+    ID3D11Buffer *mAppliedTFBuffers[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS]; // Tracks the current D3D buffers
+                                                                                        // in use for streamout
+    GLintptr mAppliedTFOffsets[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS]; // Tracks the current GL-specified
+                                                                                   // buffer offsets to transform feedback
+                                                                                   // buffers
+    UINT mCurrentD3DOffsets[gl::IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];  // Tracks the D3D buffer offsets,
+                                                                                 // which may differ from GLs, due
+                                                                                 // to different append behavior
+
+    // Currently applied shaders
+    uintptr_t mAppliedVertexShader;
+    uintptr_t mAppliedGeometryShader;
+    uintptr_t mAppliedPixelShader;
+
+    dx_VertexConstants mVertexConstants;
+    dx_VertexConstants mAppliedVertexConstants;
+    ID3D11Buffer *mDriverConstantBufferVS;
+    ID3D11Buffer *mCurrentVertexConstantBuffer;
+    unsigned int mCurrentConstantBufferVS[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
+    GLintptr mCurrentConstantBufferVSOffset[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
+    GLsizeiptr mCurrentConstantBufferVSSize[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS];
+
+    dx_PixelConstants mPixelConstants;
+    dx_PixelConstants mAppliedPixelConstants;
+    ID3D11Buffer *mDriverConstantBufferPS;
+    ID3D11Buffer *mCurrentPixelConstantBuffer;
+    unsigned int mCurrentConstantBufferPS[gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS];
+    GLintptr mCurrentConstantBufferPSOffset[gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS];
+    GLsizeiptr mCurrentConstantBufferPSSize[gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS];
+
+    ID3D11Buffer *mCurrentGeometryConstantBuffer;
+
+    // Vertex, index and input layouts
+    VertexDataManager *mVertexDataManager;
+    IndexDataManager *mIndexDataManager;
+    InputLayoutCache mInputLayoutCache;
+
+    StreamingIndexBufferInterface *mLineLoopIB;
+    StreamingIndexBufferInterface *mTriangleFanIB;
+
+    // Texture copy resources
+    Blit11 *mBlit;
+    PixelTransfer11 *mPixelTransfer;
+
+    // Masked clear resources
+    Clear11 *mClear;
+
+    // Perform trim for D3D resources
+    Trim11 *mTrim;
+
+    // Sync query
+    ID3D11Query *mSyncQuery;
+
+    // Constant buffer offset support
+    bool mSupportsConstantBufferOffsets;
+
+    ID3D11Device *mDevice;
+    D3D_FEATURE_LEVEL mFeatureLevel;
+    ID3D11DeviceContext *mDeviceContext;
+    ID3D11DeviceContext1 *mDeviceContext1;
+    IDXGIAdapter *mDxgiAdapter;
+    DXGI_ADAPTER_DESC mAdapterDescription;
+    char mDescription[128];
+    DXGIFactory *mDxgiFactory;
+    ID3D11Debug *mDebug;
+
+    DebugAnnotator11 mAnnotator;
+};
+
+}
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11ShaderExecutable11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// ShaderExecutable11.cpp: Implements a D3D11-specific class to contain shader
+// executable implementation details.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+
+namespace rx
+{
+
+ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11PixelShader *executable)
+    : ShaderExecutableD3D(function, length)
+{
+    mPixelExecutable = executable;
+    mVertexExecutable = NULL;
+    mGeometryExecutable = NULL;
+    mStreamOutExecutable = NULL;
+}
+
+ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable, ID3D11GeometryShader *streamOut)
+    : ShaderExecutableD3D(function, length)
+{
+    mVertexExecutable = executable;
+    mPixelExecutable = NULL;
+    mGeometryExecutable = NULL;
+    mStreamOutExecutable = streamOut;
+}
+
+ShaderExecutable11::ShaderExecutable11(const void *function, size_t length, ID3D11GeometryShader *executable)
+    : ShaderExecutableD3D(function, length)
+{
+    mGeometryExecutable = executable;
+    mVertexExecutable = NULL;
+    mPixelExecutable = NULL;
+    mStreamOutExecutable = NULL;
+}
+
+ShaderExecutable11::~ShaderExecutable11()
+{
+    SafeRelease(mVertexExecutable);
+    SafeRelease(mPixelExecutable);
+    SafeRelease(mGeometryExecutable);
+    SafeRelease(mStreamOutExecutable);
+}
+
+ID3D11VertexShader *ShaderExecutable11::getVertexShader() const
+{
+    return mVertexExecutable;
+}
+
+ID3D11PixelShader *ShaderExecutable11::getPixelShader() const
+{
+    return mPixelExecutable;
+}
+
+ID3D11GeometryShader *ShaderExecutable11::getGeometryShader() const
+{
+    return mGeometryExecutable;
+}
+
+ID3D11GeometryShader *ShaderExecutable11::getStreamOutShader() const
+{
+    return mStreamOutExecutable;
+}
+
+UniformStorage11::UniformStorage11(Renderer11 *renderer, size_t initialSize)
+    : UniformStorageD3D(initialSize),
+      mConstantBuffer(NULL)
+{
+    ID3D11Device *d3d11Device = renderer-&gt;getDevice();
+
+    if (initialSize &gt; 0)
+    {
+        D3D11_BUFFER_DESC constantBufferDescription = {0};
+        constantBufferDescription.ByteWidth = initialSize;
+        constantBufferDescription.Usage = D3D11_USAGE_DYNAMIC;
+        constantBufferDescription.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+        constantBufferDescription.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+        constantBufferDescription.MiscFlags = 0;
+        constantBufferDescription.StructureByteStride = 0;
+
+        HRESULT result = d3d11Device-&gt;CreateBuffer(&amp;constantBufferDescription, NULL, &amp;mConstantBuffer);
+        UNUSED_ASSERTION_VARIABLE(result);
+        ASSERT(SUCCEEDED(result));
+    }
+}
+
+UniformStorage11::~UniformStorage11()
+{
+    SafeRelease(mConstantBuffer);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11ShaderExecutable11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// ShaderExecutable11.h: Defines a D3D11-specific class to contain shader
+// executable implementation details.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_SHADEREXECUTABLE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_SHADEREXECUTABLE11_H_
+
+#include &quot;libANGLE/renderer/d3d/ShaderExecutableD3D.h&quot;
+
+namespace rx
+{
+class Renderer11;
+class UniformStorage11;
+
+class ShaderExecutable11 : public ShaderExecutableD3D
+{
+  public:
+    ShaderExecutable11(const void *function, size_t length, ID3D11PixelShader *executable);
+    ShaderExecutable11(const void *function, size_t length, ID3D11VertexShader *executable, ID3D11GeometryShader *streamOut);
+    ShaderExecutable11(const void *function, size_t length, ID3D11GeometryShader *executable);
+
+    virtual ~ShaderExecutable11();
+
+    ID3D11PixelShader *getPixelShader() const;
+    ID3D11VertexShader *getVertexShader() const;
+    ID3D11GeometryShader *getGeometryShader() const;
+    ID3D11GeometryShader *getStreamOutShader() const;
+
+  private:
+    ID3D11PixelShader *mPixelExecutable;
+    ID3D11VertexShader *mVertexExecutable;
+    ID3D11GeometryShader *mGeometryExecutable;
+    ID3D11GeometryShader *mStreamOutExecutable;
+};
+
+class UniformStorage11 : public UniformStorageD3D
+{
+  public:
+    UniformStorage11(Renderer11 *renderer, size_t initialSize);
+    virtual ~UniformStorage11();
+
+    ID3D11Buffer *getConstantBuffer() const { return mConstantBuffer; }
+
+  private:
+    ID3D11Buffer *mConstantBuffer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_SHADEREXECUTABLE11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11SwapChain11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,665 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// SwapChain11.cpp: Implements a back-end specific class for the D3D11 swap chain.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/SwapChain11.h&quot;
+
+#include &quot;libANGLE/features.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;third_party/trace_event/trace_event.h&quot;
+
+// Precompiled shaders
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h&quot;
+
+namespace rx
+{
+
+SwapChain11::SwapChain11(Renderer11 *renderer, NativeWindow nativeWindow, HANDLE shareHandle,
+                         GLenum backBufferFormat, GLenum depthBufferFormat)
+    : mRenderer(renderer),
+      SwapChainD3D(nativeWindow, shareHandle, backBufferFormat, depthBufferFormat),
+      mColorRenderTarget(this, renderer, false),
+      mDepthStencilRenderTarget(this, renderer, true)
+{
+    mSwapChain = NULL;
+    mBackBufferTexture = NULL;
+    mBackBufferRTView = NULL;
+    mOffscreenTexture = NULL;
+    mOffscreenRTView = NULL;
+    mOffscreenSRView = NULL;
+    mDepthStencilTexture = NULL;
+    mDepthStencilDSView = NULL;
+    mDepthStencilSRView = NULL;
+    mQuadVB = NULL;
+    mPassThroughSampler = NULL;
+    mPassThroughIL = NULL;
+    mPassThroughVS = NULL;
+    mPassThroughPS = NULL;
+    mWidth = -1;
+    mHeight = -1;
+    mSwapInterval = 0;
+    mAppCreatedShareHandle = mShareHandle != NULL;
+    mPassThroughResourcesInit = false;
+}
+
+SwapChain11::~SwapChain11()
+{
+    release();
+}
+
+void SwapChain11::release()
+{
+    SafeRelease(mSwapChain);
+    SafeRelease(mBackBufferTexture);
+    SafeRelease(mBackBufferRTView);
+    SafeRelease(mOffscreenTexture);
+    SafeRelease(mOffscreenRTView);
+    SafeRelease(mOffscreenSRView);
+    SafeRelease(mDepthStencilTexture);
+    SafeRelease(mDepthStencilDSView);
+    SafeRelease(mDepthStencilSRView);
+    SafeRelease(mQuadVB);
+    SafeRelease(mPassThroughSampler);
+    SafeRelease(mPassThroughIL);
+    SafeRelease(mPassThroughVS);
+    SafeRelease(mPassThroughPS);
+
+    if (!mAppCreatedShareHandle)
+    {
+        mShareHandle = NULL;
+    }
+}
+
+void SwapChain11::releaseOffscreenTexture()
+{
+    SafeRelease(mOffscreenTexture);
+    SafeRelease(mOffscreenRTView);
+    SafeRelease(mOffscreenSRView);
+    SafeRelease(mDepthStencilTexture);
+    SafeRelease(mDepthStencilDSView);
+    SafeRelease(mDepthStencilSRView);
+}
+
+EGLint SwapChain11::resetOffscreenTexture(int backbufferWidth, int backbufferHeight)
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;SwapChain11::resetOffscreenTexture&quot;);
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    ASSERT(device != NULL);
+
+    // D3D11 does not allow zero size textures
+    ASSERT(backbufferWidth &gt;= 1);
+    ASSERT(backbufferHeight &gt;= 1);
+
+    // Preserve the render target content
+    ID3D11Texture2D *previousOffscreenTexture = mOffscreenTexture;
+    if (previousOffscreenTexture)
+    {
+        previousOffscreenTexture-&gt;AddRef();
+    }
+    const int previousWidth = mWidth;
+    const int previousHeight = mHeight;
+
+    releaseOffscreenTexture();
+
+    const d3d11::TextureFormat &amp;backbufferFormatInfo = d3d11::GetTextureFormatInfo(mBackBufferFormat, mRenderer-&gt;getFeatureLevel());
+
+    // If the app passed in a share handle, open the resource
+    // See EGL_ANGLE_d3d_share_handle_client_buffer
+    if (mAppCreatedShareHandle)
+    {
+        ID3D11Resource *tempResource11;
+        HRESULT result = device-&gt;OpenSharedResource(mShareHandle, __uuidof(ID3D11Resource), (void**)&amp;tempResource11);
+
+        if (FAILED(result))
+        {
+            ERR(&quot;Failed to open the swap chain pbuffer share handle: %08lX&quot;, result);
+            release();
+            return EGL_BAD_PARAMETER;
+        }
+
+        result = tempResource11-&gt;QueryInterface(__uuidof(ID3D11Texture2D), (void**)&amp;mOffscreenTexture);
+        SafeRelease(tempResource11);
+
+        if (FAILED(result))
+        {
+            ERR(&quot;Failed to query texture2d interface in pbuffer share handle: %08lX&quot;, result);
+            release();
+            return EGL_BAD_PARAMETER;
+        }
+
+        // Validate offscreen texture parameters
+        D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
+        mOffscreenTexture-&gt;GetDesc(&amp;offscreenTextureDesc);
+
+        if (offscreenTextureDesc.Width != (UINT)backbufferWidth ||
+            offscreenTextureDesc.Height != (UINT)backbufferHeight ||
+            offscreenTextureDesc.Format != backbufferFormatInfo.texFormat ||
+            offscreenTextureDesc.MipLevels != 1 ||
+            offscreenTextureDesc.ArraySize != 1)
+        {
+            ERR(&quot;Invalid texture parameters in the shared offscreen texture pbuffer&quot;);
+            release();
+            return EGL_BAD_PARAMETER;
+        }
+    }
+    else
+    {
+        const bool useSharedResource = !mNativeWindow.getNativeWindow() &amp;&amp; mRenderer-&gt;getShareHandleSupport();
+
+        D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
+        offscreenTextureDesc.Width = backbufferWidth;
+        offscreenTextureDesc.Height = backbufferHeight;
+        offscreenTextureDesc.Format = backbufferFormatInfo.texFormat;
+        offscreenTextureDesc.MipLevels = 1;
+        offscreenTextureDesc.ArraySize = 1;
+        offscreenTextureDesc.SampleDesc.Count = 1;
+        offscreenTextureDesc.SampleDesc.Quality = 0;
+        offscreenTextureDesc.Usage = D3D11_USAGE_DEFAULT;
+        offscreenTextureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
+        offscreenTextureDesc.CPUAccessFlags = 0;
+        offscreenTextureDesc.MiscFlags = useSharedResource ? D3D11_RESOURCE_MISC_SHARED : 0;
+
+        HRESULT result = device-&gt;CreateTexture2D(&amp;offscreenTextureDesc, NULL, &amp;mOffscreenTexture);
+
+        if (FAILED(result))
+        {
+            ERR(&quot;Could not create offscreen texture: %08lX&quot;, result);
+            release();
+
+            if (d3d11::isDeviceLostError(result))
+            {
+                return EGL_CONTEXT_LOST;
+            }
+            else
+            {
+                return EGL_BAD_ALLOC;
+            }
+        }
+
+        d3d11::SetDebugName(mOffscreenTexture, &quot;Offscreen back buffer texture&quot;);
+
+        // EGL_ANGLE_surface_d3d_texture_2d_share_handle requires that we store a share handle for the client
+        if (useSharedResource)
+        {
+            IDXGIResource *offscreenTextureResource = NULL;
+            result = mOffscreenTexture-&gt;QueryInterface(__uuidof(IDXGIResource), (void**)&amp;offscreenTextureResource);
+
+            // Fall back to no share handle on failure
+            if (FAILED(result))
+            {
+                ERR(&quot;Could not query offscreen texture resource: %08lX&quot;, result);
+            }
+            else
+            {
+                result = offscreenTextureResource-&gt;GetSharedHandle(&amp;mShareHandle);
+                SafeRelease(offscreenTextureResource);
+
+                if (FAILED(result))
+                {
+                    mShareHandle = NULL;
+                    ERR(&quot;Could not get offscreen texture shared handle: %08lX&quot;, result);
+                }
+            }
+        }
+    }
+
+
+    D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc;
+    offscreenRTVDesc.Format = backbufferFormatInfo.rtvFormat;
+    offscreenRTVDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+    offscreenRTVDesc.Texture2D.MipSlice = 0;
+
+    HRESULT result = device-&gt;CreateRenderTargetView(mOffscreenTexture, &amp;offscreenRTVDesc, &amp;mOffscreenRTView);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mOffscreenRTView, &quot;Offscreen back buffer render target&quot;);
+
+    D3D11_SHADER_RESOURCE_VIEW_DESC offscreenSRVDesc;
+    offscreenSRVDesc.Format = backbufferFormatInfo.srvFormat;
+    offscreenSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+    offscreenSRVDesc.Texture2D.MostDetailedMip = 0;
+    offscreenSRVDesc.Texture2D.MipLevels = static_cast&lt;UINT&gt;(-1);
+
+    result = device-&gt;CreateShaderResourceView(mOffscreenTexture, &amp;offscreenSRVDesc, &amp;mOffscreenSRView);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mOffscreenSRView, &quot;Offscreen back buffer shader resource&quot;);
+
+    const d3d11::TextureFormat &amp;depthBufferFormatInfo = d3d11::GetTextureFormatInfo(mDepthBufferFormat, mRenderer-&gt;getFeatureLevel());
+
+    if (mDepthBufferFormat != GL_NONE)
+    {
+        D3D11_TEXTURE2D_DESC depthStencilTextureDesc;
+        depthStencilTextureDesc.Width = backbufferWidth;
+        depthStencilTextureDesc.Height = backbufferHeight;
+        depthStencilTextureDesc.Format = depthBufferFormatInfo.texFormat;
+        depthStencilTextureDesc.MipLevels = 1;
+        depthStencilTextureDesc.ArraySize = 1;
+        depthStencilTextureDesc.SampleDesc.Count = 1;
+        depthStencilTextureDesc.SampleDesc.Quality = 0;
+        depthStencilTextureDesc.Usage = D3D11_USAGE_DEFAULT;
+        depthStencilTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
+
+        if (depthBufferFormatInfo.srvFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            depthStencilTextureDesc.BindFlags |= D3D11_BIND_SHADER_RESOURCE;
+        }
+
+        depthStencilTextureDesc.CPUAccessFlags = 0;
+        depthStencilTextureDesc.MiscFlags = 0;
+
+        result = device-&gt;CreateTexture2D(&amp;depthStencilTextureDesc, NULL, &amp;mDepthStencilTexture);
+        if (FAILED(result))
+        {
+            ERR(&quot;Could not create depthstencil surface for new swap chain: 0x%08X&quot;, result);
+            release();
+
+            if (d3d11::isDeviceLostError(result))
+            {
+                return EGL_CONTEXT_LOST;
+            }
+            else
+            {
+                return EGL_BAD_ALLOC;
+            }
+        }
+        d3d11::SetDebugName(mDepthStencilTexture, &quot;Offscreen depth stencil texture&quot;);
+
+        D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilDesc;
+        depthStencilDesc.Format = depthBufferFormatInfo.dsvFormat;
+        depthStencilDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+        depthStencilDesc.Flags = 0;
+        depthStencilDesc.Texture2D.MipSlice = 0;
+
+        result = device-&gt;CreateDepthStencilView(mDepthStencilTexture, &amp;depthStencilDesc, &amp;mDepthStencilDSView);
+        ASSERT(SUCCEEDED(result));
+        d3d11::SetDebugName(mDepthStencilDSView, &quot;Offscreen depth stencil view&quot;);
+
+        if (depthBufferFormatInfo.srvFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            D3D11_SHADER_RESOURCE_VIEW_DESC depthStencilSRVDesc;
+            depthStencilSRVDesc.Format = depthBufferFormatInfo.srvFormat;
+            depthStencilSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+            depthStencilSRVDesc.Texture2D.MostDetailedMip = 0;
+            depthStencilSRVDesc.Texture2D.MipLevels = static_cast&lt;UINT&gt;(-1);
+
+            result = device-&gt;CreateShaderResourceView(mDepthStencilTexture, &amp;depthStencilSRVDesc, &amp;mDepthStencilSRView);
+            ASSERT(SUCCEEDED(result));
+            d3d11::SetDebugName(mDepthStencilSRView, &quot;Offscreen depth stencil shader resource&quot;);
+        }
+    }
+
+    mWidth = backbufferWidth;
+    mHeight = backbufferHeight;
+
+    if (previousOffscreenTexture != NULL)
+    {
+        D3D11_BOX sourceBox = {0};
+        sourceBox.left = 0;
+        sourceBox.right = std::min(previousWidth, mWidth);
+        sourceBox.top = std::max(previousHeight - mHeight, 0);
+        sourceBox.bottom = previousHeight;
+        sourceBox.front = 0;
+        sourceBox.back = 1;
+
+        ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+        const int yoffset = std::max(mHeight - previousHeight, 0);
+        deviceContext-&gt;CopySubresourceRegion(mOffscreenTexture, 0, 0, yoffset, 0, previousOffscreenTexture, 0, &amp;sourceBox);
+
+        SafeRelease(previousOffscreenTexture);
+
+        if (mSwapChain)
+        {
+            swapRect(0, 0, mWidth, mHeight);
+        }
+    }
+
+    return EGL_SUCCESS;
+}
+
+EGLint SwapChain11::resize(EGLint backbufferWidth, EGLint backbufferHeight)
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;SwapChain11::resize&quot;);
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    if (device == NULL)
+    {
+        return EGL_BAD_ACCESS;
+    }
+
+    // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+    if (backbufferWidth &lt; 1 || backbufferHeight &lt; 1)
+    {
+        return EGL_SUCCESS;
+    }
+
+    // Can only call resize if we have already created our swap buffer and resources
+    ASSERT(mSwapChain &amp;&amp; mBackBufferTexture &amp;&amp; mBackBufferRTView);
+
+    SafeRelease(mBackBufferTexture);
+    SafeRelease(mBackBufferRTView);
+
+    // Resize swap chain
+    DXGI_SWAP_CHAIN_DESC desc;
+    mSwapChain-&gt;GetDesc(&amp;desc);
+    const d3d11::TextureFormat &amp;backbufferFormatInfo = d3d11::GetTextureFormatInfo(mBackBufferFormat, mRenderer-&gt;getFeatureLevel());
+    HRESULT result = mSwapChain-&gt;ResizeBuffers(desc.BufferCount, backbufferWidth, backbufferHeight, backbufferFormatInfo.texFormat, 0);
+
+    if (FAILED(result))
+    {
+        ERR(&quot;Error resizing swap chain buffers: 0x%08X&quot;, result);
+        release();
+
+        if (d3d11::isDeviceLostError(result))
+        {
+            return EGL_CONTEXT_LOST;
+        }
+        else
+        {
+            return EGL_BAD_ALLOC;
+        }
+    }
+
+    result = mSwapChain-&gt;GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&amp;mBackBufferTexture);
+    ASSERT(SUCCEEDED(result));
+    if (SUCCEEDED(result))
+    {
+        d3d11::SetDebugName(mBackBufferTexture, &quot;Back buffer texture&quot;);
+    }
+
+    result = device-&gt;CreateRenderTargetView(mBackBufferTexture, NULL, &amp;mBackBufferRTView);
+    ASSERT(SUCCEEDED(result));
+    if (SUCCEEDED(result))
+    {
+        d3d11::SetDebugName(mBackBufferRTView, &quot;Back buffer render target&quot;);
+    }
+
+    return resetOffscreenTexture(backbufferWidth, backbufferHeight);
+}
+
+EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swapInterval)
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;SwapChain11::reset&quot;);
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    if (device == NULL)
+    {
+        return EGL_BAD_ACCESS;
+    }
+
+    // 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.
+    SafeRelease(mSwapChain);
+    SafeRelease(mBackBufferTexture);
+    SafeRelease(mBackBufferRTView);
+
+    mSwapInterval = static_cast&lt;unsigned int&gt;(swapInterval);
+    if (mSwapInterval &gt; 4)
+    {
+        // IDXGISwapChain::Present documentation states that valid sync intervals are in the [0,4] range
+        return EGL_BAD_PARAMETER;
+    }
+
+    // EGL allows creating a surface with 0x0 dimension, however, DXGI does not like 0x0 swapchains
+    if (backbufferWidth &lt; 1 || backbufferHeight &lt; 1)
+    {
+        releaseOffscreenTexture();
+        return EGL_SUCCESS;
+    }
+
+    if (mNativeWindow.getNativeWindow())
+    {
+        const d3d11::TextureFormat &amp;backbufferFormatInfo = d3d11::GetTextureFormatInfo(mBackBufferFormat, mRenderer-&gt;getFeatureLevel());
+
+        HRESULT result = mNativeWindow.createSwapChain(device, mRenderer-&gt;getDxgiFactory(),
+                                               backbufferFormatInfo.texFormat,
+                                               backbufferWidth, backbufferHeight, &amp;mSwapChain);
+
+        if (FAILED(result))
+        {
+            ERR(&quot;Could not create additional swap chains or offscreen surfaces: %08lX&quot;, result);
+            release();
+
+            if (d3d11::isDeviceLostError(result))
+            {
+                return EGL_CONTEXT_LOST;
+            }
+            else
+            {
+                return EGL_BAD_ALLOC;
+            }
+        }
+
+        result = mSwapChain-&gt;GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&amp;mBackBufferTexture);
+        ASSERT(SUCCEEDED(result));
+        d3d11::SetDebugName(mBackBufferTexture, &quot;Back buffer texture&quot;);
+
+        result = device-&gt;CreateRenderTargetView(mBackBufferTexture, NULL, &amp;mBackBufferRTView);
+        ASSERT(SUCCEEDED(result));
+        d3d11::SetDebugName(mBackBufferRTView, &quot;Back buffer render target&quot;);
+    }
+
+    // If we are resizing the swap chain, we don't wish to recreate all the static resources
+    if (!mPassThroughResourcesInit)
+    {
+        mPassThroughResourcesInit = true;
+        initPassThroughResources();
+    }
+
+    return resetOffscreenTexture(backbufferWidth, backbufferHeight);
+}
+
+void SwapChain11::initPassThroughResources()
+{
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;SwapChain11::initPassThroughResources&quot;);
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+
+    ASSERT(device != NULL);
+
+    // Make sure our resources are all not allocated, when we create
+    ASSERT(mQuadVB == NULL &amp;&amp; mPassThroughSampler == NULL);
+    ASSERT(mPassThroughIL == NULL &amp;&amp; mPassThroughVS == NULL &amp;&amp; mPassThroughPS == NULL);
+
+    D3D11_BUFFER_DESC vbDesc;
+    vbDesc.ByteWidth = sizeof(d3d11::PositionTexCoordVertex) * 4;
+    vbDesc.Usage = D3D11_USAGE_DYNAMIC;
+    vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+    vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+    vbDesc.MiscFlags = 0;
+    vbDesc.StructureByteStride = 0;
+
+    HRESULT result = device-&gt;CreateBuffer(&amp;vbDesc, NULL, &amp;mQuadVB);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mQuadVB, &quot;Swap chain quad vertex buffer&quot;);
+
+    D3D11_SAMPLER_DESC samplerDesc;
+    samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
+    samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
+    samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
+    samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+    samplerDesc.MipLODBias = 0.0f;
+    samplerDesc.MaxAnisotropy = 0;
+    samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
+    samplerDesc.BorderColor[0] = 0.0f;
+    samplerDesc.BorderColor[1] = 0.0f;
+    samplerDesc.BorderColor[2] = 0.0f;
+    samplerDesc.BorderColor[3] = 0.0f;
+    samplerDesc.MinLOD = 0;
+    samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
+
+    result = device-&gt;CreateSamplerState(&amp;samplerDesc, &amp;mPassThroughSampler);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mPassThroughSampler, &quot;Swap chain pass through sampler&quot;);
+
+    D3D11_INPUT_ELEMENT_DESC quadLayout[] =
+    {
+        { &quot;POSITION&quot;, 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+        { &quot;TEXCOORD&quot;, 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+    };
+
+    result = device-&gt;CreateInputLayout(quadLayout, 2, g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), &amp;mPassThroughIL);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mPassThroughIL, &quot;Swap chain pass through layout&quot;);
+
+    result = device-&gt;CreateVertexShader(g_VS_Passthrough2D, sizeof(g_VS_Passthrough2D), NULL, &amp;mPassThroughVS);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mPassThroughVS, &quot;Swap chain pass through vertex shader&quot;);
+
+    result = device-&gt;CreatePixelShader(g_PS_PassthroughRGBA2D, sizeof(g_PS_PassthroughRGBA2D), NULL, &amp;mPassThroughPS);
+    ASSERT(SUCCEEDED(result));
+    d3d11::SetDebugName(mPassThroughPS, &quot;Swap chain pass through pixel shader&quot;);
+}
+
+// parameters should be validated/clamped by caller
+EGLint SwapChain11::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    if (!mSwapChain)
+    {
+        return EGL_SUCCESS;
+    }
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    ID3D11DeviceContext *deviceContext = mRenderer-&gt;getDeviceContext();
+
+    // Set vertices
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    HRESULT result = deviceContext-&gt;Map(mQuadVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return EGL_BAD_ACCESS;
+    }
+
+    d3d11::PositionTexCoordVertex *vertices = static_cast&lt;d3d11::PositionTexCoordVertex*&gt;(mappedResource.pData);
+
+    // Create a quad in homogeneous coordinates
+    float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
+    float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
+    float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
+    float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
+
+    float u1 = x / float(mWidth);
+    float v1 = y / float(mHeight);
+    float u2 = (x + width) / float(mWidth);
+    float v2 = (y + height) / float(mHeight);
+
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[0], x1, y1, u1, v1);
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[1], x1, y2, u1, v2);
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[2], x2, y1, u2, v1);
+    d3d11::SetPositionTexCoordVertex(&amp;vertices[3], x2, y2, u2, v2);
+
+    deviceContext-&gt;Unmap(mQuadVB, 0);
+
+    static UINT stride = sizeof(d3d11::PositionTexCoordVertex);
+    static UINT startIdx = 0;
+    deviceContext-&gt;IASetVertexBuffers(0, 1, &amp;mQuadVB, &amp;stride, &amp;startIdx);
+
+    // Apply state
+    deviceContext-&gt;OMSetDepthStencilState(NULL, 0xFFFFFFFF);
+
+    static const float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
+    deviceContext-&gt;OMSetBlendState(NULL, blendFactor, 0xFFFFFFF);
+
+    deviceContext-&gt;RSSetState(NULL);
+
+    // Apply shaders
+    deviceContext-&gt;IASetInputLayout(mPassThroughIL);
+    deviceContext-&gt;IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+    deviceContext-&gt;VSSetShader(mPassThroughVS, NULL, 0);
+    deviceContext-&gt;PSSetShader(mPassThroughPS, NULL, 0);
+    deviceContext-&gt;GSSetShader(NULL, NULL, 0);
+
+    // Apply render targets
+    mRenderer-&gt;setOneTimeRenderTarget(mBackBufferRTView);
+
+    // Set the viewport
+    D3D11_VIEWPORT viewport;
+    viewport.TopLeftX = 0;
+    viewport.TopLeftY = 0;
+    viewport.Width = static_cast&lt;FLOAT&gt;(mWidth);
+    viewport.Height = static_cast&lt;FLOAT&gt;(mHeight);
+    viewport.MinDepth = 0.0f;
+    viewport.MaxDepth = 1.0f;
+    deviceContext-&gt;RSSetViewports(1, &amp;viewport);
+
+    // Apply textures
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, mOffscreenSRView);
+    deviceContext-&gt;PSSetSamplers(0, 1, &amp;mPassThroughSampler);
+
+    // Draw
+    deviceContext-&gt;Draw(4, 0);
+
+#if ANGLE_VSYNC == ANGLE_DISABLED
+    result = mSwapChain-&gt;Present(0, 0);
+#else
+    result = mSwapChain-&gt;Present(mSwapInterval, 0);
+#endif
+
+    if (result == DXGI_ERROR_DEVICE_REMOVED)
+    {
+        HRESULT removedReason = device-&gt;GetDeviceRemovedReason();
+        UNUSED_TRACE_VARIABLE(removedReason);
+        ERR(&quot;Present failed: the D3D11 device was removed: 0x%08X&quot;, removedReason);
+        return EGL_CONTEXT_LOST;
+    }
+    else if (result == DXGI_ERROR_DEVICE_RESET)
+    {
+        ERR(&quot;Present failed: the D3D11 device was reset from a bad command.&quot;);
+        return EGL_CONTEXT_LOST;
+    }
+    else if (FAILED(result))
+    {
+        ERR(&quot;Present failed with error code 0x%08X&quot;, result);
+    }
+
+    // Unbind
+    mRenderer-&gt;setShaderResource(gl::SAMPLER_PIXEL, 0, NULL);
+
+    mRenderer-&gt;unapplyRenderTargets();
+    mRenderer-&gt;markAllStateDirty();
+
+    return EGL_SUCCESS;
+}
+
+ID3D11Texture2D *SwapChain11::getOffscreenTexture()
+{
+    return mOffscreenTexture;
+}
+
+ID3D11RenderTargetView *SwapChain11::getRenderTarget()
+{
+    return mOffscreenRTView;
+}
+
+ID3D11ShaderResourceView *SwapChain11::getRenderTargetShaderResource()
+{
+    return mOffscreenSRView;
+}
+
+ID3D11DepthStencilView *SwapChain11::getDepthStencil()
+{
+    return mDepthStencilDSView;
+}
+
+ID3D11ShaderResourceView * SwapChain11::getDepthStencilShaderResource()
+{
+    return mDepthStencilSRView;
+}
+
+ID3D11Texture2D *SwapChain11::getDepthStencilTexture()
+{
+    return mDepthStencilTexture;
+}
+
+void SwapChain11::recreate()
+{
+    // possibly should use this method instead of reset
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11SwapChain11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+//
+// 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.
+//
+
+// SwapChain11.h: Defines a back-end specific class for the D3D11 swap chain.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_SWAPCHAIN11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_SWAPCHAIN11_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/SwapChainD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+class SwapChain11 : public SwapChainD3D
+{
+  public:
+    SwapChain11(Renderer11 *renderer, NativeWindow nativeWindow, HANDLE shareHandle,
+                GLenum backBufferFormat, GLenum depthBufferFormat);
+    virtual ~SwapChain11();
+
+    EGLint resize(EGLint backbufferWidth, EGLint backbufferHeight);
+    virtual EGLint reset(EGLint backbufferWidth, EGLint backbufferHeight, EGLint swapInterval);
+    virtual EGLint swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
+    virtual void recreate();
+
+    RenderTargetD3D *getColorRenderTarget() override { return &amp;mColorRenderTarget; }
+    RenderTargetD3D *getDepthStencilRenderTarget() override { return &amp;mDepthStencilRenderTarget; }
+
+    virtual ID3D11Texture2D *getOffscreenTexture();
+    virtual ID3D11RenderTargetView *getRenderTarget();
+    virtual ID3D11ShaderResourceView *getRenderTargetShaderResource();
+
+    virtual ID3D11Texture2D *getDepthStencilTexture();
+    virtual ID3D11DepthStencilView *getDepthStencil();
+    virtual ID3D11ShaderResourceView *getDepthStencilShaderResource();
+
+    EGLint getWidth() const { return mWidth; }
+    EGLint getHeight() const { return mHeight; }
+
+  private:
+    void release();
+    void initPassThroughResources();
+    void releaseOffscreenTexture();
+    EGLint resetOffscreenTexture(int backbufferWidth, int backbufferHeight);
+
+    Renderer11 *mRenderer;
+    EGLint mHeight;
+    EGLint mWidth;
+    bool mAppCreatedShareHandle;
+    unsigned int mSwapInterval;
+    bool mPassThroughResourcesInit;
+
+    DXGISwapChain *mSwapChain;
+
+    ID3D11Texture2D *mBackBufferTexture;
+    ID3D11RenderTargetView *mBackBufferRTView;
+
+    ID3D11Texture2D *mOffscreenTexture;
+    ID3D11RenderTargetView *mOffscreenRTView;
+    ID3D11ShaderResourceView *mOffscreenSRView;
+
+    ID3D11Texture2D *mDepthStencilTexture;
+    ID3D11DepthStencilView *mDepthStencilDSView;
+    ID3D11ShaderResourceView *mDepthStencilSRView;
+
+    ID3D11Buffer *mQuadVB;
+    ID3D11SamplerState *mPassThroughSampler;
+    ID3D11InputLayout *mPassThroughIL;
+    ID3D11VertexShader *mPassThroughVS;
+    ID3D11PixelShader *mPassThroughPS;
+
+    SurfaceRenderTarget11 mColorRenderTarget;
+    SurfaceRenderTarget11 mDepthStencilRenderTarget;
+};
+
+}
+#endif // LIBANGLE_RENDERER_D3D_D3D11_SWAPCHAIN11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11TextureStorage11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,2731 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// TextureStorage11.cpp: Implements the abstract rx::TextureStorage11 class and its concrete derived
+// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/TextureStorage11.h&quot;
+
+#include &lt;tuple&gt;
+
+#include &quot;common/MemoryBuffer.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/ImageIndex.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Blit11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Image11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/SwapChain11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+
+namespace rx
+{
+
+TextureStorage11::SwizzleCacheValue::SwizzleCacheValue()
+    : swizzleRed(GL_NONE), swizzleGreen(GL_NONE), swizzleBlue(GL_NONE), swizzleAlpha(GL_NONE)
+{
+}
+
+TextureStorage11::SwizzleCacheValue::SwizzleCacheValue(GLenum red, GLenum green, GLenum blue, GLenum alpha)
+    : swizzleRed(red), swizzleGreen(green), swizzleBlue(blue), swizzleAlpha(alpha)
+{
+}
+
+bool TextureStorage11::SwizzleCacheValue::operator==(const SwizzleCacheValue &amp;other) const
+{
+    return swizzleRed == other.swizzleRed &amp;&amp;
+           swizzleGreen == other.swizzleGreen &amp;&amp;
+           swizzleBlue == other.swizzleBlue &amp;&amp;
+           swizzleAlpha == other.swizzleAlpha;
+}
+
+bool TextureStorage11::SwizzleCacheValue::operator!=(const SwizzleCacheValue &amp;other) const
+{
+    return !(*this == other);
+}
+
+TextureStorage11::SRVKey::SRVKey(int baseLevel, int mipLevels, bool swizzle)
+    : baseLevel(baseLevel), mipLevels(mipLevels), swizzle(swizzle)
+{
+}
+
+bool TextureStorage11::SRVKey::operator&lt;(const SRVKey &amp;rhs) const
+{
+    return std::tie(baseLevel, mipLevels, swizzle) &lt; std::tie(rhs.baseLevel, rhs.mipLevels, rhs.swizzle);
+}
+
+TextureStorage11::TextureStorage11(Renderer11 *renderer, UINT bindFlags, UINT miscFlags)
+    : mRenderer(renderer),
+      mBindFlags(bindFlags),
+      mMiscFlags(miscFlags),
+      mTopLevel(0),
+      mMipLevels(0),
+      mInternalFormat(GL_NONE),
+      mTextureFormat(DXGI_FORMAT_UNKNOWN),
+      mShaderResourceFormat(DXGI_FORMAT_UNKNOWN),
+      mRenderTargetFormat(DXGI_FORMAT_UNKNOWN),
+      mDepthStencilFormat(DXGI_FORMAT_UNKNOWN),
+      mTextureWidth(0),
+      mTextureHeight(0),
+      mTextureDepth(0)
+{
+    for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        mLevelSRVs[i] = nullptr;
+    }
+}
+
+TextureStorage11::~TextureStorage11()
+{
+    for (unsigned int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        SafeRelease(mLevelSRVs[level]);
+    }
+
+    for (SRVCache::iterator i = mSrvCache.begin(); i != mSrvCache.end(); i++)
+    {
+        SafeRelease(i-&gt;second);
+    }
+    mSrvCache.clear();
+}
+
+DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat, D3D_FEATURE_LEVEL featureLevel, bool renderTarget)
+{
+    UINT bindFlags = 0;
+
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalFormat, featureLevel);
+    if (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN)
+    {
+        bindFlags |= D3D11_BIND_SHADER_RESOURCE;
+    }
+    if (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
+    {
+        bindFlags |= D3D11_BIND_DEPTH_STENCIL;
+    }
+    if (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN &amp;&amp; renderTarget)
+    {
+        bindFlags |= D3D11_BIND_RENDER_TARGET;
+    }
+
+    return bindFlags;
+}
+
+DWORD TextureStorage11::GetTextureMiscFlags(GLenum internalFormat, D3D_FEATURE_LEVEL featureLevel, bool renderTarget, int levels)
+{
+    UINT miscFlags = 0;
+
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalFormat, featureLevel);
+    if (renderTarget &amp;&amp; levels &gt; 1)
+    {
+        const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(formatInfo.srvFormat);
+
+        if (dxgiFormatInfo.nativeMipmapSupport(featureLevel))
+        {
+            miscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
+        }
+    }
+
+    return miscFlags;
+}
+
+UINT TextureStorage11::getBindFlags() const
+{
+    return mBindFlags;
+}
+
+UINT TextureStorage11::getMiscFlags() const
+{
+    return mMiscFlags;
+}
+
+int TextureStorage11::getTopLevel() const
+{
+    return mTopLevel;
+}
+
+bool TextureStorage11::isRenderTarget() const
+{
+    return (mBindFlags &amp; (D3D11_BIND_RENDER_TARGET | D3D11_BIND_DEPTH_STENCIL)) != 0;
+}
+
+bool TextureStorage11::isManaged() const
+{
+    return false;
+}
+
+bool TextureStorage11::supportsNativeMipmapFunction() const
+{
+    return (mMiscFlags &amp; D3D11_RESOURCE_MISC_GENERATE_MIPS) != 0;
+}
+
+int TextureStorage11::getLevelCount() const
+{
+    return mMipLevels - mTopLevel;
+}
+
+int TextureStorage11::getLevelWidth(int mipLevel) const
+{
+    return std::max(static_cast&lt;int&gt;(mTextureWidth) &gt;&gt; mipLevel, 1);
+}
+
+int TextureStorage11::getLevelHeight(int mipLevel) const
+{
+    return std::max(static_cast&lt;int&gt;(mTextureHeight) &gt;&gt; mipLevel, 1);
+}
+
+int TextureStorage11::getLevelDepth(int mipLevel) const
+{
+    return std::max(static_cast&lt;int&gt;(mTextureDepth) &gt;&gt; mipLevel, 1);
+}
+
+UINT TextureStorage11::getSubresourceIndex(const gl::ImageIndex &amp;index) const
+{
+    UINT mipSlice = static_cast&lt;UINT&gt;(index.mipIndex + mTopLevel);
+    UINT arraySlice = static_cast&lt;UINT&gt;(index.hasLayer() ? index.layerIndex : 0);
+    UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels);
+    ASSERT(subresource != std::numeric_limits&lt;UINT&gt;::max());
+    return subresource;
+}
+
+gl::Error TextureStorage11::getSRV(const gl::SamplerState &amp;samplerState, ID3D11ShaderResourceView **outSRV)
+{
+    bool swizzleRequired = samplerState.swizzleRequired();
+    bool mipmapping = gl::IsMipmapFiltered(samplerState);
+    unsigned int mipLevels = mipmapping ? (samplerState.maxLevel - samplerState.baseLevel + 1) : 1;
+
+    // Make sure there's 'mipLevels' mipmap levels below the base level (offset by the top level, which corresponds to GL level 0)
+    mipLevels = std::min(mipLevels, mMipLevels - mTopLevel - samplerState.baseLevel);
+
+    if (mRenderer-&gt;getFeatureLevel() &lt;= D3D_FEATURE_LEVEL_9_3)
+    {
+        ASSERT(!swizzleRequired);
+        ASSERT(mipLevels == 1 || mipLevels == mMipLevels);
+    }
+
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        // We must ensure that the level zero texture is in sync with mipped texture.
+        gl::Error error = useLevelZeroWorkaroundTexture(mipLevels == 1);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    if (swizzleRequired)
+    {
+        verifySwizzleExists(samplerState.swizzleRed, samplerState.swizzleGreen, samplerState.swizzleBlue, samplerState.swizzleAlpha);
+    }
+
+    SRVKey key(samplerState.baseLevel, mipLevels, swizzleRequired);
+    auto iter = mSrvCache.find(key);
+    if (iter != mSrvCache.end())
+    {
+        *outSRV = iter-&gt;second;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    ID3D11Resource *texture = nullptr;
+    if (swizzleRequired)
+    {
+        gl::Error error = getSwizzleTexture(&amp;texture);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+    else
+    {
+        gl::Error error = getResource(&amp;texture);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    ID3D11ShaderResourceView *srv = nullptr;
+    DXGI_FORMAT format = (swizzleRequired ? mSwizzleShaderResourceFormat : mShaderResourceFormat);
+    gl::Error error = createSRV(samplerState.baseLevel, mipLevels, format, texture, &amp;srv);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mSrvCache.insert(std::make_pair(key, srv));
+    *outSRV = srv;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11::getSRVLevel(int mipLevel, ID3D11ShaderResourceView **outSRV)
+{
+    ASSERT(mipLevel &gt;= 0 &amp;&amp; mipLevel &lt; getLevelCount());
+
+    if (!mLevelSRVs[mipLevel])
+    {
+        ID3D11Resource *resource = NULL;
+        gl::Error error = getResource(&amp;resource);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        error = createSRV(mipLevel, 1, mShaderResourceFormat, resource, &amp;mLevelSRVs[mipLevel]);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    *outSRV = mLevelSRVs[mipLevel];
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11::getSRVLevels(GLint baseLevel, GLint maxLevel, ID3D11ShaderResourceView **outSRV)
+{
+    unsigned int mipLevels = maxLevel - baseLevel + 1;
+
+    // Make sure there's 'mipLevels' mipmap levels below the base level (offset by the top level, which corresponds to GL level 0)
+    mipLevels = std::min(mipLevels, mMipLevels - mTopLevel - baseLevel);
+
+    if (mRenderer-&gt;getFeatureLevel() &lt;= D3D_FEATURE_LEVEL_9_3)
+    {
+        ASSERT(mipLevels == 1 || mipLevels == mMipLevels);
+    }
+
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        // We must ensure that the level zero texture is in sync with mipped texture.
+        gl::Error error = useLevelZeroWorkaroundTexture(mipLevels == 1);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    SRVKey key(baseLevel, mipLevels, false);
+    auto iter = mSrvCache.find(key);
+    if (iter != mSrvCache.end())
+    {
+        *outSRV = iter-&gt;second;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    ID3D11Resource *texture = nullptr;
+    gl::Error error = getResource(&amp;texture);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ID3D11ShaderResourceView *srv = nullptr;
+    error = createSRV(baseLevel, mipLevels, mShaderResourceFormat, texture, &amp;srv);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mSrvCache[key] = srv;
+    *outSRV = srv;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11::generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
+{
+    SwizzleCacheValue swizzleTarget(swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha);
+    for (int level = 0; level &lt; getLevelCount(); level++)
+    {
+        // Check if the swizzle for this level is out of date
+        if (mSwizzleCache[level] != swizzleTarget)
+        {
+            // Need to re-render the swizzle for this level
+            ID3D11ShaderResourceView *sourceSRV = NULL;
+            gl::Error error = getSRVLevel(level, &amp;sourceSRV);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ID3D11RenderTargetView *destRTV = NULL;
+            error = getSwizzleRenderTarget(level, &amp;destRTV);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            gl::Extents size(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+
+            Blit11 *blitter = mRenderer-&gt;getBlitter();
+
+            error = blitter-&gt;swizzleTexture(sourceSRV, destRTV, size, swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            mSwizzleCache[level] = swizzleTarget;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureStorage11::invalidateSwizzleCacheLevel(int mipLevel)
+{
+    if (mipLevel &gt;= 0 &amp;&amp; static_cast&lt;unsigned int&gt;(mipLevel) &lt; ArraySize(mSwizzleCache))
+    {
+        // The default constructor of SwizzleCacheValue has GL_NONE for all channels which is not a
+        // valid swizzle combination
+        mSwizzleCache[mipLevel] = SwizzleCacheValue();
+    }
+}
+
+void TextureStorage11::invalidateSwizzleCache()
+{
+    for (unsigned int mipLevel = 0; mipLevel &lt; ArraySize(mSwizzleCache); mipLevel++)
+    {
+        invalidateSwizzleCacheLevel(mipLevel);
+    }
+}
+
+gl::Error TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture, unsigned int sourceSubresource,
+                                                   const gl::ImageIndex &amp;index, const gl::Box &amp;copyArea)
+{
+    ASSERT(srcTexture);
+
+    GLint level = index.mipIndex;
+
+    invalidateSwizzleCacheLevel(level);
+
+    gl::Extents texSize(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
+
+    bool fullCopy = copyArea.x == 0 &amp;&amp;
+                    copyArea.y == 0 &amp;&amp;
+                    copyArea.z == 0 &amp;&amp;
+                    copyArea.width  == texSize.width &amp;&amp;
+                    copyArea.height == texSize.height &amp;&amp;
+                    copyArea.depth  == texSize.depth;
+
+    ID3D11Resource *dstTexture = NULL;
+    gl::Error error(GL_NO_ERROR);
+
+    // If the zero-LOD workaround is active and we want to update a level greater than zero, then we should
+    // update the mipmapped texture, even if mapmaps are currently disabled.
+    if (index.mipIndex &gt; 0 &amp;&amp; mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        error = getMippedResource(&amp;dstTexture);
+    }
+    else
+    {
+        error = getResource(&amp;dstTexture);
+    }
+
+    if (error.isError())
+    {
+        return error;
+    }
+
+    unsigned int dstSubresource = getSubresourceIndex(index);
+
+    ASSERT(dstTexture);
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mTextureFormat);
+    if (!fullCopy &amp;&amp; (dxgiFormatInfo.depthBits &gt; 0 || dxgiFormatInfo.stencilBits &gt; 0))
+    {
+        // CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
+        Blit11 *blitter = mRenderer-&gt;getBlitter();
+
+        return blitter-&gt;copyDepthStencil(srcTexture, sourceSubresource, copyArea, texSize,
+                                         dstTexture, dstSubresource, copyArea, texSize,
+                                         NULL);
+    }
+    else
+    {
+        D3D11_BOX srcBox;
+        srcBox.left = copyArea.x;
+        srcBox.top = copyArea.y;
+        srcBox.right = copyArea.x + roundUp(static_cast&lt;UINT&gt;(copyArea.width), dxgiFormatInfo.blockWidth);
+        srcBox.bottom = copyArea.y + roundUp(static_cast&lt;UINT&gt;(copyArea.height), dxgiFormatInfo.blockHeight);
+        srcBox.front = copyArea.z;
+        srcBox.back = copyArea.z + copyArea.depth;
+
+        ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+
+        context-&gt;CopySubresourceRegion(dstTexture, dstSubresource, copyArea.x, copyArea.y, copyArea.z,
+                                       srcTexture, sourceSubresource, fullCopy ? NULL : &amp;srcBox);
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error TextureStorage11::copySubresourceLevel(ID3D11Resource* dstTexture, unsigned int dstSubresource,
+                                                 const gl::ImageIndex &amp;index, const gl::Box &amp;region)
+{
+    ASSERT(dstTexture);
+
+    ID3D11Resource *srcTexture = NULL;
+    gl::Error error(GL_NO_ERROR);
+
+    // If the zero-LOD workaround is active and we want to update a level greater than zero, then we should
+    // update the mipmapped texture, even if mapmaps are currently disabled.
+    if (index.mipIndex &gt; 0 &amp;&amp; mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        error = getMippedResource(&amp;srcTexture);
+    }
+    else
+    {
+        error = getResource(&amp;srcTexture);
+    }
+
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(srcTexture);
+
+    unsigned int srcSubresource = getSubresourceIndex(index);
+
+    ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+
+    // D3D11 can't perform partial CopySubresourceRegion on depth/stencil textures, so pSrcBox should be NULL.
+    D3D11_BOX srcBox;
+    D3D11_BOX *pSrcBox = NULL;
+    if (mRenderer-&gt;getFeatureLevel() &lt;= D3D_FEATURE_LEVEL_9_3)
+    {
+        // However, D3D10Level9 doesn't always perform CopySubresourceRegion correctly unless the source box
+        // is specified. This is okay, since we don't perform CopySubresourceRegion on depth/stencil
+        // textures on 9_3.
+        ASSERT(d3d11::GetDXGIFormatInfo(mTextureFormat).depthBits == 0);
+        ASSERT(d3d11::GetDXGIFormatInfo(mTextureFormat).stencilBits == 0);
+        srcBox.left = region.x;
+        srcBox.right = region.x + region.width;
+        srcBox.top = region.y;
+        srcBox.bottom = region.y + region.height;
+        srcBox.front = region.z;
+        srcBox.back = region.z + region.depth;
+        pSrcBox = &amp;srcBox;
+    }
+
+    context-&gt;CopySubresourceRegion(dstTexture, dstSubresource, region.x, region.y, region.z,
+                                   srcTexture, srcSubresource, pSrcBox);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11::generateMipmap(const gl::ImageIndex &amp;sourceIndex, const gl::ImageIndex &amp;destIndex)
+{
+    ASSERT(sourceIndex.layerIndex == destIndex.layerIndex);
+
+    invalidateSwizzleCacheLevel(destIndex.mipIndex);
+
+    RenderTargetD3D *source = NULL;
+    gl::Error error = getRenderTarget(sourceIndex, &amp;source);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    RenderTargetD3D *dest = NULL;
+    error = getRenderTarget(destIndex, &amp;dest);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ID3D11ShaderResourceView *sourceSRV = GetAs&lt;RenderTarget11&gt;(source)-&gt;getShaderResourceView();
+    ID3D11RenderTargetView *destRTV = GetAs&lt;RenderTarget11&gt;(dest)-&gt;getRenderTargetView();
+
+    gl::Box sourceArea(0, 0, 0, source-&gt;getWidth(), source-&gt;getHeight(), source-&gt;getDepth());
+    gl::Extents sourceSize(source-&gt;getWidth(), source-&gt;getHeight(), source-&gt;getDepth());
+
+    gl::Box destArea(0, 0, 0, dest-&gt;getWidth(), dest-&gt;getHeight(), dest-&gt;getDepth());
+    gl::Extents destSize(dest-&gt;getWidth(), dest-&gt;getHeight(), dest-&gt;getDepth());
+
+    Blit11 *blitter = mRenderer-&gt;getBlitter();
+    return blitter-&gt;copyTexture(sourceSRV, sourceArea, sourceSize, destRTV, destArea, destSize, NULL,
+                                gl::GetInternalFormatInfo(source-&gt;getInternalFormat()).format, GL_LINEAR);
+}
+
+void TextureStorage11::verifySwizzleExists(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha)
+{
+    SwizzleCacheValue swizzleTarget(swizzleRed, swizzleGreen, swizzleBlue, swizzleAlpha);
+    for (unsigned int level = 0; level &lt; mMipLevels; level++)
+    {
+        ASSERT(mSwizzleCache[level] == swizzleTarget);
+    }
+}
+
+gl::Error TextureStorage11::copyToStorage(TextureStorage *destStorage)
+{
+    ASSERT(destStorage);
+
+    ID3D11Resource *sourceResouce = NULL;
+    gl::Error error = getResource(&amp;sourceResouce);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    TextureStorage11 *dest11 = GetAs&lt;TextureStorage11&gt;(destStorage);
+    ID3D11Resource *destResource = NULL;
+    error = dest11-&gt;getResource(&amp;destResource);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ID3D11DeviceContext *immediateContext = mRenderer-&gt;getDeviceContext();
+    immediateContext-&gt;CopyResource(destResource, sourceResouce);
+
+    dest11-&gt;invalidateSwizzleCache();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11::setData(const gl::ImageIndex &amp;index, ImageD3D *image, const gl::Box *destBox, GLenum type,
+                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixelData)
+{
+    ASSERT(!image-&gt;isDirty());
+
+    ID3D11Resource *resource = NULL;
+    gl::Error error = getResource(&amp;resource);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(resource);
+
+    UINT destSubresource = getSubresourceIndex(index);
+
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(image-&gt;getInternalFormat());
+
+    gl::Box levelBox(0, 0, 0, getLevelWidth(index.mipIndex), getLevelHeight(index.mipIndex), getLevelDepth(index.mipIndex));
+    bool fullUpdate = (destBox == NULL || *destBox == levelBox);
+    ASSERT(internalFormatInfo.depthBits == 0 || fullUpdate);
+
+    // TODO(jmadill): Handle compressed formats
+    // Compressed formats have different load syntax, so we'll have to handle them with slightly
+    // different logic. Will implemnent this in a follow-up patch, and ensure we do not use SetData
+    // with compressed formats in the calling logic.
+    ASSERT(!internalFormatInfo.compressed);
+
+    int width = destBox ? destBox-&gt;width : static_cast&lt;int&gt;(image-&gt;getWidth());
+    int height = destBox ? destBox-&gt;height : static_cast&lt;int&gt;(image-&gt;getHeight());
+    int depth = destBox ? destBox-&gt;depth : static_cast&lt;int&gt;(image-&gt;getDepth());
+    UINT srcRowPitch = internalFormatInfo.computeRowPitch(type, width, unpack.alignment, unpack.rowLength);
+    UINT srcDepthPitch = internalFormatInfo.computeDepthPitch(type, width, height, unpack.alignment, unpack.rowLength);
+
+    const d3d11::TextureFormat &amp;d3d11Format = d3d11::GetTextureFormatInfo(image-&gt;getInternalFormat(), mRenderer-&gt;getFeatureLevel());
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(d3d11Format.texFormat);
+
+    size_t outputPixelSize = dxgiFormatInfo.pixelBytes;
+
+    UINT bufferRowPitch = outputPixelSize * width;
+    UINT bufferDepthPitch = bufferRowPitch * height;
+
+    size_t neededSize = bufferDepthPitch * depth;
+    MemoryBuffer *conversionBuffer = NULL;
+    error = mRenderer-&gt;getScratchMemoryBuffer(neededSize, &amp;conversionBuffer);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // TODO: fast path
+    LoadImageFunction loadFunction = d3d11Format.loadFunctions.at(type);
+    loadFunction(width, height, depth,
+                 pixelData, srcRowPitch, srcDepthPitch,
+                 conversionBuffer-&gt;data(), bufferRowPitch, bufferDepthPitch);
+
+    ID3D11DeviceContext *immediateContext = mRenderer-&gt;getDeviceContext();
+
+    if (!fullUpdate)
+    {
+        ASSERT(destBox);
+
+        D3D11_BOX destD3DBox;
+        destD3DBox.left = destBox-&gt;x;
+        destD3DBox.right = destBox-&gt;x + destBox-&gt;width;
+        destD3DBox.top = destBox-&gt;y;
+        destD3DBox.bottom = destBox-&gt;y + destBox-&gt;height;
+        destD3DBox.front = destBox-&gt;z;
+        destD3DBox.back = destBox-&gt;z + destBox-&gt;depth;
+
+        immediateContext-&gt;UpdateSubresource(resource, destSubresource,
+                                            &amp;destD3DBox, conversionBuffer-&gt;data(),
+                                            bufferRowPitch, bufferDepthPitch);
+    }
+    else
+    {
+        immediateContext-&gt;UpdateSubresource(resource, destSubresource,
+                                            NULL, conversionBuffer-&gt;data(),
+                                            bufferRowPitch, bufferDepthPitch);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+TextureStorage11_2D::TextureStorage11_2D(Renderer11 *renderer, SwapChain11 *swapchain)
+    : TextureStorage11(renderer, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, 0),
+      mTexture(swapchain-&gt;getOffscreenTexture()),
+      mSwizzleTexture(NULL),
+      mLevelZeroTexture(NULL),
+      mLevelZeroRenderTarget(NULL),
+      mUseLevelZeroTexture(false)
+{
+    mTexture-&gt;AddRef();
+
+    for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        mAssociatedImages[i] = NULL;
+        mRenderTarget[i] = NULL;
+        mSwizzleRenderTargets[i] = NULL;
+    }
+
+    D3D11_TEXTURE2D_DESC texDesc;
+    mTexture-&gt;GetDesc(&amp;texDesc);
+    mMipLevels = texDesc.MipLevels;
+    mTextureFormat = texDesc.Format;
+    mTextureWidth = texDesc.Width;
+    mTextureHeight = texDesc.Height;
+    mTextureDepth = 1;
+
+    mInternalFormat = swapchain-&gt;GetBackBufferInternalFormat();
+
+    ID3D11ShaderResourceView *srv = swapchain-&gt;getRenderTargetShaderResource();
+    D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+    srv-&gt;GetDesc(&amp;srvDesc);
+    mShaderResourceFormat = srvDesc.Format;
+
+    ID3D11RenderTargetView* offscreenRTV = swapchain-&gt;getRenderTarget();
+    D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+    offscreenRTV-&gt;GetDesc(&amp;rtvDesc);
+    mRenderTargetFormat = rtvDesc.Format;
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(mTextureFormat);
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(dxgiFormatInfo.internalFormat, mRenderer-&gt;getFeatureLevel());
+    mSwizzleTextureFormat = formatInfo.swizzleTexFormat;
+    mSwizzleShaderResourceFormat = formatInfo.swizzleSRVFormat;
+    mSwizzleRenderTargetFormat = formatInfo.swizzleRTVFormat;
+
+    mDepthStencilFormat = DXGI_FORMAT_UNKNOWN;
+
+    initializeSerials(1, 1);
+}
+
+TextureStorage11_2D::TextureStorage11_2D(Renderer11 *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly)
+    : TextureStorage11(renderer,
+                       GetTextureBindFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget),
+                       GetTextureMiscFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget, levels)),
+      mTexture(NULL),
+      mSwizzleTexture(NULL),
+      mLevelZeroTexture(NULL),
+      mLevelZeroRenderTarget(NULL),
+      mUseLevelZeroTexture(false)
+{
+    for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        mAssociatedImages[i] = NULL;
+        mRenderTarget[i] = NULL;
+        mSwizzleRenderTargets[i] = NULL;
+    }
+
+    mInternalFormat = internalformat;
+
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalformat, renderer-&gt;getFeatureLevel());
+    mTextureFormat = formatInfo.texFormat;
+    mShaderResourceFormat = formatInfo.srvFormat;
+    mDepthStencilFormat = formatInfo.dsvFormat;
+    mRenderTargetFormat = formatInfo.rtvFormat;
+    mSwizzleTextureFormat = formatInfo.swizzleTexFormat;
+    mSwizzleShaderResourceFormat = formatInfo.swizzleSRVFormat;
+    mSwizzleRenderTargetFormat = formatInfo.swizzleRTVFormat;
+
+    d3d11::MakeValidSize(false, mTextureFormat, &amp;width, &amp;height, &amp;mTopLevel);
+    mMipLevels = mTopLevel + levels;
+    mTextureWidth = width;
+    mTextureHeight = height;
+    mTextureDepth = 1;
+
+    if (hintLevelZeroOnly &amp;&amp; levels &gt; 1)
+    {
+        //The LevelZeroOnly hint should only be true if the zero max LOD workaround is active.
+        ASSERT(mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround);
+        mUseLevelZeroTexture = true;
+    }
+
+    initializeSerials(getLevelCount(), 1);
+}
+
+TextureStorage11_2D::~TextureStorage11_2D()
+{
+    for (unsigned i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        if (mAssociatedImages[i] != NULL)
+        {
+            bool imageAssociationCorrect = mAssociatedImages[i]-&gt;isAssociatedStorageValid(this);
+            ASSERT(imageAssociationCorrect);
+
+            if (imageAssociationCorrect)
+            {
+                // We must let the Images recover their data before we delete it from the TextureStorage.
+                gl::Error error = mAssociatedImages[i]-&gt;recoverFromAssociatedStorage();
+                if (error.isError())
+                {
+                    // TODO: Find a way to report this back to the context
+                }
+            }
+        }
+    }
+
+    SafeRelease(mTexture);
+    SafeRelease(mSwizzleTexture);
+
+    SafeRelease(mLevelZeroTexture);
+    SafeDelete(mLevelZeroRenderTarget);
+
+    for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        SafeDelete(mRenderTarget[i]);
+        SafeRelease(mSwizzleRenderTargets[i]);
+    }
+}
+
+gl::Error TextureStorage11_2D::copyToStorage(TextureStorage *destStorage)
+{
+    ASSERT(destStorage);
+
+    TextureStorage11_2D *dest11 = GetAs&lt;TextureStorage11_2D&gt;(destStorage);
+
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        ID3D11DeviceContext *immediateContext = mRenderer-&gt;getDeviceContext();
+
+        // If either mTexture or mLevelZeroTexture exist, then we need to copy them into the corresponding textures in destStorage.
+        if (mTexture)
+        {
+            gl::Error error = dest11-&gt;useLevelZeroWorkaroundTexture(false);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ID3D11Resource *destResource = NULL;
+            error = dest11-&gt;getResource(&amp;destResource);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            immediateContext-&gt;CopyResource(destResource, mTexture);
+        }
+
+        if (mLevelZeroTexture)
+        {
+            gl::Error error = dest11-&gt;useLevelZeroWorkaroundTexture(true);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ID3D11Resource *destResource = NULL;
+            error = dest11-&gt;getResource(&amp;destResource);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            immediateContext-&gt;CopyResource(destResource, mLevelZeroTexture);
+        }
+    }
+    else
+    {
+        ID3D11Resource *sourceResouce = NULL;
+        gl::Error error = getResource(&amp;sourceResouce);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11Resource *destResource = NULL;
+        error = dest11-&gt;getResource(&amp;destResource);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11DeviceContext *immediateContext = mRenderer-&gt;getDeviceContext();
+        immediateContext-&gt;CopyResource(destResource, sourceResouce);
+    }
+
+    dest11-&gt;invalidateSwizzleCache();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(bool useLevelZeroTexture)
+{
+    if (useLevelZeroTexture &amp;&amp; mMipLevels &gt; 1)
+    {
+        if (!mUseLevelZeroTexture &amp;&amp; mTexture)
+        {
+            gl::Error error = ensureTextureExists(1);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            // Pull data back from the mipped texture if necessary.
+            ASSERT(mLevelZeroTexture);
+            ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+            context-&gt;CopySubresourceRegion(mLevelZeroTexture, 0, 0, 0, 0, mTexture, 0, NULL);
+        }
+
+        mUseLevelZeroTexture = true;
+    }
+    else
+    {
+        if (mUseLevelZeroTexture &amp;&amp; mLevelZeroTexture)
+        {
+            gl::Error error = ensureTextureExists(mMipLevels);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            // Pull data back from the level zero texture if necessary.
+            ASSERT(mTexture);
+            ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+            context-&gt;CopySubresourceRegion(mTexture, 0, 0, 0, 0, mLevelZeroTexture, 0, NULL);
+        }
+
+        mUseLevelZeroTexture = false;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureStorage11_2D::associateImage(Image11* image, const gl::ImageIndex &amp;index)
+{
+    GLint level = index.mipIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        mAssociatedImages[level] = image;
+    }
+}
+
+bool TextureStorage11_2D::isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        // This validation check should never return false. It means the Image/TextureStorage association is broken.
+        bool retValue = (mAssociatedImages[level] == expectedImage);
+        ASSERT(retValue);
+        return retValue;
+    }
+
+    return false;
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_2D::disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        ASSERT(mAssociatedImages[level] == expectedImage);
+
+        if (mAssociatedImages[level] == expectedImage)
+        {
+            mAssociatedImages[level] = NULL;
+        }
+    }
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image recover its data before ending the association.
+gl::Error TextureStorage11_2D::releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage)
+{
+    GLint level = index.mipIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        // No need to let the old Image recover its data, if it is also the incoming Image.
+        if (mAssociatedImages[level] != NULL &amp;&amp; mAssociatedImages[level] != incomingImage)
+        {
+            // Ensure that the Image is still associated with this TextureStorage. This should be true.
+            bool imageAssociationCorrect = mAssociatedImages[level]-&gt;isAssociatedStorageValid(this);
+            ASSERT(imageAssociationCorrect);
+
+            if (imageAssociationCorrect)
+            {
+                // Force the image to recover from storage before its data is overwritten.
+                // This will reset mAssociatedImages[level] to NULL too.
+                gl::Error error = mAssociatedImages[level]-&gt;recoverFromAssociatedStorage();
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2D::getResource(ID3D11Resource **outResource)
+{
+    if (mUseLevelZeroTexture &amp;&amp; mMipLevels &gt; 1)
+    {
+        gl::Error error = ensureTextureExists(1);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        *outResource = mLevelZeroTexture;
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        gl::Error error = ensureTextureExists(mMipLevels);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        *outResource = mTexture;
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error TextureStorage11_2D::getMippedResource(ID3D11Resource **outResource)
+{
+    // This shouldn't be called unless the zero max LOD workaround is active.
+    ASSERT(mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround);
+
+    gl::Error error = ensureTextureExists(mMipLevels);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    *outResource = mTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2D::ensureTextureExists(int mipLevels)
+{
+    // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture.
+    bool useLevelZeroTexture = mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround ? (mipLevels == 1) &amp;&amp; (mMipLevels &gt; 1) : false;
+    ID3D11Texture2D **outputTexture = useLevelZeroTexture ? &amp;mLevelZeroTexture : &amp;mTexture;
+
+    // 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 (*outputTexture == NULL &amp;&amp; mTextureWidth &gt; 0 &amp;&amp; mTextureHeight &gt; 0)
+    {
+        ASSERT(mipLevels &gt; 0);
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = mTextureWidth;      // Compressed texture size constraints?
+        desc.Height = mTextureHeight;
+        desc.MipLevels = mipLevels;
+        desc.ArraySize = 1;
+        desc.Format = mTextureFormat;
+        desc.SampleDesc.Count = 1;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = getBindFlags();
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = getMiscFlags();
+
+        HRESULT result = device-&gt;CreateTexture2D(&amp;desc, NULL, outputTexture);
+
+        // this can happen from windows TDR
+        if (d3d11::isDeviceLostError(result))
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create 2D texture storage, result: 0x%X.&quot;, result);
+        }
+        else if (FAILED(result))
+        {
+            ASSERT(result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create 2D texture storage, result: 0x%X.&quot;, result);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2D::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    ASSERT(!index.hasLayer());
+
+    int level = index.mipIndex;
+    ASSERT(level &gt;= 0 &amp;&amp; level &lt; getLevelCount());
+
+    // In GL ES 2.0, the application can only render to level zero of the texture (Section 4.4.3 of the GLES 2.0 spec, page 113 of version 2.0.25).
+    // Other parts of TextureStorage11_2D could create RTVs on non-zero levels of the texture (e.g. generateMipmap).
+    // On Feature Level 9_3, this is unlikely to be useful. The renderer can't create SRVs on the individual levels of the texture,
+    // so methods like generateMipmap can't do anything useful with non-zero-level RTVs.
+    // Therefore if level &gt; 0 on 9_3 then there's almost certainly something wrong.
+    ASSERT(!(mRenderer-&gt;getFeatureLevel() &lt;= D3D_FEATURE_LEVEL_9_3 &amp;&amp; level &gt; 0));
+
+    if (!mRenderTarget[level])
+    {
+        ID3D11Resource *texture = NULL;
+        gl::Error error = getResource(&amp;texture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11ShaderResourceView *srv = NULL;
+        error = getSRVLevel(level, &amp;srv);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (mUseLevelZeroTexture)
+        {
+            if (!mLevelZeroRenderTarget)
+            {
+                ID3D11Device *device = mRenderer-&gt;getDevice();
+
+                D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+                rtvDesc.Format = mRenderTargetFormat;
+                rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+                rtvDesc.Texture2D.MipSlice = mTopLevel + level;
+
+                ID3D11RenderTargetView *rtv;
+                HRESULT result = device-&gt;CreateRenderTargetView(mLevelZeroTexture, &amp;rtvDesc, &amp;rtv);
+
+                if (result == E_OUTOFMEMORY)
+                {
+                    return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal render target view for texture storage, result: 0x%X.&quot;, result);
+                }
+                ASSERT(SUCCEEDED(result));
+
+                mLevelZeroRenderTarget = new TextureRenderTarget11(rtv, mLevelZeroTexture, NULL, mInternalFormat, getLevelWidth(level), getLevelHeight(level), 1, 0);
+
+                // RenderTarget will take ownership of these resources
+                SafeRelease(rtv);
+            }
+
+            ASSERT(outRT);
+            *outRT = mLevelZeroRenderTarget;
+            return gl::Error(GL_NO_ERROR);
+        }
+
+        if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            ID3D11Device *device = mRenderer-&gt;getDevice();
+
+            D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+            rtvDesc.Format = mRenderTargetFormat;
+            rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+            rtvDesc.Texture2D.MipSlice = mTopLevel + level;
+
+            ID3D11RenderTargetView *rtv;
+            HRESULT result = device-&gt;CreateRenderTargetView(texture, &amp;rtvDesc, &amp;rtv);
+
+            ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal render target view for texture storage, result: 0x%X.&quot;, result);
+            }
+
+            mRenderTarget[level] = new TextureRenderTarget11(rtv, texture, srv, mInternalFormat, getLevelWidth(level), getLevelHeight(level), 1, 0);
+
+            // RenderTarget will take ownership of these resources
+            SafeRelease(rtv);
+        }
+        else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            ID3D11Device *device = mRenderer-&gt;getDevice();
+
+            D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+            dsvDesc.Format = mDepthStencilFormat;
+            dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
+            dsvDesc.Texture2D.MipSlice = mTopLevel + level;
+            dsvDesc.Flags = 0;
+
+            ID3D11DepthStencilView *dsv;
+            HRESULT result = device-&gt;CreateDepthStencilView(texture, &amp;dsvDesc, &amp;dsv);
+
+            ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY,&quot;Failed to create internal depth stencil view for texture storage, result: 0x%X.&quot;, result);
+            }
+
+            mRenderTarget[level] = new TextureRenderTarget11(dsv, texture, srv, mInternalFormat, getLevelWidth(level), getLevelHeight(level), 1, 0);
+
+            // RenderTarget will take ownership of these resources
+            SafeRelease(dsv);
+        }
+        else
+        {
+            UNREACHABLE();
+        }
+    }
+
+    ASSERT(outRT);
+    *outRT = mRenderTarget[level];
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2D::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                         ID3D11ShaderResourceView **outSRV) const
+{
+    ASSERT(outSRV);
+
+    D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+    srvDesc.Format = format;
+    srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
+    srvDesc.Texture2D.MostDetailedMip = mTopLevel + baseLevel;
+    srvDesc.Texture2D.MipLevels = mipLevels;
+
+    ID3D11Resource *srvTexture = texture;
+
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        ASSERT(mTopLevel == 0);
+        ASSERT(baseLevel == 0);
+        // This code also assumes that the incoming texture equals either mLevelZeroTexture or mTexture.
+
+        if (mipLevels == 1 &amp;&amp; mMipLevels &gt; 1)
+        {
+            // We must use a SRV on the level-zero-only texture.
+            ASSERT(mLevelZeroTexture != NULL &amp;&amp; texture == mLevelZeroTexture);
+            srvTexture = mLevelZeroTexture;
+        }
+        else
+        {
+            ASSERT(mipLevels == static_cast&lt;int&gt;(mMipLevels));
+            ASSERT(mTexture != NULL &amp;&amp; texture == mTexture);
+            srvTexture = mTexture;
+        }
+    }
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    HRESULT result = device-&gt;CreateShaderResourceView(srvTexture, &amp;srvDesc, outSRV);
+
+    ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal texture storage SRV, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2D::getSwizzleTexture(ID3D11Resource **outTexture)
+{
+    ASSERT(outTexture);
+
+    if (!mSwizzleTexture)
+    {
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = mTextureWidth;
+        desc.Height = mTextureHeight;
+        desc.MipLevels = mMipLevels;
+        desc.ArraySize = 1;
+        desc.Format = mSwizzleTextureFormat;
+        desc.SampleDesc.Count = 1;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = 0;
+
+        HRESULT result = device-&gt;CreateTexture2D(&amp;desc, NULL, &amp;mSwizzleTexture);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle texture, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outTexture = mSwizzleTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2D::getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV)
+{
+    ASSERT(mipLevel &gt;= 0 &amp;&amp; mipLevel &lt; getLevelCount());
+    ASSERT(outRTV);
+
+    if (!mSwizzleRenderTargets[mipLevel])
+    {
+        ID3D11Resource *swizzleTexture = NULL;
+        gl::Error error = getSwizzleTexture(&amp;swizzleTexture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+        rtvDesc.Format = mSwizzleRenderTargetFormat;
+        rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
+        rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
+
+        HRESULT result = device-&gt;CreateRenderTargetView(mSwizzleTexture, &amp;rtvDesc, &amp;mSwizzleRenderTargets[mipLevel]);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle render target view, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outRTV = mSwizzleRenderTargets[mipLevel];
+    return gl::Error(GL_NO_ERROR);
+}
+
+TextureStorage11_Cube::TextureStorage11_Cube(Renderer11 *renderer, GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly)
+    : TextureStorage11(renderer,
+                       GetTextureBindFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget),
+                       GetTextureMiscFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget, levels))
+{
+    mTexture = NULL;
+    mSwizzleTexture = NULL;
+
+    for (unsigned int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        mSwizzleRenderTargets[level] = NULL;
+        for (unsigned int face = 0; face &lt; CUBE_FACE_COUNT; face++)
+        {
+            mAssociatedImages[face][level] = NULL;
+            mRenderTarget[face][level] = NULL;
+        }
+    }
+
+    mLevelZeroTexture = NULL;
+    mUseLevelZeroTexture = false;
+
+    for (unsigned int face = 0; face &lt; CUBE_FACE_COUNT; face++)
+    {
+        mLevelZeroRenderTarget[face] = NULL;
+    }
+
+    mInternalFormat = internalformat;
+
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalformat, renderer-&gt;getFeatureLevel());
+    mTextureFormat = formatInfo.texFormat;
+    mShaderResourceFormat = formatInfo.srvFormat;
+    mDepthStencilFormat = formatInfo.dsvFormat;
+    mRenderTargetFormat = formatInfo.rtvFormat;
+    mSwizzleTextureFormat = formatInfo.swizzleTexFormat;
+    mSwizzleShaderResourceFormat = formatInfo.swizzleSRVFormat;
+    mSwizzleRenderTargetFormat = formatInfo.swizzleRTVFormat;
+
+    // adjust size if needed for compressed textures
+    int height = size;
+    d3d11::MakeValidSize(false, mTextureFormat, &amp;size, &amp;height, &amp;mTopLevel);
+
+    mMipLevels = mTopLevel + levels;
+    mTextureWidth = size;
+    mTextureHeight = size;
+    mTextureDepth = 1;
+
+    if (hintLevelZeroOnly &amp;&amp; levels &gt; 1)
+    {
+        //The LevelZeroOnly hint should only be true if the zero max LOD workaround is active.
+        ASSERT(mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround);
+        mUseLevelZeroTexture = true;
+    }
+
+    initializeSerials(getLevelCount() * CUBE_FACE_COUNT, CUBE_FACE_COUNT);
+}
+
+TextureStorage11_Cube::~TextureStorage11_Cube()
+{
+    for (unsigned int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        for (unsigned int face = 0; face &lt; CUBE_FACE_COUNT; face++)
+        {
+            if (mAssociatedImages[face][level] != NULL)
+            {
+                bool imageAssociationCorrect = mAssociatedImages[face][level]-&gt;isAssociatedStorageValid(this);
+                ASSERT(imageAssociationCorrect);
+
+                if (imageAssociationCorrect)
+                {
+                    // We must let the Images recover their data before we delete it from the TextureStorage.
+                    mAssociatedImages[face][level]-&gt;recoverFromAssociatedStorage();
+                }
+            }
+        }
+    }
+
+    SafeRelease(mTexture);
+    SafeRelease(mSwizzleTexture);
+    SafeRelease(mLevelZeroTexture);
+
+    for (unsigned int face = 0; face &lt; CUBE_FACE_COUNT; face++)
+    {
+        SafeDelete(mLevelZeroRenderTarget[face]);
+    }
+
+    for (unsigned int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        SafeRelease(mSwizzleRenderTargets[level]);
+        for (unsigned int face = 0; face &lt; CUBE_FACE_COUNT; face++)
+        {
+            SafeDelete(mRenderTarget[face][level]);
+        }
+    }
+}
+
+UINT TextureStorage11_Cube::getSubresourceIndex(const gl::ImageIndex &amp;index) const
+{
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround &amp;&amp; mUseLevelZeroTexture &amp;&amp; index.mipIndex == 0)
+    {
+        UINT arraySlice = static_cast&lt;UINT&gt;(index.hasLayer() ? index.layerIndex : 0);
+        UINT subresource = D3D11CalcSubresource(0, arraySlice, 1);
+        ASSERT(subresource != std::numeric_limits&lt;UINT&gt;::max());
+        return subresource;
+    }
+    else
+    {
+        UINT mipSlice = static_cast&lt;UINT&gt;(index.mipIndex + mTopLevel);
+        UINT arraySlice = static_cast&lt;UINT&gt;(index.hasLayer() ? index.layerIndex : 0);
+        UINT subresource = D3D11CalcSubresource(mipSlice, arraySlice, mMipLevels);
+        ASSERT(subresource != std::numeric_limits&lt;UINT&gt;::max());
+        return subresource;
+    }
+}
+
+gl::Error TextureStorage11_Cube::copyToStorage(TextureStorage *destStorage)
+{
+    ASSERT(destStorage);
+
+    TextureStorage11_Cube *dest11 = GetAs&lt;TextureStorage11_Cube&gt;(destStorage);
+
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        ID3D11DeviceContext *immediateContext = mRenderer-&gt;getDeviceContext();
+
+        // If either mTexture or mLevelZeroTexture exist, then we need to copy them into the corresponding textures in destStorage.
+        if (mTexture)
+        {
+            gl::Error error = dest11-&gt;useLevelZeroWorkaroundTexture(false);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ID3D11Resource *destResource = NULL;
+            error = dest11-&gt;getResource(&amp;destResource);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            immediateContext-&gt;CopyResource(destResource, mTexture);
+        }
+
+        if (mLevelZeroTexture)
+        {
+            gl::Error error = dest11-&gt;useLevelZeroWorkaroundTexture(true);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ID3D11Resource *destResource = NULL;
+            error = dest11-&gt;getResource(&amp;destResource);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            immediateContext-&gt;CopyResource(destResource, mLevelZeroTexture);
+        }
+    }
+    else
+    {
+        ID3D11Resource *sourceResouce = NULL;
+        gl::Error error = getResource(&amp;sourceResouce);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11Resource *destResource = NULL;
+        error = dest11-&gt;getResource(&amp;destResource);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11DeviceContext *immediateContext = mRenderer-&gt;getDeviceContext();
+        immediateContext-&gt;CopyResource(destResource, sourceResouce);
+    }
+
+    dest11-&gt;invalidateSwizzleCache();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_Cube::useLevelZeroWorkaroundTexture(bool useLevelZeroTexture)
+{
+    if (useLevelZeroTexture &amp;&amp; mMipLevels &gt; 1)
+    {
+        if (!mUseLevelZeroTexture &amp;&amp; mTexture)
+        {
+            gl::Error error = ensureTextureExists(1);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            // Pull data back from the mipped texture if necessary.
+            ASSERT(mLevelZeroTexture);
+            ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+
+            for (int face = 0; face &lt; 6; face++)
+            {
+                context-&gt;CopySubresourceRegion(mLevelZeroTexture, D3D11CalcSubresource(0, face, 1), 0, 0, 0, mTexture, face * mMipLevels, NULL);
+            }
+        }
+
+        mUseLevelZeroTexture = true;
+    }
+    else
+    {
+        if (mUseLevelZeroTexture &amp;&amp; mLevelZeroTexture)
+        {
+            gl::Error error = ensureTextureExists(mMipLevels);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            // Pull data back from the level zero texture if necessary.
+            ASSERT(mTexture);
+            ID3D11DeviceContext *context = mRenderer-&gt;getDeviceContext();
+
+            for (int face = 0; face &lt; 6; face++)
+            {
+                context-&gt;CopySubresourceRegion(mTexture, D3D11CalcSubresource(0, face, mMipLevels), 0, 0, 0, mLevelZeroTexture, face, NULL);
+            }
+        }
+
+        mUseLevelZeroTexture = false;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureStorage11_Cube::associateImage(Image11* image, const gl::ImageIndex &amp;index)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(0 &lt;= layerTarget &amp;&amp; layerTarget &lt; CUBE_FACE_COUNT);
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        if (0 &lt;= layerTarget &amp;&amp; layerTarget &lt; CUBE_FACE_COUNT)
+        {
+            mAssociatedImages[layerTarget][level] = image;
+        }
+    }
+}
+
+bool TextureStorage11_Cube::isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        if (0 &lt;= layerTarget &amp;&amp; layerTarget &lt; CUBE_FACE_COUNT)
+        {
+            // This validation check should never return false. It means the Image/TextureStorage association is broken.
+            bool retValue = (mAssociatedImages[layerTarget][level] == expectedImage);
+            ASSERT(retValue);
+            return retValue;
+        }
+    }
+
+    return false;
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_Cube::disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(0 &lt;= layerTarget &amp;&amp; layerTarget &lt; CUBE_FACE_COUNT);
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        if (0 &lt;= layerTarget &amp;&amp; layerTarget &lt; CUBE_FACE_COUNT)
+        {
+            ASSERT(mAssociatedImages[layerTarget][level] == expectedImage);
+
+            if (mAssociatedImages[layerTarget][level] == expectedImage)
+            {
+                mAssociatedImages[layerTarget][level] = NULL;
+            }
+        }
+    }
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image recover its data before ending the association.
+gl::Error TextureStorage11_Cube::releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+    ASSERT(0 &lt;= layerTarget &amp;&amp; layerTarget &lt; CUBE_FACE_COUNT);
+
+    if ((0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
+    {
+        if (0 &lt;= layerTarget &amp;&amp; layerTarget &lt; CUBE_FACE_COUNT)
+        {
+            // No need to let the old Image recover its data, if it is also the incoming Image.
+            if (mAssociatedImages[layerTarget][level] != NULL &amp;&amp; mAssociatedImages[layerTarget][level] != incomingImage)
+            {
+                // Ensure that the Image is still associated with this TextureStorage. This should be true.
+                bool imageAssociationCorrect = mAssociatedImages[layerTarget][level]-&gt;isAssociatedStorageValid(this);
+                ASSERT(imageAssociationCorrect);
+
+                if (imageAssociationCorrect)
+                {
+                    // Force the image to recover from storage before its data is overwritten.
+                    // This will reset mAssociatedImages[level] to NULL too.
+                    gl::Error error = mAssociatedImages[layerTarget][level]-&gt;recoverFromAssociatedStorage();
+                    if (error.isError())
+                    {
+                        return error;
+                    }
+                }
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_Cube::getResource(ID3D11Resource **outResource)
+{
+    if (mUseLevelZeroTexture &amp;&amp; mMipLevels &gt; 1)
+    {
+        gl::Error error = ensureTextureExists(1);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        *outResource = mLevelZeroTexture;
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        gl::Error error = ensureTextureExists(mMipLevels);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        *outResource = mTexture;
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error TextureStorage11_Cube::getMippedResource(ID3D11Resource **outResource)
+{
+    // This shouldn't be called unless the zero max LOD workaround is active.
+    ASSERT(mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround);
+
+    gl::Error error = ensureTextureExists(mMipLevels);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    *outResource = mTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_Cube::ensureTextureExists(int mipLevels)
+{
+    // If mMipLevels = 1 then always use mTexture rather than mLevelZeroTexture.
+    bool useLevelZeroTexture = mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround ? (mipLevels == 1) &amp;&amp; (mMipLevels &gt; 1) : false;
+    ID3D11Texture2D **outputTexture = useLevelZeroTexture ? &amp;mLevelZeroTexture : &amp;mTexture;
+
+    // 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 (*outputTexture == NULL &amp;&amp; mTextureWidth &gt; 0 &amp;&amp; mTextureHeight &gt; 0)
+    {
+        ASSERT(mMipLevels &gt; 0);
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = mTextureWidth;
+        desc.Height = mTextureHeight;
+        desc.MipLevels = mipLevels;
+        desc.ArraySize = CUBE_FACE_COUNT;
+        desc.Format = mTextureFormat;
+        desc.SampleDesc.Count = 1;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = getBindFlags();
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE | getMiscFlags();
+
+        HRESULT result = device-&gt;CreateTexture2D(&amp;desc, NULL, outputTexture);
+
+        // this can happen from windows TDR
+        if (d3d11::isDeviceLostError(result))
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create cube texture storage, result: 0x%X.&quot;, result);
+        }
+        else if (FAILED(result))
+        {
+            ASSERT(result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create cube texture storage, result: 0x%X.&quot;, result);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_Cube::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    int faceIndex = index.layerIndex;
+    int level = index.mipIndex;
+
+    ASSERT(level &gt;= 0 &amp;&amp; level &lt; getLevelCount());
+    ASSERT(faceIndex &gt;= 0 &amp;&amp; faceIndex &lt; CUBE_FACE_COUNT);
+
+    if (!mRenderTarget[faceIndex][level])
+    {
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+        HRESULT result;
+
+        ID3D11Resource *texture = NULL;
+        gl::Error error = getResource(&amp;texture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (mUseLevelZeroTexture)
+        {
+            if (!mLevelZeroRenderTarget[faceIndex])
+            {
+                D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+                rtvDesc.Format = mRenderTargetFormat;
+                rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+                rtvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+                rtvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+                rtvDesc.Texture2DArray.ArraySize = 1;
+
+                ID3D11RenderTargetView *rtv;
+                result = device-&gt;CreateRenderTargetView(mLevelZeroTexture, &amp;rtvDesc, &amp;rtv);
+
+                if (result == E_OUTOFMEMORY)
+                {
+                    return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal render target view for texture storage, result: 0x%X.&quot;, result);
+                }
+                ASSERT(SUCCEEDED(result));
+
+                mLevelZeroRenderTarget[faceIndex] = new TextureRenderTarget11(rtv, mLevelZeroTexture, NULL, mInternalFormat, getLevelWidth(level), getLevelHeight(level), 1, 0);
+
+                // RenderTarget will take ownership of these resources
+                SafeRelease(rtv);
+            }
+
+            ASSERT(outRT);
+            *outRT = mLevelZeroRenderTarget[faceIndex];
+            return gl::Error(GL_NO_ERROR);
+        }
+
+        D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+        srvDesc.Format = mShaderResourceFormat;
+        srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + level;
+        srvDesc.Texture2DArray.MipLevels = 1;
+        srvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+        srvDesc.Texture2DArray.ArraySize = 1;
+
+        if (mRenderer-&gt;getFeatureLevel() &lt;= D3D_FEATURE_LEVEL_9_3)
+        {
+            srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+        }
+        else
+        {
+            srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; // Will be used with Texture2D sampler, not TextureCube
+        }
+
+        ID3D11ShaderResourceView *srv;
+        result = device-&gt;CreateShaderResourceView(texture, &amp;srvDesc, &amp;srv);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal shader resource view for texture storage, result: 0x%X.&quot;, result);
+        }
+
+        if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+            rtvDesc.Format = mRenderTargetFormat;
+            rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+            rtvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+            rtvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+            rtvDesc.Texture2DArray.ArraySize = 1;
+
+            ID3D11RenderTargetView *rtv;
+            result = device-&gt;CreateRenderTargetView(texture, &amp;rtvDesc, &amp;rtv);
+
+            ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                SafeRelease(srv);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal render target view for texture storage, result: 0x%X.&quot;, result);
+            }
+
+            mRenderTarget[faceIndex][level] = new TextureRenderTarget11(rtv, texture, srv, mInternalFormat, getLevelWidth(level), getLevelHeight(level), 1, 0);
+
+            // RenderTarget will take ownership of these resources
+            SafeRelease(rtv);
+            SafeRelease(srv);
+        }
+        else if (mDepthStencilFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
+            dsvDesc.Format = mDepthStencilFormat;
+            dsvDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
+            dsvDesc.Flags = 0;
+            dsvDesc.Texture2DArray.MipSlice = mTopLevel + level;
+            dsvDesc.Texture2DArray.FirstArraySlice = faceIndex;
+            dsvDesc.Texture2DArray.ArraySize = 1;
+
+            ID3D11DepthStencilView *dsv;
+            result = device-&gt;CreateDepthStencilView(texture, &amp;dsvDesc, &amp;dsv);
+
+            ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                SafeRelease(srv);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal depth stencil view for texture storage, result: 0x%X.&quot;, result);
+            }
+
+            mRenderTarget[faceIndex][level] = new TextureRenderTarget11(dsv, texture, srv, mInternalFormat, getLevelWidth(level), getLevelHeight(level), 1, 0);
+
+            // RenderTarget will take ownership of these resources
+            SafeRelease(dsv);
+            SafeRelease(srv);
+        }
+        else
+        {
+            UNREACHABLE();
+        }
+    }
+
+    ASSERT(outRT);
+    *outRT = mRenderTarget[faceIndex][level];
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_Cube::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                           ID3D11ShaderResourceView **outSRV) const
+{
+    ASSERT(outSRV);
+
+    D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+    srvDesc.Format = format;
+
+    // Unnormalized integer cube maps are not supported by DX11; we emulate them as an array of six 2D textures
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(format);
+    if (dxgiFormatInfo.componentType == GL_INT || dxgiFormatInfo.componentType == GL_UNSIGNED_INT)
+    {
+        srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+        srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
+        srvDesc.Texture2DArray.MipLevels = 1;
+        srvDesc.Texture2DArray.FirstArraySlice = 0;
+        srvDesc.Texture2DArray.ArraySize = CUBE_FACE_COUNT;
+    }
+    else
+    {
+        srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
+        srvDesc.TextureCube.MipLevels = mipLevels;
+        srvDesc.TextureCube.MostDetailedMip = mTopLevel + baseLevel;
+    }
+
+    ID3D11Resource *srvTexture = texture;
+
+    if (mRenderer-&gt;getWorkarounds().zeroMaxLodWorkaround)
+    {
+        ASSERT(mTopLevel == 0);
+        ASSERT(baseLevel == 0);
+        // This code also assumes that the incoming texture equals either mLevelZeroTexture or mTexture.
+
+        if (mipLevels == 1 &amp;&amp; mMipLevels &gt; 1)
+        {
+            // We must use a SRV on the level-zero-only texture.
+            ASSERT(mLevelZeroTexture != NULL &amp;&amp; texture == mLevelZeroTexture);
+            srvTexture = mLevelZeroTexture;
+        }
+        else
+        {
+            ASSERT(mipLevels == static_cast&lt;int&gt;(mMipLevels));
+            ASSERT(mTexture != NULL &amp;&amp; texture == mTexture);
+            srvTexture = mTexture;
+        }
+    }
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    HRESULT result = device-&gt;CreateShaderResourceView(srvTexture, &amp;srvDesc, outSRV);
+
+    ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal texture storage SRV, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_Cube::getSwizzleTexture(ID3D11Resource **outTexture)
+{
+    ASSERT(outTexture);
+
+    if (!mSwizzleTexture)
+    {
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = mTextureWidth;
+        desc.Height = mTextureHeight;
+        desc.MipLevels = mMipLevels;
+        desc.ArraySize = CUBE_FACE_COUNT;
+        desc.Format = mSwizzleTextureFormat;
+        desc.SampleDesc.Count = 1;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
+
+        HRESULT result = device-&gt;CreateTexture2D(&amp;desc, NULL, &amp;mSwizzleTexture);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle texture, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outTexture = mSwizzleTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_Cube::getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV)
+{
+    ASSERT(mipLevel &gt;= 0 &amp;&amp; mipLevel &lt; getLevelCount());
+    ASSERT(outRTV);
+
+    if (!mSwizzleRenderTargets[mipLevel])
+    {
+        ID3D11Resource *swizzleTexture = NULL;
+        gl::Error error = getSwizzleTexture(&amp;swizzleTexture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+        rtvDesc.Format = mSwizzleRenderTargetFormat;
+        rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+        rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+        rtvDesc.Texture2DArray.FirstArraySlice = 0;
+        rtvDesc.Texture2DArray.ArraySize = CUBE_FACE_COUNT;
+
+        HRESULT result = device-&gt;CreateRenderTargetView(mSwizzleTexture, &amp;rtvDesc, &amp;mSwizzleRenderTargets[mipLevel]);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle render target view, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outRTV = mSwizzleRenderTargets[mipLevel];
+    return gl::Error(GL_NO_ERROR);
+}
+
+TextureStorage11_3D::TextureStorage11_3D(Renderer11 *renderer, GLenum internalformat, bool renderTarget,
+                                         GLsizei width, GLsizei height, GLsizei depth, int levels)
+    : TextureStorage11(renderer,
+                       GetTextureBindFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget),
+                       GetTextureMiscFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget, levels))
+{
+    mTexture = NULL;
+    mSwizzleTexture = NULL;
+
+    for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        mAssociatedImages[i] = NULL;
+        mLevelRenderTargets[i] = NULL;
+        mSwizzleRenderTargets[i] = NULL;
+    }
+
+    mInternalFormat = internalformat;
+
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalformat, renderer-&gt;getFeatureLevel());
+    mTextureFormat = formatInfo.texFormat;
+    mShaderResourceFormat = formatInfo.srvFormat;
+    mDepthStencilFormat = formatInfo.dsvFormat;
+    mRenderTargetFormat = formatInfo.rtvFormat;
+    mSwizzleTextureFormat = formatInfo.swizzleTexFormat;
+    mSwizzleShaderResourceFormat = formatInfo.swizzleSRVFormat;
+    mSwizzleRenderTargetFormat = formatInfo.swizzleRTVFormat;
+
+    // adjust size if needed for compressed textures
+    d3d11::MakeValidSize(false, mTextureFormat, &amp;width, &amp;height, &amp;mTopLevel);
+
+    mMipLevels = mTopLevel + levels;
+    mTextureWidth = width;
+    mTextureHeight = height;
+    mTextureDepth = depth;
+
+    initializeSerials(getLevelCount() * depth, depth);
+}
+
+TextureStorage11_3D::~TextureStorage11_3D()
+{
+    for (unsigned i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        if (mAssociatedImages[i] != NULL)
+        {
+            bool imageAssociationCorrect = mAssociatedImages[i]-&gt;isAssociatedStorageValid(this);
+            ASSERT(imageAssociationCorrect);
+
+            if (imageAssociationCorrect)
+            {
+                // We must let the Images recover their data before we delete it from the TextureStorage.
+                mAssociatedImages[i]-&gt;recoverFromAssociatedStorage();
+            }
+        }
+    }
+
+    SafeRelease(mTexture);
+    SafeRelease(mSwizzleTexture);
+
+    for (RenderTargetMap::iterator i = mLevelLayerRenderTargets.begin(); i != mLevelLayerRenderTargets.end(); i++)
+    {
+        SafeDelete(i-&gt;second);
+    }
+    mLevelLayerRenderTargets.clear();
+
+    for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
+    {
+        SafeDelete(mLevelRenderTargets[i]);
+        SafeRelease(mSwizzleRenderTargets[i]);
+    }
+}
+
+void TextureStorage11_3D::associateImage(Image11* image, const gl::ImageIndex &amp;index)
+{
+    GLint level = index.mipIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        mAssociatedImages[level] = image;
+    }
+}
+
+bool TextureStorage11_3D::isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        // This validation check should never return false. It means the Image/TextureStorage association is broken.
+        bool retValue = (mAssociatedImages[level] == expectedImage);
+        ASSERT(retValue);
+        return retValue;
+    }
+
+    return false;
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_3D::disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS);
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        ASSERT(mAssociatedImages[level] == expectedImage);
+
+        if (mAssociatedImages[level] == expectedImage)
+        {
+            mAssociatedImages[level] = NULL;
+        }
+    }
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image recover its data before ending the association.
+gl::Error TextureStorage11_3D::releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage)
+{
+    GLint level = index.mipIndex;
+
+    ASSERT((0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS));
+
+    if (0 &lt;= level &amp;&amp; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
+    {
+        // No need to let the old Image recover its data, if it is also the incoming Image.
+        if (mAssociatedImages[level] != NULL &amp;&amp; mAssociatedImages[level] != incomingImage)
+        {
+            // Ensure that the Image is still associated with this TextureStorage. This should be true.
+            bool imageAssociationCorrect = mAssociatedImages[level]-&gt;isAssociatedStorageValid(this);
+            ASSERT(imageAssociationCorrect);
+
+            if (imageAssociationCorrect)
+            {
+                // Force the image to recover from storage before its data is overwritten.
+                // This will reset mAssociatedImages[level] to NULL too.
+                gl::Error error = mAssociatedImages[level]-&gt;recoverFromAssociatedStorage();
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_3D::getResource(ID3D11Resource **outResource)
+{
+    // If the width, height or depth are not positive this should be treated as an incomplete texture
+    // we handle that here by skipping the d3d texture creation
+    if (mTexture == NULL &amp;&amp; mTextureWidth &gt; 0 &amp;&amp; mTextureHeight &gt; 0 &amp;&amp; mTextureDepth &gt; 0)
+    {
+        ASSERT(mMipLevels &gt; 0);
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE3D_DESC desc;
+        desc.Width = mTextureWidth;
+        desc.Height = mTextureHeight;
+        desc.Depth = mTextureDepth;
+        desc.MipLevels = mMipLevels;
+        desc.Format = mTextureFormat;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = getBindFlags();
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = getMiscFlags();
+
+        HRESULT result = device-&gt;CreateTexture3D(&amp;desc, NULL, &amp;mTexture);
+
+        // this can happen from windows TDR
+        if (d3d11::isDeviceLostError(result))
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create 3D texture storage, result: 0x%X.&quot;, result);
+        }
+        else if (FAILED(result))
+        {
+            ASSERT(result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create 3D texture storage, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outResource = mTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_3D::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                         ID3D11ShaderResourceView **outSRV) const
+{
+    ASSERT(outSRV);
+
+    D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+    srvDesc.Format = format;
+    srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
+    srvDesc.Texture3D.MostDetailedMip = baseLevel;
+    srvDesc.Texture3D.MipLevels = mipLevels;
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    HRESULT result = device-&gt;CreateShaderResourceView(texture, &amp;srvDesc, outSRV);
+
+    ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal texture storage SRV, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_3D::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    int mipLevel = index.mipIndex;
+    ASSERT(mipLevel &gt;= 0 &amp;&amp; mipLevel &lt; getLevelCount());
+
+    ASSERT(mRenderTargetFormat != DXGI_FORMAT_UNKNOWN);
+
+    if (!index.hasLayer())
+    {
+        if (!mLevelRenderTargets[mipLevel])
+        {
+            ID3D11Resource *texture = NULL;
+            gl::Error error = getResource(&amp;texture);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ID3D11ShaderResourceView *srv = NULL;
+            error = getSRVLevel(mipLevel, &amp;srv);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            ID3D11Device *device = mRenderer-&gt;getDevice();
+
+            D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+            rtvDesc.Format = mRenderTargetFormat;
+            rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+            rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+            rtvDesc.Texture3D.FirstWSlice = 0;
+            rtvDesc.Texture3D.WSize = static_cast&lt;UINT&gt;(-1);
+
+            ID3D11RenderTargetView *rtv;
+            HRESULT result = device-&gt;CreateRenderTargetView(texture, &amp;rtvDesc, &amp;rtv);
+
+            ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                SafeRelease(srv);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal render target view for texture storage, result: 0x%X.&quot;, result);
+            }
+
+            mLevelRenderTargets[mipLevel] = new TextureRenderTarget11(rtv, texture, srv, mInternalFormat, getLevelWidth(mipLevel), getLevelHeight(mipLevel), getLevelDepth(mipLevel), 0);
+
+            // RenderTarget will take ownership of these resources
+            SafeRelease(rtv);
+        }
+
+        ASSERT(outRT);
+        *outRT = mLevelRenderTargets[mipLevel];
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        int layer = index.layerIndex;
+
+        LevelLayerKey key(mipLevel, layer);
+        if (mLevelLayerRenderTargets.find(key) == mLevelLayerRenderTargets.end())
+        {
+            ID3D11Device *device = mRenderer-&gt;getDevice();
+            HRESULT result;
+
+            ID3D11Resource *texture = NULL;
+            gl::Error error = getResource(&amp;texture);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            // TODO, what kind of SRV is expected here?
+            ID3D11ShaderResourceView *srv = NULL;
+
+            D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+            rtvDesc.Format = mRenderTargetFormat;
+            rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+            rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+            rtvDesc.Texture3D.FirstWSlice = layer;
+            rtvDesc.Texture3D.WSize = 1;
+
+            ID3D11RenderTargetView *rtv;
+            result = device-&gt;CreateRenderTargetView(texture, &amp;rtvDesc, &amp;rtv);
+
+            ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                SafeRelease(srv); return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal render target view for texture storage, result: 0x%X.&quot;, result);
+            }
+            ASSERT(SUCCEEDED(result));
+
+            mLevelLayerRenderTargets[key] = new TextureRenderTarget11(rtv, texture, srv, mInternalFormat, getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1, 0);
+
+            // RenderTarget will take ownership of these resources
+            SafeRelease(rtv);
+        }
+
+        ASSERT(outRT);
+        *outRT = mLevelLayerRenderTargets[key];
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error TextureStorage11_3D::getSwizzleTexture(ID3D11Resource **outTexture)
+{
+    ASSERT(outTexture);
+
+    if (!mSwizzleTexture)
+    {
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE3D_DESC desc;
+        desc.Width = mTextureWidth;
+        desc.Height = mTextureHeight;
+        desc.Depth = mTextureDepth;
+        desc.MipLevels = mMipLevels;
+        desc.Format = mSwizzleTextureFormat;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = 0;
+
+        HRESULT result = device-&gt;CreateTexture3D(&amp;desc, NULL, &amp;mSwizzleTexture);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle texture, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outTexture = mSwizzleTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_3D::getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV)
+{
+    ASSERT(mipLevel &gt;= 0 &amp;&amp; mipLevel &lt; getLevelCount());
+    ASSERT(outRTV);
+
+    if (!mSwizzleRenderTargets[mipLevel])
+    {
+        ID3D11Resource *swizzleTexture = NULL;
+        gl::Error error = getSwizzleTexture(&amp;swizzleTexture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+        rtvDesc.Format = mSwizzleRenderTargetFormat;
+        rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
+        rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
+        rtvDesc.Texture3D.FirstWSlice = 0;
+        rtvDesc.Texture3D.WSize = static_cast&lt;UINT&gt;(-1);
+
+        HRESULT result = device-&gt;CreateRenderTargetView(mSwizzleTexture, &amp;rtvDesc, &amp;mSwizzleRenderTargets[mipLevel]);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle render target view, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outRTV = mSwizzleRenderTargets[mipLevel];
+    return gl::Error(GL_NO_ERROR);
+}
+
+TextureStorage11_2DArray::TextureStorage11_2DArray(Renderer11 *renderer, GLenum internalformat, bool renderTarget,
+                                                   GLsizei width, GLsizei height, GLsizei depth, int levels)
+    : TextureStorage11(renderer,
+                       GetTextureBindFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget),
+                       GetTextureMiscFlags(internalformat, renderer-&gt;getFeatureLevel(), renderTarget, levels))
+{
+    mTexture = NULL;
+    mSwizzleTexture = NULL;
+
+    for (unsigned int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        mSwizzleRenderTargets[level] = NULL;
+    }
+
+    mInternalFormat = internalformat;
+
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalformat, renderer-&gt;getFeatureLevel());
+    mTextureFormat = formatInfo.texFormat;
+    mShaderResourceFormat = formatInfo.srvFormat;
+    mDepthStencilFormat = formatInfo.dsvFormat;
+    mRenderTargetFormat = formatInfo.rtvFormat;
+    mSwizzleTextureFormat = formatInfo.swizzleTexFormat;
+    mSwizzleShaderResourceFormat = formatInfo.swizzleSRVFormat;
+    mSwizzleRenderTargetFormat = formatInfo.swizzleRTVFormat;
+
+    // adjust size if needed for compressed textures
+    d3d11::MakeValidSize(false, mTextureFormat, &amp;width, &amp;height, &amp;mTopLevel);
+
+    mMipLevels = mTopLevel + levels;
+    mTextureWidth = width;
+    mTextureHeight = height;
+    mTextureDepth = depth;
+
+    initializeSerials(getLevelCount() * depth, depth);
+}
+
+TextureStorage11_2DArray::~TextureStorage11_2DArray()
+{
+    for (ImageMap::iterator i = mAssociatedImages.begin(); i != mAssociatedImages.end(); i++)
+    {
+        if (i-&gt;second)
+        {
+            bool imageAssociationCorrect = i-&gt;second-&gt;isAssociatedStorageValid(this);
+            ASSERT(imageAssociationCorrect);
+
+            if (imageAssociationCorrect)
+            {
+                // We must let the Images recover their data before we delete it from the TextureStorage.
+                i-&gt;second-&gt;recoverFromAssociatedStorage();
+            }
+        }
+    }
+    mAssociatedImages.clear();
+
+    SafeRelease(mTexture);
+    SafeRelease(mSwizzleTexture);
+
+    for (unsigned int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
+    {
+        SafeRelease(mSwizzleRenderTargets[level]);
+    }
+
+    for (RenderTargetMap::iterator i = mRenderTargets.begin(); i != mRenderTargets.end(); i++)
+    {
+        SafeDelete(i-&gt;second);
+    }
+    mRenderTargets.clear();
+}
+
+void TextureStorage11_2DArray::associateImage(Image11* image, const gl::ImageIndex &amp;index)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    ASSERT(0 &lt;= level &amp;&amp; level &lt; getLevelCount());
+
+    if (0 &lt;= level &amp;&amp; level &lt; getLevelCount())
+    {
+        LevelLayerKey key(level, layerTarget);
+        mAssociatedImages[key] = image;
+    }
+}
+
+bool TextureStorage11_2DArray::isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    LevelLayerKey key(level, layerTarget);
+
+    // This validation check should never return false. It means the Image/TextureStorage association is broken.
+    bool retValue = (mAssociatedImages.find(key) != mAssociatedImages.end() &amp;&amp; (mAssociatedImages[key] == expectedImage));
+    ASSERT(retValue);
+    return retValue;
+}
+
+// disassociateImage allows an Image to end its association with a Storage.
+void TextureStorage11_2DArray::disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    LevelLayerKey key(level, layerTarget);
+
+    bool imageAssociationCorrect = (mAssociatedImages.find(key) != mAssociatedImages.end() &amp;&amp; (mAssociatedImages[key] == expectedImage));
+    ASSERT(imageAssociationCorrect);
+
+    if (imageAssociationCorrect)
+    {
+        mAssociatedImages[key] = NULL;
+    }
+}
+
+// releaseAssociatedImage prepares the Storage for a new Image association. It lets the old Image recover its data before ending the association.
+gl::Error TextureStorage11_2DArray::releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage)
+{
+    GLint level = index.mipIndex;
+    GLint layerTarget = index.layerIndex;
+
+    LevelLayerKey key(level, layerTarget);
+
+    if (mAssociatedImages.find(key) != mAssociatedImages.end())
+    {
+        if (mAssociatedImages[key] != NULL &amp;&amp; mAssociatedImages[key] != incomingImage)
+        {
+            // Ensure that the Image is still associated with this TextureStorage. This should be true.
+            bool imageAssociationCorrect = mAssociatedImages[key]-&gt;isAssociatedStorageValid(this);
+            ASSERT(imageAssociationCorrect);
+
+            if (imageAssociationCorrect)
+            {
+                // Force the image to recover from storage before its data is overwritten.
+                // This will reset mAssociatedImages[level] to NULL too.
+                gl::Error error = mAssociatedImages[key]-&gt;recoverFromAssociatedStorage();
+                if (error.isError())
+                {
+                    return error;
+                }
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2DArray::getResource(ID3D11Resource **outResource)
+{
+    // if the width, height or depth is not positive this should be treated as an incomplete texture
+    // we handle that here by skipping the d3d texture creation
+    if (mTexture == NULL &amp;&amp; mTextureWidth &gt; 0 &amp;&amp; mTextureHeight &gt; 0 &amp;&amp; mTextureDepth &gt; 0)
+    {
+        ASSERT(mMipLevels &gt; 0);
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = mTextureWidth;
+        desc.Height = mTextureHeight;
+        desc.MipLevels = mMipLevels;
+        desc.ArraySize = mTextureDepth;
+        desc.Format = mTextureFormat;
+        desc.SampleDesc.Count = 1;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = getBindFlags();
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = getMiscFlags();
+
+        HRESULT result = device-&gt;CreateTexture2D(&amp;desc, NULL, &amp;mTexture);
+
+        // this can happen from windows TDR
+        if (d3d11::isDeviceLostError(result))
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create 2D array texture storage, result: 0x%X.&quot;, result);
+        }
+        else if (FAILED(result))
+        {
+            ASSERT(result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create 2D array texture storage, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outResource = mTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2DArray::createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                              ID3D11ShaderResourceView **outSRV) const
+{
+    D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+    srvDesc.Format = format;
+    srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+    srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
+    srvDesc.Texture2DArray.MipLevels = mipLevels;
+    srvDesc.Texture2DArray.FirstArraySlice = 0;
+    srvDesc.Texture2DArray.ArraySize = mTextureDepth;
+
+    ID3D11Device *device = mRenderer-&gt;getDevice();
+    HRESULT result = device-&gt;CreateShaderResourceView(texture, &amp;srvDesc, outSRV);
+
+    ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal texture storage SRV, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2DArray::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    ASSERT(index.hasLayer());
+
+    int mipLevel = index.mipIndex;
+    int layer = index.layerIndex;
+
+    ASSERT(mipLevel &gt;= 0 &amp;&amp; mipLevel &lt; getLevelCount());
+
+    LevelLayerKey key(mipLevel, layer);
+    if (mRenderTargets.find(key) == mRenderTargets.end())
+    {
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+        HRESULT result;
+
+        ID3D11Resource *texture = NULL;
+        gl::Error error = getResource(&amp;texture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
+        srvDesc.Format = mShaderResourceFormat;
+        srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
+        srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + mipLevel;
+        srvDesc.Texture2DArray.MipLevels = 1;
+        srvDesc.Texture2DArray.FirstArraySlice = layer;
+        srvDesc.Texture2DArray.ArraySize = 1;
+
+        ID3D11ShaderResourceView *srv;
+        result = device-&gt;CreateShaderResourceView(texture, &amp;srvDesc, &amp;srv);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal shader resource view for texture storage, result: 0x%X.&quot;, result);
+        }
+
+        if (mRenderTargetFormat != DXGI_FORMAT_UNKNOWN)
+        {
+            D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+            rtvDesc.Format = mRenderTargetFormat;
+            rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+            rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+            rtvDesc.Texture2DArray.FirstArraySlice = layer;
+            rtvDesc.Texture2DArray.ArraySize = 1;
+
+            ID3D11RenderTargetView *rtv;
+            result = device-&gt;CreateRenderTargetView(texture, &amp;rtvDesc, &amp;rtv);
+
+            ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                SafeRelease(srv);
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal render target view for texture storage, result: 0x%X.&quot;, result);
+            }
+
+            mRenderTargets[key] = new TextureRenderTarget11(rtv, texture, srv, mInternalFormat, getLevelWidth(mipLevel), getLevelHeight(mipLevel), 1, 0);
+
+            // RenderTarget will take ownership of these resources
+            SafeRelease(rtv);
+            SafeRelease(srv);
+        }
+        else
+        {
+            UNREACHABLE();
+        }
+    }
+
+    ASSERT(outRT);
+    *outRT = mRenderTargets[key];
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2DArray::getSwizzleTexture(ID3D11Resource **outTexture)
+{
+    if (!mSwizzleTexture)
+    {
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_TEXTURE2D_DESC desc;
+        desc.Width = mTextureWidth;
+        desc.Height = mTextureHeight;
+        desc.MipLevels = mMipLevels;
+        desc.ArraySize = mTextureDepth;
+        desc.Format = mSwizzleTextureFormat;
+        desc.SampleDesc.Count = 1;
+        desc.SampleDesc.Quality = 0;
+        desc.Usage = D3D11_USAGE_DEFAULT;
+        desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+        desc.CPUAccessFlags = 0;
+        desc.MiscFlags = 0;
+
+        HRESULT result = device-&gt;CreateTexture2D(&amp;desc, NULL, &amp;mSwizzleTexture);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle texture, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outTexture = mSwizzleTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage11_2DArray::getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV)
+{
+    ASSERT(mipLevel &gt;= 0 &amp;&amp; mipLevel &lt; getLevelCount());
+    ASSERT(outRTV);
+
+    if (!mSwizzleRenderTargets[mipLevel])
+    {
+        ID3D11Resource *swizzleTexture = NULL;
+        gl::Error error = getSwizzleTexture(&amp;swizzleTexture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        ID3D11Device *device = mRenderer-&gt;getDevice();
+
+        D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
+        rtvDesc.Format = mSwizzleRenderTargetFormat;
+        rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
+        rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
+        rtvDesc.Texture2DArray.FirstArraySlice = 0;
+        rtvDesc.Texture2DArray.ArraySize = mTextureDepth;
+
+        HRESULT result = device-&gt;CreateRenderTargetView(mSwizzleTexture, &amp;rtvDesc, &amp;mSwizzleRenderTargets[mipLevel]);
+
+        ASSERT(result == E_OUTOFMEMORY || SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal swizzle render target view, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outRTV = mSwizzleRenderTargets[mipLevel];
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11TextureStorage11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,322 @@
</span><ins>+//
+// Copyright (c) 2012-2013 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.
+//
+
+// TextureStorage11.h: Defines the abstract rx::TextureStorage11 class and its concrete derived
+// classes TextureStorage11_2D and TextureStorage11_Cube, which act as the interface to the D3D11 texture.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_TEXTURESTORAGE11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_TEXTURESTORAGE11_H_
+
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureStorage.h&quot;
+
+#include &lt;map&gt;
+
+namespace gl
+{
+struct ImageIndex;
+}
+
+namespace rx
+{
+class RenderTargetD3D;
+class RenderTarget11;
+class Renderer11;
+class SwapChain11;
+class Image11;
+
+class TextureStorage11 : public TextureStorage
+{
+  public:
+    virtual ~TextureStorage11();
+
+    static DWORD GetTextureBindFlags(GLenum internalFormat, D3D_FEATURE_LEVEL featureLevel, bool renderTarget);
+    static DWORD GetTextureMiscFlags(GLenum internalFormat, D3D_FEATURE_LEVEL featureLevel, bool renderTarget, int levels);
+
+    UINT getBindFlags() const;
+    UINT getMiscFlags() const;
+
+    virtual gl::Error getResource(ID3D11Resource **outResource) = 0;
+    virtual gl::Error getSRV(const gl::SamplerState &amp;samplerState, ID3D11ShaderResourceView **outSRV);
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT) = 0;
+
+    virtual gl::Error generateMipmap(const gl::ImageIndex &amp;sourceIndex, const gl::ImageIndex &amp;destIndex);
+
+    virtual int getTopLevel() const;
+    virtual bool isRenderTarget() const;
+    virtual bool isManaged() const;
+    bool supportsNativeMipmapFunction() const override;
+    virtual int getLevelCount() const;
+    virtual UINT getSubresourceIndex(const gl::ImageIndex &amp;index) const;
+
+    gl::Error generateSwizzles(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+    void invalidateSwizzleCacheLevel(int mipLevel);
+    void invalidateSwizzleCache();
+
+    gl::Error updateSubresourceLevel(ID3D11Resource *texture, unsigned int sourceSubresource,
+                                     const gl::ImageIndex &amp;index, const gl::Box &amp;copyArea);
+
+    gl::Error copySubresourceLevel(ID3D11Resource* dstTexture, unsigned int dstSubresource,
+                                   const gl::ImageIndex &amp;index, const gl::Box &amp;region);
+
+    virtual void associateImage(Image11* image, const gl::ImageIndex &amp;index) = 0;
+    virtual void disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage) = 0;
+    virtual bool isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage) = 0;
+    virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage) = 0;
+
+    virtual gl::Error copyToStorage(TextureStorage *destStorage);
+    virtual gl::Error setData(const gl::ImageIndex &amp;index, ImageD3D *image, const gl::Box *destBox, GLenum type,
+                              const gl::PixelUnpackState &amp;unpack, const uint8_t *pixelData);
+
+    gl::Error getSRVLevels(GLint baseLevel, GLint maxLevel, ID3D11ShaderResourceView **outSRV);
+
+  protected:
+    TextureStorage11(Renderer11 *renderer, UINT bindFlags, UINT miscFlags);
+    int getLevelWidth(int mipLevel) const;
+    int getLevelHeight(int mipLevel) const;
+    int getLevelDepth(int mipLevel) const;
+
+    // Some classes (e.g. TextureStorage11_2D) will override getMippedResource.
+    virtual gl::Error getMippedResource(ID3D11Resource **outResource) { return getResource(outResource); }
+
+    virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture) = 0;
+    virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV) = 0;
+    gl::Error getSRVLevel(int mipLevel, ID3D11ShaderResourceView **outSRV);
+
+    virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                ID3D11ShaderResourceView **outSRV) const = 0;
+
+    void verifySwizzleExists(GLenum swizzleRed, GLenum swizzleGreen, GLenum swizzleBlue, GLenum swizzleAlpha);
+
+    Renderer11 *mRenderer;
+    int mTopLevel;
+    unsigned int mMipLevels;
+
+    GLenum mInternalFormat;
+    DXGI_FORMAT mTextureFormat;
+    DXGI_FORMAT mShaderResourceFormat;
+    DXGI_FORMAT mRenderTargetFormat;
+    DXGI_FORMAT mDepthStencilFormat;
+    DXGI_FORMAT mSwizzleTextureFormat;
+    DXGI_FORMAT mSwizzleShaderResourceFormat;
+    DXGI_FORMAT mSwizzleRenderTargetFormat;
+    unsigned int mTextureWidth;
+    unsigned int mTextureHeight;
+    unsigned int mTextureDepth;
+
+    struct SwizzleCacheValue
+    {
+        GLenum swizzleRed;
+        GLenum swizzleGreen;
+        GLenum swizzleBlue;
+        GLenum swizzleAlpha;
+
+        SwizzleCacheValue();
+        SwizzleCacheValue(GLenum red, GLenum green, GLenum blue, GLenum alpha);
+
+        bool operator ==(const SwizzleCacheValue &amp;other) const;
+        bool operator !=(const SwizzleCacheValue &amp;other) const;
+    };
+    SwizzleCacheValue mSwizzleCache[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+  private:
+    const UINT mBindFlags;
+    const UINT mMiscFlags;
+
+    struct SRVKey
+    {
+        SRVKey(int baseLevel = 0, int mipLevels = 0, bool swizzle = false);
+
+        bool operator&lt;(const SRVKey &amp;rhs) const;
+
+        int baseLevel;
+        int mipLevels;
+        bool swizzle;
+    };
+    typedef std::map&lt;SRVKey, ID3D11ShaderResourceView *&gt; SRVCache;
+
+    SRVCache mSrvCache;
+    ID3D11ShaderResourceView *mLevelSRVs[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_2D : public TextureStorage11
+{
+  public:
+    TextureStorage11_2D(Renderer11 *renderer, SwapChain11 *swapchain);
+    TextureStorage11_2D(Renderer11 *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly = false);
+    virtual ~TextureStorage11_2D();
+
+    virtual gl::Error getResource(ID3D11Resource **outResource);
+    virtual gl::Error getMippedResource(ID3D11Resource **outResource);
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+
+    virtual gl::Error copyToStorage(TextureStorage *destStorage);
+
+    virtual void associateImage(Image11* image, const gl::ImageIndex &amp;index);
+    virtual void disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual bool isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage);
+
+    virtual gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture);
+
+  protected:
+    virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
+    virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
+
+    gl::Error ensureTextureExists(int mipLevels);
+
+  private:
+    virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                ID3D11ShaderResourceView **outSRV) const;
+
+    ID3D11Texture2D *mTexture;
+    RenderTarget11 *mRenderTarget[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+    // These are members related to the zero max-LOD workaround.
+    // D3D11 Feature Level 9_3 can't disable mipmaps on a mipmapped texture (i.e. solely sample from level zero).
+    // These members are used to work around this limitation.
+    // Usually only mTexture XOR mLevelZeroTexture will exist.
+    // For example, if an app creates a texture with only one level, then 9_3 will only create mLevelZeroTexture.
+    // However, in some scenarios, both textures have to be created. This incurs additional memory overhead.
+    // One example of this is an application that creates a texture, calls glGenerateMipmap, and then disables mipmaps on the texture.
+    // A more likely example is an app that creates an empty texture, renders to it, and then calls glGenerateMipmap
+    // TODO: In this rendering scenario, release the mLevelZeroTexture after mTexture has been created to save memory.
+    ID3D11Texture2D *mLevelZeroTexture;
+    RenderTarget11 *mLevelZeroRenderTarget;
+    bool mUseLevelZeroTexture;
+
+    // Swizzle-related variables
+    ID3D11Texture2D *mSwizzleTexture;
+    ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+    Image11 *mAssociatedImages[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_Cube : public TextureStorage11
+{
+  public:
+    TextureStorage11_Cube(Renderer11 *renderer, GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly);
+    virtual ~TextureStorage11_Cube();
+
+    virtual UINT getSubresourceIndex(const gl::ImageIndex &amp;index) const;
+
+    virtual gl::Error getResource(ID3D11Resource **outResource);
+    virtual gl::Error getMippedResource(ID3D11Resource **outResource);
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+
+    virtual gl::Error copyToStorage(TextureStorage *destStorage);
+
+    virtual void associateImage(Image11* image, const gl::ImageIndex &amp;index);
+    virtual void disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual bool isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage);
+
+    virtual gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture);
+
+  protected:
+    virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
+    virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
+
+    gl::Error ensureTextureExists(int mipLevels);
+
+  private:
+    virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                ID3D11ShaderResourceView **outSRV) const;
+
+    static const size_t CUBE_FACE_COUNT = 6;
+
+    ID3D11Texture2D *mTexture;
+    RenderTarget11 *mRenderTarget[CUBE_FACE_COUNT][gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+    // Level-zero workaround members. See TextureStorage11_2D's workaround members for a description.
+    ID3D11Texture2D *mLevelZeroTexture;
+    RenderTarget11 *mLevelZeroRenderTarget[CUBE_FACE_COUNT];
+    bool mUseLevelZeroTexture;
+
+    ID3D11Texture2D *mSwizzleTexture;
+    ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+    Image11 *mAssociatedImages[CUBE_FACE_COUNT][gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_3D : public TextureStorage11
+{
+  public:
+    TextureStorage11_3D(Renderer11 *renderer, GLenum internalformat, bool renderTarget,
+                        GLsizei width, GLsizei height, GLsizei depth, int levels);
+    virtual ~TextureStorage11_3D();
+
+    virtual gl::Error getResource(ID3D11Resource **outResource);
+
+    // Handles both layer and non-layer RTs
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+
+    virtual void associateImage(Image11* image, const gl::ImageIndex &amp;index);
+    virtual void disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual bool isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage);
+
+  protected:
+    virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
+    virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
+
+  private:
+    virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                ID3D11ShaderResourceView **outSRV) const;
+
+    typedef std::pair&lt;int, int&gt; LevelLayerKey;
+    typedef std::map&lt;LevelLayerKey, RenderTarget11*&gt; RenderTargetMap;
+    RenderTargetMap mLevelLayerRenderTargets;
+
+    RenderTarget11 *mLevelRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+    ID3D11Texture3D *mTexture;
+    ID3D11Texture3D *mSwizzleTexture;
+    ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+    Image11 *mAssociatedImages[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+};
+
+class TextureStorage11_2DArray : public TextureStorage11
+{
+  public:
+    TextureStorage11_2DArray(Renderer11 *renderer, GLenum internalformat, bool renderTarget,
+                             GLsizei width, GLsizei height, GLsizei depth, int levels);
+    virtual ~TextureStorage11_2DArray();
+
+    virtual gl::Error getResource(ID3D11Resource **outResource);
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+
+    virtual void associateImage(Image11* image, const gl::ImageIndex &amp;index);
+    virtual void disassociateImage(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual bool isAssociatedImageValid(const gl::ImageIndex &amp;index, Image11* expectedImage);
+    virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &amp;index, Image11* incomingImage);
+
+  protected:
+    virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
+    virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
+
+  private:
+    virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+                                ID3D11ShaderResourceView **outSRV) const;
+
+    typedef std::pair&lt;int, int&gt; LevelLayerKey;
+    typedef std::map&lt;LevelLayerKey, RenderTarget11*&gt; RenderTargetMap;
+    RenderTargetMap mRenderTargets;
+
+    ID3D11Texture2D *mTexture;
+
+    ID3D11Texture2D *mSwizzleTexture;
+    ID3D11RenderTargetView *mSwizzleRenderTargets[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
+
+    typedef std::map&lt;LevelLayerKey, Image11*&gt; ImageMap;
+    ImageMap mAssociatedImages;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_TEXTURESTORAGE11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Trim11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// Trim11.cpp: Trim support utility class.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/Trim11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+
+#if defined (ANGLE_ENABLE_WINDOWS_STORE)
+using namespace ABI::Windows::Foundation;
+using namespace ABI::Windows::ApplicationModel;
+using namespace ABI::Windows::ApplicationModel::Core;
+#endif
+
+namespace rx
+{
+
+Trim11::Trim11(rx::Renderer11 *renderer)
+    : mRenderer(renderer)
+{
+    bool result = true;
+    result = registerForRendererTrimRequest();
+    ASSERT(result);
+}
+
+Trim11::~Trim11()
+{
+    unregisterForRendererTrimRequest();
+}
+
+void Trim11::trim()
+{
+    if (!mRenderer)
+    {
+        return;
+    }
+
+#if defined (ANGLE_ENABLE_WINDOWS_STORE)
+    ID3D11Device* device = mRenderer-&gt;getDevice();
+    // IDXGIDevice3 is only supported on Windows 8.1 and Windows Phone 8.1 and above.
+    IDXGIDevice3 *dxgiDevice3 = d3d11::DynamicCastComObject&lt;IDXGIDevice3&gt;(device);
+    if (dxgiDevice3)
+    {
+        dxgiDevice3-&gt;Trim();
+    }
+    SafeRelease(dxgiDevice3);
+#endif
+}
+
+bool Trim11::registerForRendererTrimRequest()
+{
+#if defined (ANGLE_ENABLE_WINDOWS_STORE)
+    ICoreApplication* coreApplication = nullptr;
+    HRESULT result = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), &amp;coreApplication);
+    if (SUCCEEDED(result))
+    {
+        auto suspendHandler = Callback&lt;IEventHandler&lt;SuspendingEventArgs*&gt;&gt;(
+            [this](IInspectable*, ISuspendingEventArgs*) -&gt; HRESULT
+        {
+            trim();
+            return S_OK;
+        });
+        result = coreApplication-&gt;add_Suspending(suspendHandler.Get(), &amp;mApplicationSuspendedEventToken);
+    }
+    SafeRelease(coreApplication);
+
+    if (FAILED(result))
+    {
+        return false;
+    }
+#endif
+    return true;
+}
+
+void Trim11::unregisterForRendererTrimRequest()
+{
+#if defined (ANGLE_ENABLE_WINDOWS_STORE)
+    if (mApplicationSuspendedEventToken.value != 0)
+    {
+        ICoreApplication* coreApplication = nullptr;
+        if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Core_CoreApplication).Get(), &amp;coreApplication)))
+        {
+            coreApplication-&gt;remove_Suspending(mApplicationSuspendedEventToken);
+        }
+        mApplicationSuspendedEventToken.value = 0;
+        SafeRelease(coreApplication);
+    }
+#endif
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11Trim11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/Trim11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// Trim11.h: Trim support utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
+typedef void* EventRegistrationToken;
+#else
+#include &lt;EventToken.h&gt;
+#endif
+
+namespace rx
+{
+class Renderer11;
+
+class Trim11 : angle::NonCopyable
+{
+  public:
+    explicit Trim11(Renderer11 *renderer);
+    ~Trim11();
+
+  private:
+    Renderer11 *mRenderer;
+    EventRegistrationToken mApplicationSuspendedEventToken;
+
+    void trim();
+    bool registerForRendererTrimRequest();
+    void unregisterForRendererTrimRequest();
+};
+
+}
+
+#endif   // LIBANGLE_RENDERER_D3D_D3D11_TRIM11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11VertexArray11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// VertexArray11.h: Defines the rx::VertexArray11 class which implements rx::VertexArrayImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
+
+#include &quot;libANGLE/renderer/VertexArrayImpl.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+class VertexArray11 : public VertexArrayImpl
+{
+  public:
+    VertexArray11(Renderer11 *renderer)
+        : VertexArrayImpl(),
+          mRenderer(renderer)
+    {
+    }
+    virtual ~VertexArray11() { }
+
+    virtual void setElementArrayBuffer(const gl::Buffer *buffer) { }
+    virtual void setAttribute(size_t idx, const gl::VertexAttribute &amp;attr) { }
+    virtual void setAttributeDivisor(size_t idx, GLuint divisor) { }
+    virtual void enableAttribute(size_t idx, bool enabledState) { }
+
+  private:
+    Renderer11 *mRenderer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_VERTEXARRAY11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11VertexBuffer11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,249 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// VertexBuffer11.cpp: Defines the D3D11 VertexBuffer implementation.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/VertexBuffer11.h&quot;
+
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Buffer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/Renderer11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+
+namespace rx
+{
+
+VertexBuffer11::VertexBuffer11(Renderer11 *const renderer) : mRenderer(renderer)
+{
+    mBuffer = NULL;
+    mBufferSize = 0;
+    mDynamicUsage = false;
+    mMappedResourceData = NULL;
+}
+
+VertexBuffer11::~VertexBuffer11()
+{
+    ASSERT(mMappedResourceData == NULL);
+    SafeRelease(mBuffer);
+}
+
+gl::Error VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
+{
+    SafeRelease(mBuffer);
+
+    updateSerial();
+
+    if (size &gt; 0)
+    {
+        ID3D11Device* dxDevice = mRenderer-&gt;getDevice();
+
+        D3D11_BUFFER_DESC bufferDesc;
+        bufferDesc.ByteWidth = size;
+        bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+        bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+        bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+        bufferDesc.MiscFlags = 0;
+        bufferDesc.StructureByteStride = 0;
+
+        HRESULT result = dxDevice-&gt;CreateBuffer(&amp;bufferDesc, NULL, &amp;mBuffer);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal vertex buffer of size, %lu.&quot;, size);
+        }
+
+        if (dynamicUsage)
+        {
+            d3d11::SetDebugName(mBuffer, &quot;VertexBuffer11 (dynamic)&quot;);
+        }
+        else
+        {
+            d3d11::SetDebugName(mBuffer, &quot;VertexBuffer11 (static)&quot;);
+        }
+    }
+
+    mBufferSize = size;
+    mDynamicUsage = dynamicUsage;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexBuffer11::mapResource()
+{
+    if (mMappedResourceData == NULL)
+    {
+        ID3D11DeviceContext *dxContext = mRenderer-&gt;getDeviceContext();
+
+        D3D11_MAPPED_SUBRESOURCE mappedResource;
+
+        HRESULT result = dxContext-&gt;Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &amp;mappedResource);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal vertex buffer, HRESULT: 0x%08x.&quot;, result);
+        }
+
+        mMappedResourceData = reinterpret_cast&lt;uint8_t*&gt;(mappedResource.pData);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void VertexBuffer11::hintUnmapResource()
+{
+    if (mMappedResourceData != NULL)
+    {
+        ID3D11DeviceContext *dxContext = mRenderer-&gt;getDeviceContext();
+        dxContext-&gt;Unmap(mBuffer, 0);
+
+        mMappedResourceData = NULL;
+    }
+}
+
+gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                                GLint start, GLsizei count, GLsizei instances, unsigned int offset)
+{
+    if (!mBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal vertex buffer is not initialized.&quot;);
+    }
+
+    gl::Buffer *buffer = attrib.buffer.get();
+    int inputStride = ComputeVertexAttributeStride(attrib);
+
+    // This will map the resource if it isn't already mapped.
+    gl::Error error = mapResource();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    uint8_t *output = mMappedResourceData + offset;
+
+    const uint8_t *input = NULL;
+    if (attrib.enabled)
+    {
+        if (buffer)
+        {
+            BufferD3D *storage = GetImplAs&lt;BufferD3D&gt;(buffer);
+            error = storage-&gt;getData(&amp;input);
+            if (error.isError())
+            {
+                return error;
+            }
+            input += static_cast&lt;int&gt;(attrib.offset);
+        }
+        else
+        {
+            input = static_cast&lt;const uint8_t*&gt;(attrib.pointer);
+        }
+    }
+    else
+    {
+        input = reinterpret_cast&lt;const uint8_t*&gt;(currentValue.FloatValues);
+    }
+
+    if (instances == 0 || attrib.divisor == 0)
+    {
+        input += inputStride * start;
+    }
+
+    gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+    const d3d11::VertexFormat &amp;vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormat, mRenderer-&gt;getFeatureLevel());
+    ASSERT(vertexFormatInfo.copyFunction != NULL);
+    vertexFormatInfo.copyFunction(input, inputStride, count, output);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexBuffer11::getSpaceRequired(const gl::VertexAttribute &amp;attrib, GLsizei count,
+                                           GLsizei instances, unsigned int *outSpaceRequired) const
+{
+    unsigned int elementCount = 0;
+    if (attrib.enabled)
+    {
+        if (instances == 0 || attrib.divisor == 0)
+        {
+            elementCount = count;
+        }
+        else
+        {
+            // Round up to divisor, if possible
+            elementCount = UnsignedCeilDivide(static_cast&lt;unsigned int&gt;(instances), attrib.divisor);
+        }
+
+        gl::VertexFormat vertexFormat(attrib);
+        const d3d11::VertexFormat &amp;vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormat, mRenderer-&gt;getFeatureLevel());
+        const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(vertexFormatInfo.nativeFormat);
+        unsigned int elementSize = dxgiFormatInfo.pixelBytes;
+        if (elementSize &lt;= std::numeric_limits&lt;unsigned int&gt;::max() / elementCount)
+        {
+            if (outSpaceRequired)
+            {
+                *outSpaceRequired = elementSize * elementCount;
+            }
+            return gl::Error(GL_NO_ERROR);
+        }
+        else
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;New vertex buffer size would result in an overflow.&quot;);
+        }
+    }
+    else
+    {
+        const unsigned int elementSize = 4;
+        if (outSpaceRequired)
+        {
+            *outSpaceRequired = elementSize * 4;
+        }
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+unsigned int VertexBuffer11::getBufferSize() const
+{
+    return mBufferSize;
+}
+
+gl::Error VertexBuffer11::setBufferSize(unsigned int size)
+{
+    if (size &gt; mBufferSize)
+    {
+        return initialize(size, mDynamicUsage);
+    }
+    else
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error VertexBuffer11::discard()
+{
+    if (!mBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal vertex buffer is not initialized.&quot;);
+    }
+
+    ID3D11DeviceContext *dxContext = mRenderer-&gt;getDeviceContext();
+
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    HRESULT result = dxContext-&gt;Map(mBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to map internal buffer for discarding, HRESULT: 0x%08x&quot;, result);
+    }
+
+    dxContext-&gt;Unmap(mBuffer, 0);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+ID3D11Buffer *VertexBuffer11::getBuffer() const
+{
+    return mBuffer;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11VertexBuffer11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+//
+// 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.
+//
+
+// VertexBuffer11.h: Defines the D3D11 VertexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
+
+#include &lt;stdint.h&gt;
+
+#include &quot;libANGLE/renderer/d3d/VertexBuffer.h&quot;
+
+namespace rx
+{
+class Renderer11;
+
+class VertexBuffer11 : public VertexBuffer
+{
+  public:
+    explicit VertexBuffer11(Renderer11 *const renderer);
+    virtual ~VertexBuffer11();
+
+    virtual gl::Error initialize(unsigned int size, bool dynamicUsage);
+
+    virtual gl::Error storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                            GLint start, GLsizei count, GLsizei instances, unsigned int offset);
+
+    virtual gl::Error getSpaceRequired(const gl::VertexAttribute &amp;attrib, GLsizei count, GLsizei instances,
+                                       unsigned int *outSpaceRequired) const;
+
+    virtual unsigned int getBufferSize() const;
+    virtual gl::Error setBufferSize(unsigned int size);
+    virtual gl::Error discard();
+
+    virtual void hintUnmapResource();
+
+    ID3D11Buffer *getBuffer() const;
+
+  private:
+    gl::Error mapResource();
+
+    Renderer11 *const mRenderer;
+
+    ID3D11Buffer *mBuffer;
+    unsigned int mBufferSize;
+    bool mDynamicUsage;
+
+    uint8_t *mMappedResourceData;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_VERTEXBUFFER11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11copyvertexh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+//
+// Copyright (c) 2013-2015 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.
+//
+
+// copyvertex.h: Defines D3D11 vertex buffer copying and conversion functions
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_COPYVERTEX_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_COPYVERTEX_H_
+
+#include &quot;common/mathutil.h&quot;
+
+namespace rx
+{
+
+// 'alphaDefaultValueBits' gives the default value for the alpha channel (4th component)
+template &lt;typename T, size_t inputComponentCount, size_t outputComponentCount, uint32_t alphaDefaultValueBits&gt;
+inline void CopyNativeVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template &lt;size_t inputComponentCount, size_t outputComponentCount&gt;
+inline void Copy8SintTo16SintVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template &lt;size_t componentCount&gt;
+inline void Copy8SnormTo16SnormVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template &lt;size_t inputComponentCount, size_t outputComponentCount&gt;
+inline void Copy32FixedTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template &lt;typename T, size_t inputComponentCount, size_t outputComponentCount, bool normalized&gt;
+inline void CopyTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+template &lt;bool isSigned, bool normalized, bool toFloat&gt;
+inline void CopyXYZ10W2ToXYZW32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+}
+
+#include &quot;copyvertex.inl&quot;
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_COPYVERTEX_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11copyvertexinl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/copyvertex.inl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,377 @@
</span><ins>+//
+// Copyright (c) 2014-2015 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.
+//
+
+namespace rx
+{
+
+template &lt;typename T, size_t inputComponentCount, size_t outputComponentCount, uint32_t alphaDefaultValueBits&gt;
+inline void CopyNativeVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+    const size_t attribSize = sizeof(T)* inputComponentCount;
+
+    if (attribSize == stride &amp;&amp; inputComponentCount == outputComponentCount)
+    {
+        memcpy(output, input, count * attribSize);
+    }
+    else
+    {
+        const T defaultAlphaValue = gl::bitCast&lt;T&gt;(alphaDefaultValueBits);
+        const size_t lastNonAlphaOutputComponent = std::min&lt;size_t&gt;(outputComponentCount, 3);
+
+        for (size_t i = 0; i &lt; count; i++)
+        {
+            const T *offsetInput = reinterpret_cast&lt;const T*&gt;(input + (i * stride));
+            T *offsetOutput = reinterpret_cast&lt;T*&gt;(output) + i * outputComponentCount;
+
+            for (size_t j = 0; j &lt; inputComponentCount; j++)
+            {
+                offsetOutput[j] = offsetInput[j];
+            }
+
+            for (size_t j = inputComponentCount; j &lt; lastNonAlphaOutputComponent; j++)
+            {
+                // Set the remaining G/B channels to 0.
+                offsetOutput[j] = 0;
+            }
+
+            if (inputComponentCount &lt; outputComponentCount &amp;&amp; outputComponentCount == 4)
+            {
+                // Set the remaining alpha channel to the defaultAlphaValue.
+                offsetOutput[3] = defaultAlphaValue;
+            }
+        }
+    }
+}
+
+template &lt;size_t inputComponentCount, size_t outputComponentCount&gt;
+inline void Copy8SintTo16SintVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+    const size_t lastNonAlphaOutputComponent = std::min&lt;size_t&gt;(outputComponentCount, 3);
+
+    for (size_t i = 0; i &lt; count; i++)
+    {
+        const GLbyte *offsetInput = reinterpret_cast&lt;const GLbyte*&gt;(input + i * stride);
+        GLshort *offsetOutput = reinterpret_cast&lt;GLshort*&gt;(output)+i * outputComponentCount;
+
+        for (size_t j = 0; j &lt; inputComponentCount; j++)
+        {
+            offsetOutput[j] = static_cast&lt;GLshort&gt;(offsetInput[j]);
+        }
+
+        for (size_t j = inputComponentCount; j &lt; lastNonAlphaOutputComponent; j++)
+        {
+            // Set remaining G/B channels to 0.
+            offsetOutput[j] = 0;
+        }
+
+        if (inputComponentCount &lt; outputComponentCount &amp;&amp; outputComponentCount == 4)
+        {
+            // On integer formats, we must set the Alpha channel to 1 if it's unused.
+            offsetOutput[3] = 1;
+        }
+    }
+}
+
+template &lt;size_t inputComponentCount, size_t outputComponentCount&gt;
+inline void Copy8SnormTo16SnormVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+    for (size_t i = 0; i &lt; count; i++)
+    {
+        const GLbyte *offsetInput = reinterpret_cast&lt;const GLbyte*&gt;(input + i * stride);
+        GLshort *offsetOutput = reinterpret_cast&lt;GLshort*&gt;(output) + i * outputComponentCount;
+
+        for (size_t j = 0; j &lt; inputComponentCount; j++)
+        {
+            // The original GLbyte value ranges from -128 to +127 (INT8_MAX).
+            // When converted to GLshort, the value must be scaled to between -32768 and +32767 (INT16_MAX).
+            if (offsetInput[j] &gt; 0)
+            {
+                offsetOutput[j] = offsetInput[j] &lt;&lt; 8 | offsetInput[j] &lt;&lt; 1 | ((offsetInput[j] &amp; 0x40) &gt;&gt; 6);
+            }
+            else
+            {
+                offsetOutput[j] = offsetInput[j] &lt;&lt; 8;
+            }
+        }
+
+        for (size_t j = inputComponentCount; j &lt; std::min&lt;size_t&gt;(outputComponentCount, 3); j++)
+        {
+            // Set remaining G/B channels to 0.
+            offsetOutput[j] = 0;
+        }
+
+        if (inputComponentCount &lt; outputComponentCount &amp;&amp; outputComponentCount == 4)
+        {
+            // On normalized formats, we must set the Alpha channel to the max value if it's unused.
+            offsetOutput[3] = INT16_MAX;
+        }
+    }
+}
+
+template &lt;size_t inputComponentCount, size_t outputComponentCount&gt;
+inline void Copy32FixedTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+    static const float divisor = 1.0f / (1 &lt;&lt; 16);
+
+    for (size_t i = 0; i &lt; count; i++)
+    {
+        const GLfixed* offsetInput = reinterpret_cast&lt;const GLfixed*&gt;(input + (stride * i));
+        float* offsetOutput = reinterpret_cast&lt;float*&gt;(output) + i * outputComponentCount;
+
+        for (size_t j = 0; j &lt; inputComponentCount; j++)
+        {
+            offsetOutput[j] = static_cast&lt;float&gt;(offsetInput[j]) * divisor;
+        }
+
+        // 4-component output formats would need special padding in the alpha channel.
+        static_assert(!(inputComponentCount &lt; 4 &amp;&amp; outputComponentCount == 4),
+                      &quot;An inputComponentCount less than 4 and an outputComponentCount equal to 4 is not supported.&quot;);
+
+        for (size_t j = inputComponentCount; j &lt; outputComponentCount; j++)
+        {
+            offsetOutput[j] = 0.0f;
+        }
+    }
+}
+
+template &lt;typename T, size_t inputComponentCount, size_t outputComponentCount, bool normalized&gt;
+inline void CopyTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+    typedef std::numeric_limits&lt;T&gt; NL;
+
+    for (size_t i = 0; i &lt; count; i++)
+    {
+        const T *offsetInput = reinterpret_cast&lt;const T*&gt;(input + (stride * i));
+        float *offsetOutput = reinterpret_cast&lt;float*&gt;(output) + i * outputComponentCount;
+
+        for (size_t j = 0; j &lt; inputComponentCount; j++)
+        {
+            if (normalized)
+            {
+                if (NL::is_signed)
+                {
+                    const float divisor = 1.0f / (2 * static_cast&lt;float&gt;(NL::max()) + 1);
+                    offsetOutput[j] = (2 * static_cast&lt;float&gt;(offsetInput[j]) + 1) * divisor;
+                }
+                else
+                {
+                    offsetOutput[j] =  static_cast&lt;float&gt;(offsetInput[j]) / NL::max();
+                }
+            }
+            else
+            {
+                offsetOutput[j] =  static_cast&lt;float&gt;(offsetInput[j]);
+            }
+        }
+
+        // This would require special padding.
+        static_assert(!(inputComponentCount &lt; 4 &amp;&amp; outputComponentCount == 4),
+                      &quot;An inputComponentCount less than 4 and an outputComponentCount equal to 4 is not supported.&quot;);
+
+        for (size_t j = inputComponentCount; j &lt; outputComponentCount; j++)
+        {
+            offsetOutput[j] = 0.0f;
+        }
+    }
+}
+
+namespace priv
+{
+
+template &lt;bool isSigned, bool normalized, bool toFloat&gt;
+static inline void CopyPackedRGB(uint32_t data, uint8_t *output)
+{
+    const uint32_t rgbSignMask = 0x200;       // 1 set at the 9 bit
+    const uint32_t negativeMask = 0xFFFFFC00; // All bits from 10 to 31 set to 1
+
+    if (toFloat)
+    {
+        GLfloat *floatOutput = reinterpret_cast&lt;GLfloat*&gt;(output);
+        if (isSigned)
+        {
+            GLfloat finalValue = 0;
+            if (data &amp; rgbSignMask)
+            {
+                int negativeNumber = data | negativeMask;
+                finalValue = static_cast&lt;GLfloat&gt;(negativeNumber);
+            }
+            else
+            {
+                finalValue = static_cast&lt;GLfloat&gt;(data);
+            }
+
+            if (normalized)
+            {
+                const int32_t maxValue = 0x1FF;      // 1 set in bits 0 through 8
+                const int32_t minValue = 0xFFFFFE01; // Inverse of maxValue
+
+                // A 10-bit two's complement number has the possibility of being minValue - 1 but
+                // OpenGL's normalization rules dictate that it should be clamped to minValue in this
+                // case.
+                if (finalValue &lt; minValue)
+                {
+                    finalValue = minValue;
+                }
+
+                const int32_t halfRange = (maxValue - minValue) &gt;&gt; 1;
+                *floatOutput = ((finalValue - minValue) / halfRange) - 1.0f;
+            }
+            else
+            {
+                *floatOutput = finalValue;
+            }
+        }
+        else
+        {
+            if (normalized)
+            {
+                const uint32_t maxValue = 0x3FF; // 1 set in bits 0 through 9
+                *floatOutput = static_cast&lt;GLfloat&gt;(data) / static_cast&lt;GLfloat&gt;(maxValue);
+            }
+            else
+            {
+                *floatOutput = static_cast&lt;GLfloat&gt;(data);
+            }
+        }
+    }
+    else
+    {
+        if (isSigned)
+        {
+            GLshort *intOutput = reinterpret_cast&lt;GLshort*&gt;(output);
+
+            if (data &amp; rgbSignMask)
+            {
+                *intOutput = static_cast&lt;GLshort&gt;(data | negativeMask);
+            }
+            else
+            {
+                *intOutput = static_cast&lt;GLshort&gt;(data);
+            }
+        }
+        else
+        {
+            GLushort *uintOutput = reinterpret_cast&lt;GLushort*&gt;(output);
+            *uintOutput = static_cast&lt;GLushort&gt;(data);
+        }
+    }
+}
+
+template &lt;bool isSigned, bool normalized, bool toFloat&gt;
+inline void CopyPackedAlpha(uint32_t data, uint8_t *output)
+{
+    if (toFloat)
+    {
+        GLfloat *floatOutput = reinterpret_cast&lt;GLfloat*&gt;(output);
+        if (isSigned)
+        {
+            if (normalized)
+            {
+                switch (data)
+                {
+                  case 0x0: *floatOutput =  0.0f; break;
+                  case 0x1: *floatOutput =  1.0f; break;
+                  case 0x2: *floatOutput = -1.0f; break;
+                  case 0x3: *floatOutput = -1.0f; break;
+                  default: UNREACHABLE();
+                }
+            }
+            else
+            {
+                switch (data)
+                {
+                  case 0x0: *floatOutput =  0.0f; break;
+                  case 0x1: *floatOutput =  1.0f; break;
+                  case 0x2: *floatOutput = -2.0f; break;
+                  case 0x3: *floatOutput = -1.0f; break;
+                  default: UNREACHABLE();
+                }
+            }
+        }
+        else
+        {
+            if (normalized)
+            {
+                switch (data)
+                {
+                  case 0x0: *floatOutput = 0.0f / 3.0f; break;
+                  case 0x1: *floatOutput = 1.0f / 3.0f; break;
+                  case 0x2: *floatOutput = 2.0f / 3.0f; break;
+                  case 0x3: *floatOutput = 3.0f / 3.0f; break;
+                  default: UNREACHABLE();
+                }
+            }
+            else
+            {
+                switch (data)
+                {
+                  case 0x0: *floatOutput = 0.0f; break;
+                  case 0x1: *floatOutput = 1.0f; break;
+                  case 0x2: *floatOutput = 2.0f; break;
+                  case 0x3: *floatOutput = 3.0f; break;
+                  default: UNREACHABLE();
+                }
+            }
+        }
+    }
+    else
+    {
+        if (isSigned)
+        {
+            GLshort *intOutput = reinterpret_cast&lt;GLshort*&gt;(output);
+            switch (data)
+            {
+              case 0x0: *intOutput =  0; break;
+              case 0x1: *intOutput =  1; break;
+              case 0x2: *intOutput = -2; break;
+              case 0x3: *intOutput = -1; break;
+              default: UNREACHABLE();
+            }
+        }
+        else
+        {
+            GLushort *uintOutput = reinterpret_cast&lt;GLushort*&gt;(output);
+            switch (data)
+            {
+              case 0x0: *uintOutput = 0; break;
+              case 0x1: *uintOutput = 1; break;
+              case 0x2: *uintOutput = 2; break;
+              case 0x3: *uintOutput = 3; break;
+              default: UNREACHABLE();
+            }
+        }
+    }
+}
+
+}
+
+template &lt;bool isSigned, bool normalized, bool toFloat&gt;
+inline void CopyXYZ10W2ToXYZW32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output)
+{
+    const size_t outputComponentSize = toFloat ? 4 : 2;
+    const size_t componentCount = 4;
+
+    const uint32_t rgbMask = 0x3FF; // 1 set in bits 0 through 9
+    const size_t redShift = 0;    // red is bits 0 through 9
+    const size_t greenShift = 10; // green is bits 10 through 19
+    const size_t blueShift = 20;  // blue is bits 20 through 29
+
+    const uint32_t alphaMask = 0x3; // 1 set in bits 0 and 1
+    const size_t alphaShift = 30; // Alpha is the 30 and 31 bits
+
+    for (size_t i = 0; i &lt; count; i++)
+    {
+        GLuint packedValue = *reinterpret_cast&lt;const GLuint*&gt;(input + (i * stride));
+        uint8_t *offsetOutput = output + (i * outputComponentSize * componentCount);
+
+        priv::CopyPackedRGB&lt;isSigned, normalized, toFloat&gt;(  (packedValue &gt;&gt; redShift)   &amp; rgbMask,   offsetOutput + (0 * outputComponentSize));
+        priv::CopyPackedRGB&lt;isSigned, normalized, toFloat&gt;(  (packedValue &gt;&gt; greenShift) &amp; rgbMask,   offsetOutput + (1 * outputComponentSize));
+        priv::CopyPackedRGB&lt;isSigned, normalized, toFloat&gt;(  (packedValue &gt;&gt; blueShift)  &amp; rgbMask,   offsetOutput + (2 * outputComponentSize));
+        priv::CopyPackedAlpha&lt;isSigned, normalized, toFloat&gt;((packedValue &gt;&gt; alphaShift) &amp; alphaMask, offsetOutput + (3 * outputComponentSize));
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11formatutils11cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1342 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// formatutils11.cpp: Queries for GL image formats and their translations to D3D11
+// formats.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+#include &quot;libANGLE/renderer/d3d/copyimage.h&quot;
+#include &quot;libANGLE/renderer/d3d/generatemip.h&quot;
+#include &quot;libANGLE/renderer/d3d/loadimage.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/copyvertex.h&quot;
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+typedef std::map&lt;DXGI_FORMAT, GLenum&gt; DXGIToESFormatMap;
+
+inline void AddDXGIToESEntry(DXGIToESFormatMap *map, DXGI_FORMAT key, GLenum value)
+{
+    map-&gt;insert(std::make_pair(key, value));
+}
+
+static DXGIToESFormatMap BuildDXGIToESFormatMap()
+{
+    DXGIToESFormatMap map;
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_UNKNOWN,                  GL_NONE);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_A8_UNORM,                 GL_ALPHA8_EXT);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8_UNORM,                 GL_R8);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8_UNORM,               GL_RG8);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8B8A8_UNORM,           GL_RGBA8);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,      GL_SRGB8_ALPHA8);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_B8G8R8A8_UNORM,           GL_BGRA8_EXT);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8_SNORM,                 GL_R8_SNORM);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8_SNORM,               GL_RG8_SNORM);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8B8A8_SNORM,           GL_RGBA8_SNORM);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8_UINT,                  GL_R8UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16_UINT,                 GL_R16UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32_UINT,                 GL_R32UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8_UINT,                GL_RG8UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16G16_UINT,              GL_RG16UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32_UINT,              GL_RG32UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32B32_UINT,           GL_RGB32UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8B8A8_UINT,            GL_RGBA8UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16G16B16A16_UINT,        GL_RGBA16UI);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32B32A32_UINT,        GL_RGBA32UI);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8_SINT,                  GL_R8I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16_SINT,                 GL_R16I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32_SINT,                 GL_R32I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8_SINT,                GL_RG8I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16G16_SINT,              GL_RG16I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32_SINT,              GL_RG32I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32B32_SINT,           GL_RGB32I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R8G8B8A8_SINT,            GL_RGBA8I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16G16B16A16_SINT,        GL_RGBA16I);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32B32A32_SINT,        GL_RGBA32I);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R10G10B10A2_UNORM,        GL_RGB10_A2);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R10G10B10A2_UINT,         GL_RGB10_A2UI);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16_FLOAT,                GL_R16F);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16G16_FLOAT,             GL_RG16F);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16G16B16A16_FLOAT,       GL_RGBA16F);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32_FLOAT,                GL_R32F);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32_FLOAT,             GL_RG32F);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32B32_FLOAT,          GL_RGB32F);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G32B32A32_FLOAT,       GL_RGBA32F);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP,       GL_RGB9_E5);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R11G11B10_FLOAT,          GL_R11F_G11F_B10F);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16_TYPELESS,             GL_DEPTH_COMPONENT16);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R16_UNORM,                GL_DEPTH_COMPONENT16);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_D16_UNORM,                GL_DEPTH_COMPONENT16);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R24G8_TYPELESS,           GL_DEPTH24_STENCIL8_OES);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS,    GL_DEPTH24_STENCIL8_OES);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_D24_UNORM_S8_UINT,        GL_DEPTH24_STENCIL8_OES);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32G8X24_TYPELESS,        GL_DEPTH32F_STENCIL8);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, GL_DEPTH32F_STENCIL8);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT,     GL_DEPTH32F_STENCIL8);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_R32_TYPELESS,             GL_DEPTH_COMPONENT32F);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_D32_FLOAT,                GL_DEPTH_COMPONENT32F);
+
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_BC1_UNORM,                GL_COMPRESSED_RGBA_S3TC_DXT1_EXT);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_BC2_UNORM,                GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE);
+    AddDXGIToESEntry(&amp;map, DXGI_FORMAT_BC3_UNORM,                GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE);
+
+    return map;
+}
+
+struct D3D11FastCopyFormat
+{
+    GLenum destFormat;
+    GLenum destType;
+    ColorCopyFunction copyFunction;
+
+    D3D11FastCopyFormat(GLenum destFormat, GLenum destType, ColorCopyFunction copyFunction)
+        : destFormat(destFormat), destType(destType), copyFunction(copyFunction)
+    { }
+
+    bool operator&lt;(const D3D11FastCopyFormat&amp; other) const
+    {
+        return memcmp(this, &amp;other, sizeof(D3D11FastCopyFormat)) &lt; 0;
+    }
+};
+
+typedef std::multimap&lt;DXGI_FORMAT, D3D11FastCopyFormat&gt; D3D11FastCopyMap;
+
+static D3D11FastCopyMap BuildFastCopyMap()
+{
+    D3D11FastCopyMap map;
+
+    map.insert(std::make_pair(DXGI_FORMAT_B8G8R8A8_UNORM, D3D11FastCopyFormat(GL_RGBA, GL_UNSIGNED_BYTE, CopyBGRA8ToRGBA8)));
+
+    return map;
+}
+
+struct DXGIColorFormatInfo
+{
+    size_t redBits;
+    size_t greenBits;
+    size_t blueBits;
+
+    size_t luminanceBits;
+
+    size_t alphaBits;
+    size_t sharedBits;
+};
+
+typedef std::map&lt;DXGI_FORMAT, DXGIColorFormatInfo&gt; ColorFormatInfoMap;
+typedef std::pair&lt;DXGI_FORMAT, DXGIColorFormatInfo&gt; ColorFormatInfoPair;
+
+static inline void InsertDXGIColorFormatInfo(ColorFormatInfoMap *map, DXGI_FORMAT format, size_t redBits, size_t greenBits,
+                                             size_t blueBits, size_t alphaBits, size_t sharedBits)
+{
+    DXGIColorFormatInfo info;
+    info.redBits = redBits;
+    info.greenBits = greenBits;
+    info.blueBits = blueBits;
+    info.alphaBits = alphaBits;
+    info.sharedBits = sharedBits;
+
+    map-&gt;insert(std::make_pair(format, info));
+}
+
+static ColorFormatInfoMap BuildColorFormatInfoMap()
+{
+    ColorFormatInfoMap map;
+
+    //                             | DXGI format                         | R | G | B | A | S |
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_A8_UNORM,                  0,  0,  0,  8,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8_UNORM,                  8,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8_UNORM,                8,  8,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8B8A8_UNORM,            8,  8,  8,  8,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,       8,  8,  8,  8,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_B8G8R8A8_UNORM,            8,  8,  8,  8,  0);
+
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8_SNORM,                  8,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8_SNORM,                8,  8,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8B8A8_SNORM,            8,  8,  8,  8,  0);
+
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8_UINT,                   8,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16_UINT,                 16,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32_UINT,                 32,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8_UINT,                 8,  8,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16G16_UINT,              16, 16,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32_UINT,              32, 32,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32B32_UINT,           32, 32, 32,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8B8A8_UINT,             8,  8,  8,  8,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16G16B16A16_UINT,        16, 16, 16, 16,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32B32A32_UINT,        32, 32, 32, 32,  0);
+
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8_SINT,                   8,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16_SINT,                 16,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32_SINT,                 32,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8_SINT,                 8,  8,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16G16_SINT,              16, 16,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32_SINT,              32, 32,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32B32_SINT,           32, 32, 32,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R8G8B8A8_SINT,             8,  8,  8,  8,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16G16B16A16_SINT,        16, 16, 16, 16,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32B32A32_SINT,        32, 32, 32, 32,  0);
+
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R10G10B10A2_UNORM,        10, 10, 10,  2,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R10G10B10A2_UINT,         10, 10, 10,  2,  0);
+
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16_FLOAT,                16,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16G16_FLOAT,             16, 16,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R16G16B16A16_FLOAT,       16, 16, 16, 16,  0);
+
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32_FLOAT,                32,  0,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32_FLOAT,             32, 32,  0,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32B32_FLOAT,          32, 32, 32,  0,  0);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R32G32B32A32_FLOAT,       32, 32, 32, 32,  0);
+
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP,        9,  9,  9,  0,  5);
+    InsertDXGIColorFormatInfo(&amp;map, DXGI_FORMAT_R11G11B10_FLOAT,          11, 11, 10,  0,  0);
+
+    return map;
+}
+
+struct DXGIDepthStencilInfo
+{
+    unsigned int depthBits;
+    unsigned int depthOffset;
+    unsigned int stencilBits;
+    unsigned int stencilOffset;
+};
+
+typedef std::map&lt;DXGI_FORMAT, DXGIDepthStencilInfo&gt; DepthStencilInfoMap;
+typedef std::pair&lt;DXGI_FORMAT, DXGIDepthStencilInfo&gt; DepthStencilInfoPair;
+
+static inline void InsertDXGIDepthStencilInfo(DepthStencilInfoMap *map, DXGI_FORMAT format, unsigned int depthBits,
+                                              unsigned int depthOffset, unsigned int stencilBits, unsigned int stencilOffset)
+{
+    DXGIDepthStencilInfo info;
+    info.depthBits = depthBits;
+    info.depthOffset = depthOffset;
+    info.stencilBits = stencilBits;
+    info.stencilOffset = stencilOffset;
+
+    map-&gt;insert(std::make_pair(format, info));
+}
+
+static DepthStencilInfoMap BuildDepthStencilInfoMap()
+{
+    DepthStencilInfoMap map;
+
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R16_TYPELESS,             16, 0, 0,  0);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R16_UNORM,                16, 0, 0,  0);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_D16_UNORM,                16, 0, 0,  0);
+
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R24G8_TYPELESS,           24, 0, 8, 24);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS,    24, 0, 8, 24);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_D24_UNORM_S8_UINT,        24, 0, 8, 24);
+
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R32_TYPELESS,             32, 0, 0,  0);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R32_FLOAT,                32, 0, 0,  0);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_D32_FLOAT,                32, 0, 0,  0);
+
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R32G8X24_TYPELESS,        32, 0, 8, 32);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, 32, 0, 8, 32);
+    InsertDXGIDepthStencilInfo(&amp;map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT,     32, 0, 8, 32);
+
+    return map;
+}
+
+typedef std::map&lt;DXGI_FORMAT, DXGIFormat&gt; DXGIFormatInfoMap;
+
+DXGIFormat::DXGIFormat()
+    : pixelBytes(0),
+      blockWidth(0),
+      blockHeight(0),
+      redBits(0),
+      greenBits(0),
+      blueBits(0),
+      alphaBits(0),
+      sharedBits(0),
+      depthBits(0),
+      depthOffset(0),
+      stencilBits(0),
+      stencilOffset(0),
+      internalFormat(GL_NONE),
+      componentType(GL_NONE),
+      mipGenerationFunction(NULL),
+      colorReadFunction(NULL),
+      fastCopyFunctions(),
+      nativeMipmapSupport(NULL)
+{
+}
+
+static bool NeverSupported(D3D_FEATURE_LEVEL)
+{
+    return false;
+}
+
+template &lt;D3D_FEATURE_LEVEL requiredFeatureLevel&gt;
+static bool RequiresFeatureLevel(D3D_FEATURE_LEVEL featureLevel)
+{
+    return featureLevel &gt;= requiredFeatureLevel;
+}
+
+ColorCopyFunction DXGIFormat::getFastCopyFunction(GLenum format, GLenum type) const
+{
+    FastCopyFunctionMap::const_iterator iter = fastCopyFunctions.find(std::make_pair(format, type));
+    return (iter != fastCopyFunctions.end()) ? iter-&gt;second : NULL;
+}
+
+void AddDXGIFormat(DXGIFormatInfoMap *map, DXGI_FORMAT dxgiFormat, GLuint pixelBits, GLuint blockWidth, GLuint blockHeight,
+                   GLenum componentType, MipGenerationFunction mipFunc, ColorReadFunction readFunc, NativeMipmapGenerationSupportFunction nativeMipmapSupport)
+{
+    DXGIFormat info;
+    info.pixelBytes = pixelBits / 8;
+    info.blockWidth = blockWidth;
+    info.blockHeight = blockHeight;
+
+    static const ColorFormatInfoMap colorInfoMap = BuildColorFormatInfoMap();
+    ColorFormatInfoMap::const_iterator colorInfoIter = colorInfoMap.find(dxgiFormat);
+    if (colorInfoIter != colorInfoMap.end())
+    {
+        const DXGIColorFormatInfo &amp;colorInfo = colorInfoIter-&gt;second;
+        info.redBits = colorInfo.redBits;
+        info.greenBits = colorInfo.greenBits;
+        info.blueBits = colorInfo.blueBits;
+        info.alphaBits = colorInfo.alphaBits;
+        info.sharedBits = colorInfo.sharedBits;
+    }
+
+    static const DepthStencilInfoMap dsInfoMap = BuildDepthStencilInfoMap();
+    DepthStencilInfoMap::const_iterator dsInfoIter = dsInfoMap.find(dxgiFormat);
+    if (dsInfoIter != dsInfoMap.end())
+    {
+        const DXGIDepthStencilInfo &amp;dsInfo = dsInfoIter-&gt;second;
+        info.depthBits = dsInfo.depthBits;
+        info.depthOffset = dsInfo.depthOffset;
+        info.stencilBits = dsInfo.stencilBits;
+        info.stencilOffset = dsInfo.stencilOffset;
+    }
+
+    static const DXGIToESFormatMap dxgiToESMap = BuildDXGIToESFormatMap();
+    DXGIToESFormatMap::const_iterator dxgiToESIter = dxgiToESMap.find(dxgiFormat);
+    info.internalFormat = (dxgiToESIter != dxgiToESMap.end()) ? dxgiToESIter-&gt;second : GL_NONE;
+
+    info.componentType = componentType;
+
+    info.mipGenerationFunction = mipFunc;
+    info.colorReadFunction = readFunc;
+
+    static const D3D11FastCopyMap fastCopyMap = BuildFastCopyMap();
+    std::pair&lt;D3D11FastCopyMap::const_iterator, D3D11FastCopyMap::const_iterator&gt; fastCopyIter = fastCopyMap.equal_range(dxgiFormat);
+    for (D3D11FastCopyMap::const_iterator i = fastCopyIter.first; i != fastCopyIter.second; i++)
+    {
+        info.fastCopyFunctions.insert(std::make_pair(std::make_pair(i-&gt;second.destFormat, i-&gt;second.destType), i-&gt;second.copyFunction));
+    }
+
+    info.nativeMipmapSupport = nativeMipmapSupport;
+
+    map-&gt;insert(std::make_pair(dxgiFormat, info));
+}
+
+// A map to determine the pixel size and mipmap generation function of a given DXGI format
+static DXGIFormatInfoMap BuildDXGIFormatInfoMap()
+{
+    DXGIFormatInfoMap map;
+
+    //                | DXGI format                          |S   |W |H |Component Type         | Mip generation function   | Color read function               | Native mipmap function
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_UNKNOWN,                  0,   0, 0, GL_NONE,                NULL,                       NULL,                              NeverSupported);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_A8_UNORM,                 8,   1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip&lt;A8&gt;,            ReadColor&lt;A8, GLfloat&gt;,            RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8_UNORM,                 8,   1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip&lt;R8&gt;,            ReadColor&lt;R8, GLfloat&gt;,            RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8_UNORM,               16,  1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip&lt;R8G8&gt;,          ReadColor&lt;R8G8, GLfloat&gt;,          RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8B8A8_UNORM,           32,  1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip&lt;R8G8B8A8&gt;,      ReadColor&lt;R8G8B8A8, GLfloat&gt;,      RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_9_1&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,      32,  1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip&lt;R8G8B8A8&gt;,      ReadColor&lt;R8G8B8A8, GLfloat&gt;,      RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_9_1&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_B8G8R8A8_UNORM,           32,  1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip&lt;B8G8R8A8&gt;,      ReadColor&lt;B8G8R8A8, GLfloat&gt;,      RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_9_1&gt;);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8_SNORM,                 8,   1, 1, GL_SIGNED_NORMALIZED,   GenerateMip&lt;R8S&gt;,           ReadColor&lt;R8S, GLfloat&gt;      ,     RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8_SNORM,               16,  1, 1, GL_SIGNED_NORMALIZED,   GenerateMip&lt;R8G8S&gt;,         ReadColor&lt;R8G8S, GLfloat&gt;    ,     RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8B8A8_SNORM,           32,  1, 1, GL_SIGNED_NORMALIZED,   GenerateMip&lt;R8G8B8A8S&gt;,     ReadColor&lt;R8G8B8A8S, GLfloat&gt;,     RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8_UINT,                  8,   1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R8&gt;,            ReadColor&lt;R8, GLuint&gt;,             NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16_UINT,                 16,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R16&gt;,           ReadColor&lt;R16, GLuint&gt;,            NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32_UINT,                 32,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R32&gt;,           ReadColor&lt;R32, GLuint&gt;,            NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8_UINT,                16,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R8G8&gt;,          ReadColor&lt;R8G8, GLuint&gt;,           NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16_UINT,              32,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R16G16&gt;,        ReadColor&lt;R16G16, GLuint&gt;,         NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32_UINT,              64,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R32G32&gt;,        ReadColor&lt;R32G32, GLuint&gt;,         NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32B32_UINT,           96,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R32G32B32&gt;,     ReadColor&lt;R32G32B32, GLuint&gt;,      NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8B8A8_UINT,            32,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R8G8B8A8&gt;,      ReadColor&lt;R8G8B8A8, GLuint&gt;,       NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16B16A16_UINT,        64,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R16G16B16A16&gt;,  ReadColor&lt;R16G16B16A16, GLuint&gt;,   NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32B32A32_UINT,        128, 1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R32G32B32A32&gt;,  ReadColor&lt;R32G32B32A32, GLuint&gt;,   NeverSupported);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8_SINT,                  8,   1, 1, GL_INT,                 GenerateMip&lt;R8S&gt;,           ReadColor&lt;R8S, GLint&gt;,             NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16_SINT,                 16,  1, 1, GL_INT,                 GenerateMip&lt;R16S&gt;,          ReadColor&lt;R16S, GLint&gt;,            NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32_SINT,                 32,  1, 1, GL_INT,                 GenerateMip&lt;R32S&gt;,          ReadColor&lt;R32S, GLint&gt;,            NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8_SINT,                16,  1, 1, GL_INT,                 GenerateMip&lt;R8G8S&gt;,         ReadColor&lt;R8G8S, GLint&gt;,           NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16_SINT,              32,  1, 1, GL_INT,                 GenerateMip&lt;R16G16S&gt;,       ReadColor&lt;R16G16S, GLint&gt;,         NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32_SINT,              64,  1, 1, GL_INT,                 GenerateMip&lt;R32G32S&gt;,       ReadColor&lt;R32G32S, GLint&gt;,         NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32B32_SINT,           96,  1, 1, GL_INT,                 GenerateMip&lt;R32G32B32S&gt;,    ReadColor&lt;R32G32B32S, GLint&gt;,      NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R8G8B8A8_SINT,            32,  1, 1, GL_INT,                 GenerateMip&lt;R8G8B8A8S&gt;,     ReadColor&lt;R8G8B8A8S, GLint&gt;,       NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16B16A16_SINT,        64,  1, 1, GL_INT,                 GenerateMip&lt;R16G16B16A16S&gt;, ReadColor&lt;R16G16B16A16S, GLint&gt;,   NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32B32A32_SINT,        128, 1, 1, GL_INT,                 GenerateMip&lt;R32G32B32A32S&gt;, ReadColor&lt;R32G32B32A32S, GLint&gt;,   NeverSupported);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R10G10B10A2_UNORM,        32,  1, 1, GL_UNSIGNED_NORMALIZED, GenerateMip&lt;R10G10B10A2&gt;,   ReadColor&lt;R10G10B10A2, GLfloat&gt;,   RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R10G10B10A2_UINT,         32,  1, 1, GL_UNSIGNED_INT,        GenerateMip&lt;R10G10B10A2&gt;,   ReadColor&lt;R10G10B10A2, GLuint&gt;,    NeverSupported);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16_FLOAT,                16,  1, 1, GL_FLOAT,               GenerateMip&lt;R16F&gt;,          ReadColor&lt;R16F, GLfloat&gt;,          RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16_FLOAT,             32,  1, 1, GL_FLOAT,               GenerateMip&lt;R16G16F&gt;,       ReadColor&lt;R16G16F, GLfloat&gt;,       RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_9_2&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16B16A16_FLOAT,       64,  1, 1, GL_FLOAT,               GenerateMip&lt;R16G16B16A16F&gt;, ReadColor&lt;R16G16B16A16F, GLfloat&gt;, RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_9_2&gt;);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32_FLOAT,                32,  1, 1, GL_FLOAT,               GenerateMip&lt;R32F&gt;,          ReadColor&lt;R32F, GLfloat&gt;,          RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_9_2&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32_FLOAT,             64,  1, 1, GL_FLOAT,               GenerateMip&lt;R32G32F&gt;,       ReadColor&lt;R32G32F, GLfloat&gt;,       RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32B32_FLOAT,          96,  1, 1, GL_FLOAT,               NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G32B32A32_FLOAT,       128, 1, 1, GL_FLOAT,               GenerateMip&lt;R32G32B32A32F&gt;, ReadColor&lt;R32G32B32A32F, GLfloat&gt;, RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_9_3&gt;);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP,       32,  1, 1, GL_FLOAT,               GenerateMip&lt;R9G9B9E5&gt;,      ReadColor&lt;R9G9B9E5, GLfloat&gt;,      NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R11G11B10_FLOAT,          32,  1, 1, GL_FLOAT,               GenerateMip&lt;R11G11B10F&gt;,    ReadColor&lt;R11G11B10F, GLfloat&gt;,    RequiresFeatureLevel&lt;D3D_FEATURE_LEVEL_10_0&gt;);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16_TYPELESS,             16,  1, 1, GL_NONE,                NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16_UNORM,                16,  1, 1, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_D16_UNORM,                16,  1, 1, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R24G8_TYPELESS,           32,  1, 1, GL_NONE,                NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS,    32,  1, 1, GL_NONE,                NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_D24_UNORM_S8_UINT,        32,  1, 1, GL_UNSIGNED_INT,        NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32G8X24_TYPELESS,        64,  1, 1, GL_NONE,                NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, 64,  1, 1, GL_NONE,                NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT,     64,  1, 1, GL_UNSIGNED_INT,        NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R32_TYPELESS,             32,  1, 1, GL_NONE,                NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_D32_FLOAT,                32,  1, 1, GL_FLOAT,               NULL,                       NULL,                              NeverSupported);
+
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_BC1_UNORM,                64,  4, 4, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_BC2_UNORM,                128, 4, 4, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_BC3_UNORM,                128, 4, 4, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+
+    // Useful formats for vertex buffers
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16_UNORM,                16,  1, 1, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16_SNORM,                16,  1, 1, GL_SIGNED_NORMALIZED,   NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16_UNORM,             32,  1, 1, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16_SNORM,             32,  1, 1, GL_SIGNED_NORMALIZED,   NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16B16A16_UNORM,       64,  1, 1, GL_UNSIGNED_NORMALIZED, NULL,                       NULL,                              NeverSupported);
+    AddDXGIFormat(&amp;map, DXGI_FORMAT_R16G16B16A16_SNORM,       64,  1, 1, GL_SIGNED_NORMALIZED,   NULL,                       NULL,                              NeverSupported);
+
+    return map;
+}
+
+const DXGIFormat &amp;GetDXGIFormatInfo(DXGI_FORMAT format)
+{
+    static const DXGIFormatInfoMap infoMap = BuildDXGIFormatInfoMap();
+    DXGIFormatInfoMap::const_iterator iter = infoMap.find(format);
+    if (iter != infoMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        static DXGIFormat defaultInfo;
+        return defaultInfo;
+    }
+}
+
+struct SwizzleSizeType
+{
+    size_t maxComponentSize;
+    GLenum componentType;
+
+    SwizzleSizeType()
+        : maxComponentSize(0), componentType(GL_NONE)
+    { }
+
+    SwizzleSizeType(size_t maxComponentSize, GLenum componentType)
+        : maxComponentSize(maxComponentSize), componentType(componentType)
+    { }
+
+    bool operator&lt;(const SwizzleSizeType&amp; other) const
+    {
+        return (maxComponentSize != other.maxComponentSize) ? (maxComponentSize &lt; other.maxComponentSize)
+                                                            : (componentType &lt; other.componentType);
+    }
+};
+
+struct SwizzleFormatInfo
+{
+    DXGI_FORMAT mTexFormat;
+    DXGI_FORMAT mSRVFormat;
+    DXGI_FORMAT mRTVFormat;
+
+    SwizzleFormatInfo()
+        : mTexFormat(DXGI_FORMAT_UNKNOWN), mSRVFormat(DXGI_FORMAT_UNKNOWN), mRTVFormat(DXGI_FORMAT_UNKNOWN)
+    { }
+
+    SwizzleFormatInfo(DXGI_FORMAT texFormat, DXGI_FORMAT srvFormat, DXGI_FORMAT rtvFormat)
+        : mTexFormat(texFormat), mSRVFormat(srvFormat), mRTVFormat(rtvFormat)
+    { }
+};
+
+typedef std::map&lt;SwizzleSizeType, SwizzleFormatInfo&gt; SwizzleInfoMap;
+typedef std::pair&lt;SwizzleSizeType, SwizzleFormatInfo&gt; SwizzleInfoPair;
+
+static SwizzleInfoMap BuildSwizzleInfoMap()
+{
+    SwizzleInfoMap map;
+
+    map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM,     DXGI_FORMAT_R8G8B8A8_UNORM,     DXGI_FORMAT_R8G8B8A8_UNORM    )));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM)));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(24, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT)));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT)));
+
+    map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_SIGNED_NORMALIZED  ), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_SNORM,     DXGI_FORMAT_R8G8B8A8_SNORM,     DXGI_FORMAT_R8G8B8A8_SNORM    )));
+
+    map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_FLOAT              ), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT)));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_FLOAT              ), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT)));
+
+    map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_UNSIGNED_INT       ), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_UINT,      DXGI_FORMAT_R8G8B8A8_UINT,      DXGI_FORMAT_R8G8B8A8_UINT     )));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_UNSIGNED_INT       ), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_UINT,  DXGI_FORMAT_R16G16B16A16_UINT,  DXGI_FORMAT_R16G16B16A16_UINT )));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_UNSIGNED_INT       ), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_UINT,  DXGI_FORMAT_R32G32B32A32_UINT,  DXGI_FORMAT_R32G32B32A32_UINT )));
+
+    map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_INT                ), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_SINT,      DXGI_FORMAT_R8G8B8A8_SINT,      DXGI_FORMAT_R8G8B8A8_SINT     )));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_INT                ), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_SINT,  DXGI_FORMAT_R16G16B16A16_SINT,  DXGI_FORMAT_R16G16B16A16_SINT )));
+    map.insert(SwizzleInfoPair(SwizzleSizeType(32, GL_INT                ), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_SINT,  DXGI_FORMAT_R32G32B32A32_SINT,  DXGI_FORMAT_R32G32B32A32_SINT )));
+
+    return map;
+}
+
+typedef std::pair&lt;GLint, InitializeTextureDataFunction&gt; InternalFormatInitializerPair;
+typedef std::map&lt;GLint, InitializeTextureDataFunction&gt; InternalFormatInitializerMap;
+
+static InternalFormatInitializerMap BuildInternalFormatInitializerMap()
+{
+    InternalFormatInitializerMap map;
+
+    map.insert(InternalFormatInitializerPair(GL_RGB8,    Initialize4ComponentData&lt;GLubyte,  0x00,       0x00,       0x00,       0xFF&gt;          ));
+    map.insert(InternalFormatInitializerPair(GL_RGB565,  Initialize4ComponentData&lt;GLubyte,  0x00,       0x00,       0x00,       0xFF&gt;          ));
+    map.insert(InternalFormatInitializerPair(GL_SRGB8,   Initialize4ComponentData&lt;GLubyte,  0x00,       0x00,       0x00,       0xFF&gt;          ));
+    map.insert(InternalFormatInitializerPair(GL_RGB16F,  Initialize4ComponentData&lt;GLhalf,   0x0000,     0x0000,     0x0000,     gl::Float16One&gt;));
+    map.insert(InternalFormatInitializerPair(GL_RGB32F,  Initialize4ComponentData&lt;GLfloat,  0x00000000, 0x00000000, 0x00000000, gl::Float32One&gt;));
+    map.insert(InternalFormatInitializerPair(GL_RGB8UI,  Initialize4ComponentData&lt;GLubyte,  0x00,       0x00,       0x00,       0x01&gt;          ));
+    map.insert(InternalFormatInitializerPair(GL_RGB8I,   Initialize4ComponentData&lt;GLbyte,   0x00,       0x00,       0x00,       0x01&gt;          ));
+    map.insert(InternalFormatInitializerPair(GL_RGB16UI, Initialize4ComponentData&lt;GLushort, 0x0000,     0x0000,     0x0000,     0x0001&gt;        ));
+    map.insert(InternalFormatInitializerPair(GL_RGB16I,  Initialize4ComponentData&lt;GLshort,  0x0000,     0x0000,     0x0000,     0x0001&gt;        ));
+    map.insert(InternalFormatInitializerPair(GL_RGB32UI, Initialize4ComponentData&lt;GLuint,   0x00000000, 0x00000000, 0x00000000, 0x00000001&gt;    ));
+    map.insert(InternalFormatInitializerPair(GL_RGB32I,  Initialize4ComponentData&lt;GLint,    0x00000000, 0x00000000, 0x00000000, 0x00000001&gt;    ));
+
+    return map;
+}
+
+// ES3 image loading functions vary based on the internal format and data type given,
+// this map type determines the loading function from the internal format and type supplied
+// to glTex*Image*D and the destination DXGI_FORMAT. Source formats and types are taken from
+// Tables 3.2 and 3.3 of the ES 3 spec.
+typedef std::pair&lt;GLenum, LoadImageFunction&gt; TypeLoadFunctionPair;
+typedef std::map&lt;GLenum, std::vector&lt;TypeLoadFunctionPair&gt; &gt; D3D11LoadFunctionMap;
+
+static void UnimplementedLoadFunction(size_t width, size_t height, size_t depth,
+                                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    UNIMPLEMENTED();
+}
+
+static void UnreachableLoadFunction(size_t width, size_t height, size_t depth,
+                                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    UNREACHABLE();
+}
+
+// A helper function to insert data into the D3D11LoadFunctionMap with fewer characters.
+static inline void InsertLoadFunction(D3D11LoadFunctionMap *map, GLenum internalFormat, GLenum type,
+                                      LoadImageFunction loadFunc)
+{
+    (*map)[internalFormat].push_back(TypeLoadFunctionPair(type, loadFunc));
+}
+
+D3D11LoadFunctionMap BuildD3D11_FL9_3_LoadFunctionMap()
+{
+    D3D11LoadFunctionMap map;
+
+    // From GL_EXT_texture_storage. Also used by GL_ALPHA8
+    // On feature level 9_3, A8_UNORM doesn't support mipmaps, so we must use RGBA8 instead
+    InsertLoadFunction(&amp;map, GL_ALPHA8_EXT, GL_UNSIGNED_BYTE, LoadA8ToRGBA8);
+    
+    return map;
+}
+
+D3D11LoadFunctionMap BuildD3D11_FL10_0Plus_LoadFunctionMap()
+{
+    D3D11LoadFunctionMap map;
+
+    // From GL_EXT_texture_storage. Also used by GL_ALPHA8
+    InsertLoadFunction(&amp;map, GL_ALPHA8_EXT, GL_UNSIGNED_BYTE, LoadToNative&lt;GLubyte, 1&gt;);
+
+    return map;
+}
+
+D3D11LoadFunctionMap BuildBaseD3D11LoadFunctionMap()
+{
+    D3D11LoadFunctionMap map;
+
+    //                      | Internal format      | Type                             | Load function                       |
+    InsertLoadFunction(&amp;map, GL_RGBA8,              GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;             );
+    InsertLoadFunction(&amp;map, GL_RGB5_A1,            GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;             );
+    InsertLoadFunction(&amp;map, GL_RGBA4,              GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;             );
+    InsertLoadFunction(&amp;map, GL_SRGB8_ALPHA8,       GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;             );
+    InsertLoadFunction(&amp;map, GL_RGBA8_SNORM,        GL_BYTE,                           LoadToNative&lt;GLbyte, 4&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGBA4,              GL_UNSIGNED_SHORT_4_4_4_4,         LoadRGBA4ToRGBA8                     );
+    InsertLoadFunction(&amp;map, GL_RGB10_A2,           GL_UNSIGNED_INT_2_10_10_10_REV,    LoadToNative&lt;GLuint, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGB5_A1,            GL_UNSIGNED_SHORT_5_5_5_1,         LoadRGB5A1ToRGBA8                    );
+    InsertLoadFunction(&amp;map, GL_RGB5_A1,            GL_UNSIGNED_INT_2_10_10_10_REV,    LoadRGB10A2ToRGBA8                   );
+    InsertLoadFunction(&amp;map, GL_RGBA16F,            GL_HALF_FLOAT,                     LoadToNative&lt;GLhalf, 4&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGBA16F,            GL_HALF_FLOAT_OES,                 LoadToNative&lt;GLhalf, 4&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGBA32F,            GL_FLOAT,                          LoadToNative&lt;GLfloat, 4&gt;             );
+    InsertLoadFunction(&amp;map, GL_RGBA16F,            GL_FLOAT,                          Load32FTo16F&lt;4&gt;                      );
+    InsertLoadFunction(&amp;map, GL_RGBA8UI,            GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;             );
+    InsertLoadFunction(&amp;map, GL_RGBA8I,             GL_BYTE,                           LoadToNative&lt;GLbyte, 4&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGBA16UI,           GL_UNSIGNED_SHORT,                 LoadToNative&lt;GLushort, 4&gt;            );
+    InsertLoadFunction(&amp;map, GL_RGBA16I,            GL_SHORT,                          LoadToNative&lt;GLshort, 4&gt;             );
+    InsertLoadFunction(&amp;map, GL_RGBA32UI,           GL_UNSIGNED_INT,                   LoadToNative&lt;GLuint, 4&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGBA32I,            GL_INT,                            LoadToNative&lt;GLint, 4&gt;               );
+    InsertLoadFunction(&amp;map, GL_RGB10_A2UI,         GL_UNSIGNED_INT_2_10_10_10_REV,    LoadToNative&lt;GLuint, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGB8,               GL_UNSIGNED_BYTE,                  LoadToNative3To4&lt;GLubyte, 0xFF&gt;      );
+    InsertLoadFunction(&amp;map, GL_RGB565,             GL_UNSIGNED_BYTE,                  LoadToNative3To4&lt;GLubyte, 0xFF&gt;      );
+    InsertLoadFunction(&amp;map, GL_SRGB8,              GL_UNSIGNED_BYTE,                  LoadToNative3To4&lt;GLubyte, 0xFF&gt;      );
+    InsertLoadFunction(&amp;map, GL_RGB8_SNORM,         GL_BYTE,                           LoadToNative3To4&lt;GLbyte, 0x7F&gt;       );
+    InsertLoadFunction(&amp;map, GL_RGB565,             GL_UNSIGNED_SHORT_5_6_5,           LoadR5G6B5ToRGBA8                    );
+    InsertLoadFunction(&amp;map, GL_R11F_G11F_B10F,     GL_UNSIGNED_INT_10F_11F_11F_REV,   LoadToNative&lt;GLuint, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGB9_E5,            GL_UNSIGNED_INT_5_9_9_9_REV,       LoadToNative&lt;GLuint, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_RGB16F,             GL_HALF_FLOAT,                     LoadToNative3To4&lt;GLhalf, gl::Float16One&gt;);
+    InsertLoadFunction(&amp;map, GL_RGB16F,             GL_HALF_FLOAT_OES,                 LoadToNative3To4&lt;GLhalf, gl::Float16One&gt;);
+    InsertLoadFunction(&amp;map, GL_R11F_G11F_B10F,     GL_HALF_FLOAT,                     LoadRGB16FToRG11B10F                 );
+    InsertLoadFunction(&amp;map, GL_R11F_G11F_B10F,     GL_HALF_FLOAT_OES,                 LoadRGB16FToRG11B10F                 );
+    InsertLoadFunction(&amp;map, GL_RGB9_E5,            GL_HALF_FLOAT,                     LoadRGB16FToRGB9E5                   );
+    InsertLoadFunction(&amp;map, GL_RGB9_E5,            GL_HALF_FLOAT_OES,                 LoadRGB16FToRGB9E5                   );
+    InsertLoadFunction(&amp;map, GL_RGB32F,             GL_FLOAT,                          LoadToNative3To4&lt;GLfloat, gl::Float32One&gt;);
+    InsertLoadFunction(&amp;map, GL_RGB16F,             GL_FLOAT,                          LoadRGB32FToRGBA16F                  );
+    InsertLoadFunction(&amp;map, GL_R11F_G11F_B10F,     GL_FLOAT,                          LoadRGB32FToRG11B10F                 );
+    InsertLoadFunction(&amp;map, GL_RGB9_E5,            GL_FLOAT,                          LoadRGB32FToRGB9E5                   );
+    InsertLoadFunction(&amp;map, GL_RGB8UI,             GL_UNSIGNED_BYTE,                  LoadToNative3To4&lt;GLubyte, 0x01&gt;      );
+    InsertLoadFunction(&amp;map, GL_RGB8I,              GL_BYTE,                           LoadToNative3To4&lt;GLbyte, 0x01&gt;       );
+    InsertLoadFunction(&amp;map, GL_RGB16UI,            GL_UNSIGNED_SHORT,                 LoadToNative3To4&lt;GLushort, 0x0001&gt;   );
+    InsertLoadFunction(&amp;map, GL_RGB16I,             GL_SHORT,                          LoadToNative3To4&lt;GLshort, 0x0001&gt;    );
+    InsertLoadFunction(&amp;map, GL_RGB32UI,            GL_UNSIGNED_INT,                   LoadToNative3To4&lt;GLuint, 0x00000001&gt; );
+    InsertLoadFunction(&amp;map, GL_RGB32I,             GL_INT,                            LoadToNative3To4&lt;GLint, 0x00000001&gt;  );
+    InsertLoadFunction(&amp;map, GL_RG8,                GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 2&gt;             );
+    InsertLoadFunction(&amp;map, GL_RG8_SNORM,          GL_BYTE,                           LoadToNative&lt;GLbyte, 2&gt;              );
+    InsertLoadFunction(&amp;map, GL_RG16F,              GL_HALF_FLOAT,                     LoadToNative&lt;GLhalf, 2&gt;              );
+    InsertLoadFunction(&amp;map, GL_RG16F,              GL_HALF_FLOAT_OES,                 LoadToNative&lt;GLhalf, 2&gt;              );
+    InsertLoadFunction(&amp;map, GL_RG32F,              GL_FLOAT,                          LoadToNative&lt;GLfloat, 2&gt;             );
+    InsertLoadFunction(&amp;map, GL_RG16F,              GL_FLOAT,                          Load32FTo16F&lt;2&gt;                      );
+    InsertLoadFunction(&amp;map, GL_RG8UI,              GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 2&gt;             );
+    InsertLoadFunction(&amp;map, GL_RG8I,               GL_BYTE,                           LoadToNative&lt;GLbyte, 2&gt;              );
+    InsertLoadFunction(&amp;map, GL_RG16UI,             GL_UNSIGNED_SHORT,                 LoadToNative&lt;GLushort, 2&gt;            );
+    InsertLoadFunction(&amp;map, GL_RG16I,              GL_SHORT,                          LoadToNative&lt;GLshort, 2&gt;             );
+    InsertLoadFunction(&amp;map, GL_RG32UI,             GL_UNSIGNED_INT,                   LoadToNative&lt;GLuint, 2&gt;              );
+    InsertLoadFunction(&amp;map, GL_RG32I,              GL_INT,                            LoadToNative&lt;GLint, 2&gt;               );
+    InsertLoadFunction(&amp;map, GL_R8,                 GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 1&gt;             );
+    InsertLoadFunction(&amp;map, GL_R8_SNORM,           GL_BYTE,                           LoadToNative&lt;GLbyte, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_R16F,               GL_HALF_FLOAT,                     LoadToNative&lt;GLhalf, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_R16F,               GL_HALF_FLOAT_OES,                 LoadToNative&lt;GLhalf, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_R32F,               GL_FLOAT,                          LoadToNative&lt;GLfloat, 1&gt;             );
+    InsertLoadFunction(&amp;map, GL_R16F,               GL_FLOAT,                          Load32FTo16F&lt;1&gt;                      );
+    InsertLoadFunction(&amp;map, GL_R8UI,               GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 1&gt;             );
+    InsertLoadFunction(&amp;map, GL_R8I,                GL_BYTE,                           LoadToNative&lt;GLbyte, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_R16UI,              GL_UNSIGNED_SHORT,                 LoadToNative&lt;GLushort, 1&gt;            );
+    InsertLoadFunction(&amp;map, GL_R16I,               GL_SHORT,                          LoadToNative&lt;GLshort, 1&gt;             );
+    InsertLoadFunction(&amp;map, GL_R32UI,              GL_UNSIGNED_INT,                   LoadToNative&lt;GLuint, 1&gt;              );
+    InsertLoadFunction(&amp;map, GL_R32I,               GL_INT,                            LoadToNative&lt;GLint, 1&gt;               );
+    InsertLoadFunction(&amp;map, GL_DEPTH_COMPONENT16,  GL_UNSIGNED_SHORT,                 LoadToNative&lt;GLushort, 1&gt;            );
+    InsertLoadFunction(&amp;map, GL_DEPTH_COMPONENT24,  GL_UNSIGNED_INT,                   LoadR32ToR24G8                       );
+    InsertLoadFunction(&amp;map, GL_DEPTH_COMPONENT16,  GL_UNSIGNED_INT,                   LoadR32ToR16                         );
+    InsertLoadFunction(&amp;map, GL_DEPTH_COMPONENT32F, GL_FLOAT,                          LoadToNative&lt;GLfloat, 1&gt;             );
+    InsertLoadFunction(&amp;map, GL_DEPTH24_STENCIL8,   GL_UNSIGNED_INT_24_8,              LoadR32ToR24G8                       );
+    InsertLoadFunction(&amp;map, GL_DEPTH32F_STENCIL8,  GL_FLOAT_32_UNSIGNED_INT_24_8_REV, LoadToNative&lt;GLuint, 2&gt;              );
+
+    // Unsized formats
+    // Load functions are unreachable because they are converted to sized internal formats based on
+    // the format and type before loading takes place.
+    InsertLoadFunction(&amp;map, GL_RGBA,               GL_UNSIGNED_BYTE,                  UnreachableLoadFunction              );
+    InsertLoadFunction(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_4_4_4_4,         UnreachableLoadFunction              );
+    InsertLoadFunction(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_5_5_5_1,         UnreachableLoadFunction              );
+    InsertLoadFunction(&amp;map, GL_RGB,                GL_UNSIGNED_BYTE,                  UnreachableLoadFunction              );
+    InsertLoadFunction(&amp;map, GL_RGB,                GL_UNSIGNED_SHORT_5_6_5,           UnreachableLoadFunction              );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE_ALPHA,    GL_UNSIGNED_BYTE,                  UnreachableLoadFunction              );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE,          GL_UNSIGNED_BYTE,                  UnreachableLoadFunction              );
+    InsertLoadFunction(&amp;map, GL_ALPHA,              GL_UNSIGNED_BYTE,                  UnreachableLoadFunction              );
+
+    // From GL_OES_texture_float
+    InsertLoadFunction(&amp;map, GL_LUMINANCE_ALPHA,    GL_FLOAT,                          LoadLA32FToRGBA32F                   );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE,          GL_FLOAT,                          LoadL32FToRGBA32F                    );
+    InsertLoadFunction(&amp;map, GL_ALPHA,              GL_FLOAT,                          LoadA32FToRGBA32F                    );
+
+    // From GL_OES_texture_half_float
+    InsertLoadFunction(&amp;map, GL_LUMINANCE_ALPHA,    GL_HALF_FLOAT,                     LoadLA16FToRGBA16F                   );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE_ALPHA,    GL_HALF_FLOAT_OES,                 LoadLA16FToRGBA16F                   );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE,          GL_HALF_FLOAT,                     LoadL16FToRGBA16F                    );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE,          GL_HALF_FLOAT_OES,                 LoadL16FToRGBA16F                    );
+    InsertLoadFunction(&amp;map, GL_ALPHA,              GL_HALF_FLOAT,                     LoadA16FToRGBA16F                    );
+    InsertLoadFunction(&amp;map, GL_ALPHA,              GL_HALF_FLOAT_OES,                 LoadA16FToRGBA16F                    );
+
+    // From GL_EXT_texture_storage
+    // GL_ALPHA8_EXT GL_UNSIGNED_BYTE is in the feature-level-specific load function maps, due to differences between 9_3 and 10_0+
+    InsertLoadFunction(&amp;map, GL_LUMINANCE8_EXT,         GL_UNSIGNED_BYTE,              LoadL8ToRGBA8                        );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE8_ALPHA8_EXT,  GL_UNSIGNED_BYTE,              LoadLA8ToRGBA8                       );
+    InsertLoadFunction(&amp;map, GL_ALPHA32F_EXT,           GL_FLOAT,                      LoadA32FToRGBA32F                    );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE32F_EXT,       GL_FLOAT,                      LoadL32FToRGBA32F                    );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE_ALPHA32F_EXT, GL_FLOAT,                      LoadLA32FToRGBA32F                   );
+    InsertLoadFunction(&amp;map, GL_ALPHA16F_EXT,           GL_HALF_FLOAT,                 LoadA16FToRGBA16F                    );
+    InsertLoadFunction(&amp;map, GL_ALPHA16F_EXT,           GL_HALF_FLOAT_OES,             LoadA16FToRGBA16F                    );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE16F_EXT,       GL_HALF_FLOAT,                 LoadL16FToRGBA16F                    );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE16F_EXT,       GL_HALF_FLOAT_OES,             LoadL16FToRGBA16F                    );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE_ALPHA16F_EXT, GL_HALF_FLOAT,                 LoadLA16FToRGBA16F                   );
+    InsertLoadFunction(&amp;map, GL_LUMINANCE_ALPHA16F_EXT, GL_HALF_FLOAT_OES,             LoadLA16FToRGBA16F                   );
+
+    // From GL_ANGLE_depth_texture
+    InsertLoadFunction(&amp;map, GL_DEPTH_COMPONENT32_OES,  GL_UNSIGNED_INT,               LoadR32ToR24G8                       );
+
+    // From GL_EXT_texture_format_BGRA8888
+    InsertLoadFunction(&amp;map, GL_BGRA8_EXT,              GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;         );
+    InsertLoadFunction(&amp;map, GL_BGRA4_ANGLEX,           GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, LoadRGBA4ToRGBA8                 );
+    InsertLoadFunction(&amp;map, GL_BGRA4_ANGLEX,           GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;         );
+    InsertLoadFunction(&amp;map, GL_BGR5_A1_ANGLEX,         GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, LoadRGB5A1ToRGBA8                );
+    InsertLoadFunction(&amp;map, GL_BGR5_A1_ANGLEX,         GL_UNSIGNED_BYTE,                  LoadToNative&lt;GLubyte, 4&gt;         );
+
+    // Compressed formats
+    // From ES 3.0.1 spec, table 3.16
+    //                      | Internal format                             | Type            | Load function                  |
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_SIGNED_R11_EAC,                 GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RG11_EAC,                       GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_SIGNED_RG11_EAC,                GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RGB8_ETC2,                      GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_SRGB8_ETC2,                     GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RGBA8_ETC2_EAC,                 GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          GL_UNSIGNED_BYTE, UnimplementedLoadFunction       );
+
+    // From GL_EXT_texture_compression_dxt1
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,              GL_UNSIGNED_BYTE, LoadCompressedToNative&lt;4, 4,  8&gt;);
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,             GL_UNSIGNED_BYTE, LoadCompressedToNative&lt;4, 4,  8&gt;);
+
+    // From GL_ANGLE_texture_compression_dxt3
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,           GL_UNSIGNED_BYTE, LoadCompressedToNative&lt;4, 4, 16&gt;);
+
+    // From GL_ANGLE_texture_compression_dxt5
+    InsertLoadFunction(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,           GL_UNSIGNED_BYTE, LoadCompressedToNative&lt;4, 4, 16&gt;);
+
+    return map;
+}
+
+// For sized GL internal formats, there is only one corresponding D3D11 format. This map type allows
+// querying for the DXGI texture formats to use for textures, SRVs, RTVs and DSVs given a GL internal
+// format.
+typedef std::map&lt;GLenum, TextureFormat&gt; D3D11ES3FormatMap;
+
+TextureFormat::TextureFormat()
+    : texFormat(DXGI_FORMAT_UNKNOWN),
+      srvFormat(DXGI_FORMAT_UNKNOWN),
+      rtvFormat(DXGI_FORMAT_UNKNOWN),
+      dsvFormat(DXGI_FORMAT_UNKNOWN),
+      renderFormat(DXGI_FORMAT_UNKNOWN),
+      swizzleTexFormat(DXGI_FORMAT_UNKNOWN),
+      swizzleSRVFormat(DXGI_FORMAT_UNKNOWN),
+      swizzleRTVFormat(DXGI_FORMAT_UNKNOWN),
+      dataInitializerFunction(NULL),
+      loadFunctions()
+{
+}
+
+static inline void InsertD3D11FormatInfoBase(D3D11ES3FormatMap *formatMap, const D3D11LoadFunctionMap &amp;flLoadFunctions, GLenum internalFormat, DXGI_FORMAT texFormat,
+                                             DXGI_FORMAT srvFormat, DXGI_FORMAT rtvFormat, DXGI_FORMAT dsvFormat)
+{
+    TextureFormat info;
+    info.texFormat = texFormat;
+    info.srvFormat = srvFormat;
+    info.rtvFormat = rtvFormat;
+    info.dsvFormat = dsvFormat;
+
+    // Given a GL internal format, the renderFormat is the DSV format if it is depth- or stencil-renderable,
+    // the RTV format if it is color-renderable, and the (nonrenderable) texture format otherwise.
+    if (dsvFormat != DXGI_FORMAT_UNKNOWN)
+    {
+        info.renderFormat = dsvFormat;
+    }
+    else if (rtvFormat != DXGI_FORMAT_UNKNOWN)
+    {
+        info.renderFormat = rtvFormat;
+    }
+    else if (texFormat != DXGI_FORMAT_UNKNOWN)
+    {
+        info.renderFormat = texFormat;
+    }
+    else
+    {
+        info.renderFormat = DXGI_FORMAT_UNKNOWN;
+    }
+
+    // Compute the swizzle formats
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalFormat);
+    if (internalFormat != GL_NONE &amp;&amp; formatInfo.pixelBytes &gt; 0)
+    {
+        if (formatInfo.componentCount != 4 || texFormat == DXGI_FORMAT_UNKNOWN ||
+            srvFormat == DXGI_FORMAT_UNKNOWN || rtvFormat == DXGI_FORMAT_UNKNOWN)
+        {
+            // Get the maximum sized component
+            unsigned int maxBits = 1;
+            if (formatInfo.compressed)
+            {
+                unsigned int compressedBitsPerBlock = formatInfo.pixelBytes * 8;
+                unsigned int blockSize = formatInfo.compressedBlockWidth * formatInfo.compressedBlockHeight;
+                maxBits = std::max(compressedBitsPerBlock / blockSize, maxBits);
+            }
+            else
+            {
+                maxBits = std::max(maxBits, formatInfo.alphaBits);
+                maxBits = std::max(maxBits, formatInfo.redBits);
+                maxBits = std::max(maxBits, formatInfo.greenBits);
+                maxBits = std::max(maxBits, formatInfo.blueBits);
+                maxBits = std::max(maxBits, formatInfo.luminanceBits);
+                maxBits = std::max(maxBits, formatInfo.depthBits);
+            }
+
+            maxBits = roundUp(maxBits, 8U);
+
+            static const SwizzleInfoMap swizzleMap = BuildSwizzleInfoMap();
+            SwizzleInfoMap::const_iterator swizzleIter = swizzleMap.find(SwizzleSizeType(maxBits, formatInfo.componentType));
+            ASSERT(swizzleIter != swizzleMap.end());
+
+            const SwizzleFormatInfo &amp;swizzleInfo = swizzleIter-&gt;second;
+            info.swizzleTexFormat = swizzleInfo.mTexFormat;
+            info.swizzleSRVFormat = swizzleInfo.mSRVFormat;
+            info.swizzleRTVFormat = swizzleInfo.mRTVFormat;
+        }
+        else
+        {
+            // The original texture format is suitable for swizzle operations
+            info.swizzleTexFormat = texFormat;
+            info.swizzleSRVFormat = srvFormat;
+            info.swizzleRTVFormat = rtvFormat;
+        }
+    }
+    else
+    {
+        // Not possible to swizzle with this texture format since it is either unsized or GL_NONE
+        info.swizzleTexFormat = DXGI_FORMAT_UNKNOWN;
+        info.swizzleSRVFormat = DXGI_FORMAT_UNKNOWN;
+        info.swizzleRTVFormat = DXGI_FORMAT_UNKNOWN;
+    }
+
+    // Check if there is an initialization function for this texture format
+    static const InternalFormatInitializerMap initializerMap = BuildInternalFormatInitializerMap();
+    InternalFormatInitializerMap::const_iterator initializerIter = initializerMap.find(internalFormat);
+    info.dataInitializerFunction = (initializerIter != initializerMap.end()) ? initializerIter-&gt;second : NULL;
+
+    // Gather all the load functions for this internal format from the base list
+    static const D3D11LoadFunctionMap loadFunctions = BuildBaseD3D11LoadFunctionMap();
+    D3D11LoadFunctionMap::const_iterator loadFunctionIter = loadFunctions.find(internalFormat);
+    if (loadFunctionIter != loadFunctions.end())
+    {
+        const std::vector&lt;TypeLoadFunctionPair&gt; &amp;loadFunctionVector = loadFunctionIter-&gt;second;
+        for (size_t i = 0; i &lt; loadFunctionVector.size(); i++)
+        {
+            GLenum type = loadFunctionVector[i].first;
+            LoadImageFunction function = loadFunctionVector[i].second;
+            info.loadFunctions.insert(std::make_pair(type, function));
+        }
+    }
+
+    // Gather load functions for this internal format from the feature-level-specific list
+    D3D11LoadFunctionMap::const_iterator flLoadFunctionIter = flLoadFunctions.find(internalFormat);
+    if (flLoadFunctionIter != flLoadFunctions.end())
+    {
+        const std::vector&lt;TypeLoadFunctionPair&gt; &amp;flLoadFunctionVector = flLoadFunctionIter-&gt;second;
+        for (size_t i = 0; i &lt; flLoadFunctionVector.size(); i++)
+        {
+            GLenum type = flLoadFunctionVector[i].first;
+            LoadImageFunction function = flLoadFunctionVector[i].second;
+            info.loadFunctions.insert(std::make_pair(type, function));
+        }
+    }
+
+    formatMap-&gt;insert(std::make_pair(internalFormat, info));
+}
+
+static inline void InsertD3D11_FL9_3_FormatInfo(D3D11ES3FormatMap *map, GLenum internalFormat, DXGI_FORMAT texFormat,
+                                                DXGI_FORMAT srvFormat, DXGI_FORMAT rtvFormat, DXGI_FORMAT dsvFormat)
+{
+    static const D3D11LoadFunctionMap flLoadFunctions = BuildD3D11_FL9_3_LoadFunctionMap();
+    InsertD3D11FormatInfoBase(map, flLoadFunctions, internalFormat, texFormat, srvFormat, rtvFormat, dsvFormat);
+}
+
+static inline void InsertD3D11FormatInfo(D3D11ES3FormatMap *map, GLenum internalFormat, DXGI_FORMAT texFormat,
+                                         DXGI_FORMAT srvFormat, DXGI_FORMAT rtvFormat, DXGI_FORMAT dsvFormat)
+{
+    static const D3D11LoadFunctionMap flLoadFunctions = BuildD3D11_FL10_0Plus_LoadFunctionMap();
+    InsertD3D11FormatInfoBase(map, flLoadFunctions, internalFormat, texFormat, srvFormat, rtvFormat, dsvFormat);
+}
+
+static D3D11ES3FormatMap BuildD3D11_FL9_3FormatOverrideMap()
+{
+    // D3D11 Feature Level 9_3 doesn't support as many texture formats as Feature Level 10_0+.
+    // In particular, it doesn't support:
+    //      - mipmaps on DXGI_FORMAT_A8_NORM
+    //      - *_TYPELESS formats
+    //      - DXGI_FORMAT_D32_FLOAT_S8X24_UINT or DXGI_FORMAT_D32_FLOAT
+
+    D3D11ES3FormatMap map;
+
+    //                                | GL internal format   | D3D11 texture format            | D3D11 SRV format           | D3D11 RTV format            | D3D11 DSV format
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_ALPHA,              DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,  DXGI_FORMAT_R8G8B8A8_UNORM,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_ALPHA8_EXT,         DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,  DXGI_FORMAT_R8G8B8A8_UNORM,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_DEPTH_COMPONENT16,  DXGI_FORMAT_D16_UNORM,            DXGI_FORMAT_UNKNOWN,         DXGI_FORMAT_UNKNOWN,          DXGI_FORMAT_D16_UNORM);
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_DEPTH_COMPONENT24,  DXGI_FORMAT_D24_UNORM_S8_UINT,    DXGI_FORMAT_UNKNOWN,         DXGI_FORMAT_UNKNOWN,          DXGI_FORMAT_D24_UNORM_S8_UINT);
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_DEPTH_COMPONENT32F, DXGI_FORMAT_UNKNOWN,              DXGI_FORMAT_UNKNOWN,         DXGI_FORMAT_UNKNOWN,          DXGI_FORMAT_UNKNOWN);
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_DEPTH24_STENCIL8,   DXGI_FORMAT_D24_UNORM_S8_UINT,    DXGI_FORMAT_UNKNOWN,         DXGI_FORMAT_UNKNOWN,          DXGI_FORMAT_D24_UNORM_S8_UINT);
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_DEPTH32F_STENCIL8,  DXGI_FORMAT_UNKNOWN,              DXGI_FORMAT_UNKNOWN,         DXGI_FORMAT_UNKNOWN,          DXGI_FORMAT_UNKNOWN);
+    InsertD3D11_FL9_3_FormatInfo(&amp;map, GL_STENCIL_INDEX8,     DXGI_FORMAT_D24_UNORM_S8_UINT,    DXGI_FORMAT_UNKNOWN,         DXGI_FORMAT_UNKNOWN,          DXGI_FORMAT_D24_UNORM_S8_UINT);
+
+    return map;
+}
+
+static D3D11ES3FormatMap BuildD3D11FormatMap()
+{
+    D3D11ES3FormatMap map;
+
+    //                         | GL internal format  | D3D11 texture format            | D3D11 SRV format               | D3D11 RTV format               | D3D11 DSV format   |
+    InsertD3D11FormatInfo(&amp;map, GL_NONE,              DXGI_FORMAT_UNKNOWN,              DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R8,                DXGI_FORMAT_R8_UNORM,             DXGI_FORMAT_R8_UNORM,            DXGI_FORMAT_R8_UNORM,            DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R8_SNORM,          DXGI_FORMAT_R8_SNORM,             DXGI_FORMAT_R8_SNORM,            DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG8,               DXGI_FORMAT_R8G8_UNORM,           DXGI_FORMAT_R8G8_UNORM,          DXGI_FORMAT_R8G8_UNORM,          DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG8_SNORM,         DXGI_FORMAT_R8G8_SNORM,           DXGI_FORMAT_R8G8_SNORM,          DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB8,              DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB8_SNORM,        DXGI_FORMAT_R8G8B8A8_SNORM,       DXGI_FORMAT_R8G8B8A8_SNORM,      DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB565,            DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA4,             DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB5_A1,           DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA8,             DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA8_SNORM,       DXGI_FORMAT_R8G8B8A8_SNORM,       DXGI_FORMAT_R8G8B8A8_SNORM,      DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB10_A2,          DXGI_FORMAT_R10G10B10A2_UNORM,    DXGI_FORMAT_R10G10B10A2_UNORM,   DXGI_FORMAT_R10G10B10A2_UNORM,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB10_A2UI,        DXGI_FORMAT_R10G10B10A2_UINT,     DXGI_FORMAT_R10G10B10A2_UINT,    DXGI_FORMAT_R10G10B10A2_UINT,    DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_SRGB8,             DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,  DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_SRGB8_ALPHA8,      DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,  DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R16F,              DXGI_FORMAT_R16_FLOAT,            DXGI_FORMAT_R16_FLOAT,           DXGI_FORMAT_R16_FLOAT,           DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG16F,             DXGI_FORMAT_R16G16_FLOAT,         DXGI_FORMAT_R16G16_FLOAT,        DXGI_FORMAT_R16G16_FLOAT,        DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB16F,            DXGI_FORMAT_R16G16B16A16_FLOAT,   DXGI_FORMAT_R16G16B16A16_FLOAT,  DXGI_FORMAT_R16G16B16A16_FLOAT,  DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA16F,           DXGI_FORMAT_R16G16B16A16_FLOAT,   DXGI_FORMAT_R16G16B16A16_FLOAT,  DXGI_FORMAT_R16G16B16A16_FLOAT,  DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R32F,              DXGI_FORMAT_R32_FLOAT,            DXGI_FORMAT_R32_FLOAT,           DXGI_FORMAT_R32_FLOAT,           DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG32F,             DXGI_FORMAT_R32G32_FLOAT,         DXGI_FORMAT_R32G32_FLOAT,        DXGI_FORMAT_R32G32_FLOAT,        DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB32F,            DXGI_FORMAT_R32G32B32A32_FLOAT,   DXGI_FORMAT_R32G32B32A32_FLOAT,  DXGI_FORMAT_R32G32B32A32_FLOAT,  DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA32F,           DXGI_FORMAT_R32G32B32A32_FLOAT,   DXGI_FORMAT_R32G32B32A32_FLOAT,  DXGI_FORMAT_R32G32B32A32_FLOAT,  DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R11F_G11F_B10F,    DXGI_FORMAT_R11G11B10_FLOAT,      DXGI_FORMAT_R11G11B10_FLOAT,     DXGI_FORMAT_R11G11B10_FLOAT,     DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB9_E5,           DXGI_FORMAT_R9G9B9E5_SHAREDEXP,   DXGI_FORMAT_R9G9B9E5_SHAREDEXP,  DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R8I,               DXGI_FORMAT_R8_SINT,              DXGI_FORMAT_R8_SINT,             DXGI_FORMAT_R8_SINT,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R8UI,              DXGI_FORMAT_R8_UINT,              DXGI_FORMAT_R8_UINT,             DXGI_FORMAT_R8_UINT,             DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R16I,              DXGI_FORMAT_R16_SINT,             DXGI_FORMAT_R16_SINT,            DXGI_FORMAT_R16_SINT,            DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R16UI,             DXGI_FORMAT_R16_UINT,             DXGI_FORMAT_R16_UINT,            DXGI_FORMAT_R16_UINT,            DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R32I,              DXGI_FORMAT_R32_SINT,             DXGI_FORMAT_R32_SINT,            DXGI_FORMAT_R32_SINT,            DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_R32UI,             DXGI_FORMAT_R32_UINT,             DXGI_FORMAT_R32_UINT,            DXGI_FORMAT_R32_UINT,            DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG8I,              DXGI_FORMAT_R8G8_SINT,            DXGI_FORMAT_R8G8_SINT,           DXGI_FORMAT_R8G8_SINT,           DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG8UI,             DXGI_FORMAT_R8G8_UINT,            DXGI_FORMAT_R8G8_UINT,           DXGI_FORMAT_R8G8_UINT,           DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG16I,             DXGI_FORMAT_R16G16_SINT,          DXGI_FORMAT_R16G16_SINT,         DXGI_FORMAT_R16G16_SINT,         DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG16UI,            DXGI_FORMAT_R16G16_UINT,          DXGI_FORMAT_R16G16_UINT,         DXGI_FORMAT_R16G16_UINT,         DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG32I,             DXGI_FORMAT_R32G32_SINT,          DXGI_FORMAT_R32G32_SINT,         DXGI_FORMAT_R32G32_SINT,         DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RG32UI,            DXGI_FORMAT_R32G32_UINT,          DXGI_FORMAT_R32G32_UINT,         DXGI_FORMAT_R32G32_UINT,         DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB8I,             DXGI_FORMAT_R8G8B8A8_SINT,        DXGI_FORMAT_R8G8B8A8_SINT,       DXGI_FORMAT_R8G8B8A8_SINT,       DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB8UI,            DXGI_FORMAT_R8G8B8A8_UINT,        DXGI_FORMAT_R8G8B8A8_UINT,       DXGI_FORMAT_R8G8B8A8_UINT,       DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB16I,            DXGI_FORMAT_R16G16B16A16_SINT,    DXGI_FORMAT_R16G16B16A16_SINT,   DXGI_FORMAT_R16G16B16A16_SINT,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB16UI,           DXGI_FORMAT_R16G16B16A16_UINT,    DXGI_FORMAT_R16G16B16A16_UINT,   DXGI_FORMAT_R16G16B16A16_UINT,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB32I,            DXGI_FORMAT_R32G32B32A32_SINT,    DXGI_FORMAT_R32G32B32A32_SINT,   DXGI_FORMAT_R32G32B32A32_SINT,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB32UI,           DXGI_FORMAT_R32G32B32A32_UINT,    DXGI_FORMAT_R32G32B32A32_UINT,   DXGI_FORMAT_R32G32B32A32_UINT,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA8I,            DXGI_FORMAT_R8G8B8A8_SINT,        DXGI_FORMAT_R8G8B8A8_SINT,       DXGI_FORMAT_R8G8B8A8_SINT,       DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA8UI,           DXGI_FORMAT_R8G8B8A8_UINT,        DXGI_FORMAT_R8G8B8A8_UINT,       DXGI_FORMAT_R8G8B8A8_UINT,       DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA16I,           DXGI_FORMAT_R16G16B16A16_SINT,    DXGI_FORMAT_R16G16B16A16_SINT,   DXGI_FORMAT_R16G16B16A16_SINT,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA16UI,          DXGI_FORMAT_R16G16B16A16_UINT,    DXGI_FORMAT_R16G16B16A16_UINT,   DXGI_FORMAT_R16G16B16A16_UINT,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA32I,           DXGI_FORMAT_R32G32B32A32_SINT,    DXGI_FORMAT_R32G32B32A32_SINT,   DXGI_FORMAT_R32G32B32A32_SINT,   DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA32UI,          DXGI_FORMAT_R32G32B32A32_UINT,    DXGI_FORMAT_R32G32B32A32_UINT,   DXGI_FORMAT_R32G32B32A32_UINT,   DXGI_FORMAT_UNKNOWN);
+
+    // Unsized formats, TODO: Are types of float and half float allowed for the unsized types? Would it change the DXGI format?
+    InsertD3D11FormatInfo(&amp;map, GL_ALPHA,             DXGI_FORMAT_A8_UNORM,             DXGI_FORMAT_A8_UNORM,            DXGI_FORMAT_A8_UNORM,            DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE,         DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE_ALPHA,   DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGB,               DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_RGBA,              DXGI_FORMAT_R8G8B8A8_UNORM,       DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_R8G8B8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_BGRA_EXT,          DXGI_FORMAT_B8G8R8A8_UNORM,       DXGI_FORMAT_B8G8R8A8_UNORM,      DXGI_FORMAT_B8G8R8A8_UNORM,      DXGI_FORMAT_UNKNOWN);
+
+    // From GL_EXT_texture_storage
+    //                           | GL internal format     | D3D11 texture format          | D3D11 SRV format                    | D3D11 RTV format              | D3D11 DSV format               |
+    InsertD3D11FormatInfo(&amp;map, GL_ALPHA8_EXT,             DXGI_FORMAT_A8_UNORM,           DXGI_FORMAT_A8_UNORM,                 DXGI_FORMAT_A8_UNORM,           DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE8_EXT,         DXGI_FORMAT_R8G8B8A8_UNORM,     DXGI_FORMAT_R8G8B8A8_UNORM,           DXGI_FORMAT_R8G8B8A8_UNORM,     DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_ALPHA32F_EXT,           DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT,       DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE32F_EXT,       DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT,       DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_ALPHA16F_EXT,           DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT,       DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE16F_EXT,       DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT,       DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE8_ALPHA8_EXT,  DXGI_FORMAT_R8G8B8A8_UNORM,     DXGI_FORMAT_R8G8B8A8_UNORM,           DXGI_FORMAT_R8G8B8A8_UNORM,     DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE_ALPHA32F_EXT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT,       DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_LUMINANCE_ALPHA16F_EXT, DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT,       DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_BGRA8_EXT,              DXGI_FORMAT_B8G8R8A8_UNORM,     DXGI_FORMAT_B8G8R8A8_UNORM,           DXGI_FORMAT_B8G8R8A8_UNORM,     DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_BGRA4_ANGLEX,           DXGI_FORMAT_B8G8R8A8_UNORM,     DXGI_FORMAT_B8G8R8A8_UNORM,           DXGI_FORMAT_B8G8R8A8_UNORM,     DXGI_FORMAT_UNKNOWN           );
+    InsertD3D11FormatInfo(&amp;map, GL_BGR5_A1_ANGLEX,         DXGI_FORMAT_B8G8R8A8_UNORM,     DXGI_FORMAT_B8G8R8A8_UNORM,           DXGI_FORMAT_B8G8R8A8_UNORM,     DXGI_FORMAT_UNKNOWN           );
+
+    // Depth stencil formats
+    InsertD3D11FormatInfo(&amp;map, GL_DEPTH_COMPONENT16,     DXGI_FORMAT_R16_TYPELESS,        DXGI_FORMAT_R16_UNORM,                DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_D16_UNORM         );
+    InsertD3D11FormatInfo(&amp;map, GL_DEPTH_COMPONENT24,     DXGI_FORMAT_R24G8_TYPELESS,      DXGI_FORMAT_R24_UNORM_X8_TYPELESS,    DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_D24_UNORM_S8_UINT );
+    InsertD3D11FormatInfo(&amp;map, GL_DEPTH_COMPONENT32F,    DXGI_FORMAT_R32_TYPELESS,        DXGI_FORMAT_R32_FLOAT,                DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_D32_FLOAT         );
+    InsertD3D11FormatInfo(&amp;map, GL_DEPTH24_STENCIL8,      DXGI_FORMAT_R24G8_TYPELESS,      DXGI_FORMAT_R24_UNORM_X8_TYPELESS,    DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_D24_UNORM_S8_UINT );
+    InsertD3D11FormatInfo(&amp;map, GL_DEPTH32F_STENCIL8,     DXGI_FORMAT_R32G8X24_TYPELESS,   DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_D32_FLOAT_S8X24_UINT);
+    InsertD3D11FormatInfo(&amp;map, GL_STENCIL_INDEX8,        DXGI_FORMAT_R24G8_TYPELESS,      DXGI_FORMAT_X24_TYPELESS_G8_UINT,     DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_D24_UNORM_S8_UINT );
+
+    // From GL_ANGLE_depth_texture
+    // Since D3D11 doesn't have a D32_UNORM format, use D24S8 which has comparable precision and matches the ES3 format.
+    InsertD3D11FormatInfo(&amp;map, GL_DEPTH_COMPONENT32_OES, DXGI_FORMAT_R24G8_TYPELESS,      DXGI_FORMAT_R24_UNORM_X8_TYPELESS,    DXGI_FORMAT_UNKNOWN,             DXGI_FORMAT_D24_UNORM_S8_UINT);
+
+    // Compressed formats, From ES 3.0.1 spec, table 3.16
+    //                           | GL internal format                        | D3D11 texture format | D3D11 SRV format     | D3D11 RTV format   | D3D11 DSV format  |
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_R11_EAC,                        DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_SIGNED_R11_EAC,                 DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RG11_EAC,                       DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_SIGNED_RG11_EAC,                DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RGB8_ETC2,                      DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_SRGB8_ETC2,                     DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RGBA8_ETC2_EAC,                 DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN,   DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+
+    // From GL_EXT_texture_compression_dxt1
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,              DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,             DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+
+    // From GL_ANGLE_texture_compression_dxt3
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,           DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+
+    // From GL_ANGLE_texture_compression_dxt5
+    InsertD3D11FormatInfo(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,           DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_BC3_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN);
+
+    return map;
+}
+
+const TextureFormat &amp;GetTextureFormatInfo(GLenum internalFormat, D3D_FEATURE_LEVEL featureLevel)
+{
+    static const D3D11ES3FormatMap formatMap = BuildD3D11FormatMap();
+    static const D3D11ES3FormatMap formatMapFL9_3Override = BuildD3D11_FL9_3FormatOverrideMap();
+
+    if (featureLevel == D3D_FEATURE_LEVEL_9_3)
+    {
+        // First see if the internalFormat has a special map for FL9_3
+        D3D11ES3FormatMap::const_iterator fl9_3Iter = formatMapFL9_3Override.find(internalFormat);
+        if (fl9_3Iter != formatMapFL9_3Override.end())
+        {
+            return fl9_3Iter-&gt;second;
+        }
+    }
+
+    D3D11ES3FormatMap::const_iterator iter = formatMap.find(internalFormat);
+    if (iter != formatMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        static const TextureFormat defaultInfo;
+        return defaultInfo;
+    }
+}
+
+typedef std::map&lt;gl::VertexFormat, VertexFormat&gt; D3D11VertexFormatInfoMap;
+typedef std::pair&lt;gl::VertexFormat, VertexFormat&gt; D3D11VertexFormatPair;
+
+VertexFormat::VertexFormat()
+    : conversionType(VERTEX_CONVERT_NONE),
+      nativeFormat(DXGI_FORMAT_UNKNOWN),
+      copyFunction(NULL)
+{
+}
+
+static void AddVertexFormatInfo(D3D11VertexFormatInfoMap *map, GLenum inputType, GLboolean normalized, GLuint componentCount,
+                                VertexConversionType conversionType, DXGI_FORMAT nativeFormat, VertexCopyFunction copyFunction)
+{
+    gl::VertexFormat inputFormat(inputType, normalized, componentCount, false);
+
+    VertexFormat info;
+    info.conversionType = conversionType;
+    info.nativeFormat = nativeFormat;
+    info.copyFunction = copyFunction;
+
+    map-&gt;insert(D3D11VertexFormatPair(inputFormat, info));
+}
+
+static void AddIntegerVertexFormatInfo(D3D11VertexFormatInfoMap *map, GLenum inputType, GLuint componentCount,
+                                       VertexConversionType conversionType, DXGI_FORMAT nativeFormat, VertexCopyFunction copyFunction)
+{
+    gl::VertexFormat inputFormat(inputType, GL_FALSE, componentCount, true);
+
+    VertexFormat info;
+    info.conversionType = conversionType;
+    info.nativeFormat = nativeFormat;
+    info.copyFunction = copyFunction;
+
+    map-&gt;insert(D3D11VertexFormatPair(inputFormat, info));
+}
+
+static D3D11VertexFormatInfoMap BuildD3D11_FL9_3VertexFormatInfoOverrideMap()
+{
+    // D3D11 Feature Level 9_3 doesn't support as many formats for vertex buffer resource as Feature Level 10_0+.
+    // http://msdn.microsoft.com/en-us/library/windows/desktop/ff471324(v=vs.85).aspx
+
+    D3D11VertexFormatInfoMap map;
+
+    // GL_BYTE -- unnormalized
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE,  1,  VERTEX_CONVERT_BOTH,    DXGI_FORMAT_R16G16_SINT,         &amp;Copy8SintTo16SintVertexData&lt;1, 2&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE,  2,  VERTEX_CONVERT_BOTH,    DXGI_FORMAT_R16G16_SINT,         &amp;Copy8SintTo16SintVertexData&lt;2, 2&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE,  3,  VERTEX_CONVERT_BOTH,    DXGI_FORMAT_R16G16B16A16_SINT,   &amp;Copy8SintTo16SintVertexData&lt;3, 4&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE,  4,  VERTEX_CONVERT_BOTH,    DXGI_FORMAT_R16G16B16A16_SINT,   &amp;Copy8SintTo16SintVertexData&lt;4, 4&gt;);
+
+    // GL_BYTE -- normalized
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,   1,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R16G16_SNORM,        &amp;Copy8SnormTo16SnormVertexData&lt;1, 2&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,   2,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R16G16_SNORM,        &amp;Copy8SnormTo16SnormVertexData&lt;2, 2&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,   3,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R16G16B16A16_SNORM,  &amp;Copy8SnormTo16SnormVertexData&lt;3, 4&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,   4,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R16G16B16A16_SNORM,  &amp;Copy8SnormTo16SnormVertexData&lt;4, 4&gt;);
+
+    // GL_UNSIGNED_BYTE -- unnormalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_FALSE,  1,  VERTEX_CONVERT_BOTH,    DXGI_FORMAT_R8G8B8A8_UINT,       &amp;CopyNativeVertexData&lt;GLubyte, 1, 4, 1&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_FALSE,  2,  VERTEX_CONVERT_BOTH,    DXGI_FORMAT_R8G8B8A8_UINT,       &amp;CopyNativeVertexData&lt;GLubyte, 2, 4, 1&gt;);
+    // NOTE: 3 and 4 component unnormalized GL_UNSIGNED_BYTE should use the default format table.
+
+    // GL_UNSIGNED_BYTE -- normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_TRUE,   1,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R8G8B8A8_UNORM,      &amp;CopyNativeVertexData&lt;GLubyte, 1, 4, UINT8_MAX&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_TRUE,   2,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R8G8B8A8_UNORM,      &amp;CopyNativeVertexData&lt;GLubyte, 2, 4, UINT8_MAX&gt;);
+    // NOTE: 3 and 4 component normalized GL_UNSIGNED_BYTE should use the default format table.
+
+    // GL_SHORT -- unnormalized
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_FALSE,  1,  VERTEX_CONVERT_BOTH,     DXGI_FORMAT_R16G16_SINT,        &amp;CopyNativeVertexData&lt;GLshort, 1, 2, 0&gt;);
+    // NOTE: 2, 3 and 4 component unnormalized GL_SHORT should use the default format table.
+
+    // GL_SHORT -- normalized
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_TRUE,   1,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R16G16_SNORM,        &amp;CopyNativeVertexData&lt;GLshort, 1, 2, 0&gt;);
+    // NOTE: 2, 3 and 4 component normalized GL_SHORT should use the default format table.
+
+    // GL_UNSIGNED_SHORT -- unnormalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE,  1,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32_FLOAT,        &amp;CopyTo32FVertexData&lt;GLushort, 1, 2, false&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE,  2,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32_FLOAT,        &amp;CopyTo32FVertexData&lt;GLushort, 2, 2, false&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE,  3,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32B32_FLOAT,     &amp;CopyTo32FVertexData&lt;GLushort, 3, 3, false&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE,  4,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32B32A32_FLOAT,  &amp;CopyTo32FVertexData&lt;GLushort, 4, 4, false&gt;);
+
+    // GL_UNSIGNED_SHORT -- normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,   1,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32_FLOAT,        &amp;CopyTo32FVertexData&lt;GLushort, 1, 2, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,   2,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32_FLOAT,        &amp;CopyTo32FVertexData&lt;GLushort, 2, 2, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,   3,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32B32_FLOAT,     &amp;CopyTo32FVertexData&lt;GLushort, 3, 3, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,   4,  VERTEX_CONVERT_CPU,     DXGI_FORMAT_R32G32B32A32_FLOAT,  &amp;CopyTo32FVertexData&lt;GLushort, 4, 4, true&gt;);
+
+    // GL_FIXED
+    // TODO: Add test to verify that this works correctly.
+    AddVertexFormatInfo(&amp;map, GL_FIXED,          GL_FALSE,  1, VERTEX_CONVERT_CPU,      DXGI_FORMAT_R32G32_FLOAT,        &amp;Copy32FixedTo32FVertexData&lt;1, 2&gt;);
+    // NOTE: 2, 3 and 4 component GL_FIXED should use the default format table.
+
+    // GL_FLOAT
+    // TODO: Add test to verify that this works correctly.
+    AddVertexFormatInfo(&amp;map, GL_FLOAT,          GL_FALSE,  1, VERTEX_CONVERT_CPU,      DXGI_FORMAT_R32G32_FLOAT,        &amp;CopyNativeVertexData&lt;GLfloat, 1, 2, 0&gt;);
+    // NOTE: 2, 3 and 4 component GL_FLOAT should use the default format table.
+
+    return map;
+}
+
+static D3D11VertexFormatInfoMap BuildD3D11VertexFormatInfoMap()
+{
+    D3D11VertexFormatInfoMap map;
+
+    // TODO: column legend
+
+    //
+    // Float formats
+    //
+
+    // GL_BYTE -- un-normalized
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE, 1, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R8_SINT,            &amp;CopyNativeVertexData&lt;GLbyte, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE, 2, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R8G8_SINT,          &amp;CopyNativeVertexData&lt;GLbyte, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_SINT,      &amp;CopyNativeVertexData&lt;GLbyte, 3, 4, 1&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_FALSE, 4, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R8G8B8A8_SINT,      &amp;CopyNativeVertexData&lt;GLbyte, 4, 4, 0&gt;);
+
+    // GL_BYTE -- normalized
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,  1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SNORM,           &amp;CopyNativeVertexData&lt;GLbyte, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,  2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SNORM,         &amp;CopyNativeVertexData&lt;GLbyte, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,  3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R8G8B8A8_SNORM,     &amp;CopyNativeVertexData&lt;GLbyte, 3, 4, INT8_MAX&gt;);
+    AddVertexFormatInfo(&amp;map, GL_BYTE,           GL_TRUE,  4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SNORM,     &amp;CopyNativeVertexData&lt;GLbyte, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_BYTE -- un-normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_FALSE, 1, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R8_UINT,            &amp;CopyNativeVertexData&lt;GLubyte, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_FALSE, 2, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R8G8_UINT,          &amp;CopyNativeVertexData&lt;GLubyte, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,      &amp;CopyNativeVertexData&lt;GLubyte, 3, 4, 1&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_FALSE, 4, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R8G8B8A8_UINT,      &amp;CopyNativeVertexData&lt;GLubyte, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_BYTE -- normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_TRUE,  1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UNORM,           &amp;CopyNativeVertexData&lt;GLubyte, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_TRUE,  2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UNORM,         &amp;CopyNativeVertexData&lt;GLubyte, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_TRUE,  3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R8G8B8A8_UNORM,     &amp;CopyNativeVertexData&lt;GLubyte, 3, 4, UINT8_MAX&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  GL_TRUE,  4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UNORM,     &amp;CopyNativeVertexData&lt;GLubyte, 4, 4, 0&gt;);
+
+    // GL_SHORT -- un-normalized
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_FALSE, 1, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R16_SINT,           &amp;CopyNativeVertexData&lt;GLshort, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_FALSE, 2, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R16G16_SINT,        &amp;CopyNativeVertexData&lt;GLshort, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,  &amp;CopyNativeVertexData&lt;GLshort, 3, 4, 1&gt;);
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_FALSE, 4, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R16G16B16A16_SINT,  &amp;CopyNativeVertexData&lt;GLshort, 4, 4, 0&gt;);
+
+    // GL_SHORT -- normalized
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_TRUE,  1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SNORM,          &amp;CopyNativeVertexData&lt;GLshort, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_TRUE,  2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SNORM,       &amp;CopyNativeVertexData&lt;GLshort, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_TRUE,  3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R16G16B16A16_SNORM, &amp;CopyNativeVertexData&lt;GLshort, 3, 4, INT16_MAX&gt;);
+    AddVertexFormatInfo(&amp;map, GL_SHORT,          GL_TRUE,  4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SNORM, &amp;CopyNativeVertexData&lt;GLshort, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_SHORT -- un-normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE, 1, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R16_UINT,           &amp;CopyNativeVertexData&lt;GLushort, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE, 2, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R16G16_UINT,        &amp;CopyNativeVertexData&lt;GLushort, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_UINT,  &amp;CopyNativeVertexData&lt;GLushort, 3, 4, 1&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_FALSE, 4, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R16G16B16A16_UINT,  &amp;CopyNativeVertexData&lt;GLushort, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_SHORT -- normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,  1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UNORM,          &amp;CopyNativeVertexData&lt;GLushort, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,  2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UNORM,       &amp;CopyNativeVertexData&lt;GLushort, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,  3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R16G16B16A16_UNORM, &amp;CopyNativeVertexData&lt;GLushort, 3, 4, UINT16_MAX&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, GL_TRUE,  4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UNORM, &amp;CopyNativeVertexData&lt;GLushort, 4, 4, 0&gt;);
+
+    // GL_INT -- un-normalized
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_FALSE, 1, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32_SINT,           &amp;CopyNativeVertexData&lt;GLint, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_FALSE, 2, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32G32_SINT,        &amp;CopyNativeVertexData&lt;GLint, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_FALSE, 3, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32G32B32_SINT,     &amp;CopyNativeVertexData&lt;GLint, 3, 3, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_FALSE, 4, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32G32B32A32_SINT,  &amp;CopyNativeVertexData&lt;GLint, 4, 4, 0&gt;);
+
+    // GL_INT -- normalized
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_TRUE,  1, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32_FLOAT,          &amp;CopyTo32FVertexData&lt;GLint, 1, 1, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_TRUE,  2, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32_FLOAT,       &amp;CopyTo32FVertexData&lt;GLint, 2, 2, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_TRUE,  3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32_FLOAT,    &amp;CopyTo32FVertexData&lt;GLint, 3, 3, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_INT,            GL_TRUE,  4, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32A32_FLOAT, &amp;CopyTo32FVertexData&lt;GLint, 4, 4, true&gt;);
+
+    // GL_UNSIGNED_INT -- un-normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_FALSE, 1, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32_UINT,           &amp;CopyNativeVertexData&lt;GLuint, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_FALSE, 2, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32G32_UINT,        &amp;CopyNativeVertexData&lt;GLuint, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_FALSE, 3, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32G32B32_UINT,     &amp;CopyNativeVertexData&lt;GLuint, 3, 3, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_FALSE, 4, VERTEX_CONVERT_GPU,  DXGI_FORMAT_R32G32B32A32_UINT,  &amp;CopyNativeVertexData&lt;GLuint, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_INT -- normalized
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_TRUE,  1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT,          &amp;CopyTo32FVertexData&lt;GLuint, 1, 1, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_TRUE,  2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT,       &amp;CopyTo32FVertexData&lt;GLuint, 2, 2, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_TRUE,  3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32_FLOAT,    &amp;CopyTo32FVertexData&lt;GLuint, 3, 3, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   GL_TRUE,  4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_FLOAT, &amp;CopyTo32FVertexData&lt;GLuint, 4, 4, true&gt;);
+
+    // GL_FIXED
+    AddVertexFormatInfo(&amp;map, GL_FIXED,          GL_FALSE, 1, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32_FLOAT,          &amp;Copy32FixedTo32FVertexData&lt;1, 1&gt;);
+    AddVertexFormatInfo(&amp;map, GL_FIXED,          GL_FALSE, 2, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32_FLOAT,       &amp;Copy32FixedTo32FVertexData&lt;2, 2&gt;);
+    AddVertexFormatInfo(&amp;map, GL_FIXED,          GL_FALSE, 3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32_FLOAT,    &amp;Copy32FixedTo32FVertexData&lt;3, 3&gt;);
+    AddVertexFormatInfo(&amp;map, GL_FIXED,          GL_FALSE, 4, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32A32_FLOAT, &amp;Copy32FixedTo32FVertexData&lt;4, 4&gt;);
+
+    // GL_HALF_FLOAT
+    AddVertexFormatInfo(&amp;map, GL_HALF_FLOAT,     GL_FALSE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_FLOAT,          &amp;CopyNativeVertexData&lt;GLhalf, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_HALF_FLOAT,     GL_FALSE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_FLOAT,       &amp;CopyNativeVertexData&lt;GLhalf, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_HALF_FLOAT,     GL_FALSE, 3, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R16G16B16A16_FLOAT, &amp;CopyNativeVertexData&lt;GLhalf, 3, 4, gl::Float16One&gt;);
+    AddVertexFormatInfo(&amp;map, GL_HALF_FLOAT,     GL_FALSE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_FLOAT, &amp;CopyNativeVertexData&lt;GLhalf, 4, 4, 0&gt;);
+
+    // GL_FLOAT
+    AddVertexFormatInfo(&amp;map, GL_FLOAT,          GL_FALSE, 1, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT,          &amp;CopyNativeVertexData&lt;GLfloat, 1, 1, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_FLOAT,          GL_FALSE, 2, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT,       &amp;CopyNativeVertexData&lt;GLfloat, 2, 2, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_FLOAT,          GL_FALSE, 3, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_FLOAT,    &amp;CopyNativeVertexData&lt;GLfloat, 3, 3, 0&gt;);
+    AddVertexFormatInfo(&amp;map, GL_FLOAT,          GL_FALSE, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_FLOAT, &amp;CopyNativeVertexData&lt;GLfloat, 4, 4, 0&gt;);
+
+    // GL_INT_2_10_10_10_REV
+    AddVertexFormatInfo(&amp;map, GL_INT_2_10_10_10_REV,          GL_FALSE,  4, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32A32_FLOAT, &amp;CopyXYZ10W2ToXYZW32FVertexData&lt;true, false, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_INT_2_10_10_10_REV,          GL_TRUE,   4, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32A32_FLOAT, &amp;CopyXYZ10W2ToXYZW32FVertexData&lt;true, true,  true&gt;);
+
+    // GL_UNSIGNED_INT_2_10_10_10_REV
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT_2_10_10_10_REV, GL_FALSE,  4, VERTEX_CONVERT_CPU,  DXGI_FORMAT_R32G32B32A32_FLOAT, &amp;CopyXYZ10W2ToXYZW32FVertexData&lt;false, false, true&gt;);
+    AddVertexFormatInfo(&amp;map, GL_UNSIGNED_INT_2_10_10_10_REV, GL_TRUE,   4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UNORM,  &amp;CopyNativeVertexData&lt;GLuint, 1, 1, 0&gt;);
+
+    //
+    // Integer Formats
+    //
+
+    // GL_BYTE
+    AddIntegerVertexFormatInfo(&amp;map, GL_BYTE,           1, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R8_SINT,           &amp;CopyNativeVertexData&lt;GLbyte, 1, 1, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_BYTE,           2, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R8G8_SINT,         &amp;CopyNativeVertexData&lt;GLbyte, 2, 2, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_BYTE,           3, VERTEX_CONVERT_CPU,   DXGI_FORMAT_R8G8B8A8_SINT,     &amp;CopyNativeVertexData&lt;GLbyte, 3, 4, 1&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_BYTE,           4, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R8G8B8A8_SINT,     &amp;CopyNativeVertexData&lt;GLbyte, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_BYTE
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  1, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R8_UINT,           &amp;CopyNativeVertexData&lt;GLubyte, 1, 1, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  2, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R8G8_UINT,         &amp;CopyNativeVertexData&lt;GLubyte, 2, 2, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  3, VERTEX_CONVERT_CPU,   DXGI_FORMAT_R8G8B8A8_UINT,     &amp;CopyNativeVertexData&lt;GLubyte, 3, 4, 1&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_BYTE,  4, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R8G8B8A8_UINT,     &amp;CopyNativeVertexData&lt;GLubyte, 4, 4, 0&gt;);
+
+    // GL_SHORT
+    AddIntegerVertexFormatInfo(&amp;map, GL_SHORT,          1, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R16_SINT,          &amp;CopyNativeVertexData&lt;GLshort, 1, 1, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_SHORT,          2, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R16G16_SINT,       &amp;CopyNativeVertexData&lt;GLshort, 2, 2, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_SHORT,          3, VERTEX_CONVERT_CPU,   DXGI_FORMAT_R16G16B16A16_SINT, &amp;CopyNativeVertexData&lt;GLshort, 3, 4, 1&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_SHORT,          4, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R16G16B16A16_SINT, &amp;CopyNativeVertexData&lt;GLshort, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_SHORT
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, 1, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R16_UINT,          &amp;CopyNativeVertexData&lt;GLushort, 1, 1, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, 2, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R16G16_UINT,       &amp;CopyNativeVertexData&lt;GLushort, 2, 2, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, 3, VERTEX_CONVERT_CPU,   DXGI_FORMAT_R16G16B16A16_UINT, &amp;CopyNativeVertexData&lt;GLushort, 3, 4, 1&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_SHORT, 4, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R16G16B16A16_UINT, &amp;CopyNativeVertexData&lt;GLushort, 4, 4, 0&gt;);
+
+    // GL_INT
+    AddIntegerVertexFormatInfo(&amp;map, GL_INT,            1, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32_SINT,          &amp;CopyNativeVertexData&lt;GLint, 1, 1, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_INT,            2, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32G32_SINT,       &amp;CopyNativeVertexData&lt;GLint, 2, 2, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_INT,            3, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32G32B32_SINT,    &amp;CopyNativeVertexData&lt;GLint, 3, 3, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_INT,            4, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32G32B32A32_SINT, &amp;CopyNativeVertexData&lt;GLint, 4, 4, 0&gt;);
+
+    // GL_UNSIGNED_INT
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   1, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32_SINT,          &amp;CopyNativeVertexData&lt;GLuint, 1, 1, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   2, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32G32_SINT,       &amp;CopyNativeVertexData&lt;GLuint, 2, 2, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   3, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32G32B32_SINT,    &amp;CopyNativeVertexData&lt;GLuint, 3, 3, 0&gt;);
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_INT,   4, VERTEX_CONVERT_NONE,  DXGI_FORMAT_R32G32B32A32_SINT, &amp;CopyNativeVertexData&lt;GLuint, 4, 4, 0&gt;);
+
+    // GL_INT_2_10_10_10_REV
+    AddIntegerVertexFormatInfo(&amp;map, GL_INT_2_10_10_10_REV, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT, &amp;CopyXYZ10W2ToXYZW32FVertexData&lt;true, true, false&gt;);
+
+    // GL_UNSIGNED_INT_2_10_10_10_REV
+    AddIntegerVertexFormatInfo(&amp;map, GL_UNSIGNED_INT_2_10_10_10_REV, 4, VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UINT, &amp;CopyNativeVertexData&lt;GLuint, 1, 1, 0&gt;);
+
+    return map;
+}
+
+const VertexFormat &amp;GetVertexFormatInfo(const gl::VertexFormat &amp;vertexFormat, D3D_FEATURE_LEVEL featureLevel)
+{
+    static const D3D11VertexFormatInfoMap vertexFormatMap = BuildD3D11VertexFormatInfoMap();
+    static const D3D11VertexFormatInfoMap vertexFormatMapFL9_3Override = BuildD3D11_FL9_3VertexFormatInfoOverrideMap();
+
+    if (featureLevel == D3D_FEATURE_LEVEL_9_3)
+    {
+        // First see if the format has a special mapping for FL9_3
+        D3D11VertexFormatInfoMap::const_iterator iter = vertexFormatMapFL9_3Override.find(vertexFormat);
+        if (iter != vertexFormatMapFL9_3Override.end())
+        {
+            return iter-&gt;second;
+        }
+    }
+
+    D3D11VertexFormatInfoMap::const_iterator iter = vertexFormatMap.find(vertexFormat);
+    if (iter != vertexFormatMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        static const VertexFormat defaultInfo;
+        return defaultInfo;
+    }
+}
+
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11formatutils11h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/formatutils11.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// formatutils11.h: Queries for GL image formats and their translations to D3D11
+// formats.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
+
+#include &quot;libANGLE/renderer/d3d/formatutilsD3D.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &quot;common/platform.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+
+namespace d3d11
+{
+
+typedef std::map&lt;std::pair&lt;GLenum, GLenum&gt;, ColorCopyFunction&gt; FastCopyFunctionMap;
+typedef bool (*NativeMipmapGenerationSupportFunction)(D3D_FEATURE_LEVEL);
+
+struct DXGIFormat
+{
+    DXGIFormat();
+
+    GLuint pixelBytes;
+    GLuint blockWidth;
+    GLuint blockHeight;
+
+    GLuint redBits;
+    GLuint greenBits;
+    GLuint blueBits;
+    GLuint alphaBits;
+    GLuint sharedBits;
+
+    GLuint depthBits;
+    GLuint depthOffset;
+    GLuint stencilBits;
+    GLuint stencilOffset;
+
+    GLenum internalFormat;
+    GLenum componentType;
+
+    MipGenerationFunction mipGenerationFunction;
+    ColorReadFunction colorReadFunction;
+
+    FastCopyFunctionMap fastCopyFunctions;
+
+    NativeMipmapGenerationSupportFunction nativeMipmapSupport;
+
+    ColorCopyFunction getFastCopyFunction(GLenum format, GLenum type) const;
+};
+const DXGIFormat &amp;GetDXGIFormatInfo(DXGI_FORMAT format);
+
+struct TextureFormat
+{
+    TextureFormat();
+
+    DXGI_FORMAT texFormat;
+    DXGI_FORMAT srvFormat;
+    DXGI_FORMAT rtvFormat;
+    DXGI_FORMAT dsvFormat;
+    DXGI_FORMAT renderFormat;
+
+    DXGI_FORMAT swizzleTexFormat;
+    DXGI_FORMAT swizzleSRVFormat;
+    DXGI_FORMAT swizzleRTVFormat;
+
+    InitializeTextureDataFunction dataInitializerFunction;
+
+    typedef std::map&lt;GLenum, LoadImageFunction&gt; LoadFunctionMap;
+    LoadFunctionMap loadFunctions;
+};
+const TextureFormat &amp;GetTextureFormatInfo(GLenum internalFormat, D3D_FEATURE_LEVEL featureLevel);
+
+struct VertexFormat
+{
+    VertexFormat();
+
+    VertexConversionType conversionType;
+    DXGI_FORMAT nativeFormat;
+    VertexCopyFunction copyFunction;
+};
+const VertexFormat &amp;GetVertexFormatInfo(const gl::VertexFormat &amp;vertexFormat, D3D_FEATURE_LEVEL featureLevel);
+
+}
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11renderer11_utilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1204 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// renderer11_utils.cpp: Conversion functions and other utility routines
+// specific to the D3D11 renderer.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/renderer11_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/formatutils11.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/RenderTarget11.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/Workarounds.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+#include &lt;algorithm&gt;
+
+namespace rx
+{
+
+namespace gl_d3d11
+{
+
+D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha)
+{
+    D3D11_BLEND d3dBlend = D3D11_BLEND_ZERO;
+
+    switch (glBlend)
+    {
+      case GL_ZERO:                     d3dBlend = D3D11_BLEND_ZERO;                break;
+      case GL_ONE:                      d3dBlend = D3D11_BLEND_ONE;                 break;
+      case GL_SRC_COLOR:                d3dBlend = (isAlpha ? D3D11_BLEND_SRC_ALPHA : D3D11_BLEND_SRC_COLOR);           break;
+      case GL_ONE_MINUS_SRC_COLOR:      d3dBlend = (isAlpha ? D3D11_BLEND_INV_SRC_ALPHA : D3D11_BLEND_INV_SRC_COLOR);   break;
+      case GL_DST_COLOR:                d3dBlend = (isAlpha ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_DEST_COLOR);         break;
+      case GL_ONE_MINUS_DST_COLOR:      d3dBlend = (isAlpha ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_INV_DEST_COLOR); break;
+      case GL_SRC_ALPHA:                d3dBlend = D3D11_BLEND_SRC_ALPHA;           break;
+      case GL_ONE_MINUS_SRC_ALPHA:      d3dBlend = D3D11_BLEND_INV_SRC_ALPHA;       break;
+      case GL_DST_ALPHA:                d3dBlend = D3D11_BLEND_DEST_ALPHA;          break;
+      case GL_ONE_MINUS_DST_ALPHA:      d3dBlend = D3D11_BLEND_INV_DEST_ALPHA;      break;
+      case GL_CONSTANT_COLOR:           d3dBlend = D3D11_BLEND_BLEND_FACTOR;        break;
+      case GL_ONE_MINUS_CONSTANT_COLOR: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR;    break;
+      case GL_CONSTANT_ALPHA:           d3dBlend = D3D11_BLEND_BLEND_FACTOR;        break;
+      case GL_ONE_MINUS_CONSTANT_ALPHA: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR;    break;
+      case GL_SRC_ALPHA_SATURATE:       d3dBlend = D3D11_BLEND_SRC_ALPHA_SAT;       break;
+      default: UNREACHABLE();
+    }
+
+    return d3dBlend;
+}
+
+D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp)
+{
+    D3D11_BLEND_OP d3dBlendOp = D3D11_BLEND_OP_ADD;
+
+    switch (glBlendOp)
+    {
+      case GL_FUNC_ADD:              d3dBlendOp = D3D11_BLEND_OP_ADD;           break;
+      case GL_FUNC_SUBTRACT:         d3dBlendOp = D3D11_BLEND_OP_SUBTRACT;      break;
+      case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_REV_SUBTRACT;  break;
+      case GL_MIN:                   d3dBlendOp = D3D11_BLEND_OP_MIN;           break;
+      case GL_MAX:                   d3dBlendOp = D3D11_BLEND_OP_MAX;           break;
+      default: UNREACHABLE();
+    }
+
+    return d3dBlendOp;
+}
+
+UINT8 ConvertColorMask(bool red, bool green, bool blue, bool alpha)
+{
+    UINT8 mask = 0;
+    if (red)
+    {
+        mask |= D3D11_COLOR_WRITE_ENABLE_RED;
+    }
+    if (green)
+    {
+        mask |= D3D11_COLOR_WRITE_ENABLE_GREEN;
+    }
+    if (blue)
+    {
+        mask |= D3D11_COLOR_WRITE_ENABLE_BLUE;
+    }
+    if (alpha)
+    {
+        mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
+    }
+    return mask;
+}
+
+D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode)
+{
+    D3D11_CULL_MODE cull = D3D11_CULL_NONE;
+
+    if (cullEnabled)
+    {
+        switch (cullMode)
+        {
+          case GL_FRONT:            cull = D3D11_CULL_FRONT;    break;
+          case GL_BACK:             cull = D3D11_CULL_BACK;     break;
+          case GL_FRONT_AND_BACK:   cull = D3D11_CULL_NONE;     break;
+          default: UNREACHABLE();
+        }
+    }
+    else
+    {
+        cull = D3D11_CULL_NONE;
+    }
+
+    return cull;
+}
+
+D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison)
+{
+    D3D11_COMPARISON_FUNC d3dComp = D3D11_COMPARISON_NEVER;
+    switch (comparison)
+    {
+      case GL_NEVER:    d3dComp = D3D11_COMPARISON_NEVER;           break;
+      case GL_ALWAYS:   d3dComp = D3D11_COMPARISON_ALWAYS;          break;
+      case GL_LESS:     d3dComp = D3D11_COMPARISON_LESS;            break;
+      case GL_LEQUAL:   d3dComp = D3D11_COMPARISON_LESS_EQUAL;      break;
+      case GL_EQUAL:    d3dComp = D3D11_COMPARISON_EQUAL;           break;
+      case GL_GREATER:  d3dComp = D3D11_COMPARISON_GREATER;         break;
+      case GL_GEQUAL:   d3dComp = D3D11_COMPARISON_GREATER_EQUAL;   break;
+      case GL_NOTEQUAL: d3dComp = D3D11_COMPARISON_NOT_EQUAL;       break;
+      default: UNREACHABLE();
+    }
+
+    return d3dComp;
+}
+
+D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled)
+{
+    return depthWriteEnabled ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
+}
+
+UINT8 ConvertStencilMask(GLuint stencilmask)
+{
+    return static_cast&lt;UINT8&gt;(stencilmask);
+}
+
+D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp)
+{
+    D3D11_STENCIL_OP d3dStencilOp = D3D11_STENCIL_OP_KEEP;
+
+    switch (stencilOp)
+    {
+      case GL_ZERO:      d3dStencilOp = D3D11_STENCIL_OP_ZERO;      break;
+      case GL_KEEP:      d3dStencilOp = D3D11_STENCIL_OP_KEEP;      break;
+      case GL_REPLACE:   d3dStencilOp = D3D11_STENCIL_OP_REPLACE;   break;
+      case GL_INCR:      d3dStencilOp = D3D11_STENCIL_OP_INCR_SAT;  break;
+      case GL_DECR:      d3dStencilOp = D3D11_STENCIL_OP_DECR_SAT;  break;
+      case GL_INVERT:    d3dStencilOp = D3D11_STENCIL_OP_INVERT;    break;
+      case GL_INCR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_INCR;      break;
+      case GL_DECR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_DECR;      break;
+      default: UNREACHABLE();
+    }
+
+    return d3dStencilOp;
+}
+
+D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode)
+{
+    bool comparison = comparisonMode != GL_NONE;
+
+    if (maxAnisotropy &gt; 1.0f)
+    {
+        return D3D11_ENCODE_ANISOTROPIC_FILTER(static_cast&lt;D3D11_COMPARISON_FUNC&gt;(comparison));
+    }
+    else
+    {
+        D3D11_FILTER_TYPE dxMin = D3D11_FILTER_TYPE_POINT;
+        D3D11_FILTER_TYPE dxMip = D3D11_FILTER_TYPE_POINT;
+        switch (minFilter)
+        {
+          case GL_NEAREST:                dxMin = D3D11_FILTER_TYPE_POINT;  dxMip = D3D11_FILTER_TYPE_POINT;  break;
+          case GL_LINEAR:                 dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT;  break;
+          case GL_NEAREST_MIPMAP_NEAREST: dxMin = D3D11_FILTER_TYPE_POINT;  dxMip = D3D11_FILTER_TYPE_POINT;  break;
+          case GL_LINEAR_MIPMAP_NEAREST:  dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT;  break;
+          case GL_NEAREST_MIPMAP_LINEAR:  dxMin = D3D11_FILTER_TYPE_POINT;  dxMip = D3D11_FILTER_TYPE_LINEAR; break;
+          case GL_LINEAR_MIPMAP_LINEAR:   dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_LINEAR; break;
+          default:                        UNREACHABLE();
+        }
+
+        D3D11_FILTER_TYPE dxMag = D3D11_FILTER_TYPE_POINT;
+        switch (magFilter)
+        {
+          case GL_NEAREST: dxMag = D3D11_FILTER_TYPE_POINT;  break;
+          case GL_LINEAR:  dxMag = D3D11_FILTER_TYPE_LINEAR; break;
+          default:         UNREACHABLE();
+        }
+
+        return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip, static_cast&lt;D3D11_COMPARISON_FUNC&gt;(comparison));
+    }
+}
+
+D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap)
+{
+    switch (wrap)
+    {
+      case GL_REPEAT:          return D3D11_TEXTURE_ADDRESS_WRAP;
+      case GL_CLAMP_TO_EDGE:   return D3D11_TEXTURE_ADDRESS_CLAMP;
+      case GL_MIRRORED_REPEAT: return D3D11_TEXTURE_ADDRESS_MIRROR;
+      default:                 UNREACHABLE();
+    }
+
+    return D3D11_TEXTURE_ADDRESS_WRAP;
+}
+
+D3D11_QUERY ConvertQueryType(GLenum queryType)
+{
+    switch (queryType)
+    {
+      case GL_ANY_SAMPLES_PASSED_EXT:
+      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:   return D3D11_QUERY_OCCLUSION;
+      case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: return D3D11_QUERY_SO_STATISTICS;
+      default: UNREACHABLE();                        return D3D11_QUERY_EVENT;
+    }
+}
+
+}
+
+
+namespace d3d11_gl
+{
+
+GLint GetMaximumClientVersion(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return 3;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 2;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static gl::TextureCaps GenerateTextureFormatCaps(GLint maxClientVersion, GLenum internalFormat, ID3D11Device *device)
+{
+    gl::TextureCaps textureCaps;
+
+    const d3d11::TextureFormat &amp;formatInfo = d3d11::GetTextureFormatInfo(internalFormat, device-&gt;GetFeatureLevel());
+
+    UINT formatSupport;
+    if (SUCCEEDED(device-&gt;CheckFormatSupport(formatInfo.texFormat, &amp;formatSupport)))
+    {
+        const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+        if (internalFormatInfo.depthBits &gt; 0 || internalFormatInfo.stencilBits &gt; 0)
+        {
+            textureCaps.texturable = ((formatSupport &amp; D3D11_FORMAT_SUPPORT_TEXTURE2D) != 0);
+        }
+        else
+        {
+            UINT formatSupportMask = D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURECUBE;
+            if (maxClientVersion &gt; 2)
+            {
+                formatSupportMask |= D3D11_FORMAT_SUPPORT_TEXTURE3D;
+            }
+            textureCaps.texturable = ((formatSupport &amp; formatSupportMask) == formatSupportMask);
+        }
+    }
+
+    if (SUCCEEDED(device-&gt;CheckFormatSupport(formatInfo.renderFormat, &amp;formatSupport)) &amp;&amp;
+        ((formatSupport &amp; D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET) != 0))
+    {
+        for (size_t sampleCount = 1; sampleCount &lt;= D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT; sampleCount++)
+        {
+            UINT qualityCount = 0;
+            if (SUCCEEDED(device-&gt;CheckMultisampleQualityLevels(formatInfo.renderFormat, sampleCount, &amp;qualityCount)) &amp;&amp;
+                qualityCount &gt; 0)
+            {
+                textureCaps.sampleCounts.insert(sampleCount);
+            }
+        }
+    }
+
+    textureCaps.filterable = SUCCEEDED(device-&gt;CheckFormatSupport(formatInfo.srvFormat, &amp;formatSupport)) &amp;&amp;
+                             ((formatSupport &amp; D3D11_FORMAT_SUPPORT_SHADER_SAMPLE)) != 0;
+    textureCaps.renderable = (SUCCEEDED(device-&gt;CheckFormatSupport(formatInfo.rtvFormat, &amp;formatSupport)) &amp;&amp;
+                              ((formatSupport &amp; D3D11_FORMAT_SUPPORT_RENDER_TARGET)) != 0) ||
+                             (SUCCEEDED(device-&gt;CheckFormatSupport(formatInfo.dsvFormat, &amp;formatSupport)) &amp;&amp;
+                              ((formatSupport &amp; D3D11_FORMAT_SUPPORT_DEPTH_STENCIL) != 0));
+
+    return textureCaps;
+}
+
+static bool GetNPOTTextureSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return true;
+
+        // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return false;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static float GetMaximumAnisotropy(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_MAX_MAXANISOTROPY;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_MAX_MAXANISOTROPY;
+
+        // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:  return 16;
+
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_DEFAULT_MAX_ANISOTROPY;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static bool GetOcclusionQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return true;
+
+        // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateQuery
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:  return true;
+      case D3D_FEATURE_LEVEL_9_1:  return false;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static bool GetEventQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateQuery
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0:
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return true;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static bool GetInstancingSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateInputLayout
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return true;
+
+      // Feature Level 9_3 supports instancing, but slot 0 in the input layout must not be instanced.
+      // D3D9 has a similar restriction, where stream 0 must not be instanced.
+      // This restriction can be worked around by remapping any non-instanced slot to slot 0.
+      // This works because HLSL uses shader semantics to match the vertex inputs to the elements in the input layout, rather than the slots.
+      // Note that we only support instancing via ANGLE_instanced_array on 9_3, since 9_3 doesn't support OpenGL ES 3.0
+      case D3D_FEATURE_LEVEL_9_3:  return true;
+
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return false;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static bool GetFramebufferMultisampleSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return true;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return false;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static bool GetFramebufferBlitSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return true;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return false;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static bool GetDerivativeInstructionSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    // http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588.aspx states that shader model
+    // ps_2_x is required for the ddx (and other derivative functions).
+
+    // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx states that feature level
+    // 9.3 supports shader model ps_2_x.
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0:
+      case D3D_FEATURE_LEVEL_9_3:  return true;
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return false;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static bool GetShaderTextureLODSupport(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return true;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return false;
+
+      default: UNREACHABLE();      return false;
+    }
+}
+
+static size_t GetMaximumSimultaneousRenderTargets(D3D_FEATURE_LEVEL featureLevel)
+{
+    // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateInputLayout
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+      case D3D_FEATURE_LEVEL_9_3:  return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT;
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximum2DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_9_3:  return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumCubeMapTextureSize(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURECUBE_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURECUBE_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_9_3:  return D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION;
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximum2DTextureArraySize(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximum3DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumViewportSize(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_VIEWPORT_BOUNDS_MAX;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_VIEWPORT_BOUNDS_MAX;
+
+      // No constants for D3D11 Feature Level 9 viewport size limits, use the maximum texture sizes
+      case D3D_FEATURE_LEVEL_9_3:  return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumDrawIndexedIndexCount(D3D_FEATURE_LEVEL featureLevel)
+{
+    // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since that's what's
+    // returned from glGetInteger
+    static_assert(D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32, &quot;Unexpected D3D11 constant value.&quot;);
+    static_assert(D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32, &quot;Unexpected D3D11 constant value.&quot;);
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return std::numeric_limits&lt;GLint&gt;::max();
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:  return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumDrawVertexCount(D3D_FEATURE_LEVEL featureLevel)
+{
+    // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since that's what's
+    // returned from glGetInteger
+    static_assert(D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32, &quot;Unexpected D3D11 constant value.&quot;);
+    static_assert(D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32, &quot;Unexpected D3D11 constant value.&quot;);
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return std::numeric_limits&lt;GLint&gt;::max();
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:  return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
+      case D3D_FEATURE_LEVEL_9_1:  return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumVertexInputSlots(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_STANDARD_VERTEX_ELEMENT_COUNT;
+
+      case D3D_FEATURE_LEVEL_10_1: return D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT;
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_STANDARD_VERTEX_ELEMENT_COUNT;
+
+      // From http://http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx &quot;Max Input Slots&quot;
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 16;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+    // TODO(geofflang): Remove hard-coded limit once the gl-uniform-arrays test can pass
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return 1024; // D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return 1024; // D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+      // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx ID3D11DeviceContext::VSSetConstantBuffers
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 255;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetReservedVertexUniformBuffers()
+{
+    // Reserve one buffer for the application uniforms, and one for driver uniforms
+    return 2;
+}
+
+static size_t GetMaximumVertexUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - GetReservedVertexUniformBuffers();
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - GetReservedVertexUniformBuffers();
+
+      // Uniform blocks not supported on D3D11 Feature Level 9
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetReservedVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+    // According to The OpenGL ES Shading Language specifications 
+    // (Language Version 1.00 section 10.16, Language Version 3.10 section 12.21)
+    // built-in special variables (e.g. gl_FragCoord, or gl_PointCoord)
+    // which are statically used in the shader should be included in the variable packing algorithm.
+    // Therefore, we should not reserve output vectors for them.
+
+    switch (featureLevel)
+    {
+      // We must reserve one output vector for dx_Position.
+      // We also reserve one for gl_Position, which we unconditionally output on Feature Levels 10_0+,
+      // even if it's unused in the shader (e.g. for transform feedback). TODO: This could be improved.
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return 2;
+
+      // Just reserve dx_Position on Feature Level 9, since we don't ever need to output gl_Position.
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 1;
+
+      default: UNREACHABLE();      return 0;
+    }
+
+    return 1;
+}
+
+static size_t GetMaximumVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+    static_assert(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT, &quot;Unexpected D3D11 constant value.&quot;);
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+      case D3D_FEATURE_LEVEL_10_1: return D3D10_1_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+      // Use Shader Model 2.X limits
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 8 - GetReservedVertexOutputVectors(featureLevel);
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumVertexTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+      // Vertex textures not supported on D3D11 Feature Level 9 according to
+      // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
+      // ID3D11DeviceContext::VSSetSamplers and ID3D11DeviceContext::VSSetShaderResources
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumPixelUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+    // TODO(geofflang): Remove hard-coded limit once the gl-uniform-arrays test can pass
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return 1024; // D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return 1024; // D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+
+      // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx ID3D11DeviceContext::PSSetConstantBuffers
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 32;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetReservedPixelUniformBuffers()
+{
+    // Reserve one buffer for the application uniforms, and one for driver uniforms
+    return 2;
+}
+
+static size_t GetMaximumPixelUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - GetReservedPixelUniformBuffers();
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - GetReservedPixelUniformBuffers();
+
+      // Uniform blocks not supported on D3D11 Feature Level 9
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumPixelInputVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+
+      // Use Shader Model 2.X limits
+      case D3D_FEATURE_LEVEL_9_3:  return 8 - GetReservedVertexOutputVectors(featureLevel);
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 8 - GetReservedVertexOutputVectors(featureLevel);
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumPixelTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
+
+      // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx ID3D11DeviceContext::PSSetShaderResources
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 16;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static int GetMinimumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
+
+      // Sampling functions with offsets are not available below shader model 4.0.
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static int GetMaximumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+
+      // Sampling functions with offsets are not available below shader model 4.0.
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel)
+{
+    // Returns a size_t despite the limit being a GLuint64 because size_t is the maximum size of
+    // any buffer that could be allocated.
+
+    const size_t bytesPerComponent = 4 * sizeof(float);
+
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+
+      // Limits from http://msdn.microsoft.com/en-us/library/windows/desktop/ff476501.aspx remarks section
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 4096 * bytesPerComponent;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumStreamOutputBuffers(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return D3D11_SO_BUFFER_SLOT_COUNT;
+
+      case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SO_BUFFER_SLOT_COUNT;
+      case D3D_FEATURE_LEVEL_10_0: return D3D10_SO_BUFFER_SLOT_COUNT;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumStreamOutputInterleavedComponents(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0:
+
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return GetMaximumVertexOutputVectors(featureLevel) * 4;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+static size_t GetMaximumStreamOutputSeparateComponents(D3D_FEATURE_LEVEL featureLevel)
+{
+    switch (featureLevel)
+    {
+      case D3D_FEATURE_LEVEL_11_1:
+      case D3D_FEATURE_LEVEL_11_0: return GetMaximumStreamOutputInterleavedComponents(featureLevel) /
+                                          GetMaximumStreamOutputBuffers(featureLevel);
+
+
+      // D3D 10 and 10.1 only allow one output per output slot if an output slot other than zero is used.
+      case D3D_FEATURE_LEVEL_10_1:
+      case D3D_FEATURE_LEVEL_10_0: return 4;
+
+      case D3D_FEATURE_LEVEL_9_3:
+      case D3D_FEATURE_LEVEL_9_2:
+      case D3D_FEATURE_LEVEL_9_1:  return 0;
+
+      default: UNREACHABLE();      return 0;
+    }
+}
+
+void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions)
+{
+    D3D_FEATURE_LEVEL featureLevel = device-&gt;GetFeatureLevel();
+
+    GLuint maxSamples = 0;
+    const gl::FormatSet &amp;allFormats = gl::GetAllSizedInternalFormats();
+    for (gl::FormatSet::const_iterator internalFormat = allFormats.begin(); internalFormat != allFormats.end(); ++internalFormat)
+    {
+        gl::TextureCaps textureCaps = GenerateTextureFormatCaps(GetMaximumClientVersion(featureLevel), *internalFormat, device);
+        textureCapsMap-&gt;insert(*internalFormat, textureCaps);
+
+        maxSamples = std::max(maxSamples, textureCaps.getMaxSamples());
+
+        if (gl::GetInternalFormatInfo(*internalFormat).compressed)
+        {
+            caps-&gt;compressedTextureFormats.push_back(*internalFormat);
+        }
+    }
+
+    // GL core feature limits
+    caps-&gt;maxElementIndex = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;unsigned int&gt;::max());
+    caps-&gt;max3DTextureSize = GetMaximum3DTextureSize(featureLevel);
+    caps-&gt;max2DTextureSize = GetMaximum2DTextureSize(featureLevel);
+    caps-&gt;maxCubeMapTextureSize = GetMaximumCubeMapTextureSize(featureLevel);
+    caps-&gt;maxArrayTextureLayers = GetMaximum2DTextureArraySize(featureLevel);
+
+    // Unimplemented, set to minimum required
+    caps-&gt;maxLODBias = 2.0f;
+
+    // No specific limits on render target size, maximum 2D texture size is equivalent
+    caps-&gt;maxRenderbufferSize = caps-&gt;max2DTextureSize;
+
+    // Maximum draw buffers and color attachments are the same, max color attachments could eventually be
+    // increased to 16
+    caps-&gt;maxDrawBuffers = GetMaximumSimultaneousRenderTargets(featureLevel);
+    caps-&gt;maxColorAttachments = GetMaximumSimultaneousRenderTargets(featureLevel);
+
+    // D3D11 has the same limit for viewport width and height
+    caps-&gt;maxViewportWidth = GetMaximumViewportSize(featureLevel);
+    caps-&gt;maxViewportHeight = caps-&gt;maxViewportWidth;
+
+    // Choose a reasonable maximum, enforced in the shader.
+    caps-&gt;minAliasedPointSize = 1.0f;
+    caps-&gt;maxAliasedPointSize = 1024.0f;
+
+    // Wide lines not supported
+    caps-&gt;minAliasedLineWidth = 1.0f;
+    caps-&gt;maxAliasedLineWidth = 1.0f;
+
+    // Primitive count limits
+    caps-&gt;maxElementsIndices = GetMaximumDrawIndexedIndexCount(featureLevel);
+    caps-&gt;maxElementsVertices = GetMaximumDrawVertexCount(featureLevel);
+
+    // Program and shader binary formats (no supported shader binary formats)
+    caps-&gt;programBinaryFormats.push_back(GL_PROGRAM_BINARY_ANGLE);
+
+    caps-&gt;vertexHighpFloat.setIEEEFloat();
+    caps-&gt;vertexMediumpFloat.setIEEEFloat();
+    caps-&gt;vertexLowpFloat.setIEEEFloat();
+    caps-&gt;fragmentHighpFloat.setIEEEFloat();
+    caps-&gt;fragmentMediumpFloat.setIEEEFloat();
+    caps-&gt;fragmentLowpFloat.setIEEEFloat();
+
+    // 32-bit integers are natively supported
+    caps-&gt;vertexHighpInt.setTwosComplementInt(32);
+    caps-&gt;vertexMediumpInt.setTwosComplementInt(32);
+    caps-&gt;vertexLowpInt.setTwosComplementInt(32);
+    caps-&gt;fragmentHighpInt.setTwosComplementInt(32);
+    caps-&gt;fragmentMediumpInt.setTwosComplementInt(32);
+    caps-&gt;fragmentLowpInt.setTwosComplementInt(32);
+
+    // We do not wait for server fence objects internally, so report a max timeout of zero.
+    caps-&gt;maxServerWaitTimeout = 0;
+
+    // Vertex shader limits
+    caps-&gt;maxVertexAttributes = GetMaximumVertexInputSlots(featureLevel);
+    caps-&gt;maxVertexUniformComponents = GetMaximumVertexUniformVectors(featureLevel) * 4;
+    caps-&gt;maxVertexUniformVectors = GetMaximumVertexUniformVectors(featureLevel);
+    caps-&gt;maxVertexUniformBlocks = GetMaximumVertexUniformBlocks(featureLevel);
+    caps-&gt;maxVertexOutputComponents = GetMaximumVertexOutputVectors(featureLevel) * 4;
+    caps-&gt;maxVertexTextureImageUnits = GetMaximumVertexTextureUnits(featureLevel);
+
+    // Fragment shader limits
+    caps-&gt;maxFragmentUniformComponents = GetMaximumPixelUniformVectors(featureLevel) * 4;
+    caps-&gt;maxFragmentUniformVectors = GetMaximumPixelUniformVectors(featureLevel);
+    caps-&gt;maxFragmentUniformBlocks = GetMaximumPixelUniformBlocks(featureLevel);
+    caps-&gt;maxFragmentInputComponents = GetMaximumPixelInputVectors(featureLevel) * 4;
+    caps-&gt;maxTextureImageUnits = GetMaximumPixelTextureUnits(featureLevel);
+    caps-&gt;minProgramTexelOffset = GetMinimumTexelOffset(featureLevel);
+    caps-&gt;maxProgramTexelOffset = GetMaximumTexelOffset(featureLevel);
+
+    // Aggregate shader limits
+    caps-&gt;maxUniformBufferBindings = caps-&gt;maxVertexUniformBlocks + caps-&gt;maxFragmentUniformBlocks;
+    caps-&gt;maxUniformBlockSize = GetMaximumConstantBufferSize(featureLevel);
+
+    // With DirectX 11.1, constant buffer offset and size must be a multiple of 16 constants of 16 bytes each.
+    // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx
+    // With DirectX 11.0, we emulate UBO offsets using copies of ranges of the UBO however
+    // we still keep the same alignment as 11.1 for consistency.
+    caps-&gt;uniformBufferOffsetAlignment = 256;
+
+    caps-&gt;maxCombinedUniformBlocks = caps-&gt;maxVertexUniformBlocks + caps-&gt;maxFragmentUniformBlocks;
+    caps-&gt;maxCombinedVertexUniformComponents = (static_cast&lt;GLint64&gt;(caps-&gt;maxVertexUniformBlocks) * static_cast&lt;GLint64&gt;(caps-&gt;maxUniformBlockSize / 4)) +
+                                               static_cast&lt;GLint64&gt;(caps-&gt;maxVertexUniformComponents);
+    caps-&gt;maxCombinedFragmentUniformComponents = (static_cast&lt;GLint64&gt;(caps-&gt;maxFragmentUniformBlocks) * static_cast&lt;GLint64&gt;(caps-&gt;maxUniformBlockSize / 4)) +
+                                                 static_cast&lt;GLint64&gt;(caps-&gt;maxFragmentUniformComponents);
+    caps-&gt;maxVaryingComponents = GetMaximumVertexOutputVectors(featureLevel) * 4;
+    caps-&gt;maxVaryingVectors = GetMaximumVertexOutputVectors(featureLevel);
+    caps-&gt;maxCombinedTextureImageUnits = caps-&gt;maxVertexTextureImageUnits + caps-&gt;maxTextureImageUnits;
+
+    // Transform feedback limits
+    caps-&gt;maxTransformFeedbackInterleavedComponents = GetMaximumStreamOutputInterleavedComponents(featureLevel);
+    caps-&gt;maxTransformFeedbackSeparateAttributes = GetMaximumStreamOutputBuffers(featureLevel);
+    caps-&gt;maxTransformFeedbackSeparateComponents = GetMaximumStreamOutputSeparateComponents(featureLevel);
+
+    // Multisample limits
+    caps-&gt;maxSamples = maxSamples;
+
+    // GL extension support
+    extensions-&gt;setTextureExtensionSupport(*textureCapsMap);
+    extensions-&gt;elementIndexUint = true;
+    extensions-&gt;packedDepthStencil = true;
+    extensions-&gt;getProgramBinary = true;
+    extensions-&gt;rgb8rgba8 = true;
+    extensions-&gt;readFormatBGRA = true;
+    extensions-&gt;pixelBufferObject = true;
+    extensions-&gt;mapBuffer = true;
+    extensions-&gt;mapBufferRange = true;
+    extensions-&gt;textureNPOT = GetNPOTTextureSupport(featureLevel);
+    extensions-&gt;drawBuffers = GetMaximumSimultaneousRenderTargets(featureLevel) &gt; 1;
+    extensions-&gt;textureStorage = true;
+    extensions-&gt;textureFilterAnisotropic = true;
+    extensions-&gt;maxTextureAnisotropy = GetMaximumAnisotropy(featureLevel);
+    extensions-&gt;occlusionQueryBoolean = GetOcclusionQuerySupport(featureLevel);
+    extensions-&gt;fence = GetEventQuerySupport(featureLevel);
+    extensions-&gt;timerQuery = false; // Unimplemented
+    extensions-&gt;robustness = true;
+    extensions-&gt;blendMinMax = true;
+    extensions-&gt;framebufferBlit = GetFramebufferBlitSupport(featureLevel);
+    extensions-&gt;framebufferMultisample = GetFramebufferMultisampleSupport(featureLevel);
+    extensions-&gt;instancedArrays = GetInstancingSupport(featureLevel);
+    extensions-&gt;packReverseRowOrder = true;
+    extensions-&gt;standardDerivatives = GetDerivativeInstructionSupport(featureLevel);
+    extensions-&gt;shaderTextureLOD = GetShaderTextureLODSupport(featureLevel);
+    extensions-&gt;fragDepth = true;
+    extensions-&gt;textureUsage = true; // This could be false since it has no effect in D3D11
+    extensions-&gt;translatedShaderSource = true;
+    extensions-&gt;fboRenderMipmap = false;
+}
+
+}
+
+namespace d3d11
+{
+
+void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset)
+{
+    const DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(format);
+
+    int upsampleCount = 0;
+    // Don't expand the size of full textures that are at least (blockWidth x blockHeight) already.
+    if (isImage || *requestWidth  &lt; static_cast&lt;GLsizei&gt;(dxgiFormatInfo.blockWidth) ||
+                   *requestHeight &lt; static_cast&lt;GLsizei&gt;(dxgiFormatInfo.blockHeight))
+    {
+        while (*requestWidth % dxgiFormatInfo.blockWidth != 0 || *requestHeight % dxgiFormatInfo.blockHeight != 0)
+        {
+            *requestWidth &lt;&lt;= 1;
+            *requestHeight &lt;&lt;= 1;
+            upsampleCount++;
+        }
+    }
+    *levelOffset = upsampleCount;
+}
+
+void GenerateInitialTextureData(GLint internalFormat, D3D_FEATURE_LEVEL featureLevel, GLuint width, GLuint height, GLuint depth,
+                                GLuint mipLevels, std::vector&lt;D3D11_SUBRESOURCE_DATA&gt; *outSubresourceData,
+                                std::vector&lt; std::vector&lt;BYTE&gt; &gt; *outData)
+{
+    const d3d11::TextureFormat &amp;d3dFormatInfo = d3d11::GetTextureFormatInfo(internalFormat, featureLevel);
+    ASSERT(d3dFormatInfo.dataInitializerFunction != NULL);
+
+    const d3d11::DXGIFormat &amp;dxgiFormatInfo = d3d11::GetDXGIFormatInfo(d3dFormatInfo.texFormat);
+
+    outSubresourceData-&gt;resize(mipLevels);
+    outData-&gt;resize(mipLevels);
+
+    for (unsigned int i = 0; i &lt; mipLevels; i++)
+    {
+        unsigned int mipWidth = std::max(width &gt;&gt; i, 1U);
+        unsigned int mipHeight = std::max(height &gt;&gt; i, 1U);
+        unsigned int mipDepth = std::max(depth &gt;&gt; i, 1U);
+
+        unsigned int rowWidth = dxgiFormatInfo.pixelBytes * mipWidth;
+        unsigned int imageSize = rowWidth * height;
+
+        outData-&gt;at(i).resize(rowWidth * mipHeight * mipDepth);
+        d3dFormatInfo.dataInitializerFunction(mipWidth, mipHeight, mipDepth, outData-&gt;at(i).data(), rowWidth, imageSize);
+
+        outSubresourceData-&gt;at(i).pSysMem = outData-&gt;at(i).data();
+        outSubresourceData-&gt;at(i).SysMemPitch = rowWidth;
+        outSubresourceData-&gt;at(i).SysMemSlicePitch = imageSize;
+    }
+}
+
+void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v)
+{
+    vertex-&gt;x = x;
+    vertex-&gt;y = y;
+    vertex-&gt;u = u;
+    vertex-&gt;v = v;
+}
+
+void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, float x, float y,
+                                      unsigned int layer, float u, float v, float s)
+{
+    vertex-&gt;x = x;
+    vertex-&gt;y = y;
+    vertex-&gt;l = layer;
+    vertex-&gt;u = u;
+    vertex-&gt;v = v;
+    vertex-&gt;s = s;
+}
+
+HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
+{
+#if defined(_DEBUG)
+    return resource-&gt;SetPrivateData(WKPDID_D3DDebugObjectName, strlen(name), name);
+#else
+    return S_OK;
+#endif
+}
+
+Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel)
+{
+    Workarounds workarounds;
+    workarounds.mrtPerfWorkaround = true;
+    workarounds.setDataFasterThanImageUpload = true;
+    workarounds.zeroMaxLodWorkaround = (featureLevel &lt;= D3D_FEATURE_LEVEL_9_3);
+    workarounds.useInstancedPointSpriteEmulation = (featureLevel &lt;= D3D_FEATURE_LEVEL_9_3);
+    return workarounds;
+}
+
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11renderer11_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,188 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// renderer11_utils.h: Conversion functions and other utility routines
+// specific to the D3D11 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_UTILS_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_UTILS_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#include &lt;vector&gt;
+
+namespace gl
+{
+class FramebufferAttachment;
+}
+
+namespace rx
+{
+class RenderTarget11;
+struct Workarounds;
+
+namespace gl_d3d11
+{
+
+D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha);
+D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp);
+UINT8 ConvertColorMask(bool maskRed, bool maskGreen, bool maskBlue, bool maskAlpha);
+
+D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode);
+
+D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison);
+D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled);
+UINT8 ConvertStencilMask(GLuint stencilmask);
+D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
+
+D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode);
+D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
+
+D3D11_QUERY ConvertQueryType(GLenum queryType);
+
+}
+
+namespace d3d11_gl
+{
+
+GLint GetMaximumClientVersion(D3D_FEATURE_LEVEL featureLevel);
+void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions);
+
+}
+
+namespace d3d11
+{
+
+void MakeValidSize(bool isImage, DXGI_FORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset);
+
+void GenerateInitialTextureData(GLint internalFormat, D3D_FEATURE_LEVEL featureLevel, GLuint width, GLuint height, GLuint depth,
+                                GLuint mipLevels, std::vector&lt;D3D11_SUBRESOURCE_DATA&gt; *outSubresourceData,
+                                std::vector&lt; std::vector&lt;BYTE&gt; &gt; *outData);
+
+struct PositionTexCoordVertex
+{
+    float x, y;
+    float u, v;
+};
+void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v);
+
+struct PositionLayerTexCoord3DVertex
+{
+    float x, y;
+    unsigned int l;
+    float u, v, s;
+};
+void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, float x, float y,
+                                      unsigned int layer, float u, float v, float s);
+
+template &lt;typename T&gt;
+struct PositionDepthColorVertex
+{
+    float x, y, z;
+    T r, g, b, a;
+};
+
+template &lt;typename T&gt;
+void SetPositionDepthColorVertex(PositionDepthColorVertex&lt;T&gt;* vertex, float x, float y, float z,
+                                 const gl::Color&lt;T&gt; &amp;color)
+{
+    vertex-&gt;x = x;
+    vertex-&gt;y = y;
+    vertex-&gt;z = z;
+    vertex-&gt;r = color.red;
+    vertex-&gt;g = color.green;
+    vertex-&gt;b = color.blue;
+    vertex-&gt;a = color.alpha;
+}
+
+HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
+
+template &lt;typename outType&gt;
+outType* DynamicCastComObject(IUnknown* object)
+{
+    outType *outObject = NULL;
+    HRESULT result = object-&gt;QueryInterface(__uuidof(outType), reinterpret_cast&lt;void**&gt;(&amp;outObject));
+    if (SUCCEEDED(result))
+    {
+        return outObject;
+    }
+    else
+    {
+        SafeRelease(outObject);
+        return NULL;
+    }
+}
+
+inline bool isDeviceLostError(HRESULT errorCode)
+{
+    switch (errorCode)
+    {
+      case DXGI_ERROR_DEVICE_HUNG:
+      case DXGI_ERROR_DEVICE_REMOVED:
+      case DXGI_ERROR_DEVICE_RESET:
+      case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
+      case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
+        return true;
+      default:
+        return false;
+    }
+}
+
+template &lt;unsigned int N&gt;
+inline ID3D11VertexShader *CompileVS(ID3D11Device *device, const BYTE (&amp;byteCode)[N], const char *name)
+{
+    ID3D11VertexShader *vs = NULL;
+    HRESULT result = device-&gt;CreateVertexShader(byteCode, N, NULL, &amp;vs);
+    UNUSED_ASSERTION_VARIABLE(result);
+    ASSERT(SUCCEEDED(result));
+    SetDebugName(vs, name);
+    return vs;
+}
+
+template &lt;unsigned int N&gt;
+inline ID3D11GeometryShader *CompileGS(ID3D11Device *device, const BYTE (&amp;byteCode)[N], const char *name)
+{
+    ID3D11GeometryShader *gs = NULL;
+    HRESULT result = device-&gt;CreateGeometryShader(byteCode, N, NULL, &amp;gs);
+    UNUSED_ASSERTION_VARIABLE(result);
+    ASSERT(SUCCEEDED(result));
+    SetDebugName(gs, name);
+    return gs;
+}
+
+template &lt;unsigned int N&gt;
+inline ID3D11PixelShader *CompilePS(ID3D11Device *device, const BYTE (&amp;byteCode)[N], const char *name)
+{
+    ID3D11PixelShader *ps = NULL;
+    HRESULT result = device-&gt;CreatePixelShader(byteCode, N, NULL, &amp;ps);
+    UNUSED_ASSERTION_VARIABLE(result);
+    ASSERT(SUCCEEDED(result));
+    SetDebugName(ps, name);
+    return ps;
+}
+
+// Copy data to small D3D11 buffers, such as for small constant buffers, which use one struct to
+// represent an entire buffer.
+template &lt;class T&gt;
+inline void SetBufferData(ID3D11DeviceContext *context, ID3D11Buffer *constantBuffer, const T &amp;value)
+{
+    D3D11_MAPPED_SUBRESOURCE mappedResource;
+    context-&gt;Map(constantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &amp;mappedResource);
+
+    memcpy(mappedResource.pData, &amp;value, sizeof(T));
+
+    context-&gt;Unmap(constantBuffer, 0);
+}
+
+Workarounds GenerateWorkarounds(D3D_FEATURE_LEVEL featureLevel);
+
+}
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_RENDERER11_UTILS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersBufferToTexture11hlsl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/BufferToTexture11.hlsl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+Buffer&lt;float4&gt;    Buffer4F  : register(t0);
+Buffer&lt;int4&gt;      Buffer4I  : register(t0);
+Buffer&lt;uint4&gt;     Buffer4UI : register(t0);
+
+struct VS_OUTPUT
+{
+    float4 position : SV_Position;
+    uint index      : TEXCOORD0;
+    uint slice      : LAYER;
+};
+
+struct GS_OUTPUT
+{
+    float4 position : SV_Position;
+    uint index      : TEXCOORD0;
+    uint slice      : SV_RenderTargetArrayIndex;
+};
+
+cbuffer BufferCopyParams : register(b0)
+{
+    uint FirstPixelOffset;
+    uint PixelsPerRow;
+    uint RowStride;
+    uint RowsPerSlice;
+    float2 PositionOffset;
+    float2 PositionScale;
+    int2 TexLocationOffset;
+    int2 TexLocationScale;
+    uint FirstSlice;
+}
+
+void ComputePositionAndIndex(uint vertexID, out VS_OUTPUT outVertex)
+{
+    uint PixelsPerSlice = PixelsPerRow * RowsPerSlice;
+    uint SliceStride    = RowStride * RowsPerSlice;
+
+    uint slice          = vertexID / PixelsPerSlice;
+    uint sliceOffset    = slice * PixelsPerSlice;
+    uint row            = (vertexID - sliceOffset) / PixelsPerRow;
+    uint col            = vertexID - sliceOffset - (row * PixelsPerRow);
+
+    float2 coords       = float2(float(col), float(row));
+
+    outVertex.position  = float4(PositionOffset + PositionScale * coords, 0.0f, 1.0f);
+    outVertex.index     = FirstPixelOffset + slice * SliceStride + row * RowStride + col;
+    outVertex.slice     = FirstSlice + slice;
+}
+
+void VS_BufferToTexture(in uint vertexID : SV_VertexID, out VS_OUTPUT outVertex)
+{
+    ComputePositionAndIndex(vertexID, outVertex);
+}
+
+[maxvertexcount(1)]
+void GS_BufferToTexture(point VS_OUTPUT inVertex[1], inout PointStream&lt;GS_OUTPUT&gt; outStream)
+{
+    GS_OUTPUT outVertex;
+    outVertex.position  = inVertex[0].position;
+    outVertex.index     = inVertex[0].index;
+    outVertex.slice     = inVertex[0].slice;
+    outStream.Append(outVertex);
+}
+
+float4 PS_BufferToTexture_4F(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
+{
+    return Buffer4F.Load(inIndex);
+}
+
+int4 PS_BufferToTexture_4I(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
+{
+    return Buffer4I.Load(inIndex);
+}
+
+uint4 PS_BufferToTexture_4UI(in float4 inPosition : SV_Position, in uint inIndex : TEXCOORD0) : SV_Target
+{
+    return Buffer4UI.Load(inIndex);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersClear11hlsl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Clear11.hlsl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,119 @@
</span><ins>+// Assume we are in SM4+, which has 8 color outputs
+
+void VS_ClearFloat( in float3  inPosition :    POSITION,  in float4  inColor : COLOR,
+                   out float4 outPosition : SV_POSITION, out float4 outColor : COLOR)
+{
+    outPosition = float4(inPosition, 1.0f);
+    outColor = inColor;
+}
+
+struct PS_OutputFloat
+{
+    float4 color0 : SV_TARGET0;
+    float4 color1 : SV_TARGET1;
+    float4 color2 : SV_TARGET2;
+    float4 color3 : SV_TARGET3;
+    float4 color4 : SV_TARGET4;
+    float4 color5 : SV_TARGET5;
+    float4 color6 : SV_TARGET6;
+    float4 color7 : SV_TARGET7;
+};
+
+PS_OutputFloat PS_ClearFloat(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
+{
+    PS_OutputFloat outColor;
+    outColor.color0 = inColor;
+    outColor.color1 = inColor;
+    outColor.color2 = inColor;
+    outColor.color3 = inColor;
+    outColor.color4 = inColor;
+    outColor.color5 = inColor;
+    outColor.color6 = inColor;
+    outColor.color7 = inColor;
+    return outColor;
+}
+
+struct PS_OutputFloat_FL9
+{
+    float4 color0 : SV_TARGET0;
+    float4 color1 : SV_TARGET1;
+    float4 color2 : SV_TARGET2;
+    float4 color3 : SV_TARGET3;
+};
+
+PS_OutputFloat_FL9 PS_ClearFloat_FL9(in float4 inPosition : SV_POSITION, in float4 inColor : COLOR)
+{
+    PS_OutputFloat_FL9 outColor;
+    outColor.color0 = inColor;
+    outColor.color1 = inColor;
+    outColor.color2 = inColor;
+    outColor.color3 = inColor;
+    return outColor;
+}
+
+void VS_ClearUint( in float3  inPosition :    POSITION,   in uint4  inColor : COLOR,
+                   out float4 outPosition : SV_POSITION, out uint4 outColor : COLOR)
+{
+    outPosition = float4(inPosition, 1.0f);
+    outColor = inColor;
+}
+
+struct PS_OutputUint
+{
+    uint4 color0 : SV_TARGET0;
+    uint4 color1 : SV_TARGET1;
+    uint4 color2 : SV_TARGET2;
+    uint4 color3 : SV_TARGET3;
+    uint4 color4 : SV_TARGET4;
+    uint4 color5 : SV_TARGET5;
+    uint4 color6 : SV_TARGET6;
+    uint4 color7 : SV_TARGET7;
+};
+
+PS_OutputUint PS_ClearUint(in float4 inPosition : SV_POSITION, in uint4 inColor : COLOR)
+{
+    PS_OutputUint outColor;
+    outColor.color0 = inColor;
+    outColor.color1 = inColor;
+    outColor.color2 = inColor;
+    outColor.color3 = inColor;
+    outColor.color4 = inColor;
+    outColor.color5 = inColor;
+    outColor.color6 = inColor;
+    outColor.color7 = inColor;
+    return outColor;
+}
+
+
+void VS_ClearSint( in float3  inPosition :    POSITION,   in int4  inColor : COLOR,
+                   out float4 outPosition : SV_POSITION, out int4 outColor : COLOR)
+{
+    outPosition = float4(inPosition, 1.0f);
+    outColor = inColor;
+}
+
+struct PS_OutputSint
+{
+    int4 color0 : SV_TARGET0;
+    int4 color1 : SV_TARGET1;
+    int4 color2 : SV_TARGET2;
+    int4 color3 : SV_TARGET3;
+    int4 color4 : SV_TARGET4;
+    int4 color5 : SV_TARGET5;
+    int4 color6 : SV_TARGET6;
+    int4 color7 : SV_TARGET7;
+};
+
+PS_OutputSint PS_ClearSint(in float4 inPosition : SV_POSITION, in int4 inColor : COLOR)
+{
+    PS_OutputSint outColor;
+    outColor.color0 = inColor;
+    outColor.color1 = inColor;
+    outColor.color2 = inColor;
+    outColor.color3 = inColor;
+    outColor.color4 = inColor;
+    outColor.color5 = inColor;
+    outColor.color6 = inColor;
+    outColor.color7 = inColor;
+    return outColor;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersPassthrough2D11hlsl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough2D11.hlsl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,111 @@
</span><ins>+Texture2D&lt;float4&gt; TextureF  : register(t0);
+Texture2D&lt;uint4&gt;  TextureUI : register(t0);
+Texture2D&lt;int4&gt;   TextureI  : register(t0);
+
+SamplerState Sampler        : register(s0);
+
+void VS_Passthrough2D( in float2  inPosition :    POSITION,  in float2  inTexCoord : TEXCOORD0,
+                    out float4 outPosition : SV_POSITION, out float2 outTexCoord : TEXCOORD0)
+{
+    outPosition = float4(inPosition, 0.0f, 1.0f);
+    outTexCoord = inTexCoord;
+}
+
+float PS_PassthroughDepth2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_DEPTH
+{
+    return TextureF.Sample(Sampler, inTexCoord).r;
+}
+
+float4 PS_PassthroughRGBA2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return TextureF.Sample(Sampler, inTexCoord).rgba;
+}
+
+uint4 PS_PassthroughRGBA2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureUI.GetDimensions(size.x, size.y);
+
+    return TextureUI.Load(int3(size * inTexCoord, 0)).rgba;
+}
+
+int4 PS_PassthroughRGBA2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureI.GetDimensions(size.x, size.y);
+
+    return TextureI.Load(int3(size * inTexCoord, 0)).rgba;
+}
+
+float4 PS_PassthroughRGB2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, inTexCoord).rgb, 1.0f);
+}
+
+uint4 PS_PassthroughRGB2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureUI.GetDimensions(size.x, size.y);
+
+    return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).rgb, 0);
+}
+
+int4 PS_PassthroughRGB2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureI.GetDimensions(size.x, size.y);
+
+    return int4(TextureI.Load(int3(size * inTexCoord, 0)).rgb, 0);
+}
+
+float4 PS_PassthroughRG2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, inTexCoord).rg, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughRG2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureUI.GetDimensions(size.x, size.y);
+
+    return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).rg, 0, 0);
+}
+
+int4 PS_PassthroughRG2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureI.GetDimensions(size.x, size.y);
+
+    return int4(TextureI.Load(int3(size * inTexCoord, 0)).rg, 0, 0);
+}
+
+float4 PS_PassthroughR2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, inTexCoord).r, 0.0f, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughR2DUI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureUI.GetDimensions(size.x, size.y);
+
+    return uint4(TextureUI.Load(int3(size * inTexCoord, 0)).r, 0, 0, 0);
+}
+
+int4 PS_PassthroughR2DI(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureI.GetDimensions(size.x, size.y);
+
+    return int4(TextureI.Load(int3(size * inTexCoord, 0)).r, 0, 0, 0);
+}
+
+float4 PS_PassthroughLum2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, inTexCoord).rrr, 1.0f);
+}
+
+float4 PS_PassthroughLumAlpha2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return TextureF.Sample(Sampler, inTexCoord).rrra;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersPassthrough3D11hlsl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Passthrough3D11.hlsl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,146 @@
</span><ins>+Texture3D&lt;float4&gt; TextureF  : register(t0);
+Texture3D&lt;uint4&gt;  TextureUI : register(t0);
+Texture3D&lt;int4&gt;   TextureI  : register(t0);
+
+SamplerState      Sampler   : register(s0);
+
+struct VS_INPUT
+{
+    float2 Position : POSITION;
+    uint   Layer    : LAYER;
+    float3 TexCoord : TEXCOORD;
+};
+
+struct VS_OUTPUT
+{
+    float4 Position : SV_POSITION;
+    uint   Layer    : LAYER;
+    float3 TexCoord : TEXCOORD;
+};
+
+struct GS_OUTPUT
+{
+    float4 Position : SV_POSITION;
+    uint   Layer    : SV_RENDERTARGETARRAYINDEX;
+    float3 TexCoord : TEXCOORD;
+};
+
+VS_OUTPUT VS_Passthrough3D(VS_INPUT input)
+{
+    VS_OUTPUT output;
+
+    output.Position = float4(input.Position, 0.0f, 1.0f);
+    output.Layer = input.Layer;
+    output.TexCoord = input.TexCoord;
+
+    return output;
+}
+
+[maxvertexcount(3)]
+void GS_Passthrough3D(triangle VS_OUTPUT input[3], inout TriangleStream&lt;GS_OUTPUT&gt; outputStream)
+{
+    GS_OUTPUT output;
+
+    for (int i = 0; i &lt; 3; i++)
+    {
+        output.Position = input[i].Position;
+        output.Layer = input[i].Layer;
+        output.TexCoord = input[i].TexCoord;
+
+        outputStream.Append(output);
+    }
+}
+
+float4 PS_PassthroughRGBA3D(GS_OUTPUT input) : SV_TARGET0
+{
+    return TextureF.Sample(Sampler, input.TexCoord).rgba;
+}
+
+uint4 PS_PassthroughRGBA3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureUI.GetDimensions(size.x, size.y, size.z);
+
+    return TextureUI.Load(int4(size * input.TexCoord, 0)).rgba;
+}
+
+int4 PS_PassthroughRGBA3DI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureI.GetDimensions(size.x, size.y, size.z);
+
+    return TextureI.Load(int4(size * input.TexCoord, 0)).rgba;
+}
+
+float4 PS_PassthroughRGB3D(GS_OUTPUT input) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, input.TexCoord).rgb, 1.0f);
+}
+
+uint4 PS_PassthroughRGB3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureUI.GetDimensions(size.x, size.y, size.z);
+
+    return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
+}
+
+int4 PS_PassthroughRGB3DI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureI.GetDimensions(size.x, size.y, size.z);
+
+    return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rgb, 0);
+}
+
+float4 PS_PassthroughRG3D(GS_OUTPUT input) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, input.TexCoord).rg, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughRG3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureUI.GetDimensions(size.x, size.y, size.z);
+
+    return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
+}
+
+int4 PS_PassthroughRG3DI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureI.GetDimensions(size.x, size.y, size.z);
+
+    return int4(TextureI.Load(int4(size * input.TexCoord, 0)).rg, 0, 0);
+}
+
+float4 PS_PassthroughR3D(GS_OUTPUT input) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, input.TexCoord).r, 0.0f, 0.0f, 1.0f);
+}
+
+uint4 PS_PassthroughR3DUI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureUI.GetDimensions(size.x, size.y, size.z);
+
+    return uint4(TextureUI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
+}
+
+int4 PS_PassthroughR3DI(GS_OUTPUT input) : SV_TARGET0
+{
+    uint3 size;
+    TextureI.GetDimensions(size.x, size.y, size.z);
+
+    return int4(TextureI.Load(int4(size * input.TexCoord, 0)).r, 0, 0, 0);
+}
+
+float4 PS_PassthroughLum3D(GS_OUTPUT input) : SV_TARGET0
+{
+    return float4(TextureF.Sample(Sampler, input.TexCoord).rrr, 1.0f);
+}
+
+float4 PS_PassthroughLumAlpha3D(GS_OUTPUT input) : SV_TARGET0
+{
+    return TextureF.Sample(Sampler, input.TexCoord).rrra;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersSwizzle11hlsl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/Swizzle11.hlsl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+Texture2D&lt;float4&gt; TextureF2D  : register(t0);
+Texture2D&lt;uint4&gt;  TextureUI2D : register(t0);
+Texture2D&lt;int4&gt;   TextureI2D  : register(t0);
+
+Texture3D&lt;float4&gt; TextureF3D  : register(t0);
+Texture3D&lt;uint4&gt;  TextureUI3D : register(t0);
+Texture3D&lt;int4&gt;   TextureI3D  : register(t0);
+
+Texture2DArray&lt;float4&gt; TextureF2DArray  : register(t0);
+Texture2DArray&lt;uint4&gt;  TextureUI2DArray : register(t0);
+Texture2DArray&lt;int4&gt;   TextureI2DArray  : register(t0);
+
+SamplerState Sampler          : register(s0);
+
+cbuffer SwizzleProperties     : register(b0)
+{
+    uint4 SwizzleIndices      : packoffset(c0);
+}
+
+float4 SwizzleLookup(in float4 sample)
+{
+    float lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
+    return float4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
+}
+
+int4 SwizzleLookup(in int4 sample)
+{
+    int lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
+    return int4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
+}
+
+uint4 SwizzleLookup(in uint4 sample)
+{
+    uint lookup[6] = { sample[0], sample[1], sample[2], sample[3], 0.0f, 1.0f };
+    return uint4(lookup[SwizzleIndices[0]], lookup[SwizzleIndices[1]], lookup[SwizzleIndices[2]], lookup[SwizzleIndices[3]]);
+}
+
+float4 PS_SwizzleF2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return SwizzleLookup(TextureF2D.Sample(Sampler, inTexCoord));
+}
+
+int4 PS_SwizzleI2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureI2D.GetDimensions(size.x, size.y);
+
+    return SwizzleLookup(TextureI2D.Load(int3(size * inTexCoord, 0)));
+}
+
+uint4 PS_SwizzleUI2D(in float4 inPosition : SV_POSITION, in float2 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint2 size;
+    TextureUI2D.GetDimensions(size.x, size.y);
+
+    return SwizzleLookup(TextureUI2D.Load(int3(size * inTexCoord, 0)));
+}
+
+float4 PS_SwizzleF3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return SwizzleLookup(TextureF3D.Sample(Sampler, inTexCoord));
+}
+
+int4 PS_SwizzleI3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint3 size;
+    TextureI3D.GetDimensions(size.x, size.y, size.z);
+
+    return SwizzleLookup(TextureI3D.Load(int4(size * inTexCoord, 0)));
+}
+
+uint4 PS_SwizzleUI3D(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint3 size;
+    TextureUI3D.GetDimensions(size.x, size.y, size.z);
+
+    return SwizzleLookup(TextureUI3D.Load(int4(size * inTexCoord, 0)));
+}
+
+float4 PS_SwizzleF2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    return SwizzleLookup(TextureF2DArray.Sample(Sampler, float3(inTexCoord.xy, inLayer)));
+}
+
+int4 PS_SwizzleI2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint3 size;
+    TextureI2DArray.GetDimensions(size.x, size.y, size.z);
+
+    return SwizzleLookup(TextureI2DArray.Load(int4(size.xy * inTexCoord.xy, inLayer, 0)));
+}
+
+uint4 PS_SwizzleUI2DArray(in float4 inPosition : SV_POSITION, in uint inLayer : SV_RENDERTARGETARRAYINDEX, in float3 inTexCoord : TEXCOORD0) : SV_TARGET0
+{
+    uint3 size;
+    TextureUI2DArray.GetDimensions(size.x, size.y, size.z);
+
+    return SwizzleLookup(TextureUI2DArray.Load(int4(size.xy * inTexCoord.xy, inLayer, 0)));
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_gsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,165 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position              0   xyzw        0      POS   float   xyzw
+// TEXCOORD                 0   x           1     NONE    uint   x   
+// LAYER                    0    y          1     NONE    uint    y  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position              0   xyzw        0      POS   float   xyzw
+// TEXCOORD                 0   x           1     NONE    uint   x   
+// SV_RenderTargetArrayIndex     0    y          1  RTINDEX    uint    y  
+//
+gs_4_0
+dcl_input_siv v[1][0].xyzw, position
+dcl_input v[1][1].x
+dcl_input v[1][1].y
+dcl_inputprimitive point 
+dcl_outputtopology pointlist 
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output_siv o1.y, rendertarget_array_index
+dcl_maxout 1
+mov o0.xyzw, v[0][0].xyzw
+mov o1.x, v[0][1].x
+mov o1.y, v[0][1].y
+emit 
+ret 
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_GS_BufferToTexture[] =
+{
+     68,  88,  66,  67,  79, 166, 
+    191,  97,  16,  63, 142, 167, 
+    231,  92, 119,  74,  86,   7, 
+     58, 165,   1,   0,   0,   0, 
+    212,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0,   0,   1, 
+      0,   0, 136,   1,   0,   0, 
+     88,   2,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+     83,  71,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+    108,   0,   0,   0,   3,   0, 
+      0,   0,   8,   0,   0,   0, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,  15,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,   1,   1,   0,   0, 
+    101,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,   2,   2,   0,   0, 
+     83,  86,  95,  80, 111, 115, 
+    105, 116, 105, 111, 110,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0,  76,  65,  89, 
+     69,  82,   0, 171,  79,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,  14, 
+      0,   0, 101,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   2,  13, 
+      0,   0,  83,  86,  95,  80, 
+    111, 115, 105, 116, 105, 111, 
+    110,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0,  83, 
+     86,  95,  82, 101, 110, 100, 
+    101, 114,  84,  97, 114, 103, 
+    101, 116,  65, 114, 114,  97, 
+    121,  73, 110, 100, 101, 120, 
+      0, 171,  83,  72,  68,  82, 
+    200,   0,   0,   0,  64,   0, 
+      2,   0,  50,   0,   0,   0, 
+     97,   0,   0,   5, 242,  16, 
+     32,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  95,   0,   0,   4, 
+     18,  16,  32,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+     95,   0,   0,   4,  34,  16, 
+     32,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,  93,   8, 
+      0,   1,  92,   8,   0,   1, 
+    103,   0,   0,   4, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3,  18,  32,  16,   0, 
+      1,   0,   0,   0, 103,   0, 
+      0,   4,  34,  32,  16,   0, 
+      1,   0,   0,   0,   4,   0, 
+      0,   0,  94,   0,   0,   2, 
+      1,   0,   0,   0,  54,   0, 
+      0,   6, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  32,  16,   0, 
+      1,   0,   0,   0,  10,  16, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   6,  34,  32,  16,   0, 
+      1,   0,   0,   0,  26,  16, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  19,   0, 
+      0,   1,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   5,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_ps_4fh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,229 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer BufferCopyParams
+// {
+//
+//   uint FirstPixelOffset;             // Offset:    0 Size:     4 [unused]
+//   uint PixelsPerRow;                 // Offset:    4 Size:     4 [unused]
+//   uint RowStride;                    // Offset:    8 Size:     4 [unused]
+//   uint RowsPerSlice;                 // Offset:   12 Size:     4 [unused]
+//   float2 PositionOffset;             // Offset:   16 Size:     8 [unused]
+//   float2 PositionScale;              // Offset:   24 Size:     8 [unused]
+//   int2 TexLocationOffset;            // Offset:   32 Size:     8 [unused]
+//   int2 TexLocationScale;             // Offset:   40 Size:     8 [unused]
+//   uint FirstSlice;                   // Offset:   48 Size:     4 [unused]
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4F                          texture  float4         buf    0        1
+// BufferCopyParams                  cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position              0   xyzw        0      POS   float       
+// TEXCOORD                 0   x           1     NONE    uint   x   
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Target                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_buffer (float,float,float,float) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4F[] =
+{
+     68,  88,  66,  67, 176,  15, 
+     76, 123, 100,  38, 152,  23, 
+    150,  99, 165, 184, 222, 157, 
+    235,  80,   1,   0,   0,   0, 
+    252,   3,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   2,   0,   0, 228,   2, 
+      0,   0,  24,   3,   0,   0, 
+    128,   3,   0,   0,  82,  68, 
+     69,  70,  80,   2,   0,   0, 
+      1,   0,   0,   0, 120,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     28,   2,   0,   0,  92,   0, 
+      0,   0,   2,   0,   0,   0, 
+      5,   0,   0,   0,   1,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+    101,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  66, 117, 102, 102, 
+    101, 114,  52,  70,   0,  66, 
+    117, 102, 102, 101, 114,  67, 
+    111, 112, 121,  80,  97, 114, 
+     97, 109, 115,   0, 171, 171, 
+    101,   0,   0,   0,   9,   0, 
+      0,   0, 144,   0,   0,   0, 
+     64,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    104,   1,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0, 124,   1, 
+      0,   0,   0,   0,   0,   0, 
+    140,   1,   0,   0,   4,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0, 124,   1, 
+      0,   0,   0,   0,   0,   0, 
+    153,   1,   0,   0,   8,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0, 124,   1, 
+      0,   0,   0,   0,   0,   0, 
+    163,   1,   0,   0,  12,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0, 124,   1, 
+      0,   0,   0,   0,   0,   0, 
+    176,   1,   0,   0,  16,   0, 
+      0,   0,   8,   0,   0,   0, 
+      0,   0,   0,   0, 192,   1, 
+      0,   0,   0,   0,   0,   0, 
+    208,   1,   0,   0,  24,   0, 
+      0,   0,   8,   0,   0,   0, 
+      0,   0,   0,   0, 192,   1, 
+      0,   0,   0,   0,   0,   0, 
+    222,   1,   0,   0,  32,   0, 
+      0,   0,   8,   0,   0,   0, 
+      0,   0,   0,   0, 240,   1, 
+      0,   0,   0,   0,   0,   0, 
+      0,   2,   0,   0,  40,   0, 
+      0,   0,   8,   0,   0,   0, 
+      0,   0,   0,   0, 240,   1, 
+      0,   0,   0,   0,   0,   0, 
+     17,   2,   0,   0,  48,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0, 124,   1, 
+      0,   0,   0,   0,   0,   0, 
+     70, 105, 114, 115, 116,  80, 
+    105, 120, 101, 108,  79, 102, 
+    102, 115, 101, 116,   0, 171, 
+    171, 171,   0,   0,  19,   0, 
+      1,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     80, 105, 120, 101, 108, 115, 
+     80, 101, 114,  82, 111, 119, 
+      0,  82, 111, 119,  83, 116, 
+    114, 105, 100, 101,   0,  82, 
+    111, 119, 115,  80, 101, 114, 
+     83, 108, 105,  99, 101,   0, 
+     80, 111, 115, 105, 116, 105, 
+    111, 110,  79, 102, 102, 115, 
+    101, 116,   0, 171,   1,   0, 
+      3,   0,   1,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  80, 111, 115, 105, 
+    116, 105, 111, 110,  83,  99, 
+     97, 108, 101,   0,  84, 101, 
+    120,  76, 111,  99,  97, 116, 
+    105, 111, 110,  79, 102, 102, 
+    115, 101, 116,   0,   1,   0, 
+      2,   0,   1,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  84, 101, 120,  76, 
+    111,  99,  97, 116, 105, 111, 
+    110,  83,  99,  97, 108, 101, 
+      0,  70, 105, 114, 115, 116, 
+     83, 108, 105,  99, 101,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  54, 
+     46,  51,  46,  57,  54,  48, 
+     48,  46,  49,  54,  51,  56, 
+     52,   0, 171, 171,  73,  83, 
+     71,  78,  80,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   1, 
+      0,   0,  83,  86,  95,  80, 
+    111, 115, 105, 116, 105, 111, 
+    110,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  97, 114, 
+    103, 101, 116,   0, 171, 171, 
+     83,  72,  68,  82,  96,   0, 
+      0,   0,  64,   0,   0,   0, 
+     24,   0,   0,   0,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  88,   8,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  85,  85,   0,   0, 
+     98,   8,   0,   3,  18,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+     45,   0,   0,   7, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+      6,  16,  16,   0,   1,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_ps_4ih"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4I                          texture   sint4         buf    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position              0   xyzw        0      POS   float       
+// TEXCOORD                 0   x           1     NONE    uint   x   
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Target                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_buffer (sint,sint,sint,sint) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4I[] =
+{
+     68,  88,  66,  67, 154, 139, 
+     95, 210,  76,  52, 228,  55, 
+      1, 175,  60,  90,  13, 234, 
+    138,   3,   1,   0,   0,   0, 
+     20,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+    152,   1,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     66, 117, 102, 102, 101, 114, 
+     52,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   1,   0,   0,  83,  86, 
+     95,  80, 111, 115, 105, 116, 
+    105, 111, 110,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     97, 114, 103, 101, 116,   0, 
+    171, 171,  83,  72,  68,  82, 
+     80,   0,   0,   0,  64,   0, 
+      0,   0,  20,   0,   0,   0, 
+     88,   8,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,   8, 
+      0,   3,  18,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0,  45,   0, 
+      0,   7, 242,  32,  16,   0, 
+      0,   0,   0,   0,   6,  16, 
+     16,   0,   1,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_ps_4uih"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Buffer4UI                         texture   uint4         buf    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position              0   xyzw        0      POS   float       
+// TEXCOORD                 0   x           1     NONE    uint   x   
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Target                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_buffer (uint,uint,uint,uint) t0
+dcl_input_ps constant v1.x
+dcl_output o0.xyzw
+ld o0.xyzw, v1.xxxx, t0.xyzw
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_BufferToTexture_4UI[] =
+{
+     68,  88,  66,  67,  25, 164, 
+      1, 224, 250, 219,  16, 200, 
+     83,  99,  38, 137, 116, 129, 
+    200,  39,   1,   0,   0,   0, 
+     20,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+    152,   1,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     66, 117, 102, 102, 101, 114, 
+     52,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   1,   0,   0,  83,  86, 
+     95,  80, 111, 115, 105, 116, 
+    105, 111, 110,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     97, 114, 103, 101, 116,   0, 
+    171, 171,  83,  72,  68,  82, 
+     80,   0,   0,   0,  64,   0, 
+      0,   0,  20,   0,   0,   0, 
+     88,   8,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,   8, 
+      0,   3,  18,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0,  45,   0, 
+      0,   7, 242,  32,  16,   0, 
+      0,   0,   0,   0,   6,  16, 
+     16,   0,   1,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledbuffertotexture11_vsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,311 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer BufferCopyParams
+// {
+//
+//   uint FirstPixelOffset;             // Offset:    0 Size:     4
+//   uint PixelsPerRow;                 // Offset:    4 Size:     4
+//   uint RowStride;                    // Offset:    8 Size:     4
+//   uint RowsPerSlice;                 // Offset:   12 Size:     4
+//   float2 PositionOffset;             // Offset:   16 Size:     8
+//   float2 PositionScale;              // Offset:   24 Size:     8
+//   int2 TexLocationOffset;            // Offset:   32 Size:     8 [unused]
+//   int2 TexLocationScale;             // Offset:   40 Size:     8 [unused]
+//   uint FirstSlice;                   // Offset:   48 Size:     4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// BufferCopyParams                  cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_VertexID              0   x           0   VERTID    uint   x   
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_Position              0   xyzw        0      POS   float   xyzw
+// TEXCOORD                 0   x           1     NONE    uint   x   
+// LAYER                    0    y          1     NONE    uint    y  
+//
+vs_4_0
+dcl_constantbuffer cb0[4], immediateIndexed
+dcl_input_sgv v0.x, vertex_id
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output o1.y
+dcl_temps 2
+mov o0.zw, l(0,0,0,1.000000)
+imul null, r0.xy, cb0[0].wwww, cb0[0].yzyy
+udiv r0.z, null, v0.x, r0.x
+imad r0.x, -r0.z, r0.x, v0.x
+imad r0.y, r0.z, r0.y, cb0[0].x
+iadd o1.y, r0.z, cb0[3].x
+udiv r0.z, null, r0.x, cb0[0].y
+imad r0.x, -r0.z, cb0[0].y, r0.x
+utof r1.xy, r0.xzxx
+imad r0.y, r0.z, cb0[0].z, r0.y
+iadd o1.x, r0.x, r0.y
+mad o0.xy, cb0[1].zwzz, r1.xyxx, cb0[1].xyxx
+ret 
+// Approximately 13 instruction slots used
+#endif
+
+const BYTE g_VS_BufferToTexture[] =
+{
+     68,  88,  66,  67,  39, 207, 
+    138,  15,  42, 195, 141, 208, 
+      2, 107, 135, 197, 122,  36, 
+    114, 227,   1,   0,   0,   0, 
+    152,   5,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    100,   2,   0,   0, 152,   2, 
+      0,   0,  12,   3,   0,   0, 
+     28,   5,   0,   0,  82,  68, 
+     69,  70,  40,   2,   0,   0, 
+      1,   0,   0,   0,  80,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+    244,   1,   0,   0,  60,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+     66, 117, 102, 102, 101, 114, 
+     67, 111, 112, 121,  80,  97, 
+    114,  97, 109, 115,   0, 171, 
+    171, 171,  60,   0,   0,   0, 
+      9,   0,   0,   0, 104,   0, 
+      0,   0,  64,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  64,   1,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   2,   0,   0,   0, 
+     84,   1,   0,   0,   0,   0, 
+      0,   0, 100,   1,   0,   0, 
+      4,   0,   0,   0,   4,   0, 
+      0,   0,   2,   0,   0,   0, 
+     84,   1,   0,   0,   0,   0, 
+      0,   0, 113,   1,   0,   0, 
+      8,   0,   0,   0,   4,   0, 
+      0,   0,   2,   0,   0,   0, 
+     84,   1,   0,   0,   0,   0, 
+      0,   0, 123,   1,   0,   0, 
+     12,   0,   0,   0,   4,   0, 
+      0,   0,   2,   0,   0,   0, 
+     84,   1,   0,   0,   0,   0, 
+      0,   0, 136,   1,   0,   0, 
+     16,   0,   0,   0,   8,   0, 
+      0,   0,   2,   0,   0,   0, 
+    152,   1,   0,   0,   0,   0, 
+      0,   0, 168,   1,   0,   0, 
+     24,   0,   0,   0,   8,   0, 
+      0,   0,   2,   0,   0,   0, 
+    152,   1,   0,   0,   0,   0, 
+      0,   0, 182,   1,   0,   0, 
+     32,   0,   0,   0,   8,   0, 
+      0,   0,   0,   0,   0,   0, 
+    200,   1,   0,   0,   0,   0, 
+      0,   0, 216,   1,   0,   0, 
+     40,   0,   0,   0,   8,   0, 
+      0,   0,   0,   0,   0,   0, 
+    200,   1,   0,   0,   0,   0, 
+      0,   0, 233,   1,   0,   0, 
+     48,   0,   0,   0,   4,   0, 
+      0,   0,   2,   0,   0,   0, 
+     84,   1,   0,   0,   0,   0, 
+      0,   0,  70, 105, 114, 115, 
+    116,  80, 105, 120, 101, 108, 
+     79, 102, 102, 115, 101, 116, 
+      0, 171, 171, 171,   0,   0, 
+     19,   0,   1,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  80, 105, 120, 101, 
+    108, 115,  80, 101, 114,  82, 
+    111, 119,   0,  82, 111, 119, 
+     83, 116, 114, 105, 100, 101, 
+      0,  82, 111, 119, 115,  80, 
+    101, 114,  83, 108, 105,  99, 
+    101,   0,  80, 111, 115, 105, 
+    116, 105, 111, 110,  79, 102, 
+    102, 115, 101, 116,   0, 171, 
+      1,   0,   3,   0,   1,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  80, 111, 
+    115, 105, 116, 105, 111, 110, 
+     83,  99,  97, 108, 101,   0, 
+     84, 101, 120,  76, 111,  99, 
+     97, 116, 105, 111, 110,  79, 
+    102, 102, 115, 101, 116,   0, 
+      1,   0,   2,   0,   1,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  84, 101, 
+    120,  76, 111,  99,  97, 116, 
+    105, 111, 110,  83,  99,  97, 
+    108, 101,   0,  70, 105, 114, 
+    115, 116,  83, 108, 105,  99, 
+    101,   0,  77, 105,  99, 114, 
+    111, 115, 111, 102, 116,  32, 
+     40,  82,  41,  32,  72,  76, 
+     83,  76,  32,  83, 104,  97, 
+    100, 101, 114,  32,  67, 111, 
+    109, 112, 105, 108, 101, 114, 
+     32,  54,  46,  51,  46,  57, 
+     54,  48,  48,  46,  49,  54, 
+     51,  56,  52,   0, 171, 171, 
+     73,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   1,   0,   0,  83,  86, 
+     95,  86, 101, 114, 116, 101, 
+    120,  73,  68,   0,  79,  83, 
+     71,  78, 108,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,  14, 
+      0,   0, 101,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   2,  13, 
+      0,   0,  83,  86,  95,  80, 
+    111, 115, 105, 116, 105, 111, 
+    110,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0,  76, 
+     65,  89,  69,  82,   0, 171, 
+     83,  72,  68,  82,   8,   2, 
+      0,   0,  64,   0,   1,   0, 
+    130,   0,   0,   0,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,  96,   0,   0,   4, 
+     18,  16,  16,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+    103,   0,   0,   4, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3,  18,  32,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3,  34,  32,  16,   0, 
+      1,   0,   0,   0, 104,   0, 
+      0,   2,   2,   0,   0,   0, 
+     54,   0,   0,   8, 194,  32, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    128,  63,  38,   0,   0,  10, 
+      0, 208,   0,   0,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+    246, 143,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    150, 133,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     78,   0,   0,   8,  66,   0, 
+     16,   0,   0,   0,   0,   0, 
+      0, 208,   0,   0,  10,  16, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  35,   0,   0,  10, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  42,   0,  16, 128, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  10,  16, 
+     16,   0,   0,   0,   0,   0, 
+     35,   0,   0,  10,  34,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42,   0,  16,   0,   0,   0, 
+      0,   0,  26,   0,  16,   0, 
+      0,   0,   0,   0,  10, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  30,   0, 
+      0,   8,  34,  32,  16,   0, 
+      1,   0,   0,   0,  42,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10, 128,  32,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+     78,   0,   0,   9,  66,   0, 
+     16,   0,   0,   0,   0,   0, 
+      0, 208,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     26, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     35,   0,   0,  11,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42,   0,  16, 128,  65,   0, 
+      0,   0,   0,   0,   0,   0, 
+     26, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  86,   0,   0,   5, 
+     50,   0,  16,   0,   1,   0, 
+      0,   0, 134,   0,  16,   0, 
+      0,   0,   0,   0,  35,   0, 
+      0,  10,  34,   0,  16,   0, 
+      0,   0,   0,   0,  42,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     26,   0,  16,   0,   0,   0, 
+      0,   0,  30,   0,   0,   7, 
+     18,  32,  16,   0,   1,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     50,   0,   0,  11,  50,  32, 
+     16,   0,   0,   0,   0,   0, 
+    230, 138,  32,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     70,   0,  16,   0,   1,   0, 
+      0,   0,  70, 128,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  13,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   7,   0, 
+      0,   0,   2,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearfloat11_fl9psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11_fl9ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,176 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// COLOR                    0   xyzw        1     NONE   float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+// SV_TARGET                1   xyzw        1   TARGET   float   xyzw
+// SV_TARGET                2   xyzw        2   TARGET   float   xyzw
+// SV_TARGET                3   xyzw        3   TARGET   float   xyzw
+//
+//
+// Level9 shader bytecode:
+//
+    ps_2_x
+    dcl t0
+    mov oC0, t0
+    mov oC1, t0
+    mov oC2, t0
+    mov oC3, t0
+
+// approximately 4 instruction slots used
+ps_4_0
+dcl_input_ps linear v1.xyzw
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+mov o0.xyzw, v1.xyzw
+mov o1.xyzw, v1.xyzw
+mov o2.xyzw, v1.xyzw
+mov o3.xyzw, v1.xyzw
+ret 
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat_FL9[] =
+{
+     68,  88,  66,  67,  36, 167, 
+     59,  21, 253,  46, 206, 132, 
+    254,  28,  18, 118,  51, 115, 
+     45,  31,   1,   0,   0,   0, 
+    236,   2,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    168,   0,   0,   0,  72,   1, 
+      0,   0, 196,   1,   0,   0, 
+     28,   2,   0,   0, 112,   2, 
+      0,   0,  65, 111, 110,  57, 
+    104,   0,   0,   0, 104,   0, 
+      0,   0,   0,   2, 255, 255, 
+     68,   0,   0,   0,  36,   0, 
+      0,   0,   0,   0,  36,   0, 
+      0,   0,  36,   0,   0,   0, 
+     36,   0,   0,   0,  36,   0, 
+      0,   0,  36,   0,   1,   2, 
+    255, 255,  31,   0,   0,   2, 
+      0,   0,   0, 128,   0,   0, 
+     15, 176,   1,   0,   0,   2, 
+      0,   8,  15, 128,   0,   0, 
+    228, 176,   1,   0,   0,   2, 
+      1,   8,  15, 128,   0,   0, 
+    228, 176,   1,   0,   0,   2, 
+      2,   8,  15, 128,   0,   0, 
+    228, 176,   1,   0,   0,   2, 
+      3,   8,  15, 128,   0,   0, 
+    228, 176, 255, 255,   0,   0, 
+     83,  72,  68,  82, 152,   0, 
+      0,   0,  64,   0,   0,   0, 
+     38,   0,   0,   0,  98,  16, 
+      0,   3, 242,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      3,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   2,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      3,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      5,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      5,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  82,  68,  69,  70, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  28,   0, 
+      0,   0,   0,   4, 255, 255, 
+      0,   1,   0,   0,  28,   0, 
+      0,   0,  77, 105,  99, 114, 
+    111, 115, 111, 102, 116,  32, 
+     40,  82,  41,  32,  72,  76, 
+     83,  76,  32,  83, 104,  97, 
+    100, 101, 114,  32,  67, 111, 
+    109, 112, 105, 108, 101, 114, 
+     32,  54,  46,  51,  46,  57, 
+     54,  48,  48,  46,  49,  54, 
+     51,  56,  52,   0, 171, 171, 
+     73,  83,  71,  78,  76,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+     15,  15,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  67,  79, 
+     76,  79,  82,   0, 171, 171, 
+     79,  83,  71,  78, 116,   0, 
+      0,   0,   4,   0,   0,   0, 
+      8,   0,   0,   0, 104,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0, 104,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+     15,   0,   0,   0, 104,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+     15,   0,   0,   0, 104,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   3,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearfloat11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// COLOR                    0   xyzw        1     NONE   float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+// SV_TARGET                1   xyzw        1   TARGET   float   xyzw
+// SV_TARGET                2   xyzw        2   TARGET   float   xyzw
+// SV_TARGET                3   xyzw        3   TARGET   float   xyzw
+// SV_TARGET                4   xyzw        4   TARGET   float   xyzw
+// SV_TARGET                5   xyzw        5   TARGET   float   xyzw
+// SV_TARGET                6   xyzw        6   TARGET   float   xyzw
+// SV_TARGET                7   xyzw        7   TARGET   float   xyzw
+//
+ps_4_0
+dcl_input_ps linear v1.xyzw
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+mov o0.xyzw, v1.xyzw
+mov o1.xyzw, v1.xyzw
+mov o2.xyzw, v1.xyzw
+mov o3.xyzw, v1.xyzw
+mov o4.xyzw, v1.xyzw
+mov o5.xyzw, v1.xyzw
+mov o6.xyzw, v1.xyzw
+mov o7.xyzw, v1.xyzw
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearFloat[] =
+{
+     68,  88,  66,  67,  19,  30, 
+    102,  69, 166, 219, 165,  14, 
+    173,  41, 171, 133, 144,  58, 
+     14, 224,   1,   0,   0,   0, 
+     88,   3,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 224,   0, 
+      0,   0, 188,   1,   0,   0, 
+    220,   2,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     67,  79,  76,  79,  82,   0, 
+    171, 171,  79,  83,  71,  78, 
+    212,   0,   0,   0,   8,   0, 
+      0,   0,   8,   0,   0,   0, 
+    200,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   3,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   4,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   5,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   5,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   6,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   6,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   7,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   7,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  24,   1, 
+      0,   0,  64,   0,   0,   0, 
+     70,   0,   0,   0,  98,  16, 
+      0,   3, 242,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      3,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      4,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      5,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      6,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      7,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   2,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      3,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   4,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   5,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      6,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   7,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   9,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   9,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      8,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearfloat11vsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,175 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION                 0   xyz         0     NONE   float   xyz 
+// COLOR                    0   xyzw        1     NONE   float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float   xyzw
+// COLOR                    0   xyzw        1     NONE   float   xyzw
+//
+//
+// Runtime generated constant mappings:
+//
+// Target Reg                               Constant Description
+// ---------- --------------------------------------------------
+// c0                              Vertex Shader position offset
+//
+//
+// Level9 shader bytecode:
+//
+    vs_2_x
+    def c1, 1, 0, 0, 0
+    dcl_texcoord v0
+    dcl_texcoord1 v1
+    add oPos.xy, v0, c0
+    mad oPos.zw, v0.z, c1.xyxy, c1.xyyx
+    mov oT0, v1
+
+// approximately 3 instruction slots used
+vs_4_0
+dcl_input v0.xyz
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+mov o0.xyz, v0.xyzx
+mov o0.w, l(1.000000)
+mov o1.xyzw, v1.xyzw
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_ClearFloat[] =
+{
+     68,  88,  66,  67, 254, 253, 
+    200, 174,  22,  35,  97, 190, 
+    187, 200, 253, 161, 246,  45, 
+     67,  66,   1,   0,   0,   0, 
+    204,   2,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    208,   0,   0,   0,  84,   1, 
+      0,   0, 208,   1,   0,   0, 
+     40,   2,   0,   0, 120,   2, 
+      0,   0,  65, 111, 110,  57, 
+    144,   0,   0,   0, 144,   0, 
+      0,   0,   0,   2, 254, 255, 
+    104,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  36,   0, 
+      0,   0,  36,   0,   0,   0, 
+     36,   0,   0,   0,  36,   0, 
+      1,   0,  36,   0,   0,   0, 
+      0,   0,   1,   2, 254, 255, 
+     81,   0,   0,   5,   1,   0, 
+     15, 160,   0,   0, 128,  63, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     31,   0,   0,   2,   5,   0, 
+      0, 128,   0,   0,  15, 144, 
+     31,   0,   0,   2,   5,   0, 
+      1, 128,   1,   0,  15, 144, 
+      2,   0,   0,   3,   0,   0, 
+      3, 192,   0,   0, 228, 144, 
+      0,   0, 228, 160,   4,   0, 
+      0,   4,   0,   0,  12, 192, 
+      0,   0, 170, 144,   1,   0, 
+     68, 160,   1,   0,  20, 160, 
+      1,   0,   0,   2,   0,   0, 
+     15, 224,   1,   0, 228, 144, 
+    255, 255,   0,   0,  83,  72, 
+     68,  82, 124,   0,   0,   0, 
+     64,   0,   1,   0,  31,   0, 
+      0,   0,  95,   0,   0,   3, 
+    114,  16,  16,   0,   0,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   1,   0, 
+      0,   0, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    130,  32,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0, 128,  63,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      1,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  82,  68,  69,  70, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  28,   0, 
+      0,   0,   0,   4, 254, 255, 
+      0,   1,   0,   0,  28,   0, 
+      0,   0,  77, 105,  99, 114, 
+    111, 115, 111, 102, 116,  32, 
+     40,  82,  41,  32,  72,  76, 
+     83,  76,  32,  83, 104,  97, 
+    100, 101, 114,  32,  67, 111, 
+    109, 112, 105, 108, 101, 114, 
+     32,  54,  46,  51,  46,  57, 
+     54,  48,  48,  46,  49,  54, 
+     51,  56,  52,   0, 171, 171, 
+     73,  83,  71,  78,  72,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      7,   7,   0,   0,  65,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+     15,  15,   0,   0,  80,  79, 
+     83,  73,  84,  73,  79,  78, 
+      0,  67,  79,  76,  79,  82, 
+      0, 171,  79,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     67,  79,  76,  79,  82,   0, 
+    171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearsint11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// COLOR                    0   xyzw        1     NONE     int   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+// SV_TARGET                1   xyzw        1   TARGET     int   xyzw
+// SV_TARGET                2   xyzw        2   TARGET     int   xyzw
+// SV_TARGET                3   xyzw        3   TARGET     int   xyzw
+// SV_TARGET                4   xyzw        4   TARGET     int   xyzw
+// SV_TARGET                5   xyzw        5   TARGET     int   xyzw
+// SV_TARGET                6   xyzw        6   TARGET     int   xyzw
+// SV_TARGET                7   xyzw        7   TARGET     int   xyzw
+//
+ps_4_0
+dcl_input_ps constant v1.xyzw
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+mov o0.xyzw, v1.xyzw
+mov o1.xyzw, v1.xyzw
+mov o2.xyzw, v1.xyzw
+mov o3.xyzw, v1.xyzw
+mov o4.xyzw, v1.xyzw
+mov o5.xyzw, v1.xyzw
+mov o6.xyzw, v1.xyzw
+mov o7.xyzw, v1.xyzw
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearSint[] =
+{
+     68,  88,  66,  67, 206, 129, 
+    255, 236, 115, 217, 216,  20, 
+     88,  47, 155, 195, 145, 179, 
+    183,  28,   1,   0,   0,   0, 
+     88,   3,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 224,   0, 
+      0,   0, 188,   1,   0,   0, 
+    220,   2,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     67,  79,  76,  79,  82,   0, 
+    171, 171,  79,  83,  71,  78, 
+    212,   0,   0,   0,   8,   0, 
+      0,   0,   8,   0,   0,   0, 
+    200,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   1,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   2,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   3,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   4,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   5,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   5,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   6,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   6,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   7,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   7,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  24,   1, 
+      0,   0,  64,   0,   0,   0, 
+     70,   0,   0,   0,  98,   8, 
+      0,   3, 242,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      3,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      4,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      5,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      6,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      7,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   2,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      3,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   4,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   5,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      6,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   7,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   9,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   9,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      8,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearsint11vsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,130 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION                 0   xyz         0     NONE   float   xyz 
+// COLOR                    0   xyzw        1     NONE     int   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float   xyzw
+// COLOR                    0   xyzw        1     NONE     int   xyzw
+//
+vs_4_0
+dcl_input v0.xyz
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+mov o0.xyz, v0.xyzx
+mov o0.w, l(1.000000)
+mov o1.xyzw, v1.xyzw
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_ClearSint[] =
+{
+     68,  88,  66,  67,  20, 240, 
+     85, 136, 255, 181, 253, 103, 
+    207, 181, 122, 106,  92,  25, 
+    228,  89,   1,   0,   0,   0, 
+     48,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 220,   0, 
+      0,   0,  48,   1,   0,   0, 
+    180,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+     72,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   7,   7,   0,   0, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0,  67,  79,  76, 
+     79,  82,   0, 171,  79,  83, 
+     71,  78,  76,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      1,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  67,  79,  76,  79, 
+     82,   0, 171, 171,  83,  72, 
+     68,  82, 124,   0,   0,   0, 
+     64,   0,   1,   0,  31,   0, 
+      0,   0,  95,   0,   0,   3, 
+    114,  16,  16,   0,   0,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   1,   0, 
+      0,   0, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    130,  32,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0, 128,  63,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      1,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearuint11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,195 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// COLOR                    0   xyzw        1     NONE    uint   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+// SV_TARGET                1   xyzw        1   TARGET    uint   xyzw
+// SV_TARGET                2   xyzw        2   TARGET    uint   xyzw
+// SV_TARGET                3   xyzw        3   TARGET    uint   xyzw
+// SV_TARGET                4   xyzw        4   TARGET    uint   xyzw
+// SV_TARGET                5   xyzw        5   TARGET    uint   xyzw
+// SV_TARGET                6   xyzw        6   TARGET    uint   xyzw
+// SV_TARGET                7   xyzw        7   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_input_ps constant v1.xyzw
+dcl_output o0.xyzw
+dcl_output o1.xyzw
+dcl_output o2.xyzw
+dcl_output o3.xyzw
+dcl_output o4.xyzw
+dcl_output o5.xyzw
+dcl_output o6.xyzw
+dcl_output o7.xyzw
+mov o0.xyzw, v1.xyzw
+mov o1.xyzw, v1.xyzw
+mov o2.xyzw, v1.xyzw
+mov o3.xyzw, v1.xyzw
+mov o4.xyzw, v1.xyzw
+mov o5.xyzw, v1.xyzw
+mov o6.xyzw, v1.xyzw
+mov o7.xyzw, v1.xyzw
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_ClearUint[] =
+{
+     68,  88,  66,  67, 117, 209, 
+    142, 159,  65,  29, 212, 206, 
+    242,  37, 169,  58,  35, 236, 
+    222,  73,   1,   0,   0,   0, 
+     88,   3,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 224,   0, 
+      0,   0, 188,   1,   0,   0, 
+    220,   2,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     67,  79,  76,  79,  82,   0, 
+    171, 171,  79,  83,  71,  78, 
+    212,   0,   0,   0,   8,   0, 
+      0,   0,   8,   0,   0,   0, 
+    200,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   2,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   4,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   5,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   5,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   6,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   6,   0, 
+      0,   0,  15,   0,   0,   0, 
+    200,   0,   0,   0,   7,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   7,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  24,   1, 
+      0,   0,  64,   0,   0,   0, 
+     70,   0,   0,   0,  98,   8, 
+      0,   3, 242,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      3,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      4,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      5,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      6,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      7,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   2,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      3,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   4,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   5,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      6,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   7,   0,   0,   0, 
+     70,  30,  16,   0,   1,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   9,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   9,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      8,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledclearuint11vsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,130 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION                 0   xyz         0     NONE   float   xyz 
+// COLOR                    0   xyzw        1     NONE    uint   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float   xyzw
+// COLOR                    0   xyzw        1     NONE    uint   xyzw
+//
+vs_4_0
+dcl_input v0.xyz
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+mov o0.xyz, v0.xyzx
+mov o0.w, l(1.000000)
+mov o1.xyzw, v1.xyzw
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_ClearUint[] =
+{
+     68,  88,  66,  67,  62, 191, 
+     52,  95,  60,  98, 193,  75, 
+    194,  36, 187, 194,  54,  24, 
+    232, 224,   1,   0,   0,   0, 
+     48,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 220,   0, 
+      0,   0,  48,   1,   0,   0, 
+    180,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+     72,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   7,   7,   0,   0, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0,  67,  79,  76, 
+     79,  82,   0, 171,  79,  83, 
+     71,  78,  76,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  67,  79,  76,  79, 
+     82,   0, 171, 171,  83,  72, 
+     68,  82, 124,   0,   0,   0, 
+     64,   0,   1,   0,  31,   0, 
+      0,   0,  95,   0,   0,   3, 
+    114,  16,  16,   0,   0,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   1,   0, 
+      0,   0, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    130,  32,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0, 128,  63,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      1,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthrough2d11vsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,177 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION                 0   xy          0     NONE   float   xy  
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float   xyzw
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Runtime generated constant mappings:
+//
+// Target Reg                               Constant Description
+// ---------- --------------------------------------------------
+// c0                              Vertex Shader position offset
+//
+//
+// Level9 shader bytecode:
+//
+    vs_2_x
+    def c1, 0, 1, 0, 0
+    dcl_texcoord v0
+    dcl_texcoord1 v1
+    add oPos.xy, v0, c0
+    mov oPos.zw, c1.xyxy
+    mov oT0.xy, v1
+
+// approximately 3 instruction slots used
+vs_4_0
+dcl_input v0.xy
+dcl_input v1.xy
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xy
+mov o0.xy, v0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+mov o1.xy, v1.xyxx
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_VS_Passthrough2D[] =
+{
+     68,  88,  66,  67, 230,  95, 
+    115, 230,  65, 211,  74,  82, 
+    143, 170, 109, 175,  63, 210, 
+     14, 229,   1,   0,   0,   0, 
+    216,   2,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    200,   0,   0,   0,  88,   1, 
+      0,   0, 212,   1,   0,   0, 
+     44,   2,   0,   0, 128,   2, 
+      0,   0,  65, 111, 110,  57, 
+    136,   0,   0,   0, 136,   0, 
+      0,   0,   0,   2, 254, 255, 
+     96,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  36,   0, 
+      0,   0,  36,   0,   0,   0, 
+     36,   0,   0,   0,  36,   0, 
+      1,   0,  36,   0,   0,   0, 
+      0,   0,   1,   2, 254, 255, 
+     81,   0,   0,   5,   1,   0, 
+     15, 160,   0,   0,   0,   0, 
+      0,   0, 128,  63,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     31,   0,   0,   2,   5,   0, 
+      0, 128,   0,   0,  15, 144, 
+     31,   0,   0,   2,   5,   0, 
+      1, 128,   1,   0,  15, 144, 
+      2,   0,   0,   3,   0,   0, 
+      3, 192,   0,   0, 228, 144, 
+      0,   0, 228, 160,   1,   0, 
+      0,   2,   0,   0,  12, 192, 
+      1,   0,  68, 160,   1,   0, 
+      0,   2,   0,   0,   3, 224, 
+      1,   0, 228, 144, 255, 255, 
+      0,   0,  83,  72,  68,  82, 
+    136,   0,   0,   0,  64,   0, 
+      1,   0,  34,   0,   0,   0, 
+     95,   0,   0,   3,  50,  16, 
+     16,   0,   0,   0,   0,   0, 
+     95,   0,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    103,   0,   0,   4, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3,  50,  32,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5,  50,  32,  16,   0, 
+      0,   0,   0,   0,  70,  16, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,  32, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    128,  63,  54,   0,   0,   5, 
+     50,  32,  16,   0,   1,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     82,  68,  69,  70,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  28,   0,   0,   0, 
+      0,   4, 254, 255,   0,   1, 
+      0,   0,  28,   0,   0,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  54, 
+     46,  51,  46,  57,  54,  48, 
+     48,  46,  49,  54,  51,  56, 
+     52,   0, 171, 171,  73,  83, 
+     71,  78,  76,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   3,   3, 
+      0,   0,  65,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   3,   3, 
+      0,   0,  80,  79,  83,  73, 
+     84,  73,  79,  78,   0,  84, 
+     69,  88,  67,  79,  79,  82, 
+     68,   0, 171, 171,  79,  83, 
+     71,  78,  80,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   3,  12, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+    171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthrough3d11gsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,191 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float   xyzw
+// LAYER                    0   x           1     NONE    uint   x   
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float   xyzw
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint   x   
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+gs_4_0
+dcl_input_siv v[3][0].xyzw, position
+dcl_input v[3][1].x
+dcl_input v[3][2].xyz
+dcl_temps 1
+dcl_inputprimitive triangle 
+dcl_outputtopology trianglestrip 
+dcl_output_siv o0.xyzw, position
+dcl_output_siv o1.x, rendertarget_array_index
+dcl_output o2.xyz
+dcl_maxout 3
+mov r0.x, l(0)
+loop 
+  ige r0.y, r0.x, l(3)
+  breakc_nz r0.y
+  mov o0.xyzw, v[r0.x + 0][0].xyzw
+  mov o1.x, v[r0.x + 0][1].x
+  mov o2.xyz, v[r0.x + 0][2].xyzx
+  emit 
+  iadd r0.x, r0.x, l(1)
+endloop 
+ret 
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_GS_Passthrough3D[] =
+{
+     68,  88,  66,  67,  92, 129, 
+     41, 170, 114,  75, 160, 250, 
+     95, 161, 230, 161,  11,  78, 
+    252,  65,   1,   0,   0,   0, 
+     72,   3,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0,   0,   1, 
+      0,   0, 136,   1,   0,   0, 
+    204,   2,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+     83,  71,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+    108,   0,   0,   0,   3,   0, 
+      0,   0,   8,   0,   0,   0, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,  15,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,   1,   1,   0,   0, 
+     98,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,   7,   7,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     76,  65,  89,  69,  82,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,  14, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   8, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  83,  72,  68,  82, 
+     60,   1,   0,   0,  64,   0, 
+      2,   0,  79,   0,   0,   0, 
+     97,   0,   0,   5, 242,  16, 
+     32,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  95,   0,   0,   4, 
+     18,  16,  32,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+     95,   0,   0,   4, 114,  16, 
+     32,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     93,  24,   0,   1,  92,  40, 
+      0,   1, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    103,   0,   0,   4,  18,  32, 
+     16,   0,   1,   0,   0,   0, 
+      4,   0,   0,   0, 101,   0, 
+      0,   3, 114,  32,  16,   0, 
+      2,   0,   0,   0,  94,   0, 
+      0,   2,   3,   0,   0,   0, 
+     54,   0,   0,   5,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  48,   0,   0,   1, 
+     33,   0,   0,   7,  34,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      3,   0,   0,   0,   3,   0, 
+      4,   3,  26,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+    160,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     18,  32,  16,   0,   1,   0, 
+      0,   0,  10,  16, 160,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     54,   0,   0,   7, 114,  32, 
+     16,   0,   2,   0,   0,   0, 
+     70,  18, 160,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  19,   0, 
+      0,   1,  30,   0,   0,   7, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,   1,  64, 
+      0,   0,   1,   0,   0,   0, 
+     22,   0,   0,   1,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,  11,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   6,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   5,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthrough3d11vsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,155 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// POSITION                 0   xy          0     NONE   float   xy  
+// LAYER                    0   x           1     NONE    uint   x   
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float   xyzw
+// LAYER                    0   x           1     NONE    uint   x   
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+vs_4_0
+dcl_input v0.xy
+dcl_input v1.x
+dcl_input v2.xyz
+dcl_output_siv o0.xyzw, position
+dcl_output o1.x
+dcl_output o2.xyz
+mov o0.xy, v0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+mov o1.x, v1.x
+mov o2.xyz, v2.xyzx
+ret 
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_VS_Passthrough3D[] =
+{
+     68,  88,  66,  67, 229,  65, 
+    217, 172, 143, 180, 152,  72, 
+     16,  12, 254,  66,   0, 215, 
+     50, 173,   1,   0,   0,   0, 
+    168,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 252,   0, 
+      0,   0, 112,   1,   0,   0, 
+     44,   2,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+    104,   0,   0,   0,   3,   0, 
+      0,   0,   8,   0,   0,   0, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   3,   3,   0,   0, 
+     89,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,   1,   1,   0,   0, 
+     95,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,   7,   7,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0,  76,  65,  89, 
+     69,  82,   0,  84,  69,  88, 
+     67,  79,  79,  82,  68,   0, 
+     79,  83,  71,  78, 108,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,  14,   0,   0,  98,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   8,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  76,  65, 
+     89,  69,  82,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  83,  72,  68,  82, 
+    180,   0,   0,   0,  64,   0, 
+      1,   0,  45,   0,   0,   0, 
+     95,   0,   0,   3,  50,  16, 
+     16,   0,   0,   0,   0,   0, 
+     95,   0,   0,   3,  18,  16, 
+     16,   0,   1,   0,   0,   0, 
+     95,   0,   0,   3, 114,  16, 
+     16,   0,   2,   0,   0,   0, 
+    103,   0,   0,   4, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3,  18,  32,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 114,  32,  16,   0, 
+      2,   0,   0,   0,  54,   0, 
+      0,   5,  50,  32,  16,   0, 
+      0,   0,   0,   0,  70,  16, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,  32, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    128,  63,  54,   0,   0,   5, 
+     18,  32,  16,   0,   1,   0, 
+      0,   0,  10,  16,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 114,  32,  16,   0, 
+      2,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      5,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughdepth2d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,145 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_DEPTH                 0    N/A   oDepth    DEPTH   float    YES
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output oDepth
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov oDepth, r0.x
+ret 
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughDepth2D[] =
+{
+     68,  88,  66,  67,   8,  33, 
+    154,  92, 164,  28, 139, 205, 
+      1, 168,  30, 229,  51, 127, 
+    173, 221,   1,   0,   0,   0, 
+    100,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    220,   0,   0,   0,  52,   1, 
+      0,   0, 104,   1,   0,   0, 
+    232,   1,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      4,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78,  80,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   3,   3, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0, 255, 255, 
+    255, 255,   1,  14,   0,   0, 
+     83,  86,  95,  68,  69,  80, 
+     84,  72,   0, 171, 171, 171, 
+     83,  72,  68,  82, 120,   0, 
+      0,   0,  64,   0,   0,   0, 
+     30,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  24, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0,  98,  16,   0,   3, 
+     50,  16,  16,   0,   1,   0, 
+      0,   0, 101,   0,   0,   2, 
+      1, 192,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     69,   0,   0,   9, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  16,  16,   0,   1,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   4,   1, 192, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlum2d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler  Source Resource
+// -------------- --------------- ----------------
+// s0             s0              t0               
+//
+//
+// Level9 shader bytecode:
+//
+    ps_2_x
+    def c0, 1, 0, 0, 0
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mad r0, r0.x, c0.xxxy, c0.yyyx
+    mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xyz, r0.xxxx
+mov o0.w, l(1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLum2D[] =
+{
+     68,  88,  66,  67, 144,  18, 
+    242,  89, 150, 125,  18, 219, 
+    193, 196, 127, 207,  14, 165, 
+    198, 119,   1,   0,   0,   0, 
+     28,   3,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    208,   0,   0,   0, 108,   1, 
+      0,   0, 232,   1,   0,   0, 
+    144,   2,   0,   0, 232,   2, 
+      0,   0,  65, 111, 110,  57, 
+    144,   0,   0,   0, 144,   0, 
+      0,   0,   0,   2, 255, 255, 
+    104,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  40,   0, 
+      0,   0,  40,   0,   0,   0, 
+     40,   0,   1,   0,  36,   0, 
+      0,   0,  40,   0,   0,   0, 
+      0,   0,   1,   2, 255, 255, 
+     81,   0,   0,   5,   0,   0, 
+     15, 160,   0,   0, 128,  63, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     31,   0,   0,   2,   0,   0, 
+      0, 128,   0,   0,   3, 176, 
+     31,   0,   0,   2,   0,   0, 
+      0, 144,   0,   8,  15, 160, 
+     66,   0,   0,   3,   0,   0, 
+     15, 128,   0,   0, 228, 176, 
+      0,   8, 228, 160,   4,   0, 
+      0,   4,   0,   0,  15, 128, 
+      0,   0,   0, 128,   0,   0, 
+     64, 160,   0,   0,  21, 160, 
+      1,   0,   0,   2,   0,   8, 
+     15, 128,   0,   0, 228, 128, 
+    255, 255,   0,   0,  83,  72, 
+     68,  82, 148,   0,   0,   0, 
+     64,   0,   0,   0,  37,   0, 
+      0,   0,  90,   0,   0,   3, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  85,  85,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0,  69,   0,   0,   9, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    114,  32,  16,   0,   0,   0, 
+      0,   0,   6,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 130,  32,  16,   0, 
+      0,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0, 128,  63, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  82,  68,  69,  70, 
+    160,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  28,   0, 
+      0,   0,   0,   4, 255, 255, 
+      0,   1,   0,   0, 109,   0, 
+      0,   0,  92,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 100,   0, 
+      0,   0,   2,   0,   0,   0, 
+      5,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     83,  97, 109, 112, 108, 101, 
+    114,   0,  84, 101, 120, 116, 
+    117, 114, 101,  70,   0,  77, 
+    105,  99, 114, 111, 115, 111, 
+    102, 116,  32,  40,  82,  41, 
+     32,  72,  76,  83,  76,  32, 
+     83, 104,  97, 100, 101, 114, 
+     32,  67, 111, 109, 112, 105, 
+    108, 101, 114,  32,  54,  46, 
+     51,  46,  57,  54,  48,  48, 
+     46,  49,  54,  51,  56,  52, 
+      0, 171,  73,  83,  71,  78, 
+     80,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlum3d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,160 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xxxx
+mov o0.w, l(1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLum3D[] =
+{
+     68,  88,  66,  67, 173, 177, 
+    219,  35, 149, 130,  33, 215, 
+    183, 219, 250, 244, 100,  17, 
+     62, 106,   1,   0,   0,   0, 
+    176,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    220,   0,   0,   0, 100,   1, 
+      0,   0, 152,   1,   0,   0, 
+     52,   2,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      8,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82, 148,   0, 
+      0,   0,  64,   0,   0,   0, 
+     37,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  40, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0,  98,  16,   0,   3, 
+    114,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0, 104,   0,   0,   2, 
+      1,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 114,  32,  16,   0, 
+      0,   0,   0,   0,   6,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+    128,  63,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlumalpha2d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,185 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler  Source Resource
+// -------------- --------------- ----------------
+// s0             s0              t0               
+//
+//
+// Level9 shader bytecode:
+//
+    ps_2_x
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mov r0, r0.xxxw
+    mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xyzw, r0.xxxw
+ret 
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLumAlpha2D[] =
+{
+     68,  88,  66,  67, 246, 240, 
+    158, 208, 214, 197, 166, 221, 
+     45,  58, 235, 164,  12, 157, 
+     62,  31,   1,   0,   0,   0, 
+    232,   2,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    176,   0,   0,   0,  56,   1, 
+      0,   0, 180,   1,   0,   0, 
+     92,   2,   0,   0, 180,   2, 
+      0,   0,  65, 111, 110,  57, 
+    112,   0,   0,   0, 112,   0, 
+      0,   0,   0,   2, 255, 255, 
+     72,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  40,   0, 
+      0,   0,  40,   0,   0,   0, 
+     40,   0,   1,   0,  36,   0, 
+      0,   0,  40,   0,   0,   0, 
+      0,   0,   1,   2, 255, 255, 
+     31,   0,   0,   2,   0,   0, 
+      0, 128,   0,   0,   3, 176, 
+     31,   0,   0,   2,   0,   0, 
+      0, 144,   0,   8,  15, 160, 
+     66,   0,   0,   3,   0,   0, 
+     15, 128,   0,   0, 228, 176, 
+      0,   8, 228, 160,   1,   0, 
+      0,   2,   0,   0,  15, 128, 
+      0,   0, 192, 128,   1,   0, 
+      0,   2,   0,   8,  15, 128, 
+      0,   0, 228, 128, 255, 255, 
+      0,   0,  83,  72,  68,  82, 
+    128,   0,   0,   0,  64,   0, 
+      0,   0,  32,   0,   0,   0, 
+     90,   0,   0,   3,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     85,  85,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     69,   0,   0,   9, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  16,  16,   0,   1,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+      6,  12,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      4,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78,  80,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   3,   3, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughlumalpha3d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyzw, r0.xxxw
+ret 
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughLumAlpha3D[] =
+{
+     68,  88,  66,  67, 224, 152, 
+    208, 227,  44, 106,  62, 235, 
+    129,  97, 207, 213,  29, 232, 
+    163,   6,   1,   0,   0,   0, 
+    156,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    220,   0,   0,   0, 100,   1, 
+      0,   0, 152,   1,   0,   0, 
+     32,   2,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      8,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82, 128,   0, 
+      0,   0,  64,   0,   0,   0, 
+     32,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  40, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0,  98,  16,   0,   3, 
+    114,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0, 104,   0,   0,   2, 
+      1,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,   6,  12, 
+     16,   0,   0,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr2d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,198 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler  Source Resource
+// -------------- --------------- ----------------
+// s0             s0              t0               
+//
+//
+// Level9 shader bytecode:
+//
+    ps_2_x
+    def c0, 1, 0, 0, 0
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mad r0, r0.x, c0.xyyy, c0.yyyx
+    mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2D[] =
+{
+     68,  88,  66,  67, 212, 251, 
+    117, 250,  99, 185,  28,  44, 
+    178,  14,  83, 133, 173,   0, 
+    182, 196,   1,   0,   0,   0, 
+     40,   3,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    208,   0,   0,   0, 120,   1, 
+      0,   0, 244,   1,   0,   0, 
+    156,   2,   0,   0, 244,   2, 
+      0,   0,  65, 111, 110,  57, 
+    144,   0,   0,   0, 144,   0, 
+      0,   0,   0,   2, 255, 255, 
+    104,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  40,   0, 
+      0,   0,  40,   0,   0,   0, 
+     40,   0,   1,   0,  36,   0, 
+      0,   0,  40,   0,   0,   0, 
+      0,   0,   1,   2, 255, 255, 
+     81,   0,   0,   5,   0,   0, 
+     15, 160,   0,   0, 128,  63, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     31,   0,   0,   2,   0,   0, 
+      0, 128,   0,   0,   3, 176, 
+     31,   0,   0,   2,   0,   0, 
+      0, 144,   0,   8,  15, 160, 
+     66,   0,   0,   3,   0,   0, 
+     15, 128,   0,   0, 228, 176, 
+      0,   8, 228, 160,   4,   0, 
+      0,   4,   0,   0,  15, 128, 
+      0,   0,   0, 128,   0,   0, 
+     84, 160,   0,   0,  21, 160, 
+      1,   0,   0,   2,   0,   8, 
+     15, 128,   0,   0, 228, 128, 
+    255, 255,   0,   0,  83,  72, 
+     68,  82, 160,   0,   0,   0, 
+     64,   0,   0,   0,  40,   0, 
+      0,   0,  90,   0,   0,   3, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  85,  85,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0,  69,   0,   0,   9, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+     18,  32,  16,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   8, 226,  32,  16,   0, 
+      0,   0,   0,   0,   2,  64, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 128,  63, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  82,  68,  69,  70, 
+    160,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  28,   0, 
+      0,   0,   0,   4, 255, 255, 
+      0,   1,   0,   0, 109,   0, 
+      0,   0,  92,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 100,   0, 
+      0,   0,   2,   0,   0,   0, 
+      5,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     83,  97, 109, 112, 108, 101, 
+    114,   0,  84, 101, 120, 116, 
+    117, 114, 101,  70,   0,  77, 
+    105,  99, 114, 111, 115, 111, 
+    102, 116,  32,  40,  82,  41, 
+     32,  72,  76,  83,  76,  32, 
+     83, 104,  97, 100, 101, 114, 
+     32,  67, 111, 109, 112, 105, 
+    108, 101, 114,  32,  54,  46, 
+     51,  46,  57,  54,  48,  48, 
+     46,  49,  54,  51,  56,  52, 
+      0, 171,  73,  83,  71,  78, 
+     80,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr2di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DI[] =
+{
+     68,  88,  66,  67, 123, 230, 
+     45,  18,  63, 217,  12, 210, 
+    151, 254,  16,  78, 107, 211, 
+     57, 255,   1,   0,   0,   0, 
+    208,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     84,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+     12,   1,   0,   0,  64,   0, 
+      0,   0,  67,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    226,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr2dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR2DUI[] =
+{
+     68,  88,  66,  67,   4,  26, 
+     62, 109,  94,  45, 124, 238, 
+    150, 245,  85, 155, 185,  37, 
+    234, 152,   1,   0,   0,   0, 
+    208,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     84,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+     12,   1,   0,   0,  64,   0, 
+      0,   0,  67,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    226,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr3d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,162 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3D[] =
+{
+     68,  88,  66,  67,  11, 235, 
+    208, 143, 219, 183, 141,  78, 
+    136, 182,  62, 182, 243,  12, 
+    239, 125,   1,   0,   0,   0, 
+    188,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    220,   0,   0,   0, 100,   1, 
+      0,   0, 152,   1,   0,   0, 
+     64,   2,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      8,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82, 160,   0, 
+      0,   0,  64,   0,   0,   0, 
+     40,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  40, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0,  98,  16,   0,   3, 
+    114,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0, 104,   0,   0,   2, 
+      1,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5,  18,  32,  16,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 226,  32, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    128,  63,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr3di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3DI[] =
+{
+     68,  88,  66,  67, 222, 251, 
+     30,  61,  15,  80,  81, 247, 
+    175, 137,  44,  19,  23,  84, 
+    149, 211,   1,   0,   0,   0, 
+    244,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+    120,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+      0,   1,   0,   0,  64,   0, 
+      0,   0,  64,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    226,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughr3dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.x, r0.x
+mov o0.yzw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughR3DUI[] =
+{
+     68,  88,  66,  67,  69,   5, 
+     86, 212, 201,  54,  97, 205, 
+     89, 161, 100,  72, 246, 114, 
+     40, 214,   1,   0,   0,   0, 
+    244,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+    120,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+      0,   1,   0,   0,  64,   0, 
+      0,   0,  64,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    226,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg2d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,198 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler  Source Resource
+// -------------- --------------- ----------------
+// s0             s0              t0               
+//
+//
+// Level9 shader bytecode:
+//
+    ps_2_x
+    def c0, 1, 0, 0, 0
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mad r0, r0.xyxx, c0.xxyy, c0.yyyx
+    mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2D[] =
+{
+     68,  88,  66,  67, 217, 171, 
+    153, 248,  26,  15, 102, 119, 
+     86, 174, 121, 245, 223,  83, 
+      2, 181,   1,   0,   0,   0, 
+     40,   3,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    208,   0,   0,   0, 120,   1, 
+      0,   0, 244,   1,   0,   0, 
+    156,   2,   0,   0, 244,   2, 
+      0,   0,  65, 111, 110,  57, 
+    144,   0,   0,   0, 144,   0, 
+      0,   0,   0,   2, 255, 255, 
+    104,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  40,   0, 
+      0,   0,  40,   0,   0,   0, 
+     40,   0,   1,   0,  36,   0, 
+      0,   0,  40,   0,   0,   0, 
+      0,   0,   1,   2, 255, 255, 
+     81,   0,   0,   5,   0,   0, 
+     15, 160,   0,   0, 128,  63, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     31,   0,   0,   2,   0,   0, 
+      0, 128,   0,   0,   3, 176, 
+     31,   0,   0,   2,   0,   0, 
+      0, 144,   0,   8,  15, 160, 
+     66,   0,   0,   3,   0,   0, 
+     15, 128,   0,   0, 228, 176, 
+      0,   8, 228, 160,   4,   0, 
+      0,   4,   0,   0,  15, 128, 
+      0,   0,   4, 128,   0,   0, 
+     80, 160,   0,   0,  21, 160, 
+      1,   0,   0,   2,   0,   8, 
+     15, 128,   0,   0, 228, 128, 
+    255, 255,   0,   0,  83,  72, 
+     68,  82, 160,   0,   0,   0, 
+     64,   0,   0,   0,  40,   0, 
+      0,   0,  90,   0,   0,   3, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  85,  85,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0,  69,   0,   0,   9, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+     50,  32,  16,   0,   0,   0, 
+      0,   0,  70,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   8, 194,  32,  16,   0, 
+      0,   0,   0,   0,   2,  64, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 128,  63, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  82,  68,  69,  70, 
+    160,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  28,   0, 
+      0,   0,   0,   4, 255, 255, 
+      0,   1,   0,   0, 109,   0, 
+      0,   0,  92,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 100,   0, 
+      0,   0,   2,   0,   0,   0, 
+      5,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     83,  97, 109, 112, 108, 101, 
+    114,   0,  84, 101, 120, 116, 
+    117, 114, 101,  70,   0,  77, 
+    105,  99, 114, 111, 115, 111, 
+    102, 116,  32,  40,  82,  41, 
+     32,  72,  76,  83,  76,  32, 
+     83, 104,  97, 100, 101, 114, 
+     32,  67, 111, 109, 112, 105, 
+    108, 101, 114,  32,  54,  46, 
+     51,  46,  57,  54,  48,  48, 
+     46,  49,  54,  51,  56,  52, 
+      0, 171,  73,  83,  71,  78, 
+     80,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg2di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DI[] =
+{
+     68,  88,  66,  67,  89, 123, 
+    129, 251, 206, 105, 221, 141, 
+      5, 160, 186, 187, 168, 157, 
+    145, 246,   1,   0,   0,   0, 
+    208,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     84,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+     12,   1,   0,   0,  64,   0, 
+      0,   0,  67,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  50,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    194,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg2dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG2DUI[] =
+{
+     68,  88,  66,  67, 253, 188, 
+    138, 153, 226, 194, 182, 197, 
+    184,  36, 111,  24, 198, 171, 
+    241, 145,   1,   0,   0,   0, 
+    208,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     84,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+     12,   1,   0,   0,  64,   0, 
+      0,   0,  67,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  50,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    194,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg3d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,162 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3D[] =
+{
+     68,  88,  66,  67, 117, 159, 
+    238,  81,  51, 223, 126,  31, 
+    223, 171, 227,   2, 248,   7, 
+     72,  91,   1,   0,   0,   0, 
+    188,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    220,   0,   0,   0, 100,   1, 
+      0,   0, 152,   1,   0,   0, 
+     64,   2,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      8,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82, 160,   0, 
+      0,   0,  64,   0,   0,   0, 
+     40,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  40, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0,  98,  16,   0,   3, 
+    114,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0, 104,   0,   0,   2, 
+      1,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5,  50,  32,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,  32, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    128,  63,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg3di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3DI[] =
+{
+     68,  88,  66,  67,  62, 119, 
+     61,  21,  83,  42,  80, 125, 
+    121, 208, 247,  10, 223,  62, 
+     33,  18,   1,   0,   0,   0, 
+    244,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+    120,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+      0,   1,   0,   0,  64,   0, 
+      0,   0,  64,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  50,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    194,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrg3dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xy, r0.xyxx
+mov o0.zw, l(0,0,0,0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRG3DUI[] =
+{
+     68,  88,  66,  67,  37,  56, 
+     43, 206,  81, 137, 125, 191, 
+    216,  50,  86,  76,  61,  78, 
+     25, 246,   1,   0,   0,   0, 
+    244,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+    120,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+      0,   1,   0,   0,  64,   0, 
+      0,   0,  64,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5,  50,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   8, 
+    194,  32,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb2d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler  Source Resource
+// -------------- --------------- ----------------
+// s0             s0              t0               
+//
+//
+// Level9 shader bytecode:
+//
+    ps_2_x
+    def c0, 1, 0, 0, 0
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mad r0, r0.xyzx, c0.xxxy, c0.yyyx
+    mov oC0, r0
+
+// approximately 3 instruction slots used (1 texture, 2 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2D[] =
+{
+     68,  88,  66,  67,  51,  90, 
+     49, 167, 211,  79,  20, 215, 
+     57, 227,  70,  56, 132, 117, 
+     66, 156,   1,   0,   0,   0, 
+     28,   3,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    208,   0,   0,   0, 108,   1, 
+      0,   0, 232,   1,   0,   0, 
+    144,   2,   0,   0, 232,   2, 
+      0,   0,  65, 111, 110,  57, 
+    144,   0,   0,   0, 144,   0, 
+      0,   0,   0,   2, 255, 255, 
+    104,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  40,   0, 
+      0,   0,  40,   0,   0,   0, 
+     40,   0,   1,   0,  36,   0, 
+      0,   0,  40,   0,   0,   0, 
+      0,   0,   1,   2, 255, 255, 
+     81,   0,   0,   5,   0,   0, 
+     15, 160,   0,   0, 128,  63, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     31,   0,   0,   2,   0,   0, 
+      0, 128,   0,   0,   3, 176, 
+     31,   0,   0,   2,   0,   0, 
+      0, 144,   0,   8,  15, 160, 
+     66,   0,   0,   3,   0,   0, 
+     15, 128,   0,   0, 228, 176, 
+      0,   8, 228, 160,   4,   0, 
+      0,   4,   0,   0,  15, 128, 
+      0,   0,  36, 128,   0,   0, 
+     64, 160,   0,   0,  21, 160, 
+      1,   0,   0,   2,   0,   8, 
+     15, 128,   0,   0, 228, 128, 
+    255, 255,   0,   0,  83,  72, 
+     68,  82, 148,   0,   0,   0, 
+     64,   0,   0,   0,  37,   0, 
+      0,   0,  90,   0,   0,   3, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  85,  85,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0,  69,   0,   0,   9, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    114,  32,  16,   0,   0,   0, 
+      0,   0,  70,   2,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 130,  32,  16,   0, 
+      0,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0, 128,  63, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  82,  68,  69,  70, 
+    160,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  28,   0, 
+      0,   0,   0,   4, 255, 255, 
+      0,   1,   0,   0, 109,   0, 
+      0,   0,  92,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 100,   0, 
+      0,   0,   2,   0,   0,   0, 
+      5,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     83,  97, 109, 112, 108, 101, 
+    114,   0,  84, 101, 120, 116, 
+    117, 114, 101,  70,   0,  77, 
+    105,  99, 114, 111, 115, 111, 
+    102, 116,  32,  40,  82,  41, 
+     32,  72,  76,  83,  76,  32, 
+     83, 104,  97, 100, 101, 114, 
+     32,  67, 111, 109, 112, 105, 
+    108, 101, 114,  32,  54,  46, 
+     51,  46,  57,  54,  48,  48, 
+     46,  49,  54,  51,  56,  52, 
+      0, 171,  73,  83,  71,  78, 
+     80,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb2di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,165 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DI[] =
+{
+     68,  88,  66,  67,  16, 227, 
+    172, 190, 246, 118, 223, 239, 
+    176,  78,  90,  11, 135, 138, 
+    109, 174,   1,   0,   0,   0, 
+    196,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     72,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+      0,   1,   0,   0,  64,   0, 
+      0,   0,  64,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    130,  32,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb2dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,165 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB2DUI[] =
+{
+     68,  88,  66,  67, 245, 219, 
+     46,  32,  34,  74,   2,  47, 
+    124,  96, 216,  40, 253, 243, 
+    104, 178,   1,   0,   0,   0, 
+    196,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     72,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+      0,   1,   0,   0,  64,   0, 
+      0,   0,  64,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    130,  32,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb3d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,160 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov o0.xyz, r0.xyzx
+mov o0.w, l(1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3D[] =
+{
+     68,  88,  66,  67,   3, 213, 
+    227, 200, 132, 255,   7,  95, 
+      0, 252,  77,  33, 254, 184, 
+     83, 110,   1,   0,   0,   0, 
+    176,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    220,   0,   0,   0, 100,   1, 
+      0,   0, 152,   1,   0,   0, 
+     52,   2,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      8,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82, 148,   0, 
+      0,   0,  64,   0,   0,   0, 
+     37,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  40, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0,  98,  16,   0,   3, 
+    114,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0, 104,   0,   0,   2, 
+      1,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 114,  32,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+    128,  63,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb3di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,172 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3DI[] =
+{
+     68,  88,  66,  67, 194, 157, 
+      8, 194, 167, 235,  14, 127, 
+     69, 198,  32,  35, 167,  35, 
+    213, 248,   1,   0,   0,   0, 
+    232,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+    108,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+    244,   0,   0,   0,  64,   0, 
+      0,   0,  61,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    130,  32,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgb3dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,172 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov o0.xyz, r0.xyzx
+mov o0.w, l(0)
+ret 
+// Approximately 9 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGB3DUI[] =
+{
+     68,  88,  66,  67, 253, 147, 
+      1, 158,  41,  31, 253, 138, 
+     52, 213, 103,  41, 188, 192, 
+     79, 199,   1,   0,   0,   0, 
+    232,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+    108,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+    244,   0,   0,   0,  64,   0, 
+      0,   0,  61,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    130,  32,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   9,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba2d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,176 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+//
+// Sampler/Resource to DX9 shader sampler mappings:
+//
+// Target Sampler Source Sampler  Source Resource
+// -------------- --------------- ----------------
+// s0             s0              t0               
+//
+//
+// Level9 shader bytecode:
+//
+    ps_2_x
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mov oC0, r0
+
+// approximately 2 instruction slots used (1 texture, 1 arithmetic)
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+sample o0.xyzw, v1.xyxx, t0.xyzw, s0
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2D[] =
+{
+     68,  88,  66,  67, 240, 186, 
+    163, 221, 151,  45, 139,  68, 
+    172, 121,  30, 230, 203, 102, 
+     92,  33,   1,   0,   0,   0, 
+    192,   2,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+    164,   0,   0,   0,  16,   1, 
+      0,   0, 140,   1,   0,   0, 
+     52,   2,   0,   0, 140,   2, 
+      0,   0,  65, 111, 110,  57, 
+    100,   0,   0,   0, 100,   0, 
+      0,   0,   0,   2, 255, 255, 
+     60,   0,   0,   0,  40,   0, 
+      0,   0,   0,   0,  40,   0, 
+      0,   0,  40,   0,   0,   0, 
+     40,   0,   1,   0,  36,   0, 
+      0,   0,  40,   0,   0,   0, 
+      0,   0,   1,   2, 255, 255, 
+     31,   0,   0,   2,   0,   0, 
+      0, 128,   0,   0,   3, 176, 
+     31,   0,   0,   2,   0,   0, 
+      0, 144,   0,   8,  15, 160, 
+     66,   0,   0,   3,   0,   0, 
+     15, 128,   0,   0, 228, 176, 
+      0,   8, 228, 160,   1,   0, 
+      0,   2,   0,   8,  15, 128, 
+      0,   0, 228, 128, 255, 255, 
+      0,   0,  83,  72,  68,  82, 
+    100,   0,   0,   0,  64,   0, 
+      0,   0,  25,   0,   0,   0, 
+     90,   0,   0,   3,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     85,  85,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0,  69,   0, 
+      0,   9, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  16, 
+     16,   0,   1,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     82,  68,  69,  70, 160,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,  28,   0,   0,   0, 
+      0,   4, 255, 255,   0,   1, 
+      0,   0, 109,   0,   0,   0, 
+     92,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 100,   0,   0,   0, 
+      2,   0,   0,   0,   5,   0, 
+      0,   0,   4,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     13,   0,   0,   0,  83,  97, 
+    109, 112, 108, 101, 114,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  70,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba2di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,157 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret 
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DI[] =
+{
+     68,  88,  66,  67,  81, 147, 
+    194, 141,  92, 236, 184, 192, 
+     11, 249,  14, 215, 122, 110, 
+     35, 111,   1,   0,   0,   0, 
+    156,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     32,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+    216,   0,   0,   0,  64,   0, 
+      0,   0,  54,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      7,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba2dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,157 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret 
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA2DUI[] =
+{
+     68,  88,  66,  67, 128, 252, 
+    255, 238,  68, 109,  10, 133, 
+    175, 163, 216, 152, 219, 103, 
+    163, 223,   1,   0,   0,   0, 
+    156,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  12,   1, 
+      0,   0,  64,   1,   0,   0, 
+     32,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78,  80,   0, 
+      0,   0,   2,   0,   0,   0, 
+      8,   0,   0,   0,  56,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  68,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+    216,   0,   0,   0,  64,   0, 
+      0,   0,  54,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      7,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba3d11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,149 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF                          texture  float4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+sample o0.xyzw, v2.xyzx, t0.xyzw, s0
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3D[] =
+{
+     68,  88,  66,  67, 246,  41, 
+     15, 240, 168, 172,  91, 145, 
+    236, 221, 187,  89,  12,   0, 
+     93, 149,   1,   0,   0,   0, 
+    128,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    220,   0,   0,   0, 100,   1, 
+      0,   0, 152,   1,   0,   0, 
+      4,   2,   0,   0,  82,  68, 
+     69,  70, 160,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    109,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    100,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      8,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0,  83,  97, 109, 112, 
+    108, 101, 114,   0,  84, 101, 
+    120, 116, 117, 114, 101,  70, 
+      0,  77, 105,  99, 114, 111, 
+    115, 111, 102, 116,  32,  40, 
+     82,  41,  32,  72,  76,  83, 
+     76,  32,  83, 104,  97, 100, 
+    101, 114,  32,  67, 111, 109, 
+    112, 105, 108, 101, 114,  32, 
+     54,  46,  51,  46,  57,  54, 
+     48,  48,  46,  49,  54,  51, 
+     56,  52,   0, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82, 100,   0, 
+      0,   0,  64,   0,   0,   0, 
+     25,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  40, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0,  98,  16,   0,   3, 
+    114,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  69,   0,   0,   9, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba3di11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,164 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI                          texture   sint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret 
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3DI[] =
+{
+     68,  88,  66,  67, 139, 158, 
+      6, 251, 163, 134,   3, 183, 
+      5, 227, 185, 108,  35,  91, 
+     67, 191,   1,   0,   0,   0, 
+    192,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+     68,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     69,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  73,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+    204,   0,   0,   0,  64,   0, 
+      0,   0,  51,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      7,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledpassthroughrgba3dui11psh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,164 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI                         texture   uint4          3d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld o0.xyzw, r0.xyzw, t0.xyzw
+ret 
+// Approximately 7 instruction slots used
+#endif
+
+const BYTE g_PS_PassthroughRGBA3DUI[] =
+{
+     68,  88,  66,  67,  16, 111, 
+     56, 218, 148, 233, 100, 164, 
+      0, 199,  73, 155, 213, 171, 
+     78,  18,   1,   0,   0,   0, 
+    192,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    180,   0,   0,   0,  60,   1, 
+      0,   0, 112,   1,   0,   0, 
+     68,   2,   0,   0,  82,  68, 
+     69,  70, 120,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     70,   0,   0,   0,  60,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  85,  73,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   7,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+    204,   0,   0,   0,  64,   0, 
+      0,   0,  51,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      7,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlef2darraypsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,278 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF2DArray                   texture  float4     2darray    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint   x   
+// TEXCOORD                 0   xyz         2     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture2darray (float,float,float,float) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+utof r0.z, v1.x
+mov r0.xy, v2.xyxx
+sample r0.xyzw, r0.xyzx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 18 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF2DArray[] =
+{
+     68,  88,  66,  67,  39, 232, 
+     91, 166, 165, 217,  22,  39, 
+    183, 202, 191,  64, 238, 104, 
+    217, 199,   1,   0,   0,   0, 
+    204,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    104,   1,   0,   0, 240,   1, 
+      0,   0,  36,   2,   0,   0, 
+     80,   4,   0,   0,  82,  68, 
+     69,  70,  44,   1,   0,   0, 
+      1,   0,   0,   0, 168,   0, 
+      0,   0,   3,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    248,   0,   0,   0, 124,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    132,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      5,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0, 148,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,  83,  97, 
+    109, 112, 108, 101, 114,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  70,  50,  68,  65, 114, 
+    114,  97, 121,   0,  83, 119, 
+    105, 122, 122, 108, 101,  80, 
+    114, 111, 112, 101, 114, 116, 
+    105, 101, 115,   0, 171, 171, 
+    148,   0,   0,   0,   1,   0, 
+      0,   0, 192,   0,   0,   0, 
+     16,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    216,   0,   0,   0,   0,   0, 
+      0,   0,  16,   0,   0,   0, 
+      2,   0,   0,   0, 232,   0, 
+      0,   0,   0,   0,   0,   0, 
+     83, 119, 105, 122, 122, 108, 
+    101,  73, 110, 100, 105,  99, 
+    101, 115,   0, 171,   1,   0, 
+     19,   0,   1,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  77, 105,  99, 114, 
+    111, 115, 111, 102, 116,  32, 
+     40,  82,  41,  32,  72,  76, 
+     83,  76,  32,  83, 104,  97, 
+    100, 101, 114,  32,  67, 111, 
+    109, 112, 105, 108, 101, 114, 
+     32,  54,  46,  51,  46,  57, 
+     54,  48,  48,  46,  49,  54, 
+     51,  56,  52,   0, 171, 171, 
+     73,  83,  71,  78, 128,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   1,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   3,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  83,  86, 
+     95,  82,  69,  78,  68,  69, 
+     82,  84,  65,  82,  71,  69, 
+     84,  65,  82,  82,  65,  89, 
+     73,  78,  68,  69,  88,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+     36,   2,   0,   0,  64,   0, 
+      0,   0, 137,   0,   0,   0, 
+     89,   0,   0,   4,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  90,   0, 
+      0,   3,   0,  96,  16,   0, 
+      0,   0,   0,   0,  88,  64, 
+      0,   4,   0, 112,  16,   0, 
+      0,   0,   0,   0,  85,  85, 
+      0,   0, 100,   8,   0,   4, 
+     18,  16,  16,   0,   1,   0, 
+      0,   0,   4,   0,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   2,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0, 105,   0,   0,   4, 
+      0,   0,   0,   0,   6,   0, 
+      0,   0,   4,   0,   0,   0, 
+     86,   0,   0,   5,  66,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10,  16,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+     50,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      2,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  26,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,  42,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,  58,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   5,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0, 128,  63,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  18,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  26, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     34,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  66,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  58, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7, 130,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  18,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,  10,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      5,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlef2dpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,256 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF2D                        texture  float4          2d    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+sample r0.xyzw, v1.xyxx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 16 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF2D[] =
+{
+     68,  88,  66,  67, 187, 204, 
+    160,  39, 195, 158, 245,  72, 
+    125, 249,  70, 140, 158, 199, 
+    246, 220,   1,   0,   0,   0, 
+     96,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    100,   1,   0,   0, 188,   1, 
+      0,   0, 240,   1,   0,   0, 
+    228,   3,   0,   0,  82,  68, 
+     69,  70,  40,   1,   0,   0, 
+      1,   0,   0,   0, 164,   0, 
+      0,   0,   3,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    244,   0,   0,   0, 124,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    132,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      4,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0, 143,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,  83,  97, 
+    109, 112, 108, 101, 114,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  70,  50,  68,   0,  83, 
+    119, 105, 122, 122, 108, 101, 
+     80, 114, 111, 112, 101, 114, 
+    116, 105, 101, 115,   0, 171, 
+    171, 171, 143,   0,   0,   0, 
+      1,   0,   0,   0, 188,   0, 
+      0,   0,  16,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0, 212,   0,   0,   0, 
+      0,   0,   0,   0,  16,   0, 
+      0,   0,   2,   0,   0,   0, 
+    228,   0,   0,   0,   0,   0, 
+      0,   0,  83, 119, 105, 122, 
+    122, 108, 101,  73, 110, 100, 
+    105,  99, 101, 115,   0, 171, 
+      1,   0,  19,   0,   1,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+     80,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171,  83,  72, 
+     68,  82, 236,   1,   0,   0, 
+     64,   0,   0,   0, 123,   0, 
+      0,   0,  89,   0,   0,   4, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     90,   0,   0,   3,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     85,  85,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+    105,   0,   0,   4,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+      4,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  16, 
+     16,   0,   1,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  26,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,  42,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,  58,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   5,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0, 128,  63,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  18,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  26, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     34,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  66,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  58, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7, 130,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  16,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,  10,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlef3dpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,265 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// Sampler                           sampler      NA          NA    0        1
+// TextureF3D                        texture  float4          3d    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_sampler s0, mode_default
+dcl_resource_texture3d (float,float,float,float) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+sample r0.xyzw, v2.xyzx, t0.xyzw, s0
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1.000000)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 16 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleF3D[] =
+{
+     68,  88,  66,  67, 238,  60, 
+     80,  74,  42,  65, 120, 165, 
+    177,  91, 253, 216,  89, 102, 
+      2, 228,   1,   0,   0,   0, 
+    144,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    100,   1,   0,   0, 236,   1, 
+      0,   0,  32,   2,   0,   0, 
+     20,   4,   0,   0,  82,  68, 
+     69,  70,  40,   1,   0,   0, 
+      1,   0,   0,   0, 164,   0, 
+      0,   0,   3,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    244,   0,   0,   0, 124,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    132,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      8,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  13,   0, 
+      0,   0, 143,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,  83,  97, 
+    109, 112, 108, 101, 114,   0, 
+     84, 101, 120, 116, 117, 114, 
+    101,  70,  51,  68,   0,  83, 
+    119, 105, 122, 122, 108, 101, 
+     80, 114, 111, 112, 101, 114, 
+    116, 105, 101, 115,   0, 171, 
+    171, 171, 143,   0,   0,   0, 
+      1,   0,   0,   0, 188,   0, 
+      0,   0,  16,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0, 212,   0,   0,   0, 
+      0,   0,   0,   0,  16,   0, 
+      0,   0,   2,   0,   0,   0, 
+    228,   0,   0,   0,   0,   0, 
+      0,   0,  83, 119, 105, 122, 
+    122, 108, 101,  73, 110, 100, 
+    105,  99, 101, 115,   0, 171, 
+      1,   0,  19,   0,   1,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+    128,   0,   0,   0,   3,   0, 
+      0,   0,   8,   0,   0,   0, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    118,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,   7,   7,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     83,  86,  95,  82,  69,  78, 
+     68,  69,  82,  84,  65,  82, 
+     71,  69,  84,  65,  82,  82, 
+     65,  89,  73,  78,  68,  69, 
+     88,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171,  83,  72, 
+     68,  82, 236,   1,   0,   0, 
+     64,   0,   0,   0, 123,   0, 
+      0,   0,  89,   0,   0,   4, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     90,   0,   0,   3,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     88,  40,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     85,  85,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   1,   0,   0,   0, 
+    105,   0,   0,   4,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+      4,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+     70, 126,  16,   0,   0,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  26,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,  42,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,  58,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   5,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0, 128,  63,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  18,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  26, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     34,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  66,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  58, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7, 130,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  16,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,  10,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlei2darraypsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,286 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI2DArray                   texture   sint4     2darray    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint   x   
+// TEXCOORD                 0   xyz         2     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2darray (sint,sint,sint,sint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 22 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI2DArray[] =
+{
+     68,  88,  66,  67,  85,  61, 
+     60,  36,  33, 245,  58, 113, 
+    238, 227, 230, 200, 136, 227, 
+     36, 193,   1,   0,   0,   0, 
+    240,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+     64,   1,   0,   0, 200,   1, 
+      0,   0, 252,   1,   0,   0, 
+    116,   4,   0,   0,  82,  68, 
+     69,  70,   4,   1,   0,   0, 
+      1,   0,   0,   0, 128,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    208,   0,   0,   0,  92,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   5,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+    108,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  84, 101, 120, 116, 
+    117, 114, 101,  73,  50,  68, 
+     65, 114, 114,  97, 121,   0, 
+     83, 119, 105, 122, 122, 108, 
+    101,  80, 114, 111, 112, 101, 
+    114, 116, 105, 101, 115,   0, 
+    171, 171, 108,   0,   0,   0, 
+      1,   0,   0,   0, 152,   0, 
+      0,   0,  16,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0, 176,   0,   0,   0, 
+      0,   0,   0,   0,  16,   0, 
+      0,   0,   2,   0,   0,   0, 
+    192,   0,   0,   0,   0,   0, 
+      0,   0,  83, 119, 105, 122, 
+    122, 108, 101,  73, 110, 100, 
+    105,  99, 101, 115,   0, 171, 
+      1,   0,  19,   0,   1,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+    128,   0,   0,   0,   3,   0, 
+      0,   0,   8,   0,   0,   0, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,   1,   1,   0,   0, 
+    118,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,   7,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     83,  86,  95,  82,  69,  78, 
+     68,  69,  82,  84,  65,  82, 
+     71,  69,  84,  65,  82,  82, 
+     65,  89,  73,  78,  68,  69, 
+     88,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171,  83,  72, 
+     68,  82, 112,   2,   0,   0, 
+     64,   0,   0,   0, 156,   0, 
+      0,   0,  89,   0,   0,   4, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     88,  64,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     51,  51,   0,   0, 100,   8, 
+      0,   4,  18,  16,  16,   0, 
+      1,   0,   0,   0,   4,   0, 
+      0,   0,  98,  16,   0,   3, 
+     50,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0, 104,   0,   0,   2, 
+      1,   0,   0,   0, 105,   0, 
+      0,   4,   0,   0,   0,   0, 
+      6,   0,   0,   0,   4,   0, 
+      0,   0,  61,  16,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     86,   0,   0,   5,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  56,   0,   0,   7, 
+     50,   0,  16,   0,   0,   0, 
+      0,   0,  70,   0,  16,   0, 
+      0,   0,   0,   0,  70,  16, 
+     16,   0,   2,   0,   0,   0, 
+     27,   0,   0,   5,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+     66,   0,  16,   0,   0,   0, 
+      0,   0,  10,  16,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 130,   0,  16,   0, 
+      0,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0,   0,   0, 
+     45,   0,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  14,  16,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  26,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,  42,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,  58,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   5,   0, 
+      0,   0,   1,  64,   0,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  18,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  26, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     34,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  66,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  58, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7, 130,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  22,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,  10,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlei2dpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,270 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI2D                        texture   sint4          2d    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2d (sint,sint,sint,sint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI2D[] =
+{
+     68,  88,  66,  67, 180,  37, 
+     54,  19,  39, 134, 185, 230, 
+    234,  82, 113, 129,  69, 135, 
+    140,  27,   1,   0,   0,   0, 
+    164,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+     60,   1,   0,   0, 148,   1, 
+      0,   0, 200,   1,   0,   0, 
+     40,   4,   0,   0,  82,  68, 
+     69,  70,   0,   1,   0,   0, 
+      1,   0,   0,   0, 124,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    204,   0,   0,   0,  92,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+    103,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  84, 101, 120, 116, 
+    117, 114, 101,  73,  50,  68, 
+      0,  83, 119, 105, 122, 122, 
+    108, 101,  80, 114, 111, 112, 
+    101, 114, 116, 105, 101, 115, 
+      0, 171, 171, 171, 103,   0, 
+      0,   0,   1,   0,   0,   0, 
+    148,   0,   0,   0,  16,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 172,   0, 
+      0,   0,   0,   0,   0,   0, 
+     16,   0,   0,   0,   2,   0, 
+      0,   0, 188,   0,   0,   0, 
+      0,   0,   0,   0,  83, 119, 
+    105, 122, 122, 108, 101,  73, 
+    110, 100, 105,  99, 101, 115, 
+      0, 171,   1,   0,  19,   0, 
+      1,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  54, 
+     46,  51,  46,  57,  54,  48, 
+     48,  46,  49,  54,  51,  56, 
+     52,   0, 171, 171,  73,  83, 
+     71,  78,  80,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   3,   3, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  88,   2, 
+      0,   0,  64,   0,   0,   0, 
+    150,   0,   0,   0,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  51,  51,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0, 105,   0,   0,   4, 
+      0,   0,   0,   0,   6,   0, 
+      0,   0,   4,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  42,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,  58,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      5,   0,   0,   0,   1,  64, 
+      0,   0,   1,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  26, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  34,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  42, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     66,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     58, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7, 130,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,  21,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+     10,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   5,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzlei3dpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,277 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureI3D                        texture   sint4          3d    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET     int   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture3d (sint,sint,sint,sint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleI3D[] =
+{
+     68,  88,  66,  67,  48,  84, 
+     97, 193, 216, 245, 101, 196, 
+    167,  81, 215, 168,  25, 164, 
+    144,  38,   1,   0,   0,   0, 
+    200,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+     60,   1,   0,   0, 196,   1, 
+      0,   0, 248,   1,   0,   0, 
+     76,   4,   0,   0,  82,  68, 
+     69,  70,   0,   1,   0,   0, 
+      1,   0,   0,   0, 124,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    204,   0,   0,   0,  92,   0, 
+      0,   0,   2,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+    103,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  84, 101, 120, 116, 
+    117, 114, 101,  73,  51,  68, 
+      0,  83, 119, 105, 122, 122, 
+    108, 101,  80, 114, 111, 112, 
+    101, 114, 116, 105, 101, 115, 
+      0, 171, 171, 171, 103,   0, 
+      0,   0,   1,   0,   0,   0, 
+    148,   0,   0,   0,  16,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 172,   0, 
+      0,   0,   0,   0,   0,   0, 
+     16,   0,   0,   0,   2,   0, 
+      0,   0, 188,   0,   0,   0, 
+      0,   0,   0,   0,  83, 119, 
+    105, 122, 122, 108, 101,  73, 
+    110, 100, 105,  99, 101, 115, 
+      0, 171,   1,   0,  19,   0, 
+      1,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  54, 
+     46,  51,  46,  57,  54,  48, 
+     48,  46,  49,  54,  51,  56, 
+     52,   0, 171, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  76,   2, 
+      0,   0,  64,   0,   0,   0, 
+    147,   0,   0,   0,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  88,  40,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  51,  51,   0,   0, 
+     98,  16,   0,   3, 114,  16, 
+     16,   0,   2,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0, 105,   0,   0,   4, 
+      0,   0,   0,   0,   6,   0, 
+      0,   0,   4,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  42,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,  58,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      5,   0,   0,   0,   1,  64, 
+      0,   0,   1,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  26, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  34,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  42, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     66,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     58, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7, 130,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,  21,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+     10,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   5,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzleui2darraypsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,286 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI2DArray                  texture   uint4     2darray    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint   x   
+// TEXCOORD                 0   xyz         2     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2darray (uint,uint,uint,uint) t0
+dcl_input_ps_siv constant v1.x, rendertarget_array_index
+dcl_input_ps linear v2.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v2.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.z, v1.x
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 22 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI2DArray[] =
+{
+     68,  88,  66,  67,  15, 124, 
+    179,  49,  45,  69,  64, 249, 
+    216, 189, 135, 190,  71, 234, 
+     72,  20,   1,   0,   0,   0, 
+    240,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+     64,   1,   0,   0, 200,   1, 
+      0,   0, 252,   1,   0,   0, 
+    116,   4,   0,   0,  82,  68, 
+     69,  70,   4,   1,   0,   0, 
+      1,   0,   0,   0, 128,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    208,   0,   0,   0,  92,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   5,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+    109,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  84, 101, 120, 116, 
+    117, 114, 101,  85,  73,  50, 
+     68,  65, 114, 114,  97, 121, 
+      0,  83, 119, 105, 122, 122, 
+    108, 101,  80, 114, 111, 112, 
+    101, 114, 116, 105, 101, 115, 
+      0, 171, 109,   0,   0,   0, 
+      1,   0,   0,   0, 152,   0, 
+      0,   0,  16,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0, 176,   0,   0,   0, 
+      0,   0,   0,   0,  16,   0, 
+      0,   0,   2,   0,   0,   0, 
+    192,   0,   0,   0,   0,   0, 
+      0,   0,  83, 119, 105, 122, 
+    122, 108, 101,  73, 110, 100, 
+    105,  99, 101, 115,   0, 171, 
+      1,   0,  19,   0,   1,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  54,  46,  51, 
+     46,  57,  54,  48,  48,  46, 
+     49,  54,  51,  56,  52,   0, 
+    171, 171,  73,  83,  71,  78, 
+    128,   0,   0,   0,   3,   0, 
+      0,   0,   8,   0,   0,   0, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,   1,   1,   0,   0, 
+    118,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,   7,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     83,  86,  95,  82,  69,  78, 
+     68,  69,  82,  84,  65,  82, 
+     71,  69,  84,  65,  82,  82, 
+     65,  89,  73,  78,  68,  69, 
+     88,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171,  83,  72, 
+     68,  82, 112,   2,   0,   0, 
+     64,   0,   0,   0, 156,   0, 
+      0,   0,  89,   0,   0,   4, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     88,  64,   0,   4,   0, 112, 
+     16,   0,   0,   0,   0,   0, 
+     68,  68,   0,   0, 100,   8, 
+      0,   4,  18,  16,  16,   0, 
+      1,   0,   0,   0,   4,   0, 
+      0,   0,  98,  16,   0,   3, 
+     50,  16,  16,   0,   2,   0, 
+      0,   0, 101,   0,   0,   3, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0, 104,   0,   0,   2, 
+      1,   0,   0,   0, 105,   0, 
+      0,   4,   0,   0,   0,   0, 
+      6,   0,   0,   0,   4,   0, 
+      0,   0,  61,  16,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     86,   0,   0,   5,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  56,   0,   0,   7, 
+     50,   0,  16,   0,   0,   0, 
+      0,   0,  70,   0,  16,   0, 
+      0,   0,   0,   0,  70,  16, 
+     16,   0,   2,   0,   0,   0, 
+     27,   0,   0,   5,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+     66,   0,  16,   0,   0,   0, 
+      0,   0,  10,  16,  16,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   5, 130,   0,  16,   0, 
+      0,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0,   0,   0, 
+     45,   0,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  14,  16,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  26,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,  42,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,  58,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,  48,  32,   0, 
+      0,   0,   0,   0,   5,   0, 
+      0,   0,   1,  64,   0,   0, 
+      1,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  18,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  26, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     34,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     42, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  66,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  58, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7, 130,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  22,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,  10,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzleui2dpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,270 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI2D                       texture   uint4          2d    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// TEXCOORD                 0   xy          1     NONE   float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture2d (uint,uint,uint,uint) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xy, r0.xyxx
+mul r0.xy, r0.xyxx, v1.xyxx
+ftoi r0.xy, r0.xyxx
+mov r0.zw, l(0,0,0,0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI2D[] =
+{
+     68,  88,  66,  67, 165, 190, 
+     35, 188, 235, 202, 154, 237, 
+    226,  86, 223, 212,  34,  38, 
+     81, 252,   1,   0,   0,   0, 
+    164,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+     60,   1,   0,   0, 148,   1, 
+      0,   0, 200,   1,   0,   0, 
+     40,   4,   0,   0,  82,  68, 
+     69,  70,   0,   1,   0,   0, 
+      1,   0,   0,   0, 124,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    204,   0,   0,   0,  92,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+    104,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  84, 101, 120, 116, 
+    117, 114, 101,  85,  73,  50, 
+     68,   0,  83, 119, 105, 122, 
+    122, 108, 101,  80, 114, 111, 
+    112, 101, 114, 116, 105, 101, 
+    115,   0, 171, 171, 104,   0, 
+      0,   0,   1,   0,   0,   0, 
+    148,   0,   0,   0,  16,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 172,   0, 
+      0,   0,   0,   0,   0,   0, 
+     16,   0,   0,   0,   2,   0, 
+      0,   0, 188,   0,   0,   0, 
+      0,   0,   0,   0,  83, 119, 
+    105, 122, 122, 108, 101,  73, 
+    110, 100, 105,  99, 101, 115, 
+      0, 171,   1,   0,  19,   0, 
+      1,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  54, 
+     46,  51,  46,  57,  54,  48, 
+     48,  46,  49,  54,  51,  56, 
+     52,   0, 171, 171,  73,  83, 
+     71,  78,  80,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   3,   3, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  84,  69,  88,  67, 
+     79,  79,  82,  68,   0, 171, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  88,   2, 
+      0,   0,  64,   0,   0,   0, 
+    150,   0,   0,   0,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  68,  68,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0, 105,   0,   0,   4, 
+      0,   0,   0,   0,   6,   0, 
+      0,   0,   4,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  50,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   0,  16,   0,   0,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  27,   0, 
+      0,   5,  50,   0,  16,   0, 
+      0,   0,   0,   0,  70,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   8, 194,   0, 
+     16,   0,   0,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  42,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,  58,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      5,   0,   0,   0,   1,  64, 
+      0,   0,   1,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  26, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  34,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  42, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     66,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     58, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7, 130,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,  21,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+     10,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   5,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shaderscompiledswizzleui3dpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,277 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer SwizzleProperties
+// {
+//
+//   uint4 SwizzleIndices;              // Offset:    0 Size:    16
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// TextureUI3D                       texture   uint4          3d    0        1
+// SwizzleProperties                 cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_POSITION              0   xyzw        0      POS   float       
+// SV_RENDERTARGETARRAYINDEX     0   x           1  RTINDEX    uint       
+// TEXCOORD                 0   xyz         2     NONE   float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue  Format   Used
+// -------------------- ----- ------ -------- -------- ------- ------
+// SV_TARGET                0   xyzw        0   TARGET    uint   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[1], immediateIndexed
+dcl_resource_texture3d (uint,uint,uint,uint) t0
+dcl_input_ps linear v2.xyz
+dcl_output o0.xyzw
+dcl_temps 1
+dcl_indexableTemp x0[6], 4
+resinfo_uint r0.xyzw, l(0), t0.xyzw
+utof r0.xyz, r0.xyzx
+mul r0.xyz, r0.xyzx, v2.xyzx
+ftoi r0.xyz, r0.xyzx
+mov r0.w, l(0)
+ld r0.xyzw, r0.xyzw, t0.xyzw
+mov x0[0].x, r0.x
+mov x0[1].x, r0.y
+mov x0[2].x, r0.z
+mov x0[3].x, r0.w
+mov x0[4].x, l(0)
+mov x0[5].x, l(1)
+mov r0.x, cb0[0].x
+mov o0.x, x0[r0.x + 0].x
+mov r0.x, cb0[0].y
+mov o0.y, x0[r0.x + 0].x
+mov r0.x, cb0[0].z
+mov o0.z, x0[r0.x + 0].x
+mov r0.x, cb0[0].w
+mov o0.w, x0[r0.x + 0].x
+ret 
+// Approximately 21 instruction slots used
+#endif
+
+const BYTE g_PS_SwizzleUI3D[] =
+{
+     68,  88,  66,  67, 186, 124, 
+    222, 110, 186, 145, 165,  56, 
+    152,  97, 247, 114, 115, 197, 
+    159, 190,   1,   0,   0,   0, 
+    200,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+     60,   1,   0,   0, 196,   1, 
+      0,   0, 248,   1,   0,   0, 
+     76,   4,   0,   0,  82,  68, 
+     69,  70,   0,   1,   0,   0, 
+      1,   0,   0,   0, 124,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    204,   0,   0,   0,  92,   0, 
+      0,   0,   2,   0,   0,   0, 
+      4,   0,   0,   0,   8,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+    104,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  84, 101, 120, 116, 
+    117, 114, 101,  85,  73,  51, 
+     68,   0,  83, 119, 105, 122, 
+    122, 108, 101,  80, 114, 111, 
+    112, 101, 114, 116, 105, 101, 
+    115,   0, 171, 171, 104,   0, 
+      0,   0,   1,   0,   0,   0, 
+    148,   0,   0,   0,  16,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 172,   0, 
+      0,   0,   0,   0,   0,   0, 
+     16,   0,   0,   0,   2,   0, 
+      0,   0, 188,   0,   0,   0, 
+      0,   0,   0,   0,  83, 119, 
+    105, 122, 122, 108, 101,  73, 
+    110, 100, 105,  99, 101, 115, 
+      0, 171,   1,   0,  19,   0, 
+      1,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  54, 
+     46,  51,  46,  57,  54,  48, 
+     48,  46,  49,  54,  51,  56, 
+     52,   0, 171, 171,  73,  83, 
+     71,  78, 128,   0,   0,   0, 
+      3,   0,   0,   0,   8,   0, 
+      0,   0,  80,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  92,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0, 118,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  83,  86,  95,  82, 
+     69,  78,  68,  69,  82,  84, 
+     65,  82,  71,  69,  84,  65, 
+     82,  82,  65,  89,  73,  78, 
+     68,  69,  88,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  76,   2, 
+      0,   0,  64,   0,   0,   0, 
+    147,   0,   0,   0,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,  88,  40,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  68,  68,   0,   0, 
+     98,  16,   0,   3, 114,  16, 
+     16,   0,   2,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0, 105,   0,   0,   4, 
+      0,   0,   0,   0,   6,   0, 
+      0,   0,   4,   0,   0,   0, 
+     61,  16,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,  86,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  27,   0, 
+      0,   5, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,   0, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+      0,   0,  45,   0,   0,   7, 
+    242,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,  42,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,  58,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,  48, 
+     32,   0,   0,   0,   0,   0, 
+      5,   0,   0,   0,   1,  64, 
+      0,   0,   1,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   6,  18,   0,  16,   0, 
+      0,   0,   0,   0,  26, 128, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   7,  34,  32,  16,   0, 
+      0,   0,   0,   0,  10,  48, 
+     32,   4,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  42, 128,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  54,   0,   0,   7, 
+     66,  32,  16,   0,   0,   0, 
+      0,   0,  10,  48,  32,   4, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   6,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     58, 128,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     54,   0,   0,   7, 130,  32, 
+     16,   0,   0,   0,   0,   0, 
+     10,  48,  32,   4,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,  21,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+     10,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   5,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11shadersgenerate_shadersbat"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/generate_shaders.bat (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/generate_shaders.bat                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/shaders/generate_shaders.bat        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,125 @@
</span><ins>+@ECHO OFF
+REM
+REM Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+REM Use of this source code is governed by a BSD-style license that can be
+REM found in the LICENSE file.
+REM
+
+PATH %PATH%;%ProgramFiles(x86)%\Windows Kits\8.1\bin\x86;%DXSDK_DIR%\Utilities\bin\x86
+
+setlocal
+set errorCount=0
+set successCount=0
+set debug=0
+
+if &quot;%1&quot; == &quot;debug&quot; (
+    set debug=1
+)
+if &quot;%1&quot; == &quot;release&quot; (
+    set debug=0
+)
+
+:: Shaders for OpenGL ES 2.0 and OpenGL ES 3.0+
+::              | Input file          | Entry point           | Type            | Output file                        | Debug |
+call:BuildShader Passthrough2D11.hlsl VS_Passthrough2D         vs_4_0_level_9_3  compiled\passthrough2d11vs.h         %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGBA2D     ps_4_0_level_9_3  compiled\passthroughrgba2d11ps.h     %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGB2D      ps_4_0_level_9_3  compiled\passthroughrgb2d11ps.h      %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRG2D       ps_4_0_level_9_3  compiled\passthroughrg2d11ps.h       %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughR2D        ps_4_0_level_9_3  compiled\passthroughr2d11ps.h        %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughLum2D      ps_4_0_level_9_3  compiled\passthroughlum2d11ps.h      %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughLumAlpha2D ps_4_0_level_9_3  compiled\passthroughlumalpha2d11ps.h %debug%
+
+call:BuildShader Clear11.hlsl         VS_ClearFloat            vs_4_0_level_9_3  compiled\clearfloat11vs.h            %debug%
+call:BuildShader Clear11.hlsl         PS_ClearFloat_FL9        ps_4_0_level_9_3  compiled\clearfloat11_fl9ps.h        %debug%
+call:BuildShader Clear11.hlsl         PS_ClearFloat            ps_4_0            compiled\clearfloat11ps.h            %debug%
+
+
+:: Shaders for OpenGL ES 3.0+ only
+::              | Input file          | Entry point           | Type            | Output file                        | Debug |
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughDepth2D    ps_4_0            compiled\passthroughdepth2d11ps.h    %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGBA2DUI   ps_4_0            compiled\passthroughrgba2dui11ps.h   %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGBA2DI    ps_4_0            compiled\passthroughrgba2di11ps.h    %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGB2DUI    ps_4_0            compiled\passthroughrgb2dui11ps.h    %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRGB2DI     ps_4_0            compiled\passthroughrgb2di11ps.h     %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRG2DUI     ps_4_0            compiled\passthroughrg2dui11ps.h     %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughRG2DI      ps_4_0            compiled\passthroughrg2di11ps.h      %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughR2DUI      ps_4_0            compiled\passthroughr2dui11ps.h      %debug%
+call:BuildShader Passthrough2D11.hlsl PS_PassthroughR2DI       ps_4_0            compiled\passthroughr2di11ps.h       %debug%
+
+
+call:BuildShader Passthrough3D11.hlsl VS_Passthrough3D         vs_4_0            compiled\passthrough3d11vs.h         %debug%
+call:BuildShader Passthrough3D11.hlsl GS_Passthrough3D         gs_4_0            compiled\passthrough3d11gs.h         %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGBA3D     ps_4_0            compiled\passthroughrgba3d11ps.h     %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGBA3DUI   ps_4_0            compiled\passthroughrgba3dui11ps.h   %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGBA3DI    ps_4_0            compiled\passthroughrgba3di11ps.h    %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGB3D      ps_4_0            compiled\passthroughrgb3d11ps.h      %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGB3DUI    ps_4_0            compiled\passthroughrgb3dui11ps.h    %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRGB3DI     ps_4_0            compiled\passthroughrgb3di11ps.h     %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRG3D       ps_4_0            compiled\passthroughrg3d11ps.h       %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRG3DUI     ps_4_0            compiled\passthroughrg3dui11ps.h     %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughRG3DI      ps_4_0            compiled\passthroughrg3di11ps.h      %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughR3D        ps_4_0            compiled\passthroughr3d11ps.h        %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughR3DUI      ps_4_0            compiled\passthroughr3dui11ps.h      %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughR3DI       ps_4_0            compiled\passthroughr3di11ps.h       %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughLum3D      ps_4_0            compiled\passthroughlum3d11ps.h      %debug%
+call:BuildShader Passthrough3D11.hlsl PS_PassthroughLumAlpha3D ps_4_0            compiled\passthroughlumalpha3d11ps.h %debug%
+
+call:BuildShader Swizzle11.hlsl       PS_SwizzleF2D            ps_4_0            compiled\swizzlef2dps.h              %debug%
+call:BuildShader Swizzle11.hlsl       PS_SwizzleI2D            ps_4_0            compiled\swizzlei2dps.h              %debug%
+call:BuildShader Swizzle11.hlsl       PS_SwizzleUI2D           ps_4_0            compiled\swizzleui2dps.h             %debug%
+
+call:BuildShader Swizzle11.hlsl       PS_SwizzleF3D            ps_4_0            compiled\swizzlef3dps.h              %debug%
+call:BuildShader Swizzle11.hlsl       PS_SwizzleI3D            ps_4_0            compiled\swizzlei3dps.h              %debug%
+call:BuildShader Swizzle11.hlsl       PS_SwizzleUI3D           ps_4_0            compiled\swizzleui3dps.h             %debug%
+
+call:BuildShader Swizzle11.hlsl       PS_SwizzleF2DArray       ps_4_0            compiled\swizzlef2darrayps.h         %debug%
+call:BuildShader Swizzle11.hlsl       PS_SwizzleI2DArray       ps_4_0            compiled\swizzlei2darrayps.h         %debug%
+call:BuildShader Swizzle11.hlsl       PS_SwizzleUI2DArray      ps_4_0            compiled\swizzleui2darrayps.h        %debug%
+
+call:BuildShader Clear11.hlsl         VS_ClearUint             vs_4_0            compiled\clearuint11vs.h             %debug%
+call:BuildShader Clear11.hlsl         PS_ClearUint             ps_4_0            compiled\clearuint11ps.h             %debug%
+
+call:BuildShader Clear11.hlsl         VS_ClearSint             vs_4_0            compiled\clearsint11vs.h             %debug%
+call:BuildShader Clear11.hlsl         PS_ClearSint             ps_4_0            compiled\clearsint11ps.h             %debug%
+
+call:BuildShader BufferToTexture11.hlsl  VS_BufferToTexture        vs_4_0        compiled/buffertotexture11_vs.h      %debug%
+call:BuildShader BufferToTexture11.hlsl  GS_BufferToTexture        gs_4_0        compiled/buffertotexture11_gs.h      %debug%
+call:BuildShader BufferToTexture11.hlsl  PS_BufferToTexture_4F     ps_4_0        compiled/buffertotexture11_ps_4f.h   %debug%
+call:BuildShader BufferToTexture11.hlsl  PS_BufferToTexture_4I     ps_4_0        compiled/buffertotexture11_ps_4i.h   %debug%
+call:BuildShader BufferToTexture11.hlsl  PS_BufferToTexture_4UI    ps_4_0        compiled/buffertotexture11_ps_4ui.h  %debug%
+
+echo.
+
+if %successCount% GTR 0 (
+   echo %successCount% shaders compiled successfully.
+)
+if %errorCount% GTR 0 (
+   echo There were %errorCount% shader compilation errors.
+)
+
+endlocal
+exit /b
+
+:BuildShader
+set input=%~1
+set entry=%~2
+set type=%~3
+set output=%~4
+set debug=%~5
+
+if %debug% == 0 (
+    set &quot;buildCMD=fxc /nologo /E %entry% /T %type% /Fh %output% %input%&quot;
+) else (
+    set &quot;buildCMD=fxc /nologo /Zi /Od /E %entry% /T %type% /Fh %output% %input%&quot;
+)
+
+set error=0
+%buildCMD% || set error=1
+
+if %error% == 0 (
+    set /a successCount=%successCount%+1
+) else (
+    set /a errorCount=%errorCount%+1
+)
+
+exit /b
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11win32NativeWindowcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// NativeWindow.cpp: Handler for managing HWND native window types.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+NativeWindow::NativeWindow(EGLNativeWindowType window) : mWindow(window)
+{
+}
+
+bool NativeWindow::initialize()
+{ 
+    return true; 
+}
+
+bool NativeWindow::getClientRect(LPRECT rect)
+{
+    return GetClientRect(mWindow, rect) == TRUE;
+}
+
+bool NativeWindow::isIconic()
+{
+    return IsIconic(mWindow) == TRUE;
+}
+
+bool NativeWindow::isValidNativeWindow(EGLNativeWindowType window)
+{
+    return IsWindow(window) == TRUE;
+}
+
+HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory,
+                                      DXGI_FORMAT format, unsigned int width, unsigned int height,
+                                      DXGISwapChain** swapChain)
+{
+    if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
+    {
+        return E_INVALIDARG;
+    }
+
+    DXGI_SWAP_CHAIN_DESC swapChainDesc = { 0 };
+    swapChainDesc.BufferCount = 1;
+    swapChainDesc.BufferDesc.Format = format;
+    swapChainDesc.BufferDesc.Width = width;
+    swapChainDesc.BufferDesc.Height = height;
+    swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
+    swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
+    swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
+    swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
+    swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
+    swapChainDesc.Flags = 0;
+    swapChainDesc.OutputWindow = mWindow;
+    swapChainDesc.SampleDesc.Count = 1;
+    swapChainDesc.SampleDesc.Quality = 0;
+    swapChainDesc.Windowed = TRUE;
+    swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+
+    return factory-&gt;CreateSwapChain(device, &amp;swapChainDesc, swapChain);
+}
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtCoreWindowNativeWindowcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,189 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// CoreWindowNativeWindow.cpp: NativeWindow for managing ICoreWindow native window types.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h&quot;
+
+#include &lt;windows.graphics.display.h&gt;
+
+using namespace ABI::Windows::Foundation::Collections;
+
+namespace rx
+{
+CoreWindowNativeWindow::~CoreWindowNativeWindow()
+{
+    unregisterForSizeChangeEvents();
+}
+
+bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
+{
+    ComPtr&lt;IPropertySet&gt; props = propertySet;
+    ComPtr&lt;IInspectable&gt; win = window;
+    SIZE swapChainSize = {};
+    bool swapChainSizeSpecified = false;
+    HRESULT result = S_OK;
+
+    // IPropertySet is an optional parameter and can be null.
+    // If one is specified, cache as an IMap and read the properties
+    // used for initial host initialization.
+    if (propertySet)
+    {
+        result = props.As(&amp;mPropertyMap);
+        if (SUCCEEDED(result))
+        {
+            // The EGLRenderSurfaceSizeProperty is optional and may be missing.  The IPropertySet
+            // was prevalidated to contain the EGLNativeWindowType before being passed to
+            // this host.
+            result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &amp;swapChainSize, &amp;swapChainSizeSpecified);
+        }
+    }
+
+    if (SUCCEEDED(result))
+    {
+        result = win.As(&amp;mCoreWindow);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        // If a swapchain size is specfied, then the automatic resize
+        // behaviors implemented by the host should be disabled.  The swapchain
+        // will be still be scaled when being rendered to fit the bounds
+        // of the host.
+        // Scaling of the swapchain output occurs automatically because if
+        // the scaling mode setting DXGI_SCALING_STRETCH on the swapchain.
+        if (swapChainSizeSpecified)
+        {
+            mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
+            mSupportsSwapChainResize = false;
+        }
+        else
+        {
+            result = GetCoreWindowSizeInPixels(mCoreWindow, &amp;mClientRect);
+        }
+    }
+
+    if (SUCCEEDED(result))
+    {
+        mNewClientRect = mClientRect;
+        mClientRectChanged = false;
+        return registerForSizeChangeEvents();
+    }
+
+    return false;
+}
+
+bool CoreWindowNativeWindow::registerForSizeChangeEvents()
+{
+    ComPtr&lt;IWindowSizeChangedEventHandler&gt; sizeChangedHandler;
+    HRESULT result = Microsoft::WRL::MakeAndInitialize&lt;CoreWindowSizeChangedHandler&gt;(sizeChangedHandler.ReleaseAndGetAddressOf(), this-&gt;shared_from_this());
+    if (SUCCEEDED(result))
+    {
+        result = mCoreWindow-&gt;add_SizeChanged(sizeChangedHandler.Get(), &amp;mSizeChangedEventToken);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        return true;
+    }
+
+    return false;
+}
+
+void CoreWindowNativeWindow::unregisterForSizeChangeEvents()
+{
+    if (mCoreWindow)
+    {
+        (void)mCoreWindow-&gt;remove_SizeChanged(mSizeChangedEventToken);
+    }
+    mSizeChangedEventToken.value = 0;
+}
+
+HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
+{
+    if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
+    {
+        return E_INVALIDARG;
+    }
+
+    DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
+    swapChainDesc.Width = width;
+    swapChainDesc.Height = height;
+    swapChainDesc.Format = format;
+    swapChainDesc.Stereo = FALSE;
+    swapChainDesc.SampleDesc.Count = 1;
+    swapChainDesc.SampleDesc.Quality = 0;
+    swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
+    swapChainDesc.BufferCount = 2;
+    swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
+    swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
+
+    *swapChain = nullptr;
+
+    ComPtr&lt;IDXGISwapChain1&gt; newSwapChain;
+    HRESULT result = factory-&gt;CreateSwapChainForCoreWindow(device, mCoreWindow.Get(), &amp;swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
+    if (SUCCEEDED(result))
+    {
+
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+        // Test if swapchain supports resize.  On Windows Phone devices, this will return DXGI_ERROR_UNSUPPORTED.  On
+        // other devices DXGI_ERROR_INVALID_CALL should be returned because the combination of flags passed
+        // (DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE) are invalid flag combinations.
+        if (newSwapChain-&gt;ResizeBuffers(swapChainDesc.BufferCount, swapChainDesc.Width, swapChainDesc.Height, swapChainDesc.Format, DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE) == DXGI_ERROR_UNSUPPORTED)
+        {
+            mSupportsSwapChainResize = false;
+        }
+#endif // (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
+
+        result = newSwapChain.CopyTo(swapChain);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        // If automatic swapchain resize behaviors have been disabled, then
+        // unregister for the resize change events.
+        if (mSupportsSwapChainResize == false)
+        {
+            unregisterForSizeChangeEvents();
+        }
+    }
+
+    return result;
+}
+
+HRESULT GetCoreWindowSizeInPixels(const ComPtr&lt;ABI::Windows::UI::Core::ICoreWindow&gt;&amp; coreWindow, RECT *windowSize)
+{
+    ABI::Windows::Foundation::Rect bounds;
+    HRESULT result = coreWindow-&gt;get_Bounds(&amp;bounds);
+    if (SUCCEEDED(result))
+    {
+        *windowSize = { 0, 0, ConvertDipsToPixels(bounds.Width), ConvertDipsToPixels(bounds.Height) };
+    }
+
+    return result;
+}
+
+static float GetLogicalDpi()
+{
+    ComPtr&lt;ABI::Windows::Graphics::Display::IDisplayPropertiesStatics&gt; displayProperties;
+    float dpi = 96.0f;
+
+    if (SUCCEEDED(GetActivationFactory(HStringReference(RuntimeClass_Windows_Graphics_Display_DisplayProperties).Get(), displayProperties.GetAddressOf())))
+    {
+        if (SUCCEEDED(displayProperties-&gt;get_LogicalDpi(&amp;dpi)))
+        {
+            return dpi;
+        }
+    }
+    return dpi;
+}
+
+long ConvertDipsToPixels(float dips)
+{
+    static const float dipsPerInch = 96.0f;
+    return lround((dips * GetLogicalDpi() / dipsPerInch));
+}
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtCoreWindowNativeWindowh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// CoreWindowNativeWindow.h: NativeWindow for managing ICoreWindow native window types.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
+
+#include &quot;libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h&quot;
+
+#include &lt;memory&gt;
+
+typedef ABI::Windows::Foundation::__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t IWindowSizeChangedEventHandler;
+
+namespace rx
+{
+long ConvertDipsToPixels(float dips);
+
+class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this&lt;CoreWindowNativeWindow&gt;
+{
+  public:
+    ~CoreWindowNativeWindow();
+
+    bool initialize(EGLNativeWindowType window, IPropertySet *propertySet);
+    bool registerForSizeChangeEvents();
+    void unregisterForSizeChangeEvents();
+    HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain);
+
+  private:
+    ComPtr&lt;ABI::Windows::UI::Core::ICoreWindow&gt; mCoreWindow;
+    ComPtr&lt;IMap&lt;HSTRING, IInspectable*&gt;&gt; mPropertyMap;
+};
+
+[uuid(7F924F66-EBAE-40E5-A10B-B8F35E245190)]
+class CoreWindowSizeChangedHandler :
+    public Microsoft::WRL::RuntimeClass&lt;Microsoft::WRL::RuntimeClassFlags&lt;Microsoft::WRL::ClassicCom&gt;, IWindowSizeChangedEventHandler&gt;
+{
+  public:
+    CoreWindowSizeChangedHandler() { }
+    HRESULT RuntimeClassInitialize(std::shared_ptr&lt;InspectableNativeWindow&gt; host)
+    {
+        if (!host)
+        {
+            return E_INVALIDARG;
+        }
+
+        mHost = host;
+        return S_OK;
+    }
+
+    // IWindowSizeChangedEventHandler
+    IFACEMETHOD(Invoke)(ABI::Windows::UI::Core::ICoreWindow *sender, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *sizeChangedEventArgs)
+    {
+        std::shared_ptr&lt;InspectableNativeWindow&gt; host = mHost.lock();
+        if (host)
+        {
+            ABI::Windows::Foundation::Size windowSize;
+            if (SUCCEEDED(sizeChangedEventArgs-&gt;get_Size(&amp;windowSize)))
+            {
+                SIZE windowSizeInPixels = { ConvertDipsToPixels(windowSize.Width), ConvertDipsToPixels(windowSize.Height) };
+                host-&gt;setNewClientSize(windowSizeInPixels);
+            }
+        }
+
+        return S_OK;
+    }
+
+  private:
+    std::weak_ptr&lt;InspectableNativeWindow&gt; mHost;
+};
+
+HRESULT GetCoreWindowSizeInPixels(const ComPtr&lt;ABI::Windows::UI::Core::ICoreWindow&gt;&amp; coreWindow, RECT *windowSize);
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_COREWINDOWNATIVEWINDOW_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtCoreWindowNativeWindow_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,233 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+
+// WINAPI_FAMILY is required to be defined as WINAPI_FAMILY_PC_APP
+// to ensure that the proper defines are set when including additional
+// headers which rely on Windows Store specific configuration.
+// This would normally be defined already but this unittest exe is compiled
+// as a desktop application which results in WINAPI_FAMILY being
+// set to WINAPI_FAMILY_DESKTOP_APP
+#undef WINAPI_FAMILY
+#define WINAPI_FAMILY WINAPI_FAMILY_PC_APP
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+#include &lt;angle_windowsstore.h&gt;
+
+using namespace rx;
+using namespace ABI::Windows::ApplicationModel::Core;
+using namespace ABI::Windows::Foundation;
+using namespace ABI::Windows::Foundation::Collections;
+using namespace ABI::Windows::UI::Core;
+using namespace ABI::Windows::System;
+
+namespace
+{
+
+// Mock Generic interfaces which are NOT ICoreWindow or
+// IPropertySet
+MIDL_INTERFACE(&quot;A4D67D0A-0E7F-4DF7-918B-7A1395413AF2&quot;)
+IAmInspectable : public IInspectable
+{
+};
+
+class GenericIInspectable : public RuntimeClass &lt;
+    RuntimeClassFlags&lt;WinRtClassicComMix&gt;,
+    IAmInspectable &gt;
+{
+};
+
+MIDL_INTERFACE(&quot;3CBCFE7A-E000-4094-B2D2-B7C9A4D67A2C&quot;)
+IAmUnknown : public IUnknown
+{
+};
+
+class GenericIUnknown : public RuntimeClass &lt;
+    RuntimeClassFlags&lt;ClassicCom&gt;,
+    IAmUnknown &gt;
+{
+};
+
+// Mock ICoreWindow
+class MockCoreWindow : public ABI::Windows::UI::Core::ICoreWindow
+{
+  public:
+    // IUnknown
+    STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject)
+    {
+        *ppvObject = NULL;
+
+        if (IsEqualIID(IID_IUnknown, riid))
+        {
+            *ppvObject = static_cast&lt;IUnknown*&gt;(this);
+            return S_OK;
+        }
+
+        if (IsEqualIID(IID_IInspectable, riid))
+        {
+            *ppvObject = static_cast&lt;IInspectable*&gt;(this);
+            return S_OK;
+        }
+
+        if (IsEqualIID(IID_ICoreWindow, riid))
+        {
+            *ppvObject = static_cast&lt;ABI::Windows::UI::Core::ICoreWindow*&gt;(this);
+            return S_OK;
+        }
+
+        return E_NOINTERFACE;
+    }
+
+    STDMETHOD_(ULONG, AddRef)(){ return 1; }
+    STDMETHOD_(ULONG, Release)(){ return 1; }
+
+    // IInspectable
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, GetIids, HRESULT(ULONG *, IID**));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, GetRuntimeClassName, HRESULT(HSTRING *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTrustLevel, HRESULT(TrustLevel *));
+
+    // ICoreWindow
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_AutomationHostProvider, HRESULT(IInspectable **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Bounds, HRESULT(Rect *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_CustomProperties, HRESULT(IPropertySet **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Dispatcher, HRESULT(ICoreDispatcher **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_FlowDirection, HRESULT(CoreWindowFlowDirection *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_FlowDirection, HRESULT(CoreWindowFlowDirection));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_IsInputEnabled, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_IsInputEnabled, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_PointerCursor, HRESULT(ICoreCursor**));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_PointerCursor, HRESULT(ICoreCursor*));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_PointerPosition, HRESULT(Point*));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Visible, HRESULT(boolean *));
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, Activate, HRESULT());
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, Close , HRESULT());
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, GetAsyncKeyState, HRESULT(ABI::Windows::System::VirtualKey, ABI::Windows::UI::Core::CoreVirtualKeyStates*));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, GetKeyState, HRESULT(ABI::Windows::System::VirtualKey, ABI::Windows::UI::Core::CoreVirtualKeyStates*));
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, ReleasePointerCapture, HRESULT());
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, SetPointerCapture, HRESULT());
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_Activated, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowActivatedEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_Activated, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_AutomationProviderRequested, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CAutomationProviderRequestedEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_AutomationProviderRequested, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_CharacterReceived, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CCharacterReceivedEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_CharacterReceived, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_Closed, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CCoreWindowEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_Closed, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_InputEnabled, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CInputEnabledEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_InputEnabled, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_KeyDown, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CKeyEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_KeyDown, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_KeyUp, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CKeyEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_KeyUp, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerCaptureLost, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerCaptureLost, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerEntered, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerEntered, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerExited, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerExited, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerMoved, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerMoved, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerPressed, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerPressed, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerReleased, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerReleased, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_TouchHitTesting, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CTouchHitTestingEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_TouchHitTesting, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerWheelChanged, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CPointerEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerWheelChanged, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_SizeChanged, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_SizeChanged, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_VisibilityChanged, HRESULT(__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CVisibilityChangedEventArgs*, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_VisibilityChanged, HRESULT(EventRegistrationToken));
+};
+
+HRESULT CreatePropertyMap(IMap&lt;HSTRING, IInspectable*&gt;** propertyMap)
+{
+    HRESULT result = S_OK;
+    ComPtr&lt;IPropertySet&gt; propertySet;
+    ComPtr&lt;IActivationFactory&gt; propertySetFactory;
+    result = GetActivationFactory(HStringReference(RuntimeClass_Windows_Foundation_Collections_PropertySet).Get(), &amp;propertySetFactory);
+    EXPECT_HRESULT_SUCCEEDED(result);
+
+    result = propertySetFactory-&gt;ActivateInstance(&amp;propertySet);
+    EXPECT_HRESULT_SUCCEEDED(result);
+
+    result = propertySet.CopyTo(propertyMap);
+    EXPECT_HRESULT_SUCCEEDED(result);
+
+    return result;
+}
+
+HRESULT SetInspectablePropertyValue(const ComPtr&lt;IMap&lt;HSTRING, IInspectable*&gt;&gt;&amp; propertyMap, const wchar_t* propertyName, IInspectable* inspectable)
+{
+    boolean propertyReplaced = false;
+    return propertyMap-&gt;Insert(HStringReference(propertyName).Get(), inspectable, &amp;propertyReplaced);
+}
+
+TEST(NativeWindowTest, NativeWindowNull)
+{
+    NativeWindow nativeWindow(nullptr);
+    EXPECT_FALSE(nativeWindow.initialize());
+}
+
+TEST(NativeWindowTest, NativeWindowBadInspectable)
+{
+    ComPtr&lt;IAmInspectable&gt; notCoreWindow = Make&lt;GenericIInspectable&gt;();
+    NativeWindow nativeWindow(notCoreWindow.Get());
+    EXPECT_FALSE(nativeWindow.initialize());
+}
+
+TEST(NativeWindowTest, NativeWindowNotInspectable)
+{
+    ComPtr&lt;IAmUnknown&gt; notIInspectable = Make&lt;GenericIUnknown&gt;();
+    NativeWindow nativeWindow((IInspectable*)notIInspectable.Get());
+    EXPECT_FALSE(nativeWindow.initialize());
+}
+
+TEST(NativeWindowTest, NativeWindowValidCoreWindow)
+{
+    MockCoreWindow mockCoreWindow;
+    EXPECT_CALL(mockCoreWindow, get_Bounds(testing::_)).Times(1);
+    EXPECT_CALL(mockCoreWindow, add_SizeChanged(testing::_, testing::_)).Times(1);
+    EXPECT_CALL(mockCoreWindow, remove_SizeChanged(testing::_)).Times(1);
+    NativeWindow nativeWindow(&amp;mockCoreWindow);
+    EXPECT_TRUE(nativeWindow.initialize());
+}
+
+TEST(NativeWindowTest, NativeWindowValidCoreWindowInPropertySet)
+{
+    // COM is required to be initialized for creation of the property set
+    EXPECT_HRESULT_SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED));
+    {
+        MockCoreWindow mockCoreWindow;
+        ComPtr&lt;IMap&lt;HSTRING, IInspectable*&gt;&gt; propertySet;
+        EXPECT_CALL(mockCoreWindow, get_Bounds(testing::_)).Times(1);
+        EXPECT_CALL(mockCoreWindow, add_SizeChanged(testing::_, testing::_)).Times(1);
+        EXPECT_CALL(mockCoreWindow, remove_SizeChanged(testing::_)).Times(1);
+        EXPECT_HRESULT_SUCCEEDED(CreatePropertyMap(&amp;propertySet));
+        EXPECT_HRESULT_SUCCEEDED(SetInspectablePropertyValue(propertySet, EGLNativeWindowTypeProperty, &amp;mockCoreWindow));
+        NativeWindow nativeWindow(propertySet.Get());
+        EXPECT_TRUE(nativeWindow.initialize());
+    }
+    CoUninitialize();
+}
+
+TEST(NativeWindowTest, NativeWindowMissingCoreWindowInPropertySet)
+{
+    // COM is required to be initialized for creation of the property set
+    EXPECT_HRESULT_SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED));
+    {
+        MockCoreWindow mockCoreWindow;
+        ComPtr&lt;IMap&lt;HSTRING, IInspectable*&gt;&gt; propertySet;
+        EXPECT_HRESULT_SUCCEEDED(CreatePropertyMap(&amp;propertySet));
+        NativeWindow nativeWindow(propertySet.Get());
+        EXPECT_FALSE(nativeWindow.initialize());
+    }
+    CoUninitialize();
+}
+
+} // namespace
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtInspectableNativeWindowcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,279 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// InspectableNativeWindow.cpp: NativeWindow base class for managing IInspectable native window types.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h&quot;
+
+namespace rx
+{
+NativeWindow::NativeWindow(EGLNativeWindowType window)
+{
+    mWindow = window;
+}
+
+bool NativeWindow::initialize()
+{
+    // If the native window type is a IPropertySet, extract the
+    // EGLNativeWindowType (IInspectable) and initialize the
+    // proper host with this IPropertySet.
+    ComPtr&lt;ABI::Windows::Foundation::Collections::IPropertySet&gt; propertySet;
+    ComPtr&lt;IInspectable&gt; eglNativeWindow;
+    if (IsEGLConfiguredPropertySet(mWindow, &amp;propertySet, &amp;eglNativeWindow))
+    {
+        // A property set was found and the EGLNativeWindowType was
+        // retrieved. The mWindow member of the host to must be updated
+        // to use the EGLNativeWindowType specified in the property set.
+        // mWindow is treated as a raw pointer not an AddRef'd interface, so
+        // the old mWindow does not need a Release() before this assignment.
+        mWindow = eglNativeWindow.Get();
+    }
+
+    ComPtr&lt;ABI::Windows::UI::Core::ICoreWindow&gt; coreWindow;
+    ComPtr&lt;ABI::Windows::UI::Xaml::Controls::ISwapChainPanel&gt; swapChainPanel;
+    if (IsCoreWindow(mWindow, &amp;coreWindow))
+    {
+        mImpl = std::make_shared&lt;CoreWindowNativeWindow&gt;();
+        if (mImpl)
+        {
+            return mImpl-&gt;initialize(mWindow, propertySet.Get());
+        }
+    }
+    else if (IsSwapChainPanel(mWindow, &amp;swapChainPanel))
+    {
+        mImpl = std::make_shared&lt;SwapChainPanelNativeWindow&gt;();
+        if (mImpl)
+        {
+            return mImpl-&gt;initialize(mWindow, propertySet.Get());
+        }
+    }
+    else
+    {
+        ERR(&quot;Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include ICoreWindow, ISwapChainPanel and IPropertySet&quot;);
+    }
+
+    return false;
+}
+
+bool NativeWindow::getClientRect(RECT *rect)
+{
+    if (mImpl)
+    {
+        return mImpl-&gt;getClientRect(rect);
+    }
+
+    return false;
+}
+
+bool NativeWindow::isIconic()
+{
+    return false;
+}
+
+bool NativeWindow::isValidNativeWindow(EGLNativeWindowType window)
+{
+    return IsValidEGLNativeWindowType(window);
+}
+
+HRESULT NativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
+{
+    if (mImpl)
+    {
+        return mImpl-&gt;createSwapChain(device, factory, format, width, height, swapChain);
+    }
+
+    return E_UNEXPECTED;
+}
+
+bool IsCoreWindow(EGLNativeWindowType window, ComPtr&lt;ABI::Windows::UI::Core::ICoreWindow&gt; *coreWindow)
+{
+    if (!window)
+    {
+        return false;
+    }
+
+    ComPtr&lt;IInspectable&gt; win = window;
+    ComPtr&lt;ABI::Windows::UI::Core::ICoreWindow&gt; coreWin;
+    if (SUCCEEDED(win.As(&amp;coreWin)))
+    {
+        if (coreWindow != nullptr)
+        {
+            *coreWindow = coreWin.Detach();
+        }
+        return true;
+    }
+
+    return false;
+}
+
+bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr&lt;ABI::Windows::UI::Xaml::Controls::ISwapChainPanel&gt; *swapChainPanel)
+{
+    if (!window)
+    {
+        return false;
+    }
+
+    ComPtr&lt;IInspectable&gt; win = window;
+    ComPtr&lt;ABI::Windows::UI::Xaml::Controls::ISwapChainPanel&gt; panel;
+    if (SUCCEEDED(win.As(&amp;panel)))
+    {
+        if (swapChainPanel != nullptr)
+        {
+            *swapChainPanel = panel.Detach();
+        }
+        return true;
+    }
+
+    return false;
+}
+
+bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet, IInspectable **eglNativeWindow)
+{
+    if (!window)
+    {
+        return false;
+    }
+
+    ComPtr&lt;IInspectable&gt; props = window;
+    ComPtr&lt;IPropertySet&gt; propSet;
+    ComPtr&lt;IInspectable&gt; nativeWindow;
+    ComPtr&lt;ABI::Windows::Foundation::Collections::IMap&lt;HSTRING, IInspectable*&gt;&gt; propMap;
+    boolean hasEglNativeWindowPropertyKey = false;
+
+    HRESULT result = props.As(&amp;propSet);
+    if (SUCCEEDED(result))
+    {
+        result = propSet.As(&amp;propMap);
+    }
+
+    // Look for the presence of the EGLNativeWindowType in the property set
+    if (SUCCEEDED(result))
+    {
+        result = propMap-&gt;HasKey(HStringReference(EGLNativeWindowTypeProperty).Get(), &amp;hasEglNativeWindowPropertyKey);
+    }
+
+    // If the IPropertySet does not contain the required EglNativeWindowType key, the property set is
+    // considered invalid.
+    if (SUCCEEDED(result) &amp;&amp; !hasEglNativeWindowPropertyKey)
+    {
+        ERR(&quot;Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid EGLNativeWindowTypeProperty values include ICoreWindow&quot;);
+        return false;
+    }
+
+    // The EglNativeWindowType property exists, so retreive the IInspectable that represents the EGLNativeWindowType
+    if (SUCCEEDED(result) &amp;&amp; hasEglNativeWindowPropertyKey)
+    {
+        result = propMap-&gt;Lookup(HStringReference(EGLNativeWindowTypeProperty).Get(), &amp;nativeWindow);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        if (propertySet != nullptr)
+        {
+            result = propSet.CopyTo(propertySet);
+        }
+    }
+
+    if (SUCCEEDED(result))
+    {
+        if (eglNativeWindow != nullptr)
+        {
+            result = nativeWindow.CopyTo(eglNativeWindow);
+        }
+    }
+
+    if (SUCCEEDED(result))
+    {
+        return true;
+    }
+
+    return false;
+}
+
+// A Valid EGLNativeWindowType IInspectable can only be:
+//
+// ICoreWindow
+// IPropertySet
+// 
+// Anything else will be rejected as an invalid IInspectable.
+bool IsValidEGLNativeWindowType(EGLNativeWindowType window)
+{
+    return IsCoreWindow(window) || IsSwapChainPanel(window) || IsEGLConfiguredPropertySet(window);
+}
+
+// Attempts to read an optional SIZE property value that is assumed to be in the form of
+// an ABI::Windows::Foundation::Size.  This function validates the Size value before returning 
+// it to the caller.
+//
+// Possible return values are:
+// S_OK, valueExists == true - optional SIZE value was successfully retrieved and validated
+// S_OK, valueExists == false - optional SIZE value was not found
+// E_INVALIDARG, valueExists = false - optional SIZE value was malformed in the property set.
+//    * Incorrect property type ( must be PropertyType_Size)
+//    * Invalid property value (width/height must be &gt; 0)
+// Additional errors may be returned from IMap or IPropertyValue
+//
+HRESULT GetOptionalSizePropertyValue(const ComPtr&lt;ABI::Windows::Foundation::Collections::IMap&lt;HSTRING, IInspectable*&gt;&gt;&amp; propertyMap, const wchar_t *propertyName, SIZE *value, bool *valueExists)
+{
+    if (!propertyMap || !propertyName || !value || !valueExists)
+    {
+        return false;
+    }
+
+    // Assume that the value does not exist
+    *valueExists = false;
+    *value = { 0, 0 };
+
+    ComPtr&lt;ABI::Windows::Foundation::IPropertyValue&gt; propertyValue;
+    ABI::Windows::Foundation::PropertyType propertyType = ABI::Windows::Foundation::PropertyType::PropertyType_Empty;
+    Size sizeValue = { 0, 0 };
+    boolean hasKey = false;
+
+    HRESULT result = propertyMap-&gt;HasKey(HStringReference(propertyName).Get(), &amp;hasKey);
+    if (SUCCEEDED(result) &amp;&amp; !hasKey)
+    {
+        // Value does not exist, so return S_OK and set the exists parameter to false to indicate
+        // that a the optional property does not exist.
+        *valueExists = false;
+        return S_OK;
+    }
+
+    if (SUCCEEDED(result))
+    {
+        result = propertyMap-&gt;Lookup(HStringReference(propertyName).Get(), &amp;propertyValue);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        result = propertyValue-&gt;get_Type(&amp;propertyType);
+    }
+
+    // Check if the expected Size property is of PropertyType_Size type.
+    if (SUCCEEDED(result) &amp;&amp; propertyType == ABI::Windows::Foundation::PropertyType::PropertyType_Size)
+    {
+        if (SUCCEEDED(propertyValue-&gt;GetSize(&amp;sizeValue)) &amp;&amp; (sizeValue.Width &gt; 0 &amp;&amp; sizeValue.Height &gt; 0))
+        {
+            // A valid property value exists
+            *value = { static_cast&lt;long&gt;(sizeValue.Width), static_cast&lt;long&gt;(sizeValue.Height) };
+            *valueExists = true;
+            result = S_OK;
+        }
+        else
+        {
+            // An invalid Size property was detected. Width/Height values must &gt; 0
+            result = E_INVALIDARG;
+        }
+    }
+    else
+    {
+        // An invalid property type was detected. Size property must be of PropertyType_Size
+        result = E_INVALIDARG;
+    }
+
+    return result;
+}
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtInspectableNativeWindowh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// InspectableNativeWindow.h: Host specific implementation interface for
+// managing IInspectable native window types.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
+
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+
+#include &quot;common/platform.h&quot;
+
+#include &quot;angle_windowsstore.h&quot;
+
+#include &lt;windows.ui.xaml.h&gt;
+#include &lt;windows.ui.xaml.media.dxinterop.h&gt;
+
+using namespace Microsoft::WRL;
+using namespace Microsoft::WRL::Wrappers;
+using namespace ABI::Windows::Foundation;
+using namespace ABI::Windows::Foundation::Collections;
+
+namespace rx
+{
+class InspectableNativeWindow
+{
+  public:
+    InspectableNativeWindow() :
+        mSupportsSwapChainResize(true),
+        mRequiresSwapChainScaling(false),
+        mClientRectChanged(false),
+        mClientRect({0,0,0,0}),
+        mNewClientRect({0,0,0,0})
+    {
+        mSizeChangedEventToken.value = 0;
+    }
+    virtual ~InspectableNativeWindow(){}
+
+    virtual bool initialize(EGLNativeWindowType window, IPropertySet *propertySet) = 0;
+    virtual HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) = 0;
+    virtual bool registerForSizeChangeEvents() = 0;
+    virtual void unregisterForSizeChangeEvents() = 0;
+    virtual HRESULT scaleSwapChain(const SIZE&amp; newSize) { return S_OK; }
+
+    bool getClientRect(RECT *rect)
+    {
+        if (mClientRectChanged &amp;&amp; mSupportsSwapChainResize)
+        {
+            mClientRect = mNewClientRect;
+        }
+
+        *rect = mClientRect;
+
+        return true;
+    }
+
+    void setNewClientSize(const SIZE &amp;newSize)
+    {
+        if (mSupportsSwapChainResize &amp;&amp; !mRequiresSwapChainScaling)
+        {
+            mNewClientRect = { 0, 0, newSize.cx, newSize.cy };
+            mClientRectChanged = true;
+        }
+
+        if (mRequiresSwapChainScaling)
+        {
+            scaleSwapChain(newSize);
+        }
+    }
+
+protected:
+    bool mSupportsSwapChainResize;
+    bool mRequiresSwapChainScaling;
+    RECT mClientRect;
+    RECT mNewClientRect;
+    bool mClientRectChanged;
+
+    EventRegistrationToken mSizeChangedEventToken;
+};
+
+bool IsValidEGLNativeWindowType(EGLNativeWindowType window);
+bool IsCoreWindow(EGLNativeWindowType window, ComPtr&lt;ABI::Windows::UI::Core::ICoreWindow&gt; *coreWindow = nullptr);
+bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr&lt;ABI::Windows::UI::Xaml::Controls::ISwapChainPanel&gt; *swapChainPanel = nullptr);
+bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet = nullptr, IInspectable **inspectable = nullptr);
+HRESULT GetOptionalSizePropertyValue(const ComPtr&lt;ABI::Windows::Foundation::Collections::IMap&lt;HSTRING, IInspectable*&gt;&gt;&amp; propertyMap, const wchar_t *propertyName, SIZE *value, bool *valueExists);
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_INSPECTABLENATIVEWINDOW_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtSwapChainPanelNativeWindowcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,228 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// SwapChainPanelNativeWindow.cpp: NativeWindow for managing ISwapChainPanel native window types.
+
+#include &quot;libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h&quot;
+
+#include &lt;algorithm&gt;
+#include &lt;math.h&gt;
+
+using namespace ABI::Windows::Foundation::Collections;
+
+namespace rx
+{
+SwapChainPanelNativeWindow::~SwapChainPanelNativeWindow()
+{
+    unregisterForSizeChangeEvents();
+}
+
+bool SwapChainPanelNativeWindow::initialize(EGLNativeWindowType window, IPropertySet *propertySet)
+{
+    ComPtr&lt;IPropertySet&gt; props = propertySet;
+    ComPtr&lt;IInspectable&gt; win = window;
+    SIZE swapChainSize = {};
+    bool swapChainSizeSpecified = false;
+    HRESULT result = S_OK;
+
+    // IPropertySet is an optional parameter and can be null.
+    // If one is specified, cache as an IMap and read the properties
+    // used for initial host initialization.
+    if (propertySet)
+    {
+        result = props.As(&amp;mPropertyMap);
+        if (SUCCEEDED(result))
+        {
+            // The EGLRenderSurfaceSizeProperty is optional and may be missing.  The IPropertySet
+            // was prevalidated to contain the EGLNativeWindowType before being passed to
+            // this host.
+            result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &amp;swapChainSize, &amp;swapChainSizeSpecified);
+        }
+    }
+
+    if (SUCCEEDED(result))
+    {
+        result = win.As(&amp;mSwapChainPanel);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        // If a swapchain size is specfied, then the automatic resize
+        // behaviors implemented by the host should be disabled.  The swapchain
+        // will be still be scaled when being rendered to fit the bounds
+        // of the host.
+        // Scaling of the swapchain output needs to be handled by the
+        // host for swapchain panels even though the scaling mode setting
+        // DXGI_SCALING_STRETCH is configured on the swapchain.
+        if (swapChainSizeSpecified)
+        {
+            mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
+
+            // Enable host swapchain scaling
+            mRequiresSwapChainScaling = true;
+        }
+        else
+        {
+            result = GetSwapChainPanelSize(mSwapChainPanel, &amp;mClientRect);
+        }
+    }
+
+    if (SUCCEEDED(result))
+    {
+        mNewClientRect = mClientRect;
+        mClientRectChanged = false;
+        return registerForSizeChangeEvents();
+    }
+
+    return false;
+}
+
+bool SwapChainPanelNativeWindow::registerForSizeChangeEvents()
+{
+    ComPtr&lt;ABI::Windows::UI::Xaml::ISizeChangedEventHandler&gt; sizeChangedHandler;
+    ComPtr&lt;ABI::Windows::UI::Xaml::IFrameworkElement&gt; frameworkElement;
+    HRESULT result = Microsoft::WRL::MakeAndInitialize&lt;SwapChainPanelSizeChangedHandler&gt;(sizeChangedHandler.ReleaseAndGetAddressOf(), this-&gt;shared_from_this());
+
+    if (SUCCEEDED(result))
+    {
+        result = mSwapChainPanel.As(&amp;frameworkElement);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        result = frameworkElement-&gt;add_SizeChanged(sizeChangedHandler.Get(), &amp;mSizeChangedEventToken);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        return true;
+    }
+
+    return false;
+}
+
+void SwapChainPanelNativeWindow::unregisterForSizeChangeEvents()
+{
+    ComPtr&lt;ABI::Windows::UI::Xaml::IFrameworkElement&gt; frameworkElement;
+    if (SUCCEEDED(mSwapChainPanel.As(&amp;frameworkElement)))
+    {
+        (void)frameworkElement-&gt;remove_SizeChanged(mSizeChangedEventToken);
+    }
+
+    mSizeChangedEventToken.value = 0;
+}
+
+HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
+{
+    if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
+    {
+        return E_INVALIDARG;
+    }
+
+    DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
+    swapChainDesc.Width = width;
+    swapChainDesc.Height = height;
+    swapChainDesc.Format = format;
+    swapChainDesc.Stereo = FALSE;
+    swapChainDesc.SampleDesc.Count = 1;
+    swapChainDesc.SampleDesc.Quality = 0;
+    swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
+    swapChainDesc.BufferCount = 2;
+    swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
+    swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
+    swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
+
+    *swapChain = nullptr;
+
+    ComPtr&lt;IDXGISwapChain1&gt; newSwapChain;
+    ComPtr&lt;ISwapChainPanelNative&gt; swapChainPanelNative;
+    RECT currentPanelSize = {};
+
+    HRESULT result = factory-&gt;CreateSwapChainForComposition(device, &amp;swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
+
+    if (SUCCEEDED(result))
+    {
+        result = mSwapChainPanel.As(&amp;swapChainPanelNative);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        result = swapChainPanelNative-&gt;SetSwapChain(newSwapChain.Get());
+    }
+
+    if (SUCCEEDED(result))
+    {
+        // The swapchain panel host requires an instance of the swapchain set on the SwapChainPanel
+        // to perform the runtime-scale behavior.  This swapchain is cached here because there are
+        // no methods for retreiving the currently configured on from ISwapChainPanelNative.
+        mSwapChain = newSwapChain;
+        result = newSwapChain.CopyTo(swapChain);
+    }
+
+    // If the host is responsible for scaling the output of the swapchain, then
+    // scale it now before returning an instance to the caller.  This is done by
+    // first reading the current size of the swapchain panel, then scaling
+    if (SUCCEEDED(result) &amp;&amp; mRequiresSwapChainScaling)
+    {
+        result = GetSwapChainPanelSize(mSwapChainPanel, &amp;currentPanelSize);
+    }
+
+    // Scale the swapchain to fit inside the contents of the panel.
+    if (SUCCEEDED(result) &amp;&amp; mRequiresSwapChainScaling)
+    {
+        SIZE currentSize = { currentPanelSize.right, currentPanelSize.bottom };
+        result = scaleSwapChain(currentSize);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        // If automatic swapchain resize behaviors have been disabled, then
+        // unregister for the resize change events.
+        if (mSupportsSwapChainResize == false)
+        {
+            unregisterForSizeChangeEvents();
+        }
+    }
+
+    return result;
+}
+
+HRESULT SwapChainPanelNativeWindow::scaleSwapChain(const SIZE &amp;newSize)
+{
+    ABI::Windows::Foundation::Size renderScale = { (float)newSize.cx/(float)mClientRect.right, (float)newSize.cy/(float)mClientRect.bottom };
+    // Setup a scale matrix for the swap chain
+    DXGI_MATRIX_3X2_F scaleMatrix = {};
+    scaleMatrix._11 = renderScale.Width;
+    scaleMatrix._22 = renderScale.Height;
+
+    ComPtr&lt;IDXGISwapChain2&gt; swapChain2;
+    HRESULT result = mSwapChain.As(&amp;swapChain2);
+    if (SUCCEEDED(result))
+    {
+        result = swapChain2-&gt;SetMatrixTransform(&amp;scaleMatrix);
+    }
+
+    return result;
+}
+
+HRESULT GetSwapChainPanelSize(const ComPtr&lt;ABI::Windows::UI::Xaml::Controls::ISwapChainPanel&gt; &amp;swapChainPanel, RECT *windowSize)
+{
+    ComPtr&lt;ABI::Windows::UI::Xaml::IUIElement&gt; uiElement;
+    ABI::Windows::Foundation::Size renderSize = { 0, 0 };
+    HRESULT result = swapChainPanel.As(&amp;uiElement);
+    if (SUCCEEDED(result))
+    {
+        result = uiElement-&gt;get_RenderSize(&amp;renderSize);
+    }
+
+    if (SUCCEEDED(result))
+    {
+        *windowSize = { 0, 0, lround(renderSize.Width), lround(renderSize.Height) };
+    }
+
+    return result;
+}
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtSwapChainPanelNativeWindowh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// SwapChainPanelNativeWindow.h: NativeWindow for managing ISwapChainPanel native window types.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
+#define LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
+
+#include &quot;libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h&quot;
+
+namespace rx
+{
+class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this&lt;SwapChainPanelNativeWindow&gt;
+{
+  public:
+    ~SwapChainPanelNativeWindow();
+
+    bool initialize(EGLNativeWindowType window, IPropertySet *propertySet);
+    bool registerForSizeChangeEvents();
+    void unregisterForSizeChangeEvents();
+    HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain);
+    HRESULT scaleSwapChain(const SIZE &amp;newSize);
+
+  private:
+    ComPtr&lt;ABI::Windows::UI::Xaml::Controls::ISwapChainPanel&gt; mSwapChainPanel;
+    ComPtr&lt;IMap&lt;HSTRING, IInspectable*&gt;&gt; mPropertyMap;
+    ComPtr&lt;DXGISwapChain&gt; mSwapChain;
+};
+
+[uuid(8ACBD974-8187-4508-AD80-AEC77F93CF36)]
+class SwapChainPanelSizeChangedHandler :
+    public Microsoft::WRL::RuntimeClass&lt;Microsoft::WRL::RuntimeClassFlags&lt;Microsoft::WRL::ClassicCom&gt;, ABI::Windows::UI::Xaml::ISizeChangedEventHandler&gt;
+{
+  public:
+    SwapChainPanelSizeChangedHandler() { }
+    HRESULT RuntimeClassInitialize(std::shared_ptr&lt;InspectableNativeWindow&gt; host)
+    {
+        if (!host)
+        {
+            return E_INVALIDARG;
+        }
+
+        mHost = host;
+        return S_OK;
+    }
+
+    // ISizeChangedEventHandler
+    IFACEMETHOD(Invoke)(IInspectable *sender, ABI::Windows::UI::Xaml::ISizeChangedEventArgs *sizeChangedEventArgs)
+    {
+        std::shared_ptr&lt;InspectableNativeWindow&gt; host = mHost.lock();
+        if (host)
+        {
+            // The size of the ISwapChainPanel control is returned in DIPs.
+            // We are keeping these in dips because the swapchain created for composition
+            // also uses dip units. This keeps dimensions, viewports, etc in the same unit.
+            // XAML Clients of the ISwapChainPanel are required to use dips to define their
+            // layout sizes as well.
+            ABI::Windows::Foundation::Size newSize;
+            HRESULT result = sizeChangedEventArgs-&gt;get_NewSize(&amp;newSize);
+            if (SUCCEEDED(result))
+            {
+                SIZE windowSize = { lround(newSize.Width), lround(newSize.Height) };
+                host-&gt;setNewClientSize(windowSize);
+            }
+        }
+
+        return S_OK;
+    }
+
+  private:
+    std::weak_ptr&lt;InspectableNativeWindow&gt; mHost;
+};
+
+HRESULT GetSwapChainPanelSize(const ComPtr&lt;ABI::Windows::UI::Xaml::Controls::ISwapChainPanel&gt; &amp;swapChainPanel, RECT *windowSize);
+}
+#endif // LIBANGLE_RENDERER_D3D_D3D11_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d11winrtSwapChainPanelNativeWindow_unittestcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow_unittest.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow_unittest.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow_unittest.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,306 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;gmock/gmock.h&quot;
+#include &quot;gtest/gtest.h&quot;
+
+// WINAPI_FAMILY is required to be defined as WINAPI_FAMILY_PC_APP
+// to ensure that the proper defines are set when including additional
+// headers which rely on Windows Store specific configuration.
+// This would normally be defined already but this unittest exe is compiled
+// as a desktop application which results in WINAPI_FAMILY being
+// set to WINAPI_FAMILY_DESKTOP_APP
+#undef WINAPI_FAMILY
+#define WINAPI_FAMILY WINAPI_FAMILY_PC_APP
+#include &quot;libANGLE/renderer/d3d/d3d11/NativeWindow.h&quot;
+#include &lt;angle_windowsstore.h&gt;
+#include &lt;windows.ui.xaml.h&gt;
+#include &lt;windows.ui.xaml.media.dxinterop.h&gt;
+
+using namespace rx;
+using namespace ABI::Windows::ApplicationModel::Core;
+using namespace ABI::Windows::Foundation;
+using namespace ABI::Windows::Foundation::Collections;
+using namespace ABI::Windows::UI::Core;
+using namespace ABI::Windows::System;
+using namespace ABI::Windows::UI::Xaml::Controls;
+using namespace ABI::Windows::UI::Xaml::Data;
+using namespace ABI::Windows::UI::Xaml::Media;
+using namespace ABI::Windows::UI::Xaml::Input;
+using namespace ABI::Windows::UI::Xaml;
+
+namespace
+{
+
+// Mock ISwapChainPanel
+class MockSwapChainPanel : public ISwapChainPanel,
+                                  IFrameworkElement,
+                                  IUIElement,
+                                  ISwapChainPanelNative
+{
+  public:
+    // IUnknown
+    STDMETHOD(QueryInterface)(REFIID riid, void** ppvObject)
+    {
+        *ppvObject = NULL;
+
+        if (IsEqualIID(IID_IUnknown, riid))
+        {
+            *ppvObject = reinterpret_cast&lt;IUnknown*&gt;(this);
+            return S_OK;
+        }
+
+        if (IsEqualIID(IID_IInspectable, riid))
+        {
+            *ppvObject = reinterpret_cast&lt;IInspectable*&gt;(this);
+            return S_OK;
+        }
+
+        if (IsEqualIID(IID_ISwapChainPanel, riid))
+        {
+            *ppvObject = static_cast&lt;ISwapChainPanel*&gt;(this);
+            return S_OK;
+        }
+
+        if (IsEqualIID(IID_IFrameworkElement, riid))
+        {
+            *ppvObject = static_cast&lt;IFrameworkElement*&gt;(this);
+            return S_OK;
+        }
+
+        if (IsEqualIID(IID_IUIElement, riid))
+        {
+            *ppvObject = static_cast&lt;IUIElement*&gt;(this);
+            return S_OK;
+        }
+
+        if (IsEqualIID(__uuidof(ISwapChainPanelNative), riid))
+        {
+            *ppvObject = static_cast&lt;ISwapChainPanelNative*&gt;(this);
+            return S_OK;
+        }
+
+        return E_NOINTERFACE;
+    }
+
+    STDMETHOD_(ULONG, AddRef)(){ return 1; }
+    STDMETHOD_(ULONG, Release)(){ return 1; }
+
+    // IInspectable
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, GetIids, HRESULT(ULONG *, IID**));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, GetRuntimeClassName, HRESULT(HSTRING *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, GetTrustLevel, HRESULT(TrustLevel *));
+
+    // ISwapChainPanelNative
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, SetSwapChain, HRESULT(IDXGISwapChain *));
+
+    // ISwapChainPanel
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_CompositionScaleX, HRESULT(FLOAT *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_CompositionScaleY, HRESULT(FLOAT *));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_CompositionScaleChanged, HRESULT(__FITypedEventHandler_2_Windows__CUI__CXaml__CControls__CSwapChainPanel_IInspectable*, EventRegistrationToken*));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_CompositionScaleChanged, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, CreateCoreIndependentInputSource, HRESULT(CoreInputDeviceTypes, ICoreInputSourceBase**));
+
+    // IFrameworkElement
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Triggers, HRESULT(__FIVector_1_Windows__CUI__CXaml__CTriggerBase **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Resources, HRESULT(IResourceDictionary **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Resources, HRESULT(IResourceDictionary *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Tag, HRESULT(IInspectable **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Tag, HRESULT(IInspectable *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Language, HRESULT(HSTRING *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Language, HRESULT(HSTRING));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_ActualWidth, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_ActualHeight, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Width, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Width, HRESULT(DOUBLE));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Height, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Height, HRESULT(DOUBLE));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_MinWidth, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_MinWidth, HRESULT(DOUBLE));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_MaxWidth, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_MaxWidth, HRESULT(DOUBLE));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_MinHeight, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_MinHeight, HRESULT(DOUBLE));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_MaxHeight, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_MaxHeight, HRESULT(DOUBLE));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_HorizontalAlignment, HRESULT(HorizontalAlignment *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_HorizontalAlignment, HRESULT(HorizontalAlignment));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_VerticalAlignment, HRESULT(VerticalAlignment *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_VerticalAlignment, HRESULT(VerticalAlignment));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Margin, HRESULT(Thickness *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Margin, HRESULT(Thickness));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Name, HRESULT(HSTRING*));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Name, HRESULT(HSTRING));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_BaseUri, HRESULT(IUriRuntimeClass **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_DataContext, HRESULT(IInspectable **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_DataContext, HRESULT(IInspectable *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Style, HRESULT(IStyle **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Style, HRESULT(IStyle *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Parent, HRESULT(IDependencyObject **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_FlowDirection, HRESULT(FlowDirection *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_FlowDirection, HRESULT(FlowDirection));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_Loaded, HRESULT(IRoutedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_Loaded, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_Unloaded, HRESULT(IRoutedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_Unloaded, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_SizeChanged, HRESULT(ISizeChangedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_SizeChanged, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_LayoutUpdated, HRESULT(__FIEventHandler_1_IInspectable *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_LayoutUpdated, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, FindName, HRESULT(HSTRING, IInspectable **));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, SetBinding, HRESULT(IDependencyProperty *, IBindingBase *));
+
+    // IUIElement
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_DesiredSize, HRESULT(ABI::Windows::Foundation::Size *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_AllowDrop, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_AllowDrop, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Opacity, HRESULT(DOUBLE *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Opacity, HRESULT(DOUBLE));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Clip, HRESULT(IRectangleGeometry **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Clip, HRESULT(IRectangleGeometry *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_RenderTransform, HRESULT(ITransform **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_RenderTransform, HRESULT(ITransform *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Projection, HRESULT(IProjection **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Projection, HRESULT(IProjection *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_RenderTransformOrigin, HRESULT(Point *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_RenderTransformOrigin, HRESULT(Point));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_IsHitTestVisible, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_IsHitTestVisible, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Visibility, HRESULT(Visibility *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Visibility, HRESULT(Visibility));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_RenderSize, HRESULT(Size *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_UseLayoutRounding, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_UseLayoutRounding, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_Transitions, HRESULT(__FIVector_1_Windows__CUI__CXaml__CMedia__CAnimation__CTransition **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_Transitions, HRESULT(__FIVector_1_Windows__CUI__CXaml__CMedia__CAnimation__CTransition *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_CacheMode, HRESULT(ICacheMode **));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_CacheMode, HRESULT(ICacheMode *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_IsTapEnabled, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_IsTapEnabled, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_IsDoubleTapEnabled, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_IsDoubleTapEnabled, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_IsRightTapEnabled, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_IsRightTapEnabled, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_IsHoldingEnabled, HRESULT(boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_IsHoldingEnabled, HRESULT(boolean));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_ManipulationMode, HRESULT(ManipulationModes *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, put_ManipulationMode, HRESULT(ManipulationModes));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, get_PointerCaptures, HRESULT(__FIVectorView_1_Windows__CUI__CXaml__CInput__CPointer **));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_KeyUp, HRESULT(IKeyEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_KeyUp, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_KeyDown, HRESULT(IKeyEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_KeyDown, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_GotFocus, HRESULT(IRoutedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_GotFocus, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_LostFocus, HRESULT(IRoutedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_LostFocus, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_DragEnter, HRESULT(IDragEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_DragEnter, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_DragLeave, HRESULT(IDragEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_DragLeave, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_DragOver, HRESULT(IDragEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_DragOver, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_Drop, HRESULT(IDragEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_Drop, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerPressed, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerPressed, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerMoved, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerMoved, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerReleased, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerReleased, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerExited, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerExited, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerCaptureLost, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerCaptureLost, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerCanceled, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerCanceled, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerWheelChanged, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerWheelChanged, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_PointerEntered, HRESULT(IPointerEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_PointerEntered, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_Tapped, HRESULT(ITappedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_Tapped, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_DoubleTapped, HRESULT(IDoubleTappedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_DoubleTapped, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_Holding, HRESULT(IHoldingEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_Holding, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_RightTapped, HRESULT(IRightTappedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_RightTapped, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_ManipulationStarting, HRESULT(IManipulationStartingEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_ManipulationStarting, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_ManipulationInertiaStarting, HRESULT(IManipulationInertiaStartingEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_ManipulationInertiaStarting, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_ManipulationStarted, HRESULT(IManipulationStartedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_ManipulationStarted, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_ManipulationDelta, HRESULT(IManipulationDeltaEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_ManipulationDelta, HRESULT(EventRegistrationToken));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, add_ManipulationCompleted, HRESULT(IManipulationCompletedEventHandler *, EventRegistrationToken *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, remove_ManipulationCompleted, HRESULT(EventRegistrationToken));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Measure, HRESULT(Size));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, Arrange, HRESULT(Rect));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, CapturePointer, HRESULT(IPointer *, boolean *));
+    MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, ReleasePointerCapture, HRESULT(IPointer *));
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, ReleasePointerCaptures, HRESULT());
+    MOCK_METHOD3_WITH_CALLTYPE(STDMETHODCALLTYPE, AddHandler, HRESULT(IRoutedEvent *, IInspectable *, boolean));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, RemoveHandler, HRESULT(IRoutedEvent *, IInspectable *));
+    MOCK_METHOD2_WITH_CALLTYPE(STDMETHODCALLTYPE, TransformToVisual, HRESULT(IUIElement *, IGeneralTransform **));
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, InvalidateMeasure, HRESULT());
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, InvalidateArrange, HRESULT());
+    MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, UpdateLayout, HRESULT());
+};
+
+HRESULT CreatePropertyMap(IMap&lt;HSTRING, IInspectable*&gt;** propertyMap)
+{
+    HRESULT result = S_OK;
+    ComPtr&lt;IPropertySet&gt; propertySet;
+    ComPtr&lt;IActivationFactory&gt; propertySetFactory;
+    result = GetActivationFactory(HStringReference(RuntimeClass_Windows_Foundation_Collections_PropertySet).Get(), &amp;propertySetFactory);
+    EXPECT_HRESULT_SUCCEEDED(result);
+
+    result = propertySetFactory-&gt;ActivateInstance(&amp;propertySet);
+    EXPECT_HRESULT_SUCCEEDED(result);
+
+    result = propertySet.CopyTo(propertyMap);
+    EXPECT_HRESULT_SUCCEEDED(result);
+
+    return result;
+}
+
+HRESULT SetInspectablePropertyValue(const ComPtr&lt;IMap&lt;HSTRING, IInspectable*&gt;&gt;&amp; propertyMap, const wchar_t* propertyName, IInspectable* inspectable)
+{
+    boolean propertyReplaced = false;
+    return propertyMap-&gt;Insert(HStringReference(propertyName).Get(), inspectable, &amp;propertyReplaced);
+}
+
+TEST(NativeWindowTest, NativeWindowValidSwapChainPanel)
+{
+    MockSwapChainPanel mockSwapChainPanel;
+    NativeWindow nativeWindow(reinterpret_cast&lt;IInspectable*&gt;(&amp;mockSwapChainPanel));
+    EXPECT_CALL(mockSwapChainPanel, get_RenderSize(testing::_)).Times(1);
+    EXPECT_CALL(mockSwapChainPanel, add_SizeChanged(testing::_, testing::_)).Times(1);
+    EXPECT_CALL(mockSwapChainPanel, remove_SizeChanged(testing::_)).Times(1);
+    EXPECT_TRUE(nativeWindow.initialize());
+}
+
+TEST(NativeWindowTest, NativeWindowValidSwapChainPanelInPropertySet)
+{
+    // COM is required to be initialized for creation of the property set
+    EXPECT_HRESULT_SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED));
+    {
+        MockSwapChainPanel mockSwapChainPanel;
+        ComPtr&lt;IMap&lt;HSTRING, IInspectable*&gt;&gt; propertySet;
+        EXPECT_HRESULT_SUCCEEDED(CreatePropertyMap(&amp;propertySet));
+        EXPECT_HRESULT_SUCCEEDED(SetInspectablePropertyValue(propertySet, EGLNativeWindowTypeProperty, reinterpret_cast&lt;IInspectable*&gt;(&amp;mockSwapChainPanel)));
+        NativeWindow nativeWindow(propertySet.Get());
+        EXPECT_CALL(mockSwapChainPanel, get_RenderSize(testing::_)).Times(1);
+        EXPECT_CALL(mockSwapChainPanel, add_SizeChanged(testing::_, testing::_)).Times(1);
+        EXPECT_CALL(mockSwapChainPanel, remove_SizeChanged(testing::_)).Times(1);
+        EXPECT_TRUE(nativeWindow.initialize());
+    }
+    CoUninitialize();
+}
+
+} // namespace
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Blit9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,679 @@
</span><ins>+//
+// 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.
+//
+
+// Blit9.cpp: Surface copy utility class.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/Blit9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/TextureStorage9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+namespace
+{
+// Precompiled shaders
+#include &quot;libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h&quot;
+
+const BYTE* const g_shaderCode[] =
+{
+    g_vs20_standardvs,
+    g_vs20_flipyvs,
+    g_ps20_passthroughps,
+    g_ps20_luminanceps,
+    g_ps20_componentmaskps
+};
+
+const size_t g_shaderSize[] =
+{
+    sizeof(g_vs20_standardvs),
+    sizeof(g_vs20_flipyvs),
+    sizeof(g_ps20_passthroughps),
+    sizeof(g_ps20_luminanceps),
+    sizeof(g_ps20_componentmaskps)
+};
+}
+
+namespace rx
+{
+
+Blit9::Blit9(Renderer9 *renderer)
+    : mRenderer(renderer),
+      mGeometryLoaded(false),
+      mQuadVertexBuffer(NULL),
+      mQuadVertexDeclaration(NULL),
+      mSavedStateBlock(NULL),
+      mSavedRenderTarget(NULL),
+      mSavedDepthStencil(NULL)
+{
+    memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
+}
+
+Blit9::~Blit9()
+{
+    SafeRelease(mSavedStateBlock);
+    SafeRelease(mQuadVertexBuffer);
+    SafeRelease(mQuadVertexDeclaration);
+
+    for (int i = 0; i &lt; SHADER_COUNT; i++)
+    {
+        SafeRelease(mCompiledShaders[i]);
+    }
+}
+
+gl::Error Blit9::initialize()
+{
+    if (mGeometryLoaded)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    static const float quad[] =
+    {
+        -1, -1,
+        -1,  1,
+         1, -1,
+         1,  1
+    };
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    HRESULT result = device-&gt;CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &amp;mQuadVertexBuffer, NULL);
+
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal blit vertex shader, result: 0x%X.&quot;, result);
+    }
+
+    void *lockPtr = NULL;
+    result = mQuadVertexBuffer-&gt;Lock(0, 0, &amp;lockPtr, 0);
+
+    if (FAILED(result) || lockPtr == NULL)
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        SafeRelease(mQuadVertexBuffer);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock internal blit vertex shader, result: 0x%X.&quot;, result);
+    }
+
+    memcpy(lockPtr, quad, sizeof(quad));
+    mQuadVertexBuffer-&gt;Unlock();
+
+    static const D3DVERTEXELEMENT9 elements[] =
+    {
+        { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
+        D3DDECL_END()
+    };
+
+    result = device-&gt;CreateVertexDeclaration(elements, &amp;mQuadVertexDeclaration);
+
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        SafeRelease(mQuadVertexBuffer);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock internal blit vertex declaration, result: 0x%X.&quot;, result);
+    }
+
+    mGeometryLoaded = true;
+    return gl::Error(GL_NO_ERROR);
+}
+
+template &lt;class D3DShaderType&gt;
+gl::Error Blit9::setShader(ShaderId source, const char *profile,
+                           gl::Error (Renderer9::*createShader)(const DWORD *, size_t length, D3DShaderType **outShader),
+                           HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
+{
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    D3DShaderType *shader;
+
+    if (mCompiledShaders[source] != NULL)
+    {
+        shader = static_cast&lt;D3DShaderType*&gt;(mCompiledShaders[source]);
+    }
+    else
+    {
+        const BYTE* shaderCode = g_shaderCode[source];
+        size_t shaderSize = g_shaderSize[source];
+
+        gl::Error error = (mRenderer-&gt;*createShader)(reinterpret_cast&lt;const DWORD*&gt;(shaderCode), shaderSize, &amp;shader);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mCompiledShaders[source] = shader;
+    }
+
+    HRESULT hr = (device-&gt;*setShader)(shader);
+    if (FAILED(hr))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to set shader for blit operation, result: 0x%X.&quot;, hr);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Blit9::setVertexShader(ShaderId shader)
+{
+    return setShader&lt;IDirect3DVertexShader9&gt;(shader, &quot;vs_2_0&quot;, &amp;Renderer9::createVertexShader, &amp;IDirect3DDevice9::SetVertexShader);
+}
+
+gl::Error Blit9::setPixelShader(ShaderId shader)
+{
+    return setShader&lt;IDirect3DPixelShader9&gt;(shader, &quot;ps_2_0&quot;, &amp;Renderer9::createPixelShader, &amp;IDirect3DDevice9::SetPixelShader);
+}
+
+RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
+{
+    D3DSURFACE_DESC desc;
+    surface-&gt;GetDesc(&amp;desc);
+
+    RECT rect;
+    rect.left = 0;
+    rect.top = 0;
+    rect.right = desc.Width;
+    rect.bottom = desc.Height;
+
+    return rect;
+}
+
+gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
+{
+    gl::Error error = initialize();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DTexture9 *texture = NULL;
+    error = copySurfaceToTexture(source, getSurfaceRect(source), &amp;texture);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    saveState();
+
+    device-&gt;SetTexture(0, texture);
+    device-&gt;SetRenderTarget(0, dest);
+
+    setVertexShader(SHADER_VS_STANDARD);
+    setPixelShader(SHADER_PS_PASSTHROUGH);
+
+    setCommonBlitState();
+    device-&gt;SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
+    device-&gt;SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
+
+    setViewport(getSurfaceRect(dest), gl::Offset(0, 0, 0));
+
+    render();
+
+    SafeRelease(texture);
+
+    restoreState();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level)
+{
+    gl::Error error = initialize();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    const gl::FramebufferAttachment *colorbuffer = framebuffer-&gt;getColorbuffer(0);
+    ASSERT(colorbuffer);
+
+    RenderTarget9 *renderTarget9 = nullptr;
+    error = colorbuffer-&gt;getRenderTarget(&amp;renderTarget9);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(renderTarget9);
+
+    IDirect3DSurface9 *source = renderTarget9-&gt;getSurface();
+    ASSERT(source);
+
+    IDirect3DSurface9 *destSurface = NULL;
+    TextureStorage9_2D *storage9 = GetAs&lt;TextureStorage9_2D&gt;(storage);
+    error = storage9-&gt;getSurfaceLevel(level, true, &amp;destSurface);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(destSurface);
+
+    gl::Error result = copy(source, sourceRect, destFormat, destOffset, destSurface);
+
+    SafeRelease(destSurface);
+    SafeRelease(source);
+
+    return result;
+}
+
+gl::Error Blit9::copyCube(const gl::Framebuffer *framebuffer, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, TextureStorage *storage, GLenum target, GLint level)
+{
+    gl::Error error = initialize();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    const gl::FramebufferAttachment *colorbuffer = framebuffer-&gt;getColorbuffer(0);
+    ASSERT(colorbuffer);
+
+    RenderTarget9 *renderTarget9 = nullptr;
+    error = colorbuffer-&gt;getRenderTarget(&amp;renderTarget9);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(renderTarget9);
+
+    IDirect3DSurface9 *source = renderTarget9-&gt;getSurface();
+    ASSERT(source);
+
+    IDirect3DSurface9 *destSurface = NULL;
+    TextureStorage9_Cube *storage9 = GetAs&lt;TextureStorage9_Cube&gt;(storage);
+    error = storage9-&gt;getCubeMapSurface(target, level, true, &amp;destSurface);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(destSurface);
+
+    gl::Error result = copy(source, sourceRect, destFormat, destOffset, destSurface);
+
+    SafeRelease(destSurface);
+    SafeRelease(source);
+
+    return result;
+}
+
+gl::Error Blit9::copy(IDirect3DSurface9 *source, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, IDirect3DSurface9 *dest)
+{
+    ASSERT(source != NULL &amp;&amp; dest != NULL);
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    D3DSURFACE_DESC sourceDesc;
+    D3DSURFACE_DESC destDesc;
+    source-&gt;GetDesc(&amp;sourceDesc);
+    dest-&gt;GetDesc(&amp;destDesc);
+
+    if (sourceDesc.Format == destDesc.Format &amp;&amp; destDesc.Usage &amp; D3DUSAGE_RENDERTARGET &amp;&amp;
+        d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat))   // Can use StretchRect
+    {
+        RECT destRect = { destOffset.x, destOffset.y, destOffset.x + (sourceRect.right - sourceRect.left), destOffset.y + (sourceRect.bottom - sourceRect.top)};
+        HRESULT result = device-&gt;StretchRect(source, &amp;sourceRect, dest, &amp;destRect, D3DTEXF_POINT);
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to blit between textures, StretchRect result: 0x%X.&quot;, result);
+        }
+
+        return gl::Error(GL_NO_ERROR);
+    }
+    else
+    {
+        return formatConvert(source, sourceRect, destFormat, destOffset, dest);
+    }
+}
+
+gl::Error Blit9::formatConvert(IDirect3DSurface9 *source, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, IDirect3DSurface9 *dest)
+{
+    gl::Error error = initialize();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DTexture9 *texture = NULL;
+    error = copySurfaceToTexture(source, sourceRect, &amp;texture);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    saveState();
+
+    device-&gt;SetTexture(0, texture);
+    device-&gt;SetRenderTarget(0, dest);
+
+    setViewport(sourceRect, destOffset);
+
+    setCommonBlitState();
+
+    error = setFormatConvertShaders(destFormat);
+    if (!error.isError())
+    {
+        render();
+    }
+
+    SafeRelease(texture);
+
+    restoreState();
+
+    return error;
+}
+
+gl::Error Blit9::setFormatConvertShaders(GLenum destFormat)
+{
+    gl::Error error = setVertexShader(SHADER_VS_STANDARD);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    switch (destFormat)
+    {
+      default: UNREACHABLE();
+      case GL_RGBA:
+      case GL_BGRA_EXT:
+      case GL_RGB:
+      case GL_RG_EXT:
+      case GL_RED_EXT:
+      case GL_ALPHA:
+        error = setPixelShader(SHADER_PS_COMPONENTMASK);
+        break;
+
+      case GL_LUMINANCE:
+      case GL_LUMINANCE_ALPHA:
+        error = setPixelShader(SHADER_PS_LUMINANCE);
+        break;
+    }
+
+    if (error.isError())
+    {
+        return error;
+    }
+
+    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.
+    // Allocate one array for both registers and split it into two float4's.
+    float psConst[8] = { 0 };
+    float *multConst = &amp;psConst[0];
+    float *addConst = &amp;psConst[4];
+
+    switch (destFormat)
+    {
+      default: UNREACHABLE();
+      case GL_RGBA:
+      case GL_BGRA_EXT:
+        multConst[X] = 1;
+        multConst[Y] = 1;
+        multConst[Z] = 1;
+        multConst[W] = 1;
+        addConst[X] = 0;
+        addConst[Y] = 0;
+        addConst[Z] = 0;
+        addConst[W] = 0;
+        break;
+
+      case GL_RGB:
+        multConst[X] = 1;
+        multConst[Y] = 1;
+        multConst[Z] = 1;
+        multConst[W] = 0;
+        addConst[X] = 0;
+        addConst[Y] = 0;
+        addConst[Z] = 0;
+        addConst[W] = 1;
+        break;
+
+      case GL_RG_EXT:
+        multConst[X] = 1;
+        multConst[Y] = 1;
+        multConst[Z] = 0;
+        multConst[W] = 0;
+        addConst[X] = 0;
+        addConst[Y] = 0;
+        addConst[Z] = 0;
+        addConst[W] = 1;
+        break;
+
+      case GL_RED_EXT:
+        multConst[X] = 1;
+        multConst[Y] = 0;
+        multConst[Z] = 0;
+        multConst[W] = 0;
+        addConst[X] = 0;
+        addConst[Y] = 0;
+        addConst[Z] = 0;
+        addConst[W] = 1;
+        break;
+
+      case GL_ALPHA:
+        multConst[X] = 0;
+        multConst[Y] = 0;
+        multConst[Z] = 0;
+        multConst[W] = 1;
+        addConst[X] = 0;
+        addConst[Y] = 0;
+        addConst[Z] = 0;
+        addConst[W] = 0;
+        break;
+
+      case GL_LUMINANCE:
+        multConst[X] = 1;
+        multConst[Y] = 0;
+        multConst[Z] = 0;
+        multConst[W] = 0;
+        addConst[X] = 0;
+        addConst[Y] = 0;
+        addConst[Z] = 0;
+        addConst[W] = 1;
+        break;
+
+      case GL_LUMINANCE_ALPHA:
+        multConst[X] = 1;
+        multConst[Y] = 0;
+        multConst[Z] = 0;
+        multConst[W] = 1;
+        addConst[X] = 0;
+        addConst[Y] = 0;
+        addConst[Z] = 0;
+        addConst[W] = 0;
+        break;
+    }
+
+    mRenderer-&gt;getDevice()-&gt;SetPixelShaderConstantF(0, psConst, 2);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &amp;sourceRect, IDirect3DTexture9 **outTexture)
+{
+    ASSERT(surface);
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    D3DSURFACE_DESC sourceDesc;
+    surface-&gt;GetDesc(&amp;sourceDesc);
+
+    // Copy the render target into a texture
+    IDirect3DTexture9 *texture;
+    HRESULT result = device-&gt;CreateTexture(sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &amp;texture, NULL);
+
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal texture for blit, result: 0x%X.&quot;, result);
+    }
+
+    IDirect3DSurface9 *textureSurface;
+    result = texture-&gt;GetSurfaceLevel(0, &amp;textureSurface);
+
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        SafeRelease(texture);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to query surface of internal blit texture, result: 0x%X.&quot;, result);
+    }
+
+    mRenderer-&gt;endScene();
+    result = device-&gt;StretchRect(surface, &amp;sourceRect, textureSurface, NULL, D3DTEXF_NONE);
+
+    SafeRelease(textureSurface);
+
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        SafeRelease(texture);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to copy between internal blit textures, result: 0x%X.&quot;, result);
+    }
+
+    *outTexture = texture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Blit9::setViewport(const RECT &amp;sourceRect, const gl::Offset &amp;offset)
+{
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    D3DVIEWPORT9 vp;
+    vp.X      = offset.x;
+    vp.Y      = offset.y;
+    vp.Width  = sourceRect.right - sourceRect.left;
+    vp.Height = sourceRect.bottom - sourceRect.top;
+    vp.MinZ   = 0.0f;
+    vp.MaxZ   = 1.0f;
+    device-&gt;SetViewport(&amp;vp);
+
+    float halfPixelAdjust[4] = { -1.0f/vp.Width, 1.0f/vp.Height, 0, 0 };
+    device-&gt;SetVertexShaderConstantF(0, halfPixelAdjust, 1);
+}
+
+void Blit9::setCommonBlitState()
+{
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    device-&gt;SetDepthStencilSurface(NULL);
+
+    device-&gt;SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+    device-&gt;SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+    device-&gt;SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+    device-&gt;SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+    device-&gt;SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+    device-&gt;SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
+    device-&gt;SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
+    device-&gt;SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+
+    device-&gt;SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+    device-&gt;SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
+    device-&gt;SetSamplerState(0, D3DSAMP_SRGBTEXTURE, FALSE);
+    device-&gt;SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+    device-&gt;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-&gt;SetScissorRect(&amp;scissorRect);
+
+    for(int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        device-&gt;SetStreamSourceFreq(i, 1);
+    }
+}
+
+void Blit9::render()
+{
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    HRESULT hr = device-&gt;SetStreamSource(0, mQuadVertexBuffer, 0, 2 * sizeof(float));
+    hr = device-&gt;SetVertexDeclaration(mQuadVertexDeclaration);
+
+    mRenderer-&gt;startScene();
+    hr = device-&gt;DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
+}
+
+void Blit9::saveState()
+{
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    HRESULT hr;
+
+    device-&gt;GetDepthStencilSurface(&amp;mSavedDepthStencil);
+    device-&gt;GetRenderTarget(0, &amp;mSavedRenderTarget);
+
+    if (mSavedStateBlock == NULL)
+    {
+        hr = device-&gt;BeginStateBlock();
+        ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+        setCommonBlitState();
+
+        static const float dummyConst[8] = { 0 };
+
+        device-&gt;SetVertexShader(NULL);
+        device-&gt;SetVertexShaderConstantF(0, dummyConst, 2);
+        device-&gt;SetPixelShader(NULL);
+        device-&gt;SetPixelShaderConstantF(0, dummyConst, 2);
+
+        D3DVIEWPORT9 dummyVp;
+        dummyVp.X = 0;
+        dummyVp.Y = 0;
+        dummyVp.Width = 1;
+        dummyVp.Height = 1;
+        dummyVp.MinZ = 0;
+        dummyVp.MaxZ = 1;
+
+        device-&gt;SetViewport(&amp;dummyVp);
+
+        device-&gt;SetTexture(0, NULL);
+
+        device-&gt;SetStreamSource(0, mQuadVertexBuffer, 0, 0);
+
+        device-&gt;SetVertexDeclaration(mQuadVertexDeclaration);
+
+        hr = device-&gt;EndStateBlock(&amp;mSavedStateBlock);
+        ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+    }
+
+    ASSERT(mSavedStateBlock != NULL);
+
+    if (mSavedStateBlock != NULL)
+    {
+        hr = mSavedStateBlock-&gt;Capture();
+        ASSERT(SUCCEEDED(hr));
+    }
+}
+
+void Blit9::restoreState()
+{
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    device-&gt;SetDepthStencilSurface(mSavedDepthStencil);
+    SafeRelease(mSavedDepthStencil);
+
+    device-&gt;SetRenderTarget(0, mSavedRenderTarget);
+    SafeRelease(mSavedRenderTarget);
+
+    ASSERT(mSavedStateBlock != NULL);
+
+    if (mSavedStateBlock != NULL)
+    {
+        mSavedStateBlock-&gt;Apply();
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Blit9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Blit9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+//
+// 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.
+//
+
+// Blit9.cpp: Surface copy utility class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+
+namespace gl
+{
+class Framebuffer;
+struct Offset;
+}
+
+namespace rx
+{
+class Renderer9;
+class TextureStorage;
+
+class Blit9 : angle::NonCopyable
+{
+  public:
+    explicit Blit9(Renderer9 *renderer);
+    ~Blit9();
+
+    gl::Error initialize();
+
+    // Copy from source surface to dest surface.
+    // sourceRect, xoffset, yoffset are in D3D coordinates (0,0 in upper-left)
+    gl::Error copy2D(const gl::Framebuffer *framebuffer, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level);
+    gl::Error copyCube(const gl::Framebuffer *framebuffer, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, TextureStorage *storage, GLenum target, GLint level);
+
+    // 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.
+    gl::Error formatConvert(IDirect3DSurface9 *source, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, IDirect3DSurface9 *dest);
+
+    // 2x2 box filter sample from source to dest.
+    // Requires that source is RGB(A) and dest has the same format as source.
+    gl::Error boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
+
+  private:
+    Renderer9 *mRenderer;
+
+    bool mGeometryLoaded;
+    IDirect3DVertexBuffer9 *mQuadVertexBuffer;
+    IDirect3DVertexDeclaration9 *mQuadVertexDeclaration;
+
+    gl::Error setFormatConvertShaders(GLenum destFormat);
+
+    gl::Error copy(IDirect3DSurface9 *source, const RECT &amp;sourceRect, GLenum destFormat, const gl::Offset &amp;destOffset, IDirect3DSurface9 *dest);
+    gl::Error copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &amp;sourceRect, IDirect3DTexture9 **outTexture);
+    void setViewport(const RECT &amp;sourceRect, const gl::Offset &amp;offset);
+    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
+    };
+
+    // This actually contains IDirect3DVertexShader9 or IDirect3DPixelShader9 casted to IUnknown.
+    IUnknown *mCompiledShaders[SHADER_COUNT];
+
+    template &lt;class D3DShaderType&gt;
+    gl::Error setShader(ShaderId source, const char *profile,
+                        gl::Error (Renderer9::*createShader)(const DWORD *, size_t length, D3DShaderType **outShader),
+                        HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*));
+
+    gl::Error setVertexShader(ShaderId shader);
+    gl::Error setPixelShader(ShaderId shader);
+    void render();
+
+    void saveState();
+    void restoreState();
+    IDirect3DStateBlock9 *mSavedStateBlock;
+    IDirect3DSurface9 *mSavedRenderTarget;
+    IDirect3DSurface9 *mSavedDepthStencil;
+};
+
+}
+
+#endif   // LIBANGLE_RENDERER_D3D_D3D9_BLIT9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Buffer9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Buffer9.cpp Defines the Buffer9 class.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/Buffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+
+namespace rx
+{
+
+Buffer9::Buffer9(Renderer9 *renderer)
+    : BufferD3D(renderer),
+      mRenderer(renderer),
+      mSize(0)
+{}
+
+Buffer9::~Buffer9()
+{
+    mSize = 0;
+}
+
+gl::Error Buffer9::setData(const void* data, size_t size, GLenum usage)
+{
+    if (size &gt; mMemory.size())
+    {
+        if (!mMemory.resize(size))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to resize internal buffer.&quot;);
+        }
+    }
+
+    mSize = size;
+    if (data &amp;&amp; size &gt; 0)
+    {
+        memcpy(mMemory.data(), data, size);
+    }
+
+    invalidateStaticData();
+
+    if (usage == GL_STATIC_DRAW)
+    {
+        initializeStaticData();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer9::getData(const uint8_t **outData)
+{
+    *outData = mMemory.data();
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer9::setSubData(const void* data, size_t size, size_t offset)
+{
+    if (offset + size &gt; mMemory.size())
+    {
+        if (!mMemory.resize(offset + size))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to resize internal buffer.&quot;);
+        }
+    }
+
+    mSize = std::max(mSize, offset + size);
+    if (data &amp;&amp; size &gt; 0)
+    {
+        memcpy(mMemory.data() + offset, data, size);
+    }
+
+    invalidateStaticData();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Buffer9::copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
+{
+    // Note: this method is currently unreachable
+    Buffer9* sourceBuffer = GetAs&lt;Buffer9&gt;(source);
+    ASSERT(sourceBuffer);
+
+    memcpy(mMemory.data() + destOffset, sourceBuffer-&gt;mMemory.data() + sourceOffset, size);
+
+    invalidateStaticData();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+// We do not support buffer mapping in D3D9
+gl::Error Buffer9::map(GLenum access, GLvoid **mapPtr)
+{
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error Buffer9::mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr)
+{
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error Buffer9::unmap(GLboolean *result)
+{
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+void Buffer9::markTransformFeedbackUsage()
+{
+    UNREACHABLE();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Buffer9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Buffer9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Buffer9.h: Defines the rx::Buffer9 class which implements rx::BufferImpl via rx::BufferD3D.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_BUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_BUFFER9_H_
+
+#include &quot;common/MemoryBuffer.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class Buffer9 : public BufferD3D
+{
+  public:
+    Buffer9(Renderer9 *renderer);
+    virtual ~Buffer9();
+
+    // BufferD3D implementation
+    virtual size_t getSize() const { return mSize; }
+    virtual bool supportsDirectBinding() const { return false; }
+
+    // BufferImpl implementation
+    virtual gl::Error setData(const void* data, size_t size, GLenum usage);
+    gl::Error getData(const uint8_t **outData) override;
+    virtual gl::Error setSubData(const void* data, size_t size, size_t offset);
+    virtual gl::Error copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
+    virtual gl::Error map(GLenum access, GLvoid **mapPtr);
+    virtual gl::Error mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr);
+    virtual gl::Error unmap(GLboolean *result);
+    virtual void markTransformFeedbackUsage();
+
+  private:
+    Renderer9 *mRenderer;
+    MemoryBuffer mMemory;
+    size_t mSize;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_BUFFER9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9DebugAnnotator9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// DebugAnnotator9.h: D3D9 helpers for adding trace annotations.
+//
+
+#include &quot;libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h&quot;
+
+#include &quot;common/platform.h&quot;
+
+namespace rx
+{
+
+void DebugAnnotator9::beginEvent(const std::wstring &amp;eventName)
+{
+    D3DPERF_BeginEvent(0, eventName.c_str());
+}
+
+void DebugAnnotator9::endEvent()
+{
+    D3DPERF_EndEvent();
+}
+
+void DebugAnnotator9::setMarker(const std::wstring &amp;markerName)
+{
+    D3DPERF_SetMarker(0, markerName.c_str());
+}
+
+bool DebugAnnotator9::getStatus()
+{
+    return !!D3DPERF_GetStatus();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9DebugAnnotator9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+// DebugAnnotator9.h: D3D9 helpers for adding trace annotations.
+//
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+class DebugAnnotator9 : public gl::DebugAnnotator
+{
+  public:
+    DebugAnnotator9() {}
+    void beginEvent(const std::wstring &amp;eventName) override;
+    void endEvent() override;
+    void setMarker(const std::wstring &amp;markerName) override;
+    bool getStatus() override;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_DEBUGANNOTATOR9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Fence9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Fence9.cpp: Defines the rx::FenceNV9 class.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/Fence9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+
+namespace rx
+{
+
+FenceNV9::FenceNV9(Renderer9 *renderer)
+    : FenceNVImpl(),
+      mRenderer(renderer),
+      mQuery(NULL)
+{
+}
+
+FenceNV9::~FenceNV9()
+{
+    SafeRelease(mQuery);
+}
+
+gl::Error FenceNV9::set(GLenum condition)
+{
+    if (!mQuery)
+    {
+        gl::Error error = mRenderer-&gt;allocateEventQuery(&amp;mQuery);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    HRESULT result = mQuery-&gt;Issue(D3DISSUE_END);
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        SafeRelease(mQuery);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to end event query, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceNV9::test(GLboolean *outFinished)
+{
+    return testHelper(true, outFinished);
+}
+
+gl::Error FenceNV9::finish()
+{
+    GLboolean finished = GL_FALSE;
+    while (finished != GL_TRUE)
+    {
+        gl::Error error = testHelper(true, &amp;finished);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        Sleep(0);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceNV9::testHelper(bool flushCommandBuffer, GLboolean *outFinished)
+{
+    ASSERT(mQuery);
+
+    DWORD getDataFlags = (flushCommandBuffer ? D3DGETDATA_FLUSH : 0);
+    HRESULT result = mQuery-&gt;GetData(NULL, 0, getDataFlags);
+
+    if (d3d9::isDeviceLostError(result))
+    {
+        mRenderer-&gt;notifyDeviceLost();
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Device was lost while querying result of an event query.&quot;);
+    }
+    else if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get query data, result: 0x%X.&quot;, result);
+    }
+
+    ASSERT(result == S_OK || result == S_FALSE);
+    *outFinished = ((result == S_OK) ? GL_TRUE : GL_FALSE);
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Fence9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Fence9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Fence9.h: Defines the rx::FenceNV9 class which implements rx::FenceNVImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_
+
+#include &quot;libANGLE/renderer/FenceNVImpl.h&quot;
+#include &quot;libANGLE/renderer/FenceSyncImpl.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class FenceNV9 : public FenceNVImpl
+{
+  public:
+    explicit FenceNV9(Renderer9 *renderer);
+    ~FenceNV9() override;
+
+    gl::Error set(GLenum condition) override;
+    gl::Error test(GLboolean *outFinished) override;
+    gl::Error finish() override;
+
+  private:
+    gl::Error testHelper(bool flushCommandBuffer, GLboolean *outFinished);
+
+    Renderer9 *mRenderer;
+    IDirect3DQuery9 *mQuery;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_FENCE9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Framebuffer9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,422 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Framebuffer9.cpp: Implements the Framebuffer9 class.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/Framebuffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/TextureStorage9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+
+namespace rx
+{
+
+Framebuffer9::Framebuffer9(const gl::Framebuffer::Data &amp;data, Renderer9 *renderer)
+    : FramebufferD3D(data, renderer),
+      mRenderer(renderer)
+{
+    ASSERT(mRenderer != nullptr);
+}
+
+Framebuffer9::~Framebuffer9()
+{
+}
+
+gl::Error Framebuffer9::clear(const gl::State &amp;state, const ClearParameters &amp;clearParams)
+{
+    const gl::FramebufferAttachment *colorAttachment = mData.getColorAttachment(0);
+    const gl::FramebufferAttachment *depthStencilAttachment = mData.getDepthOrStencilAttachment();
+
+    gl::Error error = mRenderer-&gt;applyRenderTarget(colorAttachment, depthStencilAttachment);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    float nearZ = state.getNearPlane();
+    float farZ = state.getFarPlane();
+    mRenderer-&gt;setViewport(state.getViewport(), nearZ, farZ, GL_TRIANGLES, state.getRasterizerState().frontFace, true);
+
+    mRenderer-&gt;setScissorRectangle(state.getScissor(), state.isScissorTestEnabled());
+
+    return mRenderer-&gt;clear(clearParams, colorAttachment, depthStencilAttachment);
+}
+
+gl::Error Framebuffer9::readPixels(const gl::Rectangle &amp;area, GLenum format, GLenum type, size_t outputPitch, const gl::PixelPackState &amp;pack, uint8_t *pixels) const
+{
+    ASSERT(pack.pixelBuffer.get() == nullptr);
+
+    const gl::FramebufferAttachment *colorbuffer = mData.getColorAttachment(0);
+    ASSERT(colorbuffer);
+
+    RenderTarget9 *renderTarget = nullptr;
+    gl::Error error = colorbuffer-&gt;getRenderTarget(&amp;renderTarget);
+    if (error.isError())
+    {
+        return error;
+    }
+    ASSERT(renderTarget);
+
+    IDirect3DSurface9 *surface = renderTarget-&gt;getSurface();
+    ASSERT(surface);
+
+    D3DSURFACE_DESC desc;
+    surface-&gt;GetDesc(&amp;desc);
+
+    if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
+    {
+        UNIMPLEMENTED();   // FIXME: Requires resolve using StretchRect into non-multisampled render target
+        SafeRelease(surface);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;ReadPixels is unimplemented for multisampled framebuffer attachments.&quot;);
+    }
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+    ASSERT(device);
+
+    HRESULT result;
+    IDirect3DSurface9 *systemSurface = nullptr;
+    bool directToPixels = !pack.reverseRowOrder &amp;&amp; pack.alignment &lt;= 4 &amp;&amp; mRenderer-&gt;getShareHandleSupport() &amp;&amp;
+                          area.x == 0 &amp;&amp; area.y == 0 &amp;&amp;
+                          static_cast&lt;UINT&gt;(area.width) == desc.Width &amp;&amp; static_cast&lt;UINT&gt;(area.height) == desc.Height &amp;&amp;
+                          desc.Format == D3DFMT_A8R8G8B8 &amp;&amp; format == GL_BGRA_EXT &amp;&amp; type == GL_UNSIGNED_BYTE;
+    if (directToPixels)
+    {
+        // Use the pixels ptr as a shared handle to write directly into client's memory
+        result = device-&gt;CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
+                                                     D3DPOOL_SYSTEMMEM, &amp;systemSurface, reinterpret_cast&lt;void**&gt;(&amp;pixels));
+        if (FAILED(result))
+        {
+            // Try again without the shared handle
+            directToPixels = false;
+        }
+    }
+
+    if (!directToPixels)
+    {
+        result = device-&gt;CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format,
+                                                     D3DPOOL_SYSTEMMEM, &amp;systemSurface, nullptr);
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+            SafeRelease(surface);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal texture for ReadPixels.&quot;);
+        }
+    }
+
+    result = device-&gt;GetRenderTargetData(surface, systemSurface);
+    SafeRelease(surface);
+
+    if (FAILED(result))
+    {
+        SafeRelease(systemSurface);
+
+        // It turns out that D3D will sometimes produce more error
+        // codes than those documented.
+        if (d3d9::isDeviceLostError(result))
+        {
+            mRenderer-&gt;notifyDeviceLost();
+        }
+        else
+        {
+            UNREACHABLE();
+        }
+
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to read internal render target data.&quot;);
+    }
+
+    if (directToPixels)
+    {
+        SafeRelease(systemSurface);
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    RECT rect;
+    rect.left = gl::clamp(area.x, 0L, static_cast&lt;LONG&gt;(desc.Width));
+    rect.top = gl::clamp(area.y, 0L, static_cast&lt;LONG&gt;(desc.Height));
+    rect.right = gl::clamp(area.x + area.width, 0L, static_cast&lt;LONG&gt;(desc.Width));
+    rect.bottom = gl::clamp(area.y + area.height, 0L, static_cast&lt;LONG&gt;(desc.Height));
+
+    D3DLOCKED_RECT lock;
+    result = systemSurface-&gt;LockRect(&amp;lock, &amp;rect, D3DLOCK_READONLY);
+
+    if (FAILED(result))
+    {
+        UNREACHABLE();
+        SafeRelease(systemSurface);
+
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock internal render target.&quot;);
+    }
+
+    uint8_t *source;
+    int inputPitch;
+    if (pack.reverseRowOrder)
+    {
+        source = reinterpret_cast&lt;uint8_t*&gt;(lock.pBits) + lock.Pitch * (rect.bottom - rect.top - 1);
+        inputPitch = -lock.Pitch;
+    }
+    else
+    {
+        source = reinterpret_cast&lt;uint8_t*&gt;(lock.pBits);
+        inputPitch = lock.Pitch;
+    }
+
+    const d3d9::D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
+    const gl::InternalFormat &amp;sourceFormatInfo = gl::GetInternalFormatInfo(d3dFormatInfo.internalFormat);
+    if (sourceFormatInfo.format == format &amp;&amp; sourceFormatInfo.type == type)
+    {
+        // Direct copy possible
+        for (int y = 0; y &lt; rect.bottom - rect.top; y++)
+        {
+            memcpy(pixels + y * outputPitch, source + y * inputPitch, (rect.right - rect.left) * sourceFormatInfo.pixelBytes);
+        }
+    }
+    else
+    {
+        const d3d9::D3DFormat &amp;sourceD3DFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
+        ColorCopyFunction fastCopyFunc = sourceD3DFormatInfo.getFastCopyFunction(format, type);
+
+        GLenum sizedDestInternalFormat = gl::GetSizedInternalFormat(format, type);
+        const gl::InternalFormat &amp;destFormatInfo = gl::GetInternalFormatInfo(sizedDestInternalFormat);
+
+        if (fastCopyFunc)
+        {
+            // Fast copy is possible through some special function
+            for (int y = 0; y &lt; rect.bottom - rect.top; y++)
+            {
+                for (int x = 0; x &lt; rect.right - rect.left; x++)
+                {
+                    uint8_t *dest = pixels + y * outputPitch + x * destFormatInfo.pixelBytes;
+                    const uint8_t *src = source + y * inputPitch + x * sourceFormatInfo.pixelBytes;
+
+                    fastCopyFunc(src, dest);
+                }
+            }
+        }
+        else
+        {
+            ColorReadFunction colorReadFunction = sourceD3DFormatInfo.colorReadFunction;
+            ColorWriteFunction colorWriteFunction = GetColorWriteFunction(format, type);
+
+            uint8_t temp[sizeof(gl::ColorF)];
+            for (int y = 0; y &lt; rect.bottom - rect.top; y++)
+            {
+                for (int x = 0; x &lt; rect.right - rect.left; x++)
+                {
+                    uint8_t *dest = pixels + y * outputPitch + x * destFormatInfo.pixelBytes;
+                    const uint8_t *src = source + y * inputPitch + x * sourceFormatInfo.pixelBytes;
+
+                    // readFunc and writeFunc will be using the same type of color, CopyTexImage
+                    // will not allow the copy otherwise.
+                    colorReadFunction(src, temp);
+                    colorWriteFunction(temp, dest);
+                }
+            }
+        }
+    }
+
+    systemSurface-&gt;UnlockRect();
+    SafeRelease(systemSurface);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Framebuffer9::blit(const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea, const gl::Rectangle *scissor,
+                             bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
+                             const gl::Framebuffer *sourceFramebuffer)
+{
+    ASSERT(filter == GL_NEAREST);
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+    ASSERT(device);
+
+    mRenderer-&gt;endScene();
+
+    if (blitRenderTarget)
+    {
+        const gl::FramebufferAttachment *readBuffer = sourceFramebuffer-&gt;getColorbuffer(0);
+        ASSERT(readBuffer);
+
+        RenderTarget9 *readRenderTarget = nullptr;
+        gl::Error error = readBuffer-&gt;getRenderTarget(&amp;readRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(readRenderTarget);
+
+        const gl::FramebufferAttachment *drawBuffer = mData.getColorAttachment(0);
+        ASSERT(drawBuffer);
+
+        RenderTarget9 *drawRenderTarget = nullptr;
+        error = drawBuffer-&gt;getRenderTarget(&amp;drawRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(drawRenderTarget);
+
+        // The getSurface calls do an AddRef so save them until after no errors are possible
+        IDirect3DSurface9* readSurface = readRenderTarget-&gt;getSurface();
+        ASSERT(readSurface);
+
+        IDirect3DSurface9* drawSurface = drawRenderTarget-&gt;getSurface();
+        ASSERT(drawSurface);
+
+        gl::Extents srcSize(readRenderTarget-&gt;getWidth(), readRenderTarget-&gt;getHeight(), 1);
+        gl::Extents dstSize(drawRenderTarget-&gt;getWidth(), drawRenderTarget-&gt;getHeight(), 1);
+
+        RECT srcRect;
+        srcRect.left = sourceArea.x;
+        srcRect.right = sourceArea.x + sourceArea.width;
+        srcRect.top = sourceArea.y;
+        srcRect.bottom = sourceArea.y + sourceArea.height;
+
+        RECT dstRect;
+        dstRect.left = destArea.x;
+        dstRect.right = destArea.x + destArea.width;
+        dstRect.top = destArea.y;
+        dstRect.bottom = destArea.y + destArea.height;
+
+        // Clip the rectangles to the scissor rectangle
+        if (scissor)
+        {
+            if (dstRect.left &lt; scissor-&gt;x)
+            {
+                srcRect.left += (scissor-&gt;x - dstRect.left);
+                dstRect.left = scissor-&gt;x;
+            }
+            if (dstRect.top &lt; scissor-&gt;y)
+            {
+                srcRect.top += (scissor-&gt;y - dstRect.top);
+                dstRect.top = scissor-&gt;y;
+            }
+            if (dstRect.right &gt; scissor-&gt;x + scissor-&gt;width)
+            {
+                srcRect.right -= (dstRect.right - (scissor-&gt;x + scissor-&gt;width));
+                dstRect.right = scissor-&gt;x + scissor-&gt;width;
+            }
+            if (dstRect.bottom &gt; scissor-&gt;y + scissor-&gt;height)
+            {
+                srcRect.bottom -= (dstRect.bottom - (scissor-&gt;y + scissor-&gt;height));
+                dstRect.bottom = scissor-&gt;y + scissor-&gt;height;
+            }
+        }
+
+        // Clip the rectangles to the destination size
+        if (dstRect.left &lt; 0)
+        {
+            srcRect.left += -dstRect.left;
+            dstRect.left = 0;
+        }
+        if (dstRect.right &gt; dstSize.width)
+        {
+            srcRect.right -= (dstRect.right - dstSize.width);
+            dstRect.right = dstSize.width;
+        }
+        if (dstRect.top &lt; 0)
+        {
+            srcRect.top += -dstRect.top;
+            dstRect.top = 0;
+        }
+        if (dstRect.bottom &gt; dstSize.height)
+        {
+            srcRect.bottom -= (dstRect.bottom - dstSize.height);
+            dstRect.bottom = dstSize.height;
+        }
+
+        // Clip the rectangles to the source size
+        if (srcRect.left &lt; 0)
+        {
+            dstRect.left += -srcRect.left;
+            srcRect.left = 0;
+        }
+        if (srcRect.right &gt; srcSize.width)
+        {
+            dstRect.right -= (srcRect.right - srcSize.width);
+            srcRect.right = srcSize.width;
+        }
+        if (srcRect.top &lt; 0)
+        {
+            dstRect.top += -srcRect.top;
+            srcRect.top = 0;
+        }
+        if (srcRect.bottom &gt; srcSize.height)
+        {
+            dstRect.bottom -= (srcRect.bottom - srcSize.height);
+            srcRect.bottom = srcSize.height;
+        }
+
+        HRESULT result = device-&gt;StretchRect(readSurface, &amp;srcRect, drawSurface, &amp;dstRect, D3DTEXF_NONE);
+
+        SafeRelease(readSurface);
+        SafeRelease(drawSurface);
+
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal blit failed, StretchRect returned 0x%X.&quot;, result);
+        }
+    }
+
+    if (blitDepth || blitStencil)
+    {
+        const gl::FramebufferAttachment *readBuffer = sourceFramebuffer-&gt;getDepthOrStencilbuffer();
+        ASSERT(readBuffer);
+
+        RenderTarget9 *readDepthStencil = nullptr;
+        gl::Error error = readBuffer-&gt;getRenderTarget(&amp;readDepthStencil);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(readDepthStencil);
+
+        const gl::FramebufferAttachment *drawBuffer = mData.getDepthOrStencilAttachment();
+        ASSERT(drawBuffer);
+
+        RenderTarget9 *drawDepthStencil = nullptr;
+        error = drawBuffer-&gt;getRenderTarget(&amp;drawDepthStencil);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(drawDepthStencil);
+
+        // The getSurface calls do an AddRef so save them until after no errors are possible
+        IDirect3DSurface9* readSurface = readDepthStencil-&gt;getSurface();
+        ASSERT(readDepthStencil);
+
+        IDirect3DSurface9* drawSurface = drawDepthStencil-&gt;getSurface();
+        ASSERT(drawDepthStencil);
+
+        HRESULT result = device-&gt;StretchRect(readSurface, nullptr, drawSurface, nullptr, D3DTEXF_NONE);
+
+        SafeRelease(readSurface);
+        SafeRelease(drawSurface);
+
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal blit failed, StretchRect returned 0x%X.&quot;, result);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
+{
+    RenderTarget9 *renderTarget9 = GetAs&lt;RenderTarget9&gt;(renderTarget);
+    const d3d9::D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(renderTarget9-&gt;getD3DFormat());
+    return d3dFormatInfo.internalFormat;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Framebuffer9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// Framebuffer9.h: Defines the Framebuffer9 class.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
+
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class Framebuffer9 : public FramebufferD3D
+{
+  public:
+    Framebuffer9(const gl::Framebuffer::Data &amp;data, Renderer9 *renderer);
+    virtual ~Framebuffer9();
+
+  private:
+    gl::Error clear(const gl::State &amp;state, const ClearParameters &amp;clearParams) override;
+
+    gl::Error readPixels(const gl::Rectangle &amp;area, GLenum format, GLenum type, size_t outputPitch,
+                         const gl::PixelPackState &amp;pack, uint8_t *pixels) const override;
+
+    gl::Error blit(const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea, const gl::Rectangle *scissor,
+                   bool blitRenderTarget, bool blitDepth, bool blitStencil, GLenum filter,
+                   const gl::Framebuffer *sourceFramebuffer) override;
+
+    GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override;
+
+    Renderer9 *const mRenderer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Image9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,782 @@
</span><ins>+//
+// 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.
+//
+
+// Image9.cpp: Implements the rx::Image9 class, which acts as the interface to
+// the actual underlying surfaces of a Texture.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/Image9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/TextureStorage9.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace rx
+{
+
+Image9::Image9(Renderer9 *renderer)
+{
+    mSurface = NULL;
+    mRenderer = NULL;
+
+    mD3DPool = D3DPOOL_SYSTEMMEM;
+    mD3DFormat = D3DFMT_UNKNOWN;
+
+    mRenderer = renderer;
+}
+
+Image9::~Image9()
+{
+    SafeRelease(mSurface);
+}
+
+gl::Error Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface)
+{
+    D3DSURFACE_DESC destDesc;
+    HRESULT result = destSurface-&gt;GetDesc(&amp;destDesc);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to query the source surface description for mipmap generation, result: 0x%X.&quot;, result);
+    }
+
+    D3DSURFACE_DESC sourceDesc;
+    result = sourceSurface-&gt;GetDesc(&amp;sourceDesc);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to query the destination surface description for mipmap generation, result: 0x%X.&quot;, result);
+    }
+
+    ASSERT(sourceDesc.Format == destDesc.Format);
+    ASSERT(sourceDesc.Width == 1 || sourceDesc.Width / 2 == destDesc.Width);
+    ASSERT(sourceDesc.Height == 1 || sourceDesc.Height / 2 == destDesc.Height);
+
+    const d3d9::D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(sourceDesc.Format);
+    ASSERT(d3dFormatInfo.mipGenerationFunction != NULL);
+
+    D3DLOCKED_RECT sourceLocked = {0};
+    result = sourceSurface-&gt;LockRect(&amp;sourceLocked, NULL, D3DLOCK_READONLY);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock the source surface for mipmap generation, result: 0x%X.&quot;, result);
+    }
+
+    D3DLOCKED_RECT destLocked = {0};
+    result = destSurface-&gt;LockRect(&amp;destLocked, NULL, 0);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        sourceSurface-&gt;UnlockRect();
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock the destination surface for mipmap generation, result: 0x%X.&quot;, result);
+    }
+
+    const uint8_t *sourceData = reinterpret_cast&lt;const uint8_t*&gt;(sourceLocked.pBits);
+    uint8_t *destData = reinterpret_cast&lt;uint8_t*&gt;(destLocked.pBits);
+
+    ASSERT(sourceData &amp;&amp; destData);
+
+    d3dFormatInfo.mipGenerationFunction(sourceDesc.Width, sourceDesc.Height, 1, sourceData, sourceLocked.Pitch, 0,
+                                        destData, destLocked.Pitch, 0);
+
+    destSurface-&gt;UnlockRect();
+    sourceSurface-&gt;UnlockRect();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image9::generateMipmap(Image9 *dest, Image9 *source)
+{
+    IDirect3DSurface9 *sourceSurface = NULL;
+    gl::Error error = source-&gt;getSurface(&amp;sourceSurface);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DSurface9 *destSurface = NULL;
+    error = dest-&gt;getSurface(&amp;destSurface);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    error = generateMip(destSurface, sourceSurface);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    dest-&gt;markDirty();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image9::copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source)
+{
+    D3DLOCKED_RECT sourceLock = {0};
+    D3DLOCKED_RECT destLock = {0};
+
+    HRESULT result;
+
+    result = source-&gt;LockRect(&amp;sourceLock, NULL, 0);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock source surface for copy, result: 0x%X.&quot;, result);
+    }
+
+    result = dest-&gt;LockRect(&amp;destLock, NULL, 0);
+    if (FAILED(result))
+    {
+        source-&gt;UnlockRect();
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock source surface for copy, result: 0x%X.&quot;, result);
+    }
+
+    ASSERT(sourceLock.pBits &amp;&amp; destLock.pBits);
+
+    D3DSURFACE_DESC desc;
+    source-&gt;GetDesc(&amp;desc);
+
+    const d3d9::D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
+    unsigned int rows = desc.Height / d3dFormatInfo.blockHeight;
+
+    unsigned int bytes = d3d9::ComputeBlockSize(desc.Format, desc.Width, d3dFormatInfo.blockHeight);
+    ASSERT(bytes &lt;= static_cast&lt;unsigned int&gt;(sourceLock.Pitch) &amp;&amp;
+           bytes &lt;= static_cast&lt;unsigned int&gt;(destLock.Pitch));
+
+    for(unsigned int i = 0; i &lt; rows; i++)
+    {
+        memcpy((char*)destLock.pBits + destLock.Pitch * i, (char*)sourceLock.pBits + sourceLock.Pitch * i, bytes);
+    }
+
+    source-&gt;UnlockRect();
+    dest-&gt;UnlockRect();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool Image9::redefine(GLenum target, GLenum internalformat, const gl::Extents &amp;size, bool forceRelease)
+{
+    // 3D textures are not supported by the D3D9 backend.
+    ASSERT(size.depth &lt;= 1);
+
+    // Only 2D and cube texture are supported by the D3D9 backend.
+    ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP);
+
+    if (mWidth != size.width ||
+        mHeight != size.height ||
+        mDepth != size.depth ||
+        mInternalFormat != internalformat ||
+        forceRelease)
+    {
+        mWidth = size.width;
+        mHeight = size.height;
+        mDepth = size.depth;
+        mInternalFormat = internalformat;
+
+        // compute the d3d format that will be used
+        const d3d9::TextureFormat &amp;d3d9FormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+        mD3DFormat = d3d9FormatInfo.texFormat;
+        mRenderable = (d3d9FormatInfo.renderFormat != D3DFMT_UNKNOWN);
+
+        SafeRelease(mSurface);
+        mDirty = (d3d9FormatInfo.dataInitializerFunction != NULL);
+
+        return true;
+    }
+
+    return false;
+}
+
+gl::Error Image9::createSurface()
+{
+    if (mSurface)
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    IDirect3DTexture9 *newTexture = NULL;
+    IDirect3DSurface9 *newSurface = NULL;
+    const D3DPOOL poolToUse = D3DPOOL_SYSTEMMEM;
+    const D3DFORMAT d3dFormat = getD3DFormat();
+
+    if (mWidth != 0 &amp;&amp; mHeight != 0)
+    {
+        int levelToFetch = 0;
+        GLsizei requestWidth = mWidth;
+        GLsizei requestHeight = mHeight;
+        d3d9::MakeValidSize(true, d3dFormat, &amp;requestWidth, &amp;requestHeight, &amp;levelToFetch);
+
+        IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+        HRESULT result = device-&gt;CreateTexture(requestWidth, requestHeight, levelToFetch + 1, 0, d3dFormat,
+                                                    poolToUse, &amp;newTexture, NULL);
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create image surface, result: 0x%X.&quot;, result);
+        }
+
+        newTexture-&gt;GetSurfaceLevel(levelToFetch, &amp;newSurface);
+        SafeRelease(newTexture);
+
+        const d3d9::TextureFormat &amp;d3dFormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
+        if (d3dFormatInfo.dataInitializerFunction != NULL)
+        {
+            RECT entireRect;
+            entireRect.left = 0;
+            entireRect.right = mWidth;
+            entireRect.top = 0;
+            entireRect.bottom = mHeight;
+
+            D3DLOCKED_RECT lockedRect;
+            result = newSurface-&gt;LockRect(&amp;lockedRect, &amp;entireRect, 0);
+            ASSERT(SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock image surface, result: 0x%X.&quot;, result);
+            }
+
+            d3dFormatInfo.dataInitializerFunction(mWidth, mHeight, 1, reinterpret_cast&lt;uint8_t*&gt;(lockedRect.pBits),
+                                                  lockedRect.Pitch, 0);
+
+            result = newSurface-&gt;UnlockRect();
+            ASSERT(SUCCEEDED(result));
+            if (FAILED(result))
+            {
+                return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to unlock image surface, result: 0x%X.&quot;, result);
+            }
+        }
+    }
+
+    mSurface = newSurface;
+    mDirty = false;
+    mD3DPool = poolToUse;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image9::lock(D3DLOCKED_RECT *lockedRect, const RECT &amp;rect)
+{
+    gl::Error error = createSurface();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (mSurface)
+    {
+        HRESULT result = mSurface-&gt;LockRect(lockedRect, &amp;rect, 0);
+        ASSERT(SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock image surface, result: 0x%X.&quot;, result);
+        }
+
+        mDirty = true;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Image9::unlock()
+{
+    if (mSurface)
+    {
+        HRESULT result = mSurface-&gt;UnlockRect();
+        UNUSED_ASSERTION_VARIABLE(result);
+        ASSERT(SUCCEEDED(result));
+    }
+}
+
+D3DFORMAT Image9::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;
+}
+
+bool Image9::isDirty() const
+{
+    // Make sure to that this image is marked as dirty even if the staging texture hasn't been created yet
+    // if initialization is required before use.
+    return (mSurface || d3d9::GetTextureFormatInfo(mInternalFormat).dataInitializerFunction != NULL) &amp;&amp; mDirty;
+}
+
+gl::Error Image9::getSurface(IDirect3DSurface9 **outSurface)
+{
+    gl::Error error = createSurface();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    *outSurface = mSurface;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image9::setManagedSurface2D(TextureStorage *storage, int level)
+{
+    IDirect3DSurface9 *surface = NULL;
+    TextureStorage9_2D *storage9 = GetAs&lt;TextureStorage9_2D&gt;(storage);
+    gl::Error error = storage9-&gt;getSurfaceLevel(level, false, &amp;surface);
+    if (error.isError())
+    {
+        return error;
+    }
+    return setManagedSurface(surface);
+}
+
+gl::Error Image9::setManagedSurfaceCube(TextureStorage *storage, int face, int level)
+{
+    IDirect3DSurface9 *surface = NULL;
+    TextureStorage9_Cube *storage9 = GetAs&lt;TextureStorage9_Cube&gt;(storage);
+    gl::Error error = storage9-&gt;getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, level, false, &amp;surface);
+    if (error.isError())
+    {
+        return error;
+    }
+    return setManagedSurface(surface);
+}
+
+gl::Error Image9::setManagedSurface(IDirect3DSurface9 *surface)
+{
+    D3DSURFACE_DESC desc;
+    surface-&gt;GetDesc(&amp;desc);
+    ASSERT(desc.Pool == D3DPOOL_MANAGED);
+
+    if ((GLsizei)desc.Width == mWidth &amp;&amp; (GLsizei)desc.Height == mHeight)
+    {
+        if (mSurface)
+        {
+            gl::Error error = copyLockableSurfaces(surface, mSurface);
+            SafeRelease(mSurface);
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+
+        mSurface = surface;
+        mD3DPool = desc.Pool;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image9::copyToStorage(TextureStorage *storage, const gl::ImageIndex &amp;index, const gl::Box &amp;region)
+{
+    gl::Error error = createSurface();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DSurface9 *destSurface = NULL;
+
+    if (index.type == GL_TEXTURE_2D)
+    {
+        TextureStorage9_2D *storage9 = GetAs&lt;TextureStorage9_2D&gt;(storage);
+        error = storage9-&gt;getSurfaceLevel(index.mipIndex, true, &amp;destSurface);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+    else
+    {
+        ASSERT(gl::IsCubeMapTextureTarget(index.type));
+        TextureStorage9_Cube *storage9 = GetAs&lt;TextureStorage9_Cube&gt;(storage);
+        error = storage9-&gt;getCubeMapSurface(index.type, index.mipIndex, true, &amp;destSurface);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    error = copyToSurface(destSurface, region);
+    SafeRelease(destSurface);
+    return error;
+}
+
+gl::Error Image9::copyToSurface(IDirect3DSurface9 *destSurface, const gl::Box &amp;area)
+{
+    ASSERT(area.width &gt; 0 &amp;&amp; area.height &gt; 0 &amp;&amp; area.depth == 1);
+    ASSERT(destSurface);
+
+    IDirect3DSurface9 *sourceSurface = NULL;
+    gl::Error error = getSurface(&amp;sourceSurface);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ASSERT(sourceSurface &amp;&amp; sourceSurface != destSurface);
+
+    RECT rect;
+    rect.left = area.x;
+    rect.top = area.y;
+    rect.right = area.x + area.width;
+    rect.bottom = area.y + area.height;
+
+    POINT point = {rect.left, rect.top};
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    if (mD3DPool == D3DPOOL_MANAGED)
+    {
+        D3DSURFACE_DESC desc;
+        sourceSurface-&gt;GetDesc(&amp;desc);
+
+        IDirect3DSurface9 *surf = 0;
+        HRESULT result = device-&gt;CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &amp;surf, NULL);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal CreateOffscreenPlainSurface call failed, result: 0x%X.&quot;, result);
+        }
+
+        copyLockableSurfaces(surf, sourceSurface);
+        result = device-&gt;UpdateSurface(surf, &amp;rect, destSurface, &amp;point);
+        SafeRelease(surf);
+        ASSERT(SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal UpdateSurface call failed, result: 0x%X.&quot;, result);
+        }
+    }
+    else
+    {
+        // UpdateSurface: source must be SYSTEMMEM, dest must be DEFAULT pools
+        HRESULT result = device-&gt;UpdateSurface(sourceSurface, &amp;rect, destSurface, &amp;point);
+        ASSERT(SUCCEEDED(result));
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal UpdateSurface call failed, result: 0x%X.&quot;, result);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
+// into the target pixel rectangle.
+gl::Error Image9::loadData(const gl::Box &amp;area, const gl::PixelUnpackState &amp;unpack, GLenum type, const void *input)
+{
+    // 3D textures are not supported by the D3D9 backend.
+    ASSERT(area.z == 0 &amp;&amp; area.depth == 1);
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
+    GLsizei inputRowPitch = formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength);
+
+    const d3d9::TextureFormat &amp;d3dFormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
+    ASSERT(d3dFormatInfo.loadFunction != NULL);
+
+    RECT lockRect =
+    {
+        area.x, area.y,
+        area.x + area.width, area.y + area.height
+    };
+
+    D3DLOCKED_RECT locked;
+    gl::Error error = lock(&amp;locked, lockRect);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    d3dFormatInfo.loadFunction(area.width, area.height, area.depth,
+                               reinterpret_cast&lt;const uint8_t*&gt;(input), inputRowPitch, 0,
+                               reinterpret_cast&lt;uint8_t*&gt;(locked.pBits), locked.Pitch, 0);
+
+    unlock();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image9::loadCompressedData(const gl::Box &amp;area, const void *input)
+{
+    // 3D textures are not supported by the D3D9 backend.
+    ASSERT(area.z == 0 &amp;&amp; area.depth == 1);
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
+    GLsizei inputRowPitch = formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0);
+    GLsizei inputDepthPitch = formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0);
+
+    const d3d9::TextureFormat &amp;d3d9FormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
+
+    ASSERT(area.x % d3d9::GetD3DFormatInfo(d3d9FormatInfo.texFormat).blockWidth == 0);
+    ASSERT(area.y % d3d9::GetD3DFormatInfo(d3d9FormatInfo.texFormat).blockHeight == 0);
+
+    ASSERT(d3d9FormatInfo.loadFunction != NULL);
+
+    RECT lockRect =
+    {
+        area.x, area.y,
+        area.x + area.width, area.y + area.height
+    };
+
+    D3DLOCKED_RECT locked;
+    gl::Error error = lock(&amp;locked, lockRect);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    d3d9FormatInfo.loadFunction(area.width, area.height, area.depth,
+                                reinterpret_cast&lt;const uint8_t*&gt;(input), inputRowPitch, inputDepthPitch,
+                                reinterpret_cast&lt;uint8_t*&gt;(locked.pBits), locked.Pitch, 0);
+
+    unlock();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+// This implements glCopyTex[Sub]Image2D for non-renderable internal texture formats and incomplete textures
+gl::Error Image9::copy(const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea, RenderTargetD3D *source)
+{
+    ASSERT(source);
+
+    // ES3.0 only behaviour to copy into a 3d texture
+    ASSERT(destOffset.z == 0);
+
+    RenderTarget9 *renderTarget = GetAs&lt;RenderTarget9&gt;(source);
+
+    IDirect3DSurface9 *surface = renderTarget-&gt;getSurface();
+    ASSERT(surface);
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    IDirect3DSurface9 *renderTargetData = NULL;
+    D3DSURFACE_DESC description;
+    surface-&gt;GetDesc(&amp;description);
+
+    HRESULT result = device-&gt;CreateOffscreenPlainSurface(description.Width, description.Height, description.Format, D3DPOOL_SYSTEMMEM, &amp;renderTargetData, NULL);
+
+    if (FAILED(result))
+    {
+        SafeRelease(surface);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Could not create matching destination surface, result: 0x%X.&quot;, result);
+    }
+
+    result = device-&gt;GetRenderTargetData(surface, renderTargetData);
+
+    if (FAILED(result))
+    {
+        SafeRelease(renderTargetData);
+        SafeRelease(surface);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;GetRenderTargetData unexpectedly failed, result: 0x%X.&quot;, result);
+    }
+
+    int width = sourceArea.width;
+    int height = sourceArea.height;
+
+    RECT sourceRect = { sourceArea.x, sourceArea.y, sourceArea.x + width, sourceArea.y + height };
+    RECT destRect = { destOffset.x, destOffset.y, destOffset.x + width, destOffset.y + height };
+
+    D3DLOCKED_RECT sourceLock = {0};
+    result = renderTargetData-&gt;LockRect(&amp;sourceLock, &amp;sourceRect, 0);
+
+    if (FAILED(result))
+    {
+        SafeRelease(renderTargetData);
+        SafeRelease(surface);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock the source surface (rectangle might be invalid), result: 0x%X.&quot;, result);
+    }
+
+    D3DLOCKED_RECT destLock = {0};
+    gl::Error error = lock(&amp;destLock, destRect);
+    if (error.isError())
+    {
+        renderTargetData-&gt;UnlockRect();
+        SafeRelease(renderTargetData);
+        SafeRelease(surface);
+        return error;
+    }
+
+    ASSERT(destLock.pBits &amp;&amp; sourceLock.pBits);
+
+    unsigned char *sourcePixels = (unsigned char*)sourceLock.pBits;
+    unsigned char *destPixels = (unsigned char*)destLock.pBits;
+
+    switch (description.Format)
+    {
+      case D3DFMT_X8R8G8B8:
+      case D3DFMT_A8R8G8B8:
+        switch (getD3DFormat())
+        {
+          case D3DFMT_X8R8G8B8:
+          case D3DFMT_A8R8G8B8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                memcpy(destPixels, sourcePixels, 4 * width);
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          case D3DFMT_L8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    destPixels[x] = sourcePixels[x * 4 + 2];
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          case D3DFMT_A8L8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    destPixels[x * 2 + 0] = sourcePixels[x * 4 + 2];
+                    destPixels[x * 2 + 1] = sourcePixels[x * 4 + 3];
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          default:
+            UNREACHABLE();
+        }
+        break;
+      case D3DFMT_R5G6B5:
+        switch (getD3DFormat())
+        {
+          case D3DFMT_X8R8G8B8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    unsigned short rgb = ((unsigned short*)sourcePixels)[x];
+                    unsigned char red = static_cast&lt;unsigned char&gt;((rgb &amp; 0xF800) &gt;&gt; 8);
+                    unsigned char green = static_cast&lt;unsigned char&gt;((rgb &amp; 0x07E0) &gt;&gt; 3);
+                    unsigned char blue = static_cast&lt;unsigned char&gt;((rgb &amp; 0x001F) &lt;&lt; 3);
+                    destPixels[x + 0] = blue | (blue &gt;&gt; 5);
+                    destPixels[x + 1] = green | (green &gt;&gt; 6);
+                    destPixels[x + 2] = red | (red &gt;&gt; 5);
+                    destPixels[x + 3] = 0xFF;
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          case D3DFMT_L8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    unsigned char red = sourcePixels[x * 2 + 1] &amp; 0xF8;
+                    destPixels[x] = red | (red &gt;&gt; 5);
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          default:
+            UNREACHABLE();
+        }
+        break;
+      case D3DFMT_A1R5G5B5:
+        switch (getD3DFormat())
+        {
+          case D3DFMT_X8R8G8B8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    unsigned short argb = ((unsigned short*)sourcePixels)[x];
+                    unsigned char red = static_cast&lt;unsigned char&gt;((argb &amp; 0x7C00) &gt;&gt; 7);
+                    unsigned char green = static_cast&lt;unsigned char&gt;((argb &amp; 0x03E0) &gt;&gt; 2);
+                    unsigned char blue = static_cast&lt;unsigned char&gt;((argb &amp; 0x001F) &lt;&lt; 3);
+                    destPixels[x + 0] = blue | (blue &gt;&gt; 5);
+                    destPixels[x + 1] = green | (green &gt;&gt; 5);
+                    destPixels[x + 2] = red | (red &gt;&gt; 5);
+                    destPixels[x + 3] = 0xFF;
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          case D3DFMT_A8R8G8B8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    unsigned short argb = ((unsigned short*)sourcePixels)[x];
+                    unsigned char red = static_cast&lt;unsigned char&gt;((argb &amp; 0x7C00) &gt;&gt; 7);
+                    unsigned char green = static_cast&lt;unsigned char&gt;((argb &amp; 0x03E0) &gt;&gt; 2);
+                    unsigned char blue = static_cast&lt;unsigned char&gt;((argb &amp; 0x001F) &lt;&lt; 3);
+                    unsigned char alpha = (signed short)argb &gt;&gt; 15;
+                    destPixels[x + 0] = blue | (blue &gt;&gt; 5);
+                    destPixels[x + 1] = green | (green &gt;&gt; 5);
+                    destPixels[x + 2] = red | (red &gt;&gt; 5);
+                    destPixels[x + 3] = alpha;
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          case D3DFMT_L8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    unsigned char red = sourcePixels[x * 2 + 1] &amp; 0x7C;
+                    destPixels[x] = (red &lt;&lt; 1) | (red &gt;&gt; 4);
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          case D3DFMT_A8L8:
+            for (int y = 0; y &lt; height; y++)
+            {
+                for (int x = 0; x &lt; width; x++)
+                {
+                    unsigned char red = sourcePixels[x * 2 + 1] &amp; 0x7C;
+                    destPixels[x * 2 + 0] = (red &lt;&lt; 1) | (red &gt;&gt; 4);
+                    destPixels[x * 2 + 1] = (signed char)sourcePixels[x * 2 + 1] &gt;&gt; 7;
+                }
+                sourcePixels += sourceLock.Pitch;
+                destPixels += destLock.Pitch;
+            }
+            break;
+          default:
+            UNREACHABLE();
+        }
+        break;
+      default:
+        UNREACHABLE();
+    }
+
+    unlock();
+    renderTargetData-&gt;UnlockRect();
+
+    SafeRelease(renderTargetData);
+    SafeRelease(surface);
+
+    mDirty = true;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Image9::copy(const gl::Offset &amp;destOffset, const gl::Box &amp;area, const gl::ImageIndex &amp;srcIndex, TextureStorage *srcStorage)
+{
+    // Currently unreachable, due to only being used in a D3D11-only workaround
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Image9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Image9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+// Image9.h: Defines the rx::Image9 class, which acts as the interface to
+// the actual underlying surfaces of a Texture.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_IMAGE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_IMAGE9_H_
+
+#include &quot;libANGLE/renderer/d3d/ImageD3D.h&quot;
+#include &quot;common/debug.h&quot;
+
+namespace gl
+{
+class Framebuffer;
+}
+
+namespace rx
+{
+class Renderer9;
+
+class Image9 : public ImageD3D
+{
+  public:
+    Image9(Renderer9 *renderer);
+    ~Image9();
+
+    static gl::Error generateMipmap(Image9 *dest, Image9 *source);
+    static gl::Error generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
+    static gl::Error copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
+
+    bool redefine(GLenum target, GLenum internalformat, const gl::Extents &amp;size, bool forceRelease) override;
+
+    D3DFORMAT getD3DFormat() const;
+
+    virtual bool isDirty() const;
+
+    virtual gl::Error setManagedSurface2D(TextureStorage *storage, int level);
+    virtual gl::Error setManagedSurfaceCube(TextureStorage *storage, int face, int level);
+    virtual gl::Error copyToStorage(TextureStorage *storage, const gl::ImageIndex &amp;index, const gl::Box &amp;region);
+
+    virtual gl::Error loadData(const gl::Box &amp;area, const gl::PixelUnpackState &amp;unpack, GLenum type, const void *input);
+    virtual gl::Error loadCompressedData(const gl::Box &amp;area, const void *input);
+
+    virtual gl::Error copy(const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea, RenderTargetD3D *source);
+    virtual gl::Error copy(const gl::Offset &amp;destOffset, const gl::Box &amp;sourceArea,
+                           const gl::ImageIndex &amp;sourceIndex, TextureStorage *source);
+
+  private:
+    gl::Error getSurface(IDirect3DSurface9 **outSurface);
+
+    gl::Error createSurface();
+    gl::Error setManagedSurface(IDirect3DSurface9 *surface);
+    gl::Error copyToSurface(IDirect3DSurface9 *dest, const gl::Box &amp;area);
+
+    gl::Error lock(D3DLOCKED_RECT *lockedRect, const RECT &amp;rect);
+    void unlock();
+
+    Renderer9 *mRenderer;
+
+    D3DPOOL mD3DPool;   // can only be D3DPOOL_SYSTEMMEM or D3DPOOL_MANAGED since it needs to be lockable.
+    D3DFORMAT mD3DFormat;
+
+    IDirect3DSurface9 *mSurface;
+};
+}
+
+#endif   // LIBANGLE_RENDERER_D3D_D3D9_IMAGE9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9IndexBuffer9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,167 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+// Indexffer9.cpp: Defines the D3D9 IndexBuffer implementation.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/IndexBuffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+
+namespace rx
+{
+
+IndexBuffer9::IndexBuffer9(Renderer9 *const renderer) : mRenderer(renderer)
+{
+    mIndexBuffer = NULL;
+    mBufferSize = 0;
+    mIndexType = 0;
+    mDynamic = false;
+}
+
+IndexBuffer9::~IndexBuffer9()
+{
+    SafeRelease(mIndexBuffer);
+}
+
+gl::Error IndexBuffer9::initialize(unsigned int bufferSize, GLenum indexType, bool dynamic)
+{
+    SafeRelease(mIndexBuffer);
+
+    updateSerial();
+
+    if (bufferSize &gt; 0)
+    {
+        D3DFORMAT format = D3DFMT_UNKNOWN;
+        if (indexType == GL_UNSIGNED_SHORT || indexType == GL_UNSIGNED_BYTE)
+        {
+            format = D3DFMT_INDEX16;
+        }
+        else if (indexType == GL_UNSIGNED_INT)
+        {
+            ASSERT(mRenderer-&gt;getRendererExtensions().elementIndexUint);
+            format = D3DFMT_INDEX32;
+        }
+        else UNREACHABLE();
+
+        DWORD usageFlags = D3DUSAGE_WRITEONLY;
+        if (dynamic)
+        {
+            usageFlags |= D3DUSAGE_DYNAMIC;
+        }
+
+        HRESULT result = mRenderer-&gt;createIndexBuffer(bufferSize, usageFlags, format, &amp;mIndexBuffer);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal index buffer of size, %lu.&quot;, bufferSize);
+        }
+    }
+
+    mBufferSize = bufferSize;
+    mIndexType = indexType;
+    mDynamic = dynamic;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error IndexBuffer9::mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory)
+{
+    if (!mIndexBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal index buffer is not initialized.&quot;);
+    }
+
+    DWORD lockFlags = mDynamic ? D3DLOCK_NOOVERWRITE : 0;
+
+    void *mapPtr = NULL;
+    HRESULT result = mIndexBuffer-&gt;Lock(offset, size, &amp;mapPtr, lockFlags);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock internal index buffer, HRESULT: 0x%08x.&quot;, result);
+    }
+
+    *outMappedMemory = mapPtr;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error IndexBuffer9::unmapBuffer()
+{
+    if (!mIndexBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal index buffer is not initialized.&quot;);
+    }
+
+    HRESULT result = mIndexBuffer-&gt;Unlock();
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to unlock internal index buffer, HRESULT: 0x%08x.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLenum IndexBuffer9::getIndexType() const
+{
+    return mIndexType;
+}
+
+unsigned int IndexBuffer9::getBufferSize() const
+{
+    return mBufferSize;
+}
+
+gl::Error IndexBuffer9::setSize(unsigned int bufferSize, GLenum indexType)
+{
+    if (bufferSize &gt; mBufferSize || indexType != mIndexType)
+    {
+        return initialize(bufferSize, indexType, mDynamic);
+    }
+    else
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error IndexBuffer9::discard()
+{
+    if (!mIndexBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal index buffer is not initialized.&quot;);
+    }
+
+    void *dummy;
+    HRESULT result;
+
+    result = mIndexBuffer-&gt;Lock(0, 1, &amp;dummy, D3DLOCK_DISCARD);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock internal index buffer, HRESULT: 0x%08x.&quot;, result);
+    }
+
+    result = mIndexBuffer-&gt;Unlock();
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to unlock internal index buffer, HRESULT: 0x%08x.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+D3DFORMAT IndexBuffer9::getIndexFormat() const
+{
+    switch (mIndexType)
+    {
+      case GL_UNSIGNED_BYTE:    return D3DFMT_INDEX16;
+      case GL_UNSIGNED_SHORT:   return D3DFMT_INDEX16;
+      case GL_UNSIGNED_INT:     return D3DFMT_INDEX32;
+      default: UNREACHABLE();   return D3DFMT_UNKNOWN;
+    }
+}
+
+IDirect3DIndexBuffer9 * IndexBuffer9::getBuffer() const
+{
+    return mIndexBuffer;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9IndexBuffer9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/IndexBuffer9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+//
+// 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.
+//
+
+// Indexffer9.h: Defines the D3D9 IndexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_INDEXBUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_INDEXBUFFER9_H_
+
+#include &quot;libANGLE/renderer/d3d/IndexBuffer.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class IndexBuffer9 : public IndexBuffer
+{
+  public:
+    explicit IndexBuffer9(Renderer9 *const renderer);
+    virtual ~IndexBuffer9();
+
+    virtual gl::Error initialize(unsigned int bufferSize, GLenum indexType, bool dynamic);
+
+    virtual gl::Error mapBuffer(unsigned int offset, unsigned int size, void** outMappedMemory);
+    virtual gl::Error unmapBuffer();
+
+    virtual GLenum getIndexType() const;
+    virtual unsigned int getBufferSize() const;
+    virtual gl::Error setSize(unsigned int bufferSize, GLenum indexType);
+
+    virtual gl::Error discard();
+
+    D3DFORMAT getIndexFormat() const;
+    IDirect3DIndexBuffer9 *getBuffer() const;
+
+  private:
+    Renderer9 *const mRenderer;
+
+    IDirect3DIndexBuffer9 *mIndexBuffer;
+    unsigned int mBufferSize;
+    GLenum mIndexType;
+    bool mDynamic;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_INDEXBUFFER9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Query9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,144 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/Query9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+
+#include &lt;GLES2/gl2ext.h&gt;
+
+namespace rx
+{
+Query9::Query9(Renderer9 *renderer, GLenum type)
+    : QueryImpl(type),
+      mResult(GL_FALSE),
+      mQueryFinished(false),
+      mRenderer(renderer),
+      mQuery(NULL)
+{
+}
+
+Query9::~Query9()
+{
+    SafeRelease(mQuery);
+}
+
+gl::Error Query9::begin()
+{
+    if (mQuery == NULL)
+    {
+        HRESULT result = mRenderer-&gt;getDevice()-&gt;CreateQuery(D3DQUERYTYPE_OCCLUSION, &amp;mQuery);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal query creation failed, result: 0x%X.&quot;, result);
+        }
+    }
+
+    HRESULT result = mQuery-&gt;Issue(D3DISSUE_BEGIN);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to begin internal query, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query9::end()
+{
+    ASSERT(mQuery);
+
+    HRESULT result = mQuery-&gt;Issue(D3DISSUE_END);
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to end internal query, result: 0x%X.&quot;, result);
+    }
+
+    mQueryFinished = false;
+    mResult = GL_FALSE;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query9::getResult(GLuint *params)
+{
+    while (!mQueryFinished)
+    {
+        gl::Error error = testQuery();
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (!mQueryFinished)
+        {
+            Sleep(0);
+        }
+    }
+
+    ASSERT(mQueryFinished);
+    *params = mResult;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query9::isResultAvailable(GLuint *available)
+{
+    gl::Error error = testQuery();
+    if (error.isError())
+    {
+        return error;
+    }
+
+    *available = (mQueryFinished ? GL_TRUE : GL_FALSE);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Query9::testQuery()
+{
+    if (!mQueryFinished)
+    {
+        ASSERT(mQuery);
+
+        DWORD numPixels = 0;
+
+        HRESULT hres = mQuery-&gt;GetData(&amp;numPixels, sizeof(DWORD), D3DGETDATA_FLUSH);
+        if (hres == S_OK)
+        {
+            mQueryFinished = true;
+
+            switch (getType())
+            {
+              case GL_ANY_SAMPLES_PASSED_EXT:
+              case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+                mResult = (numPixels &gt; 0) ? GL_TRUE : GL_FALSE;
+                break;
+
+              default:
+                UNREACHABLE();
+                break;
+            }
+        }
+        else if (d3d9::isDeviceLostError(hres))
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to test get query result, device is lost.&quot;);
+        }
+        else if (mRenderer-&gt;testDeviceLost())
+        {
+            mRenderer-&gt;notifyDeviceLost();
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to test get query result, device is lost.&quot;);
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Query9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Query9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// Query9.h: Defines the rx::Query9 class which implements rx::QueryImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_
+
+#include &quot;libANGLE/renderer/QueryImpl.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class Query9 : public QueryImpl
+{
+  public:
+    Query9(Renderer9 *renderer, GLenum type);
+    virtual ~Query9();
+
+    virtual gl::Error begin();
+    virtual gl::Error end();
+    virtual gl::Error getResult(GLuint *params);
+    virtual gl::Error isResultAvailable(GLuint *available);
+
+  private:
+    gl::Error testQuery();
+
+    GLuint mResult;
+    bool mQueryFinished;
+
+    Renderer9 *mRenderer;
+    IDirect3DQuery9 *mQuery;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_QUERY9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9RenderTarget9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,133 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// RenderTarget9.cpp: Implements a D3D9-specific wrapper for IDirect3DSurface9
+// pointers retained by renderbuffers.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/SwapChain9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+
+namespace rx
+{
+
+// TODO: AddRef the incoming surface to take ownership instead of expecting that its ref is being given.
+TextureRenderTarget9::TextureRenderTarget9(IDirect3DSurface9 *surface, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth,
+                                           GLsizei samples)
+    : mWidth(width),
+      mHeight(height),
+      mDepth(depth),
+      mInternalFormat(internalFormat),
+      mD3DFormat(D3DFMT_UNKNOWN),
+      mSamples(samples),
+      mRenderTarget(surface)
+{
+    ASSERT(mDepth == 1);
+
+    if (mRenderTarget)
+    {
+        D3DSURFACE_DESC description;
+        mRenderTarget-&gt;GetDesc(&amp;description);
+        mD3DFormat = description.Format;
+    }
+}
+
+TextureRenderTarget9::~TextureRenderTarget9()
+{
+    SafeRelease(mRenderTarget);
+}
+
+GLsizei TextureRenderTarget9::getWidth() const
+{
+    return mWidth;
+}
+
+GLsizei TextureRenderTarget9::getHeight() const
+{
+    return mHeight;
+}
+
+GLsizei TextureRenderTarget9::getDepth() const
+{
+    return mDepth;
+}
+
+GLenum TextureRenderTarget9::getInternalFormat() const
+{
+    return mInternalFormat;
+}
+
+GLsizei TextureRenderTarget9::getSamples() const
+{
+    return mSamples;
+}
+
+IDirect3DSurface9 *TextureRenderTarget9::getSurface()
+{
+    // Caller is responsible for releasing the returned surface reference.
+    // TODO: remove the AddRef to match RenderTarget11
+    if (mRenderTarget)
+    {
+        mRenderTarget-&gt;AddRef();
+    }
+
+    return mRenderTarget;
+}
+
+D3DFORMAT TextureRenderTarget9::getD3DFormat() const
+{
+    return mD3DFormat;
+}
+
+SurfaceRenderTarget9::SurfaceRenderTarget9(SwapChain9 *swapChain, bool depth)
+    : mSwapChain(swapChain),
+      mDepth(depth)
+{
+}
+
+SurfaceRenderTarget9::~SurfaceRenderTarget9()
+{
+}
+
+GLsizei SurfaceRenderTarget9::getWidth() const
+{
+    return mSwapChain-&gt;getWidth();
+}
+
+GLsizei SurfaceRenderTarget9::getHeight() const
+{
+    return mSwapChain-&gt;getHeight();
+}
+
+GLsizei SurfaceRenderTarget9::getDepth() const
+{
+    return 1;
+}
+
+GLenum SurfaceRenderTarget9::getInternalFormat() const
+{
+    return (mDepth ? mSwapChain-&gt;GetDepthBufferInternalFormat() : mSwapChain-&gt;GetBackBufferInternalFormat());
+}
+
+GLsizei SurfaceRenderTarget9::getSamples() const
+{
+    // Our EGL surfaces do not support multisampling.
+    return 0;
+}
+
+IDirect3DSurface9 *SurfaceRenderTarget9::getSurface()
+{
+    return (mDepth ? mSwapChain-&gt;getDepthStencil() : mSwapChain-&gt;getRenderTarget());
+}
+
+D3DFORMAT SurfaceRenderTarget9::getD3DFormat() const
+{
+    return d3d9::GetTextureFormatInfo(getInternalFormat()).texFormat;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9RenderTarget9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/RenderTarget9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+//
+// 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.
+//
+
+// RenderTarget9.h: Defines a D3D9-specific wrapper for IDirect3DSurface9 pointers
+// retained by Renderbuffers.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_RENDERTARGET9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_RENDERTARGET9_H_
+
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+
+namespace rx
+{
+class Renderer9;
+class SwapChain9;
+
+class RenderTarget9 : public RenderTargetD3D
+{
+  public:
+    RenderTarget9() { }
+    virtual ~RenderTarget9() { }
+
+    virtual IDirect3DSurface9 *getSurface() = 0;
+
+    virtual D3DFORMAT getD3DFormat() const = 0;
+};
+
+class TextureRenderTarget9 : public RenderTarget9
+{
+  public:
+    TextureRenderTarget9(IDirect3DSurface9 *surface, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth,
+                         GLsizei samples);
+    virtual ~TextureRenderTarget9();
+
+    GLsizei getWidth() const override;
+    GLsizei getHeight() const override;
+    GLsizei getDepth() const override;
+    GLenum getInternalFormat() const override;
+    GLsizei getSamples() const override;
+
+    IDirect3DSurface9 *getSurface() override;
+
+    D3DFORMAT getD3DFormat() const override;
+
+  private:
+    GLsizei mWidth;
+    GLsizei mHeight;
+    GLsizei mDepth;
+    GLenum mInternalFormat;
+    D3DFORMAT mD3DFormat;
+    GLsizei mSamples;
+
+    IDirect3DSurface9 *mRenderTarget;
+};
+
+class SurfaceRenderTarget9 : public RenderTarget9
+{
+  public:
+    SurfaceRenderTarget9(SwapChain9 *swapChain, bool depth);
+    virtual ~SurfaceRenderTarget9();
+
+    GLsizei getWidth() const override;
+    GLsizei getHeight() const override;
+    GLsizei getDepth() const override;
+    GLenum getInternalFormat() const override;
+    GLsizei getSamples() const override;
+
+    IDirect3DSurface9 *getSurface() override;
+
+    D3DFORMAT getD3DFormat() const override;
+
+  private:
+    SwapChain9 *mSwapChain;
+    bool mDepth;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERTARGET9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Renderer9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,2953 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// Renderer9.cpp: Implements a back-end specific class for the D3D9 renderer.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/State.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/features.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/CompilerD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/IndexDataManager.h&quot;
+#include &quot;libANGLE/renderer/d3d/ProgramD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderbufferD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/ShaderD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/SurfaceD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/TransformFeedbackD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Blit9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Buffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Fence9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Framebuffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Image9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/IndexBuffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Query9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/SwapChain9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/TextureStorage9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/VertexArray9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/VertexBuffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+
+#include &quot;third_party/trace_event/trace_event.h&quot;
+
+#include &lt;sstream&gt;
+#include &lt;EGL/eglext.h&gt;
+
+#include &lt;EGL/eglext.h&gt;
+
+#if !defined(ANGLE_COMPILE_OPTIMIZATION_LEVEL)
+#define ANGLE_COMPILE_OPTIMIZATION_LEVEL D3DCOMPILE_OPTIMIZATION_LEVEL3
+#endif
+
+// Enable ANGLE_SUPPORT_SHADER_MODEL_2 if you wish devices with only shader model 2.
+// Such a device would not be conformant.
+#ifndef ANGLE_SUPPORT_SHADER_MODEL_2
+#define ANGLE_SUPPORT_SHADER_MODEL_2 0
+#endif
+
+namespace rx
+{
+
+enum
+{
+    MAX_VERTEX_CONSTANT_VECTORS_D3D9 = 256,
+    MAX_PIXEL_CONSTANT_VECTORS_SM2 = 32,
+    MAX_PIXEL_CONSTANT_VECTORS_SM3 = 224,
+    MAX_VARYING_VECTORS_SM2 = 8,
+    MAX_VARYING_VECTORS_SM3 = 10,
+
+    MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4
+};
+
+Renderer9::Renderer9(egl::Display *display)
+    : RendererD3D(display)
+{
+    // Initialize global annotator
+    gl::InitializeDebugAnnotations(&amp;mAnnotator);
+
+    mD3d9Module = NULL;
+
+    mD3d9 = NULL;
+    mD3d9Ex = NULL;
+    mDevice = NULL;
+    mDeviceEx = NULL;
+    mDeviceWindow = NULL;
+    mBlit = NULL;
+
+    mAdapter = D3DADAPTER_DEFAULT;
+
+    const egl::AttributeMap &amp;attributes = display-&gt;getAttributeMap();
+    EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
+                                                EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+    switch (requestedDeviceType)
+    {
+      case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
+        mDeviceType = D3DDEVTYPE_HAL;
+        break;
+
+      case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
+        mDeviceType = D3DDEVTYPE_REF;
+        break;
+
+      case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
+        mDeviceType = D3DDEVTYPE_NULLREF;
+        break;
+
+      default:
+        UNREACHABLE();
+    }
+
+    mMaskedClearSavedState = NULL;
+
+    mVertexDataManager = NULL;
+    mIndexDataManager = NULL;
+    mLineLoopIB = NULL;
+    mCountingIB = NULL;
+
+    mMaxNullColorbufferLRU = 0;
+    for (int i = 0; i &lt; NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+    {
+        mNullColorbufferCache[i].lruCount = 0;
+        mNullColorbufferCache[i].width = 0;
+        mNullColorbufferCache[i].height = 0;
+        mNullColorbufferCache[i].buffer = NULL;
+    }
+
+    mAppliedVertexShader = NULL;
+    mAppliedPixelShader = NULL;
+    mAppliedProgramSerial = 0;
+}
+
+Renderer9::~Renderer9()
+{
+    if (mDevice)
+    {
+        // If the device is lost, reset it first to prevent leaving the driver in an unstable state
+        if (testDeviceLost())
+        {
+            resetDevice();
+        }
+    }
+
+    release();
+
+    gl::UninitializeDebugAnnotations();
+}
+
+void Renderer9::release()
+{
+    RendererD3D::cleanup();
+
+    releaseDeviceResources();
+
+    SafeRelease(mDevice);
+    SafeRelease(mDeviceEx);
+    SafeRelease(mD3d9);
+    SafeRelease(mD3d9Ex);
+
+    mCompiler.release();
+
+    if (mDeviceWindow)
+    {
+        DestroyWindow(mDeviceWindow);
+        mDeviceWindow = NULL;
+    }
+
+    mD3d9Module = NULL;
+}
+
+egl::Error Renderer9::initialize()
+{
+    if (!mCompiler.initialize())
+    {
+        return egl::Error(EGL_NOT_INITIALIZED,
+                          D3D9_INIT_COMPILER_ERROR,
+                          &quot;Compiler failed to initialize.&quot;);
+    }
+
+    TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;GetModuleHandle_d3d9&quot;);
+    mD3d9Module = GetModuleHandle(TEXT(&quot;d3d9.dll&quot;));
+
+    if (mD3d9Module == NULL)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, D3D9_INIT_MISSING_DEP, &quot;No D3D9 module found.&quot;);
+    }
+
+    typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
+    Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast&lt;Direct3DCreate9ExFunc&gt;(GetProcAddress(mD3d9Module, &quot;Direct3DCreate9Ex&quot;));
+
+    // 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_D3D9EX == ANGLE_ENABLED &amp;&amp; Direct3DCreate9ExPtr &amp;&amp; SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &amp;mD3d9Ex)))
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;D3d9Ex_QueryInterface&quot;);
+        ASSERT(mD3d9Ex);
+        mD3d9Ex-&gt;QueryInterface(__uuidof(IDirect3D9), reinterpret_cast&lt;void**&gt;(&amp;mD3d9));
+        ASSERT(mD3d9);
+    }
+    else
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;Direct3DCreate9&quot;);
+        mD3d9 = Direct3DCreate9(D3D_SDK_VERSION);
+    }
+
+    if (!mD3d9)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, D3D9_INIT_MISSING_DEP, &quot;Could not create D3D9 device.&quot;);
+    }
+
+    if (mDisplay-&gt;getNativeDisplayId() != nullptr)
+    {
+    //  UNIMPLEMENTED();   // FIXME: Determine which adapter index the device context corresponds to
+    }
+
+    HRESULT result;
+
+    // Give up on getting device caps after about one second.
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;GetDeviceCaps&quot;);
+        for (int i = 0; i &lt; 10; ++i)
+        {
+            result = mD3d9-&gt;GetDeviceCaps(mAdapter, mDeviceType, &amp;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
+            {
+                return egl::Error(EGL_NOT_INITIALIZED,
+                                  D3D9_INIT_OTHER_ERROR,
+                                  &quot;Failed to get device caps: Error code 0x%x\n&quot;, result);
+            }
+        }
+    }
+
+#if ANGLE_SUPPORT_SHADER_MODEL_2
+    size_t minShaderModel = 2;
+#else
+    size_t minShaderModel = 3;
+#endif
+
+    if (mDeviceCaps.PixelShaderVersion &lt; D3DPS_VERSION(minShaderModel, 0))
+    {
+        return egl::Error(EGL_NOT_INITIALIZED,
+                          D3D9_INIT_UNSUPPORTED_VERSION,
+                          &quot;Renderer does not support PS %u.%u.aborting!&quot;, minShaderModel, 0);
+    }
+
+    // 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::ensureRenderTarget.
+    if ((mDeviceCaps.DevCaps2 &amp; D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES) == 0)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED,
+                          D3D9_INIT_UNSUPPORTED_STRETCHRECT,
+                          &quot;Renderer does not support StretctRect from textures.&quot;);
+    }
+
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;GetAdapterIdentifier&quot;);
+        mD3d9-&gt;GetAdapterIdentifier(mAdapter, 0, &amp;mAdapterIdentifier);
+    }
+
+    static const TCHAR windowName[] = TEXT(&quot;AngleHiddenWindow&quot;);
+    static const TCHAR className[] = TEXT(&quot;STATIC&quot;);
+
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;CreateWindowEx&quot;);
+        mDeviceWindow = CreateWindowEx(WS_EX_NOACTIVATE, className, windowName, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, HWND_MESSAGE, NULL, GetModuleHandle(NULL), NULL);
+    }
+
+    D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
+    DWORD behaviorFlags = D3DCREATE_FPU_PRESERVE | D3DCREATE_NOWINDOWCHANGES | D3DCREATE_MULTITHREADED;
+
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;D3d9_CreateDevice&quot;);
+        result = mD3d9-&gt;CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &amp;presentParameters, &amp;mDevice);
+    }
+    if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DEVICELOST)
+    {
+        return egl::Error(EGL_BAD_ALLOC, D3D9_INIT_OUT_OF_MEMORY,
+                          &quot;CreateDevice failed: device lost of out of memory&quot;);
+    }
+
+    if (FAILED(result))
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;D3d9_CreateDevice2&quot;);
+        result = mD3d9-&gt;CreateDevice(mAdapter, mDeviceType, mDeviceWindow, behaviorFlags | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &amp;presentParameters, &amp;mDevice);
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_NOTAVAILABLE || result == D3DERR_DEVICELOST);
+            return egl::Error(EGL_BAD_ALLOC, D3D9_INIT_OUT_OF_MEMORY,
+                              &quot;CreateDevice2 failed: device lost, not available, or of out of memory&quot;);
+        }
+    }
+
+    if (mD3d9Ex)
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;mDevice_QueryInterface&quot;);
+        result = mDevice-&gt;QueryInterface(__uuidof(IDirect3DDevice9Ex), (void**)&amp;mDeviceEx);
+        ASSERT(SUCCEEDED(result));
+    }
+
+    {
+        TRACE_EVENT0(&quot;gpu.angle&quot;, &quot;ShaderCache initialize&quot;);
+        mVertexShaderCache.initialize(mDevice);
+        mPixelShaderCache.initialize(mDevice);
+    }
+
+    D3DDISPLAYMODE currentDisplayMode;
+    mD3d9-&gt;GetAdapterDisplayMode(mAdapter, &amp;currentDisplayMode);
+
+    // Check vertex texture support
+    // Only Direct3D 10 ready devices support all the necessary vertex texture formats.
+    // We test this using D3D9 by checking support for the R16F format.
+    mVertexTextureSupport = mDeviceCaps.PixelShaderVersion &gt;= D3DPS_VERSION(3, 0) &amp;&amp;
+                            SUCCEEDED(mD3d9-&gt;CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
+                                                               D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F));
+
+    initializeDevice();
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+// 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 Renderer9::initializeDevice()
+{
+    // Permanent non-default states
+    mDevice-&gt;SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE);
+    mDevice-&gt;SetRenderState(D3DRS_LASTPIXEL, FALSE);
+
+    if (mDeviceCaps.PixelShaderVersion &gt;= D3DPS_VERSION(3, 0))
+    {
+        mDevice-&gt;SetRenderState(D3DRS_POINTSIZE_MAX, (DWORD&amp;)mDeviceCaps.MaxPointSize);
+    }
+    else
+    {
+        mDevice-&gt;SetRenderState(D3DRS_POINTSIZE_MAX, 0x3F800000);   // 1.0f
+    }
+
+    const gl::Caps &amp;rendererCaps = getRendererCaps();
+
+    mForceSetVertexSamplerStates.resize(rendererCaps.maxVertexTextureImageUnits);
+    mCurVertexSamplerStates.resize(rendererCaps.maxVertexTextureImageUnits);
+
+    mForceSetPixelSamplerStates.resize(rendererCaps.maxTextureImageUnits);
+    mCurPixelSamplerStates.resize(rendererCaps.maxTextureImageUnits);
+
+    mCurVertexTextureSerials.resize(rendererCaps.maxVertexTextureImageUnits);
+    mCurPixelTextureSerials.resize(rendererCaps.maxTextureImageUnits);
+
+    markAllStateDirty();
+
+    mSceneStarted = false;
+
+    ASSERT(!mBlit);
+    mBlit = new Blit9(this);
+    mBlit-&gt;initialize();
+
+    ASSERT(!mVertexDataManager &amp;&amp; !mIndexDataManager);
+    mVertexDataManager = new VertexDataManager(this);
+    mIndexDataManager = new IndexDataManager(this, getRendererClass());
+}
+
+D3DPRESENT_PARAMETERS Renderer9::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;
+}
+
+egl::ConfigSet Renderer9::generateConfigs() const
+{
+    static const GLenum colorBufferFormats[] =
+    {
+        GL_BGR5_A1_ANGLEX,
+        GL_BGRA8_EXT,
+        GL_RGB565,
+
+    };
+
+    static const GLenum depthStencilBufferFormats[] =
+    {
+        GL_NONE,
+        GL_DEPTH_COMPONENT32_OES,
+        GL_DEPTH24_STENCIL8_OES,
+        GL_DEPTH_COMPONENT24_OES,
+        GL_DEPTH_COMPONENT16,
+    };
+
+    const gl::Caps &amp;rendererCaps = getRendererCaps();
+    const gl::TextureCapsMap &amp;rendererTextureCaps = getRendererTextureCaps();
+
+    D3DDISPLAYMODE currentDisplayMode;
+    mD3d9-&gt;GetAdapterDisplayMode(mAdapter, &amp;currentDisplayMode);
+
+    // Determine the min and max swap intervals
+    int minSwapInterval = 4;
+    int maxSwapInterval = 0;
+
+    if (mDeviceCaps.PresentationIntervals &amp; D3DPRESENT_INTERVAL_IMMEDIATE)
+    {
+        minSwapInterval = std::min(minSwapInterval, 0);
+        maxSwapInterval = std::max(maxSwapInterval, 0);
+    }
+    if (mDeviceCaps.PresentationIntervals &amp; D3DPRESENT_INTERVAL_ONE)
+    {
+        minSwapInterval = std::min(minSwapInterval, 1);
+        maxSwapInterval = std::max(maxSwapInterval, 1);
+    }
+    if (mDeviceCaps.PresentationIntervals &amp; D3DPRESENT_INTERVAL_TWO)
+    {
+        minSwapInterval = std::min(minSwapInterval, 2);
+        maxSwapInterval = std::max(maxSwapInterval, 2);
+    }
+    if (mDeviceCaps.PresentationIntervals &amp; D3DPRESENT_INTERVAL_THREE)
+    {
+        minSwapInterval = std::min(minSwapInterval, 3);
+        maxSwapInterval = std::max(maxSwapInterval, 3);
+    }
+    if (mDeviceCaps.PresentationIntervals &amp; D3DPRESENT_INTERVAL_FOUR)
+    {
+        minSwapInterval = std::min(minSwapInterval, 4);
+        maxSwapInterval = std::max(maxSwapInterval, 4);
+    }
+
+    egl::ConfigSet configs;
+    for (size_t formatIndex = 0; formatIndex &lt; ArraySize(colorBufferFormats); formatIndex++)
+    {
+        GLenum colorBufferInternalFormat = colorBufferFormats[formatIndex];
+        const gl::TextureCaps &amp;colorBufferFormatCaps = rendererTextureCaps.get(colorBufferInternalFormat);
+        if (colorBufferFormatCaps.renderable)
+        {
+            for (size_t depthStencilIndex = 0; depthStencilIndex &lt; ArraySize(depthStencilBufferFormats); depthStencilIndex++)
+            {
+                GLenum depthStencilBufferInternalFormat = depthStencilBufferFormats[depthStencilIndex];
+                const gl::TextureCaps &amp;depthStencilBufferFormatCaps = rendererTextureCaps.get(depthStencilBufferInternalFormat);
+                if (depthStencilBufferFormatCaps.renderable || depthStencilBufferInternalFormat == GL_NONE)
+                {
+                    const gl::InternalFormat &amp;colorBufferFormatInfo = gl::GetInternalFormatInfo(colorBufferInternalFormat);
+                    const gl::InternalFormat &amp;depthStencilBufferFormatInfo = gl::GetInternalFormatInfo(depthStencilBufferInternalFormat);
+                    const d3d9::TextureFormat &amp;d3d9ColorBufferFormatInfo = d3d9::GetTextureFormatInfo(colorBufferInternalFormat);
+
+                    egl::Config config;
+                    config.renderTargetFormat = colorBufferInternalFormat;
+                    config.depthStencilFormat = depthStencilBufferInternalFormat;
+                    config.bufferSize = colorBufferFormatInfo.pixelBytes * 8;
+                    config.redSize = colorBufferFormatInfo.redBits;
+                    config.greenSize = colorBufferFormatInfo.greenBits;
+                    config.blueSize = colorBufferFormatInfo.blueBits;
+                    config.luminanceSize = colorBufferFormatInfo.luminanceBits;
+                    config.alphaSize = colorBufferFormatInfo.alphaBits;
+                    config.alphaMaskSize = 0;
+                    config.bindToTextureRGB = (colorBufferFormatInfo.format == GL_RGB);
+                    config.bindToTextureRGBA = (colorBufferFormatInfo.format == GL_RGBA || colorBufferFormatInfo.format == GL_BGRA_EXT);
+                    config.colorBufferType = EGL_RGB_BUFFER;
+                    // Mark as slow if blits to the back-buffer won't be straight forward
+                    config.configCaveat = (currentDisplayMode.Format == d3d9ColorBufferFormatInfo.renderFormat) ? EGL_NONE : EGL_SLOW_CONFIG;
+                    config.configID = static_cast&lt;EGLint&gt;(configs.size() + 1);
+                    config.conformant = EGL_OPENGL_ES2_BIT;
+                    config.depthSize = depthStencilBufferFormatInfo.depthBits;
+                    config.level = 0;
+                    config.matchNativePixmap = EGL_NONE;
+                    config.maxPBufferWidth = rendererCaps.max2DTextureSize;
+                    config.maxPBufferHeight = rendererCaps.max2DTextureSize;
+                    config.maxPBufferPixels = rendererCaps.max2DTextureSize * rendererCaps.max2DTextureSize;
+                    config.maxSwapInterval = maxSwapInterval;
+                    config.minSwapInterval = minSwapInterval;
+                    config.nativeRenderable = EGL_FALSE;
+                    config.nativeVisualID = 0;
+                    config.nativeVisualType = EGL_NONE;
+                    config.renderableType = EGL_OPENGL_ES2_BIT;
+                    config.sampleBuffers = 0; // FIXME: enumerate multi-sampling
+                    config.samples = 0;
+                    config.stencilSize = depthStencilBufferFormatInfo.stencilBits;
+                    config.surfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+                    config.transparentType = EGL_NONE;
+                    config.transparentRedValue = 0;
+                    config.transparentGreenValue = 0;
+                    config.transparentBlueValue = 0;
+
+                    configs.add(config);
+                }
+            }
+        }
+    }
+
+    ASSERT(configs.size() &gt; 0);
+    return configs;
+}
+
+void Renderer9::startScene()
+{
+    if (!mSceneStarted)
+    {
+        long result = mDevice-&gt;BeginScene();
+        if (SUCCEEDED(result)) {
+            // This is defensive checking against the device being
+            // lost at unexpected times.
+            mSceneStarted = true;
+        }
+    }
+}
+
+void Renderer9::endScene()
+{
+    if (mSceneStarted)
+    {
+        // EndScene can fail if the device was lost, for example due
+        // to a TDR during a draw call.
+        mDevice-&gt;EndScene();
+        mSceneStarted = false;
+    }
+}
+
+gl::Error Renderer9::flush()
+{
+    IDirect3DQuery9* query = NULL;
+    gl::Error error = allocateEventQuery(&amp;query);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    HRESULT result = query-&gt;Issue(D3DISSUE_END);
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to issue event query, result: 0x%X.&quot;, result);
+    }
+
+    // Grab the query data once
+    result = query-&gt;GetData(NULL, 0, D3DGETDATA_FLUSH);
+    freeEventQuery(query);
+    if (FAILED(result))
+    {
+        if (d3d9::isDeviceLostError(result))
+        {
+            notifyDeviceLost();
+        }
+
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get event query data, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::finish()
+{
+    IDirect3DQuery9* query = NULL;
+    gl::Error error = allocateEventQuery(&amp;query);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    HRESULT result = query-&gt;Issue(D3DISSUE_END);
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to issue event query, result: 0x%X.&quot;, result);
+    }
+
+    // Grab the query data once
+    result = query-&gt;GetData(NULL, 0, D3DGETDATA_FLUSH);
+    if (FAILED(result))
+    {
+        if (d3d9::isDeviceLostError(result))
+        {
+            notifyDeviceLost();
+        }
+
+        freeEventQuery(query);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get event query data, result: 0x%X.&quot;, result);
+    }
+
+    // Loop until the query completes
+    while (result == S_FALSE)
+    {
+        // Keep polling, but allow other threads to do something useful first
+        Sleep(0);
+
+        result = query-&gt;GetData(NULL, 0, D3DGETDATA_FLUSH);
+
+        // 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 (result == S_FALSE &amp;&amp; testDeviceLost())
+        {
+            result = D3DERR_DEVICELOST;
+        }
+
+        if (FAILED(result))
+        {
+            if (d3d9::isDeviceLostError(result))
+            {
+                notifyDeviceLost();
+            }
+
+            freeEventQuery(query);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get event query data, result: 0x%X.&quot;, result);
+        }
+
+    }
+
+    freeEventQuery(query);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool Renderer9::shouldCreateChildWindowForSurface(EGLNativeWindowType window) const
+{
+    // D3D9 never needs to create child windows
+    return false;
+}
+
+SwapChainD3D *Renderer9::createSwapChain(NativeWindow nativeWindow, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
+{
+    return new SwapChain9(this, nativeWindow, shareHandle, backBufferFormat, depthBufferFormat);
+}
+
+void *Renderer9::getD3DDevice()
+{
+    return reinterpret_cast&lt;void*&gt;(mDevice);
+}
+
+gl::Error Renderer9::allocateEventQuery(IDirect3DQuery9 **outQuery)
+{
+    if (mEventQueryPool.empty())
+    {
+        HRESULT result = mDevice-&gt;CreateQuery(D3DQUERYTYPE_EVENT, outQuery);
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate event query, result: 0x%X.&quot;, result);
+        }
+    }
+    else
+    {
+        *outQuery = mEventQueryPool.back();
+        mEventQueryPool.pop_back();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer9::freeEventQuery(IDirect3DQuery9* query)
+{
+    if (mEventQueryPool.size() &gt; 1000)
+    {
+        SafeRelease(query);
+    }
+    else
+    {
+        mEventQueryPool.push_back(query);
+    }
+}
+
+gl::Error Renderer9::createVertexShader(const DWORD *function, size_t length, IDirect3DVertexShader9 **outShader)
+{
+    return mVertexShaderCache.create(function, length, outShader);
+}
+
+gl::Error Renderer9::createPixelShader(const DWORD *function, size_t length, IDirect3DPixelShader9 **outShader)
+{
+    return mPixelShaderCache.create(function, length, outShader);
+}
+
+HRESULT Renderer9::createVertexBuffer(UINT Length, DWORD Usage, IDirect3DVertexBuffer9 **ppVertexBuffer)
+{
+    D3DPOOL Pool = getBufferPool(Usage);
+    return mDevice-&gt;CreateVertexBuffer(Length, Usage, 0, Pool, ppVertexBuffer, NULL);
+}
+
+VertexBuffer *Renderer9::createVertexBuffer()
+{
+    return new VertexBuffer9(this);
+}
+
+HRESULT Renderer9::createIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, IDirect3DIndexBuffer9 **ppIndexBuffer)
+{
+    D3DPOOL Pool = getBufferPool(Usage);
+    return mDevice-&gt;CreateIndexBuffer(Length, Usage, Format, Pool, ppIndexBuffer, NULL);
+}
+
+IndexBuffer *Renderer9::createIndexBuffer()
+{
+    return new IndexBuffer9(this);
+}
+
+BufferImpl *Renderer9::createBuffer()
+{
+    return new Buffer9(this);
+}
+
+VertexArrayImpl *Renderer9::createVertexArray()
+{
+    return new VertexArray9(this);
+}
+
+QueryImpl *Renderer9::createQuery(GLenum type)
+{
+    return new Query9(this, type);
+}
+
+FenceNVImpl *Renderer9::createFenceNV()
+{
+    return new FenceNV9(this);
+}
+
+FenceSyncImpl *Renderer9::createFenceSync()
+{
+    // Renderer9 doesn't support ES 3.0 and its sync objects.
+    UNREACHABLE();
+    return NULL;
+}
+
+TransformFeedbackImpl* Renderer9::createTransformFeedback()
+{
+    return new TransformFeedbackD3D();
+}
+
+bool Renderer9::supportsFastCopyBufferToTexture(GLenum internalFormat) const
+{
+    // Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
+    return false;
+}
+
+gl::Error Renderer9::fastCopyBufferToTexture(const gl::PixelUnpackState &amp;unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+                                             GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &amp;destArea)
+{
+    // Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error Renderer9::generateSwizzle(gl::Texture *texture)
+{
+    // Swizzled textures are not available in ES2 or D3D9
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error Renderer9::setSamplerState(gl::SamplerType type, int index, gl::Texture *texture, const gl::SamplerState &amp;samplerState)
+{
+    std::vector&lt;bool&gt; &amp;forceSetSamplers = (type == gl::SAMPLER_PIXEL) ? mForceSetPixelSamplerStates : mForceSetVertexSamplerStates;
+    std::vector&lt;gl::SamplerState&gt; &amp;appliedSamplers = (type == gl::SAMPLER_PIXEL) ? mCurPixelSamplerStates: mCurVertexSamplerStates;
+
+    if (forceSetSamplers[index] || memcmp(&amp;samplerState, &amp;appliedSamplers[index], sizeof(gl::SamplerState)) != 0)
+    {
+        int d3dSamplerOffset = (type == gl::SAMPLER_PIXEL) ? 0 : D3DVERTEXTEXTURESAMPLER0;
+        int d3dSampler = index + d3dSamplerOffset;
+
+        // Make sure to add the level offset for our tiny compressed texture workaround
+        TextureD3D *textureD3D = GetImplAs&lt;TextureD3D&gt;(texture);
+
+        TextureStorage *storage = nullptr;
+        gl::Error error = textureD3D-&gt;getNativeTexture(&amp;storage);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // Storage should exist, texture should be complete
+        ASSERT(storage);
+
+        DWORD baseLevel = samplerState.baseLevel + storage-&gt;getTopLevel();
+
+        mDevice-&gt;SetSamplerState(d3dSampler, D3DSAMP_ADDRESSU, gl_d3d9::ConvertTextureWrap(samplerState.wrapS));
+        mDevice-&gt;SetSamplerState(d3dSampler, D3DSAMP_ADDRESSV, gl_d3d9::ConvertTextureWrap(samplerState.wrapT));
+
+        mDevice-&gt;SetSamplerState(d3dSampler, D3DSAMP_MAGFILTER, gl_d3d9::ConvertMagFilter(samplerState.magFilter, samplerState.maxAnisotropy));
+        D3DTEXTUREFILTERTYPE d3dMinFilter, d3dMipFilter;
+        gl_d3d9::ConvertMinFilter(samplerState.minFilter, &amp;d3dMinFilter, &amp;d3dMipFilter, samplerState.maxAnisotropy);
+        mDevice-&gt;SetSamplerState(d3dSampler, D3DSAMP_MINFILTER, d3dMinFilter);
+        mDevice-&gt;SetSamplerState(d3dSampler, D3DSAMP_MIPFILTER, d3dMipFilter);
+        mDevice-&gt;SetSamplerState(d3dSampler, D3DSAMP_MAXMIPLEVEL, baseLevel);
+        if (getRendererExtensions().textureFilterAnisotropic)
+        {
+            mDevice-&gt;SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, (DWORD)samplerState.maxAnisotropy);
+        }
+    }
+
+    forceSetSamplers[index] = false;
+    appliedSamplers[index] = samplerState;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::setTexture(gl::SamplerType type, int index, gl::Texture *texture)
+{
+    int d3dSamplerOffset = (type == gl::SAMPLER_PIXEL) ? 0 : D3DVERTEXTEXTURESAMPLER0;
+    int d3dSampler = index + d3dSamplerOffset;
+    IDirect3DBaseTexture9 *d3dTexture = NULL;
+    unsigned int serial = 0;
+    bool forceSetTexture = false;
+
+    std::vector&lt;unsigned int&gt; &amp;appliedSerials = (type == gl::SAMPLER_PIXEL) ? mCurPixelTextureSerials : mCurVertexTextureSerials;
+
+    if (texture)
+    {
+        TextureD3D *textureImpl = GetImplAs&lt;TextureD3D&gt;(texture);
+
+        TextureStorage *texStorage = nullptr;
+        gl::Error error = textureImpl-&gt;getNativeTexture(&amp;texStorage);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // Texture should be complete and have a storage
+        ASSERT(texStorage);
+
+        TextureStorage9 *storage9 = GetAs&lt;TextureStorage9&gt;(texStorage);
+        error = storage9-&gt;getBaseTexture(&amp;d3dTexture);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        // If we get NULL back from getBaseTexture here, something went wrong
+        // in the texture class and we're unexpectedly missing the d3d texture
+        ASSERT(d3dTexture != NULL);
+
+        serial = texture-&gt;getTextureSerial();
+        forceSetTexture = textureImpl-&gt;hasDirtyImages();
+        textureImpl-&gt;resetDirty();
+    }
+
+    if (forceSetTexture || appliedSerials[index] != serial)
+    {
+        mDevice-&gt;SetTexture(d3dSampler, d3dTexture);
+    }
+
+    appliedSerials[index] = serial;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::setUniformBuffers(const gl::Data &amp;/*data*/,
+                                       const GLint /*vertexUniformBuffers*/[],
+                                       const GLint /*fragmentUniformBuffers*/[])
+{
+    // No effect in ES2/D3D9
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::setRasterizerState(const gl::RasterizerState &amp;rasterState)
+{
+    bool rasterStateChanged = mForceSetRasterState || memcmp(&amp;rasterState, &amp;mCurRasterState, sizeof(gl::RasterizerState)) != 0;
+
+    if (rasterStateChanged)
+    {
+        // Set the cull mode
+        if (rasterState.cullFace)
+        {
+            mDevice-&gt;SetRenderState(D3DRS_CULLMODE, gl_d3d9::ConvertCullMode(rasterState.cullMode, rasterState.frontFace));
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+        }
+
+        if (rasterState.polygonOffsetFill)
+        {
+            if (mCurDepthSize &gt; 0)
+            {
+                mDevice-&gt;SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, *(DWORD*)&amp;rasterState.polygonOffsetFactor);
+
+                float depthBias = ldexp(rasterState.polygonOffsetUnits, -static_cast&lt;int&gt;(mCurDepthSize));
+                mDevice-&gt;SetRenderState(D3DRS_DEPTHBIAS, *(DWORD*)&amp;depthBias);
+            }
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, 0);
+            mDevice-&gt;SetRenderState(D3DRS_DEPTHBIAS, 0);
+        }
+
+        mCurRasterState = rasterState;
+    }
+
+    mForceSetRasterState = false;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::setBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &amp;blendState, const gl::ColorF &amp;blendColor,
+                                   unsigned int sampleMask)
+{
+    bool blendStateChanged = mForceSetBlendState || memcmp(&amp;blendState, &amp;mCurBlendState, sizeof(gl::BlendState)) != 0;
+    bool blendColorChanged = mForceSetBlendState || memcmp(&amp;blendColor, &amp;mCurBlendColor, sizeof(gl::ColorF)) != 0;
+    bool sampleMaskChanged = mForceSetBlendState || sampleMask != mCurSampleMask;
+
+    if (blendStateChanged || blendColorChanged)
+    {
+        if (blendState.blend)
+        {
+            mDevice-&gt;SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+
+            if (blendState.sourceBlendRGB != GL_CONSTANT_ALPHA &amp;&amp; blendState.sourceBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA &amp;&amp;
+                blendState.destBlendRGB != GL_CONSTANT_ALPHA &amp;&amp; blendState.destBlendRGB != GL_ONE_MINUS_CONSTANT_ALPHA)
+            {
+                mDevice-&gt;SetRenderState(D3DRS_BLENDFACTOR, gl_d3d9::ConvertColor(blendColor));
+            }
+            else
+            {
+                mDevice-&gt;SetRenderState(D3DRS_BLENDFACTOR, D3DCOLOR_RGBA(gl::unorm&lt;8&gt;(blendColor.alpha),
+                                                                         gl::unorm&lt;8&gt;(blendColor.alpha),
+                                                                         gl::unorm&lt;8&gt;(blendColor.alpha),
+                                                                         gl::unorm&lt;8&gt;(blendColor.alpha)));
+            }
+
+            mDevice-&gt;SetRenderState(D3DRS_SRCBLEND, gl_d3d9::ConvertBlendFunc(blendState.sourceBlendRGB));
+            mDevice-&gt;SetRenderState(D3DRS_DESTBLEND, gl_d3d9::ConvertBlendFunc(blendState.destBlendRGB));
+            mDevice-&gt;SetRenderState(D3DRS_BLENDOP, gl_d3d9::ConvertBlendOp(blendState.blendEquationRGB));
+
+            if (blendState.sourceBlendRGB != blendState.sourceBlendAlpha ||
+                blendState.destBlendRGB != blendState.destBlendAlpha ||
+                blendState.blendEquationRGB != blendState.blendEquationAlpha)
+            {
+                mDevice-&gt;SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+
+                mDevice-&gt;SetRenderState(D3DRS_SRCBLENDALPHA, gl_d3d9::ConvertBlendFunc(blendState.sourceBlendAlpha));
+                mDevice-&gt;SetRenderState(D3DRS_DESTBLENDALPHA, gl_d3d9::ConvertBlendFunc(blendState.destBlendAlpha));
+                mDevice-&gt;SetRenderState(D3DRS_BLENDOPALPHA, gl_d3d9::ConvertBlendOp(blendState.blendEquationAlpha));
+            }
+            else
+            {
+                mDevice-&gt;SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, FALSE);
+            }
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+        }
+
+        if (blendState.sampleAlphaToCoverage)
+        {
+            FIXME(&quot;Sample alpha to coverage is unimplemented.&quot;);
+        }
+
+        const gl::FramebufferAttachment *attachment = framebuffer-&gt;getFirstColorbuffer();
+        GLenum internalFormat = attachment ? attachment-&gt;getInternalFormat() : GL_NONE;
+
+        // Set the color mask
+        bool zeroColorMaskAllowed = getVendorId() != VENDOR_ID_AMD;
+        // 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
+
+        const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalFormat);
+        DWORD colorMask = gl_d3d9::ConvertColorMask(formatInfo.redBits   &gt; 0 &amp;&amp; blendState.colorMaskRed,
+                                                    formatInfo.greenBits &gt; 0 &amp;&amp; blendState.colorMaskGreen,
+                                                    formatInfo.blueBits  &gt; 0 &amp;&amp; blendState.colorMaskBlue,
+                                                    formatInfo.alphaBits &gt; 0 &amp;&amp; blendState.colorMaskAlpha);
+        if (colorMask == 0 &amp;&amp; !zeroColorMaskAllowed)
+        {
+            // Enable green channel, but set blending so nothing will be drawn.
+            mDevice-&gt;SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_GREEN);
+            mDevice-&gt;SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
+
+            mDevice-&gt;SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ZERO);
+            mDevice-&gt;SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);
+            mDevice-&gt;SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_COLORWRITEENABLE, colorMask);
+        }
+
+        mDevice-&gt;SetRenderState(D3DRS_DITHERENABLE, blendState.dither ? TRUE : FALSE);
+
+        mCurBlendState = blendState;
+        mCurBlendColor = blendColor;
+    }
+
+    if (sampleMaskChanged)
+    {
+        // Set the multisample mask
+        mDevice-&gt;SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
+        mDevice-&gt;SetRenderState(D3DRS_MULTISAMPLEMASK, static_cast&lt;DWORD&gt;(sampleMask));
+
+        mCurSampleMask = sampleMask;
+    }
+
+    mForceSetBlendState = false;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::setDepthStencilState(const gl::DepthStencilState &amp;depthStencilState, int stencilRef,
+                                          int stencilBackRef, bool frontFaceCCW)
+{
+    bool depthStencilStateChanged = mForceSetDepthStencilState ||
+                                    memcmp(&amp;depthStencilState, &amp;mCurDepthStencilState, sizeof(gl::DepthStencilState)) != 0;
+    bool stencilRefChanged = mForceSetDepthStencilState || stencilRef != mCurStencilRef ||
+                             stencilBackRef != mCurStencilBackRef;
+    bool frontFaceCCWChanged = mForceSetDepthStencilState || frontFaceCCW != mCurFrontFaceCCW;
+
+    if (depthStencilStateChanged)
+    {
+        if (depthStencilState.depthTest)
+        {
+            mDevice-&gt;SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
+            mDevice-&gt;SetRenderState(D3DRS_ZFUNC, gl_d3d9::ConvertComparison(depthStencilState.depthFunc));
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
+        }
+
+        mCurDepthStencilState = depthStencilState;
+    }
+
+    if (depthStencilStateChanged || stencilRefChanged || frontFaceCCWChanged)
+    {
+        if (depthStencilState.stencilTest &amp;&amp; mCurStencilSize &gt; 0)
+        {
+            mDevice-&gt;SetRenderState(D3DRS_STENCILENABLE, TRUE);
+            mDevice-&gt;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;
+
+            ASSERT(depthStencilState.stencilWritemask == depthStencilState.stencilBackWritemask);
+            ASSERT(stencilRef == stencilBackRef);
+            ASSERT(depthStencilState.stencilMask == depthStencilState.stencilBackMask);
+
+            // get the maximum size of the stencil ref
+            unsigned int maxStencil = (1 &lt;&lt; mCurStencilSize) - 1;
+
+            mDevice-&gt;SetRenderState(frontFaceCCW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK,
+                                    depthStencilState.stencilWritemask);
+            mDevice-&gt;SetRenderState(frontFaceCCW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC,
+                                    gl_d3d9::ConvertComparison(depthStencilState.stencilFunc));
+
+            mDevice-&gt;SetRenderState(frontFaceCCW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF,
+                                    (stencilRef &lt; (int)maxStencil) ? stencilRef : maxStencil);
+            mDevice-&gt;SetRenderState(frontFaceCCW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK,
+                                    depthStencilState.stencilMask);
+
+            mDevice-&gt;SetRenderState(frontFaceCCW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL,
+                                    gl_d3d9::ConvertStencilOp(depthStencilState.stencilFail));
+            mDevice-&gt;SetRenderState(frontFaceCCW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL,
+                                    gl_d3d9::ConvertStencilOp(depthStencilState.stencilPassDepthFail));
+            mDevice-&gt;SetRenderState(frontFaceCCW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS,
+                                    gl_d3d9::ConvertStencilOp(depthStencilState.stencilPassDepthPass));
+
+            mDevice-&gt;SetRenderState(!frontFaceCCW ? D3DRS_STENCILWRITEMASK : D3DRS_CCW_STENCILWRITEMASK,
+                                    depthStencilState.stencilBackWritemask);
+            mDevice-&gt;SetRenderState(!frontFaceCCW ? D3DRS_STENCILFUNC : D3DRS_CCW_STENCILFUNC,
+                                    gl_d3d9::ConvertComparison(depthStencilState.stencilBackFunc));
+
+            mDevice-&gt;SetRenderState(!frontFaceCCW ? D3DRS_STENCILREF : D3DRS_CCW_STENCILREF,
+                                    (stencilBackRef &lt; (int)maxStencil) ? stencilBackRef : maxStencil);
+            mDevice-&gt;SetRenderState(!frontFaceCCW ? D3DRS_STENCILMASK : D3DRS_CCW_STENCILMASK,
+                                    depthStencilState.stencilBackMask);
+
+            mDevice-&gt;SetRenderState(!frontFaceCCW ? D3DRS_STENCILFAIL : D3DRS_CCW_STENCILFAIL,
+                                    gl_d3d9::ConvertStencilOp(depthStencilState.stencilBackFail));
+            mDevice-&gt;SetRenderState(!frontFaceCCW ? D3DRS_STENCILZFAIL : D3DRS_CCW_STENCILZFAIL,
+                                    gl_d3d9::ConvertStencilOp(depthStencilState.stencilBackPassDepthFail));
+            mDevice-&gt;SetRenderState(!frontFaceCCW ? D3DRS_STENCILPASS : D3DRS_CCW_STENCILPASS,
+                                    gl_d3d9::ConvertStencilOp(depthStencilState.stencilBackPassDepthPass));
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_STENCILENABLE, FALSE);
+        }
+
+        mDevice-&gt;SetRenderState(D3DRS_ZWRITEENABLE, depthStencilState.depthMask ? TRUE : FALSE);
+
+        mCurStencilRef = stencilRef;
+        mCurStencilBackRef = stencilBackRef;
+        mCurFrontFaceCCW = frontFaceCCW;
+    }
+
+    mForceSetDepthStencilState = false;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer9::setScissorRectangle(const gl::Rectangle &amp;scissor, bool enabled)
+{
+    bool scissorChanged = mForceSetScissor ||
+                          memcmp(&amp;scissor, &amp;mCurScissor, sizeof(gl::Rectangle)) != 0 ||
+                          enabled != mScissorEnabled;
+
+    if (scissorChanged)
+    {
+        if (enabled)
+        {
+            RECT rect;
+            rect.left = gl::clamp(scissor.x, 0, static_cast&lt;int&gt;(mRenderTargetDesc.width));
+            rect.top = gl::clamp(scissor.y, 0, static_cast&lt;int&gt;(mRenderTargetDesc.height));
+            rect.right = gl::clamp(scissor.x + scissor.width, 0, static_cast&lt;int&gt;(mRenderTargetDesc.width));
+            rect.bottom = gl::clamp(scissor.y + scissor.height, 0, static_cast&lt;int&gt;(mRenderTargetDesc.height));
+            mDevice-&gt;SetScissorRect(&amp;rect);
+        }
+
+        mDevice-&gt;SetRenderState(D3DRS_SCISSORTESTENABLE, enabled ? TRUE : FALSE);
+
+        mScissorEnabled = enabled;
+        mCurScissor = scissor;
+    }
+
+    mForceSetScissor = false;
+}
+
+void Renderer9::setViewport(const gl::Rectangle &amp;viewport, float zNear, float zFar, GLenum drawMode, GLenum frontFace,
+                            bool ignoreViewport)
+{
+    gl::Rectangle actualViewport = viewport;
+    float actualZNear = gl::clamp01(zNear);
+    float actualZFar = gl::clamp01(zFar);
+    if (ignoreViewport)
+    {
+        actualViewport.x = 0;
+        actualViewport.y = 0;
+        actualViewport.width = mRenderTargetDesc.width;
+        actualViewport.height = mRenderTargetDesc.height;
+        actualZNear = 0.0f;
+        actualZFar = 1.0f;
+    }
+
+    D3DVIEWPORT9 dxViewport;
+    dxViewport.X = gl::clamp(actualViewport.x, 0, static_cast&lt;int&gt;(mRenderTargetDesc.width));
+    dxViewport.Y = gl::clamp(actualViewport.y, 0, static_cast&lt;int&gt;(mRenderTargetDesc.height));
+    dxViewport.Width = gl::clamp(actualViewport.width, 0, static_cast&lt;int&gt;(mRenderTargetDesc.width) - static_cast&lt;int&gt;(dxViewport.X));
+    dxViewport.Height = gl::clamp(actualViewport.height, 0, static_cast&lt;int&gt;(mRenderTargetDesc.height) - static_cast&lt;int&gt;(dxViewport.Y));
+    dxViewport.MinZ = actualZNear;
+    dxViewport.MaxZ = actualZFar;
+
+    float depthFront = !gl::IsTriangleMode(drawMode) ? 0.0f : (frontFace == GL_CCW ? 1.0f : -1.0f);
+
+    bool viewportChanged = mForceSetViewport || memcmp(&amp;actualViewport, &amp;mCurViewport, sizeof(gl::Rectangle)) != 0 ||
+                           actualZNear != mCurNear || actualZFar != mCurFar || mCurDepthFront != depthFront;
+    if (viewportChanged)
+    {
+        mDevice-&gt;SetViewport(&amp;dxViewport);
+
+        mCurViewport = actualViewport;
+        mCurNear = actualZNear;
+        mCurFar = actualZFar;
+        mCurDepthFront = depthFront;
+
+        dx_VertexConstants vc = {0};
+        dx_PixelConstants pc = {0};
+
+        vc.viewAdjust[0] = (float)((actualViewport.width - (int)dxViewport.Width) + 2 * (actualViewport.x - (int)dxViewport.X) - 1) / dxViewport.Width;
+        vc.viewAdjust[1] = (float)((actualViewport.height - (int)dxViewport.Height) + 2 * (actualViewport.y - (int)dxViewport.Y) - 1) / dxViewport.Height;
+        vc.viewAdjust[2] = (float)actualViewport.width / dxViewport.Width;
+        vc.viewAdjust[3] = (float)actualViewport.height / dxViewport.Height;
+
+        pc.viewCoords[0] = actualViewport.width  * 0.5f;
+        pc.viewCoords[1] = actualViewport.height * 0.5f;
+        pc.viewCoords[2] = actualViewport.x + (actualViewport.width  * 0.5f);
+        pc.viewCoords[3] = actualViewport.y + (actualViewport.height * 0.5f);
+
+        pc.depthFront[0] = (actualZFar - actualZNear) * 0.5f;
+        pc.depthFront[1] = (actualZNear + actualZFar) * 0.5f;
+        pc.depthFront[2] = depthFront;
+
+        vc.depthRange[0] = actualZNear;
+        vc.depthRange[1] = actualZFar;
+        vc.depthRange[2] = actualZFar - actualZNear;
+
+        pc.depthRange[0] = actualZNear;
+        pc.depthRange[1] = actualZFar;
+        pc.depthRange[2] = actualZFar - actualZNear;
+
+        if (memcmp(&amp;vc, &amp;mVertexConstants, sizeof(dx_VertexConstants)) != 0)
+        {
+            mVertexConstants = vc;
+            mDxUniformsDirty = true;
+        }
+
+        if (memcmp(&amp;pc, &amp;mPixelConstants, sizeof(dx_PixelConstants)) != 0)
+        {
+            mPixelConstants = pc;
+            mDxUniformsDirty = true;
+        }
+    }
+
+    mForceSetViewport = false;
+}
+
+bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize)
+{
+    switch (mode)
+    {
+      case GL_POINTS:
+        mPrimitiveType = D3DPT_POINTLIST;
+        mPrimitiveCount = count;
+        break;
+      case GL_LINES:
+        mPrimitiveType = D3DPT_LINELIST;
+        mPrimitiveCount = count / 2;
+        break;
+      case GL_LINE_LOOP:
+        mPrimitiveType = D3DPT_LINESTRIP;
+        mPrimitiveCount = count - 1;   // D3D doesn't support line loops, so we draw the last line separately
+        break;
+      case GL_LINE_STRIP:
+        mPrimitiveType = D3DPT_LINESTRIP;
+        mPrimitiveCount = count - 1;
+        break;
+      case GL_TRIANGLES:
+        mPrimitiveType = D3DPT_TRIANGLELIST;
+        mPrimitiveCount = count / 3;
+        break;
+      case GL_TRIANGLE_STRIP:
+        mPrimitiveType = D3DPT_TRIANGLESTRIP;
+        mPrimitiveCount = count - 2;
+        break;
+      case GL_TRIANGLE_FAN:
+        mPrimitiveType = D3DPT_TRIANGLEFAN;
+        mPrimitiveCount = count - 2;
+        break;
+      default:
+        UNREACHABLE();
+        return false;
+    }
+
+    return mPrimitiveCount &gt; 0;
+}
+
+
+gl::Error Renderer9::getNullColorbuffer(const gl::FramebufferAttachment *depthbuffer, const gl::FramebufferAttachment **outColorBuffer)
+{
+    ASSERT(depthbuffer);
+
+    GLsizei width  = depthbuffer-&gt;getWidth();
+    GLsizei height = depthbuffer-&gt;getHeight();
+
+    // search cached nullcolorbuffers
+    for (int i = 0; i &lt; NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+    {
+        if (mNullColorbufferCache[i].buffer != NULL &amp;&amp;
+            mNullColorbufferCache[i].width == width &amp;&amp;
+            mNullColorbufferCache[i].height == height)
+        {
+            mNullColorbufferCache[i].lruCount = ++mMaxNullColorbufferLRU;
+            *outColorBuffer = mNullColorbufferCache[i].buffer;
+            return gl::Error(GL_NO_ERROR);
+        }
+    }
+
+    gl::Renderbuffer *nullRenderbuffer = new gl::Renderbuffer(createRenderbuffer(), 0);
+    gl::Error error = nullRenderbuffer-&gt;setStorage(GL_NONE, width, height);
+    if (error.isError())
+    {
+        SafeDelete(nullRenderbuffer);
+        return error;
+    }
+
+    gl::FramebufferAttachment *nullbuffer = new gl::FramebufferAttachment(GL_RENDERBUFFER, GL_NONE, gl::ImageIndex::MakeInvalid(), nullRenderbuffer);
+
+    // add nullbuffer to the cache
+    NullColorbufferCacheEntry *oldest = &amp;mNullColorbufferCache[0];
+    for (int i = 1; i &lt; NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+    {
+        if (mNullColorbufferCache[i].lruCount &lt; oldest-&gt;lruCount)
+        {
+            oldest = &amp;mNullColorbufferCache[i];
+        }
+    }
+
+    delete oldest-&gt;buffer;
+    oldest-&gt;buffer = nullbuffer;
+    oldest-&gt;lruCount = ++mMaxNullColorbufferLRU;
+    oldest-&gt;width = width;
+    oldest-&gt;height = height;
+
+    *outColorBuffer = nullbuffer;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::applyRenderTarget(const gl::FramebufferAttachment *colorAttachment,
+                                       const gl::FramebufferAttachment *depthStencilAttachment)
+{
+    const gl::FramebufferAttachment *renderAttachment = colorAttachment;
+
+    // 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.
+    if (renderAttachment == nullptr)
+    {
+        gl::Error error = getNullColorbuffer(depthStencilAttachment, &amp;renderAttachment);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+    ASSERT(renderAttachment != nullptr);
+
+    size_t renderTargetWidth = 0;
+    size_t renderTargetHeight = 0;
+    D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN;
+
+    bool renderTargetChanged = false;
+    unsigned int renderTargetSerial = GetAttachmentSerial(renderAttachment);
+    if (renderTargetSerial != mAppliedRenderTargetSerial)
+    {
+        // Apply the render target on the device
+        RenderTarget9 *renderTarget = nullptr;
+        gl::Error error = renderAttachment-&gt;getRenderTarget(&amp;renderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+        ASSERT(renderTarget);
+
+        IDirect3DSurface9 *renderTargetSurface = renderTarget-&gt;getSurface();
+        ASSERT(renderTargetSurface);
+
+        mDevice-&gt;SetRenderTarget(0, renderTargetSurface);
+        SafeRelease(renderTargetSurface);
+
+        renderTargetWidth = renderTarget-&gt;getWidth();
+        renderTargetHeight = renderTarget-&gt;getHeight();
+        renderTargetFormat = renderTarget-&gt;getD3DFormat();
+
+        mAppliedRenderTargetSerial = renderTargetSerial;
+        renderTargetChanged = true;
+    }
+
+    unsigned int depthStencilSerial = (depthStencilAttachment != nullptr) ?
+                                       GetAttachmentSerial(depthStencilAttachment) : 0;
+    if (depthStencilSerial != mAppliedDepthStencilSerial || !mDepthStencilInitialized)
+    {
+        unsigned int depthSize = 0;
+        unsigned int stencilSize = 0;
+
+        // Apply the depth stencil on the device
+        if (depthStencilAttachment)
+        {
+            RenderTarget9 *depthStencilRenderTarget = nullptr;
+            gl::Error error = depthStencilAttachment-&gt;getRenderTarget(&amp;depthStencilRenderTarget);
+            if (error.isError())
+            {
+                return error;
+            }
+            ASSERT(depthStencilRenderTarget);
+
+            IDirect3DSurface9 *depthStencilSurface = depthStencilRenderTarget-&gt;getSurface();
+            ASSERT(depthStencilSurface);
+
+            mDevice-&gt;SetDepthStencilSurface(depthStencilSurface);
+            SafeRelease(depthStencilSurface);
+
+            depthSize = depthStencilAttachment-&gt;getDepthSize();
+            stencilSize = depthStencilAttachment-&gt;getStencilSize();
+        }
+        else
+        {
+            mDevice-&gt;SetDepthStencilSurface(NULL);
+        }
+
+        if (!mDepthStencilInitialized || depthSize != mCurDepthSize)
+        {
+            mCurDepthSize = depthSize;
+            mForceSetRasterState = true;
+        }
+
+        if (!mDepthStencilInitialized || stencilSize != mCurStencilSize)
+        {
+            mCurStencilSize = stencilSize;
+            mForceSetDepthStencilState = true;
+        }
+
+        mAppliedDepthStencilSerial = depthStencilSerial;
+        mDepthStencilInitialized = true;
+    }
+
+    if (renderTargetChanged || !mRenderTargetDescInitialized)
+    {
+        mForceSetScissor = true;
+        mForceSetViewport = true;
+        mForceSetBlendState = true;
+
+        mRenderTargetDesc.width = renderTargetWidth;
+        mRenderTargetDesc.height = renderTargetHeight;
+        mRenderTargetDesc.format = renderTargetFormat;
+        mRenderTargetDescInitialized = true;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::applyRenderTarget(const gl::Framebuffer *framebuffer)
+{
+    return applyRenderTarget(framebuffer-&gt;getColorbuffer(0), framebuffer-&gt;getDepthOrStencilbuffer());
+}
+
+gl::Error Renderer9::applyVertexBuffer(const gl::State &amp;state, GLenum mode, GLint first, GLsizei count, GLsizei instances)
+{
+    TranslatedAttribute attributes[gl::MAX_VERTEX_ATTRIBS];
+    gl::Error error = mVertexDataManager-&gt;prepareVertexData(state, first, count, attributes, instances);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    return mVertexDeclarationCache.applyDeclaration(mDevice, attributes, state.getProgram(), instances, &amp;mRepeatDraw);
+}
+
+// Applies the indices and element array bindings to the Direct3D 9 device
+gl::Error Renderer9::applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
+{
+    gl::Error error = mIndexDataManager-&gt;prepareIndexData(type, count, elementArrayBuffer, indices, indexInfo);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // Directly binding the storage buffer is not supported for d3d9
+    ASSERT(indexInfo-&gt;storage == NULL);
+
+    if (indexInfo-&gt;serial != mAppliedIBSerial)
+    {
+        IndexBuffer9* indexBuffer = GetAs&lt;IndexBuffer9&gt;(indexInfo-&gt;indexBuffer);
+
+        mDevice-&gt;SetIndices(indexBuffer-&gt;getBuffer());
+        mAppliedIBSerial = indexInfo-&gt;serial;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer9::applyTransformFeedbackBuffers(const gl::State&amp; state)
+{
+    ASSERT(!state.isTransformFeedbackActiveUnpaused());
+}
+
+gl::Error Renderer9::drawArrays(const gl::Data &amp;data, GLenum mode, GLsizei count, GLsizei instances, bool usesPointSize)
+{
+    ASSERT(!data.state-&gt;isTransformFeedbackActiveUnpaused());
+
+    startScene();
+
+    if (mode == GL_LINE_LOOP)
+    {
+        return drawLineLoop(count, GL_NONE, NULL, 0, NULL);
+    }
+    else if (instances &gt; 0)
+    {
+        StaticIndexBufferInterface *countingIB = NULL;
+        gl::Error error = getCountingIB(count, &amp;countingIB);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        if (mAppliedIBSerial != countingIB-&gt;getSerial())
+        {
+            IndexBuffer9 *indexBuffer = GetAs&lt;IndexBuffer9&gt;(countingIB-&gt;getIndexBuffer());
+
+            mDevice-&gt;SetIndices(indexBuffer-&gt;getBuffer());
+            mAppliedIBSerial = countingIB-&gt;getSerial();
+        }
+
+        for (int i = 0; i &lt; mRepeatDraw; i++)
+        {
+            mDevice-&gt;DrawIndexedPrimitive(mPrimitiveType, 0, 0, count, 0, mPrimitiveCount);
+        }
+
+        return gl::Error(GL_NO_ERROR);
+    }
+    else   // Regular case
+    {
+        mDevice-&gt;DrawPrimitive(mPrimitiveType, 0, mPrimitiveCount);
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+                                  gl::Buffer *elementArrayBuffer, const TranslatedIndexData &amp;indexInfo, GLsizei /*instances*/)
+{
+    startScene();
+
+    int minIndex = static_cast&lt;int&gt;(indexInfo.indexRange.start);
+
+    if (mode == GL_POINTS)
+    {
+        return drawIndexedPoints(count, type, indices, minIndex, elementArrayBuffer);
+    }
+    else if (mode == GL_LINE_LOOP)
+    {
+        return drawLineLoop(count, type, indices, minIndex, elementArrayBuffer);
+    }
+    else
+    {
+        for (int i = 0; i &lt; mRepeatDraw; i++)
+        {
+            GLsizei vertexCount = static_cast&lt;int&gt;(indexInfo.indexRange.length()) + 1;
+            mDevice-&gt;DrawIndexedPrimitive(mPrimitiveType, -minIndex, minIndex, vertexCount, indexInfo.startIndex, mPrimitiveCount);
+        }
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
+{
+    // Get the raw indices for an indexed draw
+    if (type != GL_NONE &amp;&amp; elementArrayBuffer)
+    {
+        BufferD3D *storage = GetImplAs&lt;BufferD3D&gt;(elementArrayBuffer);
+        intptr_t offset = reinterpret_cast&lt;intptr_t&gt;(indices);
+        const uint8_t *bufferData = NULL;
+        gl::Error error = storage-&gt;getData(&amp;bufferData);
+        if (error.isError())
+        {
+            return error;
+        }
+        indices = bufferData + offset;
+    }
+
+    unsigned int startIndex = 0;
+
+    if (getRendererExtensions().elementIndexUint)
+    {
+        if (!mLineLoopIB)
+        {
+            mLineLoopIB = new StreamingIndexBufferInterface(this);
+            gl::Error error = mLineLoopIB-&gt;reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
+            if (error.isError())
+            {
+                SafeDelete(mLineLoopIB);
+                return error;
+            }
+        }
+
+        // Checked by Renderer9::applyPrimitiveType
+        ASSERT(count &gt;= 0);
+
+        if (static_cast&lt;unsigned int&gt;(count) + 1 &gt; (std::numeric_limits&lt;unsigned int&gt;::max() / sizeof(unsigned int)))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required.&quot;);
+        }
+
+        const unsigned int spaceNeeded = (static_cast&lt;unsigned int&gt;(count)+1) * sizeof(unsigned int);
+        gl::Error error = mLineLoopIB-&gt;reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        void* mappedMemory = NULL;
+        unsigned int offset = 0;
+        error = mLineLoopIB-&gt;mapBuffer(spaceNeeded, &amp;mappedMemory, &amp;offset);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        startIndex = static_cast&lt;unsigned int&gt;(offset) / 4;
+        unsigned int *data = reinterpret_cast&lt;unsigned int*&gt;(mappedMemory);
+
+        switch (type)
+        {
+          case GL_NONE:   // Non-indexed draw
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = i;
+            }
+            data[count] = 0;
+            break;
+          case GL_UNSIGNED_BYTE:
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;const GLubyte*&gt;(indices)[i];
+            }
+            data[count] = static_cast&lt;const GLubyte*&gt;(indices)[0];
+            break;
+          case GL_UNSIGNED_SHORT:
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;const GLushort*&gt;(indices)[i];
+            }
+            data[count] = static_cast&lt;const GLushort*&gt;(indices)[0];
+            break;
+          case GL_UNSIGNED_INT:
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;const GLuint*&gt;(indices)[i];
+            }
+            data[count] = static_cast&lt;const GLuint*&gt;(indices)[0];
+            break;
+          default: UNREACHABLE();
+        }
+
+        error = mLineLoopIB-&gt;unmapBuffer();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+    else
+    {
+        if (!mLineLoopIB)
+        {
+            mLineLoopIB = new StreamingIndexBufferInterface(this);
+            gl::Error error = mLineLoopIB-&gt;reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_SHORT);
+            if (error.isError())
+            {
+                SafeDelete(mLineLoopIB);
+                return error;
+            }
+        }
+
+        // Checked by Renderer9::applyPrimitiveType
+        ASSERT(count &gt;= 0);
+
+        if (static_cast&lt;unsigned int&gt;(count) + 1 &gt; (std::numeric_limits&lt;unsigned short&gt;::max() / sizeof(unsigned short)))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create a 16-bit looping index buffer for GL_LINE_LOOP, too many indices required.&quot;);
+        }
+
+        const unsigned int spaceNeeded = (static_cast&lt;unsigned int&gt;(count) + 1) * sizeof(unsigned short);
+        gl::Error error = mLineLoopIB-&gt;reserveBufferSpace(spaceNeeded, GL_UNSIGNED_SHORT);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        void* mappedMemory = NULL;
+        unsigned int offset;
+        error = mLineLoopIB-&gt;mapBuffer(spaceNeeded, &amp;mappedMemory, &amp;offset);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        startIndex = static_cast&lt;unsigned int&gt;(offset) / 2;
+        unsigned short *data = reinterpret_cast&lt;unsigned short*&gt;(mappedMemory);
+
+        switch (type)
+        {
+          case GL_NONE:   // Non-indexed draw
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;unsigned short&gt;(i);
+            }
+            data[count] = 0;
+            break;
+          case GL_UNSIGNED_BYTE:
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;const GLubyte*&gt;(indices)[i];
+            }
+            data[count] = static_cast&lt;const GLubyte*&gt;(indices)[0];
+            break;
+          case GL_UNSIGNED_SHORT:
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;const GLushort*&gt;(indices)[i];
+            }
+            data[count] = static_cast&lt;const GLushort*&gt;(indices)[0];
+            break;
+          case GL_UNSIGNED_INT:
+            for (int i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;unsigned short&gt;(static_cast&lt;const GLuint*&gt;(indices)[i]);
+            }
+            data[count] = static_cast&lt;unsigned short&gt;(static_cast&lt;const GLuint*&gt;(indices)[0]);
+            break;
+          default: UNREACHABLE();
+        }
+
+        error = mLineLoopIB-&gt;unmapBuffer();
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    if (mAppliedIBSerial != mLineLoopIB-&gt;getSerial())
+    {
+        IndexBuffer9 *indexBuffer = GetAs&lt;IndexBuffer9&gt;(mLineLoopIB-&gt;getIndexBuffer());
+
+        mDevice-&gt;SetIndices(indexBuffer-&gt;getBuffer());
+        mAppliedIBSerial = mLineLoopIB-&gt;getSerial();
+    }
+
+    mDevice-&gt;DrawIndexedPrimitive(D3DPT_LINESTRIP, -minIndex, minIndex, count, startIndex, count);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+template &lt;typename T&gt;
+static gl::Error drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices, int minIndex)
+{
+    for (int i = 0; i &lt; count; i++)
+    {
+        unsigned int indexValue = static_cast&lt;unsigned int&gt;(static_cast&lt;const T*&gt;(indices)[i]) - minIndex;
+        device-&gt;DrawPrimitive(D3DPT_POINTLIST, indexValue, 1);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
+{
+    // Drawing index point lists is unsupported in d3d9, fall back to a regular DrawPrimitive call
+    // for each individual point. This call is not expected to happen often.
+
+    if (elementArrayBuffer)
+    {
+        BufferD3D *storage = GetImplAs&lt;BufferD3D&gt;(elementArrayBuffer);
+        intptr_t offset = reinterpret_cast&lt;intptr_t&gt;(indices);
+
+        const uint8_t *bufferData = NULL;
+        gl::Error error = storage-&gt;getData(&amp;bufferData);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        indices = bufferData + offset;
+    }
+
+    switch (type)
+    {
+        case GL_UNSIGNED_BYTE:  return drawPoints&lt;GLubyte&gt;(mDevice, count, indices, minIndex);
+        case GL_UNSIGNED_SHORT: return drawPoints&lt;GLushort&gt;(mDevice, count, indices, minIndex);
+        case GL_UNSIGNED_INT:   return drawPoints&lt;GLuint&gt;(mDevice, count, indices, minIndex);
+        default: UNREACHABLE(); return gl::Error(GL_INVALID_OPERATION);
+    }
+}
+
+gl::Error Renderer9::getCountingIB(size_t count, StaticIndexBufferInterface **outIB)
+{
+    // Update the counting index buffer if it is not large enough or has not been created yet.
+    if (count &lt;= 65536)   // 16-bit indices
+    {
+        const unsigned int spaceNeeded = count * sizeof(unsigned short);
+
+        if (!mCountingIB || mCountingIB-&gt;getBufferSize() &lt; spaceNeeded)
+        {
+            SafeDelete(mCountingIB);
+            mCountingIB = new StaticIndexBufferInterface(this);
+            mCountingIB-&gt;reserveBufferSpace(spaceNeeded, GL_UNSIGNED_SHORT);
+
+            void *mappedMemory = NULL;
+            gl::Error error = mCountingIB-&gt;mapBuffer(spaceNeeded, &amp;mappedMemory, NULL);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            unsigned short *data = reinterpret_cast&lt;unsigned short*&gt;(mappedMemory);
+            for (size_t i = 0; i &lt; count; i++)
+            {
+                data[i] = static_cast&lt;unsigned short&gt;(i);
+            }
+
+            error = mCountingIB-&gt;unmapBuffer();
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+    else if (getRendererExtensions().elementIndexUint)
+    {
+        const unsigned int spaceNeeded = count * sizeof(unsigned int);
+
+        if (!mCountingIB || mCountingIB-&gt;getBufferSize() &lt; spaceNeeded)
+        {
+            SafeDelete(mCountingIB);
+            mCountingIB = new StaticIndexBufferInterface(this);
+            mCountingIB-&gt;reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
+
+            void *mappedMemory = NULL;
+            gl::Error error = mCountingIB-&gt;mapBuffer(spaceNeeded, &amp;mappedMemory, NULL);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            unsigned int *data = reinterpret_cast&lt;unsigned int*&gt;(mappedMemory);
+            for (size_t i = 0; i &lt; count; i++)
+            {
+                data[i] = i;
+            }
+
+            error = mCountingIB-&gt;unmapBuffer();
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+    else
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Could not create a counting index buffer for glDrawArraysInstanced.&quot;);
+    }
+
+    *outIB = mCountingIB;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::applyShaders(gl::Program *program, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
+                                  bool rasterizerDiscard, bool transformFeedbackActive)
+{
+    ASSERT(!transformFeedbackActive);
+    ASSERT(!rasterizerDiscard);
+
+    ProgramD3D *programD3D = GetImplAs&lt;ProgramD3D&gt;(program);
+
+    ShaderExecutableD3D *vertexExe = NULL;
+    gl::Error error = programD3D-&gt;getVertexExecutableForInputLayout(inputLayout, &amp;vertexExe, nullptr);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    ShaderExecutableD3D *pixelExe = NULL;
+    error = programD3D-&gt;getPixelExecutableForFramebuffer(framebuffer, &amp;pixelExe);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DVertexShader9 *vertexShader = (vertexExe ? GetAs&lt;ShaderExecutable9&gt;(vertexExe)-&gt;getVertexShader() : nullptr);
+    IDirect3DPixelShader9 *pixelShader = (pixelExe ? GetAs&lt;ShaderExecutable9&gt;(pixelExe)-&gt;getPixelShader() : nullptr);
+
+    if (vertexShader != mAppliedVertexShader)
+    {
+        mDevice-&gt;SetVertexShader(vertexShader);
+        mAppliedVertexShader = vertexShader;
+    }
+
+    if (pixelShader != mAppliedPixelShader)
+    {
+        mDevice-&gt;SetPixelShader(pixelShader);
+        mAppliedPixelShader = pixelShader;
+    }
+
+    // D3D9 has a quirk where creating multiple shaders with the same content
+    // can return the same shader pointer. Because GL programs store different data
+    // per-program, checking the program serial guarantees we upload fresh
+    // uniform data even if our shader pointers are the same.
+    // https://code.google.com/p/angleproject/issues/detail?id=661
+    unsigned int programSerial = programD3D-&gt;getSerial();
+    if (programSerial != mAppliedProgramSerial)
+    {
+        programD3D-&gt;dirtyAllUniforms();
+        mDxUniformsDirty = true;
+        mAppliedProgramSerial = programSerial;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::applyUniforms(const ProgramImpl &amp;program, const std::vector&lt;gl::LinkedUniform*&gt; &amp;uniformArray)
+{
+    for (size_t uniformIndex = 0; uniformIndex &lt; uniformArray.size(); uniformIndex++)
+    {
+        gl::LinkedUniform *targetUniform = uniformArray[uniformIndex];
+
+        if (targetUniform-&gt;dirty)
+        {
+            GLfloat *f = (GLfloat*)targetUniform-&gt;data;
+            GLint *i = (GLint*)targetUniform-&gt;data;
+
+            switch (targetUniform-&gt;type)
+            {
+              case GL_SAMPLER_2D:
+              case GL_SAMPLER_CUBE:
+                break;
+              case GL_BOOL:
+              case GL_BOOL_VEC2:
+              case GL_BOOL_VEC3:
+              case GL_BOOL_VEC4:
+                applyUniformnbv(targetUniform, i);
+                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_INT:
+              case GL_INT_VEC2:
+              case GL_INT_VEC3:
+              case GL_INT_VEC4:
+                applyUniformniv(targetUniform, i);
+                break;
+              default:
+                UNREACHABLE();
+            }
+        }
+    }
+
+    // Driver uniforms
+    if (mDxUniformsDirty)
+    {
+        mDevice-&gt;SetVertexShaderConstantF(0, (float*)&amp;mVertexConstants, sizeof(dx_VertexConstants) / sizeof(float[4]));
+        mDevice-&gt;SetPixelShaderConstantF(0, (float*)&amp;mPixelConstants, sizeof(dx_PixelConstants) / sizeof(float[4]));
+        mDxUniformsDirty = false;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer9::applyUniformnfv(gl::LinkedUniform *targetUniform, const GLfloat *v)
+{
+    if (targetUniform-&gt;isReferencedByFragmentShader())
+    {
+        mDevice-&gt;SetPixelShaderConstantF(targetUniform-&gt;psRegisterIndex, v, targetUniform-&gt;registerCount);
+    }
+
+    if (targetUniform-&gt;isReferencedByVertexShader())
+    {
+        mDevice-&gt;SetVertexShaderConstantF(targetUniform-&gt;vsRegisterIndex, v, targetUniform-&gt;registerCount);
+    }
+}
+
+void Renderer9::applyUniformniv(gl::LinkedUniform *targetUniform, const GLint *v)
+{
+    ASSERT(targetUniform-&gt;registerCount &lt;= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
+    GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
+
+    for (unsigned int i = 0; i &lt; targetUniform-&gt;registerCount; i++)
+    {
+        vector[i][0] = (GLfloat)v[4 * i + 0];
+        vector[i][1] = (GLfloat)v[4 * i + 1];
+        vector[i][2] = (GLfloat)v[4 * i + 2];
+        vector[i][3] = (GLfloat)v[4 * i + 3];
+    }
+
+    applyUniformnfv(targetUniform, (GLfloat*)vector);
+}
+
+void Renderer9::applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v)
+{
+    ASSERT(targetUniform-&gt;registerCount &lt;= MAX_VERTEX_CONSTANT_VECTORS_D3D9);
+    GLfloat vector[MAX_VERTEX_CONSTANT_VECTORS_D3D9][4];
+
+    for (unsigned int i = 0; i &lt; targetUniform-&gt;registerCount; i++)
+    {
+        vector[i][0] = (v[4 * i + 0] == GL_FALSE) ? 0.0f : 1.0f;
+        vector[i][1] = (v[4 * i + 1] == GL_FALSE) ? 0.0f : 1.0f;
+        vector[i][2] = (v[4 * i + 2] == GL_FALSE) ? 0.0f : 1.0f;
+        vector[i][3] = (v[4 * i + 3] == GL_FALSE) ? 0.0f : 1.0f;
+    }
+
+    applyUniformnfv(targetUniform, (GLfloat*)vector);
+}
+
+gl::Error Renderer9::clear(const ClearParameters &amp;clearParams,
+                           const gl::FramebufferAttachment *colorBuffer,
+                           const gl::FramebufferAttachment *depthStencilBuffer)
+{
+    if (clearParams.colorClearType != GL_FLOAT)
+    {
+        // Clearing buffers with non-float values is not supported by Renderer9 and ES 2.0
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION);
+    }
+
+    bool clearColor = clearParams.clearColor[0];
+    for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
+    {
+        if (clearParams.clearColor[i] != clearColor)
+        {
+            // Clearing individual buffers other than buffer zero is not supported by Renderer9 and ES 2.0
+            UNREACHABLE();
+            return gl::Error(GL_INVALID_OPERATION);
+        }
+    }
+
+    float depth = gl::clamp01(clearParams.depthClearValue);
+    DWORD stencil = clearParams.stencilClearValue &amp; 0x000000FF;
+
+    unsigned int stencilUnmasked = 0x0;
+    if (clearParams.clearStencil &amp;&amp; depthStencilBuffer-&gt;getStencilSize() &gt; 0)
+    {
+        ASSERT(depthStencilBuffer != nullptr);
+
+        RenderTargetD3D *stencilRenderTarget = nullptr;
+        gl::Error error = depthStencilBuffer-&gt;getRenderTarget(&amp;stencilRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        RenderTarget9 *stencilRenderTarget9 = GetAs&lt;RenderTarget9&gt;(stencilRenderTarget);
+        ASSERT(stencilRenderTarget9);
+
+        const d3d9::D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(stencilRenderTarget9-&gt;getD3DFormat());
+        stencilUnmasked = (0x1 &lt;&lt; d3dFormatInfo.stencilBits) - 1;
+    }
+
+    const bool needMaskedStencilClear = clearParams.clearStencil &amp;&amp;
+                                        (clearParams.stencilWriteMask &amp; stencilUnmasked) != stencilUnmasked;
+
+    bool needMaskedColorClear = false;
+    D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0);
+    if (clearColor)
+    {
+        ASSERT(colorBuffer != nullptr);
+
+        RenderTargetD3D *colorRenderTarget = NULL;
+        gl::Error error = colorBuffer-&gt;getRenderTarget(&amp;colorRenderTarget);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        RenderTarget9 *colorRenderTarget9 = GetAs&lt;RenderTarget9&gt;(colorRenderTarget);
+        ASSERT(colorRenderTarget9);
+
+        const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(colorBuffer-&gt;getInternalFormat());
+        const d3d9::D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(colorRenderTarget9-&gt;getD3DFormat());
+
+        color = D3DCOLOR_ARGB(gl::unorm&lt;8&gt;((formatInfo.alphaBits == 0 &amp;&amp; d3dFormatInfo.alphaBits &gt; 0) ? 1.0f : clearParams.colorFClearValue.alpha),
+                              gl::unorm&lt;8&gt;((formatInfo.redBits   == 0 &amp;&amp; d3dFormatInfo.redBits   &gt; 0) ? 0.0f : clearParams.colorFClearValue.red),
+                              gl::unorm&lt;8&gt;((formatInfo.greenBits == 0 &amp;&amp; d3dFormatInfo.greenBits &gt; 0) ? 0.0f : clearParams.colorFClearValue.green),
+                              gl::unorm&lt;8&gt;((formatInfo.blueBits  == 0 &amp;&amp; d3dFormatInfo.blueBits  &gt; 0) ? 0.0f : clearParams.colorFClearValue.blue));
+
+        if ((formatInfo.redBits   &gt; 0 &amp;&amp; !clearParams.colorMaskRed) ||
+            (formatInfo.greenBits &gt; 0 &amp;&amp; !clearParams.colorMaskGreen) ||
+            (formatInfo.blueBits  &gt; 0 &amp;&amp; !clearParams.colorMaskBlue) ||
+            (formatInfo.alphaBits &gt; 0 &amp;&amp; !clearParams.colorMaskAlpha))
+        {
+            needMaskedColorClear = true;
+        }
+    }
+
+    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-&gt;BeginStateBlock();
+            ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+
+            mDevice-&gt;SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
+            mDevice-&gt;SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
+            mDevice-&gt;SetRenderState(D3DRS_ZENABLE, FALSE);
+            mDevice-&gt;SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+            mDevice-&gt;SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+            mDevice-&gt;SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+            mDevice-&gt;SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+            mDevice-&gt;SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+            mDevice-&gt;SetRenderState(D3DRS_COLORWRITEENABLE, 0);
+            mDevice-&gt;SetRenderState(D3DRS_STENCILENABLE, FALSE);
+            mDevice-&gt;SetPixelShader(NULL);
+            mDevice-&gt;SetVertexShader(NULL);
+            mDevice-&gt;SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);
+            mDevice-&gt;SetStreamSource(0, NULL, 0, 0);
+            mDevice-&gt;SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+            mDevice-&gt;SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+            mDevice-&gt;SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
+            mDevice-&gt;SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
+            mDevice-&gt;SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
+            mDevice-&gt;SetRenderState(D3DRS_TEXTUREFACTOR, color);
+            mDevice-&gt;SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
+
+            for(int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+            {
+                mDevice-&gt;SetStreamSourceFreq(i, 1);
+            }
+
+            hr = mDevice-&gt;EndStateBlock(&amp;mMaskedClearSavedState);
+            ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
+        }
+
+        ASSERT(mMaskedClearSavedState != NULL);
+
+        if (mMaskedClearSavedState != NULL)
+        {
+            hr = mMaskedClearSavedState-&gt;Capture();
+            ASSERT(SUCCEEDED(hr));
+        }
+
+        mDevice-&gt;SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
+        mDevice-&gt;SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
+        mDevice-&gt;SetRenderState(D3DRS_ZENABLE, FALSE);
+        mDevice-&gt;SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+        mDevice-&gt;SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+        mDevice-&gt;SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+        mDevice-&gt;SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+        mDevice-&gt;SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+
+        if (clearColor)
+        {
+            mDevice-&gt;SetRenderState(D3DRS_COLORWRITEENABLE,
+                                    gl_d3d9::ConvertColorMask(clearParams.colorMaskRed,
+                                                              clearParams.colorMaskGreen,
+                                                              clearParams.colorMaskBlue,
+                                                              clearParams.colorMaskAlpha));
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_COLORWRITEENABLE, 0);
+        }
+
+        if (stencilUnmasked != 0x0 &amp;&amp; clearParams.clearStencil)
+        {
+            mDevice-&gt;SetRenderState(D3DRS_STENCILENABLE, TRUE);
+            mDevice-&gt;SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, FALSE);
+            mDevice-&gt;SetRenderState(D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
+            mDevice-&gt;SetRenderState(D3DRS_STENCILREF, stencil);
+            mDevice-&gt;SetRenderState(D3DRS_STENCILWRITEMASK, clearParams.stencilWriteMask);
+            mDevice-&gt;SetRenderState(D3DRS_STENCILFAIL, D3DSTENCILOP_REPLACE);
+            mDevice-&gt;SetRenderState(D3DRS_STENCILZFAIL, D3DSTENCILOP_REPLACE);
+            mDevice-&gt;SetRenderState(D3DRS_STENCILPASS, D3DSTENCILOP_REPLACE);
+        }
+        else
+        {
+            mDevice-&gt;SetRenderState(D3DRS_STENCILENABLE, FALSE);
+        }
+
+        mDevice-&gt;SetPixelShader(NULL);
+        mDevice-&gt;SetVertexShader(NULL);
+        mDevice-&gt;SetFVF(D3DFVF_XYZRHW);
+        mDevice-&gt;SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
+        mDevice-&gt;SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+        mDevice-&gt;SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
+        mDevice-&gt;SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
+        mDevice-&gt;SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
+        mDevice-&gt;SetRenderState(D3DRS_TEXTUREFACTOR, color);
+        mDevice-&gt;SetRenderState(D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
+
+        for(int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+        {
+            mDevice-&gt;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;
+
+        startScene();
+        mDevice-&gt;DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, quad, sizeof(float[4]));
+
+        if (clearParams.clearDepth)
+        {
+            mDevice-&gt;SetRenderState(D3DRS_ZENABLE, TRUE);
+            mDevice-&gt;SetRenderState(D3DRS_ZWRITEENABLE, TRUE);
+            mDevice-&gt;Clear(0, NULL, D3DCLEAR_ZBUFFER, color, depth, stencil);
+        }
+
+        if (mMaskedClearSavedState != NULL)
+        {
+            mMaskedClearSavedState-&gt;Apply();
+        }
+    }
+    else if (clearColor || clearParams.clearDepth || clearParams.clearStencil)
+    {
+        DWORD dxClearFlags = 0;
+        if (clearColor)
+        {
+            dxClearFlags |= D3DCLEAR_TARGET;
+        }
+        if (clearParams.clearDepth)
+        {
+            dxClearFlags |= D3DCLEAR_ZBUFFER;
+        }
+        if (clearParams.clearStencil)
+        {
+            dxClearFlags |= D3DCLEAR_STENCIL;
+        }
+
+        mDevice-&gt;Clear(0, NULL, dxClearFlags, color, depth, stencil);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void Renderer9::markAllStateDirty()
+{
+    mAppliedRenderTargetSerial = 0;
+    mAppliedDepthStencilSerial = 0;
+    mDepthStencilInitialized = false;
+    mRenderTargetDescInitialized = false;
+
+    mForceSetDepthStencilState = true;
+    mForceSetRasterState = true;
+    mForceSetScissor = true;
+    mForceSetViewport = true;
+    mForceSetBlendState = true;
+
+    ASSERT(mForceSetVertexSamplerStates.size() == mCurVertexTextureSerials.size());
+    for (unsigned int i = 0; i &lt; mForceSetVertexSamplerStates.size(); i++)
+    {
+        mForceSetVertexSamplerStates[i] = true;
+        mCurVertexTextureSerials[i] = 0;
+    }
+
+    ASSERT(mForceSetPixelSamplerStates.size() == mCurPixelTextureSerials.size());
+    for (unsigned int i = 0; i &lt; mForceSetPixelSamplerStates.size(); i++)
+    {
+        mForceSetPixelSamplerStates[i] = true;
+        mCurPixelTextureSerials[i] = 0;
+    }
+
+    mAppliedIBSerial = 0;
+    mAppliedVertexShader = NULL;
+    mAppliedPixelShader = NULL;
+    mAppliedProgramSerial = 0;
+    mDxUniformsDirty = true;
+
+    mVertexDeclarationCache.markStateDirty();
+}
+
+void Renderer9::releaseDeviceResources()
+{
+    for (size_t i = 0; i &lt; mEventQueryPool.size(); i++)
+    {
+        SafeRelease(mEventQueryPool[i]);
+    }
+    mEventQueryPool.clear();
+
+    SafeRelease(mMaskedClearSavedState);
+
+    mVertexShaderCache.clear();
+    mPixelShaderCache.clear();
+
+    SafeDelete(mBlit);
+    SafeDelete(mVertexDataManager);
+    SafeDelete(mIndexDataManager);
+    SafeDelete(mLineLoopIB);
+    SafeDelete(mCountingIB);
+
+    for (int i = 0; i &lt; NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++)
+    {
+        SafeDelete(mNullColorbufferCache[i].buffer);
+    }
+}
+
+// set notify to true to broadcast a message to all contexts of the device loss
+bool Renderer9::testDeviceLost()
+{
+    HRESULT status = getDeviceStatusCode();
+    bool isLost = FAILED(status);
+
+    if (isLost)
+    {
+        // ensure we note the device loss --
+        // we'll probably get this done again by notifyDeviceLost
+        // but best to remember it!
+        // Note that we don't want to clear the device loss status here
+        // -- this needs to be done by resetDevice
+        mDeviceLost = true;
+    }
+
+    return isLost;
+}
+
+HRESULT Renderer9::getDeviceStatusCode()
+{
+    HRESULT status = D3D_OK;
+
+    if (mDeviceEx)
+    {
+        status = mDeviceEx-&gt;CheckDeviceState(NULL);
+    }
+    else if (mDevice)
+    {
+        status = mDevice-&gt;TestCooperativeLevel();
+    }
+
+    return status;
+}
+
+bool Renderer9::testDeviceResettable()
+{
+    // On D3D9Ex, DEVICELOST represents a hung device that needs to be restarted
+    // DEVICEREMOVED indicates the device has been stopped and must be recreated
+    switch (getDeviceStatusCode())
+    {
+      case D3DERR_DEVICENOTRESET:
+      case D3DERR_DEVICEHUNG:
+        return true;
+      case D3DERR_DEVICELOST:
+        return (mDeviceEx != NULL);
+      case D3DERR_DEVICEREMOVED:
+        ASSERT(mDeviceEx != NULL);
+        return isRemovedDeviceResettable();
+      default:
+        return false;
+    }
+}
+
+bool Renderer9::resetDevice()
+{
+    releaseDeviceResources();
+
+    D3DPRESENT_PARAMETERS presentParameters = getDefaultPresentParameters();
+
+    HRESULT result = D3D_OK;
+    bool lost = testDeviceLost();
+    bool removedDevice = (getDeviceStatusCode() == D3DERR_DEVICEREMOVED);
+
+    // Device Removed is a feature which is only present with D3D9Ex
+    ASSERT(mDeviceEx != NULL || !removedDevice);
+
+    for (int attempts = 3; lost &amp;&amp; attempts &gt; 0; attempts--)
+    {
+        if (removedDevice)
+        {
+            // Device removed, which may trigger on driver reinstallation,
+            // may cause a longer wait other reset attempts before the
+            // system is ready to handle creating a new device.
+            Sleep(800);
+            lost = !resetRemovedDevice();
+        }
+        else if (mDeviceEx)
+        {
+            Sleep(500);   // Give the graphics driver some CPU time
+            result = mDeviceEx-&gt;ResetEx(&amp;presentParameters, NULL);
+            lost = testDeviceLost();
+        }
+        else
+        {
+            result = mDevice-&gt;TestCooperativeLevel();
+            while (result == D3DERR_DEVICELOST)
+            {
+                Sleep(100);   // Give the graphics driver some CPU time
+                result = mDevice-&gt;TestCooperativeLevel();
+            }
+
+            if (result == D3DERR_DEVICENOTRESET)
+            {
+                result = mDevice-&gt;Reset(&amp;presentParameters);
+            }
+            lost = testDeviceLost();
+        }
+    }
+
+    if (FAILED(result))
+    {
+        ERR(&quot;Reset/ResetEx failed multiple times: 0x%08X&quot;, result);
+        return false;
+    }
+
+    if (removedDevice &amp;&amp; lost)
+    {
+        ERR(&quot;Device lost reset failed multiple times&quot;);
+        return false;
+    }
+
+    // If the device was removed, we already finished re-initialization in resetRemovedDevice
+    if (!removedDevice)
+    {
+        // reset device defaults
+        initializeDevice();
+    }
+
+    mDeviceLost = false;
+
+    return true;
+}
+
+bool Renderer9::isRemovedDeviceResettable() const
+{
+    bool success = false;
+
+#if ANGLE_D3D9EX == ANGLE_ENABLED
+    IDirect3D9Ex *d3d9Ex = NULL;
+    typedef HRESULT (WINAPI *Direct3DCreate9ExFunc)(UINT, IDirect3D9Ex**);
+    Direct3DCreate9ExFunc Direct3DCreate9ExPtr = reinterpret_cast&lt;Direct3DCreate9ExFunc&gt;(GetProcAddress(mD3d9Module, &quot;Direct3DCreate9Ex&quot;));
+
+    if (Direct3DCreate9ExPtr &amp;&amp; SUCCEEDED(Direct3DCreate9ExPtr(D3D_SDK_VERSION, &amp;d3d9Ex)))
+    {
+        D3DCAPS9 deviceCaps;
+        HRESULT result = d3d9Ex-&gt;GetDeviceCaps(mAdapter, mDeviceType, &amp;deviceCaps);
+        success = SUCCEEDED(result);
+    }
+
+    SafeRelease(d3d9Ex);
+#else
+    ASSERT(UNREACHABLE());
+#endif
+
+    return success;
+}
+
+bool Renderer9::resetRemovedDevice()
+{
+    // From http://msdn.microsoft.com/en-us/library/windows/desktop/bb172554(v=vs.85).aspx:
+    // The hardware adapter has been removed. Application must destroy the device, do enumeration of
+    // adapters and create another Direct3D device. If application continues rendering without
+    // calling Reset, the rendering calls will succeed. Applies to Direct3D 9Ex only.
+    release();
+    return !initialize().isError();
+}
+
+VendorID Renderer9::getVendorId() const
+{
+    return static_cast&lt;VendorID&gt;(mAdapterIdentifier.VendorId);
+}
+
+std::string Renderer9::getRendererDescription() const
+{
+    std::ostringstream rendererString;
+
+    rendererString &lt;&lt; mAdapterIdentifier.Description;
+    if (getShareHandleSupport())
+    {
+        rendererString &lt;&lt; &quot; Direct3D9Ex&quot;;
+    }
+    else
+    {
+        rendererString &lt;&lt; &quot; Direct3D9&quot;;
+    }
+
+    rendererString &lt;&lt; &quot; vs_&quot; &lt;&lt; D3DSHADER_VERSION_MAJOR(mDeviceCaps.VertexShaderVersion) &lt;&lt; &quot;_&quot; &lt;&lt; D3DSHADER_VERSION_MINOR(mDeviceCaps.VertexShaderVersion);
+    rendererString &lt;&lt; &quot; ps_&quot; &lt;&lt; D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion) &lt;&lt; &quot;_&quot; &lt;&lt; D3DSHADER_VERSION_MINOR(mDeviceCaps.PixelShaderVersion);
+
+    return rendererString.str();
+}
+
+GUID Renderer9::getAdapterIdentifier() const
+{
+    return mAdapterIdentifier.DeviceIdentifier;
+}
+
+unsigned int Renderer9::getReservedVertexUniformVectors() const
+{
+    return 2;   // dx_ViewAdjust and dx_DepthRange.
+}
+
+unsigned int Renderer9::getReservedFragmentUniformVectors() const
+{
+    return 3;   // dx_ViewCoords, dx_DepthFront and dx_DepthRange.
+}
+
+unsigned int Renderer9::getReservedVertexUniformBuffers() const
+{
+    return 0;
+}
+
+unsigned int Renderer9::getReservedFragmentUniformBuffers() const
+{
+    return 0;
+}
+
+bool Renderer9::getShareHandleSupport() const
+{
+    // PIX doesn't seem to support using share handles, so disable them.
+    return (mD3d9Ex != NULL) &amp;&amp; !gl::DebugAnnotationsActive();
+}
+
+bool Renderer9::getPostSubBufferSupport() const
+{
+    return true;
+}
+
+int Renderer9::getMajorShaderModel() const
+{
+    return D3DSHADER_VERSION_MAJOR(mDeviceCaps.PixelShaderVersion);
+}
+
+int Renderer9::getMinorShaderModel() const
+{
+    return D3DSHADER_VERSION_MINOR(mDeviceCaps.PixelShaderVersion);
+}
+
+std::string Renderer9::getShaderModelSuffix() const
+{
+    return &quot;&quot;;
+}
+
+DWORD Renderer9::getCapsDeclTypes() const
+{
+    return mDeviceCaps.DeclTypes;
+}
+
+D3DPOOL Renderer9::getBufferPool(DWORD usage) const
+{
+    if (mD3d9Ex != NULL)
+    {
+        return D3DPOOL_DEFAULT;
+    }
+    else
+    {
+        if (!(usage &amp; D3DUSAGE_DYNAMIC))
+        {
+            return D3DPOOL_MANAGED;
+        }
+    }
+
+    return D3DPOOL_DEFAULT;
+}
+
+gl::Error Renderer9::copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                 const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level)
+{
+    RECT rect;
+    rect.left = sourceRect.x;
+    rect.top = sourceRect.y;
+    rect.right = sourceRect.x + sourceRect.width;
+    rect.bottom = sourceRect.y + sourceRect.height;
+
+    return mBlit-&gt;copy2D(framebuffer, rect, destFormat, destOffset, storage, level);
+}
+
+gl::Error Renderer9::copyImageCube(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                   const gl::Offset &amp;destOffset, TextureStorage *storage, GLenum target, GLint level)
+{
+    RECT rect;
+    rect.left = sourceRect.x;
+    rect.top = sourceRect.y;
+    rect.right = sourceRect.x + sourceRect.width;
+    rect.bottom = sourceRect.y + sourceRect.height;
+
+    return mBlit-&gt;copyCube(framebuffer, rect, destFormat, destOffset, storage, target, level);
+}
+
+gl::Error Renderer9::copyImage3D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level)
+{
+    // 3D textures are not available in the D3D9 backend.
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error Renderer9::copyImage2DArray(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                     const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level)
+{
+    // 2D array textures are not available in the D3D9 backend.
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error Renderer9::createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT)
+{
+    const d3d9::TextureFormat &amp;d3d9FormatInfo = d3d9::GetTextureFormatInfo(format);
+
+    const gl::TextureCaps &amp;textureCaps = getRendererTextureCaps().get(format);
+    GLuint supportedSamples = textureCaps.getNearestSamples(samples);
+
+    IDirect3DSurface9 *renderTarget = NULL;
+    if (width &gt; 0 &amp;&amp; height &gt; 0)
+    {
+        bool requiresInitialization = false;
+        HRESULT result = D3DERR_INVALIDCALL;
+
+        const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(format);
+        if (formatInfo.depthBits &gt; 0 || formatInfo.stencilBits &gt; 0)
+        {
+            result = mDevice-&gt;CreateDepthStencilSurface(width, height, d3d9FormatInfo.renderFormat,
+                                                        gl_d3d9::GetMultisampleType(supportedSamples),
+                                                        0, FALSE, &amp;renderTarget, NULL);
+        }
+        else
+        {
+            requiresInitialization = (d3d9FormatInfo.dataInitializerFunction != NULL);
+            result = mDevice-&gt;CreateRenderTarget(width, height, d3d9FormatInfo.renderFormat,
+                                                 gl_d3d9::GetMultisampleType(supportedSamples),
+                                                 0, FALSE, &amp;renderTarget, NULL);
+        }
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create render target, result: 0x%X.&quot;, result);
+        }
+
+        if (requiresInitialization)
+        {
+            // This format requires that the data be initialized before the render target can be used
+            // Unfortunately this requires a Get call on the d3d device but it is far better than having
+            // to mark the render target as lockable and copy data to the gpu.
+            IDirect3DSurface9 *prevRenderTarget = NULL;
+            mDevice-&gt;GetRenderTarget(0, &amp;prevRenderTarget);
+            mDevice-&gt;SetRenderTarget(0, renderTarget);
+            mDevice-&gt;Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 255), 0.0f, 0);
+            mDevice-&gt;SetRenderTarget(0, prevRenderTarget);
+        }
+    }
+
+    *outRT = new TextureRenderTarget9(renderTarget, format, width, height, 1, supportedSamples);
+    return gl::Error(GL_NO_ERROR);
+}
+
+FramebufferImpl *Renderer9::createDefaultFramebuffer(const gl::Framebuffer::Data &amp;data)
+{
+    return createFramebuffer(data);
+}
+
+FramebufferImpl *Renderer9::createFramebuffer(const gl::Framebuffer::Data &amp;data)
+{
+    return new Framebuffer9(data, this);
+}
+
+CompilerImpl *Renderer9::createCompiler(const gl::Data &amp;data)
+{
+    return new CompilerD3D(data, SH_HLSL9_OUTPUT);
+}
+
+ShaderImpl *Renderer9::createShader(GLenum type)
+{
+    return new ShaderD3D(type);
+}
+
+ProgramImpl *Renderer9::createProgram()
+{
+    return new ProgramD3D(this);
+}
+
+gl::Error Renderer9::loadExecutable(const void *function, size_t length, ShaderType type,
+                                    const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                    bool separatedOutputBuffers, ShaderExecutableD3D **outExecutable)
+{
+    // Transform feedback is not supported in ES2 or D3D9
+    ASSERT(transformFeedbackVaryings.size() == 0);
+
+    switch (type)
+    {
+      case SHADER_VERTEX:
+        {
+            IDirect3DVertexShader9 *vshader = NULL;
+            gl::Error error = createVertexShader((DWORD*)function, length, &amp;vshader);
+            if (error.isError())
+            {
+                return error;
+            }
+            *outExecutable = new ShaderExecutable9(function, length, vshader);
+        }
+        break;
+      case SHADER_PIXEL:
+        {
+            IDirect3DPixelShader9 *pshader = NULL;
+            gl::Error error = createPixelShader((DWORD*)function, length, &amp;pshader);
+            if (error.isError())
+            {
+                return error;
+            }
+            *outExecutable = new ShaderExecutable9(function, length, pshader);
+        }
+        break;
+      default:
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error Renderer9::compileToExecutable(gl::InfoLog &amp;infoLog, const std::string &amp;shaderHLSL, ShaderType type,
+                                         const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                         bool separatedOutputBuffers, const D3DCompilerWorkarounds &amp;workarounds,
+                                         ShaderExecutableD3D **outExectuable)
+{
+    // Transform feedback is not supported in ES2 or D3D9
+    ASSERT(transformFeedbackVaryings.size() == 0);
+
+    const char *profileType = NULL;
+    switch (type)
+    {
+      case SHADER_VERTEX:
+        profileType = &quot;vs&quot;;
+        break;
+      case SHADER_PIXEL:
+        profileType = &quot;ps&quot;;
+        break;
+      default:
+        UNREACHABLE();
+        return gl::Error(GL_INVALID_OPERATION);
+    }
+    unsigned int profileMajorVersion = (getMajorShaderModel() &gt;= 3) ? 3 : 2;
+    unsigned int profileMinorVersion = 0;
+    std::string profile = FormatString(&quot;%s_%u_%u&quot;, profileType, profileMajorVersion, profileMinorVersion);
+
+    UINT flags = ANGLE_COMPILE_OPTIMIZATION_LEVEL;
+
+    if (workarounds.skipOptimization)
+    {
+        flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+    }
+    else if (workarounds.useMaxOptimization)
+    {
+        flags = D3DCOMPILE_OPTIMIZATION_LEVEL3;
+    }
+
+    if (gl::DebugAnnotationsActive())
+    {
+#ifndef NDEBUG
+        flags = D3DCOMPILE_SKIP_OPTIMIZATION;
+#endif
+
+        flags |= D3DCOMPILE_DEBUG;
+    }
+
+    // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
+    // Try the default flags first and if compilation fails, try some alternatives.
+    std::vector&lt;CompileConfig&gt; configs;
+    configs.push_back(CompileConfig(flags,                                  &quot;default&quot;            ));
+    configs.push_back(CompileConfig(flags | D3DCOMPILE_AVOID_FLOW_CONTROL,  &quot;avoid flow control&quot; ));
+    configs.push_back(CompileConfig(flags | D3DCOMPILE_PREFER_FLOW_CONTROL, &quot;prefer flow control&quot;));
+
+    ID3DBlob *binary = NULL;
+    std::string debugInfo;
+    gl::Error error = mCompiler.compileToBinary(infoLog, shaderHLSL, profile, configs, NULL, &amp;binary, &amp;debugInfo);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // It's possible that binary is NULL if the compiler failed in all configurations.  Set the executable to NULL
+    // and return GL_NO_ERROR to signify that there was a link error but the internal state is still OK.
+    if (!binary)
+    {
+        *outExectuable = NULL;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    error = loadExecutable(binary-&gt;GetBufferPointer(), binary-&gt;GetBufferSize(), type,
+                           transformFeedbackVaryings, separatedOutputBuffers, outExectuable);
+
+    SafeRelease(binary);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!debugInfo.empty())
+    {
+        (*outExectuable)-&gt;appendDebugInfo(debugInfo);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+UniformStorageD3D *Renderer9::createUniformStorage(size_t storageSize)
+{
+    return new UniformStorageD3D(storageSize);
+}
+
+gl::Error Renderer9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
+{
+    return mBlit-&gt;boxFilter(source, dest);
+}
+
+D3DPOOL Renderer9::getTexturePool(DWORD usage) const
+{
+    if (mD3d9Ex != NULL)
+    {
+        return D3DPOOL_DEFAULT;
+    }
+    else
+    {
+        if (!(usage &amp; (D3DUSAGE_DEPTHSTENCIL | D3DUSAGE_RENDERTARGET)))
+        {
+            return D3DPOOL_MANAGED;
+        }
+    }
+
+    return D3DPOOL_DEFAULT;
+}
+
+gl::Error Renderer9::copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged)
+{
+    ASSERT(source &amp;&amp; dest);
+
+    HRESULT result = D3DERR_OUTOFVIDEOMEMORY;
+
+    if (fromManaged)
+    {
+        D3DSURFACE_DESC desc;
+        source-&gt;GetDesc(&amp;desc);
+
+        IDirect3DSurface9 *surf = 0;
+        result = mDevice-&gt;CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &amp;surf, NULL);
+
+        if (SUCCEEDED(result))
+        {
+            Image9::copyLockableSurfaces(surf, source);
+            result = mDevice-&gt;UpdateSurface(surf, NULL, dest, NULL);
+            SafeRelease(surf);
+        }
+    }
+    else
+    {
+        endScene();
+        result = mDevice-&gt;StretchRect(source, NULL, dest, NULL, D3DTEXF_NONE);
+    }
+
+    if (FAILED(result))
+    {
+        ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to blit internal texture, result: 0x%X.&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+ImageD3D *Renderer9::createImage()
+{
+    return new Image9(this);
+}
+
+gl::Error Renderer9::generateMipmap(ImageD3D *dest, ImageD3D *src)
+{
+    Image9 *src9 = GetAs&lt;Image9&gt;(src);
+    Image9 *dst9 = GetAs&lt;Image9&gt;(dest);
+    return Image9::generateMipmap(dst9, src9);
+}
+
+gl::Error Renderer9::generateMipmapsUsingD3D(TextureStorage *storage, const gl::SamplerState &amp;samplerState)
+{
+    UNREACHABLE();
+    return gl::Error(GL_NO_ERROR);
+}
+
+TextureStorage *Renderer9::createTextureStorage2D(SwapChainD3D *swapChain)
+{
+    SwapChain9 *swapChain9 = GetAs&lt;SwapChain9&gt;(swapChain);
+    return new TextureStorage9_2D(this, swapChain9);
+}
+
+TextureStorage *Renderer9::createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly)
+{
+    return new TextureStorage9_2D(this, internalformat, renderTarget, width, height, levels);
+}
+
+TextureStorage *Renderer9::createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly)
+{
+    return new TextureStorage9_Cube(this, internalformat, renderTarget, size, levels, hintLevelZeroOnly);
+}
+
+TextureStorage *Renderer9::createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+    // 3D textures are not supported by the D3D9 backend.
+    UNREACHABLE();
+
+    return NULL;
+}
+
+TextureStorage *Renderer9::createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
+{
+    // 2D array textures are not supported by the D3D9 backend.
+    UNREACHABLE();
+
+    return NULL;
+}
+
+TextureImpl *Renderer9::createTexture(GLenum target)
+{
+    switch(target)
+    {
+      case GL_TEXTURE_2D:       return new TextureD3D_2D(this);
+      case GL_TEXTURE_CUBE_MAP: return new TextureD3D_Cube(this);
+      default:                  UNREACHABLE();
+    }
+
+    return NULL;
+}
+
+RenderbufferImpl *Renderer9::createRenderbuffer()
+{
+    RenderbufferD3D *renderbuffer = new RenderbufferD3D(this);
+    return renderbuffer;
+}
+
+bool Renderer9::getLUID(LUID *adapterLuid) const
+{
+    adapterLuid-&gt;HighPart = 0;
+    adapterLuid-&gt;LowPart = 0;
+
+    if (mD3d9Ex)
+    {
+        mD3d9Ex-&gt;GetAdapterLUID(mAdapter, adapterLuid);
+        return true;
+    }
+
+    return false;
+}
+
+VertexConversionType Renderer9::getVertexConversionType(const gl::VertexFormat &amp;vertexFormat) const
+{
+    return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormat).conversionType;
+}
+
+GLenum Renderer9::getVertexComponentType(const gl::VertexFormat &amp;vertexFormat) const
+{
+    return d3d9::GetVertexFormatInfo(getCapsDeclTypes(), vertexFormat).componentType;
+}
+
+void Renderer9::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureCaps, gl::Extensions *outExtensions) const
+{
+    d3d9_gl::GenerateCaps(mD3d9, mDevice, mDeviceType, mAdapter, outCaps, outTextureCaps, outExtensions);
+}
+
+Workarounds Renderer9::generateWorkarounds() const
+{
+    return d3d9::GenerateWorkarounds();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9Renderer9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/Renderer9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,379 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// Renderer9.h: Defines a back-end specific class for the D3D9 renderer.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_RENDERER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_RENDERER9_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;common/mathutil.h&quot;
+#include &quot;libANGLE/renderer/d3d/HLSLCompiler.h&quot;
+#include &quot;libANGLE/renderer/d3d/RendererD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/RenderTargetD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/ShaderCache.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h&quot;
+
+namespace gl
+{
+class FramebufferAttachment;
+}
+
+namespace egl
+{
+class AttributeMap;
+}
+
+namespace rx
+{
+class Blit9;
+class IndexDataManager;
+class StreamingIndexBufferInterface;
+class StaticIndexBufferInterface;
+class VertexDataManager;
+struct ClearParameters;
+struct TranslatedAttribute;
+
+enum D3D9InitError
+{
+    D3D9_INIT_SUCCESS = 0,
+    // Failed to load the D3D or ANGLE compiler
+    D3D9_INIT_COMPILER_ERROR,
+    // Failed to load a necessary DLL
+    D3D9_INIT_MISSING_DEP,
+    // Device creation error
+    D3D9_INIT_CREATE_DEVICE_ERROR,
+    // System does not meet minimum shader spec
+    D3D9_INIT_UNSUPPORTED_VERSION,
+    // System does not support stretchrect from textures
+    D3D9_INIT_UNSUPPORTED_STRETCHRECT,
+    // A call returned out of memory or device lost
+    D3D9_INIT_OUT_OF_MEMORY,
+    // Other unspecified error
+    D3D9_INIT_OTHER_ERROR,
+    NUM_D3D9_INIT_ERRORS
+};
+
+class Renderer9 : public RendererD3D
+{
+  public:
+    explicit Renderer9(egl::Display *display);
+    virtual ~Renderer9();
+
+    egl::Error initialize() override;
+    virtual bool resetDevice();
+
+    egl::ConfigSet generateConfigs() const override;
+
+    void startScene();
+    void endScene();
+
+    gl::Error flush() override;
+    gl::Error finish() override;
+
+    bool shouldCreateChildWindowForSurface(EGLNativeWindowType window) const override;
+    virtual SwapChainD3D *createSwapChain(NativeWindow nativeWindow, HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat);
+
+    gl::Error allocateEventQuery(IDirect3DQuery9 **outQuery);
+    void freeEventQuery(IDirect3DQuery9* query);
+
+    // resource creation
+    gl::Error createVertexShader(const DWORD *function, size_t length, IDirect3DVertexShader9 **outShader);
+    gl::Error createPixelShader(const DWORD *function, size_t length, IDirect3DPixelShader9 **outShader);
+    HRESULT createVertexBuffer(UINT Length, DWORD Usage, IDirect3DVertexBuffer9 **ppVertexBuffer);
+    HRESULT createIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, IDirect3DIndexBuffer9 **ppIndexBuffer);
+    virtual gl::Error generateSwizzle(gl::Texture *texture);
+    virtual gl::Error setSamplerState(gl::SamplerType type, int index, gl::Texture *texture, const gl::SamplerState &amp;sampler);
+    virtual gl::Error setTexture(gl::SamplerType type, int index, gl::Texture *texture);
+
+    gl::Error setUniformBuffers(const gl::Data &amp;data,
+                                const GLint vertexUniformBuffers[],
+                                const GLint fragmentUniformBuffers[]) override;
+
+    virtual gl::Error setRasterizerState(const gl::RasterizerState &amp;rasterState);
+    gl::Error setBlendState(const gl::Framebuffer *framebuffer, const gl::BlendState &amp;blendState, const gl::ColorF &amp;blendColor,
+                            unsigned int sampleMask) override;
+    virtual gl::Error setDepthStencilState(const gl::DepthStencilState &amp;depthStencilState, int stencilRef,
+                                           int stencilBackRef, bool frontFaceCCW);
+
+    virtual void setScissorRectangle(const gl::Rectangle &amp;scissor, bool enabled);
+    virtual void setViewport(const gl::Rectangle &amp;viewport, float zNear, float zFar, GLenum drawMode, GLenum frontFace,
+                             bool ignoreViewport);
+
+    gl::Error applyRenderTarget(const gl::Framebuffer *frameBuffer) override;
+    gl::Error applyRenderTarget(const gl::FramebufferAttachment *colorAttachment,
+                                const gl::FramebufferAttachment *depthStencilAttachment);
+    virtual gl::Error applyShaders(gl::Program *program, const gl::VertexFormat inputLayout[], const gl::Framebuffer *framebuffer,
+                                   bool rasterizerDiscard, bool transformFeedbackActive);
+    virtual gl::Error applyUniforms(const ProgramImpl &amp;program, const std::vector&lt;gl::LinkedUniform*&gt; &amp;uniformArray);
+    virtual bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount, bool usesPointSize);
+    virtual gl::Error applyVertexBuffer(const gl::State &amp;state, GLenum mode, GLint first, GLsizei count, GLsizei instances);
+    virtual gl::Error applyIndexBuffer(const GLvoid *indices, gl::Buffer *elementArrayBuffer, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
+
+    void applyTransformFeedbackBuffers(const gl::State &amp;state) override;
+
+    gl::Error drawArrays(const gl::Data &amp;data, GLenum mode, GLsizei count, GLsizei instances, bool usesPointSize) override;
+    virtual gl::Error drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices,
+                                   gl::Buffer *elementArrayBuffer, const TranslatedIndexData &amp;indexInfo, GLsizei instances);
+
+    gl::Error clear(const ClearParameters &amp;clearParams,
+                    const gl::FramebufferAttachment *colorBuffer,
+                    const gl::FramebufferAttachment *depthStencilBuffer);
+
+    virtual void markAllStateDirty();
+
+    // lost device
+    bool testDeviceLost() override;
+    bool testDeviceResettable() override;
+
+    VendorID getVendorId() const override;
+    std::string getRendererDescription() const override;
+    GUID getAdapterIdentifier() const override;
+
+    IDirect3DDevice9 *getDevice() { return mDevice; }
+    void *getD3DDevice() override;
+
+    virtual unsigned int getReservedVertexUniformVectors() const;
+    virtual unsigned int getReservedFragmentUniformVectors() const;
+    virtual unsigned int getReservedVertexUniformBuffers() const;
+    virtual unsigned int getReservedFragmentUniformBuffers() const;
+    virtual bool getShareHandleSupport() const;
+    virtual bool getPostSubBufferSupport() const;
+
+    virtual int getMajorShaderModel() const;
+    int getMinorShaderModel() const override;
+    std::string getShaderModelSuffix() const override;
+
+    DWORD getCapsDeclTypes() const;
+
+    // Pixel operations
+    virtual gl::Error copyImage2D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                  const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level);
+    virtual gl::Error copyImageCube(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                    const gl::Offset &amp;destOffset, TextureStorage *storage, GLenum target, GLint level);
+    virtual gl::Error copyImage3D(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                  const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level);
+    virtual gl::Error copyImage2DArray(const gl::Framebuffer *framebuffer, const gl::Rectangle &amp;sourceRect, GLenum destFormat,
+                                       const gl::Offset &amp;destOffset, TextureStorage *storage, GLint level);
+
+    // RenderTarget creation
+    virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT);
+
+    // Framebuffer creation
+    FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &amp;data) override;
+    FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &amp;data) override;
+
+    // Shader creation
+    virtual CompilerImpl *createCompiler(const gl::Data &amp;data);
+    virtual ShaderImpl *createShader(GLenum type);
+    virtual ProgramImpl *createProgram();
+
+    // Shader operations
+    virtual gl::Error loadExecutable(const void *function, size_t length, ShaderType type,
+                                     const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                     bool separatedOutputBuffers, ShaderExecutableD3D **outExecutable);
+    virtual gl::Error compileToExecutable(gl::InfoLog &amp;infoLog, const std::string &amp;shaderHLSL, ShaderType type,
+                                          const std::vector&lt;gl::LinkedVarying&gt; &amp;transformFeedbackVaryings,
+                                          bool separatedOutputBuffers, const D3DCompilerWorkarounds &amp;workarounds,
+                                          ShaderExecutableD3D **outExectuable);
+    virtual UniformStorageD3D *createUniformStorage(size_t storageSize);
+
+    // Image operations
+    virtual ImageD3D *createImage();
+    gl::Error generateMipmap(ImageD3D *dest, ImageD3D *source) override;
+    gl::Error generateMipmapsUsingD3D(TextureStorage *storage, const gl::SamplerState &amp;samplerState) override;
+    virtual TextureStorage *createTextureStorage2D(SwapChainD3D *swapChain);
+    virtual TextureStorage *createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly);
+    virtual TextureStorage *createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly);
+    virtual TextureStorage *createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
+    virtual TextureStorage *createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels);
+
+    // Texture creation
+    virtual TextureImpl *createTexture(GLenum target);
+
+    // Renderbuffer creation
+    virtual RenderbufferImpl *createRenderbuffer();
+
+    // Buffer creation
+    virtual BufferImpl *createBuffer();
+    virtual VertexBuffer *createVertexBuffer();
+    virtual IndexBuffer *createIndexBuffer();
+
+    // Vertex Array creation
+    virtual VertexArrayImpl *createVertexArray();
+
+    // Query and Fence creation
+    virtual QueryImpl *createQuery(GLenum type);
+    virtual FenceNVImpl *createFenceNV();
+    virtual FenceSyncImpl *createFenceSync();
+
+    // Transform Feedback creation
+    virtual TransformFeedbackImpl* createTransformFeedback();
+
+    // Buffer-to-texture and Texture-to-buffer copies
+    virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
+    virtual gl::Error fastCopyBufferToTexture(const gl::PixelUnpackState &amp;unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+                                              GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &amp;destArea);
+
+    // D3D9-renderer specific methods
+    gl::Error boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest);
+
+    D3DPOOL getTexturePool(DWORD usage) const;
+
+    bool getLUID(LUID *adapterLuid) const override;
+    virtual VertexConversionType getVertexConversionType(const gl::VertexFormat &amp;vertexFormat) const;
+    virtual GLenum getVertexComponentType(const gl::VertexFormat &amp;vertexFormat) const;
+
+    gl::Error copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
+
+    RendererClass getRendererClass() const override { return RENDERER_D3D9; }
+
+    D3DDEVTYPE getD3D9DeviceType() const { return mDeviceType; }
+
+  private:
+    void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureCaps, gl::Extensions *outExtensions) const override;
+    Workarounds generateWorkarounds() const override;
+
+    void release();
+
+    void applyUniformnfv(gl::LinkedUniform *targetUniform, const GLfloat *v);
+    void applyUniformniv(gl::LinkedUniform *targetUniform, const GLint *v);
+    void applyUniformnbv(gl::LinkedUniform *targetUniform, const GLint *v);
+
+    gl::Error drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
+    gl::Error drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
+
+    gl::Error getCountingIB(size_t count, StaticIndexBufferInterface **outIB);
+
+    gl::Error getNullColorbuffer(const gl::FramebufferAttachment *depthbuffer, const gl::FramebufferAttachment **outColorBuffer);
+
+    D3DPOOL getBufferPool(DWORD usage) const;
+
+    HMODULE mD3d9Module;
+
+    void initializeDevice();
+    D3DPRESENT_PARAMETERS getDefaultPresentParameters();
+    void releaseDeviceResources();
+
+    HRESULT getDeviceStatusCode();
+    bool isRemovedDeviceResettable() const;
+    bool resetRemovedDevice();
+
+    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.
+
+    HLSLCompiler mCompiler;
+
+    Blit9 *mBlit;
+
+    HWND mDeviceWindow;
+
+    D3DCAPS9 mDeviceCaps;
+    D3DADAPTER_IDENTIFIER9 mAdapterIdentifier;
+
+    D3DPRIMITIVETYPE mPrimitiveType;
+    int mPrimitiveCount;
+    GLsizei mRepeatDraw;
+
+    bool mSceneStarted;
+
+    bool mVertexTextureSupport;
+
+    // current render target states
+    unsigned int mAppliedRenderTargetSerial;
+    unsigned int mAppliedDepthStencilSerial;
+    bool mDepthStencilInitialized;
+    bool mRenderTargetDescInitialized;
+    unsigned int mCurStencilSize;
+    unsigned int mCurDepthSize;
+
+    struct RenderTargetDesc
+    {
+        size_t width;
+        size_t height;
+        D3DFORMAT format;
+    };
+    RenderTargetDesc mRenderTargetDesc;
+
+    IDirect3DStateBlock9 *mMaskedClearSavedState;
+
+    // previously set render states
+    bool mForceSetDepthStencilState;
+    gl::DepthStencilState mCurDepthStencilState;
+    int mCurStencilRef;
+    int mCurStencilBackRef;
+    bool mCurFrontFaceCCW;
+
+    bool mForceSetRasterState;
+    gl::RasterizerState mCurRasterState;
+
+    bool mForceSetScissor;
+    gl::Rectangle mCurScissor;
+    bool mScissorEnabled;
+
+    bool mForceSetViewport;
+    gl::Rectangle mCurViewport;
+    float mCurNear;
+    float mCurFar;
+    float mCurDepthFront;
+
+    bool mForceSetBlendState;
+    gl::BlendState mCurBlendState;
+    gl::ColorF mCurBlendColor;
+    GLuint mCurSampleMask;
+
+    // Currently applied sampler states
+    std::vector&lt;bool&gt; mForceSetVertexSamplerStates;
+    std::vector&lt;gl::SamplerState&gt; mCurVertexSamplerStates;
+
+    std::vector&lt;bool&gt; mForceSetPixelSamplerStates;
+    std::vector&lt;gl::SamplerState&gt; mCurPixelSamplerStates;
+
+    // Currently applied textures
+    std::vector&lt;unsigned int&gt; mCurVertexTextureSerials;
+    std::vector&lt;unsigned int&gt; mCurPixelTextureSerials;
+
+    unsigned int mAppliedIBSerial;
+    IDirect3DVertexShader9 *mAppliedVertexShader;
+    IDirect3DPixelShader9 *mAppliedPixelShader;
+    unsigned int mAppliedProgramSerial;
+
+    dx_VertexConstants mVertexConstants;
+    dx_PixelConstants mPixelConstants;
+    bool mDxUniformsDirty;
+
+    // A pool of event queries that are currently unused.
+    std::vector&lt;IDirect3DQuery9*&gt; mEventQueryPool;
+    VertexShaderCache mVertexShaderCache;
+    PixelShaderCache mPixelShaderCache;
+
+    VertexDataManager *mVertexDataManager;
+    VertexDeclarationCache mVertexDeclarationCache;
+
+    IndexDataManager *mIndexDataManager;
+    StreamingIndexBufferInterface *mLineLoopIB;
+    StaticIndexBufferInterface *mCountingIB;
+
+    enum { NUM_NULL_COLORBUFFER_CACHE_ENTRIES = 12 };
+    struct NullColorbufferCacheEntry
+    {
+        UINT lruCount;
+        int width;
+        int height;
+        gl::FramebufferAttachment *buffer;
+    } mNullColorbufferCache[NUM_NULL_COLORBUFFER_CACHE_ENTRIES];
+    UINT mMaxNullColorbufferLRU;
+
+    DebugAnnotator9 mAnnotator;
+};
+
+}
+#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERER9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9ShaderCacheh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderCache.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,108 @@
</span><ins>+//
+// 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.
+//
+
+// ShaderCache: Defines rx::ShaderCache, a cache of Direct3D shader objects
+// keyed by their byte code.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_SHADERCACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_SHADERCACHE_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+#include &lt;cstddef&gt;
+#include &lt;unordered_map&gt;
+#include &lt;string&gt;
+
+namespace rx
+{
+template &lt;typename ShaderObject&gt;
+class ShaderCache : angle::NonCopyable
+{
+  public:
+    ShaderCache() : mDevice(NULL)
+    {
+    }
+
+    ~ShaderCache()
+    {
+        // Call clear while the device is still valid.
+        ASSERT(mMap.empty());
+    }
+
+    void initialize(IDirect3DDevice9* device)
+    {
+        mDevice = device;
+    }
+
+    gl::Error create(const DWORD *function, size_t length, ShaderObject **outShaderObject)
+    {
+        std::string key(reinterpret_cast&lt;const char*&gt;(function), length);
+        typename Map::iterator it = mMap.find(key);
+        if (it != mMap.end())
+        {
+            it-&gt;second-&gt;AddRef();
+            *outShaderObject = it-&gt;second;
+            return gl::Error(GL_NO_ERROR);
+        }
+
+        ShaderObject *shader;
+        HRESULT result = createShader(function, &amp;shader);
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create shader, result: 0x%X.&quot;, result);
+        }
+
+        // Random eviction policy.
+        if (mMap.size() &gt;= kMaxMapSize)
+        {
+            SafeRelease(mMap.begin()-&gt;second);
+            mMap.erase(mMap.begin());
+        }
+
+        shader-&gt;AddRef();
+        mMap[key] = shader;
+
+        *outShaderObject = shader;
+        return gl::Error(GL_NO_ERROR);
+    }
+
+    void clear()
+    {
+        for (typename Map::iterator it = mMap.begin(); it != mMap.end(); ++it)
+        {
+            SafeRelease(it-&gt;second);
+        }
+
+        mMap.clear();
+    }
+
+  private:
+    const static size_t kMaxMapSize = 100;
+
+    HRESULT createShader(const DWORD *function, IDirect3DVertexShader9 **shader)
+    {
+        return mDevice-&gt;CreateVertexShader(function, shader);
+    }
+
+    HRESULT createShader(const DWORD *function, IDirect3DPixelShader9 **shader)
+    {
+        return mDevice-&gt;CreatePixelShader(function, shader);
+    }
+
+    typedef std::unordered_map&lt;std::string, ShaderObject*&gt; Map;
+    Map mMap;
+
+    IDirect3DDevice9 *mDevice;
+};
+
+typedef ShaderCache&lt;IDirect3DVertexShader9&gt; VertexShaderCache;
+typedef ShaderCache&lt;IDirect3DPixelShader9&gt; PixelShaderCache;
+
+}
+
+#endif   // LIBANGLE_RENDERER_D3D_D3D9_SHADERCACHE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9ShaderExecutable9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+//
+// Copyright (c) 2012-2013 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.
+//
+
+// ShaderExecutable9.cpp: Implements a D3D9-specific class to contain shader
+// executable implementation details.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable)
+    : ShaderExecutableD3D(function, length)
+{
+    mPixelExecutable = executable;
+    mVertexExecutable = NULL;
+}
+
+ShaderExecutable9::ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable)
+    : ShaderExecutableD3D(function, length)
+{
+    mVertexExecutable = executable;
+    mPixelExecutable = NULL;
+}
+
+ShaderExecutable9::~ShaderExecutable9()
+{
+    SafeRelease(mVertexExecutable);
+    SafeRelease(mPixelExecutable);
+}
+
+IDirect3DVertexShader9 *ShaderExecutable9::getVertexShader() const
+{
+    return mVertexExecutable;
+}
+
+IDirect3DPixelShader9 *ShaderExecutable9::getPixelShader() const
+{
+    return mPixelExecutable;
+}
+
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9ShaderExecutable9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+//
+// Copyright (c) 2012-2013 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.
+//
+
+// ShaderExecutable9.h: Defines a D3D9-specific class to contain shader
+// executable implementation details.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_
+
+#include &quot;libANGLE/renderer/d3d/ShaderExecutableD3D.h&quot;
+
+namespace rx
+{
+
+class ShaderExecutable9 : public ShaderExecutableD3D
+{
+  public:
+    ShaderExecutable9(const void *function, size_t length, IDirect3DPixelShader9 *executable);
+    ShaderExecutable9(const void *function, size_t length, IDirect3DVertexShader9 *executable);
+    virtual ~ShaderExecutable9();
+
+    IDirect3DPixelShader9 *getPixelShader() const;
+    IDirect3DVertexShader9 *getVertexShader() const;
+
+  private:
+    IDirect3DPixelShader9 *mPixelExecutable;
+    IDirect3DVertexShader9 *mVertexExecutable;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_SHADEREXECUTABLE9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9SwapChain9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,419 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// SwapChain9.cpp: Implements a back-end specific class for the D3D9 swap chain.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/SwapChain9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/features.h&quot;
+
+namespace rx
+{
+
+SwapChain9::SwapChain9(Renderer9 *renderer, NativeWindow nativeWindow, HANDLE shareHandle,
+                       GLenum backBufferFormat, GLenum depthBufferFormat)
+    : mRenderer(renderer),
+      SwapChainD3D(nativeWindow, shareHandle, backBufferFormat, depthBufferFormat),
+      mColorRenderTarget(this, false),
+      mDepthStencilRenderTarget(this, true)
+{
+    mSwapChain = NULL;
+    mBackBuffer = NULL;
+    mDepthStencil = NULL;
+    mRenderTarget = NULL;
+    mOffscreenTexture = NULL;
+    mWidth = -1;
+    mHeight = -1;
+    mSwapInterval = -1;
+}
+
+SwapChain9::~SwapChain9()
+{
+    release();
+}
+
+void SwapChain9::release()
+{
+    SafeRelease(mSwapChain);
+    SafeRelease(mBackBuffer);
+    SafeRelease(mDepthStencil);
+    SafeRelease(mRenderTarget);
+    SafeRelease(mOffscreenTexture);
+
+    if (mNativeWindow.getNativeWindow())
+    {
+        mShareHandle = NULL;
+    }
+}
+
+static DWORD convertInterval(EGLint interval)
+{
+#if ANGLE_VSYNC == ANGLE_DISABLED
+    return D3DPRESENT_INTERVAL_IMMEDIATE;
+#else
+    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;
+#endif
+}
+
+EGLint SwapChain9::resize(int backbufferWidth, int backbufferHeight)
+{
+    // D3D9 does not support resizing swap chains without recreating them
+    return reset(backbufferWidth, backbufferHeight, mSwapInterval);
+}
+
+EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapInterval)
+{
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    if (device == NULL)
+    {
+        return EGL_BAD_ACCESS;
+    }
+
+    // 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-&gt;EvictManagedResources();
+
+    HRESULT result;
+
+    // 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.
+    SafeRelease(mSwapChain);
+    SafeRelease(mBackBuffer);
+    SafeRelease(mOffscreenTexture);
+    SafeRelease(mDepthStencil);
+
+    HANDLE *pShareHandle = NULL;
+    if (!mNativeWindow.getNativeWindow() &amp;&amp; mRenderer-&gt;getShareHandleSupport())
+    {
+        pShareHandle = &amp;mShareHandle;
+    }
+
+    const d3d9::TextureFormat &amp;backBufferd3dFormatInfo = d3d9::GetTextureFormatInfo(mBackBufferFormat);
+    result = device-&gt;CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
+                                   backBufferd3dFormatInfo.texFormat, D3DPOOL_DEFAULT, &amp;mOffscreenTexture,
+                                   pShareHandle);
+    if (FAILED(result))
+    {
+        ERR(&quot;Could not create offscreen texture: %08lX&quot;, result);
+        release();
+
+        if (d3d9::isDeviceLostError(result))
+        {
+            return EGL_CONTEXT_LOST;
+        }
+        else
+        {
+            return EGL_BAD_ALLOC;
+        }
+    }
+
+    IDirect3DSurface9 *oldRenderTarget = mRenderTarget;
+
+    result = mOffscreenTexture-&gt;GetSurfaceLevel(0, &amp;mRenderTarget);
+    ASSERT(SUCCEEDED(result));
+
+    if (oldRenderTarget)
+    {
+        RECT rect =
+        {
+            0, 0,
+            mWidth, mHeight
+        };
+
+        if (rect.right &gt; static_cast&lt;LONG&gt;(backbufferWidth))
+        {
+            rect.right = backbufferWidth;
+        }
+
+        if (rect.bottom &gt; static_cast&lt;LONG&gt;(backbufferHeight))
+        {
+            rect.bottom = backbufferHeight;
+        }
+
+        mRenderer-&gt;endScene();
+
+        result = device-&gt;StretchRect(oldRenderTarget, &amp;rect, mRenderTarget, &amp;rect, D3DTEXF_NONE);
+        ASSERT(SUCCEEDED(result));
+
+        SafeRelease(oldRenderTarget);
+    }
+
+    const d3d9::TextureFormat &amp;depthBufferd3dFormatInfo = d3d9::GetTextureFormatInfo(mDepthBufferFormat);
+
+    // Don't create a swapchain for NULLREF devices
+    D3DDEVTYPE deviceType = mRenderer-&gt;getD3D9DeviceType();
+    EGLNativeWindowType window = mNativeWindow.getNativeWindow();
+    if (window &amp;&amp; deviceType != D3DDEVTYPE_NULLREF)
+    {
+        D3DPRESENT_PARAMETERS presentParameters = {0};
+        presentParameters.AutoDepthStencilFormat = depthBufferd3dFormatInfo.renderFormat;
+        presentParameters.BackBufferCount = 1;
+        presentParameters.BackBufferFormat = backBufferd3dFormatInfo.renderFormat;
+        presentParameters.EnableAutoDepthStencil = FALSE;
+        presentParameters.Flags = 0;
+        presentParameters.hDeviceWindow = window;
+        presentParameters.MultiSampleQuality = 0;                  // FIXME: Unimplemented
+        presentParameters.MultiSampleType = D3DMULTISAMPLE_NONE;   // FIXME: Unimplemented
+        presentParameters.PresentationInterval = convertInterval(swapInterval);
+        presentParameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+        presentParameters.Windowed = TRUE;
+        presentParameters.BackBufferWidth = backbufferWidth;
+        presentParameters.BackBufferHeight = backbufferHeight;
+
+        // http://crbug.com/140239
+        // http://crbug.com/143434
+        //
+        // Some AMD/Intel switchable systems / drivers appear to round swap chain surfaces to a multiple of 64 pixels in width
+        // when using the integrated Intel. This rounds the width up rather than down.
+        //
+        // Some non-switchable AMD GPUs / drivers do not respect the source rectangle to Present. Therefore, when the vendor ID
+        // is not Intel, the back buffer width must be exactly the same width as the window or horizontal scaling will occur.
+        if (mRenderer-&gt;getVendorId() == VENDOR_ID_INTEL)
+        {
+            presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64;
+        }
+
+        result = device-&gt;CreateAdditionalSwapChain(&amp;presentParameters, &amp;mSwapChain);
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL || result == D3DERR_DEVICELOST);
+
+            ERR(&quot;Could not create additional swap chains or offscreen surfaces: %08lX&quot;, result);
+            release();
+
+            if (d3d9::isDeviceLostError(result))
+            {
+                return EGL_CONTEXT_LOST;
+            }
+            else
+            {
+                return EGL_BAD_ALLOC;
+            }
+        }
+
+        result = mSwapChain-&gt;GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &amp;mBackBuffer);
+        ASSERT(SUCCEEDED(result));
+        InvalidateRect(window, NULL, FALSE);
+    }
+
+    if (mDepthBufferFormat != GL_NONE)
+    {
+        result = device-&gt;CreateDepthStencilSurface(backbufferWidth, backbufferHeight,
+                                                   depthBufferd3dFormatInfo.renderFormat,
+                                                   D3DMULTISAMPLE_NONE, 0, FALSE, &amp;mDepthStencil, NULL);
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_INVALIDCALL);
+
+            ERR(&quot;Could not create depthstencil surface for new swap chain: 0x%08X&quot;, result);
+            release();
+
+            if (d3d9::isDeviceLostError(result))
+            {
+                return EGL_CONTEXT_LOST;
+            }
+            else
+            {
+                return EGL_BAD_ALLOC;
+            }
+        }
+    }
+
+    mWidth = backbufferWidth;
+    mHeight = backbufferHeight;
+    mSwapInterval = swapInterval;
+
+    return EGL_SUCCESS;
+}
+
+// parameters should be validated/clamped by caller
+EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    if (!mSwapChain)
+    {
+        return EGL_SUCCESS;
+    }
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+
+    // Disable all pipeline operations
+    device-&gt;SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
+    device-&gt;SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
+    device-&gt;SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
+    device-&gt;SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
+    device-&gt;SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
+    device-&gt;SetRenderState(D3DRS_STENCILENABLE, FALSE);
+    device-&gt;SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
+    device-&gt;SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
+    device-&gt;SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
+    device-&gt;SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
+    device-&gt;SetPixelShader(NULL);
+    device-&gt;SetVertexShader(NULL);
+
+    device-&gt;SetRenderTarget(0, mBackBuffer);
+    device-&gt;SetDepthStencilSurface(NULL);
+
+    device-&gt;SetTexture(0, mOffscreenTexture);
+    device-&gt;SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+    device-&gt;SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+    device-&gt;SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
+    device-&gt;SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+    device-&gt;SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
+    device-&gt;SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
+    device-&gt;SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
+    device-&gt;SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);
+
+    for (UINT streamIndex = 0; streamIndex &lt; gl::MAX_VERTEX_ATTRIBS; streamIndex++)
+    {
+        device-&gt;SetStreamSourceFreq(streamIndex, 1);
+    }
+
+    D3DVIEWPORT9 viewport = {0, 0, static_cast&lt;DWORD&gt;(mWidth), static_cast&lt;DWORD&gt;(mHeight), 0.0f, 1.0f};
+    device-&gt;SetViewport(&amp;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
+
+    mRenderer-&gt;startScene();
+    device-&gt;DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, 6 * sizeof(float));
+    mRenderer-&gt;endScene();
+
+    device-&gt;SetTexture(0, NULL);
+
+    RECT rect =
+    {
+        x, mHeight - y - height,
+        x + width, mHeight - y
+    };
+
+    HRESULT result = mSwapChain-&gt;Present(&amp;rect, &amp;rect, NULL, NULL, 0);
+
+    mRenderer-&gt;markAllStateDirty();
+
+    if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
+    {
+        return EGL_BAD_ALLOC;
+    }
+
+    // On Windows 8 systems, IDirect3DSwapChain9::Present sometimes returns 0x88760873 when the windows is
+    // in the process of entering/exiting fullscreen. This code doesn't seem to have any documentation.  The
+    // device appears to be ok after emitting this error so simply return a failure to swap.
+    if (result == 0x88760873)
+    {
+        return EGL_BAD_MATCH;
+    }
+
+    // http://crbug.com/313210
+    // If our swap failed, trigger a device lost event. Resetting will work around an AMD-specific
+    // device removed bug with lost contexts when reinstalling drivers.
+    if (FAILED(result))
+    {
+        mRenderer-&gt;notifyDeviceLost();
+        return EGL_CONTEXT_LOST;
+    }
+
+    return EGL_SUCCESS;
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+// TODO: remove the AddRef to match SwapChain11
+IDirect3DSurface9 *SwapChain9::getRenderTarget()
+{
+    if (mRenderTarget)
+    {
+        mRenderTarget-&gt;AddRef();
+    }
+
+    return mRenderTarget;
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+// TODO: remove the AddRef to match SwapChain11
+IDirect3DSurface9 *SwapChain9::getDepthStencil()
+{
+    if (mDepthStencil)
+    {
+        mDepthStencil-&gt;AddRef();
+    }
+
+    return mDepthStencil;
+}
+
+// Increments refcount on texture.
+// caller must Release() the returned texture
+// TODO: remove the AddRef to match SwapChain11
+IDirect3DTexture9 *SwapChain9::getOffscreenTexture()
+{
+    if (mOffscreenTexture)
+    {
+        mOffscreenTexture-&gt;AddRef();
+    }
+
+    return mOffscreenTexture;
+}
+
+void SwapChain9::recreate()
+{
+    if (!mSwapChain)
+    {
+        return;
+    }
+
+    IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+    if (device == NULL)
+    {
+        return;
+    }
+
+    D3DPRESENT_PARAMETERS presentParameters;
+    HRESULT result = mSwapChain-&gt;GetPresentParameters(&amp;presentParameters);
+    ASSERT(SUCCEEDED(result));
+
+    IDirect3DSwapChain9* newSwapChain = NULL;
+    result = device-&gt;CreateAdditionalSwapChain(&amp;presentParameters, &amp;newSwapChain);
+    if (FAILED(result))
+    {
+        return;
+    }
+
+    SafeRelease(mSwapChain);
+    mSwapChain = newSwapChain;
+
+    SafeRelease(mBackBuffer);
+    result = mSwapChain-&gt;GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &amp;mBackBuffer);
+    ASSERT(SUCCEEDED(result));
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9SwapChain9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+//
+// 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.
+//
+
+// SwapChain9.h: Defines a back-end specific class for the D3D9 swap chain.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/renderer/d3d/SwapChainD3D.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class SwapChain9 : public SwapChainD3D
+{
+  public:
+    SwapChain9(Renderer9 *renderer, NativeWindow nativeWindow, HANDLE shareHandle,
+               GLenum backBufferFormat, GLenum depthBufferFormat);
+    virtual ~SwapChain9();
+
+    EGLint resize(EGLint backbufferWidth, EGLint backbufferHeight);
+    virtual EGLint reset(EGLint backbufferWidth, EGLint backbufferHeight, EGLint swapInterval);
+    virtual EGLint swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
+    virtual void recreate();
+
+    RenderTargetD3D *getColorRenderTarget() override { return &amp;mColorRenderTarget; }
+    RenderTargetD3D *getDepthStencilRenderTarget() override { return &amp;mDepthStencilRenderTarget; }
+
+    virtual IDirect3DSurface9 *getRenderTarget();
+    virtual IDirect3DSurface9 *getDepthStencil();
+    virtual IDirect3DTexture9 *getOffscreenTexture();
+
+    EGLint getWidth() const { return mWidth; }
+    EGLint getHeight() const { return mHeight; }
+
+  private:
+    void release();
+
+    Renderer9 *mRenderer;
+    EGLint mHeight;
+    EGLint mWidth;
+    EGLint mSwapInterval;
+
+    IDirect3DSwapChain9 *mSwapChain;
+    IDirect3DSurface9 *mBackBuffer;
+    IDirect3DSurface9 *mRenderTarget;
+    IDirect3DSurface9 *mDepthStencil;
+    IDirect3DTexture9* mOffscreenTexture;
+
+    SurfaceRenderTarget9 mColorRenderTarget;
+    SurfaceRenderTarget9 mDepthStencilRenderTarget;
+};
+
+}
+#endif // LIBANGLE_RENDERER_D3D_D3D9_SWAPCHAIN9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9TextureStorage9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,459 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// TextureStorage9.cpp: Implements the abstract rx::TextureStorage9 class and its concrete derived
+// classes TextureStorage9_2D and TextureStorage9_Cube, which act as the interface to the
+// D3D9 texture.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/TextureStorage9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/SwapChain9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/TextureD3D.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+
+namespace rx
+{
+TextureStorage9::TextureStorage9(Renderer9 *renderer, DWORD usage)
+    : mTopLevel(0),
+      mMipLevels(0),
+      mTextureWidth(0),
+      mTextureHeight(0),
+      mInternalFormat(GL_NONE),
+      mTextureFormat(D3DFMT_UNKNOWN),
+      mRenderer(renderer),
+      mD3DUsage(usage),
+      mD3DPool(mRenderer-&gt;getTexturePool(usage))
+{
+}
+
+TextureStorage9::~TextureStorage9()
+{
+}
+
+DWORD TextureStorage9::GetTextureUsage(GLenum internalformat, bool renderTarget)
+{
+    DWORD d3dusage = 0;
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalformat);
+    const d3d9::TextureFormat &amp;d3dFormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+    if (formatInfo.depthBits &gt; 0 || formatInfo.stencilBits &gt; 0)
+    {
+        d3dusage |= D3DUSAGE_DEPTHSTENCIL;
+    }
+    else if (renderTarget &amp;&amp; (d3dFormatInfo.renderFormat != D3DFMT_UNKNOWN))
+    {
+        d3dusage |= D3DUSAGE_RENDERTARGET;
+    }
+
+    return d3dusage;
+}
+
+
+bool TextureStorage9::isRenderTarget() const
+{
+    return (mD3DUsage &amp; (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) != 0;
+}
+
+bool TextureStorage9::isManaged() const
+{
+    return (mD3DPool == D3DPOOL_MANAGED);
+}
+
+bool TextureStorage9::supportsNativeMipmapFunction() const
+{
+    return false;
+}
+
+D3DPOOL TextureStorage9::getPool() const
+{
+    return mD3DPool;
+}
+
+DWORD TextureStorage9::getUsage() const
+{
+    return mD3DUsage;
+}
+
+int TextureStorage9::getTopLevel() const
+{
+    return mTopLevel;
+}
+
+int TextureStorage9::getLevelCount() const
+{
+    return mMipLevels - mTopLevel;
+}
+
+gl::Error TextureStorage9::setData(const gl::ImageIndex &amp;index, ImageD3D *image, const gl::Box *destBox, GLenum type,
+                                   const gl::PixelUnpackState &amp;unpack, const uint8_t *pixelData)
+{
+    UNREACHABLE();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+TextureStorage9_2D::TextureStorage9_2D(Renderer9 *renderer, SwapChain9 *swapchain)
+    : TextureStorage9(renderer, D3DUSAGE_RENDERTARGET)
+{
+    IDirect3DTexture9 *surfaceTexture = swapchain-&gt;getOffscreenTexture();
+    mTexture = surfaceTexture;
+    mMipLevels = surfaceTexture-&gt;GetLevelCount();
+
+    mInternalFormat = swapchain-&gt;GetBackBufferInternalFormat();
+
+    D3DSURFACE_DESC surfaceDesc;
+    surfaceTexture-&gt;GetLevelDesc(0, &amp;surfaceDesc);
+    mTextureWidth = surfaceDesc.Width;
+    mTextureHeight = surfaceDesc.Height;
+    mTextureFormat = surfaceDesc.Format;
+
+    mRenderTarget = NULL;
+
+    initializeSerials(1, 1);
+}
+
+TextureStorage9_2D::TextureStorage9_2D(Renderer9 *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels)
+    : TextureStorage9(renderer, GetTextureUsage(internalformat, renderTarget))
+{
+    mTexture = NULL;
+    mRenderTarget = NULL;
+
+    mInternalFormat = internalformat;
+
+    const d3d9::TextureFormat &amp;d3dFormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+    mTextureFormat = d3dFormatInfo.texFormat;
+
+    d3d9::MakeValidSize(false, d3dFormatInfo.texFormat, &amp;width, &amp;height, &amp;mTopLevel);
+    mTextureWidth = width;
+    mTextureHeight = height;
+    mMipLevels = mTopLevel + levels;
+
+    initializeSerials(getLevelCount(), 1);
+}
+
+TextureStorage9_2D::~TextureStorage9_2D()
+{
+    SafeRelease(mTexture);
+    SafeDelete(mRenderTarget);
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+gl::Error TextureStorage9_2D::getSurfaceLevel(int level, bool dirty, IDirect3DSurface9 **outSurface)
+{
+    IDirect3DBaseTexture9 *baseTexture = NULL;
+    gl::Error error = getBaseTexture(&amp;baseTexture);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DTexture9 *texture = static_cast&lt;IDirect3DTexture9*&gt;(baseTexture);
+
+    HRESULT result = texture-&gt;GetSurfaceLevel(level + mTopLevel, outSurface);
+
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get the surface from a texture, result: 0x%X.&quot;, result);
+    }
+
+    // With managed textures the driver needs to be informed of updates to the lower mipmap levels
+    if (level + mTopLevel != 0 &amp;&amp; isManaged() &amp;&amp; dirty)
+    {
+        texture-&gt;AddDirtyRect(NULL);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage9_2D::getRenderTarget(const gl::ImageIndex &amp;/*index*/, RenderTargetD3D **outRT)
+{
+    if (!mRenderTarget &amp;&amp; isRenderTarget())
+    {
+        IDirect3DSurface9 *surface = NULL;
+        gl::Error error = getSurfaceLevel(0, false, &amp;surface);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mRenderTarget = new TextureRenderTarget9(surface, mInternalFormat, mTextureWidth, mTextureHeight, 1, 0);
+    }
+
+    ASSERT(outRT);
+    *outRT = mRenderTarget;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage9_2D::generateMipmap(const gl::ImageIndex &amp;sourceIndex, const gl::ImageIndex &amp;destIndex)
+{
+    IDirect3DSurface9 *upper = NULL;
+    gl::Error error = getSurfaceLevel(sourceIndex.mipIndex, false, &amp;upper);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DSurface9 *lower = NULL;
+    error = getSurfaceLevel(destIndex.mipIndex, true, &amp;lower);
+    if (error.isError())
+    {
+        SafeRelease(upper);
+        return error;
+    }
+
+    ASSERT(upper &amp;&amp; lower);
+    error = mRenderer-&gt;boxFilter(upper, lower);
+
+    SafeRelease(upper);
+    SafeRelease(lower);
+
+    return error;
+}
+
+gl::Error TextureStorage9_2D::getBaseTexture(IDirect3DBaseTexture9 **outTexture)
+{
+    // 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 (mTexture == NULL &amp;&amp; mTextureWidth &gt; 0 &amp;&amp; mTextureHeight &gt; 0)
+    {
+        ASSERT(mMipLevels &gt; 0);
+
+        IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+        HRESULT result = device-&gt;CreateTexture(mTextureWidth, mTextureHeight, mMipLevels, getUsage(), mTextureFormat,
+                                               getPool(), &amp;mTexture, NULL);
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create 2D storage texture, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outTexture = mTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage9_2D::copyToStorage(TextureStorage *destStorage)
+{
+    ASSERT(destStorage);
+
+    TextureStorage9_2D *dest9 = GetAs&lt;TextureStorage9_2D&gt;(destStorage);
+
+    int levels = getLevelCount();
+    for (int i = 0; i &lt; levels; ++i)
+    {
+        IDirect3DSurface9 *srcSurf = NULL;
+        gl::Error error = getSurfaceLevel(i, false, &amp;srcSurf);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        IDirect3DSurface9 *dstSurf = NULL;
+        error = dest9-&gt;getSurfaceLevel(i, true, &amp;dstSurf);
+        if (error.isError())
+        {
+            SafeRelease(srcSurf);
+            return error;
+        }
+
+        error = mRenderer-&gt;copyToRenderTarget(dstSurf, srcSurf, isManaged());
+
+        SafeRelease(srcSurf);
+        SafeRelease(dstSurf);
+
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+TextureStorage9_Cube::TextureStorage9_Cube(Renderer9 *renderer, GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly)
+    : TextureStorage9(renderer, GetTextureUsage(internalformat, renderTarget))
+{
+    mTexture = NULL;
+    for (int i = 0; i &lt; CUBE_FACE_COUNT; ++i)
+    {
+        mRenderTarget[i] = NULL;
+    }
+
+    mInternalFormat = internalformat;
+
+    const d3d9::TextureFormat &amp;d3dFormatInfo = d3d9::GetTextureFormatInfo(internalformat);
+    mTextureFormat = d3dFormatInfo.texFormat;
+
+    int height = size;
+    d3d9::MakeValidSize(false, d3dFormatInfo.texFormat, &amp;size, &amp;height, &amp;mTopLevel);
+    mTextureWidth = size;
+    mTextureHeight = size;
+    mMipLevels = mTopLevel + levels;
+
+    initializeSerials(getLevelCount() * CUBE_FACE_COUNT, CUBE_FACE_COUNT);
+}
+
+TextureStorage9_Cube::~TextureStorage9_Cube()
+{
+    SafeRelease(mTexture);
+
+    for (int i = 0; i &lt; CUBE_FACE_COUNT; ++i)
+    {
+        SafeDelete(mRenderTarget[i]);
+    }
+}
+
+// Increments refcount on surface.
+// caller must Release() the returned surface
+gl::Error TextureStorage9_Cube::getCubeMapSurface(GLenum faceTarget, int level, bool dirty, IDirect3DSurface9 **outSurface)
+{
+    IDirect3DBaseTexture9 *baseTexture = NULL;
+    gl::Error error = getBaseTexture(&amp;baseTexture);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DCubeTexture9 *texture = static_cast&lt;IDirect3DCubeTexture9*&gt;(baseTexture);
+
+    D3DCUBEMAP_FACES face = gl_d3d9::ConvertCubeFace(faceTarget);
+    HRESULT result = texture-&gt;GetCubeMapSurface(face, level + mTopLevel, outSurface);
+
+    ASSERT(SUCCEEDED(result));
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to get the surface from a texture, result: 0x%X.&quot;, result);
+    }
+
+    // With managed textures the driver needs to be informed of updates to the lower mipmap levels
+    if (level != 0 &amp;&amp; isManaged() &amp;&amp; dirty)
+    {
+        texture-&gt;AddDirtyRect(face, NULL);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage9_Cube::getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT)
+{
+    ASSERT(outRT);
+    ASSERT(index.mipIndex == 0);
+    ASSERT(index.layerIndex &gt;= 0 &amp;&amp; index.layerIndex &lt; CUBE_FACE_COUNT);
+
+    if (mRenderTarget[index.layerIndex] == NULL &amp;&amp; isRenderTarget())
+    {
+        IDirect3DSurface9 *surface = NULL;
+        gl::Error error = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + index.layerIndex, 0, false, &amp;surface);
+        if (error.isError())
+        {
+            return error;
+        }
+
+        mRenderTarget[index.layerIndex] = new TextureRenderTarget9(surface, mInternalFormat, mTextureWidth, mTextureHeight, 1, 0);
+    }
+
+    *outRT = mRenderTarget[index.layerIndex];
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage9_Cube::generateMipmap(const gl::ImageIndex &amp;sourceIndex, const gl::ImageIndex &amp;destIndex)
+{
+    IDirect3DSurface9 *upper = NULL;
+    gl::Error error = getCubeMapSurface(sourceIndex.type, sourceIndex.mipIndex, false, &amp;upper);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    IDirect3DSurface9 *lower = NULL;
+    error = getCubeMapSurface(destIndex.type, destIndex.mipIndex, true, &amp;lower);
+    if (error.isError())
+    {
+        SafeRelease(upper);
+        return error;
+    }
+
+    ASSERT(upper &amp;&amp; lower);
+    error = mRenderer-&gt;boxFilter(upper, lower);
+
+    SafeRelease(upper);
+    SafeRelease(lower);
+
+    return error;
+}
+
+gl::Error TextureStorage9_Cube::getBaseTexture(IDirect3DBaseTexture9 **outTexture)
+{
+    // 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 (mTexture == NULL &amp;&amp; mTextureWidth &gt; 0 &amp;&amp; mTextureHeight &gt; 0)
+    {
+        ASSERT(mMipLevels &gt; 0);
+        ASSERT(mTextureWidth == mTextureHeight);
+
+        IDirect3DDevice9 *device = mRenderer-&gt;getDevice();
+        HRESULT result = device-&gt;CreateCubeTexture(mTextureWidth, mMipLevels, getUsage(), mTextureFormat, getPool(),
+                                                   &amp;mTexture, NULL);
+
+        if (FAILED(result))
+        {
+            ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create cube storage texture, result: 0x%X.&quot;, result);
+        }
+    }
+
+    *outTexture = mTexture;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureStorage9_Cube::copyToStorage(TextureStorage *destStorage)
+{
+    ASSERT(destStorage);
+
+    TextureStorage9_Cube *dest9 = GetAs&lt;TextureStorage9_Cube&gt;(destStorage);
+
+    int levels = getLevelCount();
+    for (int f = 0; f &lt; CUBE_FACE_COUNT; f++)
+    {
+        for (int i = 0; i &lt; levels; i++)
+        {
+            IDirect3DSurface9 *srcSurf = NULL;
+            gl::Error error = getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, false, &amp;srcSurf);
+            if (error.isError())
+            {
+                return error;
+            }
+
+            IDirect3DSurface9 *dstSurf = NULL;
+            error = dest9-&gt;getCubeMapSurface(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, true, &amp;dstSurf);
+            if (error.isError())
+            {
+                SafeRelease(srcSurf);
+                return error;
+            }
+
+            error = mRenderer-&gt;copyToRenderTarget(dstSurf, srcSurf, isManaged());
+
+            SafeRelease(srcSurf);
+            SafeRelease(dstSurf);
+
+            if (error.isError())
+            {
+                return error;
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9TextureStorage9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+//
+// Copyright (c) 2012-2013 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.
+//
+
+// TextureStorage9.h: Defines the abstract rx::TextureStorage9 class and its concrete derived
+// classes TextureStorage9_2D and TextureStorage9_Cube, which act as the interface to the
+// D3D9 texture.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_TEXTURESTORAGE9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_TEXTURESTORAGE9_H_
+
+#include &quot;libANGLE/renderer/d3d/TextureStorage.h&quot;
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+class Renderer9;
+class SwapChain9;
+class RenderTargetD3D;
+class RenderTarget9;
+
+class TextureStorage9 : public TextureStorage
+{
+  public:
+    virtual ~TextureStorage9();
+
+    static DWORD GetTextureUsage(GLenum internalformat, bool renderTarget);
+
+    D3DPOOL getPool() const;
+    DWORD getUsage() const;
+
+    virtual gl::Error getBaseTexture(IDirect3DBaseTexture9 **outTexture) = 0;
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT) = 0;
+
+    virtual int getTopLevel() const;
+    virtual bool isRenderTarget() const;
+    virtual bool isManaged() const;
+    bool supportsNativeMipmapFunction() const override;
+    virtual int getLevelCount() const;
+
+    virtual gl::Error setData(const gl::ImageIndex &amp;index, ImageD3D *image, const gl::Box *destBox, GLenum type,
+                              const gl::PixelUnpackState &amp;unpack, const uint8_t *pixelData);
+
+  protected:
+    int mTopLevel;
+    size_t mMipLevels;
+    size_t mTextureWidth;
+    size_t mTextureHeight;
+    GLenum mInternalFormat;
+    D3DFORMAT mTextureFormat;
+
+    Renderer9 *mRenderer;
+
+    TextureStorage9(Renderer9 *renderer, DWORD usage);
+
+  private:
+    const DWORD mD3DUsage;
+    const D3DPOOL mD3DPool;
+};
+
+class TextureStorage9_2D : public TextureStorage9
+{
+  public:
+    TextureStorage9_2D(Renderer9 *renderer, SwapChain9 *swapchain);
+    TextureStorage9_2D(Renderer9 *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels);
+    virtual ~TextureStorage9_2D();
+
+    gl::Error getSurfaceLevel(int level, bool dirty, IDirect3DSurface9 **outSurface);
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+    virtual gl::Error getBaseTexture(IDirect3DBaseTexture9 **outTexture);
+    virtual gl::Error generateMipmap(const gl::ImageIndex &amp;sourceIndex, const gl::ImageIndex &amp;destIndex);
+    virtual gl::Error copyToStorage(TextureStorage *destStorage);
+
+  private:
+    IDirect3DTexture9 *mTexture;
+    RenderTarget9 *mRenderTarget;
+};
+
+class TextureStorage9_Cube : public TextureStorage9
+{
+  public:
+    TextureStorage9_Cube(Renderer9 *renderer, GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly);
+    virtual ~TextureStorage9_Cube();
+
+    gl::Error getCubeMapSurface(GLenum faceTarget, int level, bool dirty, IDirect3DSurface9 **outSurface);
+    virtual gl::Error getRenderTarget(const gl::ImageIndex &amp;index, RenderTargetD3D **outRT);
+    virtual gl::Error getBaseTexture(IDirect3DBaseTexture9 **outTexture);
+    virtual gl::Error generateMipmap(const gl::ImageIndex &amp;sourceIndex, const gl::ImageIndex &amp;destIndex);
+    virtual gl::Error copyToStorage(TextureStorage *destStorage);
+
+  private:
+    static const size_t CUBE_FACE_COUNT = 6;
+
+    IDirect3DCubeTexture9 *mTexture;
+    RenderTarget9 *mRenderTarget[CUBE_FACE_COUNT];
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_TEXTURESTORAGE9_H_
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexArray9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+//
+// Copyright 2014 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.
+//
+
+// VertexArray9.h: Defines the rx::VertexArray9 class which implements rx::VertexArrayImpl.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
+
+#include &quot;libANGLE/renderer/VertexArrayImpl.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class VertexArray9 : public VertexArrayImpl
+{
+  public:
+    VertexArray9(Renderer9 *renderer)
+        : VertexArrayImpl(),
+          mRenderer(renderer)
+    {
+    }
+
+    virtual ~VertexArray9() { }
+
+    virtual void setElementArrayBuffer(const gl::Buffer *buffer) { }
+    virtual void setAttribute(size_t idx, const gl::VertexAttribute &amp;attr) { }
+    virtual void setAttributeDivisor(size_t idx, GLuint divisor) { }
+    virtual void enableAttribute(size_t idx, bool enabledState) { }
+
+  private:
+    Renderer9 *mRenderer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexBuffer9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,233 @@
</span><ins>+//
+// 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.
+//
+
+// VertexBuffer9.cpp: Defines the D3D9 VertexBuffer implementation.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/VertexBuffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/vertexconversion.h&quot;
+#include &quot;libANGLE/renderer/d3d/BufferD3D.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+
+namespace rx
+{
+
+VertexBuffer9::VertexBuffer9(Renderer9 *renderer) : mRenderer(renderer)
+{
+    mVertexBuffer = NULL;
+    mBufferSize = 0;
+    mDynamicUsage = false;
+}
+
+VertexBuffer9::~VertexBuffer9()
+{
+    SafeRelease(mVertexBuffer);
+}
+
+gl::Error VertexBuffer9::initialize(unsigned int size, bool dynamicUsage)
+{
+    SafeRelease(mVertexBuffer);
+
+    updateSerial();
+
+    if (size &gt; 0)
+    {
+        DWORD flags = D3DUSAGE_WRITEONLY;
+        if (dynamicUsage)
+        {
+            flags |= D3DUSAGE_DYNAMIC;
+        }
+
+        HRESULT result = mRenderer-&gt;createVertexBuffer(size, flags, &amp;mVertexBuffer);
+
+        if (FAILED(result))
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to allocate internal vertex buffer of size, %lu.&quot;, size);
+        }
+    }
+
+    mBufferSize = size;
+    mDynamicUsage = dynamicUsage;
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                               GLint start, GLsizei count, GLsizei instances, unsigned int offset)
+{
+    if (!mVertexBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal vertex buffer is not initialized.&quot;);
+    }
+
+    gl::Buffer *buffer = attrib.buffer.get();
+
+    int inputStride = gl::ComputeVertexAttributeStride(attrib);
+    int elementSize = gl::ComputeVertexAttributeTypeSize(attrib);
+
+    DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0;
+
+    uint8_t *mapPtr = NULL;
+
+    unsigned int mapSize;
+    gl::Error error = spaceRequired(attrib, count, instances, &amp;mapSize);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    HRESULT result = mVertexBuffer-&gt;Lock(offset, mapSize, reinterpret_cast&lt;void**&gt;(&amp;mapPtr), lockFlags);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock internal vertex buffer, HRESULT: 0x%08x.&quot;, result);
+    }
+
+    const uint8_t *input = NULL;
+    if (attrib.enabled)
+    {
+        if (buffer)
+        {
+            BufferD3D *storage = GetImplAs&lt;BufferD3D&gt;(buffer);
+            ASSERT(storage);
+            error = storage-&gt;getData(&amp;input);
+            if (error.isError())
+            {
+                return error;
+            }
+            input += static_cast&lt;int&gt;(attrib.offset);
+        }
+        else
+        {
+            input = static_cast&lt;const uint8_t*&gt;(attrib.pointer);
+        }
+    }
+    else
+    {
+        input = reinterpret_cast&lt;const uint8_t*&gt;(currentValue.FloatValues);
+    }
+
+    if (instances == 0 || attrib.divisor == 0)
+    {
+        input += inputStride * start;
+    }
+
+    gl::VertexFormat vertexFormat(attrib, currentValue.Type);
+    const d3d9::VertexFormat &amp;d3dVertexInfo = d3d9::GetVertexFormatInfo(mRenderer-&gt;getCapsDeclTypes(), vertexFormat);
+    bool needsConversion = (d3dVertexInfo.conversionType &amp; VERTEX_CONVERT_CPU) &gt; 0;
+
+    if (!needsConversion &amp;&amp; inputStride == elementSize)
+    {
+        size_t copySize = static_cast&lt;size_t&gt;(count) * static_cast&lt;size_t&gt;(inputStride);
+        memcpy(mapPtr, input, copySize);
+    }
+    else
+    {
+        d3dVertexInfo.copyFunction(input, inputStride, count, mapPtr);
+    }
+
+    mVertexBuffer-&gt;Unlock();
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexBuffer9::getSpaceRequired(const gl::VertexAttribute &amp;attrib, GLsizei count, GLsizei instances,
+                                          unsigned int *outSpaceRequired) const
+{
+    return spaceRequired(attrib, count, instances, outSpaceRequired);
+}
+
+unsigned int VertexBuffer9::getBufferSize() const
+{
+    return mBufferSize;
+}
+
+gl::Error VertexBuffer9::setBufferSize(unsigned int size)
+{
+    if (size &gt; mBufferSize)
+    {
+        return initialize(size, mDynamicUsage);
+    }
+    else
+    {
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+gl::Error VertexBuffer9::discard()
+{
+    if (!mVertexBuffer)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Internal vertex buffer is not initialized.&quot;);
+    }
+
+    void *dummy;
+    HRESULT result;
+
+    result = mVertexBuffer-&gt;Lock(0, 1, &amp;dummy, D3DLOCK_DISCARD);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to lock internal buffer for discarding, HRESULT: 0x%08x&quot;, result);
+    }
+
+    result = mVertexBuffer-&gt;Unlock();
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to unlock internal buffer for discarding, HRESULT: 0x%08x&quot;, result);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+IDirect3DVertexBuffer9 * VertexBuffer9::getBuffer() const
+{
+    return mVertexBuffer;
+}
+
+gl::Error VertexBuffer9::spaceRequired(const gl::VertexAttribute &amp;attrib, std::size_t count, GLsizei instances,
+                                       unsigned int *outSpaceRequired) const
+{
+    gl::VertexFormat vertexFormat(attrib, GL_FLOAT);
+    const d3d9::VertexFormat &amp;d3d9VertexInfo = d3d9::GetVertexFormatInfo(mRenderer-&gt;getCapsDeclTypes(), vertexFormat);
+
+    if (attrib.enabled)
+    {
+        unsigned int elementCount = 0;
+        if (instances == 0 || attrib.divisor == 0)
+        {
+            elementCount = count;
+        }
+        else
+        {
+            // Round up to divisor, if possible
+            elementCount = UnsignedCeilDivide(static_cast&lt;unsigned int&gt;(instances), attrib.divisor);
+        }
+
+        if (d3d9VertexInfo.outputElementSize &lt;= std::numeric_limits&lt;unsigned int&gt;::max() / elementCount)
+        {
+            if (outSpaceRequired)
+            {
+                *outSpaceRequired = d3d9VertexInfo.outputElementSize * elementCount;
+            }
+            return gl::Error(GL_NO_ERROR);
+        }
+        else
+        {
+            return gl::Error(GL_OUT_OF_MEMORY, &quot;New vertex buffer size would result in an overflow.&quot;);
+        }
+    }
+    else
+    {
+        const unsigned int elementSize = 4;
+        if (outSpaceRequired)
+        {
+            *outSpaceRequired = elementSize * 4;
+        }
+        return gl::Error(GL_NO_ERROR);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexBuffer9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+//
+// 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.
+//
+
+// VertexBuffer9.h: Defines the D3D9 VertexBuffer implementation.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXBUFFER9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXBUFFER9_H_
+
+#include &quot;libANGLE/renderer/d3d/VertexBuffer.h&quot;
+
+namespace rx
+{
+class Renderer9;
+
+class VertexBuffer9 : public VertexBuffer
+{
+  public:
+    explicit VertexBuffer9(Renderer9 *renderer);
+    virtual ~VertexBuffer9();
+
+    virtual gl::Error initialize(unsigned int size, bool dynamicUsage);
+
+    virtual gl::Error storeVertexAttributes(const gl::VertexAttribute &amp;attrib, const gl::VertexAttribCurrentValueData &amp;currentValue,
+                                            GLint start, GLsizei count, GLsizei instances, unsigned int offset);
+
+    virtual gl::Error getSpaceRequired(const gl::VertexAttribute &amp;attrib, GLsizei count, GLsizei instances, unsigned int *outSpaceRequired) const;
+
+    virtual unsigned int getBufferSize() const;
+    virtual gl::Error setBufferSize(unsigned int size);
+    virtual gl::Error discard();
+
+    IDirect3DVertexBuffer9 *getBuffer() const;
+
+  private:
+    Renderer9 *mRenderer;
+
+    IDirect3DVertexBuffer9 *mVertexBuffer;
+    unsigned int mBufferSize;
+    bool mDynamicUsage;
+
+    gl::Error spaceRequired(const gl::VertexAttribute &amp;attrib, std::size_t count, GLsizei instances,
+                            unsigned int *outSpaceRequired) const;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXBUFFER9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexDeclarationCachecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,237 @@
</span><ins>+//
+// 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.
+//
+
+// VertexDeclarationCache.cpp: Implements a helper class to construct and cache vertex declarations.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/VertexBuffer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+
+namespace rx
+{
+
+VertexDeclarationCache::VertexDeclarationCache() : mMaxLru(0)
+{
+    for (int i = 0; i &lt; NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+    {
+        mVertexDeclCache[i].vertexDeclaration = NULL;
+        mVertexDeclCache[i].lruCount = 0;
+    }
+
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        mAppliedVBs[i].serial = 0;
+    }
+
+    mLastSetVDecl = NULL;
+    mInstancingEnabled = true;
+}
+
+VertexDeclarationCache::~VertexDeclarationCache()
+{
+    for (int i = 0; i &lt; NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+    {
+        SafeRelease(mVertexDeclCache[i].vertexDeclaration);
+    }
+}
+
+gl::Error VertexDeclarationCache::applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::Program *program, GLsizei instances, GLsizei *repeatDraw)
+{
+    *repeatDraw = 1;
+
+    int indexedAttribute = gl::MAX_VERTEX_ATTRIBS;
+    int instancedAttribute = gl::MAX_VERTEX_ATTRIBS;
+
+    if (instances == 0)
+    {
+        for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; ++i)
+        {
+            if (attributes[i].divisor != 0)
+            {
+                // If a divisor is set, it still applies even if an instanced draw was not used, so treat
+                // as a single-instance draw.
+                instances = 1;
+                break;
+            }
+        }
+    }
+
+    if (instances &gt; 0)
+    {
+        // Find an indexed attribute to be mapped to D3D stream 0
+        for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+        {
+            if (attributes[i].active)
+            {
+                if (indexedAttribute == gl::MAX_VERTEX_ATTRIBS &amp;&amp; attributes[i].divisor == 0)
+                {
+                    indexedAttribute = i;
+                }
+                else if (instancedAttribute == gl::MAX_VERTEX_ATTRIBS &amp;&amp; attributes[i].divisor != 0)
+                {
+                    instancedAttribute = i;
+                }
+                if (indexedAttribute != gl::MAX_VERTEX_ATTRIBS &amp;&amp; instancedAttribute != gl::MAX_VERTEX_ATTRIBS)
+                    break;   // Found both an indexed and instanced attribute
+            }
+        }
+
+        // The validation layer checks that there is at least one active attribute with a zero divisor as per
+        // the GL_ANGLE_instanced_arrays spec.
+        ASSERT(indexedAttribute != gl::MAX_VERTEX_ATTRIBS);
+    }
+
+    D3DCAPS9 caps;
+    device-&gt;GetDeviceCaps(&amp;caps);
+
+    D3DVERTEXELEMENT9 elements[gl::MAX_VERTEX_ATTRIBS + 1];
+    D3DVERTEXELEMENT9 *element = &amp;elements[0];
+
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        if (attributes[i].active)
+        {
+            // Directly binding the storage buffer is not supported for d3d9
+            ASSERT(attributes[i].storage == NULL);
+
+            int stream = i;
+
+            if (instances &gt; 0)
+            {
+                // Due to a bug on ATI cards we can't enable instancing when none of the attributes are instanced.
+                if (instancedAttribute == gl::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-&gt;SetStreamSourceFreq(stream, frequency);
+                    mInstancingEnabled = true;
+                }
+            }
+
+            VertexBuffer9 *vertexBuffer = GetAs&lt;VertexBuffer9&gt;(attributes[i].vertexBuffer);
+
+            if (mAppliedVBs[stream].serial != attributes[i].serial ||
+                mAppliedVBs[stream].stride != attributes[i].stride ||
+                mAppliedVBs[stream].offset != attributes[i].offset)
+            {
+                device-&gt;SetStreamSource(stream, vertexBuffer-&gt;getBuffer(), attributes[i].offset, attributes[i].stride);
+                mAppliedVBs[stream].serial = attributes[i].serial;
+                mAppliedVBs[stream].stride = attributes[i].stride;
+                mAppliedVBs[stream].offset = attributes[i].offset;
+            }
+
+            gl::VertexFormat vertexFormat(*attributes[i].attribute, GL_FLOAT);
+            const d3d9::VertexFormat &amp;d3d9VertexInfo = d3d9::GetVertexFormatInfo(caps.DeclTypes, vertexFormat);
+
+            element-&gt;Stream = static_cast&lt;WORD&gt;(stream);
+            element-&gt;Offset = 0;
+            element-&gt;Type = static_cast&lt;BYTE&gt;(d3d9VertexInfo.nativeFormat);
+            element-&gt;Method = D3DDECLMETHOD_DEFAULT;
+            element-&gt;Usage = D3DDECLUSAGE_TEXCOORD;
+            element-&gt;UsageIndex = static_cast&lt;BYTE&gt;(program-&gt;getSemanticIndex(i));
+            element++;
+        }
+    }
+
+    if (instances == 0 || instancedAttribute == gl::MAX_VERTEX_ATTRIBS)
+    {
+        if (mInstancingEnabled)
+        {
+            for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+            {
+                device-&gt;SetStreamSourceFreq(i, 1);
+            }
+
+            mInstancingEnabled = false;
+        }
+    }
+
+    static const D3DVERTEXELEMENT9 end = D3DDECL_END();
+    *(element++) = end;
+
+    for (int i = 0; i &lt; NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+    {
+        VertexDeclCacheEntry *entry = &amp;mVertexDeclCache[i];
+        if (memcmp(entry-&gt;cachedElements, elements, (element - elements) * sizeof(D3DVERTEXELEMENT9)) == 0 &amp;&amp; entry-&gt;vertexDeclaration)
+        {
+            entry-&gt;lruCount = ++mMaxLru;
+            if(entry-&gt;vertexDeclaration != mLastSetVDecl)
+            {
+                device-&gt;SetVertexDeclaration(entry-&gt;vertexDeclaration);
+                mLastSetVDecl = entry-&gt;vertexDeclaration;
+            }
+
+            return gl::Error(GL_NO_ERROR);
+        }
+    }
+
+    VertexDeclCacheEntry *lastCache = mVertexDeclCache;
+
+    for (int i = 0; i &lt; NUM_VERTEX_DECL_CACHE_ENTRIES; i++)
+    {
+        if (mVertexDeclCache[i].lruCount &lt; lastCache-&gt;lruCount)
+        {
+            lastCache = &amp;mVertexDeclCache[i];
+        }
+    }
+
+    if (lastCache-&gt;vertexDeclaration != NULL)
+    {
+        SafeRelease(lastCache-&gt;vertexDeclaration);
+        // mLastSetVDecl is set to the replacement, so we don't have to worry
+        // about it.
+    }
+
+    memcpy(lastCache-&gt;cachedElements, elements, (element - elements) * sizeof(D3DVERTEXELEMENT9));
+    HRESULT result = device-&gt;CreateVertexDeclaration(elements, &amp;lastCache-&gt;vertexDeclaration);
+    if (FAILED(result))
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to create internal vertex declaration, result: 0x%X.&quot;, result);
+    }
+
+    device-&gt;SetVertexDeclaration(lastCache-&gt;vertexDeclaration);
+    mLastSetVDecl = lastCache-&gt;vertexDeclaration;
+    lastCache-&gt;lruCount = ++mMaxLru;
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void VertexDeclarationCache::markStateDirty()
+{
+    for (int i = 0; i &lt; gl::MAX_VERTEX_ATTRIBS; i++)
+    {
+        mAppliedVBs[i].serial = 0;
+    }
+
+    mLastSetVDecl = NULL;
+    mInstancingEnabled = true;   // Forces it to be disabled when not used
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9VertexDeclarationCacheh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+//
+// 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.
+//
+
+// VertexDeclarationCache.h: Defines a helper class to construct and cache vertex declarations.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_VERTEXDECLARATIONCACHE_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXDECLARATIONCACHE_H_
+
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/renderer/d3d/VertexDataManager.h&quot;
+
+namespace gl
+{
+class VertexDataManager;
+class Program;
+}
+
+namespace rx
+{
+
+class VertexDeclarationCache
+{
+  public:
+    VertexDeclarationCache();
+    ~VertexDeclarationCache();
+
+    gl::Error applyDeclaration(IDirect3DDevice9 *device, TranslatedAttribute attributes[], gl::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[gl::MAX_VERTEX_ATTRIBS];
+    IDirect3DVertexDeclaration9 *mLastSetVDecl;
+    bool mInstancingEnabled;
+
+    struct VertexDeclCacheEntry
+    {
+        D3DVERTEXELEMENT9 cachedElements[gl::MAX_VERTEX_ATTRIBS + 1];
+        UINT lruCount;
+        IDirect3DVertexDeclaration9 *vertexDeclaration;
+    } mVertexDeclCache[NUM_VERTEX_DECL_CACHE_ENTRIES];
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXDECLARATIONCACHE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9formatutils9cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,602 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// formatutils9.cpp: Queries for GL image formats and their translations to D3D9
+// formats.
+
+#include &quot;libANGLE/renderer/d3d/copyimage.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/Renderer9.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/vertexconversion.h&quot;
+#include &quot;libANGLE/renderer/d3d/generatemip.h&quot;
+#include &quot;libANGLE/renderer/d3d/loadimage.h&quot;
+
+namespace rx
+{
+
+namespace d3d9
+{
+
+const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I', 'N', 'T', 'Z')));
+const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N', 'U', 'L', 'L')));
+
+struct D3D9FastCopyFormat
+{
+    GLenum destFormat;
+    GLenum destType;
+    ColorCopyFunction copyFunction;
+
+    D3D9FastCopyFormat(GLenum destFormat, GLenum destType, ColorCopyFunction copyFunction)
+        : destFormat(destFormat), destType(destType), copyFunction(copyFunction)
+    { }
+
+    bool operator&lt;(const D3D9FastCopyFormat&amp; other) const
+    {
+        return memcmp(this, &amp;other, sizeof(D3D9FastCopyFormat)) &lt; 0;
+    }
+};
+
+typedef std::multimap&lt;D3DFORMAT, D3D9FastCopyFormat&gt; D3D9FastCopyMap;
+
+static D3D9FastCopyMap BuildFastCopyMap()
+{
+    D3D9FastCopyMap map;
+
+    map.insert(std::make_pair(D3DFMT_A8R8G8B8, D3D9FastCopyFormat(GL_RGBA, GL_UNSIGNED_BYTE, CopyBGRA8ToRGBA8)));
+
+    return map;
+}
+
+// A map to determine the pixel size and mip generation function of a given D3D format
+typedef std::map&lt;D3DFORMAT, D3DFormat&gt; D3D9FormatInfoMap;
+
+D3DFormat::D3DFormat()
+    : pixelBytes(0),
+      blockWidth(0),
+      blockHeight(0),
+      redBits(0),
+      greenBits(0),
+      blueBits(0),
+      alphaBits(0),
+      luminanceBits(0),
+      depthBits(0),
+      stencilBits(0),
+      internalFormat(GL_NONE),
+      mipGenerationFunction(NULL),
+      colorReadFunction(NULL),
+      fastCopyFunctions()
+{
+}
+
+ColorCopyFunction D3DFormat::getFastCopyFunction(GLenum format, GLenum type) const
+{
+    FastCopyFunctionMap::const_iterator iter = fastCopyFunctions.find(std::make_pair(format, type));
+    return (iter != fastCopyFunctions.end()) ? iter-&gt;second : NULL;
+}
+
+static inline void InsertD3DFormatInfo(D3D9FormatInfoMap *map, D3DFORMAT format, GLuint bits, GLuint blockWidth,
+                                       GLuint blockHeight, GLuint redBits, GLuint greenBits, GLuint blueBits,
+                                       GLuint alphaBits, GLuint lumBits, GLuint depthBits, GLuint stencilBits,
+                                       GLenum internalFormat, MipGenerationFunction mipFunc,
+                                       ColorReadFunction colorReadFunc)
+{
+    D3DFormat info;
+    info.pixelBytes = bits / 8;
+    info.blockWidth = blockWidth;
+    info.blockHeight = blockHeight;
+    info.redBits = redBits;
+    info.greenBits = greenBits;
+    info.blueBits = blueBits;
+    info.alphaBits = alphaBits;
+    info.luminanceBits = lumBits;
+    info.depthBits = depthBits;
+    info.stencilBits = stencilBits;
+    info.internalFormat = internalFormat;
+    info.mipGenerationFunction = mipFunc;
+    info.colorReadFunction = colorReadFunc;
+
+    static const D3D9FastCopyMap fastCopyMap = BuildFastCopyMap();
+    std::pair&lt;D3D9FastCopyMap::const_iterator, D3D9FastCopyMap::const_iterator&gt; fastCopyIter = fastCopyMap.equal_range(format);
+    for (D3D9FastCopyMap::const_iterator i = fastCopyIter.first; i != fastCopyIter.second; i++)
+    {
+        info.fastCopyFunctions.insert(std::make_pair(std::make_pair(i-&gt;second.destFormat, i-&gt;second.destType), i-&gt;second.copyFunction));
+    }
+
+    map-&gt;insert(std::make_pair(format, info));
+}
+
+static D3D9FormatInfoMap BuildD3D9FormatInfoMap()
+{
+    D3D9FormatInfoMap map;
+
+    //                       | D3DFORMAT           | S  |W |H | R | G | B | A | L | D | S | Internal format                   | Mip generation function   | Color read function             |
+    InsertD3DFormatInfo(&amp;map, D3DFMT_NULL,            0, 0, 0,  0,  0,  0,  0,  0,  0,  0, GL_NONE,                            NULL,                       NULL                             );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_UNKNOWN,         0, 0, 0,  0,  0,  0,  0,  0,  0,  0, GL_NONE,                            NULL,                       NULL                             );
+
+    InsertD3DFormatInfo(&amp;map, D3DFMT_L8,              8, 1, 1,  0,  0,  0,  0,  8,  0,  0, GL_LUMINANCE8_EXT,                  GenerateMip&lt;L8&gt;,            ReadColor&lt;L8, GLfloat&gt;           );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_A8,              8, 1, 1,  0,  0,  0,  8,  0,  0,  0, GL_ALPHA8_EXT,                      GenerateMip&lt;A8&gt;,            ReadColor&lt;A8, GLfloat&gt;           );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_A8L8,           16, 1, 1,  0,  0,  0,  8,  8,  0,  0, GL_LUMINANCE8_ALPHA8_EXT,           GenerateMip&lt;A8L8&gt;,          ReadColor&lt;A8L8, GLfloat&gt;         );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_A4R4G4B4,       16, 1, 1,  4,  4,  4,  4,  0,  0,  0, GL_BGRA4_ANGLEX,                    GenerateMip&lt;B4G4R4A4&gt;,      ReadColor&lt;B4G4R4A4, GLfloat&gt;     );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_A1R5G5B5,       16, 1, 1,  5,  5,  5,  1,  0,  0,  0, GL_BGR5_A1_ANGLEX,                  GenerateMip&lt;B5G5R5A1&gt;,      ReadColor&lt;B5G5R5A1, GLfloat&gt;     );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_R5G6B5,         16, 1, 1,  5,  6,  5,  0,  0,  0,  0, GL_RGB565,                          GenerateMip&lt;R5G6B5&gt;,        ReadColor&lt;R5G6B5, GLfloat&gt;       );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_X8R8G8B8,       32, 1, 1,  8,  8,  8,  0,  0,  0,  0, GL_BGRA8_EXT,                       GenerateMip&lt;B8G8R8X8&gt;,      ReadColor&lt;B8G8R8X8, GLfloat&gt;     );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_A8R8G8B8,       32, 1, 1,  8,  8,  8,  8,  0,  0,  0, GL_BGRA8_EXT,                       GenerateMip&lt;B8G8R8A8&gt;,      ReadColor&lt;B8G8R8A8, GLfloat&gt;     );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_R16F,           16, 1, 1, 16,  0,  0,  0,  0,  0,  0, GL_R16F_EXT,                        GenerateMip&lt;R16F&gt;,          ReadColor&lt;R16F, GLfloat&gt;         );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_G16R16F,        32, 1, 1, 16, 16,  0,  0,  0,  0,  0, GL_RG16F_EXT,                       GenerateMip&lt;R16G16F&gt;,       ReadColor&lt;R16G16F, GLfloat&gt;      );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_A16B16G16R16F,  64, 1, 1, 16, 16, 16, 16,  0,  0,  0, GL_RGBA16F_EXT,                     GenerateMip&lt;R16G16B16A16F&gt;, ReadColor&lt;R16G16B16A16F, GLfloat&gt;);
+    InsertD3DFormatInfo(&amp;map, D3DFMT_R32F,           32, 1, 1, 32,  0,  0,  0,  0,  0,  0, GL_R32F_EXT,                        GenerateMip&lt;R32F&gt;,          ReadColor&lt;R32F, GLfloat&gt;         );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_G32R32F,        64, 1, 1, 32, 32,  0,  0,  0,  0,  0, GL_RG32F_EXT,                       GenerateMip&lt;R32G32F&gt;,       ReadColor&lt;R32G32F, GLfloat&gt;      );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_A32B32G32R32F, 128, 1, 1, 32, 32, 32, 32,  0,  0,  0, GL_RGBA32F_EXT,                     GenerateMip&lt;R32G32B32A32F&gt;, ReadColor&lt;R32G32B32A32F, GLfloat&gt;);
+
+    InsertD3DFormatInfo(&amp;map, D3DFMT_D16,            16, 1, 1,  0,  0,  0,  0,  0, 16,  0, GL_DEPTH_COMPONENT16,               NULL,                       NULL                             );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_D24S8,          32, 1, 1,  0,  0,  0,  0,  0, 24,  8, GL_DEPTH24_STENCIL8_OES,            NULL,                       NULL                             );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_D24X8,          32, 1, 1,  0,  0,  0,  0,  0, 24,  0, GL_DEPTH_COMPONENT16,               NULL,                       NULL                             );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_D32,            32, 1, 1,  0,  0,  0,  0,  0, 32,  0, GL_DEPTH_COMPONENT32_OES,           NULL,                       NULL                             );
+
+    InsertD3DFormatInfo(&amp;map, D3DFMT_INTZ,           32, 1, 1,  0,  0,  0,  0,  0, 24,  8, GL_DEPTH24_STENCIL8_OES,            NULL,                       NULL                             );
+
+    InsertD3DFormatInfo(&amp;map, D3DFMT_DXT1,           64, 4, 4,  0,  0,  0,  0,  0,  0,  0, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   NULL,                       NULL                             );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_DXT3,          128, 4, 4,  0,  0,  0,  0,  0,  0,  0, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, NULL,                       NULL                             );
+    InsertD3DFormatInfo(&amp;map, D3DFMT_DXT5,          128, 4, 4,  0,  0,  0,  0,  0,  0,  0, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, NULL,                       NULL                             );
+
+    return map;
+}
+
+const D3DFormat &amp;GetD3DFormatInfo(D3DFORMAT format)
+{
+    static const D3D9FormatInfoMap infoMap = BuildD3D9FormatInfoMap();
+    D3D9FormatInfoMap::const_iterator iter = infoMap.find(format);
+    if (iter != infoMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        static const D3DFormat defaultInfo;
+        return defaultInfo;
+    }
+}
+
+
+
+typedef std::pair&lt;GLint, InitializeTextureDataFunction&gt; InternalFormatInitialzerPair;
+typedef std::map&lt;GLint, InitializeTextureDataFunction&gt; InternalFormatInitialzerMap;
+
+static InternalFormatInitialzerMap BuildInternalFormatInitialzerMap()
+{
+    InternalFormatInitialzerMap map;
+
+    map.insert(InternalFormatInitialzerPair(GL_RGB16F, Initialize4ComponentData&lt;GLhalf,   0x0000,     0x0000,     0x0000,     gl::Float16One&gt;));
+    map.insert(InternalFormatInitialzerPair(GL_RGB32F, Initialize4ComponentData&lt;GLfloat,  0x00000000, 0x00000000, 0x00000000, gl::Float32One&gt;));
+
+    return map;
+}
+
+// Each GL internal format corresponds to one D3D format and data loading function.
+// Due to not all formats being available all the time, some of the function/format types are wrapped
+// in templates that perform format support queries on a Renderer9 object which is supplied
+// when requesting the function or format.
+
+typedef bool(*FallbackPredicateFunction)();
+
+template &lt;FallbackPredicateFunction pred, LoadImageFunction prefered, LoadImageFunction fallback&gt;
+static void FallbackLoad(size_t width, size_t height, size_t depth,
+                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    if (pred())
+    {
+        prefered(width, height, depth, input, inputRowPitch, inputDepthPitch, output, outputRowPitch, outputDepthPitch);
+    }
+    else
+    {
+        fallback(width, height, depth, input, inputRowPitch, inputDepthPitch, output, outputRowPitch, outputDepthPitch);
+    }
+}
+
+static void UnreachableLoad(size_t width, size_t height, size_t depth,
+                            const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                            uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    UNREACHABLE();
+}
+
+typedef std::pair&lt;GLenum, TextureFormat&gt; D3D9FormatPair;
+typedef std::map&lt;GLenum, TextureFormat&gt; D3D9FormatMap;
+
+TextureFormat::TextureFormat()
+    : texFormat(D3DFMT_UNKNOWN),
+      renderFormat(D3DFMT_UNKNOWN),
+      dataInitializerFunction(NULL),
+      loadFunction(UnreachableLoad)
+{
+}
+
+static inline void InsertD3D9FormatInfo(D3D9FormatMap *map, GLenum internalFormat, D3DFORMAT texFormat,
+                                        D3DFORMAT renderFormat, LoadImageFunction loadFunction)
+{
+    TextureFormat info;
+    info.texFormat = texFormat;
+    info.renderFormat = renderFormat;
+
+    static const InternalFormatInitialzerMap dataInitializationMap = BuildInternalFormatInitialzerMap();
+    InternalFormatInitialzerMap::const_iterator dataInitIter = dataInitializationMap.find(internalFormat);
+    info.dataInitializerFunction = (dataInitIter != dataInitializationMap.end()) ? dataInitIter-&gt;second : NULL;
+
+    info.loadFunction = loadFunction;
+
+    map-&gt;insert(std::make_pair(internalFormat, info));
+}
+
+static D3D9FormatMap BuildD3D9FormatMap()
+{
+    D3D9FormatMap map;
+
+    //                       | Internal format                     | Texture format      | Render format        | Load function                           |
+    InsertD3D9FormatInfo(&amp;map, GL_NONE,                             D3DFMT_NULL,          D3DFMT_NULL,           UnreachableLoad                          );
+
+    // We choose to downsample the GL_DEPTH_COMPONENT32_OES format to a 24-bit format because D3DFMT_D32 is not widely
+    // supported.  We're allowed to do this because:
+    //  - The ES spec 2.0.25 sec 3.7.1 states that we're allowed to store texture formats with internal format
+    //    resolutions of our own choosing.
+    //  - OES_depth_texture states that downsampling of the depth formats is allowed.
+    //  - ANGLE_depth_texture does not state minimum required resolutions of the depth texture formats it
+    //    introduces.
+    // In ES3 however, there are minimum resolutions for the texture formats and this would not be allowed.
+
+    InsertD3D9FormatInfo(&amp;map, GL_DEPTH_COMPONENT16,                D3DFMT_INTZ,          D3DFMT_D24S8,          UnreachableLoad                          );
+    InsertD3D9FormatInfo(&amp;map, GL_DEPTH_COMPONENT32_OES,            D3DFMT_INTZ,          D3DFMT_D24X8,          UnreachableLoad                          );
+    InsertD3D9FormatInfo(&amp;map, GL_DEPTH24_STENCIL8_OES,             D3DFMT_INTZ,          D3DFMT_D24S8,          UnreachableLoad                          );
+    InsertD3D9FormatInfo(&amp;map, GL_STENCIL_INDEX8,                   D3DFMT_UNKNOWN,       D3DFMT_D24S8,          UnreachableLoad                          ); // TODO: What's the texture format?
+
+    InsertD3D9FormatInfo(&amp;map, GL_RGBA32F_EXT,                      D3DFMT_A32B32G32R32F, D3DFMT_A32B32G32R32F,  LoadToNative&lt;GLfloat, 4&gt;                 );
+    InsertD3D9FormatInfo(&amp;map, GL_RGB32F_EXT,                       D3DFMT_A32B32G32R32F, D3DFMT_A32B32G32R32F,  LoadToNative3To4&lt;GLfloat, gl::Float32One&gt;);
+    InsertD3D9FormatInfo(&amp;map, GL_RG32F_EXT,                        D3DFMT_G32R32F,       D3DFMT_G32R32F,        LoadToNative&lt;GLfloat, 2&gt;                 );
+    InsertD3D9FormatInfo(&amp;map, GL_R32F_EXT,                         D3DFMT_R32F,          D3DFMT_R32F,           LoadToNative&lt;GLfloat, 1&gt;                 );
+    InsertD3D9FormatInfo(&amp;map, GL_ALPHA32F_EXT,                     D3DFMT_A32B32G32R32F, D3DFMT_UNKNOWN,        LoadA32FToRGBA32F                        );
+    InsertD3D9FormatInfo(&amp;map, GL_LUMINANCE32F_EXT,                 D3DFMT_A32B32G32R32F, D3DFMT_UNKNOWN,        LoadL32FToRGBA32F                        );
+    InsertD3D9FormatInfo(&amp;map, GL_LUMINANCE_ALPHA32F_EXT,           D3DFMT_A32B32G32R32F, D3DFMT_UNKNOWN,        LoadLA32FToRGBA32F                       );
+
+    InsertD3D9FormatInfo(&amp;map, GL_RGBA16F_EXT,                      D3DFMT_A16B16G16R16F, D3DFMT_A16B16G16R16F,  LoadToNative&lt;GLhalf, 4&gt;                  );
+    InsertD3D9FormatInfo(&amp;map, GL_RGB16F_EXT,                       D3DFMT_A16B16G16R16F, D3DFMT_A16B16G16R16F,  LoadToNative3To4&lt;GLhalf, gl::Float16One&gt; );
+    InsertD3D9FormatInfo(&amp;map, GL_RG16F_EXT,                        D3DFMT_G16R16F,       D3DFMT_G16R16F,        LoadToNative&lt;GLhalf, 2&gt;                  );
+    InsertD3D9FormatInfo(&amp;map, GL_R16F_EXT,                         D3DFMT_R16F,          D3DFMT_R16F,           LoadToNative&lt;GLhalf, 1&gt;                  );
+    InsertD3D9FormatInfo(&amp;map, GL_ALPHA16F_EXT,                     D3DFMT_A16B16G16R16F, D3DFMT_UNKNOWN,        LoadA16FToRGBA16F                        );
+    InsertD3D9FormatInfo(&amp;map, GL_LUMINANCE16F_EXT,                 D3DFMT_A16B16G16R16F, D3DFMT_UNKNOWN,        LoadL16FToRGBA16F                        );
+    InsertD3D9FormatInfo(&amp;map, GL_LUMINANCE_ALPHA16F_EXT,           D3DFMT_A16B16G16R16F, D3DFMT_UNKNOWN,        LoadLA16FToRGBA16F                       );
+
+    InsertD3D9FormatInfo(&amp;map, GL_ALPHA8_EXT,                       D3DFMT_A8R8G8B8,      D3DFMT_A8R8G8B8,       FallbackLoad&lt;gl::supportsSSE2, LoadA8ToBGRA8_SSE2, LoadA8ToBGRA8&gt;);
+
+    InsertD3D9FormatInfo(&amp;map, GL_RGB8_OES,                         D3DFMT_X8R8G8B8,      D3DFMT_X8R8G8B8,       LoadRGB8ToBGRX8                           );
+    InsertD3D9FormatInfo(&amp;map, GL_RGB565,                           D3DFMT_X8R8G8B8,      D3DFMT_X8R8G8B8,       LoadR5G6B5ToBGRA8                         );
+    InsertD3D9FormatInfo(&amp;map, GL_RGBA8_OES,                        D3DFMT_A8R8G8B8,      D3DFMT_A8R8G8B8,       FallbackLoad&lt;gl::supportsSSE2, LoadRGBA8ToBGRA8_SSE2, LoadRGBA8ToBGRA8&gt;);
+    InsertD3D9FormatInfo(&amp;map, GL_RGBA4,                            D3DFMT_A8R8G8B8,      D3DFMT_A8R8G8B8,       LoadRGBA4ToBGRA8                          );
+    InsertD3D9FormatInfo(&amp;map, GL_RGB5_A1,                          D3DFMT_A8R8G8B8,      D3DFMT_A8R8G8B8,       LoadRGB5A1ToBGRA8                         );
+    InsertD3D9FormatInfo(&amp;map, GL_R8_EXT,                           D3DFMT_X8R8G8B8,      D3DFMT_X8R8G8B8,       LoadR8ToBGRX8                             );
+    InsertD3D9FormatInfo(&amp;map, GL_RG8_EXT,                          D3DFMT_X8R8G8B8,      D3DFMT_X8R8G8B8,       LoadRG8ToBGRX8                            );
+
+    InsertD3D9FormatInfo(&amp;map, GL_BGRA8_EXT,                        D3DFMT_A8R8G8B8,      D3DFMT_A8R8G8B8,       LoadToNative&lt;GLubyte, 4&gt;                  );
+    InsertD3D9FormatInfo(&amp;map, GL_BGRA4_ANGLEX,                     D3DFMT_A8R8G8B8,      D3DFMT_A8R8G8B8,       LoadBGRA4ToBGRA8                          );
+    InsertD3D9FormatInfo(&amp;map, GL_BGR5_A1_ANGLEX,                   D3DFMT_A8R8G8B8,      D3DFMT_A8R8G8B8,       LoadBGR5A1ToBGRA8                         );
+
+    InsertD3D9FormatInfo(&amp;map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,     D3DFMT_DXT1,          D3DFMT_UNKNOWN,        LoadCompressedToNative&lt;4, 4,  8&gt;          );
+    InsertD3D9FormatInfo(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,    D3DFMT_DXT1,          D3DFMT_UNKNOWN,        LoadCompressedToNative&lt;4, 4,  8&gt;          );
+    InsertD3D9FormatInfo(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,  D3DFMT_DXT3,          D3DFMT_UNKNOWN,        LoadCompressedToNative&lt;4, 4, 16&gt;          );
+    InsertD3D9FormatInfo(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,  D3DFMT_DXT5,          D3DFMT_UNKNOWN,        LoadCompressedToNative&lt;4, 4, 16&gt;          );
+
+    // These formats require checking if the renderer supports D3DFMT_L8 or D3DFMT_A8L8 and
+    // then changing the format and loading function appropriately.
+    InsertD3D9FormatInfo(&amp;map, GL_LUMINANCE8_EXT,                   D3DFMT_L8,            D3DFMT_UNKNOWN,        LoadToNative&lt;GLubyte, 1&gt;                  );
+    InsertD3D9FormatInfo(&amp;map, GL_LUMINANCE8_ALPHA8_EXT,            D3DFMT_A8L8,          D3DFMT_UNKNOWN,        LoadToNative&lt;GLubyte, 2&gt;                  );
+
+    return map;
+}
+
+const TextureFormat &amp;GetTextureFormatInfo(GLenum internalFormat)
+{
+    static const D3D9FormatMap formatMap = BuildD3D9FormatMap();
+    D3D9FormatMap::const_iterator iter = formatMap.find(internalFormat);
+    if (iter != formatMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        static const TextureFormat defaultInfo;
+        return defaultInfo;
+    }
+}
+
+static GLenum GetDeclTypeComponentType(D3DDECLTYPE declType)
+{
+    switch (declType)
+    {
+      case D3DDECLTYPE_FLOAT1:   return GL_FLOAT;
+      case D3DDECLTYPE_FLOAT2:   return GL_FLOAT;
+      case D3DDECLTYPE_FLOAT3:   return GL_FLOAT;
+      case D3DDECLTYPE_FLOAT4:   return GL_FLOAT;
+      case D3DDECLTYPE_UBYTE4:   return GL_UNSIGNED_INT;
+      case D3DDECLTYPE_SHORT2:   return GL_INT;
+      case D3DDECLTYPE_SHORT4:   return GL_INT;
+      case D3DDECLTYPE_UBYTE4N:  return GL_UNSIGNED_NORMALIZED;
+      case D3DDECLTYPE_SHORT4N:  return GL_SIGNED_NORMALIZED;
+      case D3DDECLTYPE_USHORT4N: return GL_UNSIGNED_NORMALIZED;
+      case D3DDECLTYPE_SHORT2N:  return GL_SIGNED_NORMALIZED;
+      case D3DDECLTYPE_USHORT2N: return GL_UNSIGNED_NORMALIZED;
+      default: UNREACHABLE();    return GL_NONE;
+    }
+}
+
+// Attribute format conversion
+enum { NUM_GL_VERTEX_ATTRIB_TYPES = 6 };
+
+struct TranslationDescription
+{
+    DWORD capsFlag;
+    VertexFormat preferredConversion;
+    VertexFormat fallbackConversion;
+};
+
+// 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 &lt;GLenum GLType&gt; struct GLToCType { };
+
+template &lt;&gt; struct GLToCType&lt;GL_BYTE&gt;           { typedef GLbyte type;      };
+template &lt;&gt; struct GLToCType&lt;GL_UNSIGNED_BYTE&gt;  { typedef GLubyte type;     };
+template &lt;&gt; struct GLToCType&lt;GL_SHORT&gt;          { typedef GLshort type;     };
+template &lt;&gt; struct GLToCType&lt;GL_UNSIGNED_SHORT&gt; { typedef GLushort type;    };
+template &lt;&gt; struct GLToCType&lt;GL_FIXED&gt;          { typedef GLuint type;      };
+template &lt;&gt; struct GLToCType&lt;GL_FLOAT&gt;          { 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 &lt;unsigned int D3DType&gt; struct D3DToCType { };
+
+template &lt;&gt; struct D3DToCType&lt;D3DVT_FLOAT&gt; { typedef float type; };
+template &lt;&gt; struct D3DToCType&lt;D3DVT_SHORT&gt; { typedef short type; };
+template &lt;&gt; struct D3DToCType&lt;D3DVT_SHORT_NORM&gt; { typedef short type; };
+template &lt;&gt; struct D3DToCType&lt;D3DVT_UBYTE&gt; { typedef unsigned char type; };
+template &lt;&gt; struct D3DToCType&lt;D3DVT_UBYTE_NORM&gt; { typedef unsigned char type; };
+template &lt;&gt; struct D3DToCType&lt;D3DVT_USHORT_NORM&gt; { 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 &lt;unsigned int type, int size&gt; struct WidenRule { };
+
+template &lt;int size&gt; struct WidenRule&lt;D3DVT_FLOAT, size&gt;          : NoWiden&lt;size&gt; { };
+template &lt;int size&gt; struct WidenRule&lt;D3DVT_SHORT, size&gt;          : WidenToEven&lt;size&gt; { };
+template &lt;int size&gt; struct WidenRule&lt;D3DVT_SHORT_NORM, size&gt;     : WidenToEven&lt;size&gt; { };
+template &lt;int size&gt; struct WidenRule&lt;D3DVT_UBYTE, size&gt;          : WidenToFour&lt;size&gt; { };
+template &lt;int size&gt; struct WidenRule&lt;D3DVT_UBYTE_NORM, size&gt;     : WidenToFour&lt;size&gt; { };
+template &lt;int size&gt; struct WidenRule&lt;D3DVT_USHORT_NORM, size&gt;    : WidenToEven&lt;size&gt; { };
+
+// VertexTypeFlags encodes the D3DCAPS9::DeclType flag and vertex declaration flag for each D3D vertex type &amp; size combination.
+template &lt;unsigned int d3dtype, int size&gt; struct VertexTypeFlags { };
+
+template &lt;unsigned int _capflag, unsigned int _declflag&gt;
+struct VertexTypeFlagsHelper
+{
+    enum { capflag = _capflag };
+    enum { declflag = _declflag };
+};
+
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_FLOAT, 1&gt; : VertexTypeFlagsHelper&lt;0, D3DDECLTYPE_FLOAT1&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_FLOAT, 2&gt; : VertexTypeFlagsHelper&lt;0, D3DDECLTYPE_FLOAT2&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_FLOAT, 3&gt; : VertexTypeFlagsHelper&lt;0, D3DDECLTYPE_FLOAT3&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_FLOAT, 4&gt; : VertexTypeFlagsHelper&lt;0, D3DDECLTYPE_FLOAT4&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_SHORT, 2&gt; : VertexTypeFlagsHelper&lt;0, D3DDECLTYPE_SHORT2&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_SHORT, 4&gt; : VertexTypeFlagsHelper&lt;0, D3DDECLTYPE_SHORT4&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_SHORT_NORM, 2&gt; : VertexTypeFlagsHelper&lt;D3DDTCAPS_SHORT2N, D3DDECLTYPE_SHORT2N&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_SHORT_NORM, 4&gt; : VertexTypeFlagsHelper&lt;D3DDTCAPS_SHORT4N, D3DDECLTYPE_SHORT4N&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_UBYTE, 4&gt; : VertexTypeFlagsHelper&lt;D3DDTCAPS_UBYTE4, D3DDECLTYPE_UBYTE4&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_UBYTE_NORM, 4&gt; : VertexTypeFlagsHelper&lt;D3DDTCAPS_UBYTE4N, D3DDECLTYPE_UBYTE4N&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_USHORT_NORM, 2&gt; : VertexTypeFlagsHelper&lt;D3DDTCAPS_USHORT2N, D3DDECLTYPE_USHORT2N&gt; { };
+template &lt;&gt; struct VertexTypeFlags&lt;D3DVT_USHORT_NORM, 4&gt; : VertexTypeFlagsHelper&lt;D3DDTCAPS_USHORT4N, D3DDECLTYPE_USHORT4N&gt; { };
+
+
+// VertexTypeMapping maps GL type &amp; normalized flag to preferred and fallback D3D vertex types (as D3DVertexType enums).
+template &lt;GLenum GLtype, bool normalized&gt; struct VertexTypeMapping { };
+
+template &lt;D3DVertexType Preferred, D3DVertexType Fallback = Preferred&gt;
+struct VertexTypeMappingBase
+{
+    enum { preferred = Preferred };
+    enum { fallback = Fallback };
+};
+
+template &lt;&gt; struct VertexTypeMapping&lt;GL_BYTE, false&gt;                        : VertexTypeMappingBase&lt;D3DVT_SHORT&gt; { };                       // Cast
+template &lt;&gt; struct VertexTypeMapping&lt;GL_BYTE, true&gt;                         : VertexTypeMappingBase&lt;D3DVT_FLOAT&gt; { };                       // Normalize
+template &lt;&gt; struct VertexTypeMapping&lt;GL_UNSIGNED_BYTE, false&gt;               : VertexTypeMappingBase&lt;D3DVT_UBYTE, D3DVT_FLOAT&gt; { };          // Identity, Cast
+template &lt;&gt; struct VertexTypeMapping&lt;GL_UNSIGNED_BYTE, true&gt;                : VertexTypeMappingBase&lt;D3DVT_UBYTE_NORM, D3DVT_FLOAT&gt; { };     // Identity, Normalize
+template &lt;&gt; struct VertexTypeMapping&lt;GL_SHORT, false&gt;                       : VertexTypeMappingBase&lt;D3DVT_SHORT&gt; { };                       // Identity
+template &lt;&gt; struct VertexTypeMapping&lt;GL_SHORT, true&gt;                        : VertexTypeMappingBase&lt;D3DVT_SHORT_NORM, D3DVT_FLOAT&gt; { };     // Cast, Normalize
+template &lt;&gt; struct VertexTypeMapping&lt;GL_UNSIGNED_SHORT, false&gt;              : VertexTypeMappingBase&lt;D3DVT_FLOAT&gt; { };                       // Cast
+template &lt;&gt; struct VertexTypeMapping&lt;GL_UNSIGNED_SHORT, true&gt;               : VertexTypeMappingBase&lt;D3DVT_USHORT_NORM, D3DVT_FLOAT&gt; { };    // Cast, Normalize
+template &lt;bool normalized&gt; struct VertexTypeMapping&lt;GL_FIXED, normalized&gt;   : VertexTypeMappingBase&lt;D3DVT_FLOAT&gt; { };                       // FixedToFloat
+template &lt;bool normalized&gt; struct VertexTypeMapping&lt;GL_FLOAT, normalized&gt;   : VertexTypeMappingBase&lt;D3DVT_FLOAT&gt; { };                       // Identity
+
+
+// Given a GL type &amp; 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&lt;T,T&gt; knows it's an identity mapping).
+template &lt;GLenum fromType, bool normalized, unsigned int toType&gt;
+struct ConversionRule : Cast&lt;typename GLToCType&lt;fromType&gt;::type, typename D3DToCType&lt;toType&gt;::type&gt; { };
+
+// All conversions from normalized types to float use the Normalize operator.
+template &lt;GLenum fromType&gt; struct ConversionRule&lt;fromType, true, D3DVT_FLOAT&gt; : Normalize&lt;typename GLToCType&lt;fromType&gt;::type&gt; { };
+
+// Use a full specialization for this so that it preferentially matches ahead of the generic normalize-to-float rules.
+template &lt;&gt; struct ConversionRule&lt;GL_FIXED, true, D3DVT_FLOAT&gt;  : FixedToFloat&lt;GLint, 16&gt; { };
+template &lt;&gt; struct ConversionRule&lt;GL_FIXED, false, D3DVT_FLOAT&gt; : FixedToFloat&lt;GLint, 16&gt; { };
+
+// A 2-stage construction is used for DefaultVertexValues because float must use SimpleDefaultValues (i.e. 0/1)
+// whether it is normalized or not.
+template &lt;class T, bool normalized&gt; struct DefaultVertexValuesStage2 { };
+
+template &lt;class T&gt; struct DefaultVertexValuesStage2&lt;T, true&gt;  : NormalizedDefaultValues&lt;T&gt; { };
+template &lt;class T&gt; struct DefaultVertexValuesStage2&lt;T, false&gt; : SimpleDefaultValues&lt;T&gt; { };
+
+// Work out the default value rule for a D3D type (expressed as the C type) and
+template &lt;class T, bool normalized&gt; struct DefaultVertexValues : DefaultVertexValuesStage2&lt;T, normalized&gt; { };
+template &lt;bool normalized&gt; struct DefaultVertexValues&lt;float, normalized&gt; : SimpleDefaultValues&lt;float&gt; { };
+
+// 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 &lt;class T&gt; struct UsePreferred { enum { type = T::preferred }; };
+template &lt;class T&gt; 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 &lt;GLenum fromType, bool normalized, int size, template &lt;class T&gt; class PreferenceRule&gt;
+struct Converter
+    : VertexDataConverter&lt;typename GLToCType&lt;fromType&gt;::type,
+                          WidenRule&lt;PreferenceRule&lt; VertexTypeMapping&lt;fromType, normalized&gt; &gt;::type, size&gt;,
+                          ConversionRule&lt;fromType,
+                                         normalized,
+                                         PreferenceRule&lt; VertexTypeMapping&lt;fromType, normalized&gt; &gt;::type&gt;,
+                          DefaultVertexValues&lt;typename D3DToCType&lt;PreferenceRule&lt; VertexTypeMapping&lt;fromType, normalized&gt; &gt;::type&gt;::type, normalized &gt; &gt;
+{
+private:
+    enum { d3dtype = PreferenceRule&lt; VertexTypeMapping&lt;fromType, normalized&gt; &gt;::type };
+    enum { d3dsize = WidenRule&lt;d3dtype, size&gt;::finalWidth };
+
+public:
+    enum { capflag = VertexTypeFlags&lt;d3dtype, d3dsize&gt;::capflag };
+    enum { declflag = VertexTypeFlags&lt;d3dtype, d3dsize&gt;::declflag };
+};
+
+VertexFormat::VertexFormat()
+    : conversionType(VERTEX_CONVERT_NONE),
+      outputElementSize(0),
+      copyFunction(NULL),
+      nativeFormat(D3DDECLTYPE_UNUSED),
+      componentType(GL_NONE)
+{
+}
+
+// Initialize a TranslationInfo
+VertexFormat CreateVertexFormatInfo(bool identity, size_t elementSize, VertexCopyFunction copyFunc, D3DDECLTYPE nativeFormat)
+{
+    VertexFormat formatInfo;
+    formatInfo.conversionType = identity ? VERTEX_CONVERT_NONE : VERTEX_CONVERT_CPU;
+    formatInfo.outputElementSize = elementSize;
+    formatInfo.copyFunction = copyFunc;
+    formatInfo.nativeFormat = nativeFormat;
+    formatInfo.componentType = GetDeclTypeComponentType(nativeFormat);
+    return formatInfo;
+}
+
+#define TRANSLATION(type, norm, size, preferred)                                    \
+    CreateVertexFormatInfo                                                          \
+    (                                                                               \
+        Converter&lt;type, norm, size, preferred&gt;::identity,                           \
+        Converter&lt;type, norm, size, preferred&gt;::finalSize,                          \
+        Converter&lt;type, norm, size, preferred&gt;::convertArray,                       \
+        static_cast&lt;D3DDECLTYPE&gt;(Converter&lt;type, norm, size, preferred&gt;::declflag)  \
+    )
+
+#define TRANSLATION_FOR_TYPE_NORM_SIZE(type, norm, size)    \
+    {                                                       \
+        Converter&lt;type, norm, size, UsePreferred&gt;::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) }, \
+    }
+
+static inline unsigned int ComputeTypeIndex(GLenum type)
+{
+    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;
+    }
+}
+
+const VertexFormat &amp;GetVertexFormatInfo(DWORD supportedDeclTypes, const gl::VertexFormat &amp;vertexFormat)
+{
+    static bool initialized = false;
+    static DWORD initializedDeclTypes = 0;
+    static VertexFormat formatConverters[NUM_GL_VERTEX_ATTRIB_TYPES][2][4];
+    if (initializedDeclTypes != supportedDeclTypes)
+    {
+        const TranslationDescription translations[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)
+        };
+        for (unsigned int i = 0; i &lt; NUM_GL_VERTEX_ATTRIB_TYPES; i++)
+        {
+            for (unsigned int j = 0; j &lt; 2; j++)
+            {
+                for (unsigned int k = 0; k &lt; 4; k++)
+                {
+                    if (translations[i][j][k].capsFlag == 0 || (supportedDeclTypes &amp; translations[i][j][k].capsFlag) != 0)
+                    {
+                        formatConverters[i][j][k] = translations[i][j][k].preferredConversion;
+                    }
+                    else
+                    {
+                        formatConverters[i][j][k] = translations[i][j][k].fallbackConversion;
+                    }
+                }
+            }
+        }
+        initialized = true;
+        initializedDeclTypes = supportedDeclTypes;
+    }
+
+    // Pure integer attributes only supported in ES3.0
+    ASSERT(!vertexFormat.mPureInteger);
+    return formatConverters[ComputeTypeIndex(vertexFormat.mType)][vertexFormat.mNormalized][vertexFormat.mComponents - 1];
+}
+
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9formatutils9h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/formatutils9.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// formatutils9.h: Queries for GL image formats and their translations to D3D9
+// formats.
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
+
+#include &quot;libANGLE/renderer/d3d/formatutilsD3D.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &quot;common/platform.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+
+class Renderer9;
+
+namespace d3d9
+{
+
+typedef std::map&lt;std::pair&lt;GLenum, GLenum&gt;, ColorCopyFunction&gt; FastCopyFunctionMap;
+
+struct D3DFormat
+{
+    D3DFormat();
+
+    GLuint pixelBytes;
+    GLuint blockWidth;
+    GLuint blockHeight;
+
+    GLuint redBits;
+    GLuint greenBits;
+    GLuint blueBits;
+    GLuint alphaBits;
+    GLuint luminanceBits;
+
+    GLuint depthBits;
+    GLuint stencilBits;
+
+    GLenum internalFormat;
+
+    MipGenerationFunction mipGenerationFunction;
+    ColorReadFunction colorReadFunction;
+
+    FastCopyFunctionMap fastCopyFunctions;
+    ColorCopyFunction getFastCopyFunction(GLenum format, GLenum type) const;
+};
+const D3DFormat &amp;GetD3DFormatInfo(D3DFORMAT format);
+
+struct VertexFormat
+{
+    VertexFormat();
+
+    VertexConversionType conversionType;
+    size_t outputElementSize;
+    VertexCopyFunction copyFunction;
+    D3DDECLTYPE nativeFormat;
+    GLenum componentType;
+};
+const VertexFormat &amp;GetVertexFormatInfo(DWORD supportedDeclTypes, const gl::VertexFormat &amp;vertexFormat);
+
+struct TextureFormat
+{
+    TextureFormat();
+
+    D3DFORMAT texFormat;
+    D3DFORMAT renderFormat;
+
+    InitializeTextureDataFunction dataInitializerFunction;
+
+    LoadImageFunction loadFunction;
+};
+const TextureFormat &amp;GetTextureFormatInfo(GLenum internalFormat);
+
+}
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_FORMATUTILS9_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9renderer9_utilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,588 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+// renderer9_utils.cpp: Conversion functions and other utility routines
+// specific to the D3D9 renderer.
+
+#include &quot;libANGLE/renderer/d3d/d3d9/renderer9_utils.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/formatutils9.h&quot;
+#include &quot;libANGLE/renderer/d3d/FramebufferD3D.h&quot;
+#include &quot;libANGLE/renderer/Workarounds.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/renderer/d3d/d3d9/RenderTarget9.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/debug.h&quot;
+
+#include &quot;third_party/systeminfo/SystemInfo.h&quot;
+
+namespace rx
+{
+
+namespace gl_d3d9
+{
+
+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::ColorF color)
+{
+    return D3DCOLOR_RGBA(gl::unorm&lt;8&gt;(color.red),
+                         gl::unorm&lt;8&gt;(color.green),
+                         gl::unorm&lt;8&gt;(color.blue),
+                         gl::unorm&lt;8&gt;(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;
+      case GL_MIN_EXT:               d3dBlendOp = D3DBLENDOP_MIN;         break;
+      case GL_MAX_EXT:               d3dBlendOp = D3DBLENDOP_MAX;         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, float maxAnisotropy)
+{
+    if (maxAnisotropy &gt; 1.0f)
+    {
+        return D3DTEXF_ANISOTROPIC;
+    }
+
+    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, float maxAnisotropy)
+{
+    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();
+    }
+
+    if (maxAnisotropy &gt; 1.0f)
+    {
+        *d3dMinFilter = D3DTEXF_ANISOTROPIC;
+    }
+}
+
+D3DMULTISAMPLE_TYPE GetMultisampleType(GLuint samples)
+{
+    return (samples &gt; 1) ? static_cast&lt;D3DMULTISAMPLE_TYPE&gt;(samples) : D3DMULTISAMPLE_NONE;
+}
+
+}
+
+namespace d3d9_gl
+{
+
+GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type)
+{
+    return (type != D3DMULTISAMPLE_NONMASKABLE) ? type : 0;
+}
+
+bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format)
+{
+    GLenum internalFormat = d3d9::GetD3DFormatInfo(d3dformat).internalFormat;
+    GLenum convertedFormat = gl::GetInternalFormatInfo(internalFormat).format;
+    return convertedFormat == format;
+}
+
+static gl::TextureCaps GenerateTextureFormatCaps(GLenum internalFormat, IDirect3D9 *d3d9, D3DDEVTYPE deviceType,
+                                                 UINT adapter, D3DFORMAT adapterFormat)
+{
+    gl::TextureCaps textureCaps;
+
+    const d3d9::TextureFormat &amp;d3dFormatInfo = d3d9::GetTextureFormatInfo(internalFormat);
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalFormat);
+
+    if (d3dFormatInfo.texFormat != D3DFMT_UNKNOWN)
+    {
+        if (formatInfo.depthBits &gt; 0 || formatInfo.stencilBits &gt; 0)
+        {
+            textureCaps.texturable = SUCCEEDED(d3d9-&gt;CheckDeviceFormat(adapter, deviceType, adapterFormat, 0, D3DRTYPE_TEXTURE, d3dFormatInfo.texFormat));
+        }
+        else
+        {
+            textureCaps.texturable = SUCCEEDED(d3d9-&gt;CheckDeviceFormat(adapter, deviceType, adapterFormat, 0, D3DRTYPE_TEXTURE, d3dFormatInfo.texFormat)) &amp;&amp;
+                                     SUCCEEDED(d3d9-&gt;CheckDeviceFormat(adapter, deviceType, adapterFormat, 0, D3DRTYPE_CUBETEXTURE, d3dFormatInfo.texFormat));
+        }
+
+        textureCaps.filterable = SUCCEEDED(d3d9-&gt;CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_QUERY_FILTER, D3DRTYPE_TEXTURE, d3dFormatInfo.texFormat));
+    }
+
+    if (d3dFormatInfo.renderFormat != D3DFMT_UNKNOWN)
+    {
+        textureCaps.renderable = SUCCEEDED(d3d9-&gt;CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
+
+        if ((formatInfo.depthBits &gt; 0 || formatInfo.stencilBits &gt; 0) &amp;&amp; !textureCaps.renderable)
+        {
+            textureCaps.renderable = SUCCEEDED(d3d9-&gt;CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
+        }
+
+        textureCaps.sampleCounts.insert(1);
+        for (size_t i = D3DMULTISAMPLE_2_SAMPLES; i &lt;= D3DMULTISAMPLE_16_SAMPLES; i++)
+        {
+            D3DMULTISAMPLE_TYPE multisampleType = D3DMULTISAMPLE_TYPE(i);
+
+            HRESULT result = d3d9-&gt;CheckDeviceMultiSampleType(adapter, deviceType, d3dFormatInfo.renderFormat, TRUE, multisampleType, NULL);
+            if (SUCCEEDED(result))
+            {
+                textureCaps.sampleCounts.insert(i);
+            }
+        }
+    }
+
+    return textureCaps;
+}
+
+void GenerateCaps(IDirect3D9 *d3d9, IDirect3DDevice9 *device, D3DDEVTYPE deviceType, UINT adapter, gl::Caps *caps,
+                  gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions)
+{
+    D3DCAPS9 deviceCaps;
+    if (FAILED(d3d9-&gt;GetDeviceCaps(adapter, deviceType, &amp;deviceCaps)))
+    {
+        // Can't continue with out device caps
+        return;
+    }
+
+    D3DDISPLAYMODE currentDisplayMode;
+    d3d9-&gt;GetAdapterDisplayMode(adapter, &amp;currentDisplayMode);
+
+    GLuint maxSamples = 0;
+    const gl::FormatSet &amp;allFormats = gl::GetAllSizedInternalFormats();
+    for (gl::FormatSet::const_iterator internalFormat = allFormats.begin(); internalFormat != allFormats.end(); ++internalFormat)
+    {
+        gl::TextureCaps textureCaps = GenerateTextureFormatCaps(*internalFormat, d3d9, deviceType, adapter,
+                                                                currentDisplayMode.Format);
+        textureCapsMap-&gt;insert(*internalFormat, textureCaps);
+
+        maxSamples = std::max(maxSamples, textureCaps.getMaxSamples());
+
+        if (gl::GetInternalFormatInfo(*internalFormat).compressed)
+        {
+            caps-&gt;compressedTextureFormats.push_back(*internalFormat);
+        }
+    }
+
+    // GL core feature limits
+    caps-&gt;maxElementIndex = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;unsigned int&gt;::max());
+
+    // 3D textures are unimplemented in D3D9
+    caps-&gt;max3DTextureSize = 1;
+
+    // Only one limit in GL, use the minimum dimension
+    caps-&gt;max2DTextureSize = std::min(deviceCaps.MaxTextureWidth, deviceCaps.MaxTextureHeight);
+
+    // D3D treats cube maps as a special case of 2D textures
+    caps-&gt;maxCubeMapTextureSize = caps-&gt;max2DTextureSize;
+
+    // Array textures are not available in D3D9
+    caps-&gt;maxArrayTextureLayers = 1;
+
+    // ES3-only feature
+    caps-&gt;maxLODBias = 0.0f;
+
+    // No specific limits on render target size, maximum 2D texture size is equivalent
+    caps-&gt;maxRenderbufferSize = caps-&gt;max2DTextureSize;
+
+    // Draw buffers are not supported in D3D9
+    caps-&gt;maxDrawBuffers = 1;
+    caps-&gt;maxColorAttachments = 1;
+
+    // No specific limits on viewport size, maximum 2D texture size is equivalent
+    caps-&gt;maxViewportWidth = caps-&gt;max2DTextureSize;
+    caps-&gt;maxViewportHeight = caps-&gt;maxViewportWidth;
+
+    // Point size is clamped to 1.0f when the shader model is less than 3
+    caps-&gt;minAliasedPointSize = 1.0f;
+    caps-&gt;maxAliasedPointSize = ((D3DSHADER_VERSION_MAJOR(deviceCaps.PixelShaderVersion) &gt;= 3) ? deviceCaps.MaxPointSize : 1.0f);
+
+    // Wide lines not supported
+    caps-&gt;minAliasedLineWidth = 1.0f;
+    caps-&gt;maxAliasedLineWidth = 1.0f;
+
+    // Primitive count limits (unused in ES2)
+    caps-&gt;maxElementsIndices = 0;
+    caps-&gt;maxElementsVertices = 0;
+
+    // Program and shader binary formats (no supported shader binary formats)
+    caps-&gt;programBinaryFormats.push_back(GL_PROGRAM_BINARY_ANGLE);
+
+    caps-&gt;vertexHighpFloat.setIEEEFloat();
+    caps-&gt;vertexMediumpFloat.setIEEEFloat();
+    caps-&gt;vertexLowpFloat.setIEEEFloat();
+    caps-&gt;fragmentHighpFloat.setIEEEFloat();
+    caps-&gt;fragmentMediumpFloat.setIEEEFloat();
+    caps-&gt;fragmentLowpFloat.setIEEEFloat();
+
+    // Some (most) hardware only supports single-precision floating-point numbers,
+    // which can accurately represent integers up to +/-16777216
+    caps-&gt;vertexHighpInt.setSimulatedInt(24);
+    caps-&gt;vertexMediumpInt.setSimulatedInt(24);
+    caps-&gt;vertexLowpInt.setSimulatedInt(24);
+    caps-&gt;fragmentHighpInt.setSimulatedInt(24);
+    caps-&gt;fragmentMediumpInt.setSimulatedInt(24);
+    caps-&gt;fragmentLowpInt.setSimulatedInt(24);
+
+    // WaitSync is ES3-only, set to zero
+    caps-&gt;maxServerWaitTimeout = 0;
+
+    // Vertex shader limits
+    caps-&gt;maxVertexAttributes = 16;
+
+    const size_t reservedVertexUniformVectors = 2; // dx_ViewAdjust and dx_DepthRange.
+    const size_t MAX_VERTEX_CONSTANT_VECTORS_D3D9 = 256;
+    caps-&gt;maxVertexUniformVectors = MAX_VERTEX_CONSTANT_VECTORS_D3D9 - reservedVertexUniformVectors;
+    caps-&gt;maxVertexUniformComponents = caps-&gt;maxVertexUniformVectors * 4;
+
+    caps-&gt;maxVertexUniformBlocks = 0;
+
+    // SM3 only supports 11 output variables, with a special 12th register for PSIZE.
+    const size_t MAX_VERTEX_OUTPUT_VECTORS_SM3 = 9;
+    const size_t MAX_VERTEX_OUTPUT_VECTORS_SM2 = 7;
+    caps-&gt;maxVertexOutputComponents = ((deviceCaps.VertexShaderVersion &gt;= D3DVS_VERSION(3, 0)) ? MAX_VERTEX_OUTPUT_VECTORS_SM3
+                                                                                               : MAX_VERTEX_OUTPUT_VECTORS_SM2) * 4;
+
+    // Only Direct3D 10 ready devices support all the necessary vertex texture formats.
+    // We test this using D3D9 by checking support for the R16F format.
+    if (deviceCaps.VertexShaderVersion &gt;= D3DVS_VERSION(3, 0) &amp;&amp;
+        SUCCEEDED(d3d9-&gt;CheckDeviceFormat(adapter, deviceType, currentDisplayMode.Format,
+                                          D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F)))
+    {
+        const size_t MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4;
+        caps-&gt;maxVertexTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS_VTF_SM3;
+    }
+    else
+    {
+        caps-&gt;maxVertexTextureImageUnits = 0;
+    }
+
+    // Fragment shader limits
+    const size_t reservedPixelUniformVectors = 3; // dx_ViewCoords, dx_DepthFront and dx_DepthRange.
+
+    const size_t MAX_PIXEL_CONSTANT_VECTORS_SM3 = 224;
+    const size_t MAX_PIXEL_CONSTANT_VECTORS_SM2 = 32;
+    caps-&gt;maxFragmentUniformVectors = ((deviceCaps.PixelShaderVersion &gt;= D3DPS_VERSION(3, 0)) ? MAX_PIXEL_CONSTANT_VECTORS_SM3
+                                                                                              : MAX_PIXEL_CONSTANT_VECTORS_SM2) - reservedPixelUniformVectors;
+    caps-&gt;maxFragmentUniformComponents = caps-&gt;maxFragmentUniformVectors * 4;
+    caps-&gt;maxFragmentUniformBlocks = 0;
+    caps-&gt;maxFragmentInputComponents = caps-&gt;maxVertexOutputComponents;
+    caps-&gt;maxTextureImageUnits = 16;
+    caps-&gt;minProgramTexelOffset = 0;
+    caps-&gt;maxProgramTexelOffset = 0;
+
+    // Aggregate shader limits (unused in ES2)
+    caps-&gt;maxUniformBufferBindings = 0;
+    caps-&gt;maxUniformBlockSize = 0;
+    caps-&gt;uniformBufferOffsetAlignment = 0;
+    caps-&gt;maxCombinedUniformBlocks = 0;
+    caps-&gt;maxCombinedVertexUniformComponents = 0;
+    caps-&gt;maxCombinedFragmentUniformComponents = 0;
+    caps-&gt;maxVaryingComponents = 0;
+
+    // Aggregate shader limits
+    caps-&gt;maxVaryingVectors = caps-&gt;maxVertexOutputComponents / 4;
+    caps-&gt;maxCombinedTextureImageUnits = caps-&gt;maxVertexTextureImageUnits + caps-&gt;maxTextureImageUnits;
+
+    // Transform feedback limits
+    caps-&gt;maxTransformFeedbackInterleavedComponents = 0;
+    caps-&gt;maxTransformFeedbackSeparateAttributes = 0;
+    caps-&gt;maxTransformFeedbackSeparateComponents = 0;
+
+    // Multisample limits
+    caps-&gt;maxSamples = maxSamples;
+
+    // GL extension support
+    extensions-&gt;setTextureExtensionSupport(*textureCapsMap);
+    extensions-&gt;elementIndexUint = deviceCaps.MaxVertexIndex &gt;= (1 &lt;&lt; 16);
+    extensions-&gt;packedDepthStencil = true;
+    extensions-&gt;getProgramBinary = true;
+    extensions-&gt;rgb8rgba8 = true;
+    extensions-&gt;readFormatBGRA = true;
+    extensions-&gt;pixelBufferObject = false;
+    extensions-&gt;mapBuffer = false;
+    extensions-&gt;mapBufferRange = false;
+
+    // textureRG is emulated and not performant.
+    extensions-&gt;textureRG = false;
+
+    D3DADAPTER_IDENTIFIER9 adapterId = { 0 };
+    if (SUCCEEDED(d3d9-&gt;GetAdapterIdentifier(adapter, 0, &amp;adapterId)))
+    {
+        // ATI cards on XP have problems with non-power-of-two textures.
+        extensions-&gt;textureNPOT = !(deviceCaps.TextureCaps &amp; D3DPTEXTURECAPS_POW2) &amp;&amp;
+                                      !(deviceCaps.TextureCaps &amp; D3DPTEXTURECAPS_CUBEMAP_POW2) &amp;&amp;
+                                      !(deviceCaps.TextureCaps &amp; D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &amp;&amp;
+                                      !(!isWindowsVistaOrGreater() &amp;&amp; adapterId.VendorId == VENDOR_ID_AMD);
+
+        // Disable depth texture support on AMD cards (See ANGLE issue 839)
+        if (adapterId.VendorId == VENDOR_ID_AMD)
+        {
+            extensions-&gt;depthTextures = false;
+        }
+    }
+    else
+    {
+        extensions-&gt;textureNPOT = false;
+    }
+
+    extensions-&gt;drawBuffers = false;
+    extensions-&gt;textureStorage = true;
+
+    // Must support a minimum of 2:1 anisotropy for max anisotropy to be considered supported, per the spec
+    extensions-&gt;textureFilterAnisotropic = (deviceCaps.RasterCaps &amp; D3DPRASTERCAPS_ANISOTROPY) != 0 &amp;&amp; deviceCaps.MaxAnisotropy &gt;= 2;
+    extensions-&gt;maxTextureAnisotropy = static_cast&lt;GLfloat&gt;(deviceCaps.MaxAnisotropy);
+
+    // Check occlusion query support by trying to create one
+    IDirect3DQuery9 *occlusionQuery = NULL;
+    extensions-&gt;occlusionQueryBoolean = SUCCEEDED(device-&gt;CreateQuery(D3DQUERYTYPE_OCCLUSION, &amp;occlusionQuery)) &amp;&amp; occlusionQuery;
+    SafeRelease(occlusionQuery);
+
+    // Check event query support by trying to create one
+    IDirect3DQuery9 *eventQuery = NULL;
+    extensions-&gt;fence = SUCCEEDED(device-&gt;CreateQuery(D3DQUERYTYPE_EVENT, &amp;eventQuery)) &amp;&amp; eventQuery;
+    SafeRelease(eventQuery);
+
+    extensions-&gt;timerQuery = false; // Unimplemented
+    extensions-&gt;robustness = true;
+    extensions-&gt;blendMinMax = true;
+    extensions-&gt;framebufferBlit = true;
+    extensions-&gt;framebufferMultisample = true;
+    extensions-&gt;instancedArrays = deviceCaps.PixelShaderVersion &gt;= D3DPS_VERSION(3, 0);
+    extensions-&gt;packReverseRowOrder = true;
+    extensions-&gt;standardDerivatives = (deviceCaps.PS20Caps.Caps &amp; D3DPS20CAPS_GRADIENTINSTRUCTIONS) != 0;
+    extensions-&gt;shaderTextureLOD = true;
+    extensions-&gt;fragDepth = true;
+    extensions-&gt;textureUsage = true;
+    extensions-&gt;translatedShaderSource = true;
+    extensions-&gt;fboRenderMipmap = false;
+    extensions-&gt;colorBufferFloat = false;
+}
+
+}
+
+namespace d3d9
+{
+
+GLuint ComputeBlockSize(D3DFORMAT format, GLuint width, GLuint height)
+{
+    const D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(format);
+    GLuint numBlocksWide = (width + d3dFormatInfo.blockWidth - 1) / d3dFormatInfo.blockWidth;
+    GLuint numBlocksHight = (height + d3dFormatInfo.blockHeight - 1) / d3dFormatInfo.blockHeight;
+    return (d3dFormatInfo.pixelBytes * numBlocksWide * numBlocksHight);
+}
+
+void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset)
+{
+    const D3DFormat &amp;d3dFormatInfo = d3d9::GetD3DFormatInfo(format);
+
+    int upsampleCount = 0;
+    // Don't expand the size of full textures that are at least (blockWidth x blockHeight) already.
+    if (isImage || *requestWidth &lt; static_cast&lt;GLsizei&gt;(d3dFormatInfo.blockWidth) ||
+        *requestHeight &lt; static_cast&lt;GLsizei&gt;(d3dFormatInfo.blockHeight))
+    {
+        while (*requestWidth % d3dFormatInfo.blockWidth != 0 || *requestHeight % d3dFormatInfo.blockHeight != 0)
+        {
+            *requestWidth &lt;&lt;= 1;
+            *requestHeight &lt;&lt;= 1;
+            upsampleCount++;
+        }
+    }
+    *levelOffset = upsampleCount;
+}
+
+Workarounds GenerateWorkarounds()
+{
+    Workarounds workarounds;
+    workarounds.mrtPerfWorkaround = true;
+    workarounds.setDataFasterThanImageUpload = false;
+    workarounds.useInstancedPointSpriteEmulation = false;
+    return workarounds;
+}
+
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9renderer9_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+//
+// Copyright (c) 2002-2014 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.
+//
+
+// renderer9_utils.h: Conversion functions and other utility routines
+// specific to the D3D9 renderer
+
+#ifndef LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+namespace gl
+{
+class FramebufferAttachment;
+}
+
+namespace rx
+{
+class RenderTarget9;
+struct Workarounds;
+
+namespace gl_d3d9
+{
+
+D3DCMPFUNC ConvertComparison(GLenum comparison);
+D3DCOLOR ConvertColor(gl::ColorF 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, float maxAnisotropy);
+void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy);
+
+D3DMULTISAMPLE_TYPE GetMultisampleType(GLuint samples);
+
+}
+
+namespace d3d9_gl
+{
+
+GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type);
+
+bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
+
+void GenerateCaps(IDirect3D9 *d3d9, IDirect3DDevice9 *device, D3DDEVTYPE deviceType, UINT adapter, gl::Caps *caps,
+                  gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions);
+
+}
+
+namespace d3d9
+{
+
+GLuint ComputeBlockSize(D3DFORMAT format, GLuint width, GLuint height);
+
+void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset);
+
+inline bool isDeviceLostError(HRESULT errorCode)
+{
+    switch (errorCode)
+    {
+      case D3DERR_DRIVERINTERNALERROR:
+      case D3DERR_DEVICELOST:
+      case D3DERR_DEVICEHUNG:
+      case D3DERR_DEVICEREMOVED:
+        return true;
+      default:
+        return false;
+    }
+}
+
+Workarounds GenerateWorkarounds();
+
+}
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_D3D9_RENDERER9UTILS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shadersBlitps"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.ps        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+//
+// 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.
+//
+
+sampler2D tex : s0;
+
+uniform float4 mult : c0;
+uniform float4 add  : c1;
+
+// Passthrough Pixel Shader
+// Outputs texture 0 sampled at texcoord 0.
+float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
+{
+    return tex2D(tex, texcoord.xy);
+};
+
+// Luminance Conversion Pixel Shader
+// Performs a mad operation using the LA data from the texture with mult.xw and add.xw.
+// Returns data in the form of llla
+float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
+{
+    return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
+};
+
+// RGB/A Component Mask Pixel Shader
+// Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw.
+// Returns data in the form of rgba
+float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
+{
+    return tex2D(tex, texcoord.xy) * mult + add;
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shadersBlitvs"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/Blit.vs        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+//
+// 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.
+//
+
+struct VS_OUTPUT
+{
+    float4 position : POSITION;
+    float4 texcoord : TEXCOORD0;
+};
+
+uniform float4 halfPixelSize : c0;
+
+// 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.
+VS_OUTPUT standardvs(in float4 position : POSITION)
+{
+    VS_OUTPUT Out;
+
+    Out.position = position + halfPixelSize;
+    Out.texcoord = position * float4(0.5, -0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);
+
+    return Out;
+};
+
+// 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.
+VS_OUTPUT flipyvs(in float4 position : POSITION)
+{
+    VS_OUTPUT Out;
+
+    Out.position = position + halfPixelSize;
+    Out.texcoord = position * float4(0.5, 0.5, 1.0, 1.0) + float4(0.5, 0.5, 0, 0);
+
+    return Out;
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledcomponentmaskpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+//   float4 add;
+//   float4 mult;
+//   sampler2D tex;
+//
+//
+// Registers:
+//
+//   Name         Reg   Size
+//   ------------ ----- ----
+//   mult         c0       1
+//   add          c1       1
+//   tex          s0       1
+//
+
+    ps_2_0
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mov r1, c0
+    mad r0, r0, r1, c1
+    mov oC0, r0
+
+// approximately 4 instruction slots used (1 texture, 3 arithmetic)
+#endif
+
+const BYTE g_ps20_componentmaskps[] =
+{
+      0,   2, 255, 255, 254, 255, 
+     50,   0,  67,  84,  65,  66, 
+     28,   0,   0,   0, 143,   0, 
+      0,   0,   0,   2, 255, 255, 
+      3,   0,   0,   0,  28,   0, 
+      0,   0,   0,   1,   0,   0, 
+    136,   0,   0,   0,  88,   0, 
+      0,   0,   2,   0,   1,   0, 
+      1,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+    108,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0, 113,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0, 120,   0,   0,   0, 
+      0,   0,   0,   0,  97, 100, 
+    100,   0,   1,   0,   3,   0, 
+      1,   0,   4,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+    109, 117, 108, 116,   0, 116, 
+    101, 120,   0, 171, 171, 171, 
+      4,   0,  12,   0,   1,   0, 
+      1,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0, 112, 115, 
+     95,  50,  95,  48,   0,  77, 
+    105,  99, 114, 111, 115, 111, 
+    102, 116,  32,  40,  82,  41, 
+     32,  72,  76,  83,  76,  32, 
+     83, 104,  97, 100, 101, 114, 
+     32,  67, 111, 109, 112, 105, 
+    108, 101, 114,  32,  54,  46, 
+     51,  46,  57,  54,  48,  48, 
+     46,  49,  54,  51,  56,  52, 
+      0, 171, 171, 171,  31,   0, 
+      0,   2,   0,   0,   0, 128, 
+      0,   0,   3, 176,  31,   0, 
+      0,   2,   0,   0,   0, 144, 
+      0,   8,  15, 160,  66,   0, 
+      0,   3,   0,   0,  15, 128, 
+      0,   0, 228, 176,   0,   8, 
+    228, 160,   1,   0,   0,   2, 
+      1,   0,  15, 128,   0,   0, 
+    228, 160,   4,   0,   0,   4, 
+      0,   0,  15, 128,   0,   0, 
+    228, 128,   1,   0, 228, 128, 
+      1,   0, 228, 160,   1,   0, 
+      0,   2,   0,   8,  15, 128, 
+      0,   0, 228, 128, 255, 255, 
+      0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledflipyvsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+//   float4 halfPixelSize;
+//
+//
+// Registers:
+//
+//   Name          Reg   Size
+//   ------------- ----- ----
+//   halfPixelSize c0       1
+//
+
+    vs_2_0
+    def c1, 0.5, 1, 0, 0
+    dcl_position v0
+    add oPos, v0, c0
+    mad oT0, v0, c1.xxyy, c1.xxzz
+
+// approximately 2 instruction slots used
+#endif
+
+const BYTE g_vs20_flipyvs[] =
+{
+      0,   2, 254, 255, 254, 255, 
+     36,   0,  67,  84,  65,  66, 
+     28,   0,   0,   0,  87,   0, 
+      0,   0,   0,   2, 254, 255, 
+      1,   0,   0,   0,  28,   0, 
+      0,   0,   0,   1,   0,   0, 
+     80,   0,   0,   0,  48,   0, 
+      0,   0,   2,   0,   0,   0, 
+      1,   0,   0,   0,  64,   0, 
+      0,   0,   0,   0,   0,   0, 
+    104,  97, 108, 102,  80, 105, 
+    120, 101, 108,  83, 105, 122, 
+    101,   0, 171, 171,   1,   0, 
+      3,   0,   1,   0,   4,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0, 118, 115,  95,  50, 
+     95,  48,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+    171, 171,  81,   0,   0,   5, 
+      1,   0,  15, 160,   0,   0, 
+      0,  63,   0,   0, 128,  63, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  31,   0,   0,   2, 
+      0,   0,   0, 128,   0,   0, 
+     15, 144,   2,   0,   0,   3, 
+      0,   0,  15, 192,   0,   0, 
+    228, 144,   0,   0, 228, 160, 
+      4,   0,   0,   4,   0,   0, 
+     15, 224,   0,   0, 228, 144, 
+      1,   0,  80, 160,   1,   0, 
+    160, 160, 255, 255,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledluminancepsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+//   float4 add;
+//   float4 mult;
+//   sampler2D tex;
+//
+//
+// Registers:
+//
+//   Name         Reg   Size
+//   ------------ ----- ----
+//   mult         c0       1
+//   add          c1       1
+//   tex          s0       1
+//
+
+    ps_2_0
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mov r1.xw, c0
+    mad r0.x, r0.x, r1.x, c1.x
+    mad r0.y, r0.w, r1.w, c1.w
+    mov r1.xyz, r0.x
+    mov r1.w, r0.y
+    mov oC0, r1
+
+// approximately 7 instruction slots used (1 texture, 6 arithmetic)
+#endif
+
+const BYTE g_ps20_luminanceps[] =
+{
+      0,   2, 255, 255, 254, 255, 
+     50,   0,  67,  84,  65,  66, 
+     28,   0,   0,   0, 143,   0, 
+      0,   0,   0,   2, 255, 255, 
+      3,   0,   0,   0,  28,   0, 
+      0,   0,   0,   1,   0,   0, 
+    136,   0,   0,   0,  88,   0, 
+      0,   0,   2,   0,   1,   0, 
+      1,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+    108,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0, 113,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0, 120,   0,   0,   0, 
+      0,   0,   0,   0,  97, 100, 
+    100,   0,   1,   0,   3,   0, 
+      1,   0,   4,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+    109, 117, 108, 116,   0, 116, 
+    101, 120,   0, 171, 171, 171, 
+      4,   0,  12,   0,   1,   0, 
+      1,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0, 112, 115, 
+     95,  50,  95,  48,   0,  77, 
+    105,  99, 114, 111, 115, 111, 
+    102, 116,  32,  40,  82,  41, 
+     32,  72,  76,  83,  76,  32, 
+     83, 104,  97, 100, 101, 114, 
+     32,  67, 111, 109, 112, 105, 
+    108, 101, 114,  32,  54,  46, 
+     51,  46,  57,  54,  48,  48, 
+     46,  49,  54,  51,  56,  52, 
+      0, 171, 171, 171,  31,   0, 
+      0,   2,   0,   0,   0, 128, 
+      0,   0,   3, 176,  31,   0, 
+      0,   2,   0,   0,   0, 144, 
+      0,   8,  15, 160,  66,   0, 
+      0,   3,   0,   0,  15, 128, 
+      0,   0, 228, 176,   0,   8, 
+    228, 160,   1,   0,   0,   2, 
+      1,   0,   9, 128,   0,   0, 
+    228, 160,   4,   0,   0,   4, 
+      0,   0,   1, 128,   0,   0, 
+      0, 128,   1,   0,   0, 128, 
+      1,   0,   0, 160,   4,   0, 
+      0,   4,   0,   0,   2, 128, 
+      0,   0, 255, 128,   1,   0, 
+    255, 128,   1,   0, 255, 160, 
+      1,   0,   0,   2,   1,   0, 
+      7, 128,   0,   0,   0, 128, 
+      1,   0,   0,   2,   1,   0, 
+      8, 128,   0,   0,  85, 128, 
+      1,   0,   0,   2,   0,   8, 
+     15, 128,   1,   0, 228, 128, 
+    255, 255,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledpassthroughpsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+//   sampler2D tex;
+//
+//
+// Registers:
+//
+//   Name         Reg   Size
+//   ------------ ----- ----
+//   tex          s0       1
+//
+
+    ps_2_0
+    dcl t0.xy
+    dcl_2d s0
+    texld r0, t0, s0
+    mov oC0, r0
+
+// approximately 2 instruction slots used (1 texture, 1 arithmetic)
+#endif
+
+const BYTE g_ps20_passthroughps[] =
+{
+      0,   2, 255, 255, 254, 255, 
+     33,   0,  67,  84,  65,  66, 
+     28,   0,   0,   0,  75,   0, 
+      0,   0,   0,   2, 255, 255, 
+      1,   0,   0,   0,  28,   0, 
+      0,   0,   0,   1,   0,   0, 
+     68,   0,   0,   0,  48,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,  52,   0, 
+      0,   0,   0,   0,   0,   0, 
+    116, 101, 120,   0,   4,   0, 
+     12,   0,   1,   0,   1,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0, 112, 115,  95,  50, 
+     95,  48,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+    171, 171,  31,   0,   0,   2, 
+      0,   0,   0, 128,   0,   0, 
+      3, 176,  31,   0,   0,   2, 
+      0,   0,   0, 144,   0,   8, 
+     15, 160,  66,   0,   0,   3, 
+      0,   0,  15, 128,   0,   0, 
+    228, 176,   0,   8, 228, 160, 
+      1,   0,   0,   2,   0,   8, 
+     15, 128,   0,   0, 228, 128, 
+    255, 255,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shaderscompiledstandardvsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
+//
+// Parameters:
+//
+//   float4 halfPixelSize;
+//
+//
+// Registers:
+//
+//   Name          Reg   Size
+//   ------------- ----- ----
+//   halfPixelSize c0       1
+//
+
+    vs_2_0
+    def c1, 0.5, -0.5, 1, 0
+    dcl_position v0
+    add oPos, v0, c0
+    mad oT0, v0, c1.xyzz, c1.xxww
+
+// approximately 2 instruction slots used
+#endif
+
+const BYTE g_vs20_standardvs[] =
+{
+      0,   2, 254, 255, 254, 255, 
+     36,   0,  67,  84,  65,  66, 
+     28,   0,   0,   0,  87,   0, 
+      0,   0,   0,   2, 254, 255, 
+      1,   0,   0,   0,  28,   0, 
+      0,   0,   0,   1,   0,   0, 
+     80,   0,   0,   0,  48,   0, 
+      0,   0,   2,   0,   0,   0, 
+      1,   0,   0,   0,  64,   0, 
+      0,   0,   0,   0,   0,   0, 
+    104,  97, 108, 102,  80, 105, 
+    120, 101, 108,  83, 105, 122, 
+    101,   0, 171, 171,   1,   0, 
+      3,   0,   1,   0,   4,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0, 118, 115,  95,  50, 
+     95,  48,   0,  77, 105,  99, 
+    114, 111, 115, 111, 102, 116, 
+     32,  40,  82,  41,  32,  72, 
+     76,  83,  76,  32,  83, 104, 
+     97, 100, 101, 114,  32,  67, 
+    111, 109, 112, 105, 108, 101, 
+    114,  32,  54,  46,  51,  46, 
+     57,  54,  48,  48,  46,  49, 
+     54,  51,  56,  52,   0, 171, 
+    171, 171,  81,   0,   0,   5, 
+      1,   0,  15, 160,   0,   0, 
+      0,  63,   0,   0,   0, 191, 
+      0,   0, 128,  63,   0,   0, 
+      0,   0,  31,   0,   0,   2, 
+      0,   0,   0, 128,   0,   0, 
+     15, 144,   2,   0,   0,   3, 
+      0,   0,  15, 192,   0,   0, 
+    228, 144,   0,   0, 228, 160, 
+      4,   0,   0,   4,   0,   0, 
+     15, 224,   0,   0, 228, 144, 
+      1,   0, 164, 160,   1,   0, 
+    240, 160, 255, 255,   0,   0
+};
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9shadersgenerate_shadersbat"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/generate_shaders.bat (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/generate_shaders.bat                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/shaders/generate_shaders.bat        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+@ECHO OFF
+REM
+REM Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+REM Use of this source code is governed by a BSD-style license that can be
+REM found in the LICENSE file.
+REM
+
+PATH %PATH%;%ProgramFiles(x86)%\Windows Kits\8.1\bin\x86;%DXSDK_DIR%\Utilities\bin\x86
+
+setlocal
+set errorCount=0
+set successCount=0
+set debug=0
+
+if &quot;%1&quot; == &quot;debug&quot; (
+    set debug=1
+)
+if &quot;%1&quot; == &quot;release&quot; (
+    set debug=0
+)
+
+::              | Input file          | Entry point           | Type | Output file                        | Debug |
+call:BuildShader Blit.vs               standardvs              vs_2_0 compiled\standardvs.h                %debug%
+call:BuildShader Blit.vs               flipyvs                 vs_2_0 compiled\flipyvs.h                   %debug%
+call:BuildShader Blit.ps               passthroughps           ps_2_0 compiled\passthroughps.h             %debug%
+call:BuildShader Blit.ps               luminanceps             ps_2_0 compiled\luminanceps.h               %debug%
+call:BuildShader Blit.ps               componentmaskps         ps_2_0 compiled\componentmaskps.h           %debug%
+
+echo.
+
+if %successCount% GTR 0 (
+   echo %successCount% shaders compiled successfully.
+)
+if %errorCount% GTR 0 (
+   echo There were %errorCount% shader compilation errors.
+)
+
+endlocal
+exit /b
+
+:BuildShader
+set input=%~1
+set entry=%~2
+set type=%~3
+set output=%~4
+set debug=%~5
+
+if %debug% == 0 (
+    set &quot;buildCMD=fxc /nologo /E %entry% /T %type% /Fh %output% %input%&quot;
+) else (
+    set &quot;buildCMD=fxc /nologo /Zi /Od /E %entry% /T %type% /Fh %output% %input%&quot;
+)
+
+set error=0
+%buildCMD% || set error=1
+
+if %error% == 0 (
+    set /a successCount=%successCount%+1
+) else (
+    set /a errorCount=%errorCount%+1
+)
+
+exit /b
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dd3d9vertexconversionh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/d3d9/vertexconversion.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,197 @@
</span><ins>+//
+// 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 LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
+#define LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
+
+#include &lt;limits&gt;
+#include &lt;cstdint&gt;
+#include &lt;cstddef&gt;
+
+namespace rx
+{
+
+// 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 &lt;class T&gt;
+struct Identity
+{
+    static const bool identity = true;
+
+    typedef T OutputType;
+
+    static T convert(T x)
+    {
+        return x;
+    }
+};
+
+template &lt;class FromT, class ToT&gt;
+struct Cast
+{
+    static const bool identity = false;
+
+    typedef ToT OutputType;
+
+    static ToT convert(FromT x)
+    {
+        return static_cast&lt;ToT&gt;(x);
+    }
+};
+
+template &lt;class T&gt;
+struct Cast&lt;T, T&gt;
+{
+    static const bool identity = true;
+
+    typedef T OutputType;
+
+    static T convert(T x)
+    {
+        return static_cast&lt;T&gt;(x);
+    }
+};
+
+template &lt;class T&gt;
+struct Normalize
+{
+    static const bool identity = false;
+
+    typedef float OutputType;
+
+    static float convert(T x)
+    {
+        typedef std::numeric_limits&lt;T&gt; NL;
+        float f = static_cast&lt;float&gt;(x);
+
+        if (NL::is_signed)
+        {
+            // const float =&gt; VC2008 computes it at compile time
+            // static const float =&gt; 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&lt;float&gt;(NL::max())+1);
+            return (2*f+1)*divisor;
+        }
+        else
+        {
+            return f/NL::max();
+        }
+    }
+};
+
+template &lt;class FromType, std::size_t ScaleBits&gt;
+struct FixedToFloat
+{
+    static const bool identity = false;
+
+    typedef float OutputType;
+
+    static float convert(FromType x)
+    {
+        const float divisor = 1.0f / static_cast&lt;float&gt;(static_cast&lt;FromType&gt;(1) &lt;&lt; ScaleBits);
+        return static_cast&lt;float&gt;(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 &lt;std::size_t N&gt;
+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 &lt;std::size_t N&gt;
+struct WidenToEven
+{
+    static const std::size_t initialWidth = N;
+    static const std::size_t finalWidth = N+(N&amp;1);
+};
+
+template &lt;std::size_t N&gt;
+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 &lt;class T&gt;
+struct SimpleDefaultValues
+{
+    static T zero() { return static_cast&lt;T&gt;(0); }
+    static T one() { return static_cast&lt;T&gt;(1); }
+};
+
+// But normalised types only store [0,1] or [-1,1] so 1.0 is represented by the max value.
+template &lt;class T&gt;
+struct NormalizedDefaultValues
+{
+    static T zero() { return static_cast&lt;T&gt;(0); }
+    static T one() { return std::numeric_limits&lt;T&gt;::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 &lt;class InT, class WidenRule, class Converter, class DefaultValueRule = SimpleDefaultValues&lt;InT&gt; &gt;
+struct VertexDataConverter
+{
+    typedef typename Converter::OutputType OutputType;
+    typedef InT InputType;
+
+    static const bool identity = (WidenRule::initialWidth == WidenRule::finalWidth) &amp;&amp; Converter::identity;
+    static const std::size_t finalSize = WidenRule::finalWidth * sizeof(OutputType);
+
+    static void convertArray(const uint8_t *input, size_t stride, size_t n, uint8_t *output)
+    {
+        OutputType *out = reinterpret_cast&lt;OutputType*&gt;(output);
+
+        for (std::size_t i = 0; i &lt; n; i++)
+        {
+            const InputType *ein = reinterpret_cast&lt;const InputType*&gt;(input + i * stride);
+
+            copyComponent(out, ein, 0, static_cast&lt;OutputType&gt;(DefaultValueRule::zero()));
+            copyComponent(out, ein, 1, static_cast&lt;OutputType&gt;(DefaultValueRule::zero()));
+            copyComponent(out, ein, 2, static_cast&lt;OutputType&gt;(DefaultValueRule::zero()));
+            copyComponent(out, ein, 3, static_cast&lt;OutputType&gt;(DefaultValueRule::one()));
+
+            out += WidenRule::finalWidth;
+        }
+    }
+
+  private:
+    static void copyComponent(OutputType *out, const InputType *in, std::size_t elementindex, OutputType defaultvalue)
+    {
+        if (WidenRule::finalWidth &gt; elementindex)
+        {
+            if (WidenRule::initialWidth &gt; elementindex)
+            {
+                out[elementindex] = Converter::convert(in[elementindex]);
+            }
+            else
+            {
+                out[elementindex] = defaultvalue;
+            }
+        }
+    }
+};
+
+}
+
+#endif   // LIBANGLE_RENDERER_D3D_D3D9_VERTEXCONVERSION_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dformatutilsD3Dcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,147 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// formatutils9.cpp: Queries for GL image formats and their translations to D3D
+// formats.
+
+#include &quot;libANGLE/renderer/d3d/formatutilsD3D.h&quot;
+
+#include &lt;map&gt;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/d3d/imageformats.h&quot;
+#include &quot;libANGLE/renderer/d3d/copyimage.h&quot;
+
+namespace rx
+{
+
+typedef std::pair&lt;GLenum, GLenum&gt; FormatTypePair;
+typedef std::pair&lt;FormatTypePair, ColorWriteFunction&gt; FormatWriteFunctionPair;
+typedef std::map&lt;FormatTypePair, ColorWriteFunction&gt; FormatWriteFunctionMap;
+
+static inline void InsertFormatWriteFunctionMapping(FormatWriteFunctionMap *map, GLenum format, GLenum type,
+                                                    ColorWriteFunction writeFunc)
+{
+    map-&gt;insert(FormatWriteFunctionPair(FormatTypePair(format, type), writeFunc));
+}
+
+static FormatWriteFunctionMap BuildFormatWriteFunctionMap()
+{
+    FormatWriteFunctionMap map;
+
+    //                                    | Format               | Type                             | Color write function             |
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8B8A8, GLfloat&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_BYTE,                           WriteColor&lt;R8G8B8A8S, GLfloat&gt;    );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_4_4_4_4,         WriteColor&lt;R4G4B4A4, GLfloat&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_5_5_5_1,         WriteColor&lt;R5G5B5A1, GLfloat&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_INT_2_10_10_10_REV,    WriteColor&lt;R10G10B10A2, GLfloat&gt;  );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_FLOAT,                          WriteColor&lt;R32G32B32A32F, GLfloat&gt;);
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_HALF_FLOAT,                     WriteColor&lt;R16G16B16A16F, GLfloat&gt;);
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA,               GL_HALF_FLOAT_OES,                 WriteColor&lt;R16G16B16A16F, GLfloat&gt;);
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8B8A8, GLuint&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA_INTEGER,       GL_BYTE,                           WriteColor&lt;R8G8B8A8S, GLint&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_SHORT,                 WriteColor&lt;R16G16B16A16, GLuint&gt;  );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA_INTEGER,       GL_SHORT,                          WriteColor&lt;R16G16B16A16S, GLint&gt;  );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_INT,                   WriteColor&lt;R32G32B32A32, GLuint&gt;  );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA_INTEGER,       GL_INT,                            WriteColor&lt;R32G32B32A32S, GLint&gt;  );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_INT_2_10_10_10_REV,    WriteColor&lt;R10G10B10A2, GLuint&gt;   );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8B8, GLfloat&gt;       );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_BYTE,                           WriteColor&lt;R8G8B8S, GLfloat&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_UNSIGNED_SHORT_5_6_5,           WriteColor&lt;R5G6B5, GLfloat&gt;       );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_UNSIGNED_INT_10F_11F_11F_REV,   WriteColor&lt;R11G11B10F, GLfloat&gt;   );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_UNSIGNED_INT_5_9_9_9_REV,       WriteColor&lt;R9G9B9E5, GLfloat&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_FLOAT,                          WriteColor&lt;R32G32B32F, GLfloat&gt;   );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_HALF_FLOAT,                     WriteColor&lt;R16G16B16F, GLfloat&gt;   );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB,                GL_HALF_FLOAT_OES,                 WriteColor&lt;R16G16B16F, GLfloat&gt;   );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8B8, GLuint&gt;        );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB_INTEGER,        GL_BYTE,                           WriteColor&lt;R8G8B8S, GLint&gt;        );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_SHORT,                 WriteColor&lt;R16G16B16, GLuint&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB_INTEGER,        GL_SHORT,                          WriteColor&lt;R16G16B16S, GLint&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_INT,                   WriteColor&lt;R32G32B32, GLuint&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RGB_INTEGER,        GL_INT,                            WriteColor&lt;R32G32B32S, GLint&gt;     );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG,                 GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG,                 GL_BYTE,                           WriteColor&lt;R8G8S, GLfloat&gt;        );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG,                 GL_FLOAT,                          WriteColor&lt;R32G32F, GLfloat&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG,                 GL_HALF_FLOAT,                     WriteColor&lt;R16G16F, GLfloat&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG,                 GL_HALF_FLOAT_OES,                 WriteColor&lt;R16G16F, GLfloat&gt;      );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8, GLuint&gt;          );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG_INTEGER,         GL_BYTE,                           WriteColor&lt;R8G8S, GLint&gt;          );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_SHORT,                 WriteColor&lt;R16G16, GLuint&gt;        );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG_INTEGER,         GL_SHORT,                          WriteColor&lt;R16G16S, GLint&gt;        );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_INT,                   WriteColor&lt;R32G32, GLuint&gt;        );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RG_INTEGER,         GL_INT,                            WriteColor&lt;R32G32S, GLint&gt;        );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED,                GL_UNSIGNED_BYTE,                  WriteColor&lt;R8, GLfloat&gt;           );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED,                GL_BYTE,                           WriteColor&lt;R8S, GLfloat&gt;          );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED,                GL_FLOAT,                          WriteColor&lt;R32F, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED,                GL_HALF_FLOAT,                     WriteColor&lt;R16F, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED,                GL_HALF_FLOAT_OES,                 WriteColor&lt;R16F, GLfloat&gt;         );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_BYTE,                  WriteColor&lt;R8, GLuint&gt;            );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED_INTEGER,        GL_BYTE,                           WriteColor&lt;R8S, GLint&gt;            );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_SHORT,                 WriteColor&lt;R16, GLuint&gt;           );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED_INTEGER,        GL_SHORT,                          WriteColor&lt;R16S, GLint&gt;           );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_INT,                   WriteColor&lt;R32, GLuint&gt;           );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_RED_INTEGER,        GL_INT,                            WriteColor&lt;R32S, GLint&gt;           );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_UNSIGNED_BYTE,                  WriteColor&lt;L8A8, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE,          GL_UNSIGNED_BYTE,                  WriteColor&lt;L8, GLfloat&gt;           );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_ALPHA,              GL_UNSIGNED_BYTE,                  WriteColor&lt;A8, GLfloat&gt;           );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_FLOAT,                          WriteColor&lt;L32A32F, GLfloat&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE,          GL_FLOAT,                          WriteColor&lt;L32F, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_ALPHA,              GL_FLOAT,                          WriteColor&lt;A32F, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_HALF_FLOAT,                     WriteColor&lt;L16A16F, GLfloat&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_HALF_FLOAT_OES,                 WriteColor&lt;L16A16F, GLfloat&gt;      );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE,          GL_HALF_FLOAT,                     WriteColor&lt;L16F, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_LUMINANCE,          GL_HALF_FLOAT_OES,                 WriteColor&lt;L16F, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_ALPHA,              GL_HALF_FLOAT,                     WriteColor&lt;A16F, GLfloat&gt;         );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_ALPHA,              GL_HALF_FLOAT_OES,                 WriteColor&lt;A16F, GLfloat&gt;         );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_BYTE,                  WriteColor&lt;B8G8R8A8, GLfloat&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, WriteColor&lt;B4G4R4A4, GLfloat&gt;     );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, WriteColor&lt;B5G5R5A1, GLfloat&gt;     );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_SRGB_EXT,           GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8B8, GLfloat&gt;       );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_SRGB_ALPHA_EXT,     GL_UNSIGNED_BYTE,                  WriteColor&lt;R8G8B8A8, GLfloat&gt;     );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    GL_UNSIGNED_BYTE,     NULL                              );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   GL_UNSIGNED_BYTE,     NULL                              );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE,     NULL                              );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE,     NULL                              );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_UNSIGNED_SHORT,                 NULL                              );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_UNSIGNED_INT,                   NULL                              );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_FLOAT,                          NULL                              );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_STENCIL,            GL_UNSIGNED_BYTE,                  NULL                              );
+
+    InsertFormatWriteFunctionMapping(&amp;map, GL_DEPTH_STENCIL,      GL_UNSIGNED_INT_24_8,              NULL                              );
+    InsertFormatWriteFunctionMapping(&amp;map, GL_DEPTH_STENCIL,      GL_FLOAT_32_UNSIGNED_INT_24_8_REV, NULL                              );
+
+    return map;
+}
+
+ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type)
+{
+    static const FormatWriteFunctionMap formatTypeMap = BuildFormatWriteFunctionMap();
+    FormatWriteFunctionMap::const_iterator iter = formatTypeMap.find(FormatTypePair(format, type));
+    ASSERT(iter != formatTypeMap.end());
+    if (iter != formatTypeMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dformatutilsD3Dh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/formatutilsD3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// formatutils9.h: Queries for GL image formats and their translations to D3D
+// formats.
+
+#ifndef LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
+#define LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
+
+#include &quot;angle_gl.h&quot;
+
+#include &lt;cstddef&gt;
+#include &lt;stdint.h&gt;
+
+namespace rx
+{
+
+typedef void (*MipGenerationFunction)(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                                      const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                                      uint8_t *destData, size_t destRowPitch, size_t destDepthPitch);
+
+typedef void (*LoadImageFunction)(size_t width, size_t height, size_t depth,
+                                  const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                                  uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+typedef void (*InitializeTextureDataFunction)(size_t width, size_t height, size_t depth,
+                                              uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+typedef void (*ColorReadFunction)(const uint8_t *source, uint8_t *dest);
+typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest);
+typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest);
+
+typedef void (*VertexCopyFunction)(const uint8_t *input, size_t stride, size_t count, uint8_t *output);
+
+enum VertexConversionType
+{
+    VERTEX_CONVERT_NONE = 0,
+    VERTEX_CONVERT_CPU = 1,
+    VERTEX_CONVERT_GPU = 2,
+    VERTEX_CONVERT_BOTH = 3
+};
+
+ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type);
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_FORMATUTILSD3D_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dgeneratemiph"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// generatemip.h: Defines the GenerateMip function, templated on the format
+// type of the image for which mip levels are being generated.
+
+#ifndef LIBANGLE_RENDERER_D3D_GENERATEMIP_H_
+#define LIBANGLE_RENDERER_D3D_GENERATEMIP_H_
+
+#include &quot;libANGLE/renderer/d3d/imageformats.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+
+namespace rx
+{
+
+template &lt;typename T&gt;
+inline void GenerateMip(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                        const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                        uint8_t *destData, size_t destRowPitch, size_t destDepthPitch);
+
+}
+
+#include &quot;generatemip.inl&quot;
+
+#endif // LIBANGLE_RENDERER_D3D_GENERATEMIP_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dgeneratemipinl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.inl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.inl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/generatemip.inl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,266 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// generatemip.inl: Defines the GenerateMip function, templated on the format
+// type of the image for which mip levels are being generated.
+
+#include &quot;common/mathutil.h&quot;
+
+namespace rx
+{
+
+namespace priv
+{
+
+template &lt;typename T&gt;
+static inline T *GetPixel(uint8_t *data, size_t x, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+    return reinterpret_cast&lt;T*&gt;(data + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
+
+template &lt;typename T&gt;
+static inline const T *GetPixel(const uint8_t *data, size_t x, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+    return reinterpret_cast&lt;const T*&gt;(data + (x * sizeof(T)) + (y * rowPitch) + (z * depthPitch));
+}
+
+template &lt;typename T&gt;
+static void GenerateMip_Y(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                          const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                          size_t destWidth, size_t destHeight, size_t destDepth,
+                          uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    ASSERT(sourceWidth == 1);
+    ASSERT(sourceHeight &gt; 1);
+    ASSERT(sourceDepth == 1);
+
+    for (size_t y = 0; y &lt; destHeight; y++)
+    {
+        const T *src0 = GetPixel&lt;T&gt;(sourceData, 0, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+        const T *src1 = GetPixel&lt;T&gt;(sourceData, 0, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+        T *dst = GetPixel&lt;T&gt;(destData, 0, y, 0, destRowPitch, destDepthPitch);
+
+        T::average(dst, src0, src1);
+    }
+}
+
+template &lt;typename T&gt;
+static void GenerateMip_X(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                          const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                          size_t destWidth, size_t destHeight, size_t destDepth,
+                          uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    ASSERT(sourceWidth &gt; 1);
+    ASSERT(sourceHeight == 1);
+    ASSERT(sourceDepth == 1);
+
+    for (size_t x = 0; x &lt; destWidth; x++)
+    {
+        const T *src0 = GetPixel&lt;T&gt;(sourceData, x * 2, 0, 0, sourceRowPitch, sourceDepthPitch);
+        const T *src1 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, 0, 0, sourceRowPitch, sourceDepthPitch);
+        T *dst = GetPixel&lt;T&gt;(destData, x, 0, 0, destRowPitch, destDepthPitch);
+
+        T::average(dst, src0, src1);
+    }
+}
+
+template &lt;typename T&gt;
+static void GenerateMip_Z(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                          const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                          size_t destWidth, size_t destHeight, size_t destDepth,
+                          uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    ASSERT(sourceWidth == 1);
+    ASSERT(sourceHeight == 1);
+    ASSERT(sourceDepth &gt; 1);
+
+    for (size_t z = 0; z &lt; destDepth; z++)
+    {
+        const T *src0 = GetPixel&lt;T&gt;(sourceData, 0, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+        const T *src1 = GetPixel&lt;T&gt;(sourceData, 0, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+        T *dst = GetPixel&lt;T&gt;(destData, 0, 0, z, destRowPitch, destDepthPitch);
+
+        T::average(dst, src0, src1);
+    }
+}
+
+template &lt;typename T&gt;
+static void GenerateMip_XY(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                           const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                           size_t destWidth, size_t destHeight, size_t destDepth,
+                           uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    ASSERT(sourceWidth &gt; 1);
+    ASSERT(sourceHeight &gt; 1);
+    ASSERT(sourceDepth == 1);
+
+    for (size_t y = 0; y &lt; destHeight; y++)
+    {
+        for (size_t x = 0; x &lt; destWidth; x++)
+        {
+            const T *src0 = GetPixel&lt;T&gt;(sourceData, x * 2, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+            const T *src1 = GetPixel&lt;T&gt;(sourceData, x * 2, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+            const T *src2 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, y * 2, 0, sourceRowPitch, sourceDepthPitch);
+            const T *src3 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, y * 2 + 1, 0, sourceRowPitch, sourceDepthPitch);
+            T *dst = GetPixel&lt;T&gt;(destData, x, y, 0, destRowPitch, destDepthPitch);
+
+            T tmp0, tmp1;
+
+            T::average(&amp;tmp0, src0, src1);
+            T::average(&amp;tmp1, src2, src3);
+            T::average(dst, &amp;tmp0, &amp;tmp1);
+        }
+    }
+}
+
+template &lt;typename T&gt;
+static void GenerateMip_YZ(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                           const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                           size_t destWidth, size_t destHeight, size_t destDepth,
+                           uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    ASSERT(sourceWidth == 1);
+    ASSERT(sourceHeight &gt; 1);
+    ASSERT(sourceDepth &gt; 1);
+
+    for (size_t z = 0; z &lt; destDepth; z++)
+    {
+        for (size_t y = 0; y &lt; destHeight; y++)
+        {
+            const T *src0 = GetPixel&lt;T&gt;(sourceData, 0, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+            const T *src1 = GetPixel&lt;T&gt;(sourceData, 0, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+            const T *src2 = GetPixel&lt;T&gt;(sourceData, 0, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+            const T *src3 = GetPixel&lt;T&gt;(sourceData, 0, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+            T *dst = GetPixel&lt;T&gt;(destData, 0, y, z, destRowPitch, destDepthPitch);
+
+            T tmp0, tmp1;
+
+            T::average(&amp;tmp0, src0, src1);
+            T::average(&amp;tmp1, src2, src3);
+            T::average(dst, &amp;tmp0, &amp;tmp1);
+        }
+    }
+}
+
+template &lt;typename T&gt;
+static void GenerateMip_XZ(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                           const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                           size_t destWidth, size_t destHeight, size_t destDepth,
+                           uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    ASSERT(sourceWidth &gt; 1);
+    ASSERT(sourceHeight == 1);
+    ASSERT(sourceDepth &gt; 1);
+
+    for (size_t z = 0; z &lt; destDepth; z++)
+    {
+        for (size_t x = 0; x &lt; destWidth; x++)
+        {
+            const T *src0 = GetPixel&lt;T&gt;(sourceData, x * 2, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+            const T *src1 = GetPixel&lt;T&gt;(sourceData, x * 2, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+            const T *src2 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, 0, z * 2, sourceRowPitch, sourceDepthPitch);
+            const T *src3 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, 0, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+            T *dst = GetPixel&lt;T&gt;(destData, x, 0, z, destRowPitch, destDepthPitch);
+
+            T tmp0, tmp1;
+
+            T::average(&amp;tmp0, src0, src1);
+            T::average(&amp;tmp1, src2, src3);
+            T::average(dst, &amp;tmp0, &amp;tmp1);
+        }
+    }
+}
+
+template &lt;typename T&gt;
+static void GenerateMip_XYZ(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                            const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                            size_t destWidth, size_t destHeight, size_t destDepth,
+                            uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    ASSERT(sourceWidth &gt; 1);
+    ASSERT(sourceHeight &gt; 1);
+    ASSERT(sourceDepth &gt; 1);
+
+    for (size_t z = 0; z &lt; destDepth; z++)
+    {
+        for (size_t y = 0; y &lt; destHeight; y++)
+        {
+            for (size_t x = 0; x &lt; destWidth; x++)
+            {
+                const T *src0 = GetPixel&lt;T&gt;(sourceData, x * 2, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+                const T *src1 = GetPixel&lt;T&gt;(sourceData, x * 2, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+                const T *src2 = GetPixel&lt;T&gt;(sourceData, x * 2, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+                const T *src3 = GetPixel&lt;T&gt;(sourceData, x * 2, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+                const T *src4 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, y * 2, z * 2, sourceRowPitch, sourceDepthPitch);
+                const T *src5 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, y * 2, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+                const T *src6 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, y * 2 + 1, z * 2, sourceRowPitch, sourceDepthPitch);
+                const T *src7 = GetPixel&lt;T&gt;(sourceData, x * 2 + 1, y * 2 + 1, z * 2 + 1, sourceRowPitch, sourceDepthPitch);
+                T *dst = GetPixel&lt;T&gt;(destData, x, y, z, destRowPitch, destDepthPitch);
+
+                T tmp0, tmp1, tmp2, tmp3, tmp4, tmp5;
+
+                T::average(&amp;tmp0, src0, src1);
+                T::average(&amp;tmp1, src2, src3);
+                T::average(&amp;tmp2, src4, src5);
+                T::average(&amp;tmp3, src6, src7);
+
+                T::average(&amp;tmp4, &amp;tmp0, &amp;tmp1);
+                T::average(&amp;tmp5, &amp;tmp2, &amp;tmp3);
+
+                T::average(dst, &amp;tmp4, &amp;tmp5);
+            }
+        }
+    }
+}
+
+
+typedef void (*MipGenerationFunction)(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                                      const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                                      size_t destWidth, size_t destHeight, size_t destDepth,
+                                      uint8_t *destData, size_t destRowPitch, size_t destDepthPitch);
+
+template &lt;typename T&gt;
+static MipGenerationFunction GetMipGenerationFunction(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth)
+{
+    uint8_t index = ((sourceWidth &gt; 1)  ? 1 : 0) |
+                    ((sourceHeight &gt; 1) ? 2 : 0) |
+                    ((sourceDepth &gt; 1)  ? 4 : 0);
+
+    switch (index)
+    {
+      case 0: return NULL;
+      case 1: return GenerateMip_X&lt;T&gt;;   // W x 1 x 1
+      case 2: return GenerateMip_Y&lt;T&gt;;   // 1 x H x 1
+      case 3: return GenerateMip_XY&lt;T&gt;;  // W x H x 1
+      case 4: return GenerateMip_Z&lt;T&gt;;   // 1 x 1 x D
+      case 5: return GenerateMip_XZ&lt;T&gt;;  // W x 1 x D
+      case 6: return GenerateMip_YZ&lt;T&gt;;  // 1 x H x D
+      case 7: return GenerateMip_XYZ&lt;T&gt;; // W x H x D
+    }
+
+    UNREACHABLE();
+    return NULL;
+}
+
+}
+
+template &lt;typename T&gt;
+inline void GenerateMip(size_t sourceWidth, size_t sourceHeight, size_t sourceDepth,
+                        const uint8_t *sourceData, size_t sourceRowPitch, size_t sourceDepthPitch,
+                        uint8_t *destData, size_t destRowPitch, size_t destDepthPitch)
+{
+    size_t mipWidth = std::max&lt;size_t&gt;(1, sourceWidth &gt;&gt; 1);
+    size_t mipHeight = std::max&lt;size_t&gt;(1, sourceHeight &gt;&gt; 1);
+    size_t mipDepth = std::max&lt;size_t&gt;(1, sourceDepth &gt;&gt; 1);
+
+    priv::MipGenerationFunction generationFunction = priv::GetMipGenerationFunction&lt;T&gt;(sourceWidth, sourceHeight, sourceDepth);
+    ASSERT(generationFunction != NULL);
+
+    generationFunction(sourceWidth, sourceHeight, sourceDepth, sourceData, sourceRowPitch, sourceDepthPitch,
+                       mipWidth, mipHeight, mipDepth, destData, destRowPitch, destDepthPitch);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dimageformatsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/imageformats.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/imageformats.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/imageformats.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,2031 @@
</span><ins>+//
+// Copyright (c) 2013-2015 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.
+//
+
+// imageformats.h: Defines image format types with functions for mip generation
+// and copying.
+
+#ifndef LIBANGLE_RENDERER_D3D_IMAGEFORMATS_H_
+#define LIBANGLE_RENDERER_D3D_IMAGEFORMATS_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+
+namespace rx
+{
+
+// Several structures share functionality for reading, writing or mipmapping but the layout
+// must match the texture format which the structure represents. If collapsing or typedefing
+// structs in this header, make sure the functionality and memory layout is exactly the same.
+
+struct L8
+{
+    unsigned char L;
+
+    static void readColor(gl::ColorF *dst, const L8 *src)
+    {
+        const float lum = gl::normalizedToFloat(src-&gt;L);
+        dst-&gt;red   = lum;
+        dst-&gt;green = lum;
+        dst-&gt;blue  = lum;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(L8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;L = gl::floatToNormalized&lt;unsigned char&gt;((src-&gt;red + src-&gt;green + src-&gt;blue) / 3.0f);
+    }
+
+    static void average(L8 *dst, const L8 *src1, const L8 *src2)
+    {
+        dst-&gt;L = gl::average(src1-&gt;L, src2-&gt;L);
+    }
+};
+
+struct R8
+{
+    unsigned char R;
+
+    static void readColor(gl::ColorF *dst, const R8 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R8 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = 0;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+    }
+
+    static void writeColor(R8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+    }
+
+    static void average(R8 *dst, const R8 *src1, const R8 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+    }
+};
+
+struct A8
+{
+    unsigned char A;
+
+    static void readColor(gl::ColorF *dst, const A8 *src)
+    {
+        dst-&gt;red   = 0.0f;
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void writeColor(A8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(A8 *dst, const A8 *src1, const A8 *src2)
+    {
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct L8A8
+{
+    unsigned char L;
+    unsigned char A;
+
+    static void readColor(gl::ColorF *dst, const L8A8 *src)
+    {
+        const float lum = gl::normalizedToFloat(src-&gt;L);
+        dst-&gt;red   = lum;
+        dst-&gt;green = lum;
+        dst-&gt;blue  = lum;
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void writeColor(L8A8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;L = gl::floatToNormalized&lt;unsigned char&gt;((src-&gt;red + src-&gt;green + src-&gt;blue) / 3.0f);
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(L8A8 *dst, const L8A8 *src1, const L8A8 *src2)
+    {
+        *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) &amp; 0xFEFE) &gt;&gt; 1) + (*(unsigned short*)src1 &amp; *(unsigned short*)src2);
+    }
+};
+
+struct A8L8
+{
+    unsigned char A;
+    unsigned char L;
+
+    static void readColor(gl::ColorF *dst, const A8L8 *src)
+    {
+        const float lum = gl::normalizedToFloat(src-&gt;L);
+        dst-&gt;red   = lum;
+        dst-&gt;green = lum;
+        dst-&gt;blue  = lum;
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void writeColor(A8L8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;L = gl::floatToNormalized&lt;unsigned char&gt;((src-&gt;red + src-&gt;green + src-&gt;blue) / 3.0f);
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(A8L8 *dst, const A8L8 *src1, const A8L8 *src2)
+    {
+        *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) &amp; 0xFEFE) &gt;&gt; 1) + (*(unsigned short*)src1 &amp; *(unsigned short*)src2);
+    }
+};
+
+struct R8G8
+{
+    unsigned char R;
+    unsigned char G;
+
+    static void readColor(gl::ColorF *dst, const R8G8 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R8G8 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R8G8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;green);
+    }
+
+    static void writeColor(R8G8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned char&gt;(src-&gt;green);
+    }
+
+    static void average(R8G8 *dst, const R8G8 *src1, const R8G8 *src2)
+    {
+        *(unsigned short*)dst = (((*(unsigned short*)src1 ^ *(unsigned short*)src2) &amp; 0xFEFE) &gt;&gt; 1) + (*(unsigned short*)src1 &amp; *(unsigned short*)src2);
+    }
+};
+
+struct R8G8B8
+{
+    unsigned char R;
+    unsigned char G;
+    unsigned char B;
+
+    static void readColor(gl::ColorF *dst, const R8G8B8 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R8G8B8 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;G;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R8G8B8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;blue);
+    }
+
+    static void writeColor(R8G8B8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned char&gt;(src-&gt;blue);
+    }
+
+    static void average(R8G8B8 *dst, const R8G8B8 *src1, const R8G8B8 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct B8G8R8
+{
+    unsigned char B;
+    unsigned char G;
+    unsigned char R;
+
+    static void readColor(gl::ColorF *dst, const B8G8R8 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const B8G8R8 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;G;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(B8G8R8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;blue);
+    }
+
+    static void writeColor(B8G8R8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned char&gt;(src-&gt;blue);
+    }
+
+    static void average(B8G8R8 *dst, const B8G8R8 *src1, const B8G8R8 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct R5G6B5
+{
+    unsigned short RGB;
+
+    static void readColor(gl::ColorF *dst, const R5G6B5 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5, 11&gt;(src-&gt;RGB));
+        dst-&gt;green = gl::normalizedToFloat&lt;6&gt;(gl::getShiftedData&lt;6,  5&gt;(src-&gt;RGB));
+        dst-&gt;blue  = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5,  0&gt;(src-&gt;RGB));
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R5G6B5 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;RGB = gl::shiftData&lt;5, 11&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;red))   |
+                   gl::shiftData&lt;6,  5&gt;(gl::floatToNormalized&lt;6, unsigned short&gt;(src-&gt;green)) |
+                   gl::shiftData&lt;5,  0&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;blue));
+    }
+
+    static void average(R5G6B5 *dst, const R5G6B5 *src1, const R5G6B5 *src2)
+    {
+        dst-&gt;RGB = gl::shiftData&lt;5, 11&gt;(gl::average(gl::getShiftedData&lt;5, 11&gt;(src1-&gt;RGB), gl::getShiftedData&lt;5, 11&gt;(src2-&gt;RGB))) |
+                   gl::shiftData&lt;6,  5&gt;(gl::average(gl::getShiftedData&lt;6,  5&gt;(src1-&gt;RGB), gl::getShiftedData&lt;6,  5&gt;(src2-&gt;RGB))) |
+                   gl::shiftData&lt;5,  0&gt;(gl::average(gl::getShiftedData&lt;5,  0&gt;(src1-&gt;RGB), gl::getShiftedData&lt;5,  0&gt;(src2-&gt;RGB)));
+    }
+};
+
+struct A8R8G8B8
+{
+    unsigned char A;
+    unsigned char R;
+    unsigned char G;
+    unsigned char B;
+
+    static void readColor(gl::ColorF *dst, const A8R8G8B8 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorUI *dst, const A8R8G8B8 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(A8R8G8B8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(A8R8G8B8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(A8R8G8B8 *dst, const A8R8G8B8 *src1, const A8R8G8B8 *src2)
+    {
+        *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) &amp; 0xFEFEFEFE) &gt;&gt; 1) + (*(unsigned int*)src1 &amp; *(unsigned int*)src2);
+    }
+};
+
+struct R8G8B8A8
+{
+    unsigned char R;
+    unsigned char G;
+    unsigned char B;
+    unsigned char A;
+
+    static void readColor(gl::ColorF *dst, const R8G8B8A8 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorUI *dst, const R8G8B8A8 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R8G8B8A8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(R8G8B8A8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(R8G8B8A8 *dst, const R8G8B8A8 *src1, const R8G8B8A8 *src2)
+    {
+        *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) &amp; 0xFEFEFEFE) &gt;&gt; 1) + (*(unsigned int*)src1 &amp; *(unsigned int*)src2);
+    }
+};
+
+struct B8G8R8A8
+{
+    unsigned char B;
+    unsigned char G;
+    unsigned char R;
+    unsigned char A;
+
+    static void readColor(gl::ColorF *dst, const B8G8R8A8 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorUI *dst, const B8G8R8A8 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(B8G8R8A8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(B8G8R8A8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(B8G8R8A8 *dst, const B8G8R8A8 *src1, const B8G8R8A8 *src2)
+    {
+        *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) &amp; 0xFEFEFEFE) &gt;&gt; 1) + (*(unsigned int*)src1 &amp; *(unsigned int*)src2);
+    }
+};
+
+struct B8G8R8X8
+{
+    unsigned char B;
+    unsigned char G;
+    unsigned char R;
+    unsigned char X;
+
+    static void readColor(gl::ColorF *dst, const B8G8R8X8 *src)
+    {
+        dst-&gt;red = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const B8G8R8X8 *src)
+    {
+        dst-&gt;red = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue = src-&gt;B;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(B8G8R8X8 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;X = 255;
+    }
+
+    static void writeColor(B8G8R8X8 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned char&gt;(src-&gt;blue);
+        dst-&gt;X = 255;
+    }
+
+    static void average(B8G8R8X8 *dst, const B8G8R8X8 *src1, const B8G8R8X8 *src2)
+    {
+        *(unsigned int*)dst = (((*(unsigned int*)src1 ^ *(unsigned int*)src2) &amp; 0xFEFEFEFE) &gt;&gt; 1) + (*(unsigned int*)src1 &amp; *(unsigned int*)src2);
+        dst-&gt;X = 255;
+    }
+};
+
+struct B5G5R5A1
+{
+    unsigned short BGRA;
+
+    static void readColor(gl::ColorF *dst, const B5G5R5A1 *src)
+    {
+        dst-&gt;alpha = gl::normalizedToFloat&lt;1&gt;(gl::getShiftedData&lt;1, 15&gt;(src-&gt;BGRA));
+        dst-&gt;red   = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5, 10&gt;(src-&gt;BGRA));
+        dst-&gt;green = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5,  5&gt;(src-&gt;BGRA));
+        dst-&gt;blue  = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5,  0&gt;(src-&gt;BGRA));
+    }
+
+    static void writeColor(B5G5R5A1 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;BGRA = gl::shiftData&lt;1, 15&gt;(gl::floatToNormalized&lt;1, unsigned short&gt;(src-&gt;alpha)) |
+                    gl::shiftData&lt;5, 10&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;red))   |
+                    gl::shiftData&lt;5,  5&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;green)) |
+                    gl::shiftData&lt;5,  0&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;blue));
+    }
+
+    static void average(B5G5R5A1 *dst, const B5G5R5A1 *src1, const B5G5R5A1 *src2)
+    {
+        dst-&gt;BGRA = gl::shiftData&lt;1, 15&gt;(gl::average(gl::getShiftedData&lt;1, 15&gt;(src1-&gt;BGRA), gl::getShiftedData&lt;1, 15&gt;(src2-&gt;BGRA))) |
+                    gl::shiftData&lt;5, 10&gt;(gl::average(gl::getShiftedData&lt;5, 10&gt;(src1-&gt;BGRA), gl::getShiftedData&lt;5, 10&gt;(src2-&gt;BGRA))) |
+                    gl::shiftData&lt;5,  5&gt;(gl::average(gl::getShiftedData&lt;5,  5&gt;(src1-&gt;BGRA), gl::getShiftedData&lt;5,  5&gt;(src2-&gt;BGRA))) |
+                    gl::shiftData&lt;5,  0&gt;(gl::average(gl::getShiftedData&lt;5,  0&gt;(src1-&gt;BGRA), gl::getShiftedData&lt;5,  0&gt;(src2-&gt;BGRA)));
+    }
+};
+
+struct R5G5B5A1
+{
+    unsigned short RGBA;
+
+    static void readColor(gl::ColorF *dst, const R5G5B5A1 *src)
+    {
+        dst-&gt;alpha = gl::normalizedToFloat&lt;1&gt;(gl::getShiftedData&lt;1, 15&gt;(src-&gt;RGBA));
+        dst-&gt;blue  = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5, 10&gt;(src-&gt;RGBA));
+        dst-&gt;green = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5,  5&gt;(src-&gt;RGBA));
+        dst-&gt;red   = gl::normalizedToFloat&lt;5&gt;(gl::getShiftedData&lt;5,  0&gt;(src-&gt;RGBA));
+    }
+
+    static void writeColor(R5G5B5A1 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;RGBA = gl::shiftData&lt;1, 15&gt;(gl::floatToNormalized&lt;1, unsigned short&gt;(src-&gt;alpha)) |
+                    gl::shiftData&lt;5, 10&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;blue))  |
+                    gl::shiftData&lt;5,  5&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;green)) |
+                    gl::shiftData&lt;5,  0&gt;(gl::floatToNormalized&lt;5, unsigned short&gt;(src-&gt;red));
+    }
+
+    static void average(R5G5B5A1 *dst, const R5G5B5A1 *src1, const R5G5B5A1 *src2)
+    {
+        dst-&gt;RGBA = gl::shiftData&lt;1, 15&gt;(gl::average(gl::getShiftedData&lt;1, 15&gt;(src1-&gt;RGBA), gl::getShiftedData&lt;1, 15&gt;(src2-&gt;RGBA))) |
+                    gl::shiftData&lt;5, 10&gt;(gl::average(gl::getShiftedData&lt;5, 10&gt;(src1-&gt;RGBA), gl::getShiftedData&lt;5, 10&gt;(src2-&gt;RGBA))) |
+                    gl::shiftData&lt;5,  5&gt;(gl::average(gl::getShiftedData&lt;5,  5&gt;(src1-&gt;RGBA), gl::getShiftedData&lt;5,  5&gt;(src2-&gt;RGBA))) |
+                    gl::shiftData&lt;5,  0&gt;(gl::average(gl::getShiftedData&lt;5,  0&gt;(src1-&gt;RGBA), gl::getShiftedData&lt;5,  0&gt;(src2-&gt;RGBA)));
+    }
+};
+
+struct R4G4B4A4
+{
+    unsigned char R : 4;
+    unsigned char G : 4;
+    unsigned char B : 4;
+    unsigned char A : 4;
+
+    static void readColor(gl::ColorF *dst, const R4G4B4A4 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat&lt;4&gt;(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat&lt;4&gt;(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat&lt;4&gt;(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat&lt;4&gt;(src-&gt;A);
+    }
+
+    static void writeColor(R4G4B4A4 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(R4G4B4A4 *dst, const R4G4B4A4 *src1, const R4G4B4A4 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct A4R4G4B4
+{
+    unsigned char A : 4;
+    unsigned char R : 4;
+    unsigned char G : 4;
+    unsigned char B : 4;
+
+    static void readColor(gl::ColorF *dst, const A4R4G4B4 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat&lt;4&gt;(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat&lt;4&gt;(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat&lt;4&gt;(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat&lt;4&gt;(src-&gt;A);
+    }
+
+    static void writeColor(A4R4G4B4 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(A4R4G4B4 *dst, const A4R4G4B4 *src1, const A4R4G4B4 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct B4G4R4A4
+{
+    unsigned char B : 4;
+    unsigned char G : 4;
+    unsigned char R : 4;
+    unsigned char A : 4;
+
+    static void readColor(gl::ColorF *dst, const B4G4R4A4 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat&lt;4&gt;(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat&lt;4&gt;(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat&lt;4&gt;(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat&lt;4&gt;(src-&gt;A);
+    }
+
+    static void writeColor(B4G4R4A4 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;4, unsigned char&gt;(src-&gt;alpha);
+    }
+
+    static void average(B4G4R4A4 *dst, const B4G4R4A4 *src1, const B4G4R4A4 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R16
+{
+    unsigned short R;
+
+    static void readColor(gl::ColorF *dst, const R16 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R16 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = 0;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R16 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;red);
+    }
+
+    static void writeColor(R16 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned short&gt;(src-&gt;red);
+    }
+
+    static void average(R16 *dst, const R16 *src1, const R16 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+    }
+};
+
+struct R16G16
+{
+    unsigned short R;
+    unsigned short G;
+
+    static void readColor(gl::ColorF *dst, const R16G16 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R16G16 *src)
+    {
+        dst-&gt;red = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R16G16 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;green);
+    }
+
+    static void writeColor(R16G16 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned short&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned short&gt;(src-&gt;green);
+    }
+
+    static void average(R16G16 *dst, const R16G16 *src1, const R16G16 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+    }
+};
+
+struct R16G16B16
+{
+    unsigned short R;
+    unsigned short G;
+    unsigned short B;
+
+    static void readColor(gl::ColorF *dst, const R16G16B16 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R16G16B16 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R16G16B16 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;blue);
+    }
+
+    static void writeColor(R16G16B16 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned short&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned short&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned short&gt;(src-&gt;blue);
+    }
+
+    static void average(R16G16B16 *dst, const R16G16B16 *src1, const R16G16B16 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct R16G16B16A16
+{
+    unsigned short R;
+    unsigned short G;
+    unsigned short B;
+    unsigned short A;
+
+    static void readColor(gl::ColorF *dst, const R16G16B16A16 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorUI *dst, const R16G16B16A16 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R16G16B16A16 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned short&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(R16G16B16A16 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned short&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned short&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned short&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;unsigned short&gt;(src-&gt;alpha);
+    }
+
+    static void average(R16G16B16A16 *dst, const R16G16B16A16 *src1, const R16G16B16A16 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R32
+{
+    unsigned int R;
+
+    static void readColor(gl::ColorF *dst, const R32 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R32 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = 0;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R32 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;red);
+    }
+
+    static void writeColor(R32 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned int&gt;(src-&gt;red);
+    }
+
+    static void average(R32 *dst, const R32 *src1, const R32 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+    }
+};
+
+struct R32G32
+{
+    unsigned int R;
+    unsigned int G;
+
+    static void readColor(gl::ColorF *dst, const R32G32 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R32G32 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R32G32 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;green);
+    }
+
+    static void writeColor(R32G32 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned int&gt;(src-&gt;green);
+    }
+
+    static void average(R32G32 *dst, const R32G32 *src1, const R32G32 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+    }
+};
+
+struct R32G32B32
+{
+    unsigned int R;
+    unsigned int G;
+    unsigned int B;
+
+    static void readColor(gl::ColorF *dst, const R32G32B32 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorUI *dst, const R32G32B32 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R32G32B32 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;blue);
+    }
+
+    static void writeColor(R32G32B32 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned int&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned int&gt;(src-&gt;blue);
+    }
+
+    static void average(R32G32B32 *dst, const R32G32B32 *src1, const R32G32B32 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct R32G32B32A32
+{
+    unsigned int R;
+    unsigned int G;
+    unsigned int B;
+    unsigned int A;
+
+    static void readColor(gl::ColorF *dst, const R32G32B32A32 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorUI *dst, const R32G32B32A32 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R32G32B32A32 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;unsigned int&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(R32G32B32A32 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned int&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned int&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;unsigned int&gt;(src-&gt;alpha);
+    }
+
+    static void average(R32G32B32A32 *dst, const R32G32B32A32 *src1, const R32G32B32A32 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R8S
+{
+    char R;
+
+    static void readColor(gl::ColorF *dst, const R8S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R8S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = 0;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R8S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;char&gt;(src-&gt;red);
+    }
+
+    static void writeColor(R8S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(src-&gt;red);
+    }
+
+    static void average(R8S *dst, const R8S *src1, const R8S *src2)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(gl::average(src1-&gt;R, src2-&gt;R));
+    }
+};
+
+struct R8G8S
+{
+    char R;
+    char G;
+
+    static void readColor(gl::ColorF *dst, const R8G8S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R8G8S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R8G8S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;char&gt;(src-&gt;green);
+    }
+
+    static void writeColor(R8G8S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;char&gt;(src-&gt;green);
+    }
+
+    static void average(R8G8S *dst, const R8G8S *src1, const R8G8S *src2)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(gl::average(src1-&gt;R, src2-&gt;R));
+        dst-&gt;G = static_cast&lt;char&gt;(gl::average(src1-&gt;G, src2-&gt;G));
+    }
+};
+
+struct R8G8B8S
+{
+    char R;
+    char G;
+    char B;
+
+    static void readColor(gl::ColorF *dst, const R8G8B8S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R8G8B8S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R8G8B8S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;char&gt;(src-&gt;blue);
+    }
+
+    static void writeColor(R8G8B8S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;char&gt;(src-&gt;blue);
+    }
+
+    static void average(R8G8B8S *dst, const R8G8B8S *src1, const R8G8B8S *src2)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(gl::average(src1-&gt;R, src2-&gt;R));
+        dst-&gt;G = static_cast&lt;char&gt;(gl::average(src1-&gt;G, src2-&gt;G));
+        dst-&gt;B = static_cast&lt;char&gt;(gl::average(src1-&gt;B, src2-&gt;B));
+    }
+};
+
+struct R8G8B8A8S
+{
+    char R;
+    char G;
+    char B;
+    char A;
+
+    static void readColor(gl::ColorF *dst, const R8G8B8A8S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorI *dst, const R8G8B8A8S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R8G8B8A8S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;char&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;char&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;char&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;char&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(R8G8B8A8S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;char&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;char&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;char&gt;(src-&gt;alpha);
+    }
+
+    static void average(R8G8B8A8S *dst, const R8G8B8A8S *src1, const R8G8B8A8S *src2)
+    {
+        dst-&gt;R = static_cast&lt;char&gt;(gl::average(src1-&gt;R, src2-&gt;R));
+        dst-&gt;G = static_cast&lt;char&gt;(gl::average(src1-&gt;G, src2-&gt;G));
+        dst-&gt;B = static_cast&lt;char&gt;(gl::average(src1-&gt;B, src2-&gt;B));
+        dst-&gt;A = static_cast&lt;char&gt;(gl::average(src1-&gt;A, src2-&gt;A));
+    }
+};
+
+struct R16S
+{
+    short R;
+
+    static void readColor(gl::ColorF *dst, const R16S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R16S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = 0;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R16S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;short&gt;(src-&gt;red);
+    }
+
+    static void writeColor(R16S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;short&gt;(src-&gt;red);
+    }
+
+    static void average(R16S *dst, const R16S *src1, const R16S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+    }
+};
+
+struct R16G16S
+{
+    short R;
+    short G;
+
+    static void readColor(gl::ColorF *dst, const R16G16S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R16G16S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R16G16S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;short&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;short&gt;(src-&gt;green);
+    }
+
+    static void writeColor(R16G16S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;short&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;short&gt;(src-&gt;green);
+    }
+
+    static void average(R16G16S *dst, const R16G16S *src1, const R16G16S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+    }
+};
+
+struct R16G16B16S
+{
+    short R;
+    short G;
+    short B;
+
+    static void readColor(gl::ColorF *dst, const R16G16B16S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R16G16B16S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R16G16B16S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;short&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;short&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;short&gt;(src-&gt;blue);
+    }
+
+    static void writeColor(R16G16B16S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;short&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;short&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;short&gt;(src-&gt;blue);
+    }
+
+    static void average(R16G16B16S *dst, const R16G16B16S *src1, const R16G16B16S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct R16G16B16A16S
+{
+    short R;
+    short G;
+    short B;
+    short A;
+
+    static void readColor(gl::ColorF *dst, const R16G16B16A16S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorI *dst, const R16G16B16A16S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R16G16B16A16S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;short&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;short&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;short&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;short&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(R16G16B16A16S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;short&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;short&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;short&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;short&gt;(src-&gt;alpha);
+    }
+
+    static void average(R16G16B16A16S *dst, const R16G16B16A16S *src1, const R16G16B16A16S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R32S
+{
+    int R;
+
+    static void readColor(gl::ColorF *dst, const R32S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R32S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = 0;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R32S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;int&gt;(src-&gt;red);
+    }
+
+    static void writeColor(R32S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;int&gt;(src-&gt;red);
+    }
+
+    static void average(R32S *dst, const R32S *src1, const R32S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+    }
+};
+
+struct R32G32S
+{
+    int R;
+    int G;
+
+    static void readColor(gl::ColorF *dst, const R32G32S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R32G32S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = 0;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R32G32S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;int&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;int&gt;(src-&gt;green);
+    }
+
+    static void writeColor(R32G32S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;int&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;int&gt;(src-&gt;green);
+    }
+
+    static void average(R32G32S *dst, const R32G32S *src1, const R32G32S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+    }
+};
+
+struct R32G32B32S
+{
+    int R;
+    int G;
+    int B;
+
+    static void readColor(gl::ColorF *dst, const R32G32B32S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void readColor(gl::ColorI *dst, const R32G32B32S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = 1;
+    }
+
+    static void writeColor(R32G32B32S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;int&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;int&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;int&gt;(src-&gt;blue);
+    }
+
+    static void writeColor(R32G32B32S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;int&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;int&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;int&gt;(src-&gt;blue);
+    }
+
+    static void average(R32G32B32S *dst, const R32G32B32S *src1, const R32G32B32S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct R32G32B32A32S
+{
+    int R;
+    int G;
+    int B;
+    int A;
+
+    static void readColor(gl::ColorF *dst, const R32G32B32A32S *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorI *dst, const R32G32B32A32S *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R32G32B32A32S *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;int&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;int&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;int&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt;int&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(R32G32B32A32S *dst, const gl::ColorI *src)
+    {
+        dst-&gt;R = static_cast&lt;int&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;int&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;int&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;int&gt;(src-&gt;alpha);
+    }
+
+    static void average(R32G32B32A32S *dst, const R32G32B32A32S *src1, const R32G32B32A32S *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct A16B16G16R16F
+{
+    unsigned short A;
+    unsigned short R;
+    unsigned short G;
+    unsigned short B;
+
+    static void readColor(gl::ColorF *dst, const A16B16G16R16F *src)
+    {
+        dst-&gt;red   = gl::float16ToFloat32(src-&gt;R);
+        dst-&gt;green = gl::float16ToFloat32(src-&gt;G);
+        dst-&gt;blue  = gl::float16ToFloat32(src-&gt;B);
+        dst-&gt;alpha = gl::float16ToFloat32(src-&gt;A);
+    }
+
+    static void writeColor(A16B16G16R16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::float32ToFloat16(src-&gt;red);
+        dst-&gt;G = gl::float32ToFloat16(src-&gt;green);
+        dst-&gt;B = gl::float32ToFloat16(src-&gt;blue);
+        dst-&gt;A = gl::float32ToFloat16(src-&gt;alpha);
+    }
+
+    static void average(A16B16G16R16F *dst, const A16B16G16R16F *src1, const A16B16G16R16F *src2)
+    {
+        dst-&gt;R = gl::averageHalfFloat(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::averageHalfFloat(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::averageHalfFloat(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::averageHalfFloat(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R16G16B16A16F
+{
+    unsigned short R;
+    unsigned short G;
+    unsigned short B;
+    unsigned short A;
+
+    static void readColor(gl::ColorF *dst, const R16G16B16A16F *src)
+    {
+        dst-&gt;red   = gl::float16ToFloat32(src-&gt;R);
+        dst-&gt;green = gl::float16ToFloat32(src-&gt;G);
+        dst-&gt;blue  = gl::float16ToFloat32(src-&gt;B);
+        dst-&gt;alpha = gl::float16ToFloat32(src-&gt;A);
+    }
+
+    static void writeColor(R16G16B16A16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::float32ToFloat16(src-&gt;red);
+        dst-&gt;G = gl::float32ToFloat16(src-&gt;green);
+        dst-&gt;B = gl::float32ToFloat16(src-&gt;blue);
+        dst-&gt;A = gl::float32ToFloat16(src-&gt;alpha);
+    }
+
+    static void average(R16G16B16A16F *dst, const R16G16B16A16F *src1, const R16G16B16A16F *src2)
+    {
+        dst-&gt;R = gl::averageHalfFloat(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::averageHalfFloat(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::averageHalfFloat(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::averageHalfFloat(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R16F
+{
+    unsigned short R;
+
+    static void readColor(gl::ColorF *dst, const R16F *src)
+    {
+        dst-&gt;red   = gl::float16ToFloat32(src-&gt;R);
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::float32ToFloat16(src-&gt;red);
+    }
+    
+    static void average(R16F *dst, const R16F *src1, const R16F *src2)
+    {
+        dst-&gt;R = gl::averageHalfFloat(src1-&gt;R, src2-&gt;R);
+    }
+};
+
+struct A16F
+{
+    unsigned short A;
+
+    static void readColor(gl::ColorF *dst, const A16F *src)
+    {
+        dst-&gt;red   = 0.0f;
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = gl::float16ToFloat32(src-&gt;A);
+    }
+
+    static void writeColor(A16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;A = gl::float32ToFloat16(src-&gt;alpha);
+    }
+
+    static void average(A16F *dst, const A16F *src1, const A16F *src2)
+    {
+        dst-&gt;A = gl::averageHalfFloat(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct L16F
+{
+    unsigned short L;
+
+    static void readColor(gl::ColorF *dst, const L16F *src)
+    {
+        float lum = gl::float16ToFloat32(src-&gt;L);
+        dst-&gt;red   = lum;
+        dst-&gt;green = lum;
+        dst-&gt;blue  = lum;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(L16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;L = gl::float32ToFloat16((src-&gt;red + src-&gt;green + src-&gt;blue) / 3.0f);
+    }
+
+    static void average(L16F *dst, const L16F *src1, const L16F *src2)
+    {
+        dst-&gt;L = gl::averageHalfFloat(src1-&gt;L, src2-&gt;L);
+    }
+};
+
+struct L16A16F
+{
+    unsigned short L;
+    unsigned short A;
+
+    static void readColor(gl::ColorF *dst, const L16A16F *src)
+    {
+        float lum = gl::float16ToFloat32(src-&gt;L);
+        dst-&gt;red   = lum;
+        dst-&gt;green = lum;
+        dst-&gt;blue  = lum;
+        dst-&gt;alpha = gl::float16ToFloat32(src-&gt;A);
+    }
+
+    static void writeColor(L16A16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;L = gl::float32ToFloat16((src-&gt;red + src-&gt;green + src-&gt;blue) / 3.0f);
+        dst-&gt;A = gl::float32ToFloat16(src-&gt;alpha);
+    }
+
+    static void average(L16A16F *dst, const L16A16F *src1, const L16A16F *src2)
+    {
+        dst-&gt;L = gl::averageHalfFloat(src1-&gt;L, src2-&gt;L);
+        dst-&gt;A = gl::averageHalfFloat(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R16G16F
+{
+    unsigned short R;
+    unsigned short G;
+
+    static void readColor(gl::ColorF *dst, const R16G16F *src)
+    {
+        dst-&gt;red   = gl::float16ToFloat32(src-&gt;R);
+        dst-&gt;green = gl::float16ToFloat32(src-&gt;G);
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R16G16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::float32ToFloat16(src-&gt;red);
+        dst-&gt;G = gl::float32ToFloat16(src-&gt;green);
+    }
+
+    static void average(R16G16F *dst, const R16G16F *src1, const R16G16F *src2)
+    {
+        dst-&gt;R = gl::averageHalfFloat(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::averageHalfFloat(src1-&gt;G, src2-&gt;G);
+    }
+};
+
+struct R16G16B16F
+{
+    unsigned short R;
+    unsigned short G;
+    unsigned short B;
+
+    static void readColor(gl::ColorF *dst, const R16G16B16F *src)
+    {
+        dst-&gt;red   = gl::float16ToFloat32(src-&gt;R);
+        dst-&gt;green = gl::float16ToFloat32(src-&gt;G);
+        dst-&gt;blue  = gl::float16ToFloat32(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R16G16B16F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::float32ToFloat16(src-&gt;red);
+        dst-&gt;G = gl::float32ToFloat16(src-&gt;green);
+        dst-&gt;B = gl::float32ToFloat16(src-&gt;blue);
+    }
+
+    static void average(R16G16B16F *dst, const R16G16B16F *src1, const R16G16B16F *src2)
+    {
+        dst-&gt;R = gl::averageHalfFloat(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::averageHalfFloat(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::averageHalfFloat(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct A32B32G32R32F
+{
+    float A;
+    float R;
+    float G;
+    float B;
+
+    static void readColor(gl::ColorF *dst, const A32B32G32R32F *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(A32B32G32R32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = src-&gt;red;
+        dst-&gt;G = src-&gt;green;
+        dst-&gt;B = src-&gt;blue;
+        dst-&gt;A = src-&gt;alpha;
+    }
+
+    static void average(A32B32G32R32F *dst, const A32B32G32R32F *src1, const A32B32G32R32F *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R32G32B32A32F
+{
+    float R;
+    float G;
+    float B;
+    float A;
+
+    static void readColor(gl::ColorF *dst, const R32G32B32A32F *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R32G32B32A32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = src-&gt;red;
+        dst-&gt;G = src-&gt;green;
+        dst-&gt;B = src-&gt;blue;
+        dst-&gt;A = src-&gt;alpha;
+    }
+
+    static void average(R32G32B32A32F *dst, const R32G32B32A32F *src1, const R32G32B32A32F *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R32F
+{
+    float R;
+
+    static void readColor(gl::ColorF *dst, const R32F *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = src-&gt;red;
+    }
+
+    static void average(R32F *dst, const R32F *src1, const R32F *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+    }
+};
+
+struct A32F
+{
+    float A;
+
+    static void readColor(gl::ColorF *dst, const A32F *src)
+    {
+        dst-&gt;red   = 0.0f;
+        dst-&gt;green = 0.0f;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(A32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;A = src-&gt;alpha;
+    }
+
+    static void average(A32F *dst, const A32F *src1, const A32F *src2)
+    {
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct L32F
+{
+    float L;
+
+    static void readColor(gl::ColorF *dst, const L32F *src)
+    {
+        dst-&gt;red   = src-&gt;L;
+        dst-&gt;green = src-&gt;L;
+        dst-&gt;blue  = src-&gt;L;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(L32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;L = (src-&gt;red + src-&gt;green + src-&gt;blue) / 3.0f;
+    }
+
+    static void average(L32F *dst, const L32F *src1, const L32F *src2)
+    {
+        dst-&gt;L = gl::average(src1-&gt;L, src2-&gt;L);
+    }
+};
+
+struct L32A32F
+{
+    float L;
+    float A;
+
+    static void readColor(gl::ColorF *dst, const L32A32F *src)
+    {
+        dst-&gt;red   = src-&gt;L;
+        dst-&gt;green = src-&gt;L;
+        dst-&gt;blue  = src-&gt;L;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(L32A32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;L = (src-&gt;red + src-&gt;green + src-&gt;blue) / 3.0f;
+        dst-&gt;A = src-&gt;alpha;
+    }
+
+    static void average(L32A32F *dst, const L32A32F *src1, const L32A32F *src2)
+    {
+        dst-&gt;L = gl::average(src1-&gt;L, src2-&gt;L);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R32G32F
+{
+    float R;
+    float G;
+
+    static void readColor(gl::ColorF *dst, const R32G32F *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = 0.0f;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R32G32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = src-&gt;red;
+        dst-&gt;G = src-&gt;green;
+    }
+
+    static void average(R32G32F *dst, const R32G32F *src1, const R32G32F *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+    }
+};
+
+struct R32G32B32F
+{
+    float R;
+    float G;
+    float B;
+
+    static void readColor(gl::ColorF *dst, const R32G32B32F *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R32G32B32F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = src-&gt;red;
+        dst-&gt;G = src-&gt;green;
+        dst-&gt;B = src-&gt;blue;
+    }
+
+    static void average(R32G32B32F *dst, const R32G32B32F *src1, const R32G32B32F *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+struct R10G10B10A2
+{
+    unsigned int R : 10;
+    unsigned int G : 10;
+    unsigned int B : 10;
+    unsigned int A : 2;
+
+    static void readColor(gl::ColorF *dst, const R10G10B10A2 *src)
+    {
+        dst-&gt;red   = gl::normalizedToFloat&lt;10&gt;(src-&gt;R);
+        dst-&gt;green = gl::normalizedToFloat&lt;10&gt;(src-&gt;G);
+        dst-&gt;blue  = gl::normalizedToFloat&lt;10&gt;(src-&gt;B);
+        dst-&gt;alpha = gl::normalizedToFloat&lt; 2&gt;(src-&gt;A);
+    }
+
+    static void readColor(gl::ColorUI *dst, const R10G10B10A2 *src)
+    {
+        dst-&gt;red   = src-&gt;R;
+        dst-&gt;green = src-&gt;G;
+        dst-&gt;blue  = src-&gt;B;
+        dst-&gt;alpha = src-&gt;A;
+    }
+
+    static void writeColor(R10G10B10A2 *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::floatToNormalized&lt;10, unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = gl::floatToNormalized&lt;10, unsigned int&gt;(src-&gt;green);
+        dst-&gt;B = gl::floatToNormalized&lt;10, unsigned int&gt;(src-&gt;blue);
+        dst-&gt;A = gl::floatToNormalized&lt; 2, unsigned int&gt;(src-&gt;alpha);
+    }
+
+    static void writeColor(R10G10B10A2 *dst, const gl::ColorUI *src)
+    {
+        dst-&gt;R = static_cast&lt;unsigned int&gt;(src-&gt;red);
+        dst-&gt;G = static_cast&lt;unsigned int&gt;(src-&gt;green);
+        dst-&gt;B = static_cast&lt;unsigned int&gt;(src-&gt;blue);
+        dst-&gt;A = static_cast&lt;unsigned int&gt;(src-&gt;alpha);
+    }
+
+    static void average(R10G10B10A2 *dst, const R10G10B10A2 *src1, const R10G10B10A2 *src2)
+    {
+        dst-&gt;R = gl::average(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::average(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::average(src1-&gt;B, src2-&gt;B);
+        dst-&gt;A = gl::average(src1-&gt;A, src2-&gt;A);
+    }
+};
+
+struct R9G9B9E5
+{
+    unsigned int R : 9;
+    unsigned int G : 9;
+    unsigned int B : 9;
+    unsigned int E : 5;
+
+    static void readColor(gl::ColorF *dst, const R9G9B9E5 *src)
+    {
+        gl::convert999E5toRGBFloats(gl::bitCast&lt;unsigned int&gt;(*src), &amp;dst-&gt;red, &amp;dst-&gt;green, &amp;dst-&gt;blue);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R9G9B9E5 *dst, const gl::ColorF *src)
+    {
+        *reinterpret_cast&lt;unsigned int*&gt;(dst) = gl::convertRGBFloatsTo999E5(src-&gt;red,
+                                                                            src-&gt;green,
+                                                                            src-&gt;blue);
+    }
+
+    static void average(R9G9B9E5 *dst, const R9G9B9E5 *src1, const R9G9B9E5 *src2)
+    {
+        float r1, g1, b1;
+        gl::convert999E5toRGBFloats(*reinterpret_cast&lt;const unsigned int*&gt;(src1), &amp;r1, &amp;g1, &amp;b1);
+
+        float r2, g2, b2;
+        gl::convert999E5toRGBFloats(*reinterpret_cast&lt;const unsigned int*&gt;(src2), &amp;r2, &amp;g2, &amp;b2);
+
+        *reinterpret_cast&lt;unsigned int*&gt;(dst) = gl::convertRGBFloatsTo999E5(gl::average(r1, r2),
+                                                                            gl::average(g1, g2),
+                                                                            gl::average(b1, b2));
+    }
+};
+
+struct R11G11B10F
+{
+    unsigned int R : 11;
+    unsigned int G : 11;
+    unsigned int B : 10;
+
+    static void readColor(gl::ColorF *dst, const R11G11B10F *src)
+    {
+        dst-&gt;red   = gl::float11ToFloat32(src-&gt;R);
+        dst-&gt;green = gl::float11ToFloat32(src-&gt;G);
+        dst-&gt;blue  = gl::float10ToFloat32(src-&gt;B);
+        dst-&gt;alpha = 1.0f;
+    }
+
+    static void writeColor(R11G11B10F *dst, const gl::ColorF *src)
+    {
+        dst-&gt;R = gl::float32ToFloat11(src-&gt;red);
+        dst-&gt;G = gl::float32ToFloat11(src-&gt;green);
+        dst-&gt;B = gl::float32ToFloat10(src-&gt;blue);
+    }
+
+    static void average(R11G11B10F *dst, const R11G11B10F *src1, const R11G11B10F *src2)
+    {
+        dst-&gt;R = gl::averageFloat11(src1-&gt;R, src2-&gt;R);
+        dst-&gt;G = gl::averageFloat11(src1-&gt;G, src2-&gt;G);
+        dst-&gt;B = gl::averageFloat10(src1-&gt;B, src2-&gt;B);
+    }
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_D3D_IMAGEFORMATS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimagecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,662 @@
</span><ins>+//
+// Copyright (c) 2013-2015 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.
+//
+
+// loadimage.cpp: Defines image loading functions.
+
+#include &quot;libANGLE/renderer/d3d/loadimage.h&quot;
+
+namespace rx
+{
+
+void LoadA8ToRGBA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x] = static_cast&lt;uint32_t&gt;(source[x]) &lt;&lt; 24;
+            }
+        }
+    }
+}
+
+void LoadA8ToBGRA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    // Same as loading to RGBA
+    LoadA8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output, outputRowPitch, outputDepthPitch);
+}
+
+void LoadA32FToRGBA32F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const float *source = OffsetDataPointer&lt;float&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            float *dest = OffsetDataPointer&lt;float&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[4 * x + 0] = 0.0f;
+                dest[4 * x + 1] = 0.0f;
+                dest[4 * x + 2] = 0.0f;
+                dest[4 * x + 3] = source[x];
+            }
+        }
+    }
+}
+
+void LoadA16FToRGBA16F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint16_t *dest = OffsetDataPointer&lt;uint16_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[4 * x + 0] = 0;
+                dest[4 * x + 1] = 0;
+                dest[4 * x + 2] = 0;
+                dest[4 * x + 3] = source[x];
+            }
+        }
+    }
+}
+
+void LoadL8ToRGBA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint8_t sourceVal = source[x];
+                dest[4 * x + 0] = sourceVal;
+                dest[4 * x + 1] = sourceVal;
+                dest[4 * x + 2] = sourceVal;
+                dest[4 * x + 3] = 0xFF;
+            }
+        }
+    }
+}
+
+void LoadL8ToBGRA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    // Same as loading to RGBA
+    LoadL8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output, outputRowPitch, outputDepthPitch);
+}
+
+void LoadL32FToRGBA32F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const float *source = OffsetDataPointer&lt;float&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            float *dest = OffsetDataPointer&lt;float&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; 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 LoadL16FToRGBA16F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint16_t *dest = OffsetDataPointer&lt;uint16_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[4 * x + 0] = source[x];
+                dest[4 * x + 1] = source[x];
+                dest[4 * x + 2] = source[x];
+                dest[4 * x + 3] = gl::Float16One;
+            }
+        }
+    }
+}
+
+void LoadLA8ToRGBA8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; 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 LoadLA8ToBGRA8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    // Same as loading to RGBA
+    LoadLA8ToRGBA8(width, height, depth, input, inputRowPitch, inputDepthPitch, output, outputRowPitch, outputDepthPitch);
+}
+
+void LoadLA32FToRGBA32F(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const float *source = OffsetDataPointer&lt;float&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            float *dest = OffsetDataPointer&lt;float&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; 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 LoadLA16FToRGBA16F(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint16_t *dest = OffsetDataPointer&lt;uint16_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; 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 LoadRGB8ToBGRX8(size_t width, size_t height, size_t depth,
+                     const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                     uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; 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 LoadRG8ToBGRX8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[4 * x + 0] = 0x00;
+                dest[4 * x + 1] = source[x * 2 + 1];
+                dest[4 * x + 2] = source[x * 2 + 0];
+                dest[4 * x + 3] = 0xFF;
+            }
+        }
+    }
+}
+
+void LoadR8ToBGRX8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[4 * x + 0] = 0x00;
+                dest[4 * x + 1] = 0x00;
+                dest[4 * x + 2] = source[x];
+                dest[4 * x + 3] = 0xFF;
+            }
+        }
+    }
+}
+
+void LoadR5G6B5ToBGRA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t rgb = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((rgb &amp; 0x001F) &lt;&lt; 3) | ((rgb &amp; 0x001F) &gt;&gt; 2));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((rgb &amp; 0x07E0) &gt;&gt; 3) | ((rgb &amp; 0x07E0) &gt;&gt; 9));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((rgb &amp; 0xF800) &gt;&gt; 8) | ((rgb &amp; 0xF800) &gt;&gt; 13));
+                dest[4 * x + 3] = 0xFF;
+            }
+        }
+    }
+}
+
+void LoadR5G6B5ToRGBA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t rgb = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((rgb &amp; 0xF800) &gt;&gt; 8) | ((rgb &amp; 0xF800) &gt;&gt; 13));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((rgb &amp; 0x07E0) &gt;&gt; 3) | ((rgb &amp; 0x07E0) &gt;&gt; 9));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((rgb &amp; 0x001F) &lt;&lt; 3) | ((rgb &amp; 0x001F) &gt;&gt; 2));
+                dest[4 * x + 3] = 0xFF;
+            }
+        }
+    }
+}
+
+void LoadRGBA8ToBGRA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint32_t *source = OffsetDataPointer&lt;uint32_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint32_t rgba = source[x];
+                dest[x] = (ANGLE_ROTL(rgba, 16) &amp; 0x00ff00ff) | (rgba &amp; 0xff00ff00);
+            }
+        }
+    }
+}
+
+void LoadRGBA4ToBGRA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t rgba = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x00F0) &lt;&lt; 0) | ((rgba &amp; 0x00F0) &gt;&gt; 4));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x0F00) &gt;&gt; 4) | ((rgba &amp; 0x0F00) &gt;&gt; 8));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0xF000) &gt;&gt; 8) | ((rgba &amp; 0xF000) &gt;&gt; 12));
+                dest[4 * x + 3] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x000F) &lt;&lt; 4) | ((rgba &amp; 0x000F) &gt;&gt; 0));
+            }
+        }
+    }
+}
+
+void LoadRGBA4ToRGBA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t rgba = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0xF000) &gt;&gt; 8) | ((rgba &amp; 0xF000) &gt;&gt; 12));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x0F00) &gt;&gt; 4) | ((rgba &amp; 0x0F00) &gt;&gt; 8));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x00F0) &lt;&lt; 0) | ((rgba &amp; 0x00F0) &gt;&gt; 4));
+                dest[4 * x + 3] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x000F) &lt;&lt; 4) | ((rgba &amp; 0x000F) &gt;&gt; 0));
+            }
+        }
+    }
+}
+
+void LoadBGRA4ToBGRA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t bgra = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((bgra &amp; 0xF000) &gt;&gt; 8) | ((bgra &amp; 0xF000) &gt;&gt; 12));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((bgra &amp; 0x0F00) &gt;&gt; 4) | ((bgra &amp; 0x0F00) &gt;&gt; 8));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((bgra &amp; 0x00F0) &lt;&lt; 0) | ((bgra &amp; 0x00F0) &gt;&gt; 4));
+                dest[4 * x + 3] = static_cast&lt;uint8_t&gt;(((bgra &amp; 0x000F) &lt;&lt; 4) | ((bgra &amp; 0x000F) &gt;&gt; 0));
+            }
+        }
+    }
+}
+
+void LoadRGB5A1ToBGRA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t rgba = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x003E) &lt;&lt; 2) | ((rgba &amp; 0x003E) &gt;&gt; 3));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x07C0) &gt;&gt; 3) | ((rgba &amp; 0x07C0) &gt;&gt; 8));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0xF800) &gt;&gt; 8) | ((rgba &amp; 0xF800) &gt;&gt; 13));
+                dest[4 * x + 3] = static_cast&lt;uint8_t&gt;((rgba &amp; 0x0001) ? 0xFF : 0);
+            }
+        }
+    }
+}
+
+void LoadRGB5A1ToRGBA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t rgba = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0xF800) &gt;&gt; 8) | ((rgba &amp; 0xF800) &gt;&gt; 13));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x07C0) &gt;&gt; 3) | ((rgba &amp; 0x07C0) &gt;&gt; 8));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0x003E) &lt;&lt; 2) | ((rgba &amp; 0x003E) &gt;&gt; 3));
+                dest[4 * x + 3] = static_cast&lt;uint8_t&gt;((rgba &amp; 0x0001) ? 0xFF : 0);
+            }
+        }
+    }
+}
+
+
+void LoadBGR5A1ToBGRA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint16_t bgra = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;(((bgra &amp; 0xF800) &gt;&gt; 8) | ((bgra &amp; 0xF800) &gt;&gt; 13));
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;(((bgra &amp; 0x07C0) &gt;&gt; 3) | ((bgra &amp; 0x07C0) &gt;&gt; 8));
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;(((bgra &amp; 0x003E) &lt;&lt; 2) | ((bgra &amp; 0x003E) &gt;&gt; 3));
+                dest[4 * x + 3] = static_cast&lt;uint8_t&gt;((bgra &amp; 0x0001) ? 0xFF : 0);
+            }
+        }
+    }
+}
+
+void LoadRGB10A2ToRGBA8(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint32_t *source = OffsetDataPointer&lt;uint32_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint32_t rgba = source[x];
+                dest[4 * x + 0] = static_cast&lt;uint8_t&gt;((rgba &amp; 0x000003FF) &gt;&gt;  2);
+                dest[4 * x + 1] = static_cast&lt;uint8_t&gt;((rgba &amp; 0x000FFC00) &gt;&gt; 12);
+                dest[4 * x + 2] = static_cast&lt;uint8_t&gt;((rgba &amp; 0x3FF00000) &gt;&gt; 22);
+                dest[4 * x + 3] = static_cast&lt;uint8_t&gt;(((rgba &amp; 0xC0000000) &gt;&gt; 30) * 0x55);
+            }
+        }
+    }
+}
+
+void LoadRGB16FToRGB9E5(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x] = gl::convertRGBFloatsTo999E5(gl::float16ToFloat32(source[x * 3 + 0]),
+                                                      gl::float16ToFloat32(source[x * 3 + 1]),
+                                                      gl::float16ToFloat32(source[x * 3 + 2]));
+            }
+        }
+    }
+}
+
+void LoadRGB32FToRGB9E5(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const float *source = OffsetDataPointer&lt;float&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x] = gl::convertRGBFloatsTo999E5(source[x * 3 + 0], source[x * 3 + 1], source[x * 3 + 2]);
+            }
+        }
+    }
+}
+
+void LoadRGB16FToRG11B10F(size_t width, size_t height, size_t depth,
+                          const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                          uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint16_t *source = OffsetDataPointer&lt;uint16_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x] = (gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 0])) &lt;&lt;  0) |
+                          (gl::float32ToFloat11(gl::float16ToFloat32(source[x * 3 + 1])) &lt;&lt; 11) |
+                          (gl::float32ToFloat10(gl::float16ToFloat32(source[x * 3 + 2])) &lt;&lt; 22);
+            }
+        }
+    }
+}
+
+void LoadRGB32FToRG11B10F(size_t width, size_t height, size_t depth,
+                          const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                          uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const float *source = OffsetDataPointer&lt;float&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x] = (gl::float32ToFloat11(source[x * 3 + 0]) &lt;&lt;  0) |
+                          (gl::float32ToFloat11(source[x * 3 + 1]) &lt;&lt; 11) |
+                          (gl::float32ToFloat10(source[x * 3 + 2]) &lt;&lt; 22);
+            }
+        }
+    }
+}
+
+void LoadG8R24ToR24G8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint32_t *source = OffsetDataPointer&lt;uint32_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                uint32_t d = source[x] &gt;&gt; 8;
+                uint8_t  s = source[x] &amp; 0xFF;
+                dest[x] = d | (s &lt;&lt; 24);
+            }
+        }
+    }
+}
+
+void LoadRGB32FToRGBA16F(size_t width, size_t height, size_t depth,
+                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const float *source = OffsetDataPointer&lt;float&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint16_t *dest = OffsetDataPointer&lt;uint16_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x * 4 + 0] = gl::float32ToFloat16(source[x * 3 + 0]);
+                dest[x * 4 + 1] = gl::float32ToFloat16(source[x * 3 + 1]);
+                dest[x * 4 + 2] = gl::float32ToFloat16(source[x * 3 + 2]);
+                dest[x * 4 + 3] = gl::Float16One;
+            }
+        }
+    }
+}
+
+void LoadR32ToR16(size_t width, size_t height, size_t depth,
+                  const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                  uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint32_t *source = OffsetDataPointer&lt;uint32_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint16_t *dest = OffsetDataPointer&lt;uint16_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x] = source[x] &gt;&gt; 16;
+            }
+        }
+    }
+}
+
+void LoadR32ToR24G8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint32_t *source = OffsetDataPointer&lt;uint32_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x] = source[x] &gt;&gt; 8;
+            }
+        }
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimageh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,193 @@
</span><ins>+//
+// Copyright (c) 2013-2015 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.
+//
+
+// loadimage.h: Defines image loading functions
+
+#ifndef LIBANGLE_RENDERER_D3D_LOADIMAGE_H_
+#define LIBANGLE_RENDERER_D3D_LOADIMAGE_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+
+#include &lt;stdint.h&gt;
+
+namespace rx
+{
+
+void LoadA8ToRGBA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadA8ToBGRA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadA32FToRGBA32F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadA16FToRGBA16F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadL8ToRGBA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadL8ToBGRA8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadL32FToRGBA32F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadL16FToRGBA16F(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadLA8ToRGBA8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadLA8ToBGRA8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadLA32FToRGBA32F(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadLA16FToRGBA16F(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB8ToBGRX8(size_t width, size_t height, size_t depth,
+                     const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                     uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRG8ToBGRX8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadR8ToBGRX8(size_t width, size_t height, size_t depth,
+                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadR5G6B5ToBGRA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadR5G6B5ToRGBA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
+                           const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                           uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGBA8ToBGRA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGBA4ToBGRA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGBA4ToRGBA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadBGRA4ToBGRA8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB5A1ToBGRA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB5A1ToRGBA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadBGR5A1ToBGRA8(size_t width, size_t height, size_t depth,
+                       const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                       uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB10A2ToRGBA8(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB16FToRGB9E5(size_t width, size_t height, size_t depth,
+                          const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                          uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB32FToRGB9E5(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB16FToRG11B10F(size_t width, size_t height, size_t depth,
+                          const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                          uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB32FToRG11B10F(size_t width, size_t height, size_t depth,
+                          const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                          uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadG8R24ToR24G8(size_t width, size_t height, size_t depth,
+                      const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                      uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+template &lt;typename type, size_t componentCount&gt;
+inline void LoadToNative(size_t width, size_t height, size_t depth,
+                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+template &lt;typename type, uint32_t fourthComponentBits&gt;
+inline void LoadToNative3To4(size_t width, size_t height, size_t depth,
+                             const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                             uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+template &lt;size_t componentCount&gt;
+inline void Load32FTo16F(size_t width, size_t height, size_t depth,
+                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadRGB32FToRGBA16F(size_t width, size_t height, size_t depth,
+                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+template &lt;size_t blockWidth, size_t blockHeight, size_t blockSize&gt;
+inline void LoadCompressedToNative(size_t width, size_t height, size_t depth,
+                                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadR32ToR16(size_t width, size_t height, size_t depth,
+                  const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                  uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+template &lt;typename type, uint32_t firstBits, uint32_t secondBits, uint32_t thirdBits, uint32_t fourthBits&gt;
+inline void Initialize4ComponentData(size_t width, size_t height, size_t depth,
+                                     uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+void LoadR32ToR24G8(size_t width, size_t height, size_t depth,
+                    const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                    uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch);
+
+template &lt;typename T&gt;
+inline T *OffsetDataPointer(uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch);
+
+template &lt;typename T&gt;
+inline const T *OffsetDataPointer(const uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch);
+
+}
+
+#include &quot;loadimage.inl&quot;
+
+#endif // LIBANGLE_RENDERER_D3D_LOADIMAGE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimageinl"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.inl (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.inl                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimage.inl        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,156 @@
</span><ins>+//
+// Copyright (c) 2014-2015 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 &quot;common/mathutil.h&quot;
+
+namespace rx
+{
+
+template &lt;typename T&gt;
+inline T *OffsetDataPointer(uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+    return reinterpret_cast&lt;T*&gt;(data + (y * rowPitch) + (z * depthPitch));
+}
+
+template &lt;typename T&gt;
+inline const T *OffsetDataPointer(const uint8_t *data, size_t y, size_t z, size_t rowPitch, size_t depthPitch)
+{
+    return reinterpret_cast&lt;const T*&gt;(data + (y * rowPitch) + (z * depthPitch));
+}
+
+template &lt;typename type, size_t componentCount&gt;
+inline void LoadToNative(size_t width, size_t height, size_t depth,
+                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    const size_t rowSize = width * sizeof(type) * componentCount;
+    const size_t layerSize = rowSize * height;
+    const size_t imageSize = layerSize * depth;
+
+    if (layerSize == inputDepthPitch &amp;&amp; layerSize == outputDepthPitch)
+    {
+        ASSERT(rowSize == inputRowPitch &amp;&amp; rowSize == outputRowPitch);
+        memcpy(output, input, imageSize);
+    }
+    else if (rowSize == inputRowPitch &amp;&amp; rowSize == outputRowPitch)
+    {
+        for (size_t z = 0; z &lt; depth; z++)
+        {
+            const type *source = OffsetDataPointer&lt;type&gt;(input, 0, z, inputRowPitch, inputDepthPitch);
+            type *dest = OffsetDataPointer&lt;type&gt;(output, 0, z, outputRowPitch, outputDepthPitch);
+
+            memcpy(dest, source, layerSize);
+        }
+    }
+    else
+    {
+        for (size_t z = 0; z &lt; depth; z++)
+        {
+            for (size_t y = 0; y &lt; height; y++)
+            {
+                const type *source = OffsetDataPointer&lt;type&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+                type *dest = OffsetDataPointer&lt;type&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+                memcpy(dest, source, width * sizeof(type) * componentCount);
+            }
+        }
+    }
+}
+
+template &lt;typename type, uint32_t fourthComponentBits&gt;
+inline void LoadToNative3To4(size_t width, size_t height, size_t depth,
+                             const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                             uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    const type fourthValue = gl::bitCast&lt;type&gt;(fourthComponentBits);
+
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const type *source = OffsetDataPointer&lt;type&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            type *dest = OffsetDataPointer&lt;type&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                dest[x * 4 + 0] = source[x * 3 + 0];
+                dest[x * 4 + 1] = source[x * 3 + 1];
+                dest[x * 4 + 2] = source[x * 3 + 2];
+                dest[x * 4 + 3] = fourthValue;
+            }
+        }
+    }
+}
+
+template &lt;size_t componentCount&gt;
+inline void Load32FTo16F(size_t width, size_t height, size_t depth,
+                         const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                         uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    const size_t elementWidth = componentCount * width;
+
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const float *source = OffsetDataPointer&lt;float&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint16_t *dest = OffsetDataPointer&lt;uint16_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+
+            for (size_t x = 0; x &lt; elementWidth; x++)
+            {
+                dest[x] = gl::float32ToFloat16(source[x]);
+            }
+        }
+    }
+}
+
+template &lt;size_t blockWidth, size_t blockHeight, size_t blockSize&gt;
+inline void LoadCompressedToNative(size_t width, size_t height, size_t depth,
+                                   const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                                   uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    const size_t columns = (width + (blockWidth - 1)) / blockWidth;
+    const size_t rows = (height + (blockHeight - 1)) / blockHeight;
+
+    for (size_t z = 0; z &lt; depth; ++z)
+    {
+        for (size_t y = 0; y &lt; rows; ++y)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint8_t *dest = OffsetDataPointer&lt;uint8_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            memcpy(dest, source, columns * blockSize);
+        }
+    }
+}
+
+template &lt;typename type, uint32_t firstBits, uint32_t secondBits, uint32_t thirdBits, uint32_t fourthBits&gt;
+inline void Initialize4ComponentData(size_t width, size_t height, size_t depth,
+                                     uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+    type writeValues[4] =
+    {
+        gl::bitCast&lt;type&gt;(firstBits),
+        gl::bitCast&lt;type&gt;(secondBits),
+        gl::bitCast&lt;type&gt;(thirdBits),
+        gl::bitCast&lt;type&gt;(fourthBits),
+    };
+
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            type *destRow = OffsetDataPointer&lt;type&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+            for (size_t x = 0; x &lt; width; x++)
+            {
+                type* destPixel = destRow + x * 4;
+
+                // This could potentially be optimized by generating an entire row of initialization
+                // data and copying row by row instead of pixel by pixel.
+                memcpy(destPixel, writeValues, sizeof(type) * 4);
+            }
+        }
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererd3dloadimageSSE2cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimageSSE2.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimageSSE2.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/d3d/loadimageSSE2.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,125 @@
</span><ins>+//
+// Copyright (c) 2002-2015 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.
+//
+
+// loadimageSSE2.cpp: Defines image loading functions. It's
+// in a separated file for GCC, which can enable SSE usage only per-file,
+// not for code blocks that use SSE2 explicitly.
+
+#include &quot;libANGLE/renderer/d3d/loadimage.h&quot;
+
+#include &quot;common/platform.h&quot;
+
+#ifdef ANGLE_USE_SSE
+#include &lt;emmintrin.h&gt;
+#endif
+
+namespace rx
+{
+
+void LoadA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
+                        const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                        uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+#if defined(ANGLE_USE_SSE)
+    __m128i zeroWide = _mm_setzero_si128();
+
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint8_t *source = OffsetDataPointer&lt;uint8_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+
+            size_t x = 0;
+
+            // Make output writes aligned
+            for (; ((reinterpret_cast&lt;intptr_t&gt;(&amp;dest[x]) &amp; 0xF) != 0 &amp;&amp; x &lt; width); x++)
+            {
+                dest[x] = static_cast&lt;uint32_t&gt;(source[x]) &lt;&lt; 24;
+            }
+
+            for (; x + 7 &lt; width; x += 8)
+            {
+                __m128i sourceData = _mm_loadl_epi64(reinterpret_cast&lt;const __m128i*&gt;(&amp;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&lt;__m128i*&gt;(&amp;dest[x]), lo);
+                _mm_store_si128(reinterpret_cast&lt;__m128i*&gt;(&amp;dest[x + 4]), hi);
+            }
+
+            // Handle the remainder
+            for (; x &lt; width; x++)
+            {
+                dest[x] = static_cast&lt;uint32_t&gt;(source[x]) &lt;&lt; 24;
+            }
+        }
+    }
+#else
+    // Ensure that this function is reported as not implemented for ARM builds because
+    // the instructions below are not present for that architecture.
+    UNIMPLEMENTED();
+    return;
+#endif
+}
+
+void LoadRGBA8ToBGRA8_SSE2(size_t width, size_t height, size_t depth,
+                           const uint8_t *input, size_t inputRowPitch, size_t inputDepthPitch,
+                           uint8_t *output, size_t outputRowPitch, size_t outputDepthPitch)
+{
+#if defined(ANGLE_USE_SSE)
+    __m128i brMask = _mm_set1_epi32(0x00ff00ff);
+
+    for (size_t z = 0; z &lt; depth; z++)
+    {
+        for (size_t y = 0; y &lt; height; y++)
+        {
+            const uint32_t *source = OffsetDataPointer&lt;uint32_t&gt;(input, y, z, inputRowPitch, inputDepthPitch);
+            uint32_t *dest = OffsetDataPointer&lt;uint32_t&gt;(output, y, z, outputRowPitch, outputDepthPitch);
+
+            size_t x = 0;
+
+            // Make output writes aligned
+            for (; ((reinterpret_cast&lt;intptr_t&gt;(&amp;dest[x]) &amp; 15) != 0) &amp;&amp; x &lt; width; x++)
+            {
+                uint32_t rgba = source[x];
+                dest[x] = (ANGLE_ROTL(rgba, 16) &amp; 0x00ff00ff) | (rgba &amp; 0xff00ff00);
+            }
+
+            for (; x + 3 &lt; width; x += 4)
+            {
+                __m128i sourceData = _mm_loadu_si128(reinterpret_cast&lt;const __m128i*&gt;(&amp;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&lt;__m128i*&gt;(&amp;dest[x]), result);
+            }
+
+            // Perform leftover writes
+            for (; x &lt; width; x++)
+            {
+                uint32_t rgba = source[x];
+                dest[x] = (ANGLE_ROTL(rgba, 16) &amp; 0x00ff00ff) | (rgba &amp; 0xff00ff00);
+            }
+        }
+    }
+#else
+    // Ensure that this function is reported as not implemented for ARM builds because
+    // the instructions below are not present for that architecture.
+    UNIMPLEMENTED();
+    return;
+#endif
+}
+
+}
+
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErenderergenerate_new_rendererpy"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/generate_new_renderer.py (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/generate_new_renderer.py                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/generate_new_renderer.py        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,258 @@
</span><ins>+#!/usr/bin/python
+#
+# Copyright (c) 2015 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.
+#
+# generate_new_renderer.py:
+#   Utility script to generate stubs for a new Renderer class.
+#   Usage: generate_new_renderer.py &lt;renderer name&gt; &lt;renderer suffix&gt;
+#     Renderer name is the folder for the renderer subdirectory
+#     Renderer suffix is the abbreviation to append after the class names.
+#
+# The script is fairly robust but may not work for all new methods or
+# other unexpected features. It expects that abstract methods are all
+# grouped after the public destructor or after the private
+# DISALLOW_COPY_AND_ASSIGN macro.
+
+import os
+import sys
+import re
+import string
+
+if len(sys.argv) &lt; 3:
+    print('Usage: ' + sys.argv[0] + ' &lt;renderer name&gt; &lt;renderer suffix&gt;')
+
+renderer_name = sys.argv[1]
+renderer_suffix = sys.argv[2]
+
+# ensure subdir exists
+if not os.path.isdir(renderer_name):
+    os.mkdir(renderer_name)
+
+impl_classes = [
+    'Buffer',
+    'Compiler',
+    'Display',
+    'FenceNV',
+    'FenceSync',
+    'Framebuffer',
+    'Program',
+    'Query',
+    'Renderbuffer',
+    'Renderer',
+    'Shader',
+    'Surface',
+    'Texture',
+    'TransformFeedback',
+    'VertexArray',
+]
+
+h_file_template = &quot;&quot;&quot;//
+// Copyright 2015 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.
+//
+
+// $TypedImpl.h: Defines the class interface for $TypedImpl.
+
+#ifndef LIBANGLE_RENDERER_${RendererNameCaps}_${TypedImplCaps}_H_
+#define LIBANGLE_RENDERER_${RendererNameCaps}_${TypedImplCaps}_H_
+
+#include &quot;libANGLE/renderer/$BaseImpl.h&quot;
+
+namespace rx
+{
+
+class $TypedImpl : public $BaseImpl
+{
+  public:
+    $TypedImpl($ConstructorParams);
+    ~$TypedImpl() override;
+$ImplMethodDeclarations$PrivateImplMethodDeclarations};
+
+}
+
+#endif // LIBANGLE_RENDERER_${RendererNameCaps}_${TypedImplCaps}_H_
+&quot;&quot;&quot;
+
+cpp_file_template = &quot;&quot;&quot;//
+// Copyright 2015 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.
+//
+
+// $TypedImpl.cpp: Implements the class methods for $TypedImpl.
+
+#include &quot;libANGLE/renderer/$RendererName/$TypedImpl.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+$TypedImpl::$TypedImpl($ConstructorParams)
+    : $BaseImpl($BaseContructorArgs)
+{}
+
+$TypedImpl::~$TypedImpl()
+{}
+$ImplMethodDefinitions
+}
+&quot;&quot;&quot;
+
+def generate_impl_declaration(impl_stub):
+    # ensure the wrapped lines are aligned vertically
+    temp = re.sub(r'\n        ', '\n', impl_stub)
+    return temp + ' override;\n'
+
+def generate_impl_definition(impl_stub, typed_impl):
+    function_signature = impl_stub.strip()
+
+    # strip comments
+    function_signature = re.sub(r'\/\/[^\n]*\n', '', function_signature).strip()
+
+    prog = re.compile(r'^(.+[ \*\&amp;])([^ \(\*\&amp;]+\()')
+    return_value = prog.match(function_signature).group(1)
+
+    # ensure the wrapped lines are aligned vertically
+    spaces = ' ' * len(typed_impl)
+    function_signature = re.sub(r'\n          ', '\n' + spaces, function_signature)
+
+    # add class scoping
+    function_signature = prog.sub(r'\1' + typed_impl + r'::\2', function_signature)
+    function_signature += '\n'
+
+    return_statement = ''
+    return_type = return_value.strip()
+
+    if return_type != 'void':
+        # specialized return values for Errors, pointers, etc
+        if return_type == 'gl::Error':
+            return_statement = '    return gl::Error(GL_INVALID_OPERATION);\n'
+        elif return_type == 'egl::Error':
+            return_statement = '    return egl::Error(EGL_BAD_ACCESS);\n'
+        elif return_type == 'LinkResult':
+            return_statement = '    return LinkResult(false, gl::Error(GL_INVALID_OPERATION));\n'
+        elif re.search(r'[\*\&amp;]$', return_type):
+            return_statement = '    return static_cast&lt;' + return_type + '&gt;(0);\n'
+        else:
+            return_statement = '    return ' + return_type + '();\n'
+
+    body = '{\n' + '    UNIMPLEMENTED();\n' + return_statement +'}\n'
+
+    return '\n' + function_signature + body
+
+def get_constructor_args(constructor):
+    params = re.search(r'\((.*)\)', constructor).group(1)
+    args = ', '.join(re.findall(r'[^\w]?(\w+)(?:\,|$)', params))
+    return params, args
+
+def parse_impl_header(base_impl):
+    impl_h_file_path = base_impl + '.h'
+    impl_h_file = open(impl_h_file_path, 'r')
+
+    # extract impl stubs
+    copy = False
+    copy_private = False
+    impl_stubs = ''
+    private_impl_stubs = ''
+    constructor = base_impl + '() {}'
+    for line in impl_h_file:
+        clean_line = line.strip()
+
+        match = re.search(r'^(?:explicit )?(' + base_impl + r'\([^\)]*\))', clean_line);
+        if match:
+            constructor = match.group(1)
+
+        # begin capture when reading the destructor.
+        # begin capture also in the private scope (a few special cases)
+        # end capture when we reach a non-virtual function, or different scope.
+        if '~' + base_impl in clean_line:
+            copy = True
+            copy_private = False
+        elif 'private:' in clean_line:
+            copy = False
+            copy_private = True
+        elif ';' in clean_line and ' = 0' not in clean_line:
+            copy = False
+            copy_private = False
+        elif '}' in clean_line or 'protected:' in clean_line or 'private:' in clean_line:
+            copy = False
+            copy_private = False
+        elif copy:
+            impl_stubs += line
+        elif copy_private:
+            private_impl_stubs += line
+
+    impl_h_file.close()
+
+    return impl_stubs, private_impl_stubs, constructor
+
+for impl_class in impl_classes:
+
+    base_impl = impl_class
+
+    # special case for Renderer
+    if impl_class != 'Renderer':
+        base_impl += 'Impl'
+
+    typed_impl = impl_class + renderer_suffix
+
+    h_file_path = os.path.join(renderer_name, typed_impl + '.h')
+    cpp_file_path = os.path.join(renderer_name, typed_impl + '.cpp')
+
+    h_file = open(h_file_path, 'w')
+    cpp_file = open(cpp_file_path, 'w')
+
+    # extract impl stubs
+    impl_stubs, private_impl_stubs, constructor = parse_impl_header(base_impl)
+
+    # more special case for Renderer
+    # TODO(jmadill): general case for base classes
+    if impl_class == 'Renderer':
+        base_impl_stubs, base_private_impl_stubs, base_constructor = parse_impl_header('ImplFactory')
+        impl_stubs += base_impl_stubs
+        private_impl_stubs += base_private_impl_stubs
+
+    impl_method_declarations = ''
+    impl_method_definitions = ''
+    private_impl_method_declarations = ''
+
+    for impl_stub in impl_stubs.split(' = 0;\n'):
+        # use 'virtual' to identify the strings with functions
+        if 'virtual' in impl_stub:
+            temp = re.sub(r'virtual ', '', impl_stub)
+            impl_method_declarations += generate_impl_declaration(temp)
+            impl_method_definitions += generate_impl_definition(temp, typed_impl)
+
+    for impl_stub in private_impl_stubs.split(' = 0;\n'):
+        # use 'virtual' to identify the strings with functions
+        if 'virtual' in impl_stub:
+            temp = re.sub(r'virtual ', '', impl_stub)
+            private_impl_method_declarations += generate_impl_declaration(temp)
+            impl_method_definitions += generate_impl_definition(temp, typed_impl)
+
+    constructor_params, base_constructor_args = get_constructor_args(constructor)
+
+    if private_impl_method_declarations:
+        private_impl_method_declarations = &quot;\n  private:\n&quot; + private_impl_method_declarations
+
+    substitutions = {
+        'BaseImpl': base_impl,
+        'TypedImpl': typed_impl,
+        'TypedImplCaps': typed_impl.upper(),
+        'RendererName': renderer_name,
+        'RendererNameCaps': renderer_name.upper(),
+        'ImplMethodDeclarations': impl_method_declarations,
+        'ImplMethodDefinitions': impl_method_definitions,
+        'ConstructorParams': constructor_params,
+        'BaseContructorArgs': base_constructor_args,
+        'PrivateImplMethodDeclarations': private_impl_method_declarations,
+    }
+
+    h_file.write(string.Template(h_file_template).substitute(substitutions))
+    cpp_file.write(string.Template(cpp_file_template).substitute(substitutions))
+
+    h_file.close()
+    cpp_file.close()
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglBufferGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// BufferGL.cpp: Implements the class methods for BufferGL.
+
+#include &quot;libANGLE/renderer/gl/BufferGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+
+namespace rx
+{
+
+// Use the GL_COPY_READ_BUFFER binding when two buffers need to be bound simultaneously.
+// GL_ELEMENT_ARRAY_BUFFER is supported on more versions but can modify the state of the currently
+// bound VAO.  Two simultaneous buffer bindings are only needed for glCopyBufferSubData which also
+// adds the GL_COPY_READ_BUFFER binding.
+static const GLenum SourceBufferOperationTarget = GL_COPY_READ_BUFFER;
+
+// Use the GL_ELEMENT_ARRAY_BUFFER binding for most operations since it's available on all
+// supported GL versions and doesn't affect any current state when it changes.
+static const GLenum DestBufferOperationTarget = GL_ARRAY_BUFFER;
+
+BufferGL::BufferGL(const FunctionsGL *functions, StateManagerGL *stateManager)
+    : BufferImpl(),
+      mFunctions(functions),
+      mStateManager(stateManager),
+      mBufferID(0)
+{
+    ASSERT(mFunctions);
+    ASSERT(mStateManager);
+
+    mFunctions-&gt;genBuffers(1, &amp;mBufferID);
+}
+
+BufferGL::~BufferGL()
+{
+    if (mBufferID)
+    {
+        mFunctions-&gt;deleteBuffers(1, &amp;mBufferID);
+        mBufferID = 0;
+    }
+}
+
+gl::Error BufferGL::setData(const void* data, size_t size, GLenum usage)
+{
+    mStateManager-&gt;bindBuffer(DestBufferOperationTarget, mBufferID);
+    mFunctions-&gt;bufferData(DestBufferOperationTarget, size, data, usage);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error BufferGL::setSubData(const void* data, size_t size, size_t offset)
+{
+    mStateManager-&gt;bindBuffer(DestBufferOperationTarget, mBufferID);
+    mFunctions-&gt;bufferSubData(DestBufferOperationTarget, offset, size, data);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error BufferGL::copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
+{
+    BufferGL *sourceGL = GetAs&lt;BufferGL&gt;(source);
+
+    mStateManager-&gt;bindBuffer(DestBufferOperationTarget, mBufferID);
+    mStateManager-&gt;bindBuffer(SourceBufferOperationTarget, sourceGL-&gt;getBufferID());
+
+    mFunctions-&gt;copyBufferSubData(SourceBufferOperationTarget, DestBufferOperationTarget, sourceOffset, destOffset, size);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error BufferGL::map(GLenum access, GLvoid **mapPtr)
+{
+    mStateManager-&gt;bindBuffer(DestBufferOperationTarget, mBufferID);
+    *mapPtr = mFunctions-&gt;mapBuffer(DestBufferOperationTarget, access);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error BufferGL::mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr)
+{
+    mStateManager-&gt;bindBuffer(DestBufferOperationTarget, mBufferID);
+    *mapPtr = mFunctions-&gt;mapBufferRange(DestBufferOperationTarget, offset, length, access);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error BufferGL::unmap(GLboolean *result)
+{
+    ASSERT(*result);
+
+    mStateManager-&gt;bindBuffer(DestBufferOperationTarget, mBufferID);
+    *result = mFunctions-&gt;unmapBuffer(DestBufferOperationTarget);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error BufferGL::getData(const uint8_t **outData)
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+GLuint BufferGL::getBufferID() const
+{
+    return mBufferID;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglBufferGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/BufferGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// BufferGL.h: Defines the class interface for BufferGL.
+
+#ifndef LIBANGLE_RENDERER_GL_BUFFERGL_H_
+#define LIBANGLE_RENDERER_GL_BUFFERGL_H_
+
+#include &quot;libANGLE/renderer/BufferImpl.h&quot;
+
+namespace rx
+{
+
+class FunctionsGL;
+class StateManagerGL;
+
+class BufferGL : public BufferImpl
+{
+  public:
+    BufferGL(const FunctionsGL *functions, StateManagerGL *stateManager);
+    ~BufferGL() override;
+
+    gl::Error setData(const void* data, size_t size, GLenum usage) override;
+    gl::Error setSubData(const void* data, size_t size, size_t offset) override;
+    gl::Error copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size) override;
+    gl::Error map(GLenum access, GLvoid **mapPtr) override;
+    gl::Error mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr) override;
+    gl::Error unmap(GLboolean *result) override;
+
+    // This method may not have a corresponding GL-backed function. It is necessary
+    // for validation, for certain indexed draw calls.
+    gl::Error getData(const uint8_t **outData) override;
+
+    GLuint getBufferID() const;
+
+  private:
+    const FunctionsGL *mFunctions;
+    StateManagerGL *mStateManager;
+
+    GLuint mBufferID;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_BUFFERGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglCompilerGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// CompilerGL.cpp: Implements the class methods for CompilerGL.
+
+#include &quot;libANGLE/renderer/gl/CompilerGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+
+namespace rx
+{
+
+// Global count of active shader compiler handles. Needed to know when to call ShInitialize and ShFinalize.
+static size_t activeCompilerHandles = 0;
+
+CompilerGL::CompilerGL(const gl::Data &amp;data)
+    : CompilerImpl(),
+      mSpec(data.clientVersion &gt; 2 ? SH_GLES3_SPEC : SH_GLES2_SPEC),
+      mOutputType(SH_GLSL_OUTPUT),
+      mResources(),
+      mFragmentCompiler(nullptr),
+      mVertexCompiler(nullptr)
+{
+    ASSERT(data.clientVersion == 2 || data.clientVersion == 3);
+
+    const gl::Caps &amp;caps = *data.caps;
+    const gl::Extensions &amp;extensions = *data.extensions;
+
+    ShInitBuiltInResources(&amp;mResources);
+    mResources.MaxVertexAttribs = caps.maxVertexAttributes;
+    mResources.MaxVertexUniformVectors = caps.maxVertexUniformVectors;
+    mResources.MaxVaryingVectors = caps.maxVaryingVectors;
+    mResources.MaxVertexTextureImageUnits = caps.maxVertexTextureImageUnits;
+    mResources.MaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits;
+    mResources.MaxTextureImageUnits = caps.maxTextureImageUnits;
+    mResources.MaxFragmentUniformVectors = caps.maxFragmentUniformVectors;
+    mResources.MaxDrawBuffers = caps.maxDrawBuffers;
+    mResources.OES_standard_derivatives = extensions.standardDerivatives;
+    mResources.EXT_draw_buffers = extensions.drawBuffers;
+    mResources.EXT_shader_texture_lod = extensions.shaderTextureLOD;
+    mResources.OES_EGL_image_external = 0; // TODO: disabled until the extension is actually supported.
+    mResources.FragmentPrecisionHigh = 1; // TODO: use shader precision caps to determine if high precision is supported?
+    mResources.EXT_frag_depth = extensions.fragDepth;
+
+    // GLSL ES 3.0 constants
+    mResources.MaxVertexOutputVectors = caps.maxVertexOutputComponents / 4;
+    mResources.MaxFragmentInputVectors = caps.maxFragmentInputComponents / 4;
+    mResources.MinProgramTexelOffset = caps.minProgramTexelOffset;
+    mResources.MaxProgramTexelOffset = caps.maxProgramTexelOffset;
+}
+
+CompilerGL::~CompilerGL()
+{
+    release();
+}
+
+gl::Error CompilerGL::release()
+{
+    if (mFragmentCompiler)
+    {
+        ShDestruct(mFragmentCompiler);
+        mFragmentCompiler = NULL;
+
+        ASSERT(activeCompilerHandles &gt; 0);
+        activeCompilerHandles--;
+    }
+
+    if (mVertexCompiler)
+    {
+        ShDestruct(mVertexCompiler);
+        mVertexCompiler = NULL;
+
+        ASSERT(activeCompilerHandles &gt; 0);
+        activeCompilerHandles--;
+    }
+
+    if (activeCompilerHandles == 0)
+    {
+        ShFinalize();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+ShHandle CompilerGL::getCompilerHandle(GLenum type)
+{
+    ShHandle *compiler = NULL;
+    switch (type)
+    {
+      case GL_VERTEX_SHADER:
+        compiler = &amp;mVertexCompiler;
+        break;
+
+      case GL_FRAGMENT_SHADER:
+        compiler = &amp;mFragmentCompiler;
+        break;
+
+      default:
+        UNREACHABLE();
+        return NULL;
+    }
+
+    if ((*compiler) == nullptr)
+    {
+        if (activeCompilerHandles == 0)
+        {
+            ShInitialize();
+        }
+
+        *compiler = ShConstructCompiler(type, mSpec, mOutputType, &amp;mResources);
+        activeCompilerHandles++;
+    }
+
+    return *compiler;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglCompilerGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/CompilerGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// CompilerGL.h: Defines the class interface for CompilerGL.
+
+#ifndef LIBANGLE_RENDERER_GL_COMPILERGL_H_
+#define LIBANGLE_RENDERER_GL_COMPILERGL_H_
+
+#include &quot;libANGLE/renderer/CompilerImpl.h&quot;
+
+#include &quot;GLSLANG/ShaderLang.h&quot;
+
+namespace gl
+{
+struct Data;
+}
+
+namespace rx
+{
+
+class CompilerGL : public CompilerImpl
+{
+  public:
+    CompilerGL(const gl::Data &amp;data);
+    ~CompilerGL() override;
+
+    gl::Error release() override;
+
+    ShHandle getCompilerHandle(GLenum type);
+
+  private:
+    ShShaderSpec mSpec;
+    ShShaderOutput mOutputType;
+    ShBuiltInResources mResources;
+
+    ShHandle mFragmentCompiler;
+    ShHandle mVertexCompiler;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_COMPILERGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglDisplayGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// DisplayGL.h: GL implementation of egl::Display
+
+#include &quot;libANGLE/renderer/gl/DisplayGL.h&quot;
+
+#include &quot;libANGLE/AttributeMap.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/renderer/gl/RendererGL.h&quot;
+#include &quot;libANGLE/renderer/gl/SurfaceGL.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+
+namespace rx
+{
+
+DisplayGL::DisplayGL()
+    : mRenderer(nullptr)
+{
+}
+
+DisplayGL::~DisplayGL()
+{
+}
+
+egl::Error DisplayGL::initialize(egl::Display *display)
+{
+    mRenderer = new RendererGL(getFunctionsGL());
+    return egl::Error(EGL_SUCCESS);
+}
+
+void DisplayGL::terminate()
+{
+    SafeDelete(mRenderer);
+}
+
+egl::Error DisplayGL::createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &amp;attribs, gl::Context **outContext)
+{
+    ASSERT(mRenderer != nullptr);
+
+    EGLint clientVersion = attribs.get(EGL_CONTEXT_CLIENT_VERSION, 1);
+    bool notifyResets = (attribs.get(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, EGL_NO_RESET_NOTIFICATION_EXT) == EGL_LOSE_CONTEXT_ON_RESET_EXT);
+    bool robustAccess = (attribs.get(EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT, EGL_FALSE) == EGL_TRUE);
+
+    *outContext = new gl::Context(config, clientVersion, shareContext, mRenderer, notifyResets, robustAccess);
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
+{
+    if (!drawSurface)
+    {
+        return egl::Error(EGL_SUCCESS);
+    }
+
+    SurfaceGL *glDrawSurface = GetImplAs&lt;SurfaceGL&gt;(drawSurface);
+    return glDrawSurface-&gt;makeCurrent();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglDisplayGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/DisplayGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// DisplayGL.h: Defines the class interface for DisplayGL.
+
+#ifndef LIBANGLE_RENDERER_GL_DISPLAYGL_H_
+#define LIBANGLE_RENDERER_GL_DISPLAYGL_H_
+
+#include &quot;libANGLE/renderer/DisplayImpl.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+
+namespace rx
+{
+
+class RendererGL;
+
+class DisplayGL : public DisplayImpl
+{
+  public:
+    DisplayGL();
+    ~DisplayGL() override;
+
+    egl::Error initialize(egl::Display *display) override;
+    void terminate() override;
+
+    egl::Error createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &amp;attribs,
+                             gl::Context **outContext) override;
+
+    egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) override;
+
+  private:
+    virtual const FunctionsGL *getFunctionsGL() const = 0;
+
+    RendererGL *mRenderer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_DISPLAYGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceNVGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// FenceNVGL.cpp: Implements the class methods for FenceNVGL.
+
+#include &quot;libANGLE/renderer/gl/FenceNVGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+
+
+namespace rx
+{
+
+FenceNVGL::FenceNVGL(const FunctionsGL *functions)
+    : FenceNVImpl(),
+      mFunctions(functions)
+{
+    mFunctions-&gt;genFencesNV(1, &amp;mFence);
+}
+
+FenceNVGL::~FenceNVGL()
+{
+    mFunctions-&gt;deleteFencesNV(1, &amp;mFence);
+    mFence = 0;
+}
+
+gl::Error FenceNVGL::set(GLenum condition)
+{
+    ASSERT(condition == GL_ALL_COMPLETED_NV);
+    mFunctions-&gt;setFenceNV(mFence, condition);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceNVGL::test(GLboolean *outFinished)
+{
+    ASSERT(outFinished);
+    *outFinished = mFunctions-&gt;testFenceNV(mFence);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceNVGL::finish()
+{
+    mFunctions-&gt;finishFenceNV(mFence);
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceNVGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceNVGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// FenceNVGL.h: Defines the class interface for FenceNVGL.
+
+#ifndef LIBANGLE_RENDERER_GL_FENCENVGL_H_
+#define LIBANGLE_RENDERER_GL_FENCENVGL_H_
+
+#include &quot;libANGLE/renderer/FenceNVImpl.h&quot;
+
+namespace rx
+{
+class FunctionsGL;
+
+class FenceNVGL : public FenceNVImpl
+{
+  public:
+    explicit FenceNVGL(const FunctionsGL *functions);
+    ~FenceNVGL() override;
+
+    gl::Error set(GLenum condition) override;
+    gl::Error test(GLboolean *outFinished) override;
+    gl::Error finish() override;
+
+  private:
+    GLuint mFence;
+
+    const FunctionsGL *mFunctions;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_FENCENVGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceSyncGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// FenceSyncGL.cpp: Implements the class methods for FenceSyncGL.
+
+#include &quot;libANGLE/renderer/gl/FenceSyncGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+
+namespace rx
+{
+
+FenceSyncGL::FenceSyncGL(const FunctionsGL *functions)
+    : FenceSyncImpl(),
+      mFunctions(functions),
+      mSyncObject(0)
+{
+    ASSERT(mFunctions);
+}
+
+FenceSyncGL::~FenceSyncGL()
+{
+    if (mSyncObject != 0)
+    {
+        mFunctions-&gt;deleteSync(mSyncObject);
+    }
+}
+
+gl::Error FenceSyncGL::set(GLenum condition, GLbitfield flags)
+{
+    ASSERT(condition == GL_SYNC_GPU_COMMANDS_COMPLETE &amp;&amp; flags == 0);
+    mSyncObject = mFunctions-&gt;fenceSync(condition, flags);
+    if (mSyncObject == 0)
+    {
+        // if glFenceSync fails, it returns 0.
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;glFenceSync failed to create a GLsync object.&quot;);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceSyncGL::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult)
+{
+    ASSERT(mSyncObject != 0);
+    *outResult = mFunctions-&gt;clientWaitSync(mSyncObject, flags, timeout);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceSyncGL::serverWait(GLbitfield flags, GLuint64 timeout)
+{
+    ASSERT(mSyncObject != 0);
+    mFunctions-&gt;waitSync(mSyncObject, flags, timeout);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FenceSyncGL::getStatus(GLint *outResult)
+{
+    ASSERT(mSyncObject != 0);
+    mFunctions-&gt;getSynciv(mSyncObject, GL_SYNC_STATUS, 1, nullptr, outResult);
+    return gl::Error(GL_NO_ERROR);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFenceSyncGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FenceSyncGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// FenceSyncGL.h: Defines the class interface for FenceSyncGL.
+
+#ifndef LIBANGLE_RENDERER_GL_FENCESYNCGL_H_
+#define LIBANGLE_RENDERER_GL_FENCESYNCGL_H_
+
+#include &quot;libANGLE/renderer/FenceSyncImpl.h&quot;
+
+namespace rx
+{
+class FunctionsGL;
+
+class FenceSyncGL : public FenceSyncImpl
+{
+  public:
+    explicit FenceSyncGL(const FunctionsGL *functions);
+    ~FenceSyncGL() override;
+
+    gl::Error set(GLenum condition, GLbitfield flags) override;
+    gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) override;
+    gl::Error serverWait(GLbitfield flags, GLuint64 timeout) override;
+    gl::Error getStatus(GLint *outResult) override;
+
+  private:
+    const FunctionsGL *mFunctions;
+    GLsync mSyncObject;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_FENCESYNCGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFramebufferGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,298 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// FramebufferGL.cpp: Implements the class methods for FramebufferGL.
+
+#include &quot;libANGLE/renderer/gl/FramebufferGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/State.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/RenderbufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+#include &quot;libANGLE/renderer/gl/TextureGL.h&quot;
+
+namespace rx
+{
+
+FramebufferGL::FramebufferGL(const gl::Framebuffer::Data &amp;data, const FunctionsGL *functions, StateManagerGL *stateManager, bool isDefault)
+    : FramebufferImpl(data),
+      mFunctions(functions),
+      mStateManager(stateManager),
+      mFramebufferID(0)
+{
+    if (!isDefault)
+    {
+        mFunctions-&gt;genFramebuffers(1, &amp;mFramebufferID);
+    }
+}
+
+FramebufferGL::~FramebufferGL()
+{
+    if (mFramebufferID != 0)
+    {
+        mFunctions-&gt;deleteFramebuffers(1, &amp;mFramebufferID);
+        mFramebufferID = 0;
+    }
+}
+
+static void BindFramebufferAttachment(const FunctionsGL *functions, GLenum attachmentPoint,
+                                      const gl::FramebufferAttachment *attachment)
+{
+    if (attachment)
+    {
+        if (attachment-&gt;type() == GL_TEXTURE)
+        {
+            const gl::Texture *texture = attachment-&gt;getTexture();
+            const TextureGL *textureGL = GetImplAs&lt;TextureGL&gt;(texture);
+
+            if (texture-&gt;getTarget() == GL_TEXTURE_2D)
+            {
+                functions-&gt;framebufferTexture2D(GL_FRAMEBUFFER, attachmentPoint, GL_TEXTURE_2D,
+                                                textureGL-&gt;getTextureID(), attachment-&gt;mipLevel());
+            }
+            else if (texture-&gt;getTarget() == GL_TEXTURE_CUBE_MAP)
+            {
+                functions-&gt;framebufferTexture2D(GL_FRAMEBUFFER, attachmentPoint, attachment-&gt;cubeMapFace(),
+                                                textureGL-&gt;getTextureID(), attachment-&gt;mipLevel());
+            }
+            else if (texture-&gt;getTarget() == GL_TEXTURE_2D_ARRAY || texture-&gt;getTarget() == GL_TEXTURE_3D)
+            {
+                functions-&gt;framebufferTextureLayer(GL_FRAMEBUFFER, attachmentPoint, textureGL-&gt;getTextureID(),
+                                                   attachment-&gt;mipLevel(), attachment-&gt;layer());
+            }
+            else
+            {
+                UNREACHABLE();
+            }
+        }
+        else if (attachment-&gt;type() == GL_RENDERBUFFER)
+        {
+            const gl::Renderbuffer *renderbuffer = attachment-&gt;getRenderbuffer();
+            const RenderbufferGL *renderbufferGL = GetImplAs&lt;RenderbufferGL&gt;(renderbuffer);
+
+            functions-&gt;framebufferRenderbuffer(GL_FRAMEBUFFER, attachmentPoint, GL_RENDERBUFFER,
+                                               renderbufferGL-&gt;getRenderbufferID());
+        }
+        else
+        {
+            UNREACHABLE();
+        }
+    }
+    else
+    {
+        // Unbind this attachment
+        functions-&gt;framebufferTexture2D(GL_FRAMEBUFFER, attachmentPoint, GL_TEXTURE_2D, 0, 0);
+    }
+}
+
+void FramebufferGL::onUpdateColorAttachment(size_t index)
+{
+    if (mFramebufferID != 0)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        BindFramebufferAttachment(mFunctions,
+                                  GL_COLOR_ATTACHMENT0 + index,
+                                  mData.getColorAttachment(static_cast&lt;unsigned int&gt;(index)));
+    }
+}
+
+void FramebufferGL::onUpdateDepthAttachment()
+{
+    if (mFramebufferID != 0)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        BindFramebufferAttachment(mFunctions,
+                                  GL_DEPTH_ATTACHMENT,
+                                  mData.getDepthAttachment());
+    }
+}
+
+void FramebufferGL::onUpdateStencilAttachment()
+{
+    if (mFramebufferID != 0)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        BindFramebufferAttachment(mFunctions,
+                                  GL_STENCIL_ATTACHMENT,
+                                  mData.getStencilAttachment());
+    }
+}
+
+void FramebufferGL::onUpdateDepthStencilAttachment()
+{
+    if (mFramebufferID != 0)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        BindFramebufferAttachment(mFunctions,
+                                  GL_DEPTH_STENCIL_ATTACHMENT,
+                                  mData.getDepthStencilAttachment());
+    }
+}
+
+void FramebufferGL::setDrawBuffers(size_t count, const GLenum *buffers)
+{
+    if (mFramebufferID != 0)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        mFunctions-&gt;drawBuffers(count, buffers);
+    }
+}
+
+void FramebufferGL::setReadBuffer(GLenum buffer)
+{
+    if (mFramebufferID != 0)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        mFunctions-&gt;readBuffer(buffer);
+    }
+}
+
+gl::Error FramebufferGL::invalidate(size_t count, const GLenum *attachments)
+{
+    // Since this function is just a hint and not available until OpenGL 4.3, only call it if it is available.
+    if (mFunctions-&gt;invalidateFramebuffer)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        mFunctions-&gt;invalidateFramebuffer(GL_FRAMEBUFFER, count, attachments);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferGL::invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &amp;area)
+{
+    // Since this function is just a hint and not available until OpenGL 4.3, only call it if it is available.
+    if (mFunctions-&gt;invalidateSubFramebuffer)
+    {
+        mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+        mFunctions-&gt;invalidateSubFramebuffer(GL_FRAMEBUFFER, count, attachments, area.x, area.y, area.width, area.height);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferGL::clear(const gl::Data &amp;data, GLbitfield mask)
+{
+    mStateManager-&gt;setClearState(*data.state, mask);
+    mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+    mFunctions-&gt;clear(mask);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+static GLbitfield GetClearBufferMask(GLenum buffer)
+{
+    switch (buffer)
+    {
+      case GL_COLOR:          return GL_COLOR_BUFFER_BIT;
+      case GL_DEPTH:          return GL_DEPTH_BUFFER_BIT;
+      case GL_STENCIL:        return GL_STENCIL_BUFFER_BIT;
+      case GL_DEPTH_STENCIL:  return GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
+      default: UNREACHABLE(); return 0;
+    }
+}
+
+gl::Error FramebufferGL::clearBufferfv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLfloat *values)
+{
+    mStateManager-&gt;setClearState(state, GetClearBufferMask(buffer));
+    mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+    mFunctions-&gt;clearBufferfv(buffer, drawbuffer, values);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferGL::clearBufferuiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLuint *values)
+{
+    mStateManager-&gt;setClearState(state, GetClearBufferMask(buffer));
+    mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+    mFunctions-&gt;clearBufferuiv(buffer, drawbuffer, values);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferGL::clearBufferiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLint *values)
+{
+    mStateManager-&gt;setClearState(state, GetClearBufferMask(buffer));
+    mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+    mFunctions-&gt;clearBufferiv(buffer, drawbuffer, values);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferGL::clearBufferfi(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+    mStateManager-&gt;setClearState(state, GetClearBufferMask(buffer));
+    mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+    mFunctions-&gt;clearBufferfi(buffer, drawbuffer, depth, stencil);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLenum FramebufferGL::getImplementationColorReadFormat() const
+{
+    const gl::FramebufferAttachment *readAttachment = getData().getReadAttachment();
+    GLenum internalFormat = readAttachment-&gt;getInternalFormat();
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+    return internalFormatInfo.format;
+}
+
+GLenum FramebufferGL::getImplementationColorReadType() const
+{
+    const gl::FramebufferAttachment *readAttachment = getData().getReadAttachment();
+    GLenum internalFormat = readAttachment-&gt;getInternalFormat();
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+    return internalFormatInfo.type;
+}
+
+gl::Error FramebufferGL::readPixels(const gl::State &amp;state, const gl::Rectangle &amp;area, GLenum format, GLenum type, GLvoid *pixels) const
+{
+    const gl::PixelPackState &amp;packState = state.getPackState();
+
+    // TODO: set pack state
+    if (packState.rowLength != 0 || packState.skipRows != 0 || packState.skipPixels != 0)
+    {
+        UNIMPLEMENTED();
+        return gl::Error(GL_INVALID_OPERATION, &quot;invalid pixel store parameters in readPixels&quot;);
+    }
+
+    mStateManager-&gt;bindFramebuffer(GL_READ_FRAMEBUFFER, mFramebufferID);
+    mFunctions-&gt;readPixels(area.x, area.y, area.width, area.height, format, type, pixels);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error FramebufferGL::blit(const gl::State &amp;state, const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea,
+                              GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer)
+{
+    const FramebufferGL *sourceFramebufferGL = GetImplAs&lt;FramebufferGL&gt;(sourceFramebuffer);
+
+    mStateManager-&gt;bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL-&gt;getFramebufferID());
+    mStateManager-&gt;bindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebufferID);
+
+    mFunctions-&gt;blitFramebuffer(sourceArea.x, sourceArea.y, sourceArea.x + sourceArea.width, sourceArea.y + sourceArea.height,
+                                destArea.x, destArea.y, destArea.x + destArea.width, destArea.y + destArea.height,
+                                mask, filter);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLenum FramebufferGL::checkStatus() const
+{
+    mStateManager-&gt;bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID);
+    return mFunctions-&gt;checkFramebufferStatus(GL_FRAMEBUFFER);
+}
+
+GLuint FramebufferGL::getFramebufferID() const
+{
+    return mFramebufferID;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFramebufferGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FramebufferGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// FramebufferGL.h: Defines the class interface for FramebufferGL.
+
+#ifndef LIBANGLE_RENDERER_GL_FRAMEBUFFERGL_H_
+#define LIBANGLE_RENDERER_GL_FRAMEBUFFERGL_H_
+
+#include &quot;libANGLE/renderer/FramebufferImpl.h&quot;
+
+namespace rx
+{
+
+class FunctionsGL;
+class StateManagerGL;
+
+class FramebufferGL : public FramebufferImpl
+{
+  public:
+    FramebufferGL(const gl::Framebuffer::Data &amp;data, const FunctionsGL *functions, StateManagerGL *stateManager, bool isDefault);
+    ~FramebufferGL() override;
+
+    void onUpdateColorAttachment(size_t index) override;
+    void onUpdateDepthAttachment() override;
+    void onUpdateStencilAttachment() override;
+    void onUpdateDepthStencilAttachment() override;
+
+    void setDrawBuffers(size_t count, const GLenum *buffers) override;
+    void setReadBuffer(GLenum buffer) override;
+
+    gl::Error invalidate(size_t count, const GLenum *attachments) override;
+    gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &amp;area) override;
+
+    gl::Error clear(const gl::Data &amp;data, GLbitfield mask) override;
+    gl::Error clearBufferfv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLfloat *values) override;
+    gl::Error clearBufferuiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLuint *values) override;
+    gl::Error clearBufferiv(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, const GLint *values) override;
+    gl::Error clearBufferfi(const gl::State &amp;state, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) override;
+
+    GLenum getImplementationColorReadFormat() const override;
+    GLenum getImplementationColorReadType() const override;
+    gl::Error readPixels(const gl::State &amp;state, const gl::Rectangle &amp;area, GLenum format, GLenum type, GLvoid *pixels) const override;
+
+    gl::Error blit(const gl::State &amp;state, const gl::Rectangle &amp;sourceArea, const gl::Rectangle &amp;destArea,
+                   GLbitfield mask, GLenum filter, const gl::Framebuffer *sourceFramebuffer) override;
+
+    GLenum checkStatus() const override;
+
+    GLuint getFramebufferID() const;
+
+  private:
+    const FunctionsGL *mFunctions;
+    StateManagerGL *mStateManager;
+
+    GLuint mFramebufferID;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_FRAMEBUFFERGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFunctionsGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1562 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// FunctionsGL.cpp: Implements the FuntionsGL class to contain loaded GL functions
+
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+
+#include &lt;algorithm&gt;
+
+#include &quot;libANGLE/renderer/gl/renderergl_utils.h&quot;
+
+namespace rx
+{
+
+static void GetGLVersion(PFNGLGETSTRINGPROC getStringFunction, GLuint *outMajorVersion, GLuint *outMinorVersion,
+                         bool *outIsES)
+{
+    const std::string version = reinterpret_cast&lt;const char*&gt;(getStringFunction(GL_VERSION));
+    if (version.find(&quot;OpenGL ES&quot;) == std::string::npos)
+    {
+        // ES spec states that the GL_VERSION string will be in the following format:
+        // &quot;OpenGL ES N.M vendor-specific information&quot;
+        *outIsES = false;
+        *outMajorVersion = version[0] - '0';
+        *outMinorVersion = version[2] - '0';
+    }
+    else
+    {
+        // OpenGL spec states the GL_VERSION string will be in the following format:
+        // &lt;version number&gt;&lt;space&gt;&lt;vendor-specific information&gt;
+        // The version number is either of the form major number.minor number or major
+        // number.minor number.release number, where the numbers all have one or more
+        // digits
+        *outIsES = true;
+        *outMajorVersion = version[10] - '0';
+        *outMinorVersion = version[12] - '0';
+    }
+}
+
+static std::vector&lt;std::string&gt; GetNonIndexedExtensions(PFNGLGETSTRINGPROC getStringFunction)
+{
+    std::vector&lt;std::string&gt; result;
+
+    std::istringstream stream(reinterpret_cast&lt;const char*&gt;(getStringFunction(GL_EXTENSIONS)));
+    std::string extension;
+    while (std::getline(stream, extension, ' '))
+    {
+        result.push_back(extension);
+    }
+
+    return result;
+}
+
+static std::vector&lt;std::string&gt; GetIndexedExtensions(PFNGLGETINTEGERVPROC getIntegerFunction, PFNGLGETSTRINGIPROC getStringIFunction)
+{
+    std::vector&lt;std::string&gt; result;
+
+    GLint numExtensions;
+    getIntegerFunction(GL_NUM_EXTENSIONS, &amp;numExtensions);
+
+    result.reserve(numExtensions);
+
+    for (GLint i = 0; i &lt; numExtensions; i++)
+    {
+        result.push_back(reinterpret_cast&lt;const char*&gt;(getStringIFunction(GL_EXTENSIONS, i)));
+    }
+
+    return result;
+}
+
+template &lt;typename T&gt;
+static void AssignGLEntryPoint(void *function, T *outFunction)
+{
+    *outFunction = reinterpret_cast&lt;T&gt;(function);
+}
+
+template &lt;typename T&gt;
+static void AssignGLExtensionEntryPoint(const std::vector&lt;std::string&gt; &amp;extensions, const std::string &amp;extension, void *function, T *outFunction)
+{
+    if (std::find(extensions.begin(), extensions.end(), extension) != extensions.end())
+    {
+        *outFunction = reinterpret_cast&lt;T&gt;(function);
+    }
+}
+
+FunctionsGL::FunctionsGL()
+    : majorVersion(0),
+      minorVersion(0),
+      openGLES(false),
+      extensions(),
+
+      blendFunc(nullptr),
+      clear(nullptr),
+      clearColor(nullptr),
+      clearDepth(nullptr),
+      clearStencil(nullptr),
+      colorMask(nullptr),
+      cullFace(nullptr),
+      depthFunc(nullptr),
+      depthMask(nullptr),
+      depthRange(nullptr),
+      disable(nullptr),
+      drawBuffer(nullptr),
+      enable(nullptr),
+      finish(nullptr),
+      flush(nullptr),
+      frontFace(nullptr),
+      getBooleanv(nullptr),
+      getDoublev(nullptr),
+      getError(nullptr),
+      getFloatv(nullptr),
+      getIntegerv(nullptr),
+      getString(nullptr),
+      getTexImage(nullptr),
+      getTexLevelParameterfv(nullptr),
+      getTexLevelParameteriv(nullptr),
+      getTexParameterfv(nullptr),
+      getTexParameteriv(nullptr),
+      hint(nullptr),
+      isEnabled(nullptr),
+      lineWidth(nullptr),
+      logicOp(nullptr),
+      pixelStoref(nullptr),
+      pixelStorei(nullptr),
+      pointSize(nullptr),
+      polygonMode(nullptr),
+      readBuffer(nullptr),
+      readPixels(nullptr),
+      scissor(nullptr),
+      stencilFunc(nullptr),
+      stencilMask(nullptr),
+      stencilOp(nullptr),
+      texImage1D(nullptr),
+      texImage2D(nullptr),
+      texParameterf(nullptr),
+      texParameterfv(nullptr),
+      texParameteri(nullptr),
+      texParameteriv(nullptr),
+      viewport(nullptr),
+
+      bindTexture(nullptr),
+      copyTexImage1D(nullptr),
+      copyTexImage2D(nullptr),
+      copyTexSubImage1D(nullptr),
+      copyTexSubImage2D(nullptr),
+      deleteTextures(nullptr),
+      drawArrays(nullptr),
+      drawElements(nullptr),
+      genTextures(nullptr),
+      isTexture(nullptr),
+      polygonOffset(nullptr),
+      texSubImage1D(nullptr),
+      texSubImage2D(nullptr),
+
+      blendColor(nullptr),
+      blendEquation(nullptr),
+      copyTexSubImage3D(nullptr),
+      drawRangeElements(nullptr),
+      texImage3D(nullptr),
+      texSubImage3D(nullptr),
+
+      deleteFencesNV(nullptr),
+      genFencesNV(nullptr),
+      isFenceNV(nullptr),
+      testFenceNV(nullptr),
+      getFenceivNV(nullptr),
+      finishFenceNV(nullptr),
+      setFenceNV(nullptr),
+
+      activeTexture(nullptr),
+      compressedTexImage1D(nullptr),
+      compressedTexImage2D(nullptr),
+      compressedTexImage3D(nullptr),
+      compressedTexSubImage1D(nullptr),
+      compressedTexSubImage2D(nullptr),
+      compressedTexSubImage3D(nullptr),
+      getCompressedTexImage(nullptr),
+      sampleCoverage(nullptr),
+
+      blendFuncSeparate(nullptr),
+      multiDrawArrays(nullptr),
+      multiDrawElements(nullptr),
+      pointParameterf(nullptr),
+      pointParameterfv(nullptr),
+      pointParameteri(nullptr),
+      pointParameteriv(nullptr),
+
+      beginQuery(nullptr),
+      bindBuffer(nullptr),
+      bufferData(nullptr),
+      bufferSubData(nullptr),
+      deleteBuffers(nullptr),
+      deleteQueries(nullptr),
+      endQuery(nullptr),
+      genBuffers(nullptr),
+      genQueries(nullptr),
+      getBufferParameteriv(nullptr),
+      getBufferPointerv(nullptr),
+      getBufferSubData(nullptr),
+      getQueryObjectiv(nullptr),
+      getQueryObjectuiv(nullptr),
+      getQueryiv(nullptr),
+      isBuffer(nullptr),
+      isQuery(nullptr),
+      mapBuffer(nullptr),
+      unmapBuffer(nullptr),
+
+      attachShader(nullptr),
+      bindAttribLocation(nullptr),
+      blendEquationSeparate(nullptr),
+      compileShader(nullptr),
+      createProgram(nullptr),
+      createShader(nullptr),
+      deleteProgram(nullptr),
+      deleteShader(nullptr),
+      detachShader(nullptr),
+      disableVertexAttribArray(nullptr),
+      drawBuffers(nullptr),
+      enableVertexAttribArray(nullptr),
+      getActiveAttrib(nullptr),
+      getActiveUniform(nullptr),
+      getAttachedShaders(nullptr),
+      getAttribLocation(nullptr),
+      getProgramInfoLog(nullptr),
+      getProgramiv(nullptr),
+      getShaderInfoLog(nullptr),
+      getShaderSource(nullptr),
+      getShaderiv(nullptr),
+      getUniformLocation(nullptr),
+      getUniformfv(nullptr),
+      getUniformiv(nullptr),
+      getVertexAttribPointerv(nullptr),
+      getVertexAttribdv(nullptr),
+      getVertexAttribfv(nullptr),
+      getVertexAttribiv(nullptr),
+      isProgram(nullptr),
+      isShader(nullptr),
+      linkProgram(nullptr),
+      shaderSource(nullptr),
+      stencilFuncSeparate(nullptr),
+      stencilMaskSeparate(nullptr),
+      stencilOpSeparate(nullptr),
+      uniform1f(nullptr),
+      uniform1fv(nullptr),
+      uniform1i(nullptr),
+      uniform1iv(nullptr),
+      uniform2f(nullptr),
+      uniform2fv(nullptr),
+      uniform2i(nullptr),
+      uniform2iv(nullptr),
+      uniform3f(nullptr),
+      uniform3fv(nullptr),
+      uniform3i(nullptr),
+      uniform3iv(nullptr),
+      uniform4f(nullptr),
+      uniform4fv(nullptr),
+      uniform4i(nullptr),
+      uniform4iv(nullptr),
+      uniformMatrix2fv(nullptr),
+      uniformMatrix3fv(nullptr),
+      uniformMatrix4fv(nullptr),
+      useProgram(nullptr),
+      validateProgram(nullptr),
+      vertexAttrib1d(nullptr),
+      vertexAttrib1dv(nullptr),
+      vertexAttrib1f(nullptr),
+      vertexAttrib1fv(nullptr),
+      vertexAttrib1s(nullptr),
+      vertexAttrib1sv(nullptr),
+      vertexAttrib2d(nullptr),
+      vertexAttrib2dv(nullptr),
+      vertexAttrib2f(nullptr),
+      vertexAttrib2fv(nullptr),
+      vertexAttrib2s(nullptr),
+      vertexAttrib2sv(nullptr),
+      vertexAttrib3d(nullptr),
+      vertexAttrib3dv(nullptr),
+      vertexAttrib3f(nullptr),
+      vertexAttrib3fv(nullptr),
+      vertexAttrib3s(nullptr),
+      vertexAttrib3sv(nullptr),
+      vertexAttrib4Nbv(nullptr),
+      vertexAttrib4Niv(nullptr),
+      vertexAttrib4Nsv(nullptr),
+      vertexAttrib4Nub(nullptr),
+      vertexAttrib4Nubv(nullptr),
+      vertexAttrib4Nuiv(nullptr),
+      vertexAttrib4Nusv(nullptr),
+      vertexAttrib4bv(nullptr),
+      vertexAttrib4d(nullptr),
+      vertexAttrib4dv(nullptr),
+      vertexAttrib4f(nullptr),
+      vertexAttrib4fv(nullptr),
+      vertexAttrib4iv(nullptr),
+      vertexAttrib4s(nullptr),
+      vertexAttrib4sv(nullptr),
+      vertexAttrib4ubv(nullptr),
+      vertexAttrib4uiv(nullptr),
+      vertexAttrib4usv(nullptr),
+      vertexAttribPointer(nullptr),
+
+      uniformMatrix2x3fv(nullptr),
+      uniformMatrix2x4fv(nullptr),
+      uniformMatrix3x2fv(nullptr),
+      uniformMatrix3x4fv(nullptr),
+      uniformMatrix4x2fv(nullptr),
+      uniformMatrix4x3fv(nullptr),
+
+      beginConditionalRender(nullptr),
+      beginTransformFeedback(nullptr),
+      bindBufferBase(nullptr),
+      bindBufferRange(nullptr),
+      bindFragDataLocation(nullptr),
+      bindFramebuffer(nullptr),
+      bindRenderbuffer(nullptr),
+      bindVertexArray(nullptr),
+      blitFramebuffer(nullptr),
+      checkFramebufferStatus(nullptr),
+      clampColor(nullptr),
+      clearBufferfi(nullptr),
+      clearBufferfv(nullptr),
+      clearBufferiv(nullptr),
+      clearBufferuiv(nullptr),
+      colorMaski(nullptr),
+      deleteFramebuffers(nullptr),
+      deleteRenderbuffers(nullptr),
+      deleteVertexArrays(nullptr),
+      disablei(nullptr),
+      enablei(nullptr),
+      endConditionalRender(nullptr),
+      endTransformFeedback(nullptr),
+      flushMappedBufferRange(nullptr),
+      framebufferRenderbuffer(nullptr),
+      framebufferTexture1D(nullptr),
+      framebufferTexture2D(nullptr),
+      framebufferTexture3D(nullptr),
+      framebufferTextureLayer(nullptr),
+      genFramebuffers(nullptr),
+      genRenderbuffers(nullptr),
+      genVertexArrays(nullptr),
+      generateMipmap(nullptr),
+      getBooleani_v(nullptr),
+      getFragDataLocation(nullptr),
+      getFramebufferAttachmentParameteriv(nullptr),
+      getIntegeri_v(nullptr),
+      getRenderbufferParameteriv(nullptr),
+      getStringi(nullptr),
+      getTexParameterIiv(nullptr),
+      getTexParameterIuiv(nullptr),
+      getTransformFeedbackVarying(nullptr),
+      getUniformuiv(nullptr),
+      getVertexAttribIiv(nullptr),
+      getVertexAttribIuiv(nullptr),
+      isEnabledi(nullptr),
+      isFramebuffer(nullptr),
+      isRenderbuffer(nullptr),
+      isVertexArray(nullptr),
+      mapBufferRange(nullptr),
+      renderbufferStorage(nullptr),
+      renderbufferStorageMultisample(nullptr),
+      texParameterIiv(nullptr),
+      texParameterIuiv(nullptr),
+      transformFeedbackVaryings(nullptr),
+      uniform1ui(nullptr),
+      uniform1uiv(nullptr),
+      uniform2ui(nullptr),
+      uniform2uiv(nullptr),
+      uniform3ui(nullptr),
+      uniform3uiv(nullptr),
+      uniform4ui(nullptr),
+      uniform4uiv(nullptr),
+      vertexAttribI1i(nullptr),
+      vertexAttribI1iv(nullptr),
+      vertexAttribI1ui(nullptr),
+      vertexAttribI1uiv(nullptr),
+      vertexAttribI2i(nullptr),
+      vertexAttribI2iv(nullptr),
+      vertexAttribI2ui(nullptr),
+      vertexAttribI2uiv(nullptr),
+      vertexAttribI3i(nullptr),
+      vertexAttribI3iv(nullptr),
+      vertexAttribI3ui(nullptr),
+      vertexAttribI3uiv(nullptr),
+      vertexAttribI4bv(nullptr),
+      vertexAttribI4i(nullptr),
+      vertexAttribI4iv(nullptr),
+      vertexAttribI4sv(nullptr),
+      vertexAttribI4ubv(nullptr),
+      vertexAttribI4ui(nullptr),
+      vertexAttribI4uiv(nullptr),
+      vertexAttribI4usv(nullptr),
+      vertexAttribIPointer(nullptr),
+
+      copyBufferSubData(nullptr),
+      drawArraysInstanced(nullptr),
+      drawElementsInstanced(nullptr),
+      getActiveUniformBlockName(nullptr),
+      getActiveUniformBlockiv(nullptr),
+      getActiveUniformName(nullptr),
+      getActiveUniformsiv(nullptr),
+      getUniformBlockIndex(nullptr),
+      getUniformIndices(nullptr),
+      primitiveRestartIndex(nullptr),
+      texBuffer(nullptr),
+      uniformBlockBinding(nullptr),
+
+      clientWaitSync(nullptr),
+      deleteSync(nullptr),
+      drawElementsBaseVertex(nullptr),
+      drawElementsInstancedBaseVertex(nullptr),
+      drawRangeElementsBaseVertex(nullptr),
+      fenceSync(nullptr),
+      framebufferTexture(nullptr),
+      getBufferParameteri64v(nullptr),
+      getInteger64i_v(nullptr),
+      getInteger64v(nullptr),
+      getMultisamplefv(nullptr),
+      getSynciv(nullptr),
+      isSync(nullptr),
+      multiDrawElementsBaseVertex(nullptr),
+      provokingVertex(nullptr),
+      sampleMaski(nullptr),
+      texImage2DMultisample(nullptr),
+      texImage3DMultisample(nullptr),
+      waitSync(nullptr),
+
+      bindFragDataLocationIndexed(nullptr),
+      bindSampler(nullptr),
+      deleteSamplers(nullptr),
+      genSamplers(nullptr),
+      getFragDataIndex(nullptr),
+      getQueryObjecti64v(nullptr),
+      getQueryObjectui64v(nullptr),
+      getSamplerParameterIiv(nullptr),
+      getSamplerParameterIuiv(nullptr),
+      getSamplerParameterfv(nullptr),
+      getSamplerParameteriv(nullptr),
+      isSampler(nullptr),
+      queryCounter(nullptr),
+      samplerParameterIiv(nullptr),
+      samplerParameterIuiv(nullptr),
+      samplerParameterf(nullptr),
+      samplerParameterfv(nullptr),
+      samplerParameteri(nullptr),
+      samplerParameteriv(nullptr),
+      vertexAttribDivisor(nullptr),
+      vertexAttribP1ui(nullptr),
+      vertexAttribP1uiv(nullptr),
+      vertexAttribP2ui(nullptr),
+      vertexAttribP2uiv(nullptr),
+      vertexAttribP3ui(nullptr),
+      vertexAttribP3uiv(nullptr),
+      vertexAttribP4ui(nullptr),
+      vertexAttribP4uiv(nullptr),
+
+      beginQueryIndexed(nullptr),
+      bindTransformFeedback(nullptr),
+      blendEquationSeparatei(nullptr),
+      blendEquationi(nullptr),
+      blendFuncSeparatei(nullptr),
+      blendFunci(nullptr),
+      deleteTransformFeedbacks(nullptr),
+      drawArraysIndirect(nullptr),
+      drawElementsIndirect(nullptr),
+      drawTransformFeedback(nullptr),
+      drawTransformFeedbackStream(nullptr),
+      endQueryIndexed(nullptr),
+      genTransformFeedbacks(nullptr),
+      getActiveSubroutineName(nullptr),
+      getActiveSubroutineUniformName(nullptr),
+      getActiveSubroutineUniformiv(nullptr),
+      getProgramStageiv(nullptr),
+      getQueryIndexediv(nullptr),
+      getSubroutineIndex(nullptr),
+      getSubroutineUniformLocation(nullptr),
+      getUniformSubroutineuiv(nullptr),
+      getUniformdv(nullptr),
+      isTransformFeedback(nullptr),
+      minSampleShading(nullptr),
+      patchParameterfv(nullptr),
+      patchParameteri(nullptr),
+      pauseTransformFeedback(nullptr),
+      resumeTransformFeedback(nullptr),
+      uniform1d(nullptr),
+      uniform1dv(nullptr),
+      uniform2d(nullptr),
+      uniform2dv(nullptr),
+      uniform3d(nullptr),
+      uniform3dv(nullptr),
+      uniform4d(nullptr),
+      uniform4dv(nullptr),
+      uniformMatrix2dv(nullptr),
+      uniformMatrix2x3dv(nullptr),
+      uniformMatrix2x4dv(nullptr),
+      uniformMatrix3dv(nullptr),
+      uniformMatrix3x2dv(nullptr),
+      uniformMatrix3x4dv(nullptr),
+      uniformMatrix4dv(nullptr),
+      uniformMatrix4x2dv(nullptr),
+      uniformMatrix4x3dv(nullptr),
+      uniformSubroutinesuiv(nullptr),
+
+      activeShaderProgram(nullptr),
+      bindProgramPipeline(nullptr),
+      clearDepthf(nullptr),
+      createShaderProgramv(nullptr),
+      deleteProgramPipelines(nullptr),
+      depthRangeArrayv(nullptr),
+      depthRangeIndexed(nullptr),
+      depthRangef(nullptr),
+      genProgramPipelines(nullptr),
+      getDoublei_v(nullptr),
+      getFloati_v(nullptr),
+      getProgramBinary(nullptr),
+      getProgramPipelineInfoLog(nullptr),
+      getProgramPipelineiv(nullptr),
+      getShaderPrecisionFormat(nullptr),
+      getVertexAttribLdv(nullptr),
+      isProgramPipeline(nullptr),
+      programBinary(nullptr),
+      programParameteri(nullptr),
+      programUniform1d(nullptr),
+      programUniform1dv(nullptr),
+      programUniform1f(nullptr),
+      programUniform1fv(nullptr),
+      programUniform1i(nullptr),
+      programUniform1iv(nullptr),
+      programUniform1ui(nullptr),
+      programUniform1uiv(nullptr),
+      programUniform2d(nullptr),
+      programUniform2dv(nullptr),
+      programUniform2f(nullptr),
+      programUniform2fv(nullptr),
+      programUniform2i(nullptr),
+      programUniform2iv(nullptr),
+      programUniform2ui(nullptr),
+      programUniform2uiv(nullptr),
+      programUniform3d(nullptr),
+      programUniform3dv(nullptr),
+      programUniform3f(nullptr),
+      programUniform3fv(nullptr),
+      programUniform3i(nullptr),
+      programUniform3iv(nullptr),
+      programUniform3ui(nullptr),
+      programUniform3uiv(nullptr),
+      programUniform4d(nullptr),
+      programUniform4dv(nullptr),
+      programUniform4f(nullptr),
+      programUniform4fv(nullptr),
+      programUniform4i(nullptr),
+      programUniform4iv(nullptr),
+      programUniform4ui(nullptr),
+      programUniform4uiv(nullptr),
+      programUniformMatrix2dv(nullptr),
+      programUniformMatrix2fv(nullptr),
+      programUniformMatrix2x3dv(nullptr),
+      programUniformMatrix2x3fv(nullptr),
+      programUniformMatrix2x4dv(nullptr),
+      programUniformMatrix2x4fv(nullptr),
+      programUniformMatrix3dv(nullptr),
+      programUniformMatrix3fv(nullptr),
+      programUniformMatrix3x2dv(nullptr),
+      programUniformMatrix3x2fv(nullptr),
+      programUniformMatrix3x4dv(nullptr),
+      programUniformMatrix3x4fv(nullptr),
+      programUniformMatrix4dv(nullptr),
+      programUniformMatrix4fv(nullptr),
+      programUniformMatrix4x2dv(nullptr),
+      programUniformMatrix4x2fv(nullptr),
+      programUniformMatrix4x3dv(nullptr),
+      programUniformMatrix4x3fv(nullptr),
+      releaseShaderCompiler(nullptr),
+      scissorArrayv(nullptr),
+      scissorIndexed(nullptr),
+      scissorIndexedv(nullptr),
+      shaderBinary(nullptr),
+      useProgramStages(nullptr),
+      validateProgramPipeline(nullptr),
+      vertexAttribL1d(nullptr),
+      vertexAttribL1dv(nullptr),
+      vertexAttribL2d(nullptr),
+      vertexAttribL2dv(nullptr),
+      vertexAttribL3d(nullptr),
+      vertexAttribL3dv(nullptr),
+      vertexAttribL4d(nullptr),
+      vertexAttribL4dv(nullptr),
+      vertexAttribLPointer(nullptr),
+      viewportArrayv(nullptr),
+      viewportIndexedf(nullptr),
+      viewportIndexedfv(nullptr),
+
+      bindImageTexture(nullptr),
+      drawArraysInstancedBaseInstance(nullptr),
+      drawElementsInstancedBaseInstance(nullptr),
+      drawElementsInstancedBaseVertexBaseInstance(nullptr),
+      drawTransformFeedbackInstanced(nullptr),
+      drawTransformFeedbackStreamInstanced(nullptr),
+      getActiveAtomicCounterBufferiv(nullptr),
+      getInternalformativ(nullptr),
+      memoryBarrier(nullptr),
+      texStorage1D(nullptr),
+      texStorage2D(nullptr),
+      texStorage3D(nullptr),
+
+      bindVertexBuffer(nullptr),
+      clearBufferData(nullptr),
+      clearBufferSubData(nullptr),
+      copyImageSubData(nullptr),
+      debugMessageCallback(nullptr),
+      debugMessageControl(nullptr),
+      debugMessageInsert(nullptr),
+      dispatchCompute(nullptr),
+      dispatchComputeIndirect(nullptr),
+      framebufferParameteri(nullptr),
+      getDebugMessageLog(nullptr),
+      getFramebufferParameteriv(nullptr),
+      getInternalformati64v(nullptr),
+      getObjectLabel(nullptr),
+      getObjectPtrLabel(nullptr),
+      getProgramInterfaceiv(nullptr),
+      getProgramResourceIndex(nullptr),
+      getProgramResourceLocation(nullptr),
+      getProgramResourceLocationIndex(nullptr),
+      getProgramResourceName(nullptr),
+      getProgramResourceiv(nullptr),
+      invalidateBufferData(nullptr),
+      invalidateBufferSubData(nullptr),
+      invalidateFramebuffer(nullptr),
+      invalidateSubFramebuffer(nullptr),
+      invalidateTexImage(nullptr),
+      invalidateTexSubImage(nullptr),
+      multiDrawArraysIndirect(nullptr),
+      multiDrawElementsIndirect(nullptr),
+      objectLabel(nullptr),
+      objectPtrLabel(nullptr),
+      popDebugGroup(nullptr),
+      pushDebugGroup(nullptr),
+      shaderStorageBlockBinding(nullptr),
+      texBufferRange(nullptr),
+      texStorage2DMultisample(nullptr),
+      texStorage3DMultisample(nullptr),
+      textureView(nullptr),
+      vertexAttribBinding(nullptr),
+      vertexAttribFormat(nullptr),
+      vertexAttribIFormat(nullptr),
+      vertexAttribLFormat(nullptr),
+      vertexBindingDivisor(nullptr),
+
+      bindBuffersBase(nullptr),
+      bindBuffersRange(nullptr),
+      bindImageTextures(nullptr),
+      bindSamplers(nullptr),
+      bindTextures(nullptr),
+      bindVertexBuffers(nullptr),
+      bufferStorage(nullptr),
+      clearTexImage(nullptr),
+      clearTexSubImage(nullptr),
+
+      bindTextureUnit(nullptr),
+      blitNamedFramebuffer(nullptr),
+      checkNamedFramebufferStatus(nullptr),
+      clearNamedBufferData(nullptr),
+      clearNamedBufferSubData(nullptr),
+      clearNamedFramebufferfi(nullptr),
+      clearNamedFramebufferfv(nullptr),
+      clearNamedFramebufferiv(nullptr),
+      clearNamedFramebufferuiv(nullptr),
+      clipControl(nullptr),
+      compressedTextureSubImage1D(nullptr),
+      compressedTextureSubImage2D(nullptr),
+      compressedTextureSubImage3D(nullptr),
+      copyNamedBufferSubData(nullptr),
+      copyTextureSubImage1D(nullptr),
+      copyTextureSubImage2D(nullptr),
+      copyTextureSubImage3D(nullptr),
+      createBuffers(nullptr),
+      createFramebuffers(nullptr),
+      createProgramPipelines(nullptr),
+      createQueries(nullptr),
+      createRenderbuffers(nullptr),
+      createSamplers(nullptr),
+      createTextures(nullptr),
+      createTransformFeedbacks(nullptr),
+      createVertexArrays(nullptr),
+      disableVertexArrayAttrib(nullptr),
+      enableVertexArrayAttrib(nullptr),
+      flushMappedNamedBufferRange(nullptr),
+      generateTextureMipmap(nullptr),
+      getCompressedTextureImage(nullptr),
+      getCompressedTextureSubImage(nullptr),
+      getGraphicsResetStatus(nullptr),
+      getNamedBufferParameteri64v(nullptr),
+      getNamedBufferParameteriv(nullptr),
+      getNamedBufferPointerv(nullptr),
+      getNamedBufferSubData(nullptr),
+      getNamedFramebufferAttachmentParameteriv(nullptr),
+      getNamedFramebufferParameteriv(nullptr),
+      getNamedRenderbufferParameteriv(nullptr),
+      getQueryBufferObjecti64v(nullptr),
+      getQueryBufferObjectiv(nullptr),
+      getQueryBufferObjectui64v(nullptr),
+      getQueryBufferObjectuiv(nullptr),
+      getTextureImage(nullptr),
+      getTextureLevelParameterfv(nullptr),
+      getTextureLevelParameteriv(nullptr),
+      getTextureParameterIiv(nullptr),
+      getTextureParameterIuiv(nullptr),
+      getTextureParameterfv(nullptr),
+      getTextureParameteriv(nullptr),
+      getTextureSubImage(nullptr),
+      getTransformFeedbacki64_v(nullptr),
+      getTransformFeedbacki_v(nullptr),
+      getTransformFeedbackiv(nullptr),
+      getVertexArrayIndexed64iv(nullptr),
+      getVertexArrayIndexediv(nullptr),
+      getVertexArrayiv(nullptr),
+      getnCompressedTexImage(nullptr),
+      getnTexImage(nullptr),
+      getnUniformdv(nullptr),
+      getnUniformfv(nullptr),
+      getnUniformiv(nullptr),
+      getnUniformuiv(nullptr),
+      invalidateNamedFramebufferData(nullptr),
+      invalidateNamedFramebufferSubData(nullptr),
+      mapNamedBuffer(nullptr),
+      mapNamedBufferRange(nullptr),
+      memoryBarrierByRegion(nullptr),
+      namedBufferData(nullptr),
+      namedBufferStorage(nullptr),
+      namedBufferSubData(nullptr),
+      namedFramebufferDrawBuffer(nullptr),
+      namedFramebufferDrawBuffers(nullptr),
+      namedFramebufferParameteri(nullptr),
+      namedFramebufferReadBuffer(nullptr),
+      namedFramebufferRenderbuffer(nullptr),
+      namedFramebufferTexture(nullptr),
+      namedFramebufferTextureLayer(nullptr),
+      namedRenderbufferStorage(nullptr),
+      namedRenderbufferStorageMultisample(nullptr),
+      readnPixels(nullptr),
+      textureBarrier(nullptr),
+      textureBuffer(nullptr),
+      textureBufferRange(nullptr),
+      textureParameterIiv(nullptr),
+      textureParameterIuiv(nullptr),
+      textureParameterf(nullptr),
+      textureParameterfv(nullptr),
+      textureParameteri(nullptr),
+      textureParameteriv(nullptr),
+      textureStorage1D(nullptr),
+      textureStorage2D(nullptr),
+      textureStorage2DMultisample(nullptr),
+      textureStorage3D(nullptr),
+      textureStorage3DMultisample(nullptr),
+      textureSubImage1D(nullptr),
+      textureSubImage2D(nullptr),
+      textureSubImage3D(nullptr),
+      transformFeedbackBufferBase(nullptr),
+      transformFeedbackBufferRange(nullptr),
+      unmapNamedBuffer(nullptr),
+      vertexArrayAttribBinding(nullptr),
+      vertexArrayAttribFormat(nullptr),
+      vertexArrayAttribIFormat(nullptr),
+      vertexArrayAttribLFormat(nullptr),
+      vertexArrayBindingDivisor(nullptr),
+      vertexArrayElementBuffer(nullptr),
+      vertexArrayVertexBuffer(nullptr),
+      vertexArrayVertexBuffers(nullptr)
+{
+}
+
+FunctionsGL::~FunctionsGL()
+{
+}
+
+void FunctionsGL::initialize()
+{
+    // Grab the version number
+    AssignGLEntryPoint(loadProcAddress(&quot;glGetString&quot;), &amp;getString);
+    GetGLVersion(getString, &amp;majorVersion, &amp;minorVersion, &amp;openGLES);
+
+    // Grab the GL extensions
+    if (majorVersion &gt;= 3)
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetIntegerv&quot;), &amp;getIntegerv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetStringi&quot;), &amp;getStringi);
+        extensions = GetIndexedExtensions(getIntegerv, getStringi);
+    }
+    else
+    {
+        extensions = GetNonIndexedExtensions(getString);
+    }
+
+    // 1.0
+    if (majorVersion &gt;= 1)
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendFunc&quot;), &amp;blendFunc);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClear&quot;), &amp;clear);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearColor&quot;), &amp;clearColor);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearDepth&quot;), &amp;clearDepth);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearStencil&quot;), &amp;clearStencil);
+        AssignGLEntryPoint(loadProcAddress(&quot;glColorMask&quot;), &amp;colorMask);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCullFace&quot;), &amp;cullFace);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDepthFunc&quot;), &amp;depthFunc);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDepthMask&quot;), &amp;depthMask);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDepthRange&quot;), &amp;depthRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDisable&quot;), &amp;disable);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawBuffer&quot;), &amp;drawBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEnable&quot;), &amp;enable);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFinish&quot;), &amp;finish);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFlush&quot;), &amp;flush);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFrontFace&quot;), &amp;frontFace);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetBooleanv&quot;), &amp;getBooleanv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetDoublev&quot;), &amp;getDoublev);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetError&quot;), &amp;getError);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetFloatv&quot;), &amp;getFloatv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetIntegerv&quot;), &amp;getIntegerv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetString&quot;), &amp;getString);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTexImage&quot;), &amp;getTexImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTexLevelParameterfv&quot;), &amp;getTexLevelParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTexLevelParameteriv&quot;), &amp;getTexLevelParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTexParameterfv&quot;), &amp;getTexParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTexParameteriv&quot;), &amp;getTexParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glHint&quot;), &amp;hint);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsEnabled&quot;), &amp;isEnabled);
+        AssignGLEntryPoint(loadProcAddress(&quot;glLineWidth&quot;), &amp;lineWidth);
+        AssignGLEntryPoint(loadProcAddress(&quot;glLogicOp&quot;), &amp;logicOp);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPixelStoref&quot;), &amp;pixelStoref);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPixelStorei&quot;), &amp;pixelStorei);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPointSize&quot;), &amp;pointSize);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPolygonMode&quot;), &amp;polygonMode);
+        AssignGLEntryPoint(loadProcAddress(&quot;glReadBuffer&quot;), &amp;readBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glReadPixels&quot;), &amp;readPixels);
+        AssignGLEntryPoint(loadProcAddress(&quot;glScissor&quot;), &amp;scissor);
+        AssignGLEntryPoint(loadProcAddress(&quot;glStencilFunc&quot;), &amp;stencilFunc);
+        AssignGLEntryPoint(loadProcAddress(&quot;glStencilMask&quot;), &amp;stencilMask);
+        AssignGLEntryPoint(loadProcAddress(&quot;glStencilOp&quot;), &amp;stencilOp);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexImage1D&quot;), &amp;texImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexImage2D&quot;), &amp;texImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexParameterf&quot;), &amp;texParameterf);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexParameterfv&quot;), &amp;texParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexParameteri&quot;), &amp;texParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexParameteriv&quot;), &amp;texParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glViewport&quot;), &amp;viewport);
+    }
+
+    // 1.1
+    if (majorVersion &gt; 1 || (majorVersion == 1 &amp;&amp; minorVersion &gt;= 1))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindTexture&quot;), &amp;bindTexture);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTexImage1D&quot;), &amp;copyTexImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTexImage2D&quot;), &amp;copyTexImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTexSubImage1D&quot;), &amp;copyTexSubImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTexSubImage2D&quot;), &amp;copyTexSubImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteTextures&quot;), &amp;deleteTextures);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawArrays&quot;), &amp;drawArrays);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawElements&quot;), &amp;drawElements);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenTextures&quot;), &amp;genTextures);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsTexture&quot;), &amp;isTexture);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPolygonOffset&quot;), &amp;polygonOffset);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexSubImage1D&quot;), &amp;texSubImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexSubImage2D&quot;), &amp;texSubImage2D);
+    }
+
+    // 1.2
+    if (majorVersion &gt; 1 || (majorVersion == 1 &amp;&amp; minorVersion &gt;= 2))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendColor&quot;), &amp;blendColor);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendEquation&quot;), &amp;blendEquation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTexSubImage3D&quot;), &amp;copyTexSubImage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawRangeElements&quot;), &amp;drawRangeElements);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexImage3D&quot;), &amp;texImage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexSubImage3D&quot;), &amp;texSubImage3D);
+
+        // Extensions
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_NV_fence&quot;, loadProcAddress(&quot;glDeleteFencesNV&quot;), &amp;deleteFencesNV);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_NV_fence&quot;, loadProcAddress(&quot;glGenFencesNV&quot;), &amp;genFencesNV);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_NV_fence&quot;, loadProcAddress(&quot;glIsFenceNV&quot;), &amp;isFenceNV);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_NV_fence&quot;, loadProcAddress(&quot;glTestFenceNV&quot;), &amp;testFenceNV);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_NV_fence&quot;, loadProcAddress(&quot;glGetFenceivNV&quot;), &amp;getFenceivNV);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_NV_fence&quot;, loadProcAddress(&quot;glFinishFenceNV&quot;), &amp;finishFenceNV);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_NV_fence&quot;, loadProcAddress(&quot;glSetFenceNV&quot;), &amp;setFenceNV);
+    }
+
+    // 1.3
+    if (majorVersion &gt; 1 || (majorVersion == 1 &amp;&amp; minorVersion &gt;= 3))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glActiveTexture&quot;), &amp;activeTexture);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTexImage1D&quot;), &amp;compressedTexImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTexImage2D&quot;), &amp;compressedTexImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTexImage3D&quot;), &amp;compressedTexImage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTexSubImage1D&quot;), &amp;compressedTexSubImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTexSubImage2D&quot;), &amp;compressedTexSubImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTexSubImage3D&quot;), &amp;compressedTexSubImage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetCompressedTexImage&quot;), &amp;getCompressedTexImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSampleCoverage&quot;), &amp;sampleCoverage);
+    }
+
+    // 1.4
+    if (majorVersion &gt; 1 || (majorVersion == 1 &amp;&amp; minorVersion &gt;= 4))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendFuncSeparate&quot;), &amp;blendFuncSeparate);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMultiDrawArrays&quot;), &amp;multiDrawArrays);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMultiDrawElements&quot;), &amp;multiDrawElements);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPointParameterf&quot;), &amp;pointParameterf);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPointParameterfv&quot;), &amp;pointParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPointParameteri&quot;), &amp;pointParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPointParameteriv&quot;), &amp;pointParameteriv);
+    }
+
+    // 1.5
+    if (majorVersion &gt; 1 || (majorVersion == 1 &amp;&amp; minorVersion &gt;= 5))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBeginQuery&quot;), &amp;beginQuery);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindBuffer&quot;), &amp;bindBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBufferData&quot;), &amp;bufferData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBufferSubData&quot;), &amp;bufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteBuffers&quot;), &amp;deleteBuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteQueries&quot;), &amp;deleteQueries);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEndQuery&quot;), &amp;endQuery);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenBuffers&quot;), &amp;genBuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenQueries&quot;), &amp;genQueries);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetBufferParameteriv&quot;), &amp;getBufferParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetBufferPointerv&quot;), &amp;getBufferPointerv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetBufferSubData&quot;), &amp;getBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryObjectiv&quot;), &amp;getQueryObjectiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryObjectuiv&quot;), &amp;getQueryObjectuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryiv&quot;), &amp;getQueryiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsBuffer&quot;), &amp;isBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsQuery&quot;), &amp;isQuery);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMapBuffer&quot;), &amp;mapBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUnmapBuffer&quot;), &amp;unmapBuffer);
+    }
+
+    // 2.0
+    if (majorVersion &gt;= 2)
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glAttachShader&quot;), &amp;attachShader);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindAttribLocation&quot;), &amp;bindAttribLocation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendEquationSeparate&quot;), &amp;blendEquationSeparate);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompileShader&quot;), &amp;compileShader);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateProgram&quot;), &amp;createProgram);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateShader&quot;), &amp;createShader);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteProgram&quot;), &amp;deleteProgram);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteShader&quot;), &amp;deleteShader);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDetachShader&quot;), &amp;detachShader);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDisableVertexAttribArray&quot;), &amp;disableVertexAttribArray);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawBuffers&quot;), &amp;drawBuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEnableVertexAttribArray&quot;), &amp;enableVertexAttribArray);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveAttrib&quot;), &amp;getActiveAttrib);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveUniform&quot;), &amp;getActiveUniform);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetAttachedShaders&quot;), &amp;getAttachedShaders);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetAttribLocation&quot;), &amp;getAttribLocation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramInfoLog&quot;), &amp;getProgramInfoLog);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramiv&quot;), &amp;getProgramiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetShaderInfoLog&quot;), &amp;getShaderInfoLog);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetShaderSource&quot;), &amp;getShaderSource);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetShaderiv&quot;), &amp;getShaderiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformLocation&quot;), &amp;getUniformLocation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformfv&quot;), &amp;getUniformfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformiv&quot;), &amp;getUniformiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexAttribPointerv&quot;), &amp;getVertexAttribPointerv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexAttribdv&quot;), &amp;getVertexAttribdv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexAttribfv&quot;), &amp;getVertexAttribfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexAttribiv&quot;), &amp;getVertexAttribiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsProgram&quot;), &amp;isProgram);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsShader&quot;), &amp;isShader);
+        AssignGLEntryPoint(loadProcAddress(&quot;glLinkProgram&quot;), &amp;linkProgram);
+        AssignGLEntryPoint(loadProcAddress(&quot;glShaderSource&quot;), &amp;shaderSource);
+        AssignGLEntryPoint(loadProcAddress(&quot;glStencilFuncSeparate&quot;), &amp;stencilFuncSeparate);
+        AssignGLEntryPoint(loadProcAddress(&quot;glStencilMaskSeparate&quot;), &amp;stencilMaskSeparate);
+        AssignGLEntryPoint(loadProcAddress(&quot;glStencilOpSeparate&quot;), &amp;stencilOpSeparate);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1f&quot;), &amp;uniform1f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1fv&quot;), &amp;uniform1fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1i&quot;), &amp;uniform1i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1iv&quot;), &amp;uniform1iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2f&quot;), &amp;uniform2f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2fv&quot;), &amp;uniform2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2i&quot;), &amp;uniform2i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2iv&quot;), &amp;uniform2iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3f&quot;), &amp;uniform3f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3fv&quot;), &amp;uniform3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3i&quot;), &amp;uniform3i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3iv&quot;), &amp;uniform3iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4f&quot;), &amp;uniform4f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4fv&quot;), &amp;uniform4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4i&quot;), &amp;uniform4i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4iv&quot;), &amp;uniform4iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix2fv&quot;), &amp;uniformMatrix2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix3fv&quot;), &amp;uniformMatrix3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix4fv&quot;), &amp;uniformMatrix4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUseProgram&quot;), &amp;useProgram);
+        AssignGLEntryPoint(loadProcAddress(&quot;glValidateProgram&quot;), &amp;validateProgram);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib1d&quot;), &amp;vertexAttrib1d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib1dv&quot;), &amp;vertexAttrib1dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib1f&quot;), &amp;vertexAttrib1f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib1fv&quot;), &amp;vertexAttrib1fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib1s&quot;), &amp;vertexAttrib1s);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib1sv&quot;), &amp;vertexAttrib1sv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib2d&quot;), &amp;vertexAttrib2d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib2dv&quot;), &amp;vertexAttrib2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib2f&quot;), &amp;vertexAttrib2f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib2fv&quot;), &amp;vertexAttrib2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib2s&quot;), &amp;vertexAttrib2s);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib2sv&quot;), &amp;vertexAttrib2sv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib3d&quot;), &amp;vertexAttrib3d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib3dv&quot;), &amp;vertexAttrib3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib3f&quot;), &amp;vertexAttrib3f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib3fv&quot;), &amp;vertexAttrib3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib3s&quot;), &amp;vertexAttrib3s);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib3sv&quot;), &amp;vertexAttrib3sv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4Nbv&quot;), &amp;vertexAttrib4Nbv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4Niv&quot;), &amp;vertexAttrib4Niv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4Nsv&quot;), &amp;vertexAttrib4Nsv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4Nub&quot;), &amp;vertexAttrib4Nub);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4Nubv&quot;), &amp;vertexAttrib4Nubv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4Nuiv&quot;), &amp;vertexAttrib4Nuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4Nusv&quot;), &amp;vertexAttrib4Nusv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4bv&quot;), &amp;vertexAttrib4bv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4d&quot;), &amp;vertexAttrib4d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4dv&quot;), &amp;vertexAttrib4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4f&quot;), &amp;vertexAttrib4f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4fv&quot;), &amp;vertexAttrib4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4iv&quot;), &amp;vertexAttrib4iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4s&quot;), &amp;vertexAttrib4s);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4sv&quot;), &amp;vertexAttrib4sv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4ubv&quot;), &amp;vertexAttrib4ubv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4uiv&quot;), &amp;vertexAttrib4uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttrib4usv&quot;), &amp;vertexAttrib4usv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribPointer&quot;), &amp;vertexAttribPointer);
+    }
+
+    // 2.1
+    if (majorVersion &gt; 2 || (majorVersion == 2 &amp;&amp; minorVersion &gt;= 1))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix2x3fv&quot;), &amp;uniformMatrix2x3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix2x4fv&quot;), &amp;uniformMatrix2x4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix3x2fv&quot;), &amp;uniformMatrix3x2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix3x4fv&quot;), &amp;uniformMatrix3x4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix4x2fv&quot;), &amp;uniformMatrix4x2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix4x3fv&quot;), &amp;uniformMatrix4x3fv);
+    }
+
+    // 3.0
+    if (majorVersion &gt;= 3)
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBeginConditionalRender&quot;), &amp;beginConditionalRender);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBeginTransformFeedback&quot;), &amp;beginTransformFeedback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindBufferBase&quot;), &amp;bindBufferBase);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindBufferRange&quot;), &amp;bindBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindFragDataLocation&quot;), &amp;bindFragDataLocation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindFramebuffer&quot;), &amp;bindFramebuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindRenderbuffer&quot;), &amp;bindRenderbuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindVertexArray&quot;), &amp;bindVertexArray);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlitFramebuffer&quot;), &amp;blitFramebuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCheckFramebufferStatus&quot;), &amp;checkFramebufferStatus);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClampColor&quot;), &amp;clampColor);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearBufferfi&quot;), &amp;clearBufferfi);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearBufferfv&quot;), &amp;clearBufferfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearBufferiv&quot;), &amp;clearBufferiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearBufferuiv&quot;), &amp;clearBufferuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glColorMaski&quot;), &amp;colorMaski);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteFramebuffers&quot;), &amp;deleteFramebuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteRenderbuffers&quot;), &amp;deleteRenderbuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteVertexArrays&quot;), &amp;deleteVertexArrays);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDisablei&quot;), &amp;disablei);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEnablei&quot;), &amp;enablei);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEndConditionalRender&quot;), &amp;endConditionalRender);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEndTransformFeedback&quot;), &amp;endTransformFeedback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFlushMappedBufferRange&quot;), &amp;flushMappedBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFramebufferRenderbuffer&quot;), &amp;framebufferRenderbuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFramebufferTexture1D&quot;), &amp;framebufferTexture1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFramebufferTexture2D&quot;), &amp;framebufferTexture2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFramebufferTexture3D&quot;), &amp;framebufferTexture3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFramebufferTextureLayer&quot;), &amp;framebufferTextureLayer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenFramebuffers&quot;), &amp;genFramebuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenRenderbuffers&quot;), &amp;genRenderbuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenVertexArrays&quot;), &amp;genVertexArrays);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenerateMipmap&quot;), &amp;generateMipmap);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetBooleani_v&quot;), &amp;getBooleani_v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetFragDataLocation&quot;), &amp;getFragDataLocation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetFramebufferAttachmentParameteriv&quot;), &amp;getFramebufferAttachmentParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetIntegeri_v&quot;), &amp;getIntegeri_v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetRenderbufferParameteriv&quot;), &amp;getRenderbufferParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetStringi&quot;), &amp;getStringi);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTexParameterIiv&quot;), &amp;getTexParameterIiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTexParameterIuiv&quot;), &amp;getTexParameterIuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTransformFeedbackVarying&quot;), &amp;getTransformFeedbackVarying);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformuiv&quot;), &amp;getUniformuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexAttribIiv&quot;), &amp;getVertexAttribIiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexAttribIuiv&quot;), &amp;getVertexAttribIuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsEnabledi&quot;), &amp;isEnabledi);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsFramebuffer&quot;), &amp;isFramebuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsRenderbuffer&quot;), &amp;isRenderbuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsVertexArray&quot;), &amp;isVertexArray);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMapBufferRange&quot;), &amp;mapBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glRenderbufferStorage&quot;), &amp;renderbufferStorage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glRenderbufferStorageMultisample&quot;), &amp;renderbufferStorageMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexParameterIiv&quot;), &amp;texParameterIiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexParameterIuiv&quot;), &amp;texParameterIuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTransformFeedbackVaryings&quot;), &amp;transformFeedbackVaryings);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1ui&quot;), &amp;uniform1ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1uiv&quot;), &amp;uniform1uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2ui&quot;), &amp;uniform2ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2uiv&quot;), &amp;uniform2uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3ui&quot;), &amp;uniform3ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3uiv&quot;), &amp;uniform3uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4ui&quot;), &amp;uniform4ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4uiv&quot;), &amp;uniform4uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI1i&quot;), &amp;vertexAttribI1i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI1iv&quot;), &amp;vertexAttribI1iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI1ui&quot;), &amp;vertexAttribI1ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI1uiv&quot;), &amp;vertexAttribI1uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI2i&quot;), &amp;vertexAttribI2i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI2iv&quot;), &amp;vertexAttribI2iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI2ui&quot;), &amp;vertexAttribI2ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI2uiv&quot;), &amp;vertexAttribI2uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI3i&quot;), &amp;vertexAttribI3i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI3iv&quot;), &amp;vertexAttribI3iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI3ui&quot;), &amp;vertexAttribI3ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI3uiv&quot;), &amp;vertexAttribI3uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4bv&quot;), &amp;vertexAttribI4bv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4i&quot;), &amp;vertexAttribI4i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4iv&quot;), &amp;vertexAttribI4iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4sv&quot;), &amp;vertexAttribI4sv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4ubv&quot;), &amp;vertexAttribI4ubv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4ui&quot;), &amp;vertexAttribI4ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4uiv&quot;), &amp;vertexAttribI4uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribI4usv&quot;), &amp;vertexAttribI4usv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribIPointer&quot;), &amp;vertexAttribIPointer);
+
+        // Extensions
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_internalformat_query&quot;, loadProcAddress(&quot;glGetInternalformativ&quot;), &amp;getInternalformativ);
+    }
+
+    // 3.1
+    if (majorVersion &gt; 3 || (majorVersion == 3 &amp;&amp; minorVersion &gt;= 1))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyBufferSubData&quot;), &amp;copyBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawArraysInstanced&quot;), &amp;drawArraysInstanced);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawElementsInstanced&quot;), &amp;drawElementsInstanced);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveUniformBlockName&quot;), &amp;getActiveUniformBlockName);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveUniformBlockiv&quot;), &amp;getActiveUniformBlockiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveUniformName&quot;), &amp;getActiveUniformName);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveUniformsiv&quot;), &amp;getActiveUniformsiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformBlockIndex&quot;), &amp;getUniformBlockIndex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformIndices&quot;), &amp;getUniformIndices);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPrimitiveRestartIndex&quot;), &amp;primitiveRestartIndex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexBuffer&quot;), &amp;texBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformBlockBinding&quot;), &amp;uniformBlockBinding);
+
+        // Extensions
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glClientWaitSync&quot;), &amp;clientWaitSync);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glDeleteSync&quot;), &amp;deleteSync);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glFenceSync&quot;), &amp;fenceSync);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glGetInteger64i_v&quot;), &amp;getInteger64i_v);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glGetInteger64v&quot;), &amp;getInteger64v);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glGetSynciv&quot;), &amp;getSynciv);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glIsSync&quot;), &amp;isSync);
+        AssignGLExtensionEntryPoint(extensions, &quot;GL_ARB_sync&quot;, loadProcAddress(&quot;glWaitSync&quot;), &amp;waitSync);
+    }
+
+    // 3.2
+    if (majorVersion &gt; 3 || (majorVersion == 3 &amp;&amp; minorVersion &gt;= 2))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glClientWaitSync&quot;), &amp;clientWaitSync);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteSync&quot;), &amp;deleteSync);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawElementsBaseVertex&quot;), &amp;drawElementsBaseVertex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawElementsInstancedBaseVertex&quot;), &amp;drawElementsInstancedBaseVertex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawRangeElementsBaseVertex&quot;), &amp;drawRangeElementsBaseVertex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFenceSync&quot;), &amp;fenceSync);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFramebufferTexture&quot;), &amp;framebufferTexture);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetBufferParameteri64v&quot;), &amp;getBufferParameteri64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetInteger64i_v&quot;), &amp;getInteger64i_v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetInteger64v&quot;), &amp;getInteger64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetMultisamplefv&quot;), &amp;getMultisamplefv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetSynciv&quot;), &amp;getSynciv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsSync&quot;), &amp;isSync);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMultiDrawElementsBaseVertex&quot;), &amp;multiDrawElementsBaseVertex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProvokingVertex&quot;), &amp;provokingVertex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSampleMaski&quot;), &amp;sampleMaski);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexImage2DMultisample&quot;), &amp;texImage2DMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexImage3DMultisample&quot;), &amp;texImage3DMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glWaitSync&quot;), &amp;waitSync);
+    }
+
+    // 3.3
+    if (majorVersion &gt; 3 || (majorVersion == 3 &amp;&amp; minorVersion &gt;= 3))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindFragDataLocationIndexed&quot;), &amp;bindFragDataLocationIndexed);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindSampler&quot;), &amp;bindSampler);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteSamplers&quot;), &amp;deleteSamplers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenSamplers&quot;), &amp;genSamplers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetFragDataIndex&quot;), &amp;getFragDataIndex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryObjecti64v&quot;), &amp;getQueryObjecti64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryObjectui64v&quot;), &amp;getQueryObjectui64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetSamplerParameterIiv&quot;), &amp;getSamplerParameterIiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetSamplerParameterIuiv&quot;), &amp;getSamplerParameterIuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetSamplerParameterfv&quot;), &amp;getSamplerParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetSamplerParameteriv&quot;), &amp;getSamplerParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsSampler&quot;), &amp;isSampler);
+        AssignGLEntryPoint(loadProcAddress(&quot;glQueryCounter&quot;), &amp;queryCounter);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSamplerParameterIiv&quot;), &amp;samplerParameterIiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSamplerParameterIuiv&quot;), &amp;samplerParameterIuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSamplerParameterf&quot;), &amp;samplerParameterf);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSamplerParameterfv&quot;), &amp;samplerParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSamplerParameteri&quot;), &amp;samplerParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glSamplerParameteriv&quot;), &amp;samplerParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribDivisor&quot;), &amp;vertexAttribDivisor);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP1ui&quot;), &amp;vertexAttribP1ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP1uiv&quot;), &amp;vertexAttribP1uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP2ui&quot;), &amp;vertexAttribP2ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP2uiv&quot;), &amp;vertexAttribP2uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP3ui&quot;), &amp;vertexAttribP3ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP3uiv&quot;), &amp;vertexAttribP3uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP4ui&quot;), &amp;vertexAttribP4ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribP4uiv&quot;), &amp;vertexAttribP4uiv);
+    }
+
+    // 4.0
+    if (majorVersion &gt;= 4)
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBeginQueryIndexed&quot;), &amp;beginQueryIndexed);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindTransformFeedback&quot;), &amp;bindTransformFeedback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendEquationSeparatei&quot;), &amp;blendEquationSeparatei);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendEquationi&quot;), &amp;blendEquationi);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendFuncSeparatei&quot;), &amp;blendFuncSeparatei);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlendFunci&quot;), &amp;blendFunci);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteTransformFeedbacks&quot;), &amp;deleteTransformFeedbacks);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawArraysIndirect&quot;), &amp;drawArraysIndirect);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawElementsIndirect&quot;), &amp;drawElementsIndirect);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawTransformFeedback&quot;), &amp;drawTransformFeedback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawTransformFeedbackStream&quot;), &amp;drawTransformFeedbackStream);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEndQueryIndexed&quot;), &amp;endQueryIndexed);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenTransformFeedbacks&quot;), &amp;genTransformFeedbacks);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveSubroutineName&quot;), &amp;getActiveSubroutineName);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveSubroutineUniformName&quot;), &amp;getActiveSubroutineUniformName);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveSubroutineUniformiv&quot;), &amp;getActiveSubroutineUniformiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramStageiv&quot;), &amp;getProgramStageiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryIndexediv&quot;), &amp;getQueryIndexediv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetSubroutineIndex&quot;), &amp;getSubroutineIndex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetSubroutineUniformLocation&quot;), &amp;getSubroutineUniformLocation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformSubroutineuiv&quot;), &amp;getUniformSubroutineuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetUniformdv&quot;), &amp;getUniformdv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsTransformFeedback&quot;), &amp;isTransformFeedback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMinSampleShading&quot;), &amp;minSampleShading);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPatchParameterfv&quot;), &amp;patchParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPatchParameteri&quot;), &amp;patchParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPauseTransformFeedback&quot;), &amp;pauseTransformFeedback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glResumeTransformFeedback&quot;), &amp;resumeTransformFeedback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1d&quot;), &amp;uniform1d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform1dv&quot;), &amp;uniform1dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2d&quot;), &amp;uniform2d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform2dv&quot;), &amp;uniform2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3d&quot;), &amp;uniform3d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform3dv&quot;), &amp;uniform3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4d&quot;), &amp;uniform4d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniform4dv&quot;), &amp;uniform4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix2dv&quot;), &amp;uniformMatrix2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix2x3dv&quot;), &amp;uniformMatrix2x3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix2x4dv&quot;), &amp;uniformMatrix2x4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix3dv&quot;), &amp;uniformMatrix3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix3x2dv&quot;), &amp;uniformMatrix3x2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix3x4dv&quot;), &amp;uniformMatrix3x4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix4dv&quot;), &amp;uniformMatrix4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix4x2dv&quot;), &amp;uniformMatrix4x2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformMatrix4x3dv&quot;), &amp;uniformMatrix4x3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUniformSubroutinesuiv&quot;), &amp;uniformSubroutinesuiv);
+    }
+
+    // 4.1
+    if (majorVersion &gt; 4 || (majorVersion == 4 &amp;&amp; minorVersion &gt;= 1))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glActiveShaderProgram&quot;), &amp;activeShaderProgram);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindProgramPipeline&quot;), &amp;bindProgramPipeline);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearDepthf&quot;), &amp;clearDepthf);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateShaderProgramv&quot;), &amp;createShaderProgramv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDeleteProgramPipelines&quot;), &amp;deleteProgramPipelines);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDepthRangeArrayv&quot;), &amp;depthRangeArrayv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDepthRangeIndexed&quot;), &amp;depthRangeIndexed);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDepthRangef&quot;), &amp;depthRangef);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenProgramPipelines&quot;), &amp;genProgramPipelines);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetDoublei_v&quot;), &amp;getDoublei_v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetFloati_v&quot;), &amp;getFloati_v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramBinary&quot;), &amp;getProgramBinary);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramPipelineInfoLog&quot;), &amp;getProgramPipelineInfoLog);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramPipelineiv&quot;), &amp;getProgramPipelineiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetShaderPrecisionFormat&quot;), &amp;getShaderPrecisionFormat);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexAttribLdv&quot;), &amp;getVertexAttribLdv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glIsProgramPipeline&quot;), &amp;isProgramPipeline);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramBinary&quot;), &amp;programBinary);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramParameteri&quot;), &amp;programParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1d&quot;), &amp;programUniform1d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1dv&quot;), &amp;programUniform1dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1f&quot;), &amp;programUniform1f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1fv&quot;), &amp;programUniform1fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1i&quot;), &amp;programUniform1i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1iv&quot;), &amp;programUniform1iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1ui&quot;), &amp;programUniform1ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform1uiv&quot;), &amp;programUniform1uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2d&quot;), &amp;programUniform2d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2dv&quot;), &amp;programUniform2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2f&quot;), &amp;programUniform2f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2fv&quot;), &amp;programUniform2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2i&quot;), &amp;programUniform2i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2iv&quot;), &amp;programUniform2iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2ui&quot;), &amp;programUniform2ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform2uiv&quot;), &amp;programUniform2uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3d&quot;), &amp;programUniform3d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3dv&quot;), &amp;programUniform3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3f&quot;), &amp;programUniform3f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3fv&quot;), &amp;programUniform3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3i&quot;), &amp;programUniform3i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3iv&quot;), &amp;programUniform3iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3ui&quot;), &amp;programUniform3ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform3uiv&quot;), &amp;programUniform3uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4d&quot;), &amp;programUniform4d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4dv&quot;), &amp;programUniform4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4f&quot;), &amp;programUniform4f);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4fv&quot;), &amp;programUniform4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4i&quot;), &amp;programUniform4i);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4iv&quot;), &amp;programUniform4iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4ui&quot;), &amp;programUniform4ui);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniform4uiv&quot;), &amp;programUniform4uiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix2dv&quot;), &amp;programUniformMatrix2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix2fv&quot;), &amp;programUniformMatrix2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix2x3dv&quot;), &amp;programUniformMatrix2x3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix2x3fv&quot;), &amp;programUniformMatrix2x3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix2x4dv&quot;), &amp;programUniformMatrix2x4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix2x4fv&quot;), &amp;programUniformMatrix2x4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix3dv&quot;), &amp;programUniformMatrix3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix3fv&quot;), &amp;programUniformMatrix3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix3x2dv&quot;), &amp;programUniformMatrix3x2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix3x2fv&quot;), &amp;programUniformMatrix3x2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix3x4dv&quot;), &amp;programUniformMatrix3x4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix3x4fv&quot;), &amp;programUniformMatrix3x4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix4dv&quot;), &amp;programUniformMatrix4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix4fv&quot;), &amp;programUniformMatrix4fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix4x2dv&quot;), &amp;programUniformMatrix4x2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix4x2fv&quot;), &amp;programUniformMatrix4x2fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix4x3dv&quot;), &amp;programUniformMatrix4x3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glProgramUniformMatrix4x3fv&quot;), &amp;programUniformMatrix4x3fv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glReleaseShaderCompiler&quot;), &amp;releaseShaderCompiler);
+        AssignGLEntryPoint(loadProcAddress(&quot;glScissorArrayv&quot;), &amp;scissorArrayv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glScissorIndexed&quot;), &amp;scissorIndexed);
+        AssignGLEntryPoint(loadProcAddress(&quot;glScissorIndexedv&quot;), &amp;scissorIndexedv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glShaderBinary&quot;), &amp;shaderBinary);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUseProgramStages&quot;), &amp;useProgramStages);
+        AssignGLEntryPoint(loadProcAddress(&quot;glValidateProgramPipeline&quot;), &amp;validateProgramPipeline);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL1d&quot;), &amp;vertexAttribL1d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL1dv&quot;), &amp;vertexAttribL1dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL2d&quot;), &amp;vertexAttribL2d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL2dv&quot;), &amp;vertexAttribL2dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL3d&quot;), &amp;vertexAttribL3d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL3dv&quot;), &amp;vertexAttribL3dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL4d&quot;), &amp;vertexAttribL4d);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribL4dv&quot;), &amp;vertexAttribL4dv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribLPointer&quot;), &amp;vertexAttribLPointer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glViewportArrayv&quot;), &amp;viewportArrayv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glViewportIndexedf&quot;), &amp;viewportIndexedf);
+        AssignGLEntryPoint(loadProcAddress(&quot;glViewportIndexedfv&quot;), &amp;viewportIndexedfv);
+    }
+
+    // 4.2
+    if (majorVersion &gt; 4 || (majorVersion == 4 &amp;&amp; minorVersion &gt;= 2))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindImageTexture&quot;), &amp;bindImageTexture);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawArraysInstancedBaseInstance&quot;), &amp;drawArraysInstancedBaseInstance);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawElementsInstancedBaseInstance&quot;), &amp;drawElementsInstancedBaseInstance);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawElementsInstancedBaseVertexBaseInstance&quot;), &amp;drawElementsInstancedBaseVertexBaseInstance);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawTransformFeedbackInstanced&quot;), &amp;drawTransformFeedbackInstanced);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDrawTransformFeedbackStreamInstanced&quot;), &amp;drawTransformFeedbackStreamInstanced);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetActiveAtomicCounterBufferiv&quot;), &amp;getActiveAtomicCounterBufferiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetInternalformativ&quot;), &amp;getInternalformativ);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMemoryBarrier&quot;), &amp;memoryBarrier);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexStorage1D&quot;), &amp;texStorage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexStorage2D&quot;), &amp;texStorage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexStorage3D&quot;), &amp;texStorage3D);
+    }
+
+    // 4.3
+    if (majorVersion &gt; 4 || (majorVersion == 4 &amp;&amp; minorVersion &gt;= 3))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindVertexBuffer&quot;), &amp;bindVertexBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearBufferData&quot;), &amp;clearBufferData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearBufferSubData&quot;), &amp;clearBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyImageSubData&quot;), &amp;copyImageSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDebugMessageCallback&quot;), &amp;debugMessageCallback);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDebugMessageControl&quot;), &amp;debugMessageControl);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDebugMessageInsert&quot;), &amp;debugMessageInsert);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDispatchCompute&quot;), &amp;dispatchCompute);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDispatchComputeIndirect&quot;), &amp;dispatchComputeIndirect);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFramebufferParameteri&quot;), &amp;framebufferParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetDebugMessageLog&quot;), &amp;getDebugMessageLog);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetFramebufferParameteriv&quot;), &amp;getFramebufferParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetInternalformati64v&quot;), &amp;getInternalformati64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetObjectLabel&quot;), &amp;getObjectLabel);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetObjectPtrLabel&quot;), &amp;getObjectPtrLabel);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramInterfaceiv&quot;), &amp;getProgramInterfaceiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramResourceIndex&quot;), &amp;getProgramResourceIndex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramResourceLocation&quot;), &amp;getProgramResourceLocation);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramResourceLocationIndex&quot;), &amp;getProgramResourceLocationIndex);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramResourceName&quot;), &amp;getProgramResourceName);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetProgramResourceiv&quot;), &amp;getProgramResourceiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateBufferData&quot;), &amp;invalidateBufferData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateBufferSubData&quot;), &amp;invalidateBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateFramebuffer&quot;), &amp;invalidateFramebuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateSubFramebuffer&quot;), &amp;invalidateSubFramebuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateTexImage&quot;), &amp;invalidateTexImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateTexSubImage&quot;), &amp;invalidateTexSubImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMultiDrawArraysIndirect&quot;), &amp;multiDrawArraysIndirect);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMultiDrawElementsIndirect&quot;), &amp;multiDrawElementsIndirect);
+        AssignGLEntryPoint(loadProcAddress(&quot;glObjectLabel&quot;), &amp;objectLabel);
+        AssignGLEntryPoint(loadProcAddress(&quot;glObjectPtrLabel&quot;), &amp;objectPtrLabel);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPopDebugGroup&quot;), &amp;popDebugGroup);
+        AssignGLEntryPoint(loadProcAddress(&quot;glPushDebugGroup&quot;), &amp;pushDebugGroup);
+        AssignGLEntryPoint(loadProcAddress(&quot;glShaderStorageBlockBinding&quot;), &amp;shaderStorageBlockBinding);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexBufferRange&quot;), &amp;texBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexStorage2DMultisample&quot;), &amp;texStorage2DMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTexStorage3DMultisample&quot;), &amp;texStorage3DMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureView&quot;), &amp;textureView);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribBinding&quot;), &amp;vertexAttribBinding);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribFormat&quot;), &amp;vertexAttribFormat);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribIFormat&quot;), &amp;vertexAttribIFormat);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexAttribLFormat&quot;), &amp;vertexAttribLFormat);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexBindingDivisor&quot;), &amp;vertexBindingDivisor);
+    }
+
+    // 4.4
+    if (majorVersion &gt; 4 || (majorVersion == 4 &amp;&amp; minorVersion &gt;= 4))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindBuffersBase&quot;), &amp;bindBuffersBase);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindBuffersRange&quot;), &amp;bindBuffersRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindImageTextures&quot;), &amp;bindImageTextures);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindSamplers&quot;), &amp;bindSamplers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindTextures&quot;), &amp;bindTextures);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindVertexBuffers&quot;), &amp;bindVertexBuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBufferStorage&quot;), &amp;bufferStorage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearTexImage&quot;), &amp;clearTexImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearTexSubImage&quot;), &amp;clearTexSubImage);
+    }
+
+    // 4.5
+    if (majorVersion &gt; 4 || (majorVersion == 4 &amp;&amp; minorVersion &gt;= 5))
+    {
+        AssignGLEntryPoint(loadProcAddress(&quot;glBindTextureUnit&quot;), &amp;bindTextureUnit);
+        AssignGLEntryPoint(loadProcAddress(&quot;glBlitNamedFramebuffer&quot;), &amp;blitNamedFramebuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCheckNamedFramebufferStatus&quot;), &amp;checkNamedFramebufferStatus);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearNamedBufferData&quot;), &amp;clearNamedBufferData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearNamedBufferSubData&quot;), &amp;clearNamedBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearNamedFramebufferfi&quot;), &amp;clearNamedFramebufferfi);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearNamedFramebufferfv&quot;), &amp;clearNamedFramebufferfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearNamedFramebufferiv&quot;), &amp;clearNamedFramebufferiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClearNamedFramebufferuiv&quot;), &amp;clearNamedFramebufferuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glClipControl&quot;), &amp;clipControl);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTextureSubImage1D&quot;), &amp;compressedTextureSubImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTextureSubImage2D&quot;), &amp;compressedTextureSubImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCompressedTextureSubImage3D&quot;), &amp;compressedTextureSubImage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyNamedBufferSubData&quot;), &amp;copyNamedBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTextureSubImage1D&quot;), &amp;copyTextureSubImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTextureSubImage2D&quot;), &amp;copyTextureSubImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCopyTextureSubImage3D&quot;), &amp;copyTextureSubImage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateBuffers&quot;), &amp;createBuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateFramebuffers&quot;), &amp;createFramebuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateProgramPipelines&quot;), &amp;createProgramPipelines);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateQueries&quot;), &amp;createQueries);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateRenderbuffers&quot;), &amp;createRenderbuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateSamplers&quot;), &amp;createSamplers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateTextures&quot;), &amp;createTextures);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateTransformFeedbacks&quot;), &amp;createTransformFeedbacks);
+        AssignGLEntryPoint(loadProcAddress(&quot;glCreateVertexArrays&quot;), &amp;createVertexArrays);
+        AssignGLEntryPoint(loadProcAddress(&quot;glDisableVertexArrayAttrib&quot;), &amp;disableVertexArrayAttrib);
+        AssignGLEntryPoint(loadProcAddress(&quot;glEnableVertexArrayAttrib&quot;), &amp;enableVertexArrayAttrib);
+        AssignGLEntryPoint(loadProcAddress(&quot;glFlushMappedNamedBufferRange&quot;), &amp;flushMappedNamedBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGenerateTextureMipmap&quot;), &amp;generateTextureMipmap);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetCompressedTextureImage&quot;), &amp;getCompressedTextureImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetCompressedTextureSubImage&quot;), &amp;getCompressedTextureSubImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetGraphicsResetStatus&quot;), &amp;getGraphicsResetStatus);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetNamedBufferParameteri64v&quot;), &amp;getNamedBufferParameteri64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetNamedBufferParameteriv&quot;), &amp;getNamedBufferParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetNamedBufferPointerv&quot;), &amp;getNamedBufferPointerv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetNamedBufferSubData&quot;), &amp;getNamedBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetNamedFramebufferAttachmentParameteriv&quot;), &amp;getNamedFramebufferAttachmentParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetNamedFramebufferParameteriv&quot;), &amp;getNamedFramebufferParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetNamedRenderbufferParameteriv&quot;), &amp;getNamedRenderbufferParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryBufferObjecti64v&quot;), &amp;getQueryBufferObjecti64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryBufferObjectiv&quot;), &amp;getQueryBufferObjectiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryBufferObjectui64v&quot;), &amp;getQueryBufferObjectui64v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetQueryBufferObjectuiv&quot;), &amp;getQueryBufferObjectuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureImage&quot;), &amp;getTextureImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureLevelParameterfv&quot;), &amp;getTextureLevelParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureLevelParameteriv&quot;), &amp;getTextureLevelParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureParameterIiv&quot;), &amp;getTextureParameterIiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureParameterIuiv&quot;), &amp;getTextureParameterIuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureParameterfv&quot;), &amp;getTextureParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureParameteriv&quot;), &amp;getTextureParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTextureSubImage&quot;), &amp;getTextureSubImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTransformFeedbacki64_v&quot;), &amp;getTransformFeedbacki64_v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTransformFeedbacki_v&quot;), &amp;getTransformFeedbacki_v);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetTransformFeedbackiv&quot;), &amp;getTransformFeedbackiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexArrayIndexed64iv&quot;), &amp;getVertexArrayIndexed64iv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexArrayIndexediv&quot;), &amp;getVertexArrayIndexediv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetVertexArrayiv&quot;), &amp;getVertexArrayiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetnCompressedTexImage&quot;), &amp;getnCompressedTexImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetnTexImage&quot;), &amp;getnTexImage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetnUniformdv&quot;), &amp;getnUniformdv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetnUniformfv&quot;), &amp;getnUniformfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetnUniformiv&quot;), &amp;getnUniformiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glGetnUniformuiv&quot;), &amp;getnUniformuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateNamedFramebufferData&quot;), &amp;invalidateNamedFramebufferData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glInvalidateNamedFramebufferSubData&quot;), &amp;invalidateNamedFramebufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMapNamedBuffer&quot;), &amp;mapNamedBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMapNamedBufferRange&quot;), &amp;mapNamedBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glMemoryBarrierByRegion&quot;), &amp;memoryBarrierByRegion);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedBufferData&quot;), &amp;namedBufferData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedBufferStorage&quot;), &amp;namedBufferStorage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedBufferSubData&quot;), &amp;namedBufferSubData);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedFramebufferDrawBuffer&quot;), &amp;namedFramebufferDrawBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedFramebufferDrawBuffers&quot;), &amp;namedFramebufferDrawBuffers);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedFramebufferParameteri&quot;), &amp;namedFramebufferParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedFramebufferReadBuffer&quot;), &amp;namedFramebufferReadBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedFramebufferRenderbuffer&quot;), &amp;namedFramebufferRenderbuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedFramebufferTexture&quot;), &amp;namedFramebufferTexture);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedFramebufferTextureLayer&quot;), &amp;namedFramebufferTextureLayer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedRenderbufferStorage&quot;), &amp;namedRenderbufferStorage);
+        AssignGLEntryPoint(loadProcAddress(&quot;glNamedRenderbufferStorageMultisample&quot;), &amp;namedRenderbufferStorageMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glReadnPixels&quot;), &amp;readnPixels);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureBarrier&quot;), &amp;textureBarrier);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureBuffer&quot;), &amp;textureBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureBufferRange&quot;), &amp;textureBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureParameterIiv&quot;), &amp;textureParameterIiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureParameterIuiv&quot;), &amp;textureParameterIuiv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureParameterf&quot;), &amp;textureParameterf);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureParameterfv&quot;), &amp;textureParameterfv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureParameteri&quot;), &amp;textureParameteri);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureParameteriv&quot;), &amp;textureParameteriv);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureStorage1D&quot;), &amp;textureStorage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureStorage2D&quot;), &amp;textureStorage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureStorage2DMultisample&quot;), &amp;textureStorage2DMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureStorage3D&quot;), &amp;textureStorage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureStorage3DMultisample&quot;), &amp;textureStorage3DMultisample);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureSubImage1D&quot;), &amp;textureSubImage1D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureSubImage2D&quot;), &amp;textureSubImage2D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTextureSubImage3D&quot;), &amp;textureSubImage3D);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTransformFeedbackBufferBase&quot;), &amp;transformFeedbackBufferBase);
+        AssignGLEntryPoint(loadProcAddress(&quot;glTransformFeedbackBufferRange&quot;), &amp;transformFeedbackBufferRange);
+        AssignGLEntryPoint(loadProcAddress(&quot;glUnmapNamedBuffer&quot;), &amp;unmapNamedBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayAttribBinding&quot;), &amp;vertexArrayAttribBinding);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayAttribFormat&quot;), &amp;vertexArrayAttribFormat);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayAttribIFormat&quot;), &amp;vertexArrayAttribIFormat);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayAttribLFormat&quot;), &amp;vertexArrayAttribLFormat);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayBindingDivisor&quot;), &amp;vertexArrayBindingDivisor);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayElementBuffer&quot;), &amp;vertexArrayElementBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayVertexBuffer&quot;), &amp;vertexArrayVertexBuffer);
+        AssignGLEntryPoint(loadProcAddress(&quot;glVertexArrayVertexBuffers&quot;), &amp;vertexArrayVertexBuffers);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglFunctionsGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/FunctionsGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,739 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// FunctionsGL.h: Defines the FuntionsGL class to contain loaded GL functions
+
+#ifndef LIBANGLE_RENDERER_GL_FUNCTIONSGL_H_
+#define LIBANGLE_RENDERER_GL_FUNCTIONSGL_H_
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/gl/functionsgl_enums.h&quot;
+#include &quot;libANGLE/renderer/gl/functionsgl_typedefs.h&quot;
+
+namespace rx
+{
+
+class FunctionsGL
+{
+  public:
+    FunctionsGL();
+    virtual ~FunctionsGL();
+
+    void initialize();
+
+    // Version information
+    GLuint majorVersion;
+    GLuint minorVersion;
+    bool openGLES;
+
+    // Extensions
+    std::vector&lt;std::string&gt; extensions;
+
+    // Entry Points
+    // 1.0
+    PFNGLBLENDFUNCPROC blendFunc;
+    PFNGLCLEARPROC clear;
+    PFNGLCLEARCOLORPROC clearColor;
+    PFNGLCLEARDEPTHPROC clearDepth;
+    PFNGLCLEARSTENCILPROC clearStencil;
+    PFNGLCOLORMASKPROC colorMask;
+    PFNGLCULLFACEPROC cullFace;
+    PFNGLDEPTHFUNCPROC depthFunc;
+    PFNGLDEPTHMASKPROC depthMask;
+    PFNGLDEPTHRANGEPROC depthRange;
+    PFNGLDISABLEPROC disable;
+    PFNGLDRAWBUFFERPROC drawBuffer;
+    PFNGLENABLEPROC enable;
+    PFNGLFINISHPROC finish;
+    PFNGLFLUSHPROC flush;
+    PFNGLFRONTFACEPROC frontFace;
+    PFNGLGETBOOLEANVPROC getBooleanv;
+    PFNGLGETDOUBLEVPROC getDoublev;
+    PFNGLGETERRORPROC getError;
+    PFNGLGETFLOATVPROC getFloatv;
+    PFNGLGETINTEGERVPROC getIntegerv;
+    PFNGLGETSTRINGPROC getString;
+    PFNGLGETTEXIMAGEPROC getTexImage;
+    PFNGLGETTEXLEVELPARAMETERFVPROC getTexLevelParameterfv;
+    PFNGLGETTEXLEVELPARAMETERIVPROC getTexLevelParameteriv;
+    PFNGLGETTEXPARAMETERFVPROC getTexParameterfv;
+    PFNGLGETTEXPARAMETERIVPROC getTexParameteriv;
+    PFNGLHINTPROC hint;
+    PFNGLISENABLEDPROC isEnabled;
+    PFNGLLINEWIDTHPROC lineWidth;
+    PFNGLLOGICOPPROC logicOp;
+    PFNGLPIXELSTOREFPROC pixelStoref;
+    PFNGLPIXELSTOREIPROC pixelStorei;
+    PFNGLPOINTSIZEPROC pointSize;
+    PFNGLPOLYGONMODEPROC polygonMode;
+    PFNGLREADBUFFERPROC readBuffer;
+    PFNGLREADPIXELSPROC readPixels;
+    PFNGLSCISSORPROC scissor;
+    PFNGLSTENCILFUNCPROC stencilFunc;
+    PFNGLSTENCILMASKPROC stencilMask;
+    PFNGLSTENCILOPPROC stencilOp;
+    PFNGLTEXIMAGE1DPROC texImage1D;
+    PFNGLTEXIMAGE2DPROC texImage2D;
+    PFNGLTEXPARAMETERFPROC texParameterf;
+    PFNGLTEXPARAMETERFVPROC texParameterfv;
+    PFNGLTEXPARAMETERIPROC texParameteri;
+    PFNGLTEXPARAMETERIVPROC texParameteriv;
+    PFNGLVIEWPORTPROC viewport;
+
+    // 1.1
+    PFNGLBINDTEXTUREPROC bindTexture;
+    PFNGLCOPYTEXIMAGE1DPROC copyTexImage1D;
+    PFNGLCOPYTEXIMAGE2DPROC copyTexImage2D;
+    PFNGLCOPYTEXSUBIMAGE1DPROC copyTexSubImage1D;
+    PFNGLCOPYTEXSUBIMAGE2DPROC copyTexSubImage2D;
+    PFNGLDELETETEXTURESPROC deleteTextures;
+    PFNGLDRAWARRAYSPROC drawArrays;
+    PFNGLDRAWELEMENTSPROC drawElements;
+    PFNGLGENTEXTURESPROC genTextures;
+    PFNGLISTEXTUREPROC isTexture;
+    PFNGLPOLYGONOFFSETPROC polygonOffset;
+    PFNGLTEXSUBIMAGE1DPROC texSubImage1D;
+    PFNGLTEXSUBIMAGE2DPROC texSubImage2D;
+
+    // 1.2
+    PFNGLBLENDCOLORPROC blendColor;
+    PFNGLBLENDEQUATIONPROC blendEquation;
+    PFNGLCOPYTEXSUBIMAGE3DPROC copyTexSubImage3D;
+    PFNGLDRAWRANGEELEMENTSPROC drawRangeElements;
+    PFNGLTEXIMAGE3DPROC texImage3D;
+    PFNGLTEXSUBIMAGE3DPROC texSubImage3D;
+
+    // 1.2 Extensions
+    PFNGLDELETEFENCESNVPROC deleteFencesNV;
+    PFNGLGENFENCESNVPROC genFencesNV;
+    PFNGLISFENCENVPROC isFenceNV;
+    PFNGLTESTFENCENVPROC testFenceNV;
+    PFNGLGETFENCEIVNVPROC getFenceivNV;
+    PFNGLFINISHFENCENVPROC finishFenceNV;
+    PFNGLSETFENCENVPROC setFenceNV;
+
+    // 1.3
+    PFNGLACTIVETEXTUREPROC activeTexture;
+    PFNGLCOMPRESSEDTEXIMAGE1DPROC compressedTexImage1D;
+    PFNGLCOMPRESSEDTEXIMAGE2DPROC compressedTexImage2D;
+    PFNGLCOMPRESSEDTEXIMAGE3DPROC compressedTexImage3D;
+    PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC compressedTexSubImage1D;
+    PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC compressedTexSubImage2D;
+    PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC compressedTexSubImage3D;
+    PFNGLGETCOMPRESSEDTEXIMAGEPROC getCompressedTexImage;
+    PFNGLSAMPLECOVERAGEPROC sampleCoverage;
+
+    // 1.4
+    PFNGLBLENDFUNCSEPARATEPROC blendFuncSeparate;
+    PFNGLMULTIDRAWARRAYSPROC multiDrawArrays;
+    PFNGLMULTIDRAWELEMENTSPROC multiDrawElements;
+    PFNGLPOINTPARAMETERFPROC pointParameterf;
+    PFNGLPOINTPARAMETERFVPROC pointParameterfv;
+    PFNGLPOINTPARAMETERIPROC pointParameteri;
+    PFNGLPOINTPARAMETERIVPROC pointParameteriv;
+
+    // 1.5
+    PFNGLBEGINQUERYPROC beginQuery;
+    PFNGLBINDBUFFERPROC bindBuffer;
+    PFNGLBUFFERDATAPROC bufferData;
+    PFNGLBUFFERSUBDATAPROC bufferSubData;
+    PFNGLDELETEBUFFERSPROC deleteBuffers;
+    PFNGLDELETEQUERIESPROC deleteQueries;
+    PFNGLENDQUERYPROC endQuery;
+    PFNGLGENBUFFERSPROC genBuffers;
+    PFNGLGENQUERIESPROC genQueries;
+    PFNGLGETBUFFERPARAMETERIVPROC getBufferParameteriv;
+    PFNGLGETBUFFERPOINTERVPROC getBufferPointerv;
+    PFNGLGETBUFFERSUBDATAPROC getBufferSubData;
+    PFNGLGETQUERYOBJECTIVPROC getQueryObjectiv;
+    PFNGLGETQUERYOBJECTUIVPROC getQueryObjectuiv;
+    PFNGLGETQUERYIVPROC getQueryiv;
+    PFNGLISBUFFERPROC isBuffer;
+    PFNGLISQUERYPROC isQuery;
+    PFNGLMAPBUFFERPROC mapBuffer;
+    PFNGLUNMAPBUFFERPROC unmapBuffer;
+
+    // 2.0
+    PFNGLATTACHSHADERPROC attachShader;
+    PFNGLBINDATTRIBLOCATIONPROC bindAttribLocation;
+    PFNGLBLENDEQUATIONSEPARATEPROC blendEquationSeparate;
+    PFNGLCOMPILESHADERPROC compileShader;
+    PFNGLCREATEPROGRAMPROC createProgram;
+    PFNGLCREATESHADERPROC createShader;
+    PFNGLDELETEPROGRAMPROC deleteProgram;
+    PFNGLDELETESHADERPROC deleteShader;
+    PFNGLDETACHSHADERPROC detachShader;
+    PFNGLDISABLEVERTEXATTRIBARRAYPROC disableVertexAttribArray;
+    PFNGLDRAWBUFFERSPROC drawBuffers;
+    PFNGLENABLEVERTEXATTRIBARRAYPROC enableVertexAttribArray;
+    PFNGLGETACTIVEATTRIBPROC getActiveAttrib;
+    PFNGLGETACTIVEUNIFORMPROC getActiveUniform;
+    PFNGLGETATTACHEDSHADERSPROC getAttachedShaders;
+    PFNGLGETATTRIBLOCATIONPROC getAttribLocation;
+    PFNGLGETPROGRAMINFOLOGPROC getProgramInfoLog;
+    PFNGLGETPROGRAMIVPROC getProgramiv;
+    PFNGLGETSHADERINFOLOGPROC getShaderInfoLog;
+    PFNGLGETSHADERSOURCEPROC getShaderSource;
+    PFNGLGETSHADERIVPROC getShaderiv;
+    PFNGLGETUNIFORMLOCATIONPROC getUniformLocation;
+    PFNGLGETUNIFORMFVPROC getUniformfv;
+    PFNGLGETUNIFORMIVPROC getUniformiv;
+    PFNGLGETVERTEXATTRIBPOINTERVPROC getVertexAttribPointerv;
+    PFNGLGETVERTEXATTRIBDVPROC getVertexAttribdv;
+    PFNGLGETVERTEXATTRIBFVPROC getVertexAttribfv;
+    PFNGLGETVERTEXATTRIBIVPROC getVertexAttribiv;
+    PFNGLISPROGRAMPROC isProgram;
+    PFNGLISSHADERPROC isShader;
+    PFNGLLINKPROGRAMPROC linkProgram;
+    PFNGLSHADERSOURCEPROC shaderSource;
+    PFNGLSTENCILFUNCSEPARATEPROC stencilFuncSeparate;
+    PFNGLSTENCILMASKSEPARATEPROC stencilMaskSeparate;
+    PFNGLSTENCILOPSEPARATEPROC stencilOpSeparate;
+    PFNGLUNIFORM1FPROC uniform1f;
+    PFNGLUNIFORM1FVPROC uniform1fv;
+    PFNGLUNIFORM1IPROC uniform1i;
+    PFNGLUNIFORM1IVPROC uniform1iv;
+    PFNGLUNIFORM2FPROC uniform2f;
+    PFNGLUNIFORM2FVPROC uniform2fv;
+    PFNGLUNIFORM2IPROC uniform2i;
+    PFNGLUNIFORM2IVPROC uniform2iv;
+    PFNGLUNIFORM3FPROC uniform3f;
+    PFNGLUNIFORM3FVPROC uniform3fv;
+    PFNGLUNIFORM3IPROC uniform3i;
+    PFNGLUNIFORM3IVPROC uniform3iv;
+    PFNGLUNIFORM4FPROC uniform4f;
+    PFNGLUNIFORM4FVPROC uniform4fv;
+    PFNGLUNIFORM4IPROC uniform4i;
+    PFNGLUNIFORM4IVPROC uniform4iv;
+    PFNGLUNIFORMMATRIX2FVPROC uniformMatrix2fv;
+    PFNGLUNIFORMMATRIX3FVPROC uniformMatrix3fv;
+    PFNGLUNIFORMMATRIX4FVPROC uniformMatrix4fv;
+    PFNGLUSEPROGRAMPROC useProgram;
+    PFNGLVALIDATEPROGRAMPROC validateProgram;
+    PFNGLVERTEXATTRIB1DPROC vertexAttrib1d;
+    PFNGLVERTEXATTRIB1DVPROC vertexAttrib1dv;
+    PFNGLVERTEXATTRIB1FPROC vertexAttrib1f;
+    PFNGLVERTEXATTRIB1FVPROC vertexAttrib1fv;
+    PFNGLVERTEXATTRIB1SPROC vertexAttrib1s;
+    PFNGLVERTEXATTRIB1SVPROC vertexAttrib1sv;
+    PFNGLVERTEXATTRIB2DPROC vertexAttrib2d;
+    PFNGLVERTEXATTRIB2DVPROC vertexAttrib2dv;
+    PFNGLVERTEXATTRIB2FPROC vertexAttrib2f;
+    PFNGLVERTEXATTRIB2FVPROC vertexAttrib2fv;
+    PFNGLVERTEXATTRIB2SPROC vertexAttrib2s;
+    PFNGLVERTEXATTRIB2SVPROC vertexAttrib2sv;
+    PFNGLVERTEXATTRIB3DPROC vertexAttrib3d;
+    PFNGLVERTEXATTRIB3DVPROC vertexAttrib3dv;
+    PFNGLVERTEXATTRIB3FPROC vertexAttrib3f;
+    PFNGLVERTEXATTRIB3FVPROC vertexAttrib3fv;
+    PFNGLVERTEXATTRIB3SPROC vertexAttrib3s;
+    PFNGLVERTEXATTRIB3SVPROC vertexAttrib3sv;
+    PFNGLVERTEXATTRIB4NBVPROC vertexAttrib4Nbv;
+    PFNGLVERTEXATTRIB4NIVPROC vertexAttrib4Niv;
+    PFNGLVERTEXATTRIB4NSVPROC vertexAttrib4Nsv;
+    PFNGLVERTEXATTRIB4NUBPROC vertexAttrib4Nub;
+    PFNGLVERTEXATTRIB4NUBVPROC vertexAttrib4Nubv;
+    PFNGLVERTEXATTRIB4NUIVPROC vertexAttrib4Nuiv;
+    PFNGLVERTEXATTRIB4NUSVPROC vertexAttrib4Nusv;
+    PFNGLVERTEXATTRIB4BVPROC vertexAttrib4bv;
+    PFNGLVERTEXATTRIB4DPROC vertexAttrib4d;
+    PFNGLVERTEXATTRIB4DVPROC vertexAttrib4dv;
+    PFNGLVERTEXATTRIB4FPROC vertexAttrib4f;
+    PFNGLVERTEXATTRIB4FVPROC vertexAttrib4fv;
+    PFNGLVERTEXATTRIB4IVPROC vertexAttrib4iv;
+    PFNGLVERTEXATTRIB4SPROC vertexAttrib4s;
+    PFNGLVERTEXATTRIB4SVPROC vertexAttrib4sv;
+    PFNGLVERTEXATTRIB4UBVPROC vertexAttrib4ubv;
+    PFNGLVERTEXATTRIB4UIVPROC vertexAttrib4uiv;
+    PFNGLVERTEXATTRIB4USVPROC vertexAttrib4usv;
+    PFNGLVERTEXATTRIBPOINTERPROC vertexAttribPointer;
+
+    // 2.1
+    PFNGLUNIFORMMATRIX2X3FVPROC uniformMatrix2x3fv;
+    PFNGLUNIFORMMATRIX2X4FVPROC uniformMatrix2x4fv;
+    PFNGLUNIFORMMATRIX3X2FVPROC uniformMatrix3x2fv;
+    PFNGLUNIFORMMATRIX3X4FVPROC uniformMatrix3x4fv;
+    PFNGLUNIFORMMATRIX4X2FVPROC uniformMatrix4x2fv;
+    PFNGLUNIFORMMATRIX4X3FVPROC uniformMatrix4x3fv;
+
+    // 3.0
+    PFNGLBEGINCONDITIONALRENDERPROC beginConditionalRender;
+    PFNGLBEGINTRANSFORMFEEDBACKPROC beginTransformFeedback;
+    PFNGLBINDBUFFERBASEPROC bindBufferBase;
+    PFNGLBINDBUFFERRANGEPROC bindBufferRange;
+    PFNGLBINDFRAGDATALOCATIONPROC bindFragDataLocation;
+    PFNGLBINDFRAMEBUFFERPROC bindFramebuffer;
+    PFNGLBINDRENDERBUFFERPROC bindRenderbuffer;
+    PFNGLBINDVERTEXARRAYPROC bindVertexArray;
+    PFNGLBLITFRAMEBUFFERPROC blitFramebuffer;
+    PFNGLCHECKFRAMEBUFFERSTATUSPROC checkFramebufferStatus;
+    PFNGLCLAMPCOLORPROC clampColor;
+    PFNGLCLEARBUFFERFIPROC clearBufferfi;
+    PFNGLCLEARBUFFERFVPROC clearBufferfv;
+    PFNGLCLEARBUFFERIVPROC clearBufferiv;
+    PFNGLCLEARBUFFERUIVPROC clearBufferuiv;
+    PFNGLCOLORMASKIPROC colorMaski;
+    PFNGLDELETEFRAMEBUFFERSPROC deleteFramebuffers;
+    PFNGLDELETERENDERBUFFERSPROC deleteRenderbuffers;
+    PFNGLDELETEVERTEXARRAYSPROC deleteVertexArrays;
+    PFNGLDISABLEIPROC disablei;
+    PFNGLENABLEIPROC enablei;
+    PFNGLENDCONDITIONALRENDERPROC endConditionalRender;
+    PFNGLENDTRANSFORMFEEDBACKPROC endTransformFeedback;
+    PFNGLFLUSHMAPPEDBUFFERRANGEPROC flushMappedBufferRange;
+    PFNGLFRAMEBUFFERRENDERBUFFERPROC framebufferRenderbuffer;
+    PFNGLFRAMEBUFFERTEXTURE1DPROC framebufferTexture1D;
+    PFNGLFRAMEBUFFERTEXTURE2DPROC framebufferTexture2D;
+    PFNGLFRAMEBUFFERTEXTURE3DPROC framebufferTexture3D;
+    PFNGLFRAMEBUFFERTEXTURELAYERPROC framebufferTextureLayer;
+    PFNGLGENFRAMEBUFFERSPROC genFramebuffers;
+    PFNGLGENRENDERBUFFERSPROC genRenderbuffers;
+    PFNGLGENVERTEXARRAYSPROC genVertexArrays;
+    PFNGLGENERATEMIPMAPPROC generateMipmap;
+    PFNGLGETBOOLEANI_VPROC getBooleani_v;
+    PFNGLGETFRAGDATALOCATIONPROC getFragDataLocation;
+    PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC getFramebufferAttachmentParameteriv;
+    PFNGLGETINTEGERI_VPROC getIntegeri_v;
+    PFNGLGETRENDERBUFFERPARAMETERIVPROC getRenderbufferParameteriv;
+    PFNGLGETSTRINGIPROC getStringi;
+    PFNGLGETTEXPARAMETERIIVPROC getTexParameterIiv;
+    PFNGLGETTEXPARAMETERIUIVPROC getTexParameterIuiv;
+    PFNGLGETTRANSFORMFEEDBACKVARYINGPROC getTransformFeedbackVarying;
+    PFNGLGETUNIFORMUIVPROC getUniformuiv;
+    PFNGLGETVERTEXATTRIBIIVPROC getVertexAttribIiv;
+    PFNGLGETVERTEXATTRIBIUIVPROC getVertexAttribIuiv;
+    PFNGLISENABLEDIPROC isEnabledi;
+    PFNGLISFRAMEBUFFERPROC isFramebuffer;
+    PFNGLISRENDERBUFFERPROC isRenderbuffer;
+    PFNGLISVERTEXARRAYPROC isVertexArray;
+    PFNGLMAPBUFFERRANGEPROC mapBufferRange;
+    PFNGLRENDERBUFFERSTORAGEPROC renderbufferStorage;
+    PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC renderbufferStorageMultisample;
+    PFNGLTEXPARAMETERIIVPROC texParameterIiv;
+    PFNGLTEXPARAMETERIUIVPROC texParameterIuiv;
+    PFNGLTRANSFORMFEEDBACKVARYINGSPROC transformFeedbackVaryings;
+    PFNGLUNIFORM1UIPROC uniform1ui;
+    PFNGLUNIFORM1UIVPROC uniform1uiv;
+    PFNGLUNIFORM2UIPROC uniform2ui;
+    PFNGLUNIFORM2UIVPROC uniform2uiv;
+    PFNGLUNIFORM3UIPROC uniform3ui;
+    PFNGLUNIFORM3UIVPROC uniform3uiv;
+    PFNGLUNIFORM4UIPROC uniform4ui;
+    PFNGLUNIFORM4UIVPROC uniform4uiv;
+    PFNGLVERTEXATTRIBI1IPROC vertexAttribI1i;
+    PFNGLVERTEXATTRIBI1IVPROC vertexAttribI1iv;
+    PFNGLVERTEXATTRIBI1UIPROC vertexAttribI1ui;
+    PFNGLVERTEXATTRIBI1UIVPROC vertexAttribI1uiv;
+    PFNGLVERTEXATTRIBI2IPROC vertexAttribI2i;
+    PFNGLVERTEXATTRIBI2IVPROC vertexAttribI2iv;
+    PFNGLVERTEXATTRIBI2UIPROC vertexAttribI2ui;
+    PFNGLVERTEXATTRIBI2UIVPROC vertexAttribI2uiv;
+    PFNGLVERTEXATTRIBI3IPROC vertexAttribI3i;
+    PFNGLVERTEXATTRIBI3IVPROC vertexAttribI3iv;
+    PFNGLVERTEXATTRIBI3UIPROC vertexAttribI3ui;
+    PFNGLVERTEXATTRIBI3UIVPROC vertexAttribI3uiv;
+    PFNGLVERTEXATTRIBI4BVPROC vertexAttribI4bv;
+    PFNGLVERTEXATTRIBI4IPROC vertexAttribI4i;
+    PFNGLVERTEXATTRIBI4IVPROC vertexAttribI4iv;
+    PFNGLVERTEXATTRIBI4SVPROC vertexAttribI4sv;
+    PFNGLVERTEXATTRIBI4UBVPROC vertexAttribI4ubv;
+    PFNGLVERTEXATTRIBI4UIPROC vertexAttribI4ui;
+    PFNGLVERTEXATTRIBI4UIVPROC vertexAttribI4uiv;
+    PFNGLVERTEXATTRIBI4USVPROC vertexAttribI4usv;
+    PFNGLVERTEXATTRIBIPOINTERPROC vertexAttribIPointer;
+
+    // 3.1
+    PFNGLCOPYBUFFERSUBDATAPROC copyBufferSubData;
+    PFNGLDRAWARRAYSINSTANCEDPROC drawArraysInstanced;
+    PFNGLDRAWELEMENTSINSTANCEDPROC drawElementsInstanced;
+    PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC getActiveUniformBlockName;
+    PFNGLGETACTIVEUNIFORMBLOCKIVPROC getActiveUniformBlockiv;
+    PFNGLGETACTIVEUNIFORMNAMEPROC getActiveUniformName;
+    PFNGLGETACTIVEUNIFORMSIVPROC getActiveUniformsiv;
+    PFNGLGETUNIFORMBLOCKINDEXPROC getUniformBlockIndex;
+    PFNGLGETUNIFORMINDICESPROC getUniformIndices;
+    PFNGLPRIMITIVERESTARTINDEXPROC primitiveRestartIndex;
+    PFNGLTEXBUFFERPROC texBuffer;
+    PFNGLUNIFORMBLOCKBINDINGPROC uniformBlockBinding;
+
+    // 3.2
+    PFNGLCLIENTWAITSYNCPROC clientWaitSync;
+    PFNGLDELETESYNCPROC deleteSync;
+    PFNGLDRAWELEMENTSBASEVERTEXPROC drawElementsBaseVertex;
+    PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC drawElementsInstancedBaseVertex;
+    PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC drawRangeElementsBaseVertex;
+    PFNGLFENCESYNCPROC fenceSync;
+    PFNGLFRAMEBUFFERTEXTUREPROC framebufferTexture;
+    PFNGLGETBUFFERPARAMETERI64VPROC getBufferParameteri64v;
+    PFNGLGETINTEGER64I_VPROC getInteger64i_v;
+    PFNGLGETINTEGER64VPROC getInteger64v;
+    PFNGLGETMULTISAMPLEFVPROC getMultisamplefv;
+    PFNGLGETSYNCIVPROC getSynciv;
+    PFNGLISSYNCPROC isSync;
+    PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC multiDrawElementsBaseVertex;
+    PFNGLPROVOKINGVERTEXPROC provokingVertex;
+    PFNGLSAMPLEMASKIPROC sampleMaski;
+    PFNGLTEXIMAGE2DMULTISAMPLEPROC texImage2DMultisample;
+    PFNGLTEXIMAGE3DMULTISAMPLEPROC texImage3DMultisample;
+    PFNGLWAITSYNCPROC waitSync;
+
+    // 3.3
+    PFNGLBINDFRAGDATALOCATIONINDEXEDPROC bindFragDataLocationIndexed;
+    PFNGLBINDSAMPLERPROC bindSampler;
+    PFNGLDELETESAMPLERSPROC deleteSamplers;
+    PFNGLGENSAMPLERSPROC genSamplers;
+    PFNGLGETFRAGDATAINDEXPROC getFragDataIndex;
+    PFNGLGETQUERYOBJECTI64VPROC getQueryObjecti64v;
+    PFNGLGETQUERYOBJECTUI64VPROC getQueryObjectui64v;
+    PFNGLGETSAMPLERPARAMETERIIVPROC getSamplerParameterIiv;
+    PFNGLGETSAMPLERPARAMETERIUIVPROC getSamplerParameterIuiv;
+    PFNGLGETSAMPLERPARAMETERFVPROC getSamplerParameterfv;
+    PFNGLGETSAMPLERPARAMETERIVPROC getSamplerParameteriv;
+    PFNGLISSAMPLERPROC isSampler;
+    PFNGLQUERYCOUNTERPROC queryCounter;
+    PFNGLSAMPLERPARAMETERIIVPROC samplerParameterIiv;
+    PFNGLSAMPLERPARAMETERIUIVPROC samplerParameterIuiv;
+    PFNGLSAMPLERPARAMETERFPROC samplerParameterf;
+    PFNGLSAMPLERPARAMETERFVPROC samplerParameterfv;
+    PFNGLSAMPLERPARAMETERIPROC samplerParameteri;
+    PFNGLSAMPLERPARAMETERIVPROC samplerParameteriv;
+    PFNGLVERTEXATTRIBDIVISORPROC vertexAttribDivisor;
+    PFNGLVERTEXATTRIBP1UIPROC vertexAttribP1ui;
+    PFNGLVERTEXATTRIBP1UIVPROC vertexAttribP1uiv;
+    PFNGLVERTEXATTRIBP2UIPROC vertexAttribP2ui;
+    PFNGLVERTEXATTRIBP2UIVPROC vertexAttribP2uiv;
+    PFNGLVERTEXATTRIBP3UIPROC vertexAttribP3ui;
+    PFNGLVERTEXATTRIBP3UIVPROC vertexAttribP3uiv;
+    PFNGLVERTEXATTRIBP4UIPROC vertexAttribP4ui;
+    PFNGLVERTEXATTRIBP4UIVPROC vertexAttribP4uiv;
+
+    // 4.0
+    PFNGLBEGINQUERYINDEXEDPROC beginQueryIndexed;
+    PFNGLBINDTRANSFORMFEEDBACKPROC bindTransformFeedback;
+    PFNGLBLENDEQUATIONSEPARATEIPROC blendEquationSeparatei;
+    PFNGLBLENDEQUATIONIPROC blendEquationi;
+    PFNGLBLENDFUNCSEPARATEIPROC blendFuncSeparatei;
+    PFNGLBLENDFUNCIPROC blendFunci;
+    PFNGLDELETETRANSFORMFEEDBACKSPROC deleteTransformFeedbacks;
+    PFNGLDRAWARRAYSINDIRECTPROC drawArraysIndirect;
+    PFNGLDRAWELEMENTSINDIRECTPROC drawElementsIndirect;
+    PFNGLDRAWTRANSFORMFEEDBACKPROC drawTransformFeedback;
+    PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC drawTransformFeedbackStream;
+    PFNGLENDQUERYINDEXEDPROC endQueryIndexed;
+    PFNGLGENTRANSFORMFEEDBACKSPROC genTransformFeedbacks;
+    PFNGLGETACTIVESUBROUTINENAMEPROC getActiveSubroutineName;
+    PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC getActiveSubroutineUniformName;
+    PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC getActiveSubroutineUniformiv;
+    PFNGLGETPROGRAMSTAGEIVPROC getProgramStageiv;
+    PFNGLGETQUERYINDEXEDIVPROC getQueryIndexediv;
+    PFNGLGETSUBROUTINEINDEXPROC getSubroutineIndex;
+    PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC getSubroutineUniformLocation;
+    PFNGLGETUNIFORMSUBROUTINEUIVPROC getUniformSubroutineuiv;
+    PFNGLGETUNIFORMDVPROC getUniformdv;
+    PFNGLISTRANSFORMFEEDBACKPROC isTransformFeedback;
+    PFNGLMINSAMPLESHADINGPROC minSampleShading;
+    PFNGLPATCHPARAMETERFVPROC patchParameterfv;
+    PFNGLPATCHPARAMETERIPROC patchParameteri;
+    PFNGLPAUSETRANSFORMFEEDBACKPROC pauseTransformFeedback;
+    PFNGLRESUMETRANSFORMFEEDBACKPROC resumeTransformFeedback;
+    PFNGLUNIFORM1DPROC uniform1d;
+    PFNGLUNIFORM1DVPROC uniform1dv;
+    PFNGLUNIFORM2DPROC uniform2d;
+    PFNGLUNIFORM2DVPROC uniform2dv;
+    PFNGLUNIFORM3DPROC uniform3d;
+    PFNGLUNIFORM3DVPROC uniform3dv;
+    PFNGLUNIFORM4DPROC uniform4d;
+    PFNGLUNIFORM4DVPROC uniform4dv;
+    PFNGLUNIFORMMATRIX2DVPROC uniformMatrix2dv;
+    PFNGLUNIFORMMATRIX2X3DVPROC uniformMatrix2x3dv;
+    PFNGLUNIFORMMATRIX2X4DVPROC uniformMatrix2x4dv;
+    PFNGLUNIFORMMATRIX3DVPROC uniformMatrix3dv;
+    PFNGLUNIFORMMATRIX3X2DVPROC uniformMatrix3x2dv;
+    PFNGLUNIFORMMATRIX3X4DVPROC uniformMatrix3x4dv;
+    PFNGLUNIFORMMATRIX4DVPROC uniformMatrix4dv;
+    PFNGLUNIFORMMATRIX4X2DVPROC uniformMatrix4x2dv;
+    PFNGLUNIFORMMATRIX4X3DVPROC uniformMatrix4x3dv;
+    PFNGLUNIFORMSUBROUTINESUIVPROC uniformSubroutinesuiv;
+
+    // 4.1
+    PFNGLACTIVESHADERPROGRAMPROC activeShaderProgram;
+    PFNGLBINDPROGRAMPIPELINEPROC bindProgramPipeline;
+    PFNGLCLEARDEPTHFPROC clearDepthf;
+    PFNGLCREATESHADERPROGRAMVPROC createShaderProgramv;
+    PFNGLDELETEPROGRAMPIPELINESPROC deleteProgramPipelines;
+    PFNGLDEPTHRANGEARRAYVPROC depthRangeArrayv;
+    PFNGLDEPTHRANGEINDEXEDPROC depthRangeIndexed;
+    PFNGLDEPTHRANGEFPROC depthRangef;
+    PFNGLGENPROGRAMPIPELINESPROC genProgramPipelines;
+    PFNGLGETDOUBLEI_VPROC getDoublei_v;
+    PFNGLGETFLOATI_VPROC getFloati_v;
+    PFNGLGETPROGRAMBINARYPROC getProgramBinary;
+    PFNGLGETPROGRAMPIPELINEINFOLOGPROC getProgramPipelineInfoLog;
+    PFNGLGETPROGRAMPIPELINEIVPROC getProgramPipelineiv;
+    PFNGLGETSHADERPRECISIONFORMATPROC getShaderPrecisionFormat;
+    PFNGLGETVERTEXATTRIBLDVPROC getVertexAttribLdv;
+    PFNGLISPROGRAMPIPELINEPROC isProgramPipeline;
+    PFNGLPROGRAMBINARYPROC programBinary;
+    PFNGLPROGRAMPARAMETERIPROC programParameteri;
+    PFNGLPROGRAMUNIFORM1DPROC programUniform1d;
+    PFNGLPROGRAMUNIFORM1DVPROC programUniform1dv;
+    PFNGLPROGRAMUNIFORM1FPROC programUniform1f;
+    PFNGLPROGRAMUNIFORM1FVPROC programUniform1fv;
+    PFNGLPROGRAMUNIFORM1IPROC programUniform1i;
+    PFNGLPROGRAMUNIFORM1IVPROC programUniform1iv;
+    PFNGLPROGRAMUNIFORM1UIPROC programUniform1ui;
+    PFNGLPROGRAMUNIFORM1UIVPROC programUniform1uiv;
+    PFNGLPROGRAMUNIFORM2DPROC programUniform2d;
+    PFNGLPROGRAMUNIFORM2DVPROC programUniform2dv;
+    PFNGLPROGRAMUNIFORM2FPROC programUniform2f;
+    PFNGLPROGRAMUNIFORM2FVPROC programUniform2fv;
+    PFNGLPROGRAMUNIFORM2IPROC programUniform2i;
+    PFNGLPROGRAMUNIFORM2IVPROC programUniform2iv;
+    PFNGLPROGRAMUNIFORM2UIPROC programUniform2ui;
+    PFNGLPROGRAMUNIFORM2UIVPROC programUniform2uiv;
+    PFNGLPROGRAMUNIFORM3DPROC programUniform3d;
+    PFNGLPROGRAMUNIFORM3DVPROC programUniform3dv;
+    PFNGLPROGRAMUNIFORM3FPROC programUniform3f;
+    PFNGLPROGRAMUNIFORM3FVPROC programUniform3fv;
+    PFNGLPROGRAMUNIFORM3IPROC programUniform3i;
+    PFNGLPROGRAMUNIFORM3IVPROC programUniform3iv;
+    PFNGLPROGRAMUNIFORM3UIPROC programUniform3ui;
+    PFNGLPROGRAMUNIFORM3UIVPROC programUniform3uiv;
+    PFNGLPROGRAMUNIFORM4DPROC programUniform4d;
+    PFNGLPROGRAMUNIFORM4DVPROC programUniform4dv;
+    PFNGLPROGRAMUNIFORM4FPROC programUniform4f;
+    PFNGLPROGRAMUNIFORM4FVPROC programUniform4fv;
+    PFNGLPROGRAMUNIFORM4IPROC programUniform4i;
+    PFNGLPROGRAMUNIFORM4IVPROC programUniform4iv;
+    PFNGLPROGRAMUNIFORM4UIPROC programUniform4ui;
+    PFNGLPROGRAMUNIFORM4UIVPROC programUniform4uiv;
+    PFNGLPROGRAMUNIFORMMATRIX2DVPROC programUniformMatrix2dv;
+    PFNGLPROGRAMUNIFORMMATRIX2FVPROC programUniformMatrix2fv;
+    PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC programUniformMatrix2x3dv;
+    PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC programUniformMatrix2x3fv;
+    PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC programUniformMatrix2x4dv;
+    PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC programUniformMatrix2x4fv;
+    PFNGLPROGRAMUNIFORMMATRIX3DVPROC programUniformMatrix3dv;
+    PFNGLPROGRAMUNIFORMMATRIX3FVPROC programUniformMatrix3fv;
+    PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC programUniformMatrix3x2dv;
+    PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC programUniformMatrix3x2fv;
+    PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC programUniformMatrix3x4dv;
+    PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC programUniformMatrix3x4fv;
+    PFNGLPROGRAMUNIFORMMATRIX4DVPROC programUniformMatrix4dv;
+    PFNGLPROGRAMUNIFORMMATRIX4FVPROC programUniformMatrix4fv;
+    PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC programUniformMatrix4x2dv;
+    PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC programUniformMatrix4x2fv;
+    PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC programUniformMatrix4x3dv;
+    PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC programUniformMatrix4x3fv;
+    PFNGLRELEASESHADERCOMPILERPROC releaseShaderCompiler;
+    PFNGLSCISSORARRAYVPROC scissorArrayv;
+    PFNGLSCISSORINDEXEDPROC scissorIndexed;
+    PFNGLSCISSORINDEXEDVPROC scissorIndexedv;
+    PFNGLSHADERBINARYPROC shaderBinary;
+    PFNGLUSEPROGRAMSTAGESPROC useProgramStages;
+    PFNGLVALIDATEPROGRAMPIPELINEPROC validateProgramPipeline;
+    PFNGLVERTEXATTRIBL1DPROC vertexAttribL1d;
+    PFNGLVERTEXATTRIBL1DVPROC vertexAttribL1dv;
+    PFNGLVERTEXATTRIBL2DPROC vertexAttribL2d;
+    PFNGLVERTEXATTRIBL2DVPROC vertexAttribL2dv;
+    PFNGLVERTEXATTRIBL3DPROC vertexAttribL3d;
+    PFNGLVERTEXATTRIBL3DVPROC vertexAttribL3dv;
+    PFNGLVERTEXATTRIBL4DPROC vertexAttribL4d;
+    PFNGLVERTEXATTRIBL4DVPROC vertexAttribL4dv;
+    PFNGLVERTEXATTRIBLPOINTERPROC vertexAttribLPointer;
+    PFNGLVIEWPORTARRAYVPROC viewportArrayv;
+    PFNGLVIEWPORTINDEXEDFPROC viewportIndexedf;
+    PFNGLVIEWPORTINDEXEDFVPROC viewportIndexedfv;
+
+    // 4.2
+    PFNGLBINDIMAGETEXTUREPROC bindImageTexture;
+    PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC drawArraysInstancedBaseInstance;
+    PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC drawElementsInstancedBaseInstance;
+    PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC drawElementsInstancedBaseVertexBaseInstance;
+    PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC drawTransformFeedbackInstanced;
+    PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC drawTransformFeedbackStreamInstanced;
+    PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC getActiveAtomicCounterBufferiv;
+    PFNGLGETINTERNALFORMATIVPROC getInternalformativ;
+    PFNGLMEMORYBARRIERPROC memoryBarrier;
+    PFNGLTEXSTORAGE1DPROC texStorage1D;
+    PFNGLTEXSTORAGE2DPROC texStorage2D;
+    PFNGLTEXSTORAGE3DPROC texStorage3D;
+
+    // 4.3
+    PFNGLBINDVERTEXBUFFERPROC bindVertexBuffer;
+    PFNGLCLEARBUFFERDATAPROC clearBufferData;
+    PFNGLCLEARBUFFERSUBDATAPROC clearBufferSubData;
+    PFNGLCOPYIMAGESUBDATAPROC copyImageSubData;
+    PFNGLDEBUGMESSAGECALLBACKPROC debugMessageCallback;
+    PFNGLDEBUGMESSAGECONTROLPROC debugMessageControl;
+    PFNGLDEBUGMESSAGEINSERTPROC debugMessageInsert;
+    PFNGLDISPATCHCOMPUTEPROC dispatchCompute;
+    PFNGLDISPATCHCOMPUTEINDIRECTPROC dispatchComputeIndirect;
+    PFNGLFRAMEBUFFERPARAMETERIPROC framebufferParameteri;
+    PFNGLGETDEBUGMESSAGELOGPROC getDebugMessageLog;
+    PFNGLGETFRAMEBUFFERPARAMETERIVPROC getFramebufferParameteriv;
+    PFNGLGETINTERNALFORMATI64VPROC getInternalformati64v;
+    PFNGLGETOBJECTLABELPROC getObjectLabel;
+    PFNGLGETOBJECTPTRLABELPROC getObjectPtrLabel;
+    PFNGLGETPROGRAMINTERFACEIVPROC getProgramInterfaceiv;
+    PFNGLGETPROGRAMRESOURCEINDEXPROC getProgramResourceIndex;
+    PFNGLGETPROGRAMRESOURCELOCATIONPROC getProgramResourceLocation;
+    PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC getProgramResourceLocationIndex;
+    PFNGLGETPROGRAMRESOURCENAMEPROC getProgramResourceName;
+    PFNGLGETPROGRAMRESOURCEIVPROC getProgramResourceiv;
+    PFNGLINVALIDATEBUFFERDATAPROC invalidateBufferData;
+    PFNGLINVALIDATEBUFFERSUBDATAPROC invalidateBufferSubData;
+    PFNGLINVALIDATEFRAMEBUFFERPROC invalidateFramebuffer;
+    PFNGLINVALIDATESUBFRAMEBUFFERPROC invalidateSubFramebuffer;
+    PFNGLINVALIDATETEXIMAGEPROC invalidateTexImage;
+    PFNGLINVALIDATETEXSUBIMAGEPROC invalidateTexSubImage;
+    PFNGLMULTIDRAWARRAYSINDIRECTPROC multiDrawArraysIndirect;
+    PFNGLMULTIDRAWELEMENTSINDIRECTPROC multiDrawElementsIndirect;
+    PFNGLOBJECTLABELPROC objectLabel;
+    PFNGLOBJECTPTRLABELPROC objectPtrLabel;
+    PFNGLPOPDEBUGGROUPPROC popDebugGroup;
+    PFNGLPUSHDEBUGGROUPPROC pushDebugGroup;
+    PFNGLSHADERSTORAGEBLOCKBINDINGPROC shaderStorageBlockBinding;
+    PFNGLTEXBUFFERRANGEPROC texBufferRange;
+    PFNGLTEXSTORAGE2DMULTISAMPLEPROC texStorage2DMultisample;
+    PFNGLTEXSTORAGE3DMULTISAMPLEPROC texStorage3DMultisample;
+    PFNGLTEXTUREVIEWPROC textureView;
+    PFNGLVERTEXATTRIBBINDINGPROC vertexAttribBinding;
+    PFNGLVERTEXATTRIBFORMATPROC vertexAttribFormat;
+    PFNGLVERTEXATTRIBIFORMATPROC vertexAttribIFormat;
+    PFNGLVERTEXATTRIBLFORMATPROC vertexAttribLFormat;
+    PFNGLVERTEXBINDINGDIVISORPROC vertexBindingDivisor;
+
+    // 4.4
+    PFNGLBINDBUFFERSBASEPROC bindBuffersBase;
+    PFNGLBINDBUFFERSRANGEPROC bindBuffersRange;
+    PFNGLBINDIMAGETEXTURESPROC bindImageTextures;
+    PFNGLBINDSAMPLERSPROC bindSamplers;
+    PFNGLBINDTEXTURESPROC bindTextures;
+    PFNGLBINDVERTEXBUFFERSPROC bindVertexBuffers;
+    PFNGLBUFFERSTORAGEPROC bufferStorage;
+    PFNGLCLEARTEXIMAGEPROC clearTexImage;
+    PFNGLCLEARTEXSUBIMAGEPROC clearTexSubImage;
+
+    // 4.5
+    PFNGLBINDTEXTUREUNITPROC bindTextureUnit;
+    PFNGLBLITNAMEDFRAMEBUFFERPROC blitNamedFramebuffer;
+    PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC checkNamedFramebufferStatus;
+    PFNGLCLEARNAMEDBUFFERDATAPROC clearNamedBufferData;
+    PFNGLCLEARNAMEDBUFFERSUBDATAPROC clearNamedBufferSubData;
+    PFNGLCLEARNAMEDFRAMEBUFFERFIPROC clearNamedFramebufferfi;
+    PFNGLCLEARNAMEDFRAMEBUFFERFVPROC clearNamedFramebufferfv;
+    PFNGLCLEARNAMEDFRAMEBUFFERIVPROC clearNamedFramebufferiv;
+    PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC clearNamedFramebufferuiv;
+    PFNGLCLIPCONTROLPROC clipControl;
+    PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC compressedTextureSubImage1D;
+    PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC compressedTextureSubImage2D;
+    PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC compressedTextureSubImage3D;
+    PFNGLCOPYNAMEDBUFFERSUBDATAPROC copyNamedBufferSubData;
+    PFNGLCOPYTEXTURESUBIMAGE1DPROC copyTextureSubImage1D;
+    PFNGLCOPYTEXTURESUBIMAGE2DPROC copyTextureSubImage2D;
+    PFNGLCOPYTEXTURESUBIMAGE3DPROC copyTextureSubImage3D;
+    PFNGLCREATEBUFFERSPROC createBuffers;
+    PFNGLCREATEFRAMEBUFFERSPROC createFramebuffers;
+    PFNGLCREATEPROGRAMPIPELINESPROC createProgramPipelines;
+    PFNGLCREATEQUERIESPROC createQueries;
+    PFNGLCREATERENDERBUFFERSPROC createRenderbuffers;
+    PFNGLCREATESAMPLERSPROC createSamplers;
+    PFNGLCREATETEXTURESPROC createTextures;
+    PFNGLCREATETRANSFORMFEEDBACKSPROC createTransformFeedbacks;
+    PFNGLCREATEVERTEXARRAYSPROC createVertexArrays;
+    PFNGLDISABLEVERTEXARRAYATTRIBPROC disableVertexArrayAttrib;
+    PFNGLENABLEVERTEXARRAYATTRIBPROC enableVertexArrayAttrib;
+    PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC flushMappedNamedBufferRange;
+    PFNGLGENERATETEXTUREMIPMAPPROC generateTextureMipmap;
+    PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC getCompressedTextureImage;
+    PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC getCompressedTextureSubImage;
+    PFNGLGETGRAPHICSRESETSTATUSPROC getGraphicsResetStatus;
+    PFNGLGETNAMEDBUFFERPARAMETERI64VPROC getNamedBufferParameteri64v;
+    PFNGLGETNAMEDBUFFERPARAMETERIVPROC getNamedBufferParameteriv;
+    PFNGLGETNAMEDBUFFERPOINTERVPROC getNamedBufferPointerv;
+    PFNGLGETNAMEDBUFFERSUBDATAPROC getNamedBufferSubData;
+    PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC getNamedFramebufferAttachmentParameteriv;
+    PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC getNamedFramebufferParameteriv;
+    PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC getNamedRenderbufferParameteriv;
+    PFNGLGETQUERYBUFFEROBJECTI64VPROC getQueryBufferObjecti64v;
+    PFNGLGETQUERYBUFFEROBJECTIVPROC getQueryBufferObjectiv;
+    PFNGLGETQUERYBUFFEROBJECTUI64VPROC getQueryBufferObjectui64v;
+    PFNGLGETQUERYBUFFEROBJECTUIVPROC getQueryBufferObjectuiv;
+    PFNGLGETTEXTUREIMAGEPROC getTextureImage;
+    PFNGLGETTEXTURELEVELPARAMETERFVPROC getTextureLevelParameterfv;
+    PFNGLGETTEXTURELEVELPARAMETERIVPROC getTextureLevelParameteriv;
+    PFNGLGETTEXTUREPARAMETERIIVPROC getTextureParameterIiv;
+    PFNGLGETTEXTUREPARAMETERIUIVPROC getTextureParameterIuiv;
+    PFNGLGETTEXTUREPARAMETERFVPROC getTextureParameterfv;
+    PFNGLGETTEXTUREPARAMETERIVPROC getTextureParameteriv;
+    PFNGLGETTEXTURESUBIMAGEPROC getTextureSubImage;
+    PFNGLGETTRANSFORMFEEDBACKI64_VPROC getTransformFeedbacki64_v;
+    PFNGLGETTRANSFORMFEEDBACKI_VPROC getTransformFeedbacki_v;
+    PFNGLGETTRANSFORMFEEDBACKIVPROC getTransformFeedbackiv;
+    PFNGLGETVERTEXARRAYINDEXED64IVPROC getVertexArrayIndexed64iv;
+    PFNGLGETVERTEXARRAYINDEXEDIVPROC getVertexArrayIndexediv;
+    PFNGLGETVERTEXARRAYIVPROC getVertexArrayiv;
+    PFNGLGETNCOMPRESSEDTEXIMAGEPROC getnCompressedTexImage;
+    PFNGLGETNTEXIMAGEPROC getnTexImage;
+    PFNGLGETNUNIFORMDVPROC getnUniformdv;
+    PFNGLGETNUNIFORMFVPROC getnUniformfv;
+    PFNGLGETNUNIFORMIVPROC getnUniformiv;
+    PFNGLGETNUNIFORMUIVPROC getnUniformuiv;
+    PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC invalidateNamedFramebufferData;
+    PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC invalidateNamedFramebufferSubData;
+    PFNGLMAPNAMEDBUFFERPROC mapNamedBuffer;
+    PFNGLMAPNAMEDBUFFERRANGEPROC mapNamedBufferRange;
+    PFNGLMEMORYBARRIERBYREGIONPROC memoryBarrierByRegion;
+    PFNGLNAMEDBUFFERDATAPROC namedBufferData;
+    PFNGLNAMEDBUFFERSTORAGEPROC namedBufferStorage;
+    PFNGLNAMEDBUFFERSUBDATAPROC namedBufferSubData;
+    PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC namedFramebufferDrawBuffer;
+    PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC namedFramebufferDrawBuffers;
+    PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC namedFramebufferParameteri;
+    PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC namedFramebufferReadBuffer;
+    PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC namedFramebufferRenderbuffer;
+    PFNGLNAMEDFRAMEBUFFERTEXTUREPROC namedFramebufferTexture;
+    PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC namedFramebufferTextureLayer;
+    PFNGLNAMEDRENDERBUFFERSTORAGEPROC namedRenderbufferStorage;
+    PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC namedRenderbufferStorageMultisample;
+    PFNGLREADNPIXELSPROC readnPixels;
+    PFNGLTEXTUREBARRIERPROC textureBarrier;
+    PFNGLTEXTUREBUFFERPROC textureBuffer;
+    PFNGLTEXTUREBUFFERRANGEPROC textureBufferRange;
+    PFNGLTEXTUREPARAMETERIIVPROC textureParameterIiv;
+    PFNGLTEXTUREPARAMETERIUIVPROC textureParameterIuiv;
+    PFNGLTEXTUREPARAMETERFPROC textureParameterf;
+    PFNGLTEXTUREPARAMETERFVPROC textureParameterfv;
+    PFNGLTEXTUREPARAMETERIPROC textureParameteri;
+    PFNGLTEXTUREPARAMETERIVPROC textureParameteriv;
+    PFNGLTEXTURESTORAGE1DPROC textureStorage1D;
+    PFNGLTEXTURESTORAGE2DPROC textureStorage2D;
+    PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC textureStorage2DMultisample;
+    PFNGLTEXTURESTORAGE3DPROC textureStorage3D;
+    PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC textureStorage3DMultisample;
+    PFNGLTEXTURESUBIMAGE1DPROC textureSubImage1D;
+    PFNGLTEXTURESUBIMAGE2DPROC textureSubImage2D;
+    PFNGLTEXTURESUBIMAGE3DPROC textureSubImage3D;
+    PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC transformFeedbackBufferBase;
+    PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC transformFeedbackBufferRange;
+    PFNGLUNMAPNAMEDBUFFERPROC unmapNamedBuffer;
+    PFNGLVERTEXARRAYATTRIBBINDINGPROC vertexArrayAttribBinding;
+    PFNGLVERTEXARRAYATTRIBFORMATPROC vertexArrayAttribFormat;
+    PFNGLVERTEXARRAYATTRIBIFORMATPROC vertexArrayAttribIFormat;
+    PFNGLVERTEXARRAYATTRIBLFORMATPROC vertexArrayAttribLFormat;
+    PFNGLVERTEXARRAYBINDINGDIVISORPROC vertexArrayBindingDivisor;
+    PFNGLVERTEXARRAYELEMENTBUFFERPROC vertexArrayElementBuffer;
+    PFNGLVERTEXARRAYVERTEXBUFFERPROC vertexArrayVertexBuffer;
+    PFNGLVERTEXARRAYVERTEXBUFFERSPROC vertexArrayVertexBuffers;
+
+  private:
+    virtual void *loadProcAddress(const std::string &amp;function) = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_FUNCTIONSGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglProgramGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,419 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// ProgramGL.cpp: Implements the class methods for ProgramGL.
+
+#include &quot;libANGLE/renderer/gl/ProgramGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/ShaderGL.h&quot;
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+
+namespace rx
+{
+
+ProgramGL::ProgramGL(const FunctionsGL *functions, StateManagerGL *stateManager)
+    : ProgramImpl(),
+      mFunctions(functions),
+      mStateManager(stateManager),
+      mProgramID(0)
+{
+    ASSERT(mFunctions);
+    ASSERT(mStateManager);
+}
+
+ProgramGL::~ProgramGL()
+{
+    if (mProgramID != 0)
+    {
+        mFunctions-&gt;deleteProgram(mProgramID);
+        mProgramID = 0;
+    }
+}
+
+bool ProgramGL::usesPointSize() const
+{
+    UNIMPLEMENTED();
+    return bool();
+}
+
+int ProgramGL::getShaderVersion() const
+{
+    UNIMPLEMENTED();
+    return int();
+}
+
+GLenum ProgramGL::getTransformFeedbackBufferMode() const
+{
+    UNIMPLEMENTED();
+    return GLenum();
+}
+
+GLenum ProgramGL::getBinaryFormat()
+{
+    UNIMPLEMENTED();
+    return GLenum();
+}
+
+LinkResult ProgramGL::load(gl::InfoLog &amp;infoLog, gl::BinaryInputStream *stream)
+{
+    UNIMPLEMENTED();
+    return LinkResult(false, gl::Error(GL_INVALID_OPERATION));
+}
+
+gl::Error ProgramGL::save(gl::BinaryOutputStream *stream)
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+LinkResult ProgramGL::link(const gl::Data &amp;data, gl::InfoLog &amp;infoLog,
+                           gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                           const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings,
+                           GLenum transformFeedbackBufferMode,
+                           int *registers, std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings,
+                           std::map&lt;int, gl::VariableLocation&gt; *outputVariables)
+{
+    // Reset the program state, delete the current program if one exists
+    reset();
+
+    ShaderGL *vertexShaderGL = GetImplAs&lt;ShaderGL&gt;(vertexShader);
+    ShaderGL *fragmentShaderGL = GetImplAs&lt;ShaderGL&gt;(fragmentShader);
+
+    // Generate a new program, make sure one doesn't already exist
+    ASSERT(mProgramID == 0);
+    mProgramID = mFunctions-&gt;createProgram();
+
+    // Attach the shaders
+    mFunctions-&gt;attachShader(mProgramID, vertexShaderGL-&gt;getShaderID());
+    mFunctions-&gt;attachShader(mProgramID, fragmentShaderGL-&gt;getShaderID());
+
+    // TODO: bind attribute locations?
+
+    // Link and verify
+    mFunctions-&gt;linkProgram(mProgramID);
+
+    GLint linkStatus = GL_FALSE;
+    mFunctions-&gt;getProgramiv(mProgramID, GL_LINK_STATUS, &amp;linkStatus);
+    ASSERT(linkStatus == GL_TRUE);
+    if (linkStatus == GL_FALSE)
+    {
+        // Linking failed, put the error into the info log
+        GLint infoLogLength = 0;
+        mFunctions-&gt;getProgramiv(mProgramID, GL_INFO_LOG_LENGTH, &amp;infoLogLength);
+
+        std::vector&lt;char&gt; buf(infoLogLength);
+        mFunctions-&gt;getProgramInfoLog(mProgramID, infoLogLength, nullptr, &amp;buf[0]);
+
+        mFunctions-&gt;deleteProgram(mProgramID);
+        mProgramID = 0;
+
+        infoLog.append(&amp;buf[0]);
+        TRACE(&quot;\n%s&quot;, &amp;buf[0]);
+
+        // TODO, return GL_OUT_OF_MEMORY or just fail the link? This is an unexpected case
+        return LinkResult(false, gl::Error(GL_NO_ERROR));
+    }
+
+    // Query the uniform information
+    // TODO: A lot of this logic should be done at the gl::Program level
+    GLint activeUniformMaxLength = 0;
+    mFunctions-&gt;getProgramiv(mProgramID, GL_ACTIVE_UNIFORM_MAX_LENGTH, &amp;activeUniformMaxLength);
+
+    std::vector&lt;GLchar&gt; uniformNameBuffer(activeUniformMaxLength);
+
+    GLint uniformCount = 0;
+    mFunctions-&gt;getProgramiv(mProgramID, GL_ACTIVE_UNIFORMS, &amp;uniformCount);
+    for (GLint i = 0; i &lt; uniformCount; i++)
+    {
+        GLsizei uniformNameLength = 0;
+        GLint uniformSize = 0;
+        GLenum uniformType = GL_NONE;
+        mFunctions-&gt;getActiveUniform(mProgramID, i, uniformNameBuffer.size(), &amp;uniformNameLength, &amp;uniformSize, &amp;uniformType, &amp;uniformNameBuffer[0]);
+
+        std::string uniformName = gl::ParseUniformName(std::string(&amp;uniformNameBuffer[0], uniformNameLength), nullptr);
+
+        for (size_t arrayIndex = 0; arrayIndex &lt; static_cast&lt;size_t&gt;(uniformSize); arrayIndex++)
+        {
+            std::string locationName = uniformName;
+            if (uniformSize &gt; 1)
+            {
+                locationName += &quot;[&quot; + Str(arrayIndex) + &quot;]&quot;;
+            }
+
+            GLint location = mFunctions-&gt;getUniformLocation(mProgramID, locationName.c_str());
+            if (location &gt;= 0)
+            {
+                // Make sure the uniform index array is large enough
+                if (static_cast&lt;size_t&gt;(location) &gt;= mUniformIndex.size())
+                {
+                    mUniformIndex.resize(location + 1);
+                }
+
+                mUniformIndex[location] = gl::VariableLocation(uniformName, arrayIndex, static_cast&lt;unsigned int&gt;(mUniforms.size()));
+            }
+        }
+
+        // ANGLE uses 0 to identify an non-array uniform.
+        unsigned int arraySize = (uniformSize &gt; 1) ? static_cast&lt;unsigned int&gt;(uniformSize) : 0;
+
+        // TODO: determine uniform precision
+        mUniforms.push_back(new gl::LinkedUniform(uniformType, GL_NONE, uniformName, arraySize, -1, sh::BlockMemberInfo::getDefaultBlockInfo()));
+    }
+
+    // Query the attribute information
+    GLint activeAttributeMaxLength = 0;
+    mFunctions-&gt;getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &amp;activeAttributeMaxLength);
+
+    std::vector&lt;GLchar&gt; attributeNameBuffer(activeAttributeMaxLength);
+
+    GLint attributeCount = 0;
+    mFunctions-&gt;getProgramiv(mProgramID, GL_ACTIVE_ATTRIBUTES, &amp;attributeCount);
+    for (GLint i = 0; i &lt; attributeCount; i++)
+    {
+        GLsizei attributeNameLength = 0;
+        GLint attributeSize = 0;
+        GLenum attributeType = GL_NONE;
+        mFunctions-&gt;getActiveAttrib(mProgramID, i, attributeNameBuffer.size(), &amp;attributeNameLength, &amp;attributeSize, &amp;attributeType, &amp;attributeNameBuffer[0]);
+
+        std::string attributeName(&amp;attributeNameBuffer[0], attributeNameLength);
+
+        // TODO: determine attribute precision
+        setShaderAttribute(static_cast&lt;size_t&gt;(i), attributeType, GL_NONE, attributeName, attributeSize, i);
+    }
+
+    return LinkResult(true, gl::Error(GL_NO_ERROR));
+}
+
+void ProgramGL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform1fv(location, count, v);
+}
+
+void ProgramGL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform2fv(location, count, v);
+}
+
+void ProgramGL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform3fv(location, count, v);
+}
+
+void ProgramGL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform4fv(location, count, v);
+}
+
+void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform1iv(location, count, v);
+}
+
+void ProgramGL::setUniform2iv(GLint location, GLsizei count, const GLint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform2iv(location, count, v);
+}
+
+void ProgramGL::setUniform3iv(GLint location, GLsizei count, const GLint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform3iv(location, count, v);
+}
+
+void ProgramGL::setUniform4iv(GLint location, GLsizei count, const GLint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform4iv(location, count, v);
+}
+
+void ProgramGL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform1uiv(location, count, v);
+}
+
+void ProgramGL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform2uiv(location, count, v);
+}
+
+void ProgramGL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform3uiv(location, count, v);
+}
+
+void ProgramGL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniform4uiv(location, count, v);
+}
+
+void ProgramGL::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix2fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix3fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix4fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix2x3fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix3x2fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix2x4fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix4x2fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix3x4fv(location, count, transpose, value);
+}
+
+void ProgramGL::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+    mStateManager-&gt;useProgram(mProgramID);
+    mFunctions-&gt;uniformMatrix4x3fv(location, count, transpose, value);
+}
+
+void ProgramGL::getUniformfv(GLint location, GLfloat *params)
+{
+    mFunctions-&gt;getUniformfv(mProgramID, location, params);
+}
+
+void ProgramGL::getUniformiv(GLint location, GLint *params)
+{
+    mFunctions-&gt;getUniformiv(mProgramID, location, params);
+}
+
+void ProgramGL::getUniformuiv(GLint location, GLuint *params)
+{
+    mFunctions-&gt;getUniformuiv(mProgramID, location, params);
+}
+
+GLint ProgramGL::getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &amp;caps) const
+{
+    UNIMPLEMENTED();
+    return GLint();
+}
+
+GLenum ProgramGL::getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const
+{
+    UNIMPLEMENTED();
+    return GLenum();
+}
+
+GLint ProgramGL::getUsedSamplerRange(gl::SamplerType type) const
+{
+    UNIMPLEMENTED();
+    return GLint();
+}
+
+void ProgramGL::updateSamplerMapping()
+{
+    UNIMPLEMENTED();
+}
+
+bool ProgramGL::validateSamplers(gl::InfoLog *infoLog, const gl::Caps &amp;caps)
+{
+    //UNIMPLEMENTED();
+    return true;
+}
+
+LinkResult ProgramGL::compileProgramExecutables(gl::InfoLog &amp;infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                                                int registers)
+{
+    //UNIMPLEMENTED();
+    return LinkResult(true, gl::Error(GL_NO_ERROR));
+}
+
+bool ProgramGL::linkUniforms(gl::InfoLog &amp;infoLog, const gl::Shader &amp;vertexShader, const gl::Shader &amp;fragmentShader,
+                             const gl::Caps &amp;caps)
+{
+    //UNIMPLEMENTED();
+    return true;
+}
+
+bool ProgramGL::defineUniformBlock(gl::InfoLog &amp;infoLog, const gl::Shader &amp;shader, const sh::InterfaceBlock &amp;interfaceBlock,
+                                   const gl::Caps &amp;caps)
+{
+    UNIMPLEMENTED();
+    return bool();
+}
+
+gl::Error ProgramGL::applyUniforms()
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error ProgramGL::applyUniformBuffers(const gl::Data &amp;data, GLuint uniformBlockBindings[])
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+bool ProgramGL::assignUniformBlockRegister(gl::InfoLog &amp;infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
+                                           unsigned int registerIndex, const gl::Caps &amp;caps)
+{
+    UNIMPLEMENTED();
+    return bool();
+}
+
+void ProgramGL::reset()
+{
+    ProgramImpl::reset();
+
+    if (mProgramID)
+    {
+        mFunctions-&gt;deleteProgram(mProgramID);
+        mProgramID = 0;
+    }
+}
+
+GLuint ProgramGL::getProgramID() const
+{
+    return mProgramID;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglProgramGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ProgramGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// ProgramGL.h: Defines the class interface for ProgramGL.
+
+#ifndef LIBANGLE_RENDERER_GL_PROGRAMGL_H_
+#define LIBANGLE_RENDERER_GL_PROGRAMGL_H_
+
+#include &quot;libANGLE/renderer/ProgramImpl.h&quot;
+
+namespace rx
+{
+
+class FunctionsGL;
+class StateManagerGL;
+
+class ProgramGL : public ProgramImpl
+{
+  public:
+    ProgramGL(const FunctionsGL *functions, StateManagerGL *stateManager);
+    ~ProgramGL() override;
+
+    bool usesPointSize() const override;
+    int getShaderVersion() const override;
+    GLenum getTransformFeedbackBufferMode() const override;
+
+    GLenum getBinaryFormat() override;
+    LinkResult load(gl::InfoLog &amp;infoLog, gl::BinaryInputStream *stream) override;
+    gl::Error save(gl::BinaryOutputStream *stream) override;
+
+    LinkResult link(const gl::Data &amp;data, gl::InfoLog &amp;infoLog,
+                    gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                    const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryings,
+                    GLenum transformFeedbackBufferMode,
+                    int *registers, std::vector&lt;gl::LinkedVarying&gt; *linkedVaryings,
+                    std::map&lt;int, gl::VariableLocation&gt; *outputVariables) override;
+
+    void setUniform1fv(GLint location, GLsizei count, const GLfloat *v) override;
+    void setUniform2fv(GLint location, GLsizei count, const GLfloat *v) override;
+    void setUniform3fv(GLint location, GLsizei count, const GLfloat *v) override;
+    void setUniform4fv(GLint location, GLsizei count, const GLfloat *v) override;
+    void setUniform1iv(GLint location, GLsizei count, const GLint *v) override;
+    void setUniform2iv(GLint location, GLsizei count, const GLint *v) override;
+    void setUniform3iv(GLint location, GLsizei count, const GLint *v) override;
+    void setUniform4iv(GLint location, GLsizei count, const GLint *v) override;
+    void setUniform1uiv(GLint location, GLsizei count, const GLuint *v) override;
+    void setUniform2uiv(GLint location, GLsizei count, const GLuint *v) override;
+    void setUniform3uiv(GLint location, GLsizei count, const GLuint *v) override;
+    void setUniform4uiv(GLint location, GLsizei count, const GLuint *v) override;
+    void setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+    void setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) override;
+
+    void getUniformfv(GLint location, GLfloat *params) override;
+    void getUniformiv(GLint location, GLint *params) override;
+    void getUniformuiv(GLint location, GLuint *params) override;
+
+    GLint getSamplerMapping(gl::SamplerType type, unsigned int samplerIndex, const gl::Caps &amp;caps) const override;
+    GLenum getSamplerTextureType(gl::SamplerType type, unsigned int samplerIndex) const override;
+    GLint getUsedSamplerRange(gl::SamplerType type) const override;
+    void updateSamplerMapping() override;
+    bool validateSamplers(gl::InfoLog *infoLog, const gl::Caps &amp;caps) override;
+
+    LinkResult compileProgramExecutables(gl::InfoLog &amp;infoLog, gl::Shader *fragmentShader, gl::Shader *vertexShader,
+                                         int registers) override;
+
+    bool linkUniforms(gl::InfoLog &amp;infoLog, const gl::Shader &amp;vertexShader, const gl::Shader &amp;fragmentShader,
+                      const gl::Caps &amp;caps) override;
+    bool defineUniformBlock(gl::InfoLog &amp;infoLog, const gl::Shader &amp;shader, const sh::InterfaceBlock &amp;interfaceBlock,
+                            const gl::Caps &amp;caps) override;
+
+    gl::Error applyUniforms() override;
+    gl::Error applyUniformBuffers(const gl::Data &amp;data, GLuint uniformBlockBindings[]) override;
+    bool assignUniformBlockRegister(gl::InfoLog &amp;infoLog, gl::UniformBlock *uniformBlock, GLenum shader,
+                                    unsigned int registerIndex, const gl::Caps &amp;caps) override;
+
+    void reset() override;
+
+    GLuint getProgramID() const;
+
+  private:
+    const FunctionsGL *mFunctions;
+    StateManagerGL *mStateManager;
+
+    GLuint mProgramID;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_PROGRAMGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglQueryGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// QueryGL.cpp: Implements the class methods for QueryGL.
+
+#include &quot;libANGLE/renderer/gl/QueryGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+QueryGL::QueryGL(GLenum type)
+    : QueryImpl(type)
+{}
+
+QueryGL::~QueryGL()
+{}
+
+gl::Error QueryGL::begin()
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error QueryGL::end()
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error QueryGL::getResult(GLuint *params)
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+gl::Error QueryGL::isResultAvailable(GLuint *available)
+{
+    UNIMPLEMENTED();
+    return gl::Error(GL_INVALID_OPERATION);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglQueryGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/QueryGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// QueryGL.h: Defines the class interface for QueryGL.
+
+#ifndef LIBANGLE_RENDERER_GL_QUERYGL_H_
+#define LIBANGLE_RENDERER_GL_QUERYGL_H_
+
+#include &quot;libANGLE/renderer/QueryImpl.h&quot;
+
+namespace rx
+{
+
+class QueryGL : public QueryImpl
+{
+  public:
+    QueryGL(GLenum type);
+    ~QueryGL() override;
+
+    gl::Error begin() override;
+    gl::Error end() override;
+    gl::Error getResult(GLuint *params) override;
+    gl::Error isResultAvailable(GLuint *available) override;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_QUERYGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglRenderbufferGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// RenderbufferGL.cpp: Implements the class methods for RenderbufferGL.
+
+#include &quot;libANGLE/renderer/gl/RenderbufferGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+#include &quot;libANGLE/renderer/gl/renderergl_utils.h&quot;
+
+namespace rx
+{
+
+RenderbufferGL::RenderbufferGL(const FunctionsGL *functions, StateManagerGL *stateManager, const gl::TextureCapsMap &amp;textureCaps)
+    : RenderbufferImpl(),
+      mFunctions(functions),
+      mStateManager(stateManager),
+      mTextureCaps(textureCaps),
+      mRenderbufferID(0)
+{
+    mFunctions-&gt;genRenderbuffers(1, &amp;mRenderbufferID);
+}
+
+RenderbufferGL::~RenderbufferGL()
+{
+    if (mRenderbufferID != 0)
+    {
+        mFunctions-&gt;deleteRenderbuffers(1, &amp;mRenderbufferID);
+        mRenderbufferID = 0;
+    }
+}
+
+gl::Error RenderbufferGL::setStorage(GLenum internalformat, size_t width, size_t height)
+{
+    mStateManager-&gt;bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID);
+    mFunctions-&gt;renderbufferStorage(GL_RENDERBUFFER, internalformat, width, height);
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RenderbufferGL::setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height)
+{
+    mStateManager-&gt;bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID);
+    mFunctions-&gt;renderbufferStorageMultisample(GL_RENDERBUFFER, samples, internalformat, width, height);
+
+    const gl::TextureCaps &amp;formatCaps = mTextureCaps.get(internalformat);
+    if (samples &gt; formatCaps.getMaxSamples())
+    {
+        // Before version 4.2, it is unknown if the specific internal format can support the requested number
+        // of samples.  It is expected that GL_OUT_OF_MEMORY is returned if the renderbuffer cannot be created.
+        GLenum error = GL_NO_ERROR;
+        do
+        {
+            error = mFunctions-&gt;getError();
+            if (error == GL_OUT_OF_MEMORY)
+            {
+                return gl::Error(GL_OUT_OF_MEMORY);
+            }
+
+            ASSERT(error == GL_NO_ERROR);
+        } while (error != GL_NO_ERROR);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLuint RenderbufferGL::getRenderbufferID() const
+{
+    return mRenderbufferID;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglRenderbufferGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RenderbufferGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// RenderbufferGL.h: Defines the class interface for RenderbufferGL.
+
+#ifndef LIBANGLE_RENDERER_GL_RENDERBUFFERGL_H_
+#define LIBANGLE_RENDERER_GL_RENDERBUFFERGL_H_
+
+#include &quot;libANGLE/renderer/RenderbufferImpl.h&quot;
+
+namespace gl
+{
+class TextureCapsMap;
+}
+
+namespace rx
+{
+
+class FunctionsGL;
+class StateManagerGL;
+
+class RenderbufferGL : public RenderbufferImpl
+{
+  public:
+    RenderbufferGL(const FunctionsGL *functions, StateManagerGL *stateManager, const gl::TextureCapsMap &amp;textureCaps);
+    ~RenderbufferGL() override;
+
+    virtual gl::Error setStorage(GLenum internalformat, size_t width, size_t height) override;
+    virtual gl::Error setStorageMultisample(size_t samples, GLenum internalformat, size_t width, size_t height) override;
+
+    GLuint getRenderbufferID() const;
+
+    gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                        FramebufferAttachmentRenderTarget **rtOut) override
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Not supported on OpenGL&quot;);
+    }
+
+  private:
+    const FunctionsGL *mFunctions;
+    StateManagerGL *mStateManager;
+    const gl::TextureCapsMap &amp;mTextureCaps;
+
+    GLuint mRenderbufferID;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_RENDERBUFFERGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglRendererGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,221 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// RendererGL.cpp: Implements the class methods for RendererGL.
+
+#include &quot;libANGLE/renderer/gl/RendererGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/renderer/gl/BufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/CompilerGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FenceNVGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FenceSyncGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FramebufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/ProgramGL.h&quot;
+#include &quot;libANGLE/renderer/gl/QueryGL.h&quot;
+#include &quot;libANGLE/renderer/gl/RenderbufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/ShaderGL.h&quot;
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+#include &quot;libANGLE/renderer/gl/SurfaceGL.h&quot;
+#include &quot;libANGLE/renderer/gl/TextureGL.h&quot;
+#include &quot;libANGLE/renderer/gl/TransformFeedbackGL.h&quot;
+#include &quot;libANGLE/renderer/gl/VertexArrayGL.h&quot;
+#include &quot;libANGLE/renderer/gl/renderergl_utils.h&quot;
+
+namespace rx
+{
+
+RendererGL::RendererGL(const FunctionsGL *functions)
+    : Renderer(),
+      mFunctions(functions),
+      mStateManager(nullptr)
+{
+    ASSERT(mFunctions);
+    mStateManager = new StateManagerGL(mFunctions, getRendererCaps());
+}
+
+RendererGL::~RendererGL()
+{
+    SafeDelete(mStateManager);
+}
+
+gl::Error RendererGL::flush()
+{
+    mFunctions-&gt;flush();
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RendererGL::finish()
+{
+    mFunctions-&gt;finish();
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RendererGL::drawArrays(const gl::Data &amp;data, GLenum mode,
+                                 GLint first, GLsizei count, GLsizei instances)
+{
+    gl::Error error = mStateManager-&gt;setDrawArraysState(data, first, count);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mFunctions-&gt;drawArrays(mode, first, count);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error RendererGL::drawElements(const gl::Data &amp;data, GLenum mode, GLsizei count, GLenum type,
+                                   const GLvoid *indices, GLsizei instances,
+                                   const RangeUI &amp;indexRange)
+{
+    if (instances &gt; 0)
+    {
+        UNIMPLEMENTED();
+    }
+
+    const GLvoid *drawIndexPointer = nullptr;
+    gl::Error error = mStateManager-&gt;setDrawElementsState(data, count, type, indices, &amp;drawIndexPointer);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    mFunctions-&gt;drawElements(mode, count, type, drawIndexPointer);
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+CompilerImpl *RendererGL::createCompiler(const gl::Data &amp;data)
+{
+    return new CompilerGL(data);
+}
+
+ShaderImpl *RendererGL::createShader(GLenum type)
+{
+    return new ShaderGL(type, mFunctions);
+}
+
+ProgramImpl *RendererGL::createProgram()
+{
+    return new ProgramGL(mFunctions, mStateManager);
+}
+
+FramebufferImpl *RendererGL::createDefaultFramebuffer(const gl::Framebuffer::Data &amp;data)
+{
+    return new FramebufferGL(data, mFunctions, mStateManager, true);
+}
+
+FramebufferImpl *RendererGL::createFramebuffer(const gl::Framebuffer::Data &amp;data)
+{
+    return new FramebufferGL(data, mFunctions, mStateManager, false);
+}
+
+TextureImpl *RendererGL::createTexture(GLenum target)
+{
+    return new TextureGL(target, mFunctions, mStateManager);
+}
+
+RenderbufferImpl *RendererGL::createRenderbuffer()
+{
+    return new RenderbufferGL(mFunctions, mStateManager, getRendererTextureCaps());
+}
+
+BufferImpl *RendererGL::createBuffer()
+{
+    return new BufferGL(mFunctions, mStateManager);
+}
+
+VertexArrayImpl *RendererGL::createVertexArray()
+{
+    return new VertexArrayGL(mFunctions, mStateManager);
+}
+
+QueryImpl *RendererGL::createQuery(GLenum type)
+{
+    return new QueryGL(type);
+}
+
+FenceNVImpl *RendererGL::createFenceNV()
+{
+    return new FenceNVGL(mFunctions);
+}
+
+FenceSyncImpl *RendererGL::createFenceSync()
+{
+    return new FenceSyncGL(mFunctions);
+}
+
+TransformFeedbackImpl *RendererGL::createTransformFeedback()
+{
+    return new TransformFeedbackGL();
+}
+
+void RendererGL::notifyDeviceLost()
+{
+    UNIMPLEMENTED();
+}
+
+bool RendererGL::isDeviceLost() const
+{
+    UNIMPLEMENTED();
+    return bool();
+}
+
+bool RendererGL::testDeviceLost()
+{
+    UNIMPLEMENTED();
+    return bool();
+}
+
+bool RendererGL::testDeviceResettable()
+{
+    UNIMPLEMENTED();
+    return bool();
+}
+
+VendorID RendererGL::getVendorId() const
+{
+    UNIMPLEMENTED();
+    return VendorID();
+}
+
+std::string RendererGL::getVendorString() const
+{
+    return std::string(reinterpret_cast&lt;const char*&gt;(mFunctions-&gt;getString(GL_VENDOR)));
+}
+
+std::string RendererGL::getRendererDescription() const
+{
+    std::string nativeVendorString(reinterpret_cast&lt;const char*&gt;(mFunctions-&gt;getString(GL_VENDOR)));
+    std::string nativeRendererString(reinterpret_cast&lt;const char*&gt;(mFunctions-&gt;getString(GL_RENDERER)));
+
+    std::ostringstream rendererString;
+    rendererString &lt;&lt; nativeVendorString &lt;&lt; &quot; &quot; &lt;&lt; nativeRendererString &lt;&lt; &quot; OpenGL&quot;;
+    if (mFunctions-&gt;openGLES)
+    {
+        rendererString &lt;&lt; &quot; ES&quot;;
+    }
+    rendererString &lt;&lt; &quot; &quot; &lt;&lt; mFunctions-&gt;majorVersion &lt;&lt; &quot;.&quot; &lt;&lt; mFunctions-&gt;minorVersion;
+
+    return rendererString.str();
+}
+
+void RendererGL::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps, gl::Extensions *outExtensions) const
+{
+    nativegl_gl::GenerateCaps(mFunctions, outCaps, outTextureCaps, outExtensions);
+}
+
+Workarounds RendererGL::generateWorkarounds() const
+{
+    Workarounds workarounds;
+    return workarounds;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglRendererGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/RendererGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// RendererGL.h: Defines the class interface for RendererGL.
+
+#ifndef LIBANGLE_RENDERER_GL_RENDERERGL_H_
+#define LIBANGLE_RENDERER_GL_RENDERERGL_H_
+
+#include &quot;libANGLE/renderer/Renderer.h&quot;
+
+namespace rx
+{
+class FunctionsGL;
+class StateManagerGL;
+
+class RendererGL : public Renderer
+{
+  public:
+    RendererGL(const FunctionsGL *functions);
+    ~RendererGL() override;
+
+    gl::Error flush() override;
+    gl::Error finish() override;
+
+    gl::Error drawArrays(const gl::Data &amp;data, GLenum mode,
+                         GLint first, GLsizei count, GLsizei instances) override;
+    gl::Error drawElements(const gl::Data &amp;data, GLenum mode, GLsizei count, GLenum type,
+                           const GLvoid *indices, GLsizei instances,
+                           const RangeUI &amp;indexRange) override;
+
+    // Shader creation
+    CompilerImpl *createCompiler(const gl::Data &amp;data) override;
+    ShaderImpl *createShader(GLenum type) override;
+    ProgramImpl *createProgram() override;
+
+    // Framebuffer creation
+    FramebufferImpl *createDefaultFramebuffer(const gl::Framebuffer::Data &amp;data) override;
+    FramebufferImpl *createFramebuffer(const gl::Framebuffer::Data &amp;data) override;
+
+    // Texture creation
+    TextureImpl *createTexture(GLenum target) override;
+
+    // Renderbuffer creation
+    RenderbufferImpl *createRenderbuffer() override;
+
+    // Buffer creation
+    BufferImpl *createBuffer() override;
+
+    // Vertex Array creation
+    VertexArrayImpl *createVertexArray() override;
+
+    // Query and Fence creation
+    QueryImpl *createQuery(GLenum type) override;
+    FenceNVImpl *createFenceNV() override;
+    FenceSyncImpl *createFenceSync() override;
+
+    // Transform Feedback creation
+    TransformFeedbackImpl *createTransformFeedback() override;
+
+    // lost device
+    void notifyDeviceLost() override;
+    bool isDeviceLost() const override;
+    bool testDeviceLost() override;
+    bool testDeviceResettable() override;
+
+    VendorID getVendorId() const override;
+    std::string getVendorString() const override;
+    std::string getRendererDescription() const override;
+
+  private:
+    void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap* outTextureCaps, gl::Extensions *outExtensions) const override;
+    Workarounds generateWorkarounds() const override;
+
+    const FunctionsGL *mFunctions;
+    StateManagerGL *mStateManager;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_RENDERERGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglShaderGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,151 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// ShaderGL.cpp: Implements the class methods for ShaderGL.
+
+#include &quot;libANGLE/renderer/gl/ShaderGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Compiler.h&quot;
+#include &quot;libANGLE/renderer/gl/CompilerGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+
+template &lt;typename VarT&gt;
+static std::vector&lt;VarT&gt; GetFilteredShaderVariables(const std::vector&lt;VarT&gt; *variableList)
+{
+    ASSERT(variableList);
+    std::vector&lt;VarT&gt; result;
+    for (size_t varIndex = 0; varIndex &lt; variableList-&gt;size(); varIndex++)
+    {
+        const VarT &amp;var = variableList-&gt;at(varIndex);
+        if (var.staticUse)
+        {
+            result.push_back(var);
+        }
+    }
+    return result;
+}
+
+template &lt;typename VarT&gt;
+static const std::vector&lt;VarT&gt; &amp;GetShaderVariables(const std::vector&lt;VarT&gt; *variableList)
+{
+    ASSERT(variableList);
+    return *variableList;
+}
+
+namespace rx
+{
+
+ShaderGL::ShaderGL(GLenum type, const FunctionsGL *functions)
+    : ShaderImpl(),
+      mFunctions(functions),
+      mType(type),
+      mShaderID(0)
+{
+    ASSERT(mFunctions);
+}
+
+ShaderGL::~ShaderGL()
+{
+    if (mShaderID != 0)
+    {
+        mFunctions-&gt;deleteShader(mShaderID);
+        mShaderID = 0;
+    }
+}
+
+bool ShaderGL::compile(gl::Compiler *compiler, const std::string &amp;source)
+{
+    // Reset the previous state
+    mActiveAttributes.clear();
+    mVaryings.clear();
+    mUniforms.clear();
+    mInterfaceBlocks.clear();
+    mActiveOutputVariables.clear();
+    if (mShaderID != 0)
+    {
+        mFunctions-&gt;deleteShader(mShaderID);
+        mShaderID = 0;
+    }
+
+    // Translate the ESSL into GLSL
+    CompilerGL *compilerGL = GetImplAs&lt;CompilerGL&gt;(compiler);
+    ShHandle compilerHandle = compilerGL-&gt;getCompilerHandle(mType);
+
+    int compileOptions = (SH_OBJECT_CODE | SH_VARIABLES);
+    const char* sourceCString = source.c_str();
+    if (!ShCompile(compilerHandle, &amp;sourceCString, 1, compileOptions))
+    {
+        mInfoLog = ShGetInfoLog(compilerHandle);
+        TRACE(&quot;\n%s&quot;, mInfoLog.c_str());
+        return false;
+    }
+
+    mTranslatedSource = ShGetObjectCode(compilerHandle);
+    const char* translatedSourceCString = mTranslatedSource.c_str();
+
+    // Generate a shader object and set the source
+    mShaderID = mFunctions-&gt;createShader(mType);
+    mFunctions-&gt;shaderSource(mShaderID, 1, &amp;translatedSourceCString, nullptr);
+    mFunctions-&gt;compileShader(mShaderID);
+
+    // Check for compile errors from the native driver
+    GLint compileStatus = GL_FALSE;
+    mFunctions-&gt;getShaderiv(mShaderID, GL_COMPILE_STATUS, &amp;compileStatus);
+    ASSERT(compileStatus == GL_TRUE);
+    if (compileStatus == GL_FALSE)
+    {
+        // Compilation failed, put the error into the info log
+        GLint infoLogLength = 0;
+        mFunctions-&gt;getShaderiv(mShaderID, GL_INFO_LOG_LENGTH, &amp;infoLogLength);
+
+        std::vector&lt;char&gt; buf(infoLogLength);
+        mFunctions-&gt;getShaderInfoLog(mShaderID, infoLogLength, nullptr, &amp;buf[0]);
+
+        mFunctions-&gt;deleteShader(mShaderID);
+        mShaderID = 0;
+
+        mInfoLog = &amp;buf[0];
+        TRACE(&quot;\n%s&quot;, mInfoLog.c_str());
+        return false;
+    }
+
+    // Gather the shader information
+    // TODO: refactor this out, gathering of the attributes, varyings and outputs should be done
+    // at the gl::Shader level
+    if (mType == GL_VERTEX_SHADER)
+    {
+        mActiveAttributes = GetFilteredShaderVariables(ShGetAttributes(compilerHandle));
+    }
+
+    const std::vector&lt;sh::Varying&gt; &amp;varyings = GetShaderVariables(ShGetVaryings(compilerHandle));
+    for (size_t varyingIndex = 0; varyingIndex &lt; varyings.size(); varyingIndex++)
+    {
+        mVaryings.push_back(gl::PackedVarying(varyings[varyingIndex]));
+    }
+
+    mUniforms = GetShaderVariables(ShGetUniforms(compilerHandle));
+    mInterfaceBlocks = GetShaderVariables(ShGetInterfaceBlocks(compilerHandle));
+
+    if (mType == GL_FRAGMENT_SHADER)
+    {
+        mActiveOutputVariables = GetFilteredShaderVariables(ShGetOutputVariables(compilerHandle));
+    }
+
+    return true;
+}
+
+std::string ShaderGL::getDebugInfo() const
+{
+    return std::string();
+}
+
+GLuint ShaderGL::getShaderID() const
+{
+    return mShaderID;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglShaderGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/ShaderGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// ShaderGL.h: Defines the class interface for ShaderGL.
+
+#ifndef LIBANGLE_RENDERER_GL_SHADERGL_H_
+#define LIBANGLE_RENDERER_GL_SHADERGL_H_
+
+#include &quot;libANGLE/renderer/ShaderImpl.h&quot;
+
+namespace rx
+{
+
+class FunctionsGL;
+
+class ShaderGL : public ShaderImpl
+{
+  public:
+    ShaderGL(GLenum type, const FunctionsGL *functions);
+    ~ShaderGL() override;
+
+    bool compile(gl::Compiler *compiler, const std::string &amp;source) override;
+    std::string getDebugInfo() const override;
+
+    GLuint getShaderID() const;
+
+  private:
+    const FunctionsGL *mFunctions;
+
+    GLenum mType;
+    GLuint mShaderID;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_SHADERGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglStateManagerGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,780 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// StateManagerGL.h: Defines a class for caching applied OpenGL state
+
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+
+#include &quot;libANGLE/Data.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/renderer/gl/FramebufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/ProgramGL.h&quot;
+#include &quot;libANGLE/renderer/gl/TextureGL.h&quot;
+#include &quot;libANGLE/renderer/gl/VertexArrayGL.h&quot;
+
+namespace rx
+{
+
+StateManagerGL::StateManagerGL(const FunctionsGL *functions, const gl::Caps &amp;rendererCaps)
+    : mFunctions(functions),
+      mProgram(0),
+      mVAO(0),
+      mBuffers(),
+      mTextureUnitIndex(0),
+      mTextures(),
+      mUnpackAlignment(4),
+      mUnpackRowLength(0),
+      mFramebuffers(),
+      mRenderbuffer(0),
+      mScissorTestEnabled(false),
+      mScissor(0, 0, 0, 0),
+      mViewport(0, 0, 0, 0),
+      mNear(0.0f),
+      mFar(1.0f),
+      mBlendEnabled(false),
+      mBlendColor(0, 0, 0, 0),
+      mSourceBlendRGB(GL_ONE),
+      mDestBlendRGB(GL_ZERO),
+      mSourceBlendAlpha(GL_ONE),
+      mDestBlendAlpha(GL_ZERO),
+      mBlendEquationRGB(GL_FUNC_ADD),
+      mBlendEquationAlpha(GL_FUNC_ADD),
+      mColorMaskRed(true),
+      mColorMaskGreen(true),
+      mColorMaskBlue(true),
+      mColorMaskAlpha(true),
+      mSampleAlphaToCoverageEnabled(false),
+      mSampleCoverageEnabled(false),
+      mSampleCoverageValue(1.0f),
+      mSampleCoverageInvert(false),
+      mDepthTestEnabled(false),
+      mDepthFunc(GL_LESS),
+      mDepthMask(true),
+      mStencilTestEnabled(false),
+      mStencilFrontFunc(GL_ALWAYS),
+      mStencilFrontValueMask(static_cast&lt;GLuint&gt;(-1)),
+      mStencilFrontStencilFailOp(GL_KEEP),
+      mStencilFrontStencilPassDepthFailOp(GL_KEEP),
+      mStencilFrontStencilPassDepthPassOp(GL_KEEP),
+      mStencilFrontWritemask(static_cast&lt;GLuint&gt;(-1)),
+      mStencilBackFunc(GL_ALWAYS),
+      mStencilBackValueMask(static_cast&lt;GLuint&gt;(-1)),
+      mStencilBackStencilFailOp(GL_KEEP),
+      mStencilBackStencilPassDepthFailOp(GL_KEEP),
+      mStencilBackStencilPassDepthPassOp(GL_KEEP),
+      mStencilBackWritemask(static_cast&lt;GLuint&gt;(-1)),
+      mCullFaceEnabled(false),
+      mCullFace(GL_BACK),
+      mFrontFace(GL_CCW),
+      mPolygonOffsetFillEnabled(false),
+      mPolygonOffsetFactor(0.0f),
+      mPolygonOffsetUnits(0.0f),
+      mMultisampleEnabled(true),
+      mRasterizerDiscardEnabled(false),
+      mLineWidth(1.0f),
+      mPrimitiveRestartEnabled(false),
+      mClearColor(0.0f, 0.0f, 0.0f, 0.0f),
+      mClearDepth(1.0f),
+      mClearStencil(0)
+{
+    ASSERT(mFunctions);
+
+    mTextures[GL_TEXTURE_2D].resize(rendererCaps.maxCombinedTextureImageUnits);
+    mTextures[GL_TEXTURE_CUBE_MAP].resize(rendererCaps.maxCombinedTextureImageUnits);
+    mTextures[GL_TEXTURE_2D_ARRAY].resize(rendererCaps.maxCombinedTextureImageUnits);
+    mTextures[GL_TEXTURE_3D].resize(rendererCaps.maxCombinedTextureImageUnits);
+
+    mFramebuffers[GL_READ_FRAMEBUFFER] = 0;
+    mFramebuffers[GL_DRAW_FRAMEBUFFER] = 0;
+}
+
+void StateManagerGL::useProgram(GLuint program)
+{
+    if (mProgram != program)
+    {
+        mProgram = program;
+        mFunctions-&gt;useProgram(mProgram);
+    }
+}
+
+void StateManagerGL::bindVertexArray(GLuint vao)
+{
+    if (mVAO != vao)
+    {
+        mVAO = vao;
+        mFunctions-&gt;bindVertexArray(vao);
+    }
+}
+
+void StateManagerGL::bindBuffer(GLenum type, GLuint buffer)
+{
+    if (mBuffers[type] != buffer)
+    {
+        mBuffers[type] = buffer;
+        mFunctions-&gt;bindBuffer(type, buffer);
+    }
+}
+
+void StateManagerGL::activeTexture(size_t unit)
+{
+    if (mTextureUnitIndex != unit)
+    {
+        mTextureUnitIndex = unit;
+        mFunctions-&gt;activeTexture(GL_TEXTURE0 + mTextureUnitIndex);
+    }
+}
+
+void StateManagerGL::bindTexture(GLenum type, GLuint texture)
+{
+    if (mTextures[type][mTextureUnitIndex] != texture)
+    {
+        mTextures[type][mTextureUnitIndex] = texture;
+        mFunctions-&gt;bindTexture(type, texture);
+    }
+}
+
+void StateManagerGL::setPixelUnpackState(GLint alignment, GLint rowLength)
+{
+    if (mUnpackAlignment != alignment)
+    {
+        mUnpackAlignment = alignment;
+        mFunctions-&gt;pixelStorei(GL_UNPACK_ALIGNMENT, mUnpackAlignment);
+    }
+
+    if (mUnpackRowLength != rowLength)
+    {
+        mUnpackRowLength = rowLength;
+        mFunctions-&gt;pixelStorei(GL_UNPACK_ROW_LENGTH, mUnpackRowLength);
+    }
+}
+
+void StateManagerGL::bindFramebuffer(GLenum type, GLuint framebuffer)
+{
+    if (type == GL_FRAMEBUFFER)
+    {
+        if (mFramebuffers[GL_READ_FRAMEBUFFER] != framebuffer ||
+            mFramebuffers[GL_DRAW_FRAMEBUFFER] != framebuffer)
+        {
+            mFramebuffers[GL_READ_FRAMEBUFFER] = framebuffer;
+            mFramebuffers[GL_DRAW_FRAMEBUFFER] = framebuffer;
+            mFunctions-&gt;bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
+        }
+    }
+    else
+    {
+        if (mFramebuffers[type] != framebuffer)
+        {
+            mFramebuffers[type] = framebuffer;
+            mFunctions-&gt;bindFramebuffer(type, framebuffer);
+        }
+    }
+}
+
+void StateManagerGL::bindRenderbuffer(GLenum type, GLuint renderbuffer)
+{
+    ASSERT(type == GL_RENDERBUFFER);
+    if (mRenderbuffer != renderbuffer)
+    {
+        mRenderbuffer = renderbuffer;
+        mFunctions-&gt;bindRenderbuffer(type, mRenderbuffer);
+    }
+}
+
+void StateManagerGL::setClearState(const gl::State &amp;state, GLbitfield mask)
+{
+    // Only apply the state required to do a clear
+    const gl::RasterizerState &amp;rasterizerState = state.getRasterizerState();
+    setRasterizerDiscardEnabled(rasterizerState.rasterizerDiscard);
+    if (!rasterizerState.rasterizerDiscard)
+    {
+        setScissor(state.getScissor());
+        setViewport(state.getViewport());
+
+        if ((mask &amp; GL_COLOR_BUFFER_BIT) != 0)
+        {
+            setClearColor(state.getColorClearValue());
+
+            const gl::BlendState &amp;blendState = state.getBlendState();
+            setColorMask(blendState.colorMaskRed, blendState.colorMaskGreen, blendState.colorMaskBlue, blendState.colorMaskAlpha);
+        }
+
+        if ((mask &amp; GL_DEPTH_BUFFER_BIT) != 0)
+        {
+            setClearDepth(state.getDepthClearValue());
+            setDepthMask(state.getDepthStencilState().depthMask);
+        }
+
+        if ((mask &amp; GL_STENCIL_BUFFER_BIT) != 0)
+        {
+            setClearStencil(state.getStencilClearValue());
+            setStencilFrontWritemask(state.getDepthStencilState().stencilWritemask);
+            setStencilBackWritemask(state.getDepthStencilState().stencilBackWritemask);
+        }
+    }
+}
+
+gl::Error StateManagerGL::setDrawArraysState(const gl::Data &amp;data, GLint first, GLsizei count)
+{
+    const gl::State &amp;state = *data.state;
+
+    const gl::VertexArray *vao = state.getVertexArray();
+    const VertexArrayGL *vaoGL = GetImplAs&lt;VertexArrayGL&gt;(vao);
+    vaoGL-&gt;syncDrawArraysState(first, count);
+    bindVertexArray(vaoGL-&gt;getVertexArrayID());
+
+    return setGenericDrawState(data);
+}
+
+gl::Error StateManagerGL::setDrawElementsState(const gl::Data &amp;data, GLsizei count, GLenum type, const GLvoid *indices,
+                                               const GLvoid **outIndices)
+{
+    const gl::State &amp;state = *data.state;
+
+    const gl::VertexArray *vao = state.getVertexArray();
+    const VertexArrayGL *vaoGL = GetImplAs&lt;VertexArrayGL&gt;(vao);
+
+    gl::Error error = vaoGL-&gt;syncDrawElementsState(count, type, indices, outIndices);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    bindVertexArray(vaoGL-&gt;getVertexArrayID());
+
+    return setGenericDrawState(data);
+}
+
+gl::Error StateManagerGL::setGenericDrawState(const gl::Data &amp;data)
+{
+    const gl::State &amp;state = *data.state;
+    const gl::Caps &amp;caps = *data.caps;
+
+    const gl::Program *program = state.getProgram();
+    const ProgramGL *programGL = GetImplAs&lt;ProgramGL&gt;(program);
+    useProgram(programGL-&gt;getProgramID());
+
+    // TODO: Only apply textures referenced by the program.
+    for (auto textureTypeIter = mTextures.begin(); textureTypeIter != mTextures.end(); textureTypeIter++)
+    {
+        GLenum textureType = textureTypeIter-&gt;first;
+
+        // Determine if this texture type can exist in the source context
+        bool validTextureType = (textureType == GL_TEXTURE_2D || textureType == GL_TEXTURE_CUBE_MAP ||
+                                 (textureType == GL_TEXTURE_2D_ARRAY &amp;&amp; data.clientVersion &gt;= 3) ||
+                                 (textureType == GL_TEXTURE_3D &amp;&amp; data.clientVersion &gt;= 3));
+
+        const std::vector&lt;GLuint&gt; &amp;textureVector = textureTypeIter-&gt;second;
+        for (size_t textureUnitIndex = 0; textureUnitIndex &lt; textureVector.size(); textureUnitIndex++)
+        {
+            const gl::Texture *texture = nullptr;
+
+            bool validTextureUnit = textureUnitIndex &lt; caps.maxCombinedTextureImageUnits;
+            if (validTextureType &amp;&amp; validTextureUnit)
+            {
+                texture = state.getSamplerTexture(textureUnitIndex, textureType);
+            }
+
+            if (texture != nullptr)
+            {
+                const TextureGL *textureGL = GetImplAs&lt;TextureGL&gt;(texture);
+                textureGL-&gt;syncSamplerState(texture-&gt;getSamplerState());
+
+                if (mTextures[textureType][textureUnitIndex] != textureGL-&gt;getTextureID())
+                {
+                    activeTexture(textureUnitIndex);
+                    bindTexture(textureType, textureGL-&gt;getTextureID());
+                }
+
+                // TODO: apply sampler object if one is bound
+            }
+            else
+            {
+                if (mTextures[textureType][textureUnitIndex] != 0)
+                {
+                    activeTexture(textureUnitIndex);
+                    bindTexture(textureType, 0);
+                }
+            }
+        }
+    }
+
+    const gl::Framebuffer *framebuffer = state.getDrawFramebuffer();
+    const FramebufferGL *framebufferGL = GetImplAs&lt;FramebufferGL&gt;(framebuffer);
+    bindFramebuffer(GL_DRAW_FRAMEBUFFER, framebufferGL-&gt;getFramebufferID());
+
+    setScissorTestEnabled(state.isScissorTestEnabled());
+    if (state.isScissorTestEnabled())
+    {
+        setScissor(state.getScissor());
+    }
+
+    setViewport(state.getViewport());
+    setDepthRange(state.getNearPlane(), state.getFarPlane());
+
+    const gl::BlendState &amp;blendState = state.getBlendState();
+    setBlendEnabled(blendState.blend);
+    if (blendState.blend)
+    {
+        setBlendColor(state.getBlendColor());
+        setBlendFuncs(blendState.sourceBlendRGB, blendState.destBlendRGB, blendState.sourceBlendAlpha, blendState.destBlendAlpha);
+        setBlendEquations(blendState.blendEquationRGB, blendState.blendEquationAlpha);
+        setColorMask(blendState.colorMaskRed, blendState.colorMaskGreen, blendState.colorMaskBlue, blendState.colorMaskAlpha);
+    }
+    setSampleAlphaToCoverageEnabled(blendState.sampleAlphaToCoverage);
+    setSampleCoverageEnabled(state.isSampleCoverageEnabled());
+    setSampleCoverage(state.getSampleCoverageValue(), state.getSampleCoverageInvert());
+
+    const gl::DepthStencilState &amp;depthStencilState = state.getDepthStencilState();
+    setDepthTestEnabled(depthStencilState.depthTest);
+    if (depthStencilState.depthTest)
+    {
+        setDepthFunc(depthStencilState.depthFunc);
+        setDepthMask(depthStencilState.depthMask);
+    }
+
+    setStencilTestEnabled(depthStencilState.stencilTest);
+    if (depthStencilState.stencilTest)
+    {
+        setStencilFrontWritemask(state.getDepthStencilState().stencilWritemask);
+        setStencilBackWritemask(state.getDepthStencilState().stencilBackWritemask);
+        setStencilFrontFuncs(depthStencilState.stencilFunc, state.getStencilRef(), depthStencilState.stencilMask);
+        setStencilBackFuncs(depthStencilState.stencilBackFunc, state.getStencilBackRef(), depthStencilState.stencilBackMask);
+        setStencilFrontOps(depthStencilState.stencilFail, depthStencilState.stencilPassDepthFail, depthStencilState.stencilPassDepthPass);
+        setStencilBackOps(depthStencilState.stencilBackFail, depthStencilState.stencilBackPassDepthFail, depthStencilState.stencilBackPassDepthPass);
+    }
+
+    const gl::RasterizerState &amp;rasterizerState = state.getRasterizerState();
+    setCullFaceEnabled(rasterizerState.cullFace);
+    if (rasterizerState.cullFace)
+    {
+        setCullFace(rasterizerState.cullMode);
+        setFrontFace(rasterizerState.frontFace);
+    }
+
+    setPolygonOffsetFillEnabled(rasterizerState.polygonOffsetFill);
+    if (rasterizerState.polygonOffsetFill)
+    {
+        setPolygonOffset(rasterizerState.polygonOffsetFactor, rasterizerState.polygonOffsetUnits);
+    }
+
+    setMultisampleEnabled(rasterizerState.multiSample);
+    setRasterizerDiscardEnabled(rasterizerState.rasterizerDiscard);
+    setLineWidth(state.getLineWidth());
+
+    setPrimitiveRestartEnabled(state.isPrimitiveRestartEnabled());
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+void StateManagerGL::setScissorTestEnabled(bool enabled)
+{
+    if (mScissorTestEnabled != enabled)
+    {
+        mScissorTestEnabled = enabled;
+        if (mScissorTestEnabled)
+        {
+            mFunctions-&gt;enable(GL_SCISSOR_TEST);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_SCISSOR_TEST);
+        }
+    }
+}
+
+void StateManagerGL::setScissor(const gl::Rectangle &amp;scissor)
+{
+    if (scissor != mScissor)
+    {
+        mScissor = scissor;
+        mFunctions-&gt;scissor(mScissor.x, mScissor.y, mScissor.width, mScissor.height);
+    }
+}
+
+void StateManagerGL::setViewport(const gl::Rectangle &amp;viewport)
+{
+    if (viewport != mViewport)
+    {
+        mViewport = viewport;
+        mFunctions-&gt;viewport(mViewport.x, mViewport.y, mViewport.width, mViewport.height);
+    }
+}
+
+void StateManagerGL::setDepthRange(float near, float far)
+{
+    if (mNear != near || mFar != far)
+    {
+        mNear = near;
+        mFar = far;
+        mFunctions-&gt;depthRange(mNear, mFar);
+    }
+}
+
+void StateManagerGL::setBlendEnabled(bool enabled)
+{
+    if (mBlendEnabled != enabled)
+    {
+        mBlendEnabled = enabled;
+        if (mBlendEnabled)
+        {
+            mFunctions-&gt;enable(GL_BLEND);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_BLEND);
+        }
+    }
+}
+
+void StateManagerGL::setBlendColor(const gl::ColorF &amp;blendColor)
+{
+    if (mBlendColor != blendColor)
+    {
+        mBlendColor = blendColor;
+        mFunctions-&gt;blendColor(mBlendColor.red, mBlendColor.green, mBlendColor.blue, mBlendColor.alpha);
+    }
+}
+
+void StateManagerGL::setBlendFuncs(GLenum sourceBlendRGB, GLenum destBlendRGB, GLenum sourceBlendAlpha,
+                                   GLenum destBlendAlpha)
+{
+    if (mSourceBlendRGB != sourceBlendRGB || mDestBlendRGB != destBlendRGB ||
+        mSourceBlendAlpha != sourceBlendAlpha || mDestBlendAlpha != destBlendAlpha)
+    {
+        mSourceBlendRGB = sourceBlendRGB;
+        mDestBlendRGB = destBlendRGB;
+        mSourceBlendAlpha = sourceBlendAlpha;
+        mDestBlendAlpha = destBlendAlpha;
+
+        mFunctions-&gt;blendFuncSeparate(mSourceBlendRGB, mDestBlendRGB, mSourceBlendAlpha, mDestBlendAlpha);
+    }
+}
+
+void StateManagerGL::setBlendEquations(GLenum blendEquationRGB, GLenum blendEquationAlpha)
+{
+    if (mBlendEquationRGB != blendEquationRGB || mBlendEquationAlpha != blendEquationAlpha)
+    {
+        mBlendEquationRGB = blendEquationRGB;
+        mBlendEquationAlpha = mDestBlendAlpha;
+
+        mFunctions-&gt;blendEquationSeparate(mBlendEquationRGB, mBlendEquationAlpha);
+    }
+}
+
+void StateManagerGL::setColorMask(bool red, bool green, bool blue, bool alpha)
+{
+    if (mColorMaskRed != red || mColorMaskGreen != green || mColorMaskBlue != blue || mColorMaskAlpha != alpha)
+    {
+        mColorMaskRed = red;
+        mColorMaskGreen = green;
+        mColorMaskBlue = blue;
+        mColorMaskAlpha = alpha;
+        mFunctions-&gt;colorMask(mColorMaskRed, mColorMaskGreen, mColorMaskBlue, mColorMaskAlpha);
+    }
+}
+
+void StateManagerGL::setSampleAlphaToCoverageEnabled(bool enabled)
+{
+    if (mSampleAlphaToCoverageEnabled != enabled)
+    {
+        mSampleAlphaToCoverageEnabled = enabled;
+        if (mSampleAlphaToCoverageEnabled)
+        {
+            mFunctions-&gt;enable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+        }
+    }
+}
+
+void StateManagerGL::setSampleCoverageEnabled(bool enabled)
+{
+    if (mSampleCoverageEnabled != enabled)
+    {
+        mSampleCoverageEnabled = enabled;
+        if (mSampleCoverageEnabled)
+        {
+            mFunctions-&gt;enable(GL_SAMPLE_COVERAGE);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_SAMPLE_COVERAGE);
+        }
+    }
+}
+
+void StateManagerGL::setSampleCoverage(float value, bool invert)
+{
+    if (mSampleCoverageValue != value || mSampleCoverageInvert != invert)
+    {
+        mSampleCoverageValue = value;
+        mSampleCoverageInvert = invert;
+        mFunctions-&gt;sampleCoverage(mSampleCoverageValue, mSampleCoverageInvert);
+    }
+}
+
+void StateManagerGL::setDepthTestEnabled(bool enabled)
+{
+    if (mDepthTestEnabled != enabled)
+    {
+        mDepthTestEnabled = enabled;
+        if (mDepthTestEnabled)
+        {
+            mFunctions-&gt;enable(GL_DEPTH_TEST);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_DEPTH_TEST);
+        }
+    }
+}
+
+void StateManagerGL::setDepthFunc(GLenum depthFunc)
+{
+    if (mDepthFunc != depthFunc)
+    {
+        mDepthFunc = depthFunc;
+        mFunctions-&gt;depthFunc(mDepthFunc);
+    }
+}
+
+void StateManagerGL::setDepthMask(bool mask)
+{
+    if (mDepthMask != mask)
+    {
+        mDepthMask = mask;
+        mFunctions-&gt;depthMask(mDepthMask);
+    }
+}
+
+void StateManagerGL::setStencilTestEnabled(bool enabled)
+{
+    if (mStencilTestEnabled != enabled)
+    {
+        mStencilTestEnabled = enabled;
+        if (mStencilTestEnabled)
+        {
+            mFunctions-&gt;enable(GL_STENCIL_TEST);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_STENCIL_TEST);
+        }
+    }
+}
+
+void StateManagerGL::setStencilFrontWritemask(GLuint mask)
+{
+    if (mStencilFrontWritemask != mask)
+    {
+        mStencilFrontWritemask = mask;
+        mFunctions-&gt;stencilMaskSeparate(GL_FRONT, mStencilFrontWritemask);
+    }
+}
+
+void StateManagerGL::setStencilBackWritemask(GLuint mask)
+{
+    if (mStencilBackWritemask != mask)
+    {
+        mStencilBackWritemask = mask;
+        mFunctions-&gt;stencilMaskSeparate(GL_BACK, mStencilBackWritemask);
+    }
+}
+
+void StateManagerGL::setStencilFrontFuncs(GLenum func, GLint ref, GLuint mask)
+{
+    if (mStencilFrontFunc != func || mStencilFrontRef != ref || mStencilFrontValueMask != mask)
+    {
+        mStencilFrontFunc = func;
+        mStencilFrontRef = ref;
+        mStencilFrontValueMask = mask;
+        mFunctions-&gt;stencilFuncSeparate(GL_FRONT, mStencilFrontFunc, mStencilFrontRef, mStencilFrontValueMask);
+    }
+}
+
+void StateManagerGL::setStencilBackFuncs(GLenum func, GLint ref, GLuint mask)
+{
+    if (mStencilBackFunc != func || mStencilBackRef != ref || mStencilBackValueMask != mask)
+    {
+        mStencilBackFunc = func;
+        mStencilBackRef = ref;
+        mStencilBackValueMask = mask;
+        mFunctions-&gt;stencilFuncSeparate(GL_BACK, mStencilBackFunc, mStencilBackRef, mStencilBackValueMask);
+    }
+}
+
+void StateManagerGL::setStencilFrontOps(GLenum sfail, GLenum dpfail, GLenum dppass)
+{
+    if (mStencilFrontStencilFailOp != sfail || mStencilFrontStencilPassDepthFailOp != dpfail || mStencilFrontStencilPassDepthPassOp != dppass)
+    {
+        mStencilFrontStencilFailOp = sfail;
+        mStencilFrontStencilPassDepthFailOp = dpfail;
+        mStencilFrontStencilPassDepthPassOp = dppass;
+        mFunctions-&gt;stencilOpSeparate(GL_FRONT, mStencilFrontStencilFailOp, mStencilFrontStencilPassDepthFailOp, mStencilFrontStencilPassDepthPassOp);
+    }
+}
+
+void StateManagerGL::setStencilBackOps(GLenum sfail, GLenum dpfail, GLenum dppass)
+{
+    if (mStencilBackStencilFailOp != sfail || mStencilBackStencilPassDepthFailOp != dpfail || mStencilBackStencilPassDepthPassOp != dppass)
+    {
+        mStencilBackStencilFailOp = sfail;
+        mStencilBackStencilPassDepthFailOp = dpfail;
+        mStencilBackStencilPassDepthPassOp = dppass;
+        mFunctions-&gt;stencilOpSeparate(GL_BACK, mStencilBackStencilFailOp, mStencilBackStencilPassDepthFailOp, mStencilBackStencilPassDepthPassOp);
+    }
+}
+
+void StateManagerGL::setCullFaceEnabled(bool enabled)
+{
+    if (mCullFaceEnabled != enabled)
+    {
+        mCullFaceEnabled = enabled;
+        if (mCullFaceEnabled)
+        {
+            mFunctions-&gt;enable(GL_CULL_FACE);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_CULL_FACE);
+        }
+    }
+}
+
+void StateManagerGL::setCullFace(GLenum cullFace)
+{
+    if (mCullFace != cullFace)
+    {
+        mCullFace = cullFace;
+        mFunctions-&gt;cullFace(mCullFace);
+    }
+}
+
+void StateManagerGL::setFrontFace(GLenum frontFace)
+{
+    if (mFrontFace != frontFace)
+    {
+        mFrontFace = frontFace;
+        mFunctions-&gt;frontFace(mFrontFace);
+    }
+}
+
+void StateManagerGL::setPolygonOffsetFillEnabled(bool enabled)
+{
+    if (mPolygonOffsetFillEnabled != enabled)
+    {
+        mPolygonOffsetFillEnabled = enabled;
+        if (mPolygonOffsetFillEnabled)
+        {
+            mFunctions-&gt;enable(GL_POLYGON_OFFSET_FILL);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_POLYGON_OFFSET_FILL);
+        }
+    }
+}
+
+void StateManagerGL::setPolygonOffset(float factor, float units)
+{
+    if (mPolygonOffsetFactor != factor || mPolygonOffsetUnits != units)
+    {
+        mPolygonOffsetFactor = factor;
+        mPolygonOffsetUnits = units;
+        mFunctions-&gt;polygonOffset(mPolygonOffsetFactor, mPolygonOffsetUnits);
+    }
+}
+
+void StateManagerGL::setMultisampleEnabled(bool enabled)
+{
+    if (mMultisampleEnabled != enabled)
+    {
+        mMultisampleEnabled = enabled;
+        if (mMultisampleEnabled)
+        {
+            mFunctions-&gt;enable(GL_MULTISAMPLE);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_MULTISAMPLE);
+        }
+    }
+}
+
+void StateManagerGL::setRasterizerDiscardEnabled(bool enabled)
+{
+    if (mRasterizerDiscardEnabled != enabled)
+    {
+        mRasterizerDiscardEnabled = enabled;
+        if (mRasterizerDiscardEnabled)
+        {
+            mFunctions-&gt;enable(GL_RASTERIZER_DISCARD);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_RASTERIZER_DISCARD);
+        }
+    }
+}
+
+void StateManagerGL::setLineWidth(float width)
+{
+    if (mLineWidth != width)
+    {
+        mLineWidth = width;
+        mFunctions-&gt;lineWidth(mLineWidth);
+    }
+}
+
+void StateManagerGL::setPrimitiveRestartEnabled(bool enabled)
+{
+    if (mPrimitiveRestartEnabled != enabled)
+    {
+        mPrimitiveRestartEnabled = enabled;
+
+        if (mPrimitiveRestartEnabled)
+        {
+            mFunctions-&gt;enable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
+        }
+        else
+        {
+            mFunctions-&gt;disable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
+        }
+    }
+}
+
+void StateManagerGL::setClearDepth(float clearDepth)
+{
+    if (mClearDepth != clearDepth)
+    {
+        mClearDepth = clearDepth;
+        mFunctions-&gt;clearDepth(mClearDepth);
+    }
+}
+
+void StateManagerGL::setClearColor(const gl::ColorF &amp;clearColor)
+{
+    if (mClearColor != clearColor)
+    {
+        mClearColor = clearColor;
+        mFunctions-&gt;clearColor(mClearColor.red, mClearColor.green, mClearColor.blue, mClearColor.alpha);
+    }
+}
+
+void StateManagerGL::setClearStencil(GLint clearStencil)
+{
+    if (mClearStencil != clearStencil)
+    {
+        mClearStencil = clearStencil;
+        mFunctions-&gt;clearStencil(mClearStencil);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglStateManagerGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/StateManagerGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,172 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// StateManagerGL.h: Defines a class for caching applied OpenGL state
+
+#ifndef LIBANGLE_RENDERER_GL_STATEMANAGERGL_H_
+#define LIBANGLE_RENDERER_GL_STATEMANAGERGL_H_
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/gl/functionsgl_typedefs.h&quot;
+
+#include &lt;map&gt;
+
+namespace gl
+{
+struct Caps;
+struct Data;
+class State;
+}
+
+namespace rx
+{
+
+class FunctionsGL;
+
+class StateManagerGL : angle::NonCopyable
+{
+  public:
+    StateManagerGL(const FunctionsGL *functions, const gl::Caps &amp;rendererCaps);
+
+    void useProgram(GLuint program);
+    void bindVertexArray(GLuint vao);
+    void bindBuffer(GLenum type, GLuint buffer);
+    void activeTexture(size_t unit);
+    void bindTexture(GLenum type, GLuint texture);
+    void setPixelUnpackState(GLint alignment, GLint rowLength);
+    void bindFramebuffer(GLenum type, GLuint framebuffer);
+    void bindRenderbuffer(GLenum type, GLuint renderbuffer);
+
+    void setClearState(const gl::State &amp;state, GLbitfield mask);
+
+    gl::Error setDrawArraysState(const gl::Data &amp;data, GLint first, GLsizei count);
+    gl::Error setDrawElementsState(const gl::Data &amp;data, GLsizei count, GLenum type, const GLvoid *indices,
+                                   const GLvoid **outIndices);
+
+  private:
+    gl::Error setGenericDrawState(const gl::Data &amp;data);
+
+    void setScissorTestEnabled(bool enabled);
+    void setScissor(const gl::Rectangle &amp;scissor);
+
+    void setViewport(const gl::Rectangle &amp;viewport);
+    void setDepthRange(float near, float far);
+
+    void setBlendEnabled(bool enabled);
+    void setBlendColor(const gl::ColorF &amp;blendColor);
+    void setBlendFuncs(GLenum sourceBlendRGB, GLenum destBlendRGB, GLenum sourceBlendAlpha, GLenum destBlendAlpha);
+    void setBlendEquations(GLenum blendEquationRGB, GLenum blendEquationAlpha);
+    void setColorMask(bool red, bool green, bool blue, bool alpha);
+    void setSampleAlphaToCoverageEnabled(bool enabled);
+    void setSampleCoverageEnabled(bool enabled);
+    void setSampleCoverage(float value, bool invert);
+
+    void setDepthTestEnabled(bool enabled);
+    void setDepthFunc(GLenum depthFunc);
+    void setDepthMask(bool mask);
+    void setStencilTestEnabled(bool enabled);
+    void setStencilFrontWritemask(GLuint mask);
+    void setStencilBackWritemask(GLuint mask);
+    void setStencilFrontFuncs(GLenum func, GLint ref, GLuint mask);
+    void setStencilBackFuncs(GLenum func, GLint ref, GLuint mask);
+    void setStencilFrontOps(GLenum sfail, GLenum dpfail, GLenum dppass);
+    void setStencilBackOps(GLenum sfail, GLenum dpfail, GLenum dppass);
+
+    void setCullFaceEnabled(bool enabled);
+    void setCullFace(GLenum cullFace);
+    void setFrontFace(GLenum frontFace);
+    void setPolygonOffsetFillEnabled(bool enabled);
+    void setPolygonOffset(float factor, float units);
+    void setMultisampleEnabled(bool enabled);
+    void setRasterizerDiscardEnabled(bool enabled);
+    void setLineWidth(float width);
+
+    void setPrimitiveRestartEnabled(bool enabled);
+
+    void setClearColor(const gl::ColorF &amp;clearColor);
+    void setClearDepth(float clearDepth);
+    void setClearStencil(GLint clearStencil);
+
+    const FunctionsGL *mFunctions;
+
+    GLuint mProgram;
+    GLuint mVAO;
+    std::map&lt;GLenum, GLuint&gt; mBuffers;
+
+    size_t mTextureUnitIndex;
+    std::map&lt;GLenum, std::vector&lt;GLuint&gt;&gt; mTextures;
+
+    GLint mUnpackAlignment;
+    GLint mUnpackRowLength;
+
+    std::map&lt;GLenum, GLuint&gt; mFramebuffers;
+    GLuint mRenderbuffer;
+
+    bool mScissorTestEnabled;
+    gl::Rectangle mScissor;
+
+    gl::Rectangle mViewport;
+    float mNear;
+    float mFar;
+
+    bool mBlendEnabled;
+    gl::ColorF mBlendColor;
+    GLenum mSourceBlendRGB;
+    GLenum mDestBlendRGB;
+    GLenum mSourceBlendAlpha;
+    GLenum mDestBlendAlpha;
+    GLenum mBlendEquationRGB;
+    GLenum mBlendEquationAlpha;
+    bool mColorMaskRed;
+    bool mColorMaskGreen;
+    bool mColorMaskBlue;
+    bool mColorMaskAlpha;
+    bool mSampleAlphaToCoverageEnabled;
+    bool mSampleCoverageEnabled;
+    float mSampleCoverageValue;
+    bool mSampleCoverageInvert;
+
+    bool mDepthTestEnabled;
+    GLenum mDepthFunc;
+    bool mDepthMask;
+    bool mStencilTestEnabled;
+    GLenum mStencilFrontFunc;
+    GLint mStencilFrontRef;
+    GLuint mStencilFrontValueMask;
+    GLenum mStencilFrontStencilFailOp;
+    GLenum mStencilFrontStencilPassDepthFailOp;
+    GLenum mStencilFrontStencilPassDepthPassOp;
+    GLuint mStencilFrontWritemask;
+    GLenum mStencilBackFunc;
+    GLint mStencilBackRef;
+    GLuint mStencilBackValueMask;
+    GLenum mStencilBackStencilFailOp;
+    GLenum mStencilBackStencilPassDepthFailOp;
+    GLenum mStencilBackStencilPassDepthPassOp;
+    GLuint mStencilBackWritemask;
+
+    bool mCullFaceEnabled;
+    GLenum mCullFace;
+    GLenum mFrontFace;
+    bool mPolygonOffsetFillEnabled;
+    GLfloat mPolygonOffsetFactor;
+    GLfloat mPolygonOffsetUnits;
+    bool mMultisampleEnabled;
+    bool mRasterizerDiscardEnabled;
+    float mLineWidth;
+
+    bool mPrimitiveRestartEnabled;
+
+    gl::ColorF mClearColor;
+    float mClearDepth;
+    GLint mClearStencil;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_STATEMANAGERGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglSurfaceGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// SurfaceGL.cpp: OpenGL implementation of egl::Surface
+
+#include &quot;libANGLE/renderer/gl/SurfaceGL.h&quot;
+
+namespace rx
+{
+
+SurfaceGL::SurfaceGL()
+    : SurfaceImpl()
+{
+}
+
+SurfaceGL::~SurfaceGL()
+{
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglSurfaceGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/SurfaceGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// SurfaceGL.h: Defines the class interface for SurfaceGL.
+
+#ifndef LIBANGLE_RENDERER_GL_SURFACEGL_H_
+#define LIBANGLE_RENDERER_GL_SURFACEGL_H_
+
+#include &quot;libANGLE/renderer/SurfaceImpl.h&quot;
+
+namespace rx
+{
+
+class SurfaceGL : public SurfaceImpl
+{
+  public:
+    SurfaceGL();
+    ~SurfaceGL() override;
+
+    gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                        FramebufferAttachmentRenderTarget **rtOut) override
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Not supported on OpenGL&quot;);
+    }
+
+    virtual egl::Error makeCurrent() = 0;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_SURFACEGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglTextureGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,408 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// TextureGL.cpp: Implements the class methods for TextureGL.
+
+#include &quot;libANGLE/renderer/gl/TextureGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;libANGLE/State.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/gl/BufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FramebufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+
+namespace rx
+{
+
+static void SetUnpackStateForTexImage(StateManagerGL *stateManager, const gl::PixelUnpackState &amp;unpack)
+{
+    const gl::Buffer *unpackBuffer = unpack.pixelBuffer.get();
+    if (unpackBuffer != nullptr)
+    {
+        UNIMPLEMENTED();
+    }
+    if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
+    {
+        UNIMPLEMENTED();
+    }
+    stateManager-&gt;setPixelUnpackState(unpack.alignment, unpack.rowLength);
+}
+
+static bool UseTexImage2D(GLenum textureType)
+{
+    return textureType == GL_TEXTURE_2D || textureType == GL_TEXTURE_CUBE_MAP;
+}
+
+static bool UseTexImage3D(GLenum textureType)
+{
+    return textureType == GL_TEXTURE_2D_ARRAY || textureType == GL_TEXTURE_3D;
+}
+
+static bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget)
+{
+    if (textureType != GL_TEXTURE_CUBE_MAP)
+    {
+        return textureType == textureTarget;
+    }
+    else
+    {
+        return gl::IsCubeMapTextureTarget(textureTarget);
+    }
+}
+
+TextureGL::TextureGL(GLenum type, const FunctionsGL *functions, StateManagerGL *stateManager)
+    : TextureImpl(),
+      mTextureType(type),
+      mFunctions(functions),
+      mStateManager(stateManager),
+      mAppliedSamplerState(),
+      mTextureID(0)
+{
+    ASSERT(mFunctions);
+    ASSERT(mStateManager);
+
+    mFunctions-&gt;genTextures(1, &amp;mTextureID);
+}
+
+TextureGL::~TextureGL()
+{
+    if (mTextureID)
+    {
+        mFunctions-&gt;deleteTextures(1, &amp;mTextureID);
+        mTextureID = 0;
+    }
+}
+
+void TextureGL::setUsage(GLenum usage)
+{
+    // GL_ANGLE_texture_usage not implemented for desktop GL
+    UNREACHABLE();
+}
+
+gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                              const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    UNUSED_ASSERTION_VARIABLE(&amp;CompatibleTextureTarget); // Reference this function to avoid warnings.
+    ASSERT(CompatibleTextureTarget(mTextureType, target));
+
+    SetUnpackStateForTexImage(mStateManager, unpack);
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    if (UseTexImage2D(mTextureType))
+    {
+        ASSERT(size.depth == 1);
+        mFunctions-&gt;texImage2D(target, level, internalFormat, size.width, size.height, 0, format, type, pixels);
+    }
+    else if (UseTexImage3D(mTextureType))
+    {
+        mFunctions-&gt;texImage3D(target, level, internalFormat, size.width, size.height, size.depth, 0, format, type, pixels);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(CompatibleTextureTarget(mTextureType, target));
+
+    SetUnpackStateForTexImage(mStateManager, unpack);
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    if (UseTexImage2D(mTextureType))
+    {
+        ASSERT(area.z == 0 &amp;&amp; area.depth == 1);
+        mFunctions-&gt;texSubImage2D(target, level, area.x, area.y, area.width, area.height, format, type, pixels);
+    }
+    else if (UseTexImage3D(mTextureType))
+    {
+        mFunctions-&gt;texSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth,
+                                  format, type, pixels);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                        const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(CompatibleTextureTarget(mTextureType, target));
+
+    SetUnpackStateForTexImage(mStateManager, unpack);
+
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+    size_t depthPitch = internalFormatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height,
+                                                             unpack.alignment, unpack.rowLength);
+    size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, size.width, size.height) * depthPitch;
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    if (UseTexImage2D(mTextureType))
+    {
+        ASSERT(size.depth == 1);
+        mFunctions-&gt;compressedTexImage2D(target, level, internalFormat, size.width, size.height, 0, dataSize, pixels);
+    }
+    else if (UseTexImage3D(mTextureType))
+    {
+        mFunctions-&gt;compressedTexImage3D(target, level, internalFormat, size.width, size.height, size.depth, 0,
+                                         dataSize, pixels);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                           const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels)
+{
+    ASSERT(CompatibleTextureTarget(mTextureType, target));
+
+    SetUnpackStateForTexImage(mStateManager, unpack);
+
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(format);
+    size_t depthPitch = internalFormatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height,
+                                                             unpack.alignment, unpack.rowLength);
+    size_t dataSize = internalFormatInfo.computeBlockSize(GL_UNSIGNED_BYTE, area.width, area.height) * depthPitch;
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    if (UseTexImage2D(mTextureType))
+    {
+        ASSERT(area.z == 0 &amp;&amp; area.depth == 1);
+        mFunctions-&gt;compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height, format, dataSize,
+                                            pixels);
+    }
+    else if (UseTexImage3D(mTextureType))
+    {
+        mFunctions-&gt;compressedTexSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth,
+                                            format, dataSize, pixels);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                               const gl::Framebuffer *source)
+{
+    const FramebufferGL *sourceFramebufferGL = GetImplAs&lt;FramebufferGL&gt;(source);
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    mStateManager-&gt;bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL-&gt;getFramebufferID());
+
+    if (UseTexImage2D(mTextureType))
+    {
+        mFunctions-&gt;copyTexImage2D(target, level, internalFormat, sourceArea.x, sourceArea.y,
+                                   sourceArea.width, sourceArea.height, 0);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureGL::copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                                  const gl::Framebuffer *source)
+{
+    const FramebufferGL *sourceFramebufferGL = GetImplAs&lt;FramebufferGL&gt;(source);
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    mStateManager-&gt;bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL-&gt;getFramebufferID());
+
+    if (UseTexImage2D(mTextureType))
+    {
+        ASSERT(destOffset.z == 0);
+        mFunctions-&gt;copyTexSubImage2D(target, level, destOffset.x, destOffset.y,
+                                      sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height);
+    }
+    else if (UseTexImage3D(mTextureType))
+    {
+        mFunctions-&gt;copyTexSubImage3D(target, level, destOffset.x, destOffset.y, destOffset.z,
+                                      sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureGL::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size)
+{
+    // TODO: emulate texture storage with TexImage calls if on GL version &lt;4.2 or the
+    // ARB_texture_storage extension is not available.
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    if (UseTexImage2D(mTextureType))
+    {
+        ASSERT(size.depth == 1);
+        if (mFunctions-&gt;texStorage2D)
+        {
+            mFunctions-&gt;texStorage2D(target, levels, internalFormat, size.width, size.height);
+        }
+        else
+        {
+            // Make sure no pixel unpack buffer is bound
+            mStateManager-&gt;bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+
+            const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+
+            // Internal format must be sized
+            ASSERT(internalFormatInfo.pixelBytes != 0);
+
+            for (size_t level = 0; level &lt; levels; level++)
+            {
+                gl::Extents levelSize(std::max(size.width &gt;&gt; level, 1),
+                                      std::max(size.height &gt;&gt; level, 1),
+                                      1);
+
+                if (mTextureType == GL_TEXTURE_2D)
+                {
+                    mFunctions-&gt;texImage2D(target, level, internalFormat, levelSize.width, levelSize.height,
+                                           0, internalFormatInfo.format, internalFormatInfo.type, nullptr);
+                }
+                else if (mTextureType == GL_TEXTURE_CUBE_MAP)
+                {
+                    for (GLenum face = gl::FirstCubeMapTextureTarget; face &lt;= gl::LastCubeMapTextureTarget; face++)
+                    {
+                        mFunctions-&gt;texImage2D(face, level, internalFormat, levelSize.width, levelSize.height,
+                                               0, internalFormatInfo.format, internalFormatInfo.type, nullptr);
+                    }
+                }
+                else
+                {
+                    UNREACHABLE();
+                }
+            }
+        }
+    }
+    else if (UseTexImage3D(mTextureType))
+    {
+        if (mFunctions-&gt;texStorage3D)
+        {
+            mFunctions-&gt;texStorage3D(target, levels, internalFormat, size.width, size.height, size.depth);
+        }
+        else
+        {
+            // Make sure no pixel unpack buffer is bound
+            mStateManager-&gt;bindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+
+            const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+
+            // Internal format must be sized
+            ASSERT(internalFormatInfo.pixelBytes != 0);
+
+            for (size_t i = 0; i &lt; levels; i++)
+            {
+                gl::Extents levelSize(std::max(size.width &gt;&gt; i, 1),
+                                      std::max(size.height &gt;&gt; i, 1),
+                                      mTextureType == GL_TEXTURE_3D ? std::max(size.depth &gt;&gt; i, 1) : size.depth);
+
+                mFunctions-&gt;texImage3D(target, i, internalFormat, levelSize.width, levelSize.height, levelSize.depth,
+                                       0, internalFormatInfo.format, internalFormatInfo.type, nullptr);
+            }
+        }
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error TextureGL::generateMipmaps(const gl::SamplerState &amp;samplerState)
+{
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    mFunctions-&gt;generateMipmap(mTextureType);
+    return gl::Error(GL_NO_ERROR);
+}
+
+void TextureGL::bindTexImage(egl::Surface *surface)
+{
+    ASSERT(mTextureType == GL_TEXTURE_2D);
+
+    // Make sure this texture is bound
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+}
+
+void TextureGL::releaseTexImage()
+{
+    // Not all Surface implementations reset the size of mip 0 when releasing, do it manually
+    ASSERT(mTextureType == GL_TEXTURE_2D);
+
+    mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+    if (UseTexImage2D(mTextureType))
+    {
+        mFunctions-&gt;texImage2D(mTextureType, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
+    }
+    else
+    {
+        UNREACHABLE();
+    }
+}
+
+template &lt;typename T&gt;
+static inline void SyncSamplerStateMember(const FunctionsGL *functions, const gl::SamplerState &amp;newState,
+                                          gl::SamplerState &amp;curState, GLenum textureType, GLenum name,
+                                          T(gl::SamplerState::*samplerMember))
+{
+    if (curState.*samplerMember != newState.*samplerMember)
+    {
+        curState.*samplerMember = newState.*samplerMember;
+        functions-&gt;texParameterf(textureType, name, static_cast&lt;GLfloat&gt;(curState.*samplerMember));
+    }
+}
+
+void TextureGL::syncSamplerState(const gl::SamplerState &amp;samplerState) const
+{
+    if (mAppliedSamplerState != samplerState)
+    {
+        mStateManager-&gt;bindTexture(mTextureType, mTextureID);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MIN_FILTER, &amp;gl::SamplerState::minFilter);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAG_FILTER, &amp;gl::SamplerState::magFilter);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_S, &amp;gl::SamplerState::wrapS);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_T, &amp;gl::SamplerState::wrapT);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_WRAP_R, &amp;gl::SamplerState::wrapR);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_ANISOTROPY_EXT, &amp;gl::SamplerState::maxAnisotropy);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_BASE_LEVEL, &amp;gl::SamplerState::baseLevel);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_LEVEL, &amp;gl::SamplerState::maxLevel);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MIN_LOD, &amp;gl::SamplerState::minLod);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_MAX_LOD, &amp;gl::SamplerState::maxLod);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_COMPARE_MODE, &amp;gl::SamplerState::compareMode);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_COMPARE_FUNC, &amp;gl::SamplerState::compareFunc);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_R, &amp;gl::SamplerState::swizzleRed);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_G, &amp;gl::SamplerState::swizzleGreen);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_B, &amp;gl::SamplerState::swizzleBlue);
+        SyncSamplerStateMember(mFunctions, samplerState, mAppliedSamplerState, mTextureType, GL_TEXTURE_SWIZZLE_A, &amp;gl::SamplerState::swizzleAlpha);
+    }
+}
+
+GLuint TextureGL::getTextureID() const
+{
+    return mTextureID;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglTextureGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TextureGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// TextureGL.h: Defines the class interface for TextureGL.
+
+#ifndef LIBANGLE_RENDERER_GL_TEXTUREGL_H_
+#define LIBANGLE_RENDERER_GL_TEXTUREGL_H_
+
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/renderer/TextureImpl.h&quot;
+
+namespace rx
+{
+
+class FunctionsGL;
+class StateManagerGL;
+
+class TextureGL : public TextureImpl
+{
+  public:
+    TextureGL(GLenum type, const FunctionsGL *functions, StateManagerGL *stateManager);
+    ~TextureGL() override;
+
+    void setUsage(GLenum usage) override;
+
+    gl::Error setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size, GLenum format, GLenum type,
+                       const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format, GLenum type,
+                          const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &amp;size,
+                                 const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+    gl::Error setCompressedSubImage(GLenum target, size_t level, const gl::Box &amp;area, GLenum format,
+                                    const gl::PixelUnpackState &amp;unpack, const uint8_t *pixels) override;
+
+    gl::Error copyImage(GLenum target, size_t level, const gl::Rectangle &amp;sourceArea, GLenum internalFormat,
+                        const gl::Framebuffer *source) override;
+    gl::Error copySubImage(GLenum target, size_t level, const gl::Offset &amp;destOffset, const gl::Rectangle &amp;sourceArea,
+                           const gl::Framebuffer *source) override;
+
+    gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &amp;size) override;
+
+    gl::Error generateMipmaps(const gl::SamplerState &amp;samplerState) override;
+
+    void bindTexImage(egl::Surface *surface) override;
+    void releaseTexImage() override;
+
+    void syncSamplerState(const gl::SamplerState &amp;samplerState) const;
+    GLuint getTextureID() const;
+
+    gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &amp;target,
+                                        FramebufferAttachmentRenderTarget **rtOut) override
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Not supported on OpenGL&quot;);
+    }
+
+  private:
+    GLenum mTextureType;
+
+    const FunctionsGL *mFunctions;
+    StateManagerGL *mStateManager;
+
+    mutable gl::SamplerState mAppliedSamplerState;
+    GLuint mTextureID;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_TEXTUREGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglTransformFeedbackGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// TransformFeedbackGL.cpp: Implements the class methods for TransformFeedbackGL.
+
+#include &quot;libANGLE/renderer/gl/TransformFeedbackGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace rx
+{
+
+TransformFeedbackGL::TransformFeedbackGL()
+    : TransformFeedbackImpl()
+{}
+
+TransformFeedbackGL::~TransformFeedbackGL()
+{}
+
+void TransformFeedbackGL::begin(GLenum primitiveMode)
+{
+    UNIMPLEMENTED();
+}
+
+void TransformFeedbackGL::end()
+{
+    UNIMPLEMENTED();
+}
+
+void TransformFeedbackGL::pause()
+{
+    UNIMPLEMENTED();
+}
+
+void TransformFeedbackGL::resume()
+{
+    UNIMPLEMENTED();
+}
+
+void TransformFeedbackGL::bindGenericBuffer(const BindingPointer&lt;gl::Buffer&gt; &amp;binding)
+{
+    UNIMPLEMENTED();
+}
+
+void TransformFeedbackGL::bindIndexedBuffer(size_t index, const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding)
+{
+    UNIMPLEMENTED();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglTransformFeedbackGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/TransformFeedbackGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// TransformFeedbackGL.h: Defines the class interface for TransformFeedbackGL.
+
+#ifndef LIBANGLE_RENDERER_GL_TRANSFORMFEEDBACKGL_H_
+#define LIBANGLE_RENDERER_GL_TRANSFORMFEEDBACKGL_H_
+
+#include &quot;libANGLE/renderer/TransformFeedbackImpl.h&quot;
+
+namespace rx
+{
+
+class TransformFeedbackGL : public TransformFeedbackImpl
+{
+  public:
+    TransformFeedbackGL();
+    ~TransformFeedbackGL() override;
+
+    void begin(GLenum primitiveMode) override;
+    void end() override;
+    void pause() override;
+    void resume() override;
+
+    void bindGenericBuffer(const BindingPointer&lt;gl::Buffer&gt; &amp;binding) override;
+    void bindIndexedBuffer(size_t index, const OffsetBindingPointer&lt;gl::Buffer&gt; &amp;binding) override;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_TRANSFORMFEEDBACKGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglVertexArrayGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,423 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// VertexArrayGL.cpp: Implements the class methods for VertexArrayGL.
+
+#include &quot;libANGLE/renderer/gl/VertexArrayGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/mathutil.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/angletypes.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/gl/BufferGL.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/StateManagerGL.h&quot;
+
+namespace rx
+{
+
+VertexArrayGL::VertexArrayGL(const FunctionsGL *functions, StateManagerGL *stateManager)
+    : VertexArrayImpl(),
+      mFunctions(functions),
+      mStateManager(stateManager),
+      mVertexArrayID(0),
+      mElementArrayBuffer(),
+      mAttributes(),
+      mAppliedElementArrayBuffer(0),
+      mAppliedAttributes(),
+      mStreamingElementArrayBufferSize(0),
+      mStreamingElementArrayBuffer(0),
+      mStreamingArrayBufferSize(0),
+      mStreamingArrayBuffer(0)
+{
+    ASSERT(mFunctions);
+    ASSERT(mStateManager);
+    mFunctions-&gt;genVertexArrays(1, &amp;mVertexArrayID);
+
+    // Set the cached vertex attribute array size
+    GLint maxVertexAttribs;
+    mFunctions-&gt;getIntegerv(GL_MAX_VERTEX_ATTRIBS, &amp;maxVertexAttribs);
+    mAttributes.resize(maxVertexAttribs);
+    mAppliedAttributes.resize(maxVertexAttribs);
+}
+
+VertexArrayGL::~VertexArrayGL()
+{
+    if (mVertexArrayID != 0)
+    {
+        mFunctions-&gt;deleteVertexArrays(1, &amp;mVertexArrayID);
+        mVertexArrayID = 0;
+    }
+
+    if (mStreamingElementArrayBuffer != 0)
+    {
+        mFunctions-&gt;deleteBuffers(1, &amp;mStreamingElementArrayBuffer);
+        mStreamingElementArrayBufferSize = 0;
+        mStreamingElementArrayBuffer = 0;
+    }
+
+    if (mStreamingArrayBuffer != 0)
+    {
+        mFunctions-&gt;deleteBuffers(1, &amp;mStreamingArrayBuffer);
+        mStreamingArrayBufferSize = 0;
+        mStreamingArrayBuffer = 0;
+    }
+
+    mElementArrayBuffer.set(nullptr);
+    for (size_t idx = 0; idx &lt; mAttributes.size(); idx++)
+    {
+        mAttributes[idx].buffer.set(NULL);
+    }
+
+    for (size_t idx = 0; idx &lt; mAppliedAttributes.size(); idx++)
+    {
+        mAppliedAttributes[idx].buffer.set(NULL);
+    }
+}
+
+void VertexArrayGL::setElementArrayBuffer(const gl::Buffer *buffer)
+{
+    mElementArrayBuffer.set(buffer);
+}
+
+void VertexArrayGL::setAttribute(size_t idx, const gl::VertexAttribute &amp;attr)
+{
+    mAttributes[idx] = attr;
+}
+
+void VertexArrayGL::setAttributeDivisor(size_t idx, GLuint divisor)
+{
+    mAttributes[idx].divisor = divisor;
+}
+
+void VertexArrayGL::enableAttribute(size_t idx, bool enabledState)
+{
+    mAttributes[idx].enabled = enabledState;
+}
+
+gl::Error VertexArrayGL::syncDrawArraysState(GLint first, GLsizei count) const
+{
+    return syncDrawState(first, count, GL_NONE, nullptr, nullptr);
+}
+
+gl::Error VertexArrayGL::syncDrawElementsState(GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const
+{
+    return syncDrawState(0, count, type, indices, outIndices);
+}
+
+gl::Error VertexArrayGL::syncDrawState(GLint first, GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const
+{
+    mStateManager-&gt;bindVertexArray(mVertexArrayID);
+
+    // Check if any attributes need to be streamed, determines if the index range needs to be computed
+    bool attributesNeedStreaming = doAttributesNeedStreaming();
+
+    // Determine if an index buffer needs to be streamed and the range of vertices that need to be copied
+    RangeUI indexRange(0, 0);
+    if (type != GL_NONE)
+    {
+        gl::Error error = syncIndexData(count, type, indices, attributesNeedStreaming, &amp;indexRange, outIndices);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+    else
+    {
+        // Not an indexed call, set the range to [first, first + count)
+        indexRange.start = first;
+        indexRange.end = first + count;
+    }
+
+    // Sync the vertex attribute state and track what data needs to be streamed
+    size_t streamingDataSize = 0;
+    size_t maxAttributeDataSize = 0;
+    gl::Error error = syncAttributeState(attributesNeedStreaming, indexRange, &amp;streamingDataSize, &amp;maxAttributeDataSize);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (streamingDataSize &gt; 0)
+    {
+        ASSERT(attributesNeedStreaming);
+
+        gl::Error error = streamAttributes(streamingDataSize, maxAttributeDataSize, indexRange);
+        if (error.isError())
+        {
+            return error;
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+bool VertexArrayGL::doAttributesNeedStreaming() const
+{
+    // TODO: if GLES, nothing needs to be streamed
+    for (size_t idx = 0; idx &lt; mAttributes.size(); idx++)
+    {
+        if (mAttributes[idx].enabled &amp;&amp; mAttributes[idx].buffer.get() == nullptr)
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+gl::Error VertexArrayGL::syncAttributeState(bool attributesNeedStreaming, const RangeUI &amp;indexRange,
+                                            size_t *outStreamingDataSize, size_t *outMaxAttributeDataSize) const
+{
+    *outStreamingDataSize = 0;
+    *outMaxAttributeDataSize = 0;
+
+    for (size_t idx = 0; idx &lt; mAttributes.size(); idx++)
+    {
+        // Always sync the enabled and divisor state, they are required for both streaming and buffered
+        // attributes
+        if (mAppliedAttributes[idx].enabled != mAttributes[idx].enabled)
+        {
+            if (mAttributes[idx].enabled)
+            {
+                mFunctions-&gt;enableVertexAttribArray(idx);
+            }
+            else
+            {
+                mFunctions-&gt;disableVertexAttribArray(idx);
+            }
+            mAppliedAttributes[idx].enabled = mAttributes[idx].enabled;
+        }
+        if (mAppliedAttributes[idx].divisor != mAttributes[idx].divisor)
+        {
+            mFunctions-&gt;vertexAttribDivisor(idx, mAttributes[idx].divisor);
+            mAppliedAttributes[idx].divisor = mAttributes[idx].divisor;
+        }
+
+        if (mAttributes[idx].enabled &amp;&amp; mAttributes[idx].buffer.get() == nullptr)
+        {
+            ASSERT(attributesNeedStreaming);
+
+            const size_t streamedVertexCount = indexRange.end - indexRange.start + 1;
+
+            // If streaming is going to be required, compute the size of the required buffer
+            // and how much slack space at the beginning of the buffer will be required by determining
+            // the attribute with the largest data size.
+            size_t typeSize = ComputeVertexAttributeTypeSize(mAttributes[idx]);
+            *outStreamingDataSize += typeSize * streamedVertexCount;
+            *outMaxAttributeDataSize = std::max(*outMaxAttributeDataSize, typeSize);
+        }
+        else
+        {
+            // Sync the attribute with no translation
+            if (mAppliedAttributes[idx] != mAttributes[idx])
+            {
+                const gl::Buffer *arrayBuffer = mAttributes[idx].buffer.get();
+                const BufferGL *arrayBufferGL = GetImplAs&lt;BufferGL&gt;(arrayBuffer);
+                mStateManager-&gt;bindBuffer(GL_ARRAY_BUFFER, arrayBufferGL-&gt;getBufferID());
+
+                if (mAttributes[idx].pureInteger)
+                {
+                    mFunctions-&gt;vertexAttribIPointer(idx, mAttributes[idx].size, mAttributes[idx].type,
+                                                     mAttributes[idx].stride, mAttributes[idx].pointer);
+                }
+                else
+                {
+                    mFunctions-&gt;vertexAttribPointer(idx, mAttributes[idx].size, mAttributes[idx].type,
+                                                    mAttributes[idx].normalized, mAttributes[idx].stride,
+                                                    mAttributes[idx].pointer);
+                }
+
+                mAppliedAttributes[idx] = mAttributes[idx];
+            }
+        }
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexArrayGL::syncIndexData(GLsizei count, GLenum type, const GLvoid *indices, bool attributesNeedStreaming,
+                                       RangeUI *outIndexRange, const GLvoid **outIndices) const
+{
+    ASSERT(outIndices);
+
+    // Need to check the range of indices if attributes need to be streamed
+    if (mElementArrayBuffer.get() != nullptr)
+    {
+        const BufferGL *bufferGL = GetImplAs&lt;BufferGL&gt;(mElementArrayBuffer.get());
+        GLuint elementArrayBufferID = bufferGL-&gt;getBufferID();
+        if (elementArrayBufferID != mAppliedElementArrayBuffer)
+        {
+            mStateManager-&gt;bindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementArrayBufferID);
+            mAppliedElementArrayBuffer = elementArrayBufferID;
+        }
+
+        // Only compute the index range if the attributes also need to be streamed
+        if (attributesNeedStreaming)
+        {
+            ptrdiff_t elementArrayBufferOffset = reinterpret_cast&lt;ptrdiff_t&gt;(indices);
+
+            // Find the index range in the buffer
+            const IndexRangeCache *rangeCache = mElementArrayBuffer.get()-&gt;getIndexRangeCache();
+
+            if (!rangeCache-&gt;findRange(type, static_cast&lt;unsigned int&gt;(elementArrayBufferOffset), count, outIndexRange))
+            {
+                // Need to compute the index range.
+                mStateManager-&gt;bindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementArrayBufferID);
+                uint8_t *elementArrayBufferPointer = reinterpret_cast&lt;uint8_t*&gt;(mFunctions-&gt;mapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY));
+
+                *outIndexRange = IndexRangeCache::ComputeRange(type, elementArrayBufferPointer + elementArrayBufferOffset, count);
+
+                // TODO: Store the range cache at the impl level since the gl::Buffer object is supposed to remain constant
+                const_cast&lt;IndexRangeCache*&gt;(rangeCache)-&gt;addRange(type, static_cast&lt;unsigned int&gt;(elementArrayBufferOffset), count, *outIndexRange);
+
+                if (!mFunctions-&gt;unmapBuffer(GL_ELEMENT_ARRAY_BUFFER))
+                {
+                    return gl::Error(GL_OUT_OF_MEMORY);
+                }
+            }
+        }
+
+        // Indices serves as an offset into the index buffer in this case, use the same value for the draw call
+        *outIndices = indices;
+    }
+    else
+    {
+        // Need to stream the index buffer
+        // TODO: if GLES, nothing needs to be streamed
+
+        // Only compute the index range if the attributes also need to be streamed
+        if (attributesNeedStreaming)
+        {
+            *outIndexRange = IndexRangeCache::ComputeRange(type, indices, count);
+        }
+
+        // Allocate the streaming element array buffer
+        if (mStreamingElementArrayBuffer == 0)
+        {
+            mFunctions-&gt;genBuffers(1, &amp;mStreamingElementArrayBuffer);
+            mStreamingElementArrayBufferSize = 0;
+        }
+
+        mStateManager-&gt;bindBuffer(GL_ELEMENT_ARRAY_BUFFER, mStreamingElementArrayBuffer);
+        mAppliedElementArrayBuffer = mStreamingElementArrayBuffer;
+
+        // Make sure the element array buffer is large enough
+        const gl::Type &amp;indexTypeInfo = gl::GetTypeInfo(type);
+        size_t requiredStreamingBufferSize = indexTypeInfo.bytes * count;
+        if (requiredStreamingBufferSize &gt; mStreamingElementArrayBufferSize)
+        {
+            // Copy the indices in while resizing the buffer
+            mFunctions-&gt;bufferData(GL_ELEMENT_ARRAY_BUFFER, requiredStreamingBufferSize, indices, GL_DYNAMIC_DRAW);
+            mStreamingElementArrayBufferSize = requiredStreamingBufferSize;
+        }
+        else
+        {
+            // Put the indices at the beginning of the buffer
+            mFunctions-&gt;bufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, requiredStreamingBufferSize, indices);
+        }
+
+        // Set the index offset for the draw call to zero since the supplied index pointer is to client data
+        *outIndices = nullptr;
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+gl::Error VertexArrayGL::streamAttributes(size_t streamingDataSize, size_t maxAttributeDataSize, const RangeUI &amp;indexRange) const
+{
+    if (mStreamingArrayBuffer == 0)
+    {
+        mFunctions-&gt;genBuffers(1, &amp;mStreamingArrayBuffer);
+        mStreamingArrayBufferSize = 0;
+    }
+
+    // If first is greater than zero, a slack space needs to be left at the beginning of the buffer so that
+    // the same 'first' argument can be passed into the draw call.
+    const size_t bufferEmptySpace = maxAttributeDataSize * indexRange.start;
+    const size_t requiredBufferSize = streamingDataSize + bufferEmptySpace;
+
+    mStateManager-&gt;bindBuffer(GL_ARRAY_BUFFER, mStreamingArrayBuffer);
+    if (requiredBufferSize &gt; mStreamingArrayBufferSize)
+    {
+        mFunctions-&gt;bufferData(GL_ARRAY_BUFFER, requiredBufferSize, nullptr, GL_DYNAMIC_DRAW);
+        mStreamingArrayBufferSize = requiredBufferSize;
+    }
+
+    // Unmapping a buffer can return GL_FALSE to indicate that the system has corrupted the data
+    // somehow (such as by a screen change), retry writing the data a few times and return OUT_OF_MEMORY
+    // if that fails.
+    GLboolean unmapResult = GL_FALSE;
+    size_t unmapRetryAttempts = 5;
+    while (unmapResult != GL_TRUE &amp;&amp; --unmapRetryAttempts &gt; 0)
+    {
+        uint8_t *bufferPointer = reinterpret_cast&lt;uint8_t*&gt;(mFunctions-&gt;mapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY));
+        size_t curBufferOffset = bufferEmptySpace;
+
+        const size_t streamedVertexCount = indexRange.end - indexRange.start + 1;
+
+        for (size_t idx = 0; idx &lt; mAttributes.size(); idx++)
+        {
+            if (mAttributes[idx].enabled &amp;&amp; mAttributes[idx].buffer.get() == nullptr)
+            {
+                const size_t sourceStride = ComputeVertexAttributeStride(mAttributes[idx]);
+                const size_t destStride = ComputeVertexAttributeTypeSize(mAttributes[idx]);
+
+                const uint8_t *inputPointer = reinterpret_cast&lt;const uint8_t*&gt;(mAttributes[idx].pointer);
+
+                // Pack the data when copying it, user could have supplied a very large stride that would
+                // cause the buffer to be much larger than needed.
+                if (destStride == sourceStride)
+                {
+                    // Can copy in one go, the data is packed
+                    memcpy(bufferPointer + curBufferOffset,
+                           inputPointer + (sourceStride * indexRange.start),
+                           destStride * streamedVertexCount);
+                }
+                else
+                {
+                    // Copy each vertex individually
+                    for (size_t vertexIdx = indexRange.start; vertexIdx &lt;= indexRange.end; vertexIdx++)
+                    {
+                        memcpy(bufferPointer + curBufferOffset + (destStride * vertexIdx),
+                               inputPointer + (sourceStride * vertexIdx),
+                               destStride);
+                    }
+                }
+
+                // Compute where the 0-index vertex would be.
+                const size_t vertexStartOffset = curBufferOffset - (indexRange.start * destStride);
+
+                mFunctions-&gt;vertexAttribPointer(idx, mAttributes[idx].size, mAttributes[idx].type,
+                                                mAttributes[idx].normalized, destStride,
+                                                reinterpret_cast&lt;const GLvoid*&gt;(vertexStartOffset));
+
+                curBufferOffset += destStride * streamedVertexCount;
+
+                // Mark the applied attribute as dirty by setting an invalid size so that if it doesn't
+                // need to be streamed later, there is no chance that the caching will skip it.
+                mAppliedAttributes[idx].size = static_cast&lt;GLuint&gt;(-1);
+            }
+        }
+
+        unmapResult = mFunctions-&gt;unmapBuffer(GL_ARRAY_BUFFER);
+    }
+
+    if (unmapResult != GL_TRUE)
+    {
+        return gl::Error(GL_OUT_OF_MEMORY, &quot;Failed to unmap the client data streaming buffer.&quot;);
+    }
+
+    return gl::Error(GL_NO_ERROR);
+}
+
+GLuint VertexArrayGL::getVertexArrayID() const
+{
+    return mVertexArrayID;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglVertexArrayGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/VertexArrayGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+//
+// Copyright 2015 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.
+//
+
+// VertexArrayGL.h: Defines the class interface for VertexArrayGL.
+
+#ifndef LIBANGLE_RENDERER_GL_VERTEXARRAYGL_H_
+#define LIBANGLE_RENDERER_GL_VERTEXARRAYGL_H_
+
+#include &quot;libANGLE/renderer/VertexArrayImpl.h&quot;
+
+namespace rx
+{
+
+class FunctionsGL;
+class StateManagerGL;
+
+class VertexArrayGL : public VertexArrayImpl
+{
+  public:
+    VertexArrayGL(const FunctionsGL *functions, StateManagerGL *stateManager);
+    ~VertexArrayGL() override;
+
+    void setElementArrayBuffer(const gl::Buffer *buffer) override;
+    void setAttribute(size_t idx, const gl::VertexAttribute &amp;attr) override;
+    void setAttributeDivisor(size_t idx, GLuint divisor) override;
+    void enableAttribute(size_t idx, bool enabledState) override;
+
+    gl::Error syncDrawArraysState(GLint first, GLsizei count) const;
+    gl::Error syncDrawElementsState(GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const;
+
+    GLuint getVertexArrayID() const;
+
+  private:
+    gl::Error syncDrawState(GLint first, GLsizei count, GLenum type, const GLvoid *indices, const GLvoid **outIndices) const;
+
+    // Check if any vertex attributes need to be streamed
+    bool doAttributesNeedStreaming() const;
+
+    // Apply attribute state, returns the amount of space needed to stream all attributes that need streaming
+    // and the data size of the largest attribute
+    gl::Error syncAttributeState(bool attributesNeedStreaming, const RangeUI &amp;indexRange, size_t *outStreamingDataSize,
+                                 size_t *outMaxAttributeDataSize) const;
+
+    // Apply index data, only sets outIndexRange if attributesNeedStreaming is true
+    gl::Error syncIndexData(GLsizei count, GLenum type, const GLvoid *indices, bool attributesNeedStreaming,
+                            RangeUI *outIndexRange, const GLvoid **outIndices) const;
+
+    // Stream attributes that have client data
+    gl::Error streamAttributes(size_t streamingDataSize, size_t maxAttributeDataSize, const RangeUI &amp;indexRange) const;
+
+    const FunctionsGL *mFunctions;
+    StateManagerGL *mStateManager;
+
+    GLuint mVertexArrayID;
+
+    BindingPointer&lt;const gl::Buffer&gt; mElementArrayBuffer;
+    std::vector&lt;gl::VertexAttribute&gt; mAttributes;
+
+    mutable GLuint mAppliedElementArrayBuffer;
+    mutable std::vector&lt;gl::VertexAttribute&gt; mAppliedAttributes;
+
+    mutable size_t mStreamingElementArrayBufferSize;
+    mutable GLuint mStreamingElementArrayBuffer;
+
+    mutable size_t mStreamingArrayBufferSize;
+    mutable GLuint mStreamingArrayBuffer;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_VERTEXARRAYGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglformatutilsglcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,220 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// formatutilsgl.cpp: Queries for GL image formats and their translations to native
+// GL formats.
+
+#include &quot;libANGLE/renderer/gl/formatutilsgl.h&quot;
+
+#include &lt;map&gt;
+
+namespace rx
+{
+
+namespace nativegl
+{
+
+// Information about internal formats
+static bool AlwaysSupported(GLuint, GLuint, const std::vector&lt;std::string&gt; &amp;)
+{
+    return true;
+}
+
+static bool UnimplementedSupport(GLuint, GLuint, const std::vector&lt;std::string&gt; &amp;)
+{
+    return false;
+}
+
+static bool NeverSupported(GLuint, GLuint, const std::vector&lt;std::string&gt; &amp;)
+{
+    return false;
+}
+
+template &lt;GLuint minMajorVersion, GLuint minMinorVersion&gt;
+static bool RequireGL(GLuint major, GLuint minor, const std::vector&lt;std::string&gt; &amp;)
+{
+    return major &gt; minMajorVersion || (major == minMajorVersion &amp;&amp; minor &gt;= minMinorVersion);
+}
+
+
+InternalFormat::InternalFormat()
+    : textureSupport(NeverSupported),
+      renderSupport(NeverSupported),
+      filterSupport(NeverSupported)
+{
+}
+
+typedef std::pair&lt;GLenum, InternalFormat&gt; InternalFormatInfoPair;
+typedef std::map&lt;GLenum, InternalFormat&gt; InternalFormatInfoMap;
+
+// A helper function to insert data into the format map with fewer characters.
+static inline void InsertFormatMapping(InternalFormatInfoMap *map, GLenum internalFormat,
+                                       InternalFormat::SupportCheckFunction textureSupport,
+                                       InternalFormat::SupportCheckFunction renderSupport,
+                                       InternalFormat::SupportCheckFunction filterSupport)
+{
+    InternalFormat formatInfo;
+    formatInfo.textureSupport = textureSupport;
+    formatInfo.renderSupport = renderSupport;
+    formatInfo.filterSupport = filterSupport;
+    map-&gt;insert(std::make_pair(internalFormat, formatInfo));
+}
+
+static InternalFormatInfoMap BuildInternalFormatInfoMap()
+{
+    InternalFormatInfoMap map;
+
+    // From ES 3.0.1 spec, table 3.12
+    InsertFormatMapping(&amp;map, GL_NONE,              NeverSupported,       NeverSupported,       NeverSupported);
+
+    //                       | Internal format     | Texture support     | Render support     | Filter support      |
+    InsertFormatMapping(&amp;map, GL_R8,                UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R8_SNORM,          UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG8,               UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG8_SNORM,         UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB8,              AlwaysSupported,      AlwaysSupported,      AlwaysSupported     );
+    InsertFormatMapping(&amp;map, GL_RGB8_SNORM,        UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB565,            AlwaysSupported,      AlwaysSupported,      AlwaysSupported     );
+    InsertFormatMapping(&amp;map, GL_RGBA4,             AlwaysSupported,      AlwaysSupported,      AlwaysSupported     );
+    InsertFormatMapping(&amp;map, GL_RGB5_A1,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA8,             AlwaysSupported,      AlwaysSupported,      AlwaysSupported     );
+    InsertFormatMapping(&amp;map, GL_RGBA8_SNORM,       UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB10_A2,          UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB10_A2UI,        UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_SRGB8,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_SRGB8_ALPHA8,      UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R11F_G11F_B10F,    UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB9_E5,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R8I,               UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R8UI,              UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R16I,              UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R16UI,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R32I,              UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R32UI,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG8I,              UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG8UI,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG16I,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG16UI,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG32I,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG32UI,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB8I,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB8UI,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB16I,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB16UI,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB32I,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB32UI,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA8I,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA8UI,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA16I,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA16UI,          UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA32I,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA32UI,          UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    InsertFormatMapping(&amp;map, GL_BGRA8_EXT,         UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    // Floating point formats
+    //                       | Internal format     | Texture support     | Render support     | Filter support      |
+    InsertFormatMapping(&amp;map, GL_R16F,              UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG16F,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB16F,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA16F,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_R32F,              UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG32F,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB32F,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA32F,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    // Depth stencil formats
+    //                       | Internal format         | Texture support     | Render support     | Filter support      |
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT16,     AlwaysSupported,      AlwaysSupported,      NeverSupported      );
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT24,     UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT32F,    UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT32_OES, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_DEPTH24_STENCIL8,      UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_DEPTH32F_STENCIL8,     UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_STENCIL_INDEX8,        AlwaysSupported,      AlwaysSupported,      NeverSupported      );
+
+    // Luminance alpha formats
+    //                       | Internal format          | Texture support     | Render support     | Filter support      |
+    InsertFormatMapping(&amp;map, GL_ALPHA8_EXT,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE8_EXT,         UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_ALPHA32F_EXT,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE32F_EXT,       UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_ALPHA16F_EXT,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE16F_EXT,       UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE8_ALPHA8_EXT,  UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA32F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA16F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    // Unsized formats
+    //                       | Internal format   | Texture support     | Render support     | Filter support      |
+    InsertFormatMapping(&amp;map, GL_ALPHA,           UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE,       UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RED,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG,              UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB,             UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA,            UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RED_INTEGER,     UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RG_INTEGER,      UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,     UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,    UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_BGRA_EXT,        UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_DEPTH_STENCIL,   UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_SRGB_EXT,        UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_SRGB_ALPHA_EXT,  UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    // Compressed formats, From ES 3.0.1 spec, table 3.16
+    //                       | Internal format                             | Texture support     | Render support     | Filter support      |
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_R11_EAC,                        UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_SIGNED_R11_EAC,                 UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RG11_EAC,                       UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_SIGNED_RG11_EAC,                UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGB8_ETC2,                      UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_SRGB8_ETC2,                     UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA8_ETC2_EAC,                 UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    // From GL_EXT_texture_compression_dxt1
+    //                       | Internal format                   | Texture support     | Render support     | Filter support      |
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    // From GL_ANGLE_texture_compression_dxt3
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    // From GL_ANGLE_texture_compression_dxt5
+    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+
+    return map;
+}
+
+static const InternalFormatInfoMap &amp;GetInternalFormatMap()
+{
+    static const InternalFormatInfoMap formatMap = BuildInternalFormatInfoMap();
+    return formatMap;
+}
+
+const InternalFormat &amp;GetInternalFormatInfo(GLenum internalFormat)
+{
+    const InternalFormatInfoMap &amp;formatMap = GetInternalFormatMap();
+    InternalFormatInfoMap::const_iterator iter = formatMap.find(internalFormat);
+    if (iter != formatMap.end())
+    {
+        return iter-&gt;second;
+    }
+    else
+    {
+        static const InternalFormat defaultInternalFormat;
+        return defaultInternalFormat;
+    }
+}
+
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglformatutilsglh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/formatutilsgl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// formatutilsgl.h: Queries for GL image formats and their translations to native
+// GL formats.
+
+#ifndef LIBANGLE_RENDERER_GL_FORMATUTILSGL_H_
+#define LIBANGLE_RENDERER_GL_FORMATUTILSGL_H_
+
+#include &lt;string&gt;
+#include &lt;vector&gt;
+
+#include &quot;angle_gl.h&quot;
+
+namespace rx
+{
+
+namespace nativegl
+{
+
+struct InternalFormat
+{
+    InternalFormat();
+
+    typedef bool(*SupportCheckFunction)(GLuint majorVersion, GLuint minorVersion,
+                                        const std::vector&lt;std::string&gt; &amp;extensions);
+    SupportCheckFunction textureSupport;
+    SupportCheckFunction renderSupport;
+    SupportCheckFunction filterSupport;
+};
+const InternalFormat &amp;GetInternalFormatInfo(GLenum internalFormat);
+
+}
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_FORMATUTILSGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglfunctionsgl_enumsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_enums.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_enums.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_enums.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1374 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// functionsgl_enums.h: OpenGL enums for versions 1.0 through 4.5.
+
+#ifndef LIBANGLE_RENDERER_GL_FUNCTIONSGLENUMS_H_
+#define LIBANGLE_RENDERER_GL_FUNCTIONSGLENUMS_H_
+
+// 1.0
+#define GL_ALPHA 0x1906
+#define GL_ALWAYS 0x0207
+#define GL_AND 0x1501
+#define GL_AND_INVERTED 0x1504
+#define GL_AND_REVERSE 0x1502
+#define GL_BACK 0x0405
+#define GL_BACK_LEFT 0x0402
+#define GL_BACK_RIGHT 0x0403
+#define GL_BLEND 0x0BE2
+#define GL_BLEND_DST 0x0BE0
+#define GL_BLEND_SRC 0x0BE1
+#define GL_BLUE 0x1905
+#define GL_BYTE 0x1400
+#define GL_CCW 0x0901
+#define GL_CLEAR 0x1500
+#define GL_COLOR 0x1800
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_COPY 0x1503
+#define GL_COPY_INVERTED 0x150C
+#define GL_CULL_FACE 0x0B44
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_CW 0x0900
+#define GL_DECR 0x1E03
+#define GL_DEPTH 0x1801
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_TEST 0x0B71
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DITHER 0x0BD0
+#define GL_DONT_CARE 0x1100
+#define GL_DOUBLE 0x140A
+#define GL_DOUBLEBUFFER 0x0C32
+#define GL_DRAW_BUFFER 0x0C01
+#define GL_DST_ALPHA 0x0304
+#define GL_DST_COLOR 0x0306
+#define GL_EQUAL 0x0202
+#define GL_EQUIV 0x1509
+#define GL_EXTENSIONS 0x1F03
+#define GL_FALSE 0
+#define GL_FASTEST 0x1101
+#define GL_FILL 0x1B02
+#define GL_FLOAT 0x1406
+#define GL_FRONT 0x0404
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_FRONT_FACE 0x0B46
+#define GL_FRONT_LEFT 0x0400
+#define GL_FRONT_RIGHT 0x0401
+#define GL_GEQUAL 0x0206
+#define GL_GREATER 0x0204
+#define GL_GREEN 0x1904
+#define GL_INCR 0x1E02
+#define GL_INT 0x1404
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_OPERATION 0x0502
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVERT 0x150A
+#define GL_KEEP 0x1E00
+#define GL_LEFT 0x0406
+#define GL_LEQUAL 0x0203
+#define GL_LESS 0x0201
+#define GL_LINE 0x1B01
+#define GL_LINEAR 0x2601
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_LINE_STRIP 0x0003
+#define GL_LINE_WIDTH 0x0B21
+#define GL_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_LINE_WIDTH_RANGE 0x0B22
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_NAND 0x150E
+#define GL_NEAREST 0x2600
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_NEVER 0x0200
+#define GL_NICEST 0x1102
+#define GL_NONE 0
+#define GL_NOOP 0x1505
+#define GL_NOR 0x1508
+#define GL_NOTEQUAL 0x0205
+#define GL_NO_ERROR 0
+#define GL_ONE 1
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_OR 0x1507
+#define GL_OR_INVERTED 0x150D
+#define GL_OR_REVERSE 0x150B
+#define GL_OUT_OF_MEMORY 0x0505
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_PACK_LSB_FIRST 0x0D01
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SWAP_BYTES 0x0D00
+#define GL_POINT 0x1B00
+#define GL_POINTS 0x0000
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_POINT_SIZE_RANGE 0x0B12
+#define GL_POLYGON_MODE 0x0B40
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_POLYGON_OFFSET_LINE 0x2A02
+#define GL_POLYGON_OFFSET_POINT 0x2A01
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_SMOOTH 0x0B41
+#define GL_POLYGON_SMOOTH_HINT 0x0C53
+#define GL_PROXY_TEXTURE_1D 0x8063
+#define GL_PROXY_TEXTURE_2D 0x8064
+#define GL_QUADS 0x0007
+#define GL_R3_G3_B2 0x2A10
+#define GL_READ_BUFFER 0x0C02
+#define GL_RED 0x1903
+#define GL_RENDERER 0x1F01
+#define GL_REPEAT 0x2901
+#define GL_REPLACE 0x1E01
+#define GL_RGB 0x1907
+#define GL_RGB10 0x8052
+#define GL_RGB10_A2 0x8059
+#define GL_RGB12 0x8053
+#define GL_RGB16 0x8054
+#define GL_RGB4 0x804F
+#define GL_RGB5 0x8050
+#define GL_RGB5_A1 0x8057
+#define GL_RGB8 0x8051
+#define GL_RGBA 0x1908
+#define GL_RGBA12 0x805A
+#define GL_RGBA16 0x805B
+#define GL_RGBA2 0x8055
+#define GL_RGBA4 0x8056
+#define GL_RGBA8 0x8058
+#define GL_RIGHT 0x0407
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_SET 0x150F
+#define GL_SHORT 0x1402
+#define GL_SRC_ALPHA 0x0302
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_SRC_COLOR 0x0300
+#define GL_STENCIL 0x1802
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_INDEX 0x1901
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_TEST 0x0B90
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STEREO 0x0C33
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_TEXTURE 0x1702
+#define GL_TEXTURE_1D 0x0DE0
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_BINDING_1D 0x8068
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRUE 1
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_UNPACK_LSB_FIRST 0x0CF1
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SWAP_BYTES 0x0CF0
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_UNSIGNED_INT 0x1405
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_VENDOR 0x1F00
+#define GL_VERSION 0x1F02
+#define GL_VIEWPORT 0x0BA2
+#define GL_XOR 0x1506
+#define GL_ZERO 0
+
+// 1.2
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_BGR 0x80E0
+#define GL_BGRA 0x80E1
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_PACK_IMAGE_HEIGHT 0x806C
+#define GL_PACK_SKIP_IMAGES 0x806B
+#define GL_PROXY_TEXTURE_3D 0x8070
+#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
+#define GL_UNSIGNED_BYTE_3_3_2 0x8032
+#define GL_UNSIGNED_INT_10_10_10_2 0x8036
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_UNSIGNED_INT_8_8_8_8 0x8035
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+
+// 1.2 Extensions
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+
+// 1.3
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_CLAMP_TO_BORDER 0x812D
+#define GL_COMPRESSED_RGB 0x84ED
+#define GL_COMPRESSED_RGBA 0x84EE
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#define GL_MULTISAMPLE 0x809D
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
+#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+
+// 1.5
+#define GL_BLEND_COLOR 0x8005
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_DECR_WRAP 0x8508
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_DEPTH_COMPONENT32 0x81A7
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_INCR_WRAP 0x8507
+#define GL_MAX 0x8008
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_MIN 0x8007
+#define GL_MIRRORED_REPEAT 0x8370
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_LOD_BIAS 0x8501
+
+// 1.5
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_BUFFER_ACCESS 0x88BB
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_CURRENT_QUERY 0x8865
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_QUERY_COUNTER_BITS 0x8864
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_READ_ONLY 0x88B8
+#define GL_READ_WRITE 0x88BA
+#define GL_SAMPLES_PASSED 0x8914
+#define GL_SRC1_ALPHA 0x8589
+#define GL_STATIC_COPY 0x88E6
+#define GL_STATIC_DRAW 0x88E4
+#define GL_STATIC_READ 0x88E5
+#define GL_STREAM_COPY 0x88E2
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STREAM_READ 0x88E1
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#define GL_WRITE_ONLY 0x88B9
+
+// 2.0
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_DELETE_STATUS 0x8B80
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#define GL_DRAW_BUFFER10 0x882F
+#define GL_DRAW_BUFFER11 0x8830
+#define GL_DRAW_BUFFER12 0x8831
+#define GL_DRAW_BUFFER13 0x8832
+#define GL_DRAW_BUFFER14 0x8833
+#define GL_DRAW_BUFFER15 0x8834
+#define GL_DRAW_BUFFER2 0x8827
+#define GL_DRAW_BUFFER3 0x8828
+#define GL_DRAW_BUFFER4 0x8829
+#define GL_DRAW_BUFFER5 0x882A
+#define GL_DRAW_BUFFER6 0x882B
+#define GL_DRAW_BUFFER7 0x882C
+#define GL_DRAW_BUFFER8 0x882D
+#define GL_DRAW_BUFFER9 0x882E
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_LINK_STATUS 0x8B82
+#define GL_LOWER_LEFT 0x8CA1
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_VARYING_FLOATS 0x8B4B
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
+#define GL_SAMPLER_1D 0x8B5D
+#define GL_SAMPLER_1D_SHADOW 0x8B61
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_UPPER_LEFT 0x8CA2
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
+#define GL_VERTEX_SHADER 0x8B31
+
+// 2.1
+#define GL_COMPRESSED_SRGB 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_SRGB_ALPHA 0x8C42
+
+// 3.0
+#define GL_BGRA_INTEGER 0x8D9B
+#define GL_BGR_INTEGER 0x8D9A
+#define GL_BLUE_INTEGER 0x8D96
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_CLAMP_READ_COLOR 0x891C
+#define GL_CLIP_DISTANCE0 0x3000
+#define GL_CLIP_DISTANCE1 0x3001
+#define GL_CLIP_DISTANCE2 0x3002
+#define GL_CLIP_DISTANCE3 0x3003
+#define GL_CLIP_DISTANCE4 0x3004
+#define GL_CLIP_DISTANCE5 0x3005
+#define GL_CLIP_DISTANCE6 0x3006
+#define GL_CLIP_DISTANCE7 0x3007
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_COMPRESSED_RED 0x8225
+#define GL_COMPRESSED_RED_RGTC1 0x8DBB
+#define GL_COMPRESSED_RG 0x8226
+#define GL_COMPRESSED_RG_RGTC2 0x8DBD
+#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
+#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
+#define GL_CONTEXT_FLAGS 0x821E
+#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_FIXED_ONLY 0x891D
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
+#define GL_FRAMEBUFFER_SRGB 0x8DB9
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_GREEN_INTEGER 0x8D95
+#define GL_HALF_FLOAT 0x140B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_INT_SAMPLER_1D 0x8DC9
+#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MAX_CLIP_DISTANCES 0x0D32
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_MINOR_VERSION 0x821C
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_PRIMITIVES_GENERATED 0x8C87
+#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
+#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
+#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
+#define GL_QUERY_BY_REGION_WAIT 0x8E15
+#define GL_QUERY_NO_WAIT 0x8E14
+#define GL_QUERY_WAIT 0x8E13
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_R16 0x822A
+#define GL_R16F 0x822D
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32F 0x822E
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_R8 0x8229
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RED_INTEGER 0x8D94
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RG 0x8227
+#define GL_RG16 0x822C
+#define GL_RG16F 0x822F
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32F 0x8230
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_RG8 0x822B
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RGB16F 0x881B
+#define GL_RGB16I 0x8D89
+#define GL_RGB16UI 0x8D77
+#define GL_RGB32F 0x8815
+#define GL_RGB32I 0x8D83
+#define GL_RGB32UI 0x8D71
+#define GL_RGB8I 0x8D8F
+#define GL_RGB8UI 0x8D7D
+#define GL_RGB9_E5 0x8C3D
+#define GL_RGBA16F 0x881A
+#define GL_RGBA16I 0x8D88
+#define GL_RGBA16UI 0x8D76
+#define GL_RGBA32F 0x8814
+#define GL_RGBA32I 0x8D82
+#define GL_RGBA32UI 0x8D70
+#define GL_RGBA8I 0x8D8E
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RG_INTEGER 0x8228
+#define GL_SAMPLER_1D_ARRAY 0x8DC0
+#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_STENCIL_INDEX1 0x8D46
+#define GL_STENCIL_INDEX16 0x8D49
+#define GL_STENCIL_INDEX4 0x8D47
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_TEXTURE_1D_ARRAY 0x8C18
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_ALPHA_TYPE 0x8C13
+#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_TEXTURE_BLUE_TYPE 0x8C12
+#define GL_TEXTURE_DEPTH_TYPE 0x8C16
+#define GL_TEXTURE_GREEN_TYPE 0x8C11
+#define GL_TEXTURE_RED_TYPE 0x8C10
+#define GL_TEXTURE_SHARED_SIZE 0x8C3F
+#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1
+#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+
+// 3.1
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_INT_SAMPLER_2D_RECT 0x8DCD
+#define GL_INT_SAMPLER_BUFFER 0x8DD0
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
+#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_PRIMITIVE_RESTART 0x8F9D
+#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
+#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
+#define GL_R16_SNORM 0x8F98
+#define GL_R8_SNORM 0x8F94
+#define GL_RG16_SNORM 0x8F99
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB16_SNORM 0x8F9A
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA16_SNORM 0x8F9B
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_SAMPLER_2D_RECT 0x8B63
+#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
+#define GL_SAMPLER_BUFFER 0x8DC2
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
+#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
+#define GL_TEXTURE_BUFFER 0x8C2A
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
+
+// 3.2
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+#define GL_CONTEXT_PROFILE_MASK 0x9126
+#define GL_DEPTH_CLAMP 0x864F
+#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
+#define GL_GEOMETRY_INPUT_TYPE 0x8917
+#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
+#define GL_GEOMETRY_SHADER 0x8DD9
+#define GL_GEOMETRY_VERTICES_OUT 0x8916
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
+#define GL_LAST_VERTEX_CONVENTION 0x8E4E
+#define GL_LINES_ADJACENCY 0x000A
+#define GL_LINE_STRIP_ADJACENCY 0x000B
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_OBJECT_TYPE 0x9112
+#define GL_PROGRAM_POINT_SIZE 0x8642
+#define GL_PROVOKING_VERTEX 0x8E4F
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SIGNALED 0x9119
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_SYNC_STATUS 0x9114
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
+#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#define GL_TRIANGLES_ADJACENCY 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
+#define GL_UNSIGNALED 0x9118
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
+#define GL_WAIT_FAILED 0x911D
+
+// 3.3
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
+#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
+#define GL_ONE_MINUS_SRC1_COLOR 0x88FA
+#define GL_RGB10_A2UI 0x906F
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_SRC1_COLOR 0x88F9
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
+#define GL_TIMESTAMP 0x8E28
+#define GL_TIME_ELAPSED 0x88BF
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+
+// 4.0
+#define GL_ACTIVE_SUBROUTINES 0x8DE5
+#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48
+#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
+#define GL_COMPATIBLE_SUBROUTINES 0x8E4B
+#define GL_DOUBLE_MAT2 0x8F46
+#define GL_DOUBLE_MAT2x3 0x8F49
+#define GL_DOUBLE_MAT2x4 0x8F4A
+#define GL_DOUBLE_MAT3 0x8F47
+#define GL_DOUBLE_MAT3x2 0x8F4B
+#define GL_DOUBLE_MAT3x4 0x8F4C
+#define GL_DOUBLE_MAT4 0x8F48
+#define GL_DOUBLE_MAT4x2 0x8F4D
+#define GL_DOUBLE_MAT4x3 0x8F4E
+#define GL_DOUBLE_VEC2 0x8FFC
+#define GL_DOUBLE_VEC3 0x8FFD
+#define GL_DOUBLE_VEC4 0x8FFE
+#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
+#define GL_FRACTIONAL_EVEN 0x8E7C
+#define GL_FRACTIONAL_ODD 0x8E7B
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
+#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
+#define GL_ISOLINES 0x8E7A
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
+#define GL_MAX_PATCH_VERTICES 0x8E7D
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_MAX_SUBROUTINES 0x8DE7
+#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
+#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
+#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
+#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
+#define GL_MAX_VERTEX_STREAMS 0x8E71
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
+#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A
+#define GL_PATCHES 0x000E
+#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
+#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
+#define GL_PATCH_VERTICES 0x8E72
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B
+#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
+#define GL_SAMPLE_SHADING 0x8C36
+#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
+#define GL_TESS_CONTROL_SHADER 0x8E88
+#define GL_TESS_EVALUATION_SHADER 0x8E87
+#define GL_TESS_GEN_MODE 0x8E76
+#define GL_TESS_GEN_POINT_MODE 0x8E79
+#define GL_TESS_GEN_SPACING 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
+#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
+
+// 4.1
+#define GL_ACTIVE_PROGRAM 0x8259
+#define GL_ALL_SHADER_BITS 0xFFFFFFFF
+#define GL_FIXED 0x140C
+#define GL_FRAGMENT_SHADER_BIT 0x00000002
+#define GL_GEOMETRY_SHADER_BIT 0x00000004
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_HIGH_INT 0x8DF5
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_LAYER_PROVOKING_VERTEX 0x825E
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_LOW_INT 0x8DF3
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VIEWPORTS 0x825B
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_PIPELINE_BINDING 0x825A
+#define GL_PROGRAM_SEPARABLE 0x8258
+#define GL_RGB565 0x8D62
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_TESS_CONTROL_SHADER_BIT 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010
+#define GL_UNDEFINED_VERTEX 0x8260
+#define GL_VERTEX_SHADER_BIT 0x00000001
+#define GL_VIEWPORT_BOUNDS_RANGE 0x825D
+#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
+#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C
+
+// 4.2
+#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
+#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
+#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
+#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
+#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
+#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
+#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
+#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
+#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
+#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
+#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
+#define GL_COMMAND_BARRIER_BIT 0x00000040
+#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C
+#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E
+#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
+#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D
+#define GL_COPY_READ_BUFFER_BINDING GL_COPY_READ_BUFFER
+#define GL_COPY_WRITE_BUFFER_BINDING GL_COPY_WRITE_BUFFER
+#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
+#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
+#define GL_IMAGE_1D 0x904C
+#define GL_IMAGE_1D_ARRAY 0x9052
+#define GL_IMAGE_2D 0x904D
+#define GL_IMAGE_2D_ARRAY 0x9053
+#define GL_IMAGE_2D_MULTISAMPLE 0x9055
+#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
+#define GL_IMAGE_2D_RECT 0x904F
+#define GL_IMAGE_3D 0x904E
+#define GL_IMAGE_BINDING_ACCESS 0x8F3E
+#define GL_IMAGE_BINDING_FORMAT 0x906E
+#define GL_IMAGE_BINDING_LAYER 0x8F3D
+#define GL_IMAGE_BINDING_LAYERED 0x8F3C
+#define GL_IMAGE_BINDING_LEVEL 0x8F3B
+#define GL_IMAGE_BINDING_NAME 0x8F3A
+#define GL_IMAGE_BUFFER 0x9051
+#define GL_IMAGE_CUBE 0x9050
+#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
+#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
+#define GL_INT_IMAGE_1D 0x9057
+#define GL_INT_IMAGE_1D_ARRAY 0x905D
+#define GL_INT_IMAGE_2D 0x9058
+#define GL_INT_IMAGE_2D_ARRAY 0x905E
+#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
+#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
+#define GL_INT_IMAGE_2D_RECT 0x905A
+#define GL_INT_IMAGE_3D 0x9059
+#define GL_INT_IMAGE_BUFFER 0x905C
+#define GL_INT_IMAGE_CUBE 0x905B
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
+#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
+#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
+#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
+#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
+#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
+#define GL_MAX_IMAGE_SAMPLES 0x906D
+#define GL_MAX_IMAGE_UNITS 0x8F38
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
+#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
+#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
+#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
+#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D
+#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C
+#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E
+#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B
+#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
+#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
+#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
+#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
+#define GL_UNIFORM_BARRIER_BIT 0x00000004
+#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129
+#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
+#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A
+#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
+#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
+#define GL_UNSIGNED_INT_IMAGE_1D 0x9062
+#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
+#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
+#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
+#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
+#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
+#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
+
+// 4.3
+#define GL_ACTIVE_RESOURCES 0x92F5
+#define GL_ACTIVE_VARIABLES 0x9305
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_ARRAY_SIZE 0x92FB
+#define GL_ARRAY_STRIDE 0x92FE
+#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED
+#define GL_AUTO_GENERATE_MIPMAP 0x8295
+#define GL_BLOCK_INDEX 0x92FD
+#define GL_BUFFER 0x82E0
+#define GL_BUFFER_BINDING 0x9302
+#define GL_BUFFER_DATA_SIZE 0x9303
+#define GL_BUFFER_VARIABLE 0x92E5
+#define GL_CAVEAT_SUPPORT 0x82B8
+#define GL_CLEAR_BUFFER 0x82B4
+#define GL_COLOR_COMPONENTS 0x8283
+#define GL_COLOR_ENCODING 0x8296
+#define GL_COLOR_RENDERABLE 0x8286
+#define GL_COMPRESSED_R11_EAC 0x9270
+#define GL_COMPRESSED_RG11_EAC 0x9272
+#define GL_COMPRESSED_RGB8_ETC2 0x9274
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
+#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
+#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_COMPRESSED_SRGB8_ETC2 0x9275
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPUTE_SHADER 0x91B9
+#define GL_COMPUTE_SHADER_BIT 0x00000020
+#define GL_COMPUTE_SUBROUTINE 0x92ED
+#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3
+#define GL_COMPUTE_TEXTURE 0x82A0
+#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
+#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
+#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
+#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
+#define GL_DEBUG_LOGGED_MESSAGES 0x9145
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
+#define GL_DEBUG_OUTPUT 0x92E0
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
+#define GL_DEBUG_SEVERITY_HIGH 0x9146
+#define GL_DEBUG_SEVERITY_LOW 0x9148
+#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
+#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
+#define GL_DEBUG_SOURCE_API 0x8246
+#define GL_DEBUG_SOURCE_APPLICATION 0x824A
+#define GL_DEBUG_SOURCE_OTHER 0x824B
+#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
+#define GL_DEBUG_TYPE_ERROR 0x824C
+#define GL_DEBUG_TYPE_MARKER 0x8268
+#define GL_DEBUG_TYPE_OTHER 0x8251
+#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
+#define GL_DEBUG_TYPE_POP_GROUP 0x826A
+#define GL_DEBUG_TYPE_PORTABILITY 0x824F
+#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
+#define GL_DEPTH_COMPONENTS 0x8284
+#define GL_DEPTH_RENDERABLE 0x8287
+#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
+#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
+#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
+#define GL_FILTER 0x829A
+#define GL_FRAGMENT_SUBROUTINE 0x92EC
+#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2
+#define GL_FRAGMENT_TEXTURE 0x829F
+#define GL_FRAMEBUFFER_BLEND 0x828B
+#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
+#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312
+#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
+#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
+#define GL_FRAMEBUFFER_RENDERABLE 0x8289
+#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A
+#define GL_FULL_SUPPORT 0x82B7
+#define GL_GEOMETRY_SUBROUTINE 0x92EB
+#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1
+#define GL_GEOMETRY_TEXTURE 0x829E
+#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291
+#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292
+#define GL_IMAGE_CLASS_10_10_10_2 0x82C3
+#define GL_IMAGE_CLASS_11_11_10 0x82C2
+#define GL_IMAGE_CLASS_1_X_16 0x82BE
+#define GL_IMAGE_CLASS_1_X_32 0x82BB
+#define GL_IMAGE_CLASS_1_X_8 0x82C1
+#define GL_IMAGE_CLASS_2_X_16 0x82BD
+#define GL_IMAGE_CLASS_2_X_32 0x82BA
+#define GL_IMAGE_CLASS_2_X_8 0x82C0
+#define GL_IMAGE_CLASS_4_X_16 0x82BC
+#define GL_IMAGE_CLASS_4_X_32 0x82B9
+#define GL_IMAGE_CLASS_4_X_8 0x82BF
+#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8
+#define GL_IMAGE_PIXEL_FORMAT 0x82A9
+#define GL_IMAGE_PIXEL_TYPE 0x82AA
+#define GL_IMAGE_TEXEL_SIZE 0x82A7
+#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274
+#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B
+#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273
+#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A
+#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275
+#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C
+#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272
+#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279
+#define GL_INTERNALFORMAT_PREFERRED 0x8270
+#define GL_INTERNALFORMAT_RED_SIZE 0x8271
+#define GL_INTERNALFORMAT_RED_TYPE 0x8278
+#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277
+#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276
+#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D
+#define GL_INTERNALFORMAT_SUPPORTED 0x826F
+#define GL_IS_PER_PATCH 0x92E7
+#define GL_IS_ROW_MAJOR 0x9300
+#define GL_LOCATION 0x930E
+#define GL_LOCATION_INDEX 0x930F
+#define GL_MANUAL_GENERATE_MIPMAP 0x8294
+#define GL_MATRIX_STRIDE 0x92FF
+#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
+#define GL_MAX_COMBINED_DIMENSIONS 0x8282
+#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
+#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
+#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
+#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
+#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
+#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
+#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
+#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
+#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
+#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
+#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
+#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
+#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
+#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
+#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
+#define GL_MAX_DEPTH 0x8280
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
+#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
+#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317
+#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
+#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
+#define GL_MAX_HEIGHT 0x827F
+#define GL_MAX_LABEL_LENGTH 0x82E8
+#define GL_MAX_LAYERS 0x8281
+#define GL_MAX_NAME_LENGTH 0x92F6
+#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
+#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
+#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
+#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
+#define GL_MAX_UNIFORM_LOCATIONS 0x826E
+#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
+#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
+#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
+#define GL_MAX_WIDTH 0x827E
+#define GL_MIPMAP 0x8293
+#define GL_NAME_LENGTH 0x92F9
+#define GL_NUM_ACTIVE_VARIABLES 0x9304
+#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9
+#define GL_OFFSET 0x92FC
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_PROGRAM 0x82E2
+#define GL_PROGRAM_INPUT 0x92E3
+#define GL_PROGRAM_OUTPUT 0x92E4
+#define GL_PROGRAM_PIPELINE 0x82E4
+#define GL_QUERY 0x82E3
+#define GL_READ_PIXELS 0x828C
+#define GL_READ_PIXELS_FORMAT 0x828D
+#define GL_READ_PIXELS_TYPE 0x828E
+#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
+#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
+#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
+#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
+#define GL_SAMPLER 0x82E6
+#define GL_SHADER 0x82E1
+#define GL_SHADER_IMAGE_ATOMIC 0x82A6
+#define GL_SHADER_IMAGE_LOAD 0x82A4
+#define GL_SHADER_IMAGE_STORE 0x82A5
+#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
+#define GL_SHADER_STORAGE_BLOCK 0x92E6
+#define GL_SHADER_STORAGE_BUFFER 0x90D2
+#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
+#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
+#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
+#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
+#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC
+#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE
+#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD
+#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF
+#define GL_SRGB_READ 0x8297
+#define GL_SRGB_WRITE 0x8298
+#define GL_STENCIL_COMPONENTS 0x8285
+#define GL_STENCIL_RENDERABLE 0x8288
+#define GL_TESS_CONTROL_SUBROUTINE 0x92E9
+#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF
+#define GL_TESS_CONTROL_TEXTURE 0x829C
+#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA
+#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0
+#define GL_TESS_EVALUATION_TEXTURE 0x829D
+#define GL_TEXTURE_BUFFER_OFFSET 0x919D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
+#define GL_TEXTURE_BUFFER_SIZE 0x919E
+#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2
+#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3
+#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1
+#define GL_TEXTURE_GATHER 0x82A2
+#define GL_TEXTURE_GATHER_SHADOW 0x82A3
+#define GL_TEXTURE_IMAGE_FORMAT 0x828F
+#define GL_TEXTURE_IMAGE_TYPE 0x8290
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+#define GL_TEXTURE_SHADOW 0x82A1
+#define GL_TEXTURE_VIEW 0x82B5
+#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD
+#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB
+#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE
+#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC
+#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
+#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
+#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
+#define GL_TYPE 0x92FA
+#define GL_UNIFORM 0x92E1
+#define GL_UNIFORM_BLOCK 0x92E2
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC
+#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E
+#define GL_VERTEX_ATTRIB_BINDING 0x82D4
+#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
+#define GL_VERTEX_BINDING_BUFFER 0x8F4F
+#define GL_VERTEX_BINDING_DIVISOR 0x82D6
+#define GL_VERTEX_BINDING_OFFSET 0x82D7
+#define GL_VERTEX_BINDING_STRIDE 0x82D8
+#define GL_VERTEX_SUBROUTINE 0x92E8
+#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE
+#define GL_VERTEX_TEXTURE 0x829B
+#define GL_VIEW_CLASS_128_BITS 0x82C4
+#define GL_VIEW_CLASS_16_BITS 0x82CA
+#define GL_VIEW_CLASS_24_BITS 0x82C9
+#define GL_VIEW_CLASS_32_BITS 0x82C8
+#define GL_VIEW_CLASS_48_BITS 0x82C7
+#define GL_VIEW_CLASS_64_BITS 0x82C6
+#define GL_VIEW_CLASS_8_BITS 0x82CB
+#define GL_VIEW_CLASS_96_BITS 0x82C5
+#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3
+#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2
+#define GL_VIEW_CLASS_RGTC1_RED 0x82D0
+#define GL_VIEW_CLASS_RGTC2_RG 0x82D1
+#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC
+#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD
+#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE
+#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF
+#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6
+
+// 4.4
+#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F
+#define GL_BUFFER_STORAGE_FLAGS 0x8220
+#define GL_CLEAR_TEXTURE 0x9365
+#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000
+#define GL_CLIENT_STORAGE_BIT 0x0200
+#define GL_DYNAMIC_STORAGE_BIT 0x0100
+#define GL_LOCATION_COMPONENT 0x934A
+#define GL_MAP_COHERENT_BIT 0x0080
+#define GL_MAP_PERSISTENT_BIT 0x0040
+#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
+#define GL_MIRROR_CLAMP_TO_EDGE 0x8743
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
+#define GL_QUERY_BUFFER 0x9192
+#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000
+#define GL_QUERY_BUFFER_BINDING 0x9193
+#define GL_QUERY_RESULT_NO_WAIT 0x9194
+#define GL_TEXTURE_BUFFER_BINDING 0x8C2A
+#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B
+#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C
+
+// 4.5
+#define GL_CLIP_DEPTH_MODE 0x935D
+#define GL_CLIP_ORIGIN 0x935C
+#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004
+#define GL_CONTEXT_LOST 0x0507
+#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB
+#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC
+#define GL_GUILTY_CONTEXT_RESET 0x8253
+#define GL_INNOCENT_CONTEXT_RESET 0x8254
+#define GL_LOSE_CONTEXT_ON_RESET 0x8252
+#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA
+#define GL_MAX_CULL_DISTANCES 0x82F9
+#define GL_NEGATIVE_ONE_TO_ONE 0x935E
+#define GL_NO_RESET_NOTIFICATION 0x8261
+#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A
+#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19
+#define GL_QUERY_NO_WAIT_INVERTED 0x8E18
+#define GL_QUERY_TARGET 0x82EA
+#define GL_QUERY_WAIT_INVERTED 0x8E17
+#define GL_RESET_NOTIFICATION_STRATEGY 0x8256
+#define GL_TEXTURE_TARGET 0x1006
+#define GL_UNKNOWN_CONTEXT_RESET 0x8255
+#define GL_ZERO_TO_ONE 0x935F
+
+#endif // LIBANGLE_RENDERER_GL_FUNCTIONSGLENUMS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglfunctionsgl_typedefsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_typedefs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_typedefs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/functionsgl_typedefs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,754 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// functionsgl_typedefs.h: Typedefs of OpenGL types and functions for versions 1.0 through 4.5.
+
+#ifndef LIBANGLE_RENDERER_GL_FUNCTIONSGLTYPEDEFS_H_
+#define LIBANGLE_RENDERER_GL_FUNCTIONSGLTYPEDEFS_H_
+
+#include &quot;common/platform.h&quot;
+
+#include &lt;KHR/khrplatform.h&gt;
+#include &lt;stdint.h&gt;
+
+#ifndef INTERNAL_GL_APIENTRY
+#   ifdef ANGLE_PLATFORM_WINDOWS
+#       define INTERNAL_GL_APIENTRY __stdcall
+#   else
+#       define INTERNAL_GL_APIENTRY
+#   endif
+#endif
+
+typedef void             GLvoid;
+typedef char             GLchar;
+typedef unsigned int     GLenum;
+typedef unsigned char    GLboolean;
+typedef unsigned int     GLbitfield;
+typedef khronos_int8_t   GLbyte;
+typedef short            GLshort;
+typedef int              GLint;
+typedef int              GLsizei;
+typedef khronos_uint8_t  GLubyte;
+typedef unsigned short   GLushort;
+typedef unsigned int     GLuint;
+typedef khronos_float_t  GLfloat;
+typedef khronos_float_t  GLclampf;
+typedef double           GLdouble;
+typedef double           GLclampd;
+typedef khronos_int32_t  GLfixed;
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t  GLsizeiptr;
+typedef unsigned short   GLhalf;
+typedef khronos_int64_t  GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+namespace rx
+{
+typedef void (INTERNAL_GL_APIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam);
+typedef void (INTERNAL_GL_APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam);
+typedef void (INTERNAL_GL_APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar *message, void *userParam);
+
+// 1.0
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDFUNCPROC)(GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARPROC)(GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARCOLORPROC)(GLfloat, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARDEPTHPROC)(GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARSTENCILPROC)(GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOLORMASKPROC)(GLboolean, GLboolean, GLboolean, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCULLFACEPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEPTHFUNCPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEPTHMASKPROC)(GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEPTHRANGEPROC)(GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDISABLEPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWBUFFERPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENABLEPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFINISHPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFLUSHPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRONTFACEPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETBOOLEANVPROC)(GLenum, GLboolean *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETDOUBLEVPROC)(GLenum, GLdouble *);
+typedef GLenum (INTERNAL_GL_APIENTRY *PFNGLGETERRORPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETFLOATVPROC)(GLenum, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETINTEGERVPROC)(GLenum, GLint *);
+typedef const GLubyte * (INTERNAL_GL_APIENTRY *PFNGLGETSTRINGPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXIMAGEPROC)(GLenum, GLint, GLenum, GLenum, GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum, GLint, GLenum, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum, GLint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXPARAMETERFVPROC)(GLenum, GLenum, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXPARAMETERIVPROC)(GLenum, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLHINTPROC)(GLenum, GLenum);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISENABLEDPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLLINEWIDTHPROC)(GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLLOGICOPPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPIXELSTOREFPROC)(GLenum, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPIXELSTOREIPROC)(GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOINTSIZEPROC)(GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOLYGONMODEPROC)(GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLREADBUFFERPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLREADPIXELSPROC)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSCISSORPROC)(GLint, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSTENCILFUNCPROC)(GLenum, GLint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSTENCILMASKPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSTENCILOPPROC)(GLenum, GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXIMAGE1DPROC)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXIMAGE2DPROC)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXPARAMETERFPROC)(GLenum, GLenum, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXPARAMETERFVPROC)(GLenum, GLenum, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXPARAMETERIPROC)(GLenum, GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXPARAMETERIVPROC)(GLenum, GLenum, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVIEWPORTPROC)(GLint, GLint, GLsizei, GLsizei);
+
+// 1.1
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDTEXTUREPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXIMAGE1DPROC)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXIMAGE2DPROC)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETETEXTURESPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWARRAYSPROC)(GLenum, GLint, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWELEMENTSPROC)(GLenum, GLsizei, GLenum, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENTEXTURESPROC)(GLsizei, GLuint *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISTEXTUREPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOLYGONOFFSETPROC)(GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSUBIMAGE1DPROC)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSUBIMAGE2DPROC)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+
+// 1.2
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDCOLORPROC)(GLfloat, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDEQUATIONPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWRANGEELEMENTSPROC)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXIMAGE3DPROC)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSUBIMAGE3DPROC)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+
+// 1.2 Extensions
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETEFENCESNVPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENFENCESNVPROC)(GLsizei, GLuint *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISFENCENVPROC)(GLuint);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLTESTFENCENVPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETFENCEIVNVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFINISHFENCENVPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSETFENCENVPROC)(GLuint, GLenum);
+
+// 1.3
+typedef void (INTERNAL_GL_APIENTRY *PFNGLACTIVETEXTUREPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum, GLint, GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLECOVERAGEPROC)(GLfloat, GLboolean);
+
+// 1.4
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDFUNCSEPARATEPROC)(GLenum, GLenum, GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMULTIDRAWARRAYSPROC)(GLenum, const GLint *, const GLsizei *, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMULTIDRAWELEMENTSPROC)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOINTPARAMETERFPROC)(GLenum, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOINTPARAMETERFVPROC)(GLenum, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOINTPARAMETERIPROC)(GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOINTPARAMETERIVPROC)(GLenum, const GLint *);
+
+// 1.5
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBEGINQUERYPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDBUFFERPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBUFFERDATAPROC)(GLenum, GLsizeiptr, const GLvoid *, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBUFFERSUBDATAPROC)(GLenum, GLintptr, GLsizeiptr, const GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETEBUFFERSPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETEQUERIESPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENDQUERYPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENBUFFERSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENQUERIESPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETBUFFERPOINTERVPROC)(GLenum, GLenum, GLvoid **);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETBUFFERSUBDATAPROC)(GLenum, GLintptr, GLsizeiptr, GLvoid *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYOBJECTIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYOBJECTUIVPROC)(GLuint, GLenum, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYIVPROC)(GLenum, GLenum, GLint *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISBUFFERPROC)(GLuint);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISQUERYPROC)(GLuint);
+typedef void * (INTERNAL_GL_APIENTRY *PFNGLMAPBUFFERPROC)(GLenum, GLenum);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLUNMAPBUFFERPROC)(GLenum);
+
+// 2.0
+typedef void (INTERNAL_GL_APIENTRY *PFNGLATTACHSHADERPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDATTRIBLOCATIONPROC)(GLuint, GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPILESHADERPROC)(GLuint);
+typedef GLuint (INTERNAL_GL_APIENTRY *PFNGLCREATEPROGRAMPROC)();
+typedef GLuint (INTERNAL_GL_APIENTRY *PFNGLCREATESHADERPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETEPROGRAMPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETESHADERPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDETACHSHADERPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWBUFFERSPROC)(GLsizei, const GLenum *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVEATTRIBPROC)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVEUNIFORMPROC)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETATTACHEDSHADERSPROC)(GLuint, GLsizei, GLsizei *, GLuint *);
+typedef GLint (INTERNAL_GL_APIENTRY *PFNGLGETATTRIBLOCATIONPROC)(GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMINFOLOGPROC)(GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSHADERINFOLOGPROC)(GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSHADERSOURCEPROC)(GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSHADERIVPROC)(GLuint, GLenum, GLint *);
+typedef GLint (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMLOCATIONPROC)(GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMFVPROC)(GLuint, GLint, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMIVPROC)(GLuint, GLint, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint, GLenum, GLvoid **);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint, GLenum, GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXATTRIBFVPROC)(GLuint, GLenum, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXATTRIBIVPROC)(GLuint, GLenum, GLint *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISPROGRAMPROC)(GLuint);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISSHADERPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLLINKPROGRAMPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSHADERSOURCEPROC)(GLuint, GLsizei, const GLchar *const*, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum, GLenum, GLint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSTENCILMASKSEPARATEPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSTENCILOPSEPARATEPROC)(GLenum, GLenum, GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1FPROC)(GLint, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1FVPROC)(GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1IPROC)(GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1IVPROC)(GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2FPROC)(GLint, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2FVPROC)(GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2IPROC)(GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2IVPROC)(GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3FPROC)(GLint, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3FVPROC)(GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3IPROC)(GLint, GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3IVPROC)(GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4FPROC)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4FVPROC)(GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4IPROC)(GLint, GLint, GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4IVPROC)(GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX2FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX3FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX4FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUSEPROGRAMPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVALIDATEPROGRAMPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB1DPROC)(GLuint, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB1DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB1FPROC)(GLuint, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB1FVPROC)(GLuint, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB1SPROC)(GLuint, GLshort);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB1SVPROC)(GLuint, const GLshort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB2DPROC)(GLuint, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB2DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB2FPROC)(GLuint, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB2FVPROC)(GLuint, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB2SPROC)(GLuint, GLshort, GLshort);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB2SVPROC)(GLuint, const GLshort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB3DPROC)(GLuint, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB3DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB3FPROC)(GLuint, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB3FVPROC)(GLuint, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB3SPROC)(GLuint, GLshort, GLshort, GLshort);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB3SVPROC)(GLuint, const GLshort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4NBVPROC)(GLuint, const GLbyte *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4NIVPROC)(GLuint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4NSVPROC)(GLuint, const GLshort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4NUBPROC)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4NUBVPROC)(GLuint, const GLubyte *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4NUIVPROC)(GLuint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4NUSVPROC)(GLuint, const GLushort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4BVPROC)(GLuint, const GLbyte *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4DPROC)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4FPROC)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4FVPROC)(GLuint, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4IVPROC)(GLuint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4SPROC)(GLuint, GLshort, GLshort, GLshort, GLshort);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4SVPROC)(GLuint, const GLshort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4UBVPROC)(GLuint, const GLubyte *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4UIVPROC)(GLuint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIB4USVPROC)(GLuint, const GLushort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
+
+// 2.1
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX2X3FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX2X4FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX3X2FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX3X4FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX4X2FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX4X3FVPROC)(GLint, GLsizei, GLboolean, const GLfloat *);
+
+// 3.0
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBEGINCONDITIONALRENDERPROC)(GLuint, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDBUFFERBASEPROC)(GLenum, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDBUFFERRANGEPROC)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDFRAGDATALOCATIONPROC)(GLuint, GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDFRAMEBUFFERPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDRENDERBUFFERPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDVERTEXARRAYPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLITFRAMEBUFFERPROC)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+typedef GLenum (INTERNAL_GL_APIENTRY *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLAMPCOLORPROC)(GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARBUFFERFIPROC)(GLenum, GLint, GLfloat, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARBUFFERFVPROC)(GLenum, GLint, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARBUFFERIVPROC)(GLenum, GLint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARBUFFERUIVPROC)(GLenum, GLint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOLORMASKIPROC)(GLuint, GLboolean, GLboolean, GLboolean, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETERENDERBUFFERSPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETEVERTEXARRAYSPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDISABLEIPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENABLEIPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENDCONDITIONALRENDERPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENDTRANSFORMFEEDBACKPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum, GLenum, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum, GLenum, GLenum, GLuint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum, GLenum, GLenum, GLuint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum, GLenum, GLenum, GLuint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum, GLenum, GLuint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENFRAMEBUFFERSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENRENDERBUFFERSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENVERTEXARRAYSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENERATEMIPMAPPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETBOOLEANI_VPROC)(GLenum, GLuint, GLboolean *);
+typedef GLint (INTERNAL_GL_APIENTRY *PFNGLGETFRAGDATALOCATIONPROC)(GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum, GLenum, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETINTEGERI_VPROC)(GLenum, GLuint, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum, GLenum, GLint *);
+typedef const GLubyte * (INTERNAL_GL_APIENTRY *PFNGLGETSTRINGIPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXPARAMETERIIVPROC)(GLenum, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXPARAMETERIUIVPROC)(GLenum, GLenum, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMUIVPROC)(GLuint, GLint, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXATTRIBIIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint, GLenum, GLuint *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISENABLEDIPROC)(GLenum, GLuint);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISFRAMEBUFFERPROC)(GLuint);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISRENDERBUFFERPROC)(GLuint);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISVERTEXARRAYPROC)(GLuint);
+typedef void * (INTERNAL_GL_APIENTRY *PFNGLMAPBUFFERRANGEPROC)(GLenum, GLintptr, GLsizeiptr, GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum, GLenum, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXPARAMETERIIVPROC)(GLenum, GLenum, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXPARAMETERIUIVPROC)(GLenum, GLenum, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint, GLsizei, const GLchar *const*, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1UIPROC)(GLint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1UIVPROC)(GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2UIPROC)(GLint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2UIVPROC)(GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3UIPROC)(GLint, GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3UIVPROC)(GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4UIPROC)(GLint, GLuint, GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4UIVPROC)(GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI1IPROC)(GLuint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI1IVPROC)(GLuint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI1UIPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI1UIVPROC)(GLuint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI2IPROC)(GLuint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI2IVPROC)(GLuint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI2UIPROC)(GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI2UIVPROC)(GLuint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI3IPROC)(GLuint, GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI3IVPROC)(GLuint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI3UIPROC)(GLuint, GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI3UIVPROC)(GLuint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4BVPROC)(GLuint, const GLbyte *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4IPROC)(GLuint, GLint, GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4IVPROC)(GLuint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4SVPROC)(GLuint, const GLshort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4UBVPROC)(GLuint, const GLubyte *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4UIPROC)(GLuint, GLuint, GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4UIVPROC)(GLuint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBI4USVPROC)(GLuint, const GLushort *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint, GLint, GLenum, GLsizei, const GLvoid *);
+
+// 3.1
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYBUFFERSUBDATAPROC)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint, GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint, GLsizei, const GLuint *, GLenum, GLint *);
+typedef GLuint (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMINDICESPROC)(GLuint, GLsizei, const GLchar *const*, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXBUFFERPROC)(GLenum, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint, GLuint, GLuint);
+
+// 3.2
+typedef GLenum (INTERNAL_GL_APIENTRY *PFNGLCLIENTWAITSYNCPROC)(GLsync, GLbitfield, GLuint64);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETESYNCPROC)(GLsync);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum, GLsizei, GLenum, const GLvoid *, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint);
+typedef GLsync (INTERNAL_GL_APIENTRY *PFNGLFENCESYNCPROC)(GLenum, GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum, GLenum, GLuint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum, GLenum, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETINTEGER64I_VPROC)(GLenum, GLuint, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETINTEGER64VPROC)(GLenum, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETMULTISAMPLEFVPROC)(GLenum, GLuint, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSYNCIVPROC)(GLsync, GLenum, GLsizei, GLsizei *, GLint *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISSYNCPROC)(GLsync);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum, const GLsizei *, GLenum, const GLvoid *const*, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROVOKINGVERTEXPROC)(GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLEMASKIPROC)(GLuint, GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLWAITSYNCPROC)(GLsync, GLbitfield, GLuint64);
+
+// 3.3
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint, GLuint, GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDSAMPLERPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETESAMPLERSPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENSAMPLERSPROC)(GLsizei, GLuint *);
+typedef GLint (INTERNAL_GL_APIENTRY *PFNGLGETFRAGDATAINDEXPROC)(GLuint, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYOBJECTI64VPROC)(GLuint, GLenum, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYOBJECTUI64VPROC)(GLuint, GLenum, GLuint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint, GLenum, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint, GLenum, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint, GLenum, GLint *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISSAMPLERPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLQUERYCOUNTERPROC)(GLuint, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLERPARAMETERIIVPROC)(GLuint, GLenum, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint, GLenum, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLERPARAMETERFPROC)(GLuint, GLenum, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLERPARAMETERFVPROC)(GLuint, GLenum, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLERPARAMETERIPROC)(GLuint, GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSAMPLERPARAMETERIVPROC)(GLuint, GLenum, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBDIVISORPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP1UIPROC)(GLuint, GLenum, GLboolean, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP1UIVPROC)(GLuint, GLenum, GLboolean, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP2UIPROC)(GLuint, GLenum, GLboolean, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP2UIVPROC)(GLuint, GLenum, GLboolean, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP3UIPROC)(GLuint, GLenum, GLboolean, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP3UIVPROC)(GLuint, GLenum, GLboolean, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP4UIPROC)(GLuint, GLenum, GLboolean, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBP4UIVPROC)(GLuint, GLenum, GLboolean, const GLuint *);
+
+// 4.0
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBEGINQUERYINDEXEDPROC)(GLenum, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDTRANSFORMFEEDBACKPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDEQUATIONSEPARATEIPROC)(GLuint, GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDEQUATIONIPROC)(GLuint, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDFUNCSEPARATEIPROC)(GLuint, GLenum, GLenum, GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLENDFUNCIPROC)(GLuint, GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETETRANSFORMFEEDBACKSPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWARRAYSINDIRECTPROC)(GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWELEMENTSINDIRECTPROC)(GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWTRANSFORMFEEDBACKPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)(GLenum, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENDQUERYINDEXEDPROC)(GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENTRANSFORMFEEDBACKSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVESUBROUTINENAMEPROC)(GLuint, GLenum, GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)(GLuint, GLenum, GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)(GLuint, GLenum, GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMSTAGEIVPROC)(GLuint, GLenum, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYINDEXEDIVPROC)(GLenum, GLuint, GLenum, GLint *);
+typedef GLuint (INTERNAL_GL_APIENTRY *PFNGLGETSUBROUTINEINDEXPROC)(GLuint, GLenum, const GLchar *);
+typedef GLint (INTERNAL_GL_APIENTRY *PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)(GLuint, GLenum, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMSUBROUTINEUIVPROC)(GLenum, GLint, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETUNIFORMDVPROC)(GLuint, GLint, GLdouble *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISTRANSFORMFEEDBACKPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMINSAMPLESHADINGPROC)(GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPATCHPARAMETERFVPROC)(GLenum, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPATCHPARAMETERIPROC)(GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPAUSETRANSFORMFEEDBACKPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLRESUMETRANSFORMFEEDBACKPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1DPROC)(GLint, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM1DVPROC)(GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2DPROC)(GLint, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM2DVPROC)(GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3DPROC)(GLint, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM3DVPROC)(GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4DPROC)(GLint, GLdouble, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORM4DVPROC)(GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX2DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX2X3DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX2X4DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX3DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX3X2DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX3X4DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX4DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX4X2DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMMATRIX4X3DVPROC)(GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUNIFORMSUBROUTINESUIVPROC)(GLenum, GLsizei, const GLuint *);
+
+// 4.1
+typedef void (INTERNAL_GL_APIENTRY *PFNGLACTIVESHADERPROGRAMPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDPROGRAMPIPELINEPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARDEPTHFPROC)(GLfloat);
+typedef GLuint (INTERNAL_GL_APIENTRY *PFNGLCREATESHADERPROGRAMVPROC)(GLenum, GLsizei, const GLchar *const*);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDELETEPROGRAMPIPELINESPROC)(GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEPTHRANGEARRAYVPROC)(GLuint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEPTHRANGEINDEXEDPROC)(GLuint, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEPTHRANGEFPROC)(GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENPROGRAMPIPELINESPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETDOUBLEI_VPROC)(GLenum, GLuint, GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETFLOATI_VPROC)(GLenum, GLuint, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMBINARYPROC)(GLuint, GLsizei, GLsizei *, GLenum *, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMPIPELINEINFOLOGPROC)(GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMPIPELINEIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum, GLenum, GLint *, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXATTRIBLDVPROC)(GLuint, GLenum, GLdouble *);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLISPROGRAMPIPELINEPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMBINARYPROC)(GLuint, GLenum, const void *, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMPARAMETERIPROC)(GLuint, GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1DPROC)(GLuint, GLint, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1DVPROC)(GLuint, GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1FPROC)(GLuint, GLint, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1FVPROC)(GLuint, GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1IPROC)(GLuint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1IVPROC)(GLuint, GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1UIPROC)(GLuint, GLint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM1UIVPROC)(GLuint, GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2DPROC)(GLuint, GLint, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2DVPROC)(GLuint, GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2FPROC)(GLuint, GLint, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2FVPROC)(GLuint, GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2IPROC)(GLuint, GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2IVPROC)(GLuint, GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2UIPROC)(GLuint, GLint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM2UIVPROC)(GLuint, GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3DPROC)(GLuint, GLint, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3DVPROC)(GLuint, GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3FPROC)(GLuint, GLint, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3FVPROC)(GLuint, GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3IPROC)(GLuint, GLint, GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3IVPROC)(GLuint, GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3UIPROC)(GLuint, GLint, GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM3UIVPROC)(GLuint, GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4DPROC)(GLuint, GLint, GLdouble, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4DVPROC)(GLuint, GLint, GLsizei, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4FPROC)(GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4FVPROC)(GLuint, GLint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4IPROC)(GLuint, GLint, GLint, GLint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4IVPROC)(GLuint, GLint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4UIPROC)(GLuint, GLint, GLuint, GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORM4UIVPROC)(GLuint, GLint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC)(GLuint, GLint, GLsizei, GLboolean, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLRELEASESHADERCOMPILERPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSCISSORARRAYVPROC)(GLuint, GLsizei, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSCISSORINDEXEDPROC)(GLuint, GLint, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSCISSORINDEXEDVPROC)(GLuint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSHADERBINARYPROC)(GLsizei, const GLuint *, GLenum, const void *, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLUSEPROGRAMSTAGESPROC)(GLuint, GLbitfield, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVALIDATEPROGRAMPIPELINEPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL1DPROC)(GLuint, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL1DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL2DPROC)(GLuint, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL2DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL3DPROC)(GLuint, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL3DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL4DPROC)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBL4DVPROC)(GLuint, const GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBLPOINTERPROC)(GLuint, GLint, GLenum, GLsizei, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVIEWPORTARRAYVPROC)(GLuint, GLsizei, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVIEWPORTINDEXEDFPROC)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVIEWPORTINDEXEDFVPROC)(GLuint, const GLfloat *);
+
+// 4.2
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDIMAGETEXTUREPROC)(GLuint, GLuint, GLint, GLboolean, GLint, GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC)(GLenum, GLint, GLsizei, GLsizei, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC)(GLenum, GLsizei, GLenum, const void *, GLsizei, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC)(GLenum, GLsizei, GLenum, const void *, GLsizei, GLint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC)(GLenum, GLuint, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC)(GLenum, GLuint, GLuint, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC)(GLuint, GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETINTERNALFORMATIVPROC)(GLenum, GLenum, GLenum, GLsizei, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMEMORYBARRIERPROC)(GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSTORAGE1DPROC)(GLenum, GLsizei, GLenum, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSTORAGE2DPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSTORAGE3DPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
+
+// 4.3
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDVERTEXBUFFERPROC)(GLuint, GLuint, GLintptr, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARBUFFERDATAPROC)(GLenum, GLenum, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARBUFFERSUBDATAPROC)(GLenum, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYIMAGESUBDATAPROC)(GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEBUGMESSAGECONTROLPROC)(GLenum, GLenum, GLenum, GLsizei, const GLuint *, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDEBUGMESSAGEINSERTPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDISPATCHCOMPUTEPROC)(GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDISPATCHCOMPUTEINDIRECTPROC)(GLintptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFRAMEBUFFERPARAMETERIPROC)(GLenum, GLenum, GLint);
+typedef GLuint (INTERNAL_GL_APIENTRY *PFNGLGETDEBUGMESSAGELOGPROC)(GLuint, GLsizei, GLenum *, GLenum *, GLuint *, GLenum *, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETFRAMEBUFFERPARAMETERIVPROC)(GLenum, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETINTERNALFORMATI64VPROC)(GLenum, GLenum, GLenum, GLsizei, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETOBJECTLABELPROC)(GLenum, GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETOBJECTPTRLABELPROC)(const void *, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMINTERFACEIVPROC)(GLuint, GLenum, GLenum, GLint *);
+typedef GLuint (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMRESOURCEINDEXPROC)(GLuint, GLenum, const GLchar *);
+typedef GLint (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMRESOURCELOCATIONPROC)(GLuint, GLenum, const GLchar *);
+typedef GLint (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC)(GLuint, GLenum, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMRESOURCENAMEPROC)(GLuint, GLenum, GLuint, GLsizei, GLsizei *, GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETPROGRAMRESOURCEIVPROC)(GLuint, GLenum, GLuint, GLsizei, const GLenum *, GLsizei, GLsizei *, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATEBUFFERDATAPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATEBUFFERSUBDATAPROC)(GLuint, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATEFRAMEBUFFERPROC)(GLenum, GLsizei, const GLenum *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATESUBFRAMEBUFFERPROC)(GLenum, GLsizei, const GLenum *, GLint, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATETEXIMAGEPROC)(GLuint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATETEXSUBIMAGEPROC)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMULTIDRAWARRAYSINDIRECTPROC)(GLenum, const void *, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMULTIDRAWELEMENTSINDIRECTPROC)(GLenum, GLenum, const void *, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLOBJECTLABELPROC)(GLenum, GLuint, GLsizei, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLOBJECTPTRLABELPROC)(const void *, GLsizei, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPOPDEBUGGROUPPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLPUSHDEBUGGROUPPROC)(GLenum, GLuint, GLsizei, const GLchar *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLSHADERSTORAGEBLOCKBINDINGPROC)(GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXBUFFERRANGEPROC)(GLenum, GLenum, GLuint, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSTORAGE2DMULTISAMPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXSTORAGE3DMULTISAMPLEPROC)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREVIEWPROC)(GLuint, GLenum, GLuint, GLenum, GLuint, GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBBINDINGPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBFORMATPROC)(GLuint, GLint, GLenum, GLboolean, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBIFORMATPROC)(GLuint, GLint, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXATTRIBLFORMATPROC)(GLuint, GLint, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXBINDINGDIVISORPROC)(GLuint, GLuint);
+
+// 4.4
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDBUFFERSBASEPROC)(GLenum, GLuint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDBUFFERSRANGEPROC)(GLenum, GLuint, GLsizei, const GLuint *, const GLintptr *, const GLsizeiptr *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDIMAGETEXTURESPROC)(GLuint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDSAMPLERSPROC)(GLuint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDTEXTURESPROC)(GLuint, GLsizei, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDVERTEXBUFFERSPROC)(GLuint, GLsizei, const GLuint *, const GLintptr *, const GLsizei *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBUFFERSTORAGEPROC)(GLenum, GLsizeiptr, const void *, GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARTEXIMAGEPROC)(GLuint, GLint, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARTEXSUBIMAGEPROC)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *);
+
+// 4.5
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBINDTEXTUREUNITPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLBLITNAMEDFRAMEBUFFERPROC)(GLuint, GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
+typedef GLenum (INTERNAL_GL_APIENTRY *PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC)(GLuint, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARNAMEDBUFFERDATAPROC)(GLuint, GLenum, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARNAMEDBUFFERSUBDATAPROC)(GLuint, GLenum, GLintptr, GLsizeiptr, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARNAMEDFRAMEBUFFERFIPROC)(GLuint, GLenum, const GLfloat, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARNAMEDFRAMEBUFFERFVPROC)(GLuint, GLenum, GLint, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARNAMEDFRAMEBUFFERIVPROC)(GLuint, GLenum, GLint, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC)(GLuint, GLenum, GLint, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCLIPCONTROLPROC)(GLenum, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC)(GLuint, GLint, GLint, GLsizei, GLenum, GLsizei, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC)(GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYNAMEDBUFFERSUBDATAPROC)(GLuint, GLuint, GLintptr, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXTURESUBIMAGE1DPROC)(GLuint, GLint, GLint, GLint, GLint, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXTURESUBIMAGE2DPROC)(GLuint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCOPYTEXTURESUBIMAGE3DPROC)(GLuint, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATEBUFFERSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATEFRAMEBUFFERSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATEPROGRAMPIPELINESPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATEQUERIESPROC)(GLenum, GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATERENDERBUFFERSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATESAMPLERSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATETEXTURESPROC)(GLenum, GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATETRANSFORMFEEDBACKSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLCREATEVERTEXARRAYSPROC)(GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLDISABLEVERTEXARRAYATTRIBPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLENABLEVERTEXARRAYATTRIBPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC)(GLuint, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGENERATETEXTUREMIPMAPPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC)(GLuint, GLint, GLsizei, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, void *);
+typedef GLenum (INTERNAL_GL_APIENTRY *PFNGLGETGRAPHICSRESETSTATUSPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNAMEDBUFFERPARAMETERI64VPROC)(GLuint, GLenum, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNAMEDBUFFERPARAMETERIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNAMEDBUFFERPOINTERVPROC)(GLuint, GLenum, void **);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNAMEDBUFFERSUBDATAPROC)(GLuint, GLintptr, GLsizeiptr, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLuint, GLenum, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYBUFFEROBJECTI64VPROC)(GLuint, GLuint, GLenum, GLintptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYBUFFEROBJECTIVPROC)(GLuint, GLuint, GLenum, GLintptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYBUFFEROBJECTUI64VPROC)(GLuint, GLuint, GLenum, GLintptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETQUERYBUFFEROBJECTUIVPROC)(GLuint, GLuint, GLenum, GLintptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTUREIMAGEPROC)(GLuint, GLint, GLenum, GLenum, GLsizei, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTURELEVELPARAMETERFVPROC)(GLuint, GLint, GLenum, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTURELEVELPARAMETERIVPROC)(GLuint, GLint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTUREPARAMETERIIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTUREPARAMETERIUIVPROC)(GLuint, GLenum, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTUREPARAMETERFVPROC)(GLuint, GLenum, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTUREPARAMETERIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTEXTURESUBIMAGEPROC)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTRANSFORMFEEDBACKI64_VPROC)(GLuint, GLenum, GLuint, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTRANSFORMFEEDBACKI_VPROC)(GLuint, GLenum, GLuint, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETTRANSFORMFEEDBACKIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXARRAYINDEXED64IVPROC)(GLuint, GLuint, GLenum, GLint64 *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXARRAYINDEXEDIVPROC)(GLuint, GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETVERTEXARRAYIVPROC)(GLuint, GLenum, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNCOMPRESSEDTEXIMAGEPROC)(GLenum, GLint, GLsizei, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNTEXIMAGEPROC)(GLenum, GLint, GLenum, GLenum, GLsizei, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNUNIFORMDVPROC)(GLuint, GLint, GLsizei, GLdouble *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNUNIFORMFVPROC)(GLuint, GLint, GLsizei, GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNUNIFORMIVPROC)(GLuint, GLint, GLsizei, GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLGETNUNIFORMUIVPROC)(GLuint, GLint, GLsizei, GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC)(GLuint, GLsizei, const GLenum *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC)(GLuint, GLsizei, const GLenum *, GLint, GLint, GLsizei, GLsizei);
+typedef void *(INTERNAL_GL_APIENTRY *PFNGLMAPNAMEDBUFFERPROC)(GLuint, GLenum);
+typedef void *(INTERNAL_GL_APIENTRY *PFNGLMAPNAMEDBUFFERRANGEPROC)(GLuint, GLintptr, GLsizeiptr, GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLMEMORYBARRIERBYREGIONPROC)(GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDBUFFERDATAPROC)(GLuint, GLsizeiptr, const void *, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDBUFFERSTORAGEPROC)(GLuint, GLsizeiptr, const void *, GLbitfield);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDBUFFERSUBDATAPROC)(GLuint, GLintptr, GLsizeiptr, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC)(GLuint, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC)(GLuint, GLsizei, const GLenum *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC)(GLuint, GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC)(GLuint, GLenum);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC)(GLuint, GLenum, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDFRAMEBUFFERTEXTUREPROC)(GLuint, GLenum, GLuint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC)(GLuint, GLenum, GLuint, GLint, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDRENDERBUFFERSTORAGEPROC)(GLuint, GLenum, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLuint, GLsizei, GLenum, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLREADNPIXELSPROC)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLsizei, void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREBARRIERPROC)();
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREBUFFERPROC)(GLuint, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREBUFFERRANGEPROC)(GLuint, GLenum, GLuint, GLintptr, GLsizeiptr);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREPARAMETERIIVPROC)(GLuint, GLenum, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREPARAMETERIUIVPROC)(GLuint, GLenum, const GLuint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREPARAMETERFPROC)(GLuint, GLenum, GLfloat);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREPARAMETERFVPROC)(GLuint, GLenum, const GLfloat *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREPARAMETERIPROC)(GLuint, GLenum, GLint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTUREPARAMETERIVPROC)(GLuint, GLenum, const GLint *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESTORAGE1DPROC)(GLuint, GLsizei, GLenum, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESTORAGE2DPROC)(GLuint, GLsizei, GLenum, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC)(GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESTORAGE3DPROC)(GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC)(GLuint, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, GLboolean);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESUBIMAGE1DPROC)(GLuint, GLint, GLint, GLsizei, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESUBIMAGE2DPROC)(GLuint, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTEXTURESUBIMAGE3DPROC)(GLuint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void *);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC)(GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC)(GLuint, GLuint, GLuint, GLintptr, GLsizeiptr);
+typedef GLboolean (INTERNAL_GL_APIENTRY *PFNGLUNMAPNAMEDBUFFERPROC)(GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYATTRIBBINDINGPROC)(GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYATTRIBFORMATPROC)(GLuint, GLuint, GLint, GLenum, GLboolean, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYATTRIBIFORMATPROC)(GLuint, GLuint, GLint, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYATTRIBLFORMATPROC)(GLuint, GLuint, GLint, GLenum, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYBINDINGDIVISORPROC)(GLuint, GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYELEMENTBUFFERPROC)(GLuint, GLuint);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYVERTEXBUFFERPROC)(GLuint, GLuint, GLuint, GLintptr, GLsizei);
+typedef void (INTERNAL_GL_APIENTRY *PFNGLVERTEXARRAYVERTEXBUFFERSPROC)(GLuint, GLuint, GLsizei, const GLuint *, const GLintptr *, const GLsizei *);
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_FUNCTIONSGLTYPEDEFS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglrenderergl_utilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// renderer11_utils.cpp: Conversion functions and other utility routines
+// specific to the OpenGL renderer.
+
+#include &quot;libANGLE/renderer/gl/renderergl_utils.h&quot;
+
+#include &lt;limits&gt;
+
+#include &quot;libANGLE/Caps.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/renderer/gl/FunctionsGL.h&quot;
+#include &quot;libANGLE/renderer/gl/formatutilsgl.h&quot;
+
+#include &lt;algorithm&gt;
+
+namespace rx
+{
+
+namespace nativegl_gl
+{
+
+static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, GLenum internalFormat)
+{
+    gl::TextureCaps textureCaps;
+
+    const nativegl::InternalFormat &amp;formatInfo = nativegl::GetInternalFormatInfo(internalFormat);
+    textureCaps.texturable = formatInfo.textureSupport(functions-&gt;majorVersion, functions-&gt;minorVersion, functions-&gt;extensions);
+    textureCaps.renderable = formatInfo.renderSupport(functions-&gt;majorVersion, functions-&gt;minorVersion, functions-&gt;extensions);
+    textureCaps.filterable = formatInfo.filterSupport(functions-&gt;majorVersion, functions-&gt;minorVersion, functions-&gt;extensions);
+
+    // glGetInternalformativ is not available until version 4.2 but may be available through the 3.0
+    // extension GL_ARB_internalformat_query
+    if (textureCaps.renderable &amp;&amp; functions-&gt;getInternalformativ)
+    {
+        GLint numSamples = 0;
+        functions-&gt;getInternalformativ(GL_RENDERBUFFER, internalFormat, GL_NUM_SAMPLE_COUNTS, 1, &amp;numSamples);
+
+        if (numSamples &gt; 0)
+        {
+            std::vector&lt;GLint&gt; samples(numSamples);
+            functions-&gt;getInternalformativ(GL_RENDERBUFFER, internalFormat, GL_SAMPLES, samples.size(), &amp;samples[0]);
+            for (size_t sampleIndex = 0; sampleIndex &lt; samples.size(); sampleIndex++)
+            {
+                textureCaps.sampleCounts.insert(samples[sampleIndex]);
+            }
+        }
+    }
+
+    return textureCaps;
+}
+
+static GLint QuerySingleGLInt(const FunctionsGL *functions, GLenum name)
+{
+    GLint result;
+    functions-&gt;getIntegerv(name, &amp;result);
+    return result;
+}
+
+void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap,
+                  gl::Extensions *extensions)
+{
+    // Texture format support checks
+    const gl::FormatSet &amp;allFormats = gl::GetAllSizedInternalFormats();
+    for (GLenum internalFormat : allFormats)
+    {
+        gl::TextureCaps textureCaps = GenerateTextureFormatCaps(functions, internalFormat);
+        textureCapsMap-&gt;insert(internalFormat, textureCaps);
+
+        if (gl::GetInternalFormatInfo(internalFormat).compressed)
+        {
+            caps-&gt;compressedTextureFormats.push_back(internalFormat);
+        }
+    }
+
+    // Set some minimum GLES2 caps, TODO: query for real GL caps
+
+    // Table 6.28, implementation dependent values
+    caps-&gt;maxElementIndex = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;unsigned int&gt;::max());
+    caps-&gt;max3DTextureSize = QuerySingleGLInt(functions, GL_MAX_3D_TEXTURE_SIZE);
+    caps-&gt;max2DTextureSize = QuerySingleGLInt(functions, GL_MAX_TEXTURE_SIZE);
+    caps-&gt;maxCubeMapTextureSize = QuerySingleGLInt(functions, GL_MAX_CUBE_MAP_TEXTURE_SIZE);
+    caps-&gt;maxArrayTextureLayers = QuerySingleGLInt(functions, GL_MAX_ARRAY_TEXTURE_LAYERS);
+    caps-&gt;maxLODBias = 2.0f;
+    caps-&gt;maxRenderbufferSize = QuerySingleGLInt(functions, GL_MAX_RENDERBUFFER_SIZE);
+    caps-&gt;maxDrawBuffers = QuerySingleGLInt(functions, GL_MAX_DRAW_BUFFERS);
+    caps-&gt;maxColorAttachments = QuerySingleGLInt(functions, GL_MAX_COLOR_ATTACHMENTS);
+    caps-&gt;maxViewportWidth = caps-&gt;max2DTextureSize;
+    caps-&gt;maxViewportHeight = caps-&gt;maxViewportWidth;
+    caps-&gt;minAliasedPointSize = 1.0f;
+    caps-&gt;maxAliasedPointSize = 1.0f;
+    caps-&gt;minAliasedLineWidth = 1.0f;
+    caps-&gt;maxAliasedLineWidth = 1.0f;
+
+    // Table 6.29, implementation dependent values (cont.)
+    caps-&gt;maxElementsIndices = 0;
+    caps-&gt;maxElementsVertices = 0;
+    caps-&gt;vertexHighpFloat.setIEEEFloat();
+    caps-&gt;vertexMediumpFloat.setIEEEFloat();
+    caps-&gt;vertexLowpFloat.setIEEEFloat();
+    caps-&gt;fragmentHighpFloat.setIEEEFloat();
+    caps-&gt;fragmentMediumpFloat.setIEEEFloat();
+    caps-&gt;fragmentLowpFloat.setIEEEFloat();
+    caps-&gt;vertexHighpInt.setTwosComplementInt(32);
+    caps-&gt;vertexMediumpInt.setTwosComplementInt(32);
+    caps-&gt;vertexLowpInt.setTwosComplementInt(32);
+    caps-&gt;fragmentHighpInt.setTwosComplementInt(32);
+    caps-&gt;fragmentMediumpInt.setTwosComplementInt(32);
+    caps-&gt;fragmentLowpInt.setTwosComplementInt(32);
+    caps-&gt;maxServerWaitTimeout = 0;
+
+    // Table 6.31, implementation dependent vertex shader limits
+    caps-&gt;maxVertexAttributes = 16;
+    caps-&gt;maxVertexUniformComponents = 1024;
+    caps-&gt;maxVertexUniformVectors = 256;
+    caps-&gt;maxVertexUniformBlocks = 12;
+    caps-&gt;maxVertexOutputComponents = 64;
+    caps-&gt;maxVertexTextureImageUnits = QuerySingleGLInt(functions, GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+
+    // Table 6.32, implementation dependent fragment shader limits
+    caps-&gt;maxFragmentUniformComponents = 896;
+    caps-&gt;maxFragmentUniformVectors = 224;
+    caps-&gt;maxFragmentUniformBlocks = 12;
+    caps-&gt;maxFragmentInputComponents = 60;
+    caps-&gt;maxTextureImageUnits = QuerySingleGLInt(functions, GL_MAX_TEXTURE_IMAGE_UNITS);
+    caps-&gt;minProgramTexelOffset = -8;
+    caps-&gt;maxProgramTexelOffset = 7;
+
+    // Table 6.33, implementation dependent aggregate shader limits
+    caps-&gt;maxUniformBufferBindings = 24;
+    caps-&gt;maxUniformBlockSize = 16384;
+    caps-&gt;uniformBufferOffsetAlignment = 1;
+    caps-&gt;maxCombinedUniformBlocks = 24;
+    caps-&gt;maxCombinedVertexUniformComponents = (caps-&gt;maxVertexUniformBlocks * (caps-&gt;maxUniformBlockSize / 4)) + caps-&gt;maxVertexUniformComponents;
+    caps-&gt;maxCombinedFragmentUniformComponents = (caps-&gt;maxFragmentUniformBlocks * (caps-&gt;maxUniformBlockSize / 4)) + caps-&gt;maxFragmentUniformComponents;
+    caps-&gt;maxVaryingComponents = 60;
+    caps-&gt;maxVaryingVectors = 15;
+    caps-&gt;maxCombinedTextureImageUnits = caps-&gt;maxVertexTextureImageUnits + caps-&gt;maxTextureImageUnits;
+
+    // Table 6.34, implementation dependent transform feedback limits
+    caps-&gt;maxTransformFeedbackInterleavedComponents = 64;
+    caps-&gt;maxTransformFeedbackSeparateAttributes = 4;
+    caps-&gt;maxTransformFeedbackSeparateComponents = 4;
+
+    // Table 6.35, Framebuffer Dependent Values
+    caps-&gt;maxSamples = QuerySingleGLInt(functions, GL_MAX_SAMPLES);
+
+    // Extension support
+    extensions-&gt;setTextureExtensionSupport(*textureCapsMap);
+    extensions-&gt;textureNPOT = true;
+    extensions-&gt;textureStorage = true;
+    extensions-&gt;fboRenderMipmap = true;
+    extensions-&gt;framebufferMultisample = caps-&gt;maxSamples &gt; 0;
+    extensions-&gt;fence = std::find(functions-&gt;extensions.begin(), functions-&gt;extensions.end(), &quot;GL_NV_fence&quot;) != functions-&gt;extensions.end();
+}
+
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglrenderergl_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/renderergl_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+//
+// Copyright (c) 2012-2014 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.
+//
+
+// renderer11_utils.h: Conversion functions and other utility routines
+// specific to the OpenGL renderer.
+
+#ifndef LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_
+#define LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_
+
+#include &quot;libANGLE/renderer/gl/functionsgl_typedefs.h&quot;
+
+#include &lt;vector&gt;
+
+namespace gl
+{
+struct Caps;
+class TextureCapsMap;
+struct Extensions;
+}
+
+namespace rx
+{
+class FunctionsGL;
+
+namespace nativegl_gl
+{
+
+void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsMap *textureCapsMap,
+                  gl::Extensions *extensions);
+
+}
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglDisplayWGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,493 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// DisplayWGL.h: WGL implementation of egl::Display
+
+#include &quot;libANGLE/renderer/gl/wgl/DisplayWGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/renderer/gl/renderergl_utils.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/FunctionsWGL.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/wgl_utils.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+#include &lt;string&gt;
+#include &lt;sstream&gt;
+
+namespace rx
+{
+
+class FunctionsGLWindows : public FunctionsGL
+{
+  public:
+    FunctionsGLWindows(HMODULE openGLModule, PFNWGLGETPROCADDRESSPROC getProcAddressWGL)
+        : mOpenGLModule(openGLModule),
+          mGetProcAddressWGL(getProcAddressWGL)
+    {
+        ASSERT(mOpenGLModule);
+        ASSERT(mGetProcAddressWGL);
+    }
+
+    virtual ~FunctionsGLWindows()
+    {
+    }
+
+  private:
+    void *loadProcAddress(const std::string &amp;function) override
+    {
+        void *proc = reinterpret_cast&lt;void*&gt;(mGetProcAddressWGL(function.c_str()));
+        if (!proc)
+        {
+            proc = reinterpret_cast&lt;void*&gt;(GetProcAddress(mOpenGLModule, function.c_str()));
+        }
+        return proc;
+    }
+
+    HMODULE mOpenGLModule;
+    PFNWGLGETPROCADDRESSPROC mGetProcAddressWGL;
+};
+
+DisplayWGL::DisplayWGL()
+    : DisplayGL(),
+      mOpenGLModule(nullptr),
+      mFunctionsWGL(nullptr),
+      mFunctionsGL(nullptr),
+      mWindowClass(0),
+      mWindow(nullptr),
+      mDeviceContext(nullptr),
+      mPixelFormat(0),
+      mWGLContext(nullptr),
+      mDisplay(nullptr)
+{
+}
+
+DisplayWGL::~DisplayWGL()
+{
+}
+
+static LRESULT CALLBACK IntermediateWindowProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    switch (message)
+    {
+      case WM_ERASEBKGND:
+        // Prevent windows from erasing the background.
+        return 1;
+      case WM_PAINT:
+        // Do not paint anything.
+        PAINTSTRUCT paint;
+        if (BeginPaint(window, &amp;paint))
+        {
+            EndPaint(window, &amp;paint);
+        }
+        return 0;
+    }
+
+    return DefWindowProc(window, message, wParam, lParam);
+}
+
+egl::Error DisplayWGL::initialize(egl::Display *display)
+{
+    mDisplay = display;
+
+    mOpenGLModule = LoadLibraryA(&quot;opengl32.dll&quot;);
+    if (!mOpenGLModule)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to load OpenGL library.&quot;);
+    }
+
+    mFunctionsWGL = new FunctionsWGL();
+    mFunctionsWGL-&gt;initialize(mOpenGLModule, nullptr);
+
+    // WGL can't grab extensions until it creates a context because it needs to load the driver's DLLs first.
+    // Create a dummy context to load the driver and determine which GL versions are available.
+
+    // Work around compile error from not defining &quot;UNICODE&quot; while Chromium does
+    const LPSTR idcArrow = MAKEINTRESOURCEA(32512);
+
+    WNDCLASSA intermediateClassDesc = { 0 };
+    intermediateClassDesc.style = CS_OWNDC;
+    intermediateClassDesc.lpfnWndProc = IntermediateWindowProc;
+    intermediateClassDesc.cbClsExtra = 0;
+    intermediateClassDesc.cbWndExtra = 0;
+    intermediateClassDesc.hInstance = GetModuleHandle(NULL);
+    intermediateClassDesc.hIcon = NULL;
+    intermediateClassDesc.hCursor = LoadCursorA(NULL, idcArrow);
+    intermediateClassDesc.hbrBackground = 0;
+    intermediateClassDesc.lpszMenuName = NULL;
+    intermediateClassDesc.lpszClassName = &quot;ANGLE Intermediate Window&quot;;
+    mWindowClass = RegisterClassA(&amp;intermediateClassDesc);
+    if (!mWindowClass)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to register intermediate OpenGL window class.&quot;);
+    }
+
+    HWND dummyWindow = CreateWindowExA(WS_EX_NOPARENTNOTIFY,
+                                       reinterpret_cast&lt;const char *&gt;(mWindowClass),
+                                       &quot;ANGLE Dummy Window&quot;,
+                                       WS_OVERLAPPEDWINDOW,
+                                       CW_USEDEFAULT,
+                                       CW_USEDEFAULT,
+                                       CW_USEDEFAULT,
+                                       CW_USEDEFAULT,
+                                       NULL,
+                                       NULL,
+                                       NULL,
+                                       NULL);
+    if (!dummyWindow)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to create dummy OpenGL window.&quot;);
+    }
+
+    HDC dummyDeviceContext = GetDC(dummyWindow);
+    if (!dummyDeviceContext)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to get the device context of the dummy OpenGL window.&quot;);
+    }
+
+    const PIXELFORMATDESCRIPTOR pixelFormatDescriptor = wgl::GetDefaultPixelFormatDescriptor();
+
+    int dummyPixelFormat = ChoosePixelFormat(dummyDeviceContext, &amp;pixelFormatDescriptor);
+    if (dummyPixelFormat == 0)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Could not find a compatible pixel format for the dummy OpenGL window.&quot;);
+    }
+
+    if (!SetPixelFormat(dummyDeviceContext, dummyPixelFormat, &amp;pixelFormatDescriptor))
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to set the pixel format on the intermediate OpenGL window.&quot;);
+    }
+
+    HGLRC dummyWGLContext = mFunctionsWGL-&gt;createContext(dummyDeviceContext);
+    if (!dummyDeviceContext)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to create a WGL context for the dummy OpenGL window.&quot;);
+    }
+
+    if (!mFunctionsWGL-&gt;makeCurrent(dummyDeviceContext, dummyWGLContext))
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to make the dummy WGL context current.&quot;);
+    }
+
+    // Grab the GL version from this context and use it as the maximum version available.
+    typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
+    PFNGLGETSTRINGPROC getString = reinterpret_cast&lt;PFNGLGETSTRINGPROC&gt;(GetProcAddress(mOpenGLModule, &quot;glGetString&quot;));
+    if (!getString)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to get glGetString pointer.&quot;);
+    }
+
+    // Reinitialize the wgl functions to grab the extensions
+    mFunctionsWGL-&gt;initialize(mOpenGLModule, dummyDeviceContext);
+
+    // Destroy the dummy window and context
+    mFunctionsWGL-&gt;makeCurrent(dummyDeviceContext, NULL);
+    mFunctionsWGL-&gt;deleteContext(dummyWGLContext);
+    ReleaseDC(dummyWindow, dummyDeviceContext);
+    DestroyWindow(dummyWindow);
+
+    // Create the real intermediate context and windows
+    HDC parentHDC = display-&gt;getNativeDisplayId();
+    HWND parentWindow = WindowFromDC(parentHDC);
+
+    mWindow = CreateWindowExA(WS_EX_NOPARENTNOTIFY,
+                              reinterpret_cast&lt;const char *&gt;(mWindowClass),
+                              &quot;ANGLE Intermediate Window&quot;,
+                              WS_OVERLAPPEDWINDOW,
+                              CW_USEDEFAULT,
+                              CW_USEDEFAULT,
+                              CW_USEDEFAULT,
+                              CW_USEDEFAULT,
+                              parentWindow,
+                              NULL,
+                              NULL,
+                              NULL);
+    if (!mWindow)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to create intermediate OpenGL window.&quot;);
+    }
+
+    mDeviceContext = GetDC(mWindow);
+    if (!mDeviceContext)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to get the device context of the intermediate OpenGL window.&quot;);
+    }
+
+    mPixelFormat = ChoosePixelFormat(mDeviceContext, &amp;pixelFormatDescriptor);
+    if (mPixelFormat == 0)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Could not find a compatible pixel format for the intermediate OpenGL window.&quot;);
+    }
+
+    if (!SetPixelFormat(mDeviceContext, mPixelFormat, &amp;pixelFormatDescriptor))
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to set the pixel format on the intermediate OpenGL window.&quot;);
+    }
+
+    if (mFunctionsWGL-&gt;createContextAttribsARB)
+    {
+        int flags = 0;
+        // TODO: allow debug contexts
+        // TODO: handle robustness
+
+        int mask = 0;
+        // Request core profile, TODO: Don't request core if requested GL version is less than 3.0
+        mask |= WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
+
+        std::vector&lt;int&gt; contextCreationAttibutes;
+
+        // TODO: create a context version based on the requested version and validate the version numbers
+        contextCreationAttibutes.push_back(WGL_CONTEXT_MAJOR_VERSION_ARB);
+        contextCreationAttibutes.push_back(3);
+
+        contextCreationAttibutes.push_back(WGL_CONTEXT_MINOR_VERSION_ARB);
+        contextCreationAttibutes.push_back(1);
+
+        // Set the flag attributes
+        if (flags != 0)
+        {
+            contextCreationAttibutes.push_back(WGL_CONTEXT_FLAGS_ARB);
+            contextCreationAttibutes.push_back(flags);
+        }
+
+        // Set the mask attribute
+        if (mask != 0)
+        {
+            contextCreationAttibutes.push_back(WGL_CONTEXT_PROFILE_MASK_ARB);
+            contextCreationAttibutes.push_back(mask);
+        }
+
+        // Signal the end of the attributes
+        contextCreationAttibutes.push_back(0);
+        contextCreationAttibutes.push_back(0);
+
+        mWGLContext = mFunctionsWGL-&gt;createContextAttribsARB(mDeviceContext, NULL, &amp;contextCreationAttibutes[0]);
+    }
+
+    // If wglCreateContextAttribsARB is unavailable or failed, try the standard wglCreateContext
+    if (!mWGLContext)
+    {
+        // Don't have control over GL versions
+        mWGLContext = mFunctionsWGL-&gt;createContext(mDeviceContext);
+    }
+
+    if (!mWGLContext)
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to create a WGL context for the intermediate OpenGL window.&quot;);
+    }
+
+    if (!mFunctionsWGL-&gt;makeCurrent(mDeviceContext, mWGLContext))
+    {
+        return egl::Error(EGL_NOT_INITIALIZED, &quot;Failed to make the intermediate WGL context current.&quot;);
+    }
+
+    mFunctionsGL = new FunctionsGLWindows(mOpenGLModule, mFunctionsWGL-&gt;getProcAddress);
+    mFunctionsGL-&gt;initialize();
+
+    return DisplayGL::initialize(display);
+}
+
+void DisplayWGL::terminate()
+{
+    DisplayGL::terminate();
+
+    mFunctionsWGL-&gt;makeCurrent(mDeviceContext, NULL);
+    mFunctionsWGL-&gt;deleteContext(mWGLContext);
+    mWGLContext = NULL;
+
+    ReleaseDC(mWindow, mDeviceContext);
+    mDeviceContext = NULL;
+
+    DestroyWindow(mWindow);
+    mWindow = NULL;
+
+    UnregisterClassA(reinterpret_cast&lt;const char*&gt;(mWindowClass), NULL);
+    mWindowClass = NULL;
+
+    SafeDelete(mFunctionsWGL);
+    SafeDelete(mFunctionsGL);
+
+    FreeLibrary(mOpenGLModule);
+    mOpenGLModule = nullptr;
+}
+
+egl::Error DisplayWGL::createWindowSurface(const egl::Config *configuration, EGLNativeWindowType window,
+                                           const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface)
+{
+    WindowSurfaceWGL *surface = new WindowSurfaceWGL(window, mWindowClass, mPixelFormat, mWGLContext, mFunctionsWGL);
+    egl::Error error = surface-&gt;initialize();
+    if (error.isError())
+    {
+        SafeDelete(surface);
+        return error;
+    }
+
+    *outSurface = surface;
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayWGL::createPbufferSurface(const egl::Config *configuration, const egl::AttributeMap &amp;attribs,
+                                            SurfaceImpl **outSurface)
+{
+    EGLint width = attribs.get(EGL_WIDTH, 0);
+    EGLint height = attribs.get(EGL_HEIGHT, 0);
+    bool largest = (attribs.get(EGL_LARGEST_PBUFFER, EGL_FALSE) == EGL_TRUE);
+    EGLenum textureFormat = attribs.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
+    EGLenum textureTarget = attribs.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
+
+    PbufferSurfaceWGL *surface = new PbufferSurfaceWGL(width, height, textureFormat, textureTarget, largest,
+                                                       mPixelFormat, mDeviceContext, mWGLContext, mFunctionsWGL);
+    egl::Error error = surface-&gt;initialize();
+    if (error.isError())
+    {
+        SafeDelete(surface);
+        return error;
+    }
+
+    *outSurface = surface;
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error DisplayWGL::createPbufferFromClientBuffer(const egl::Config *configuration, EGLClientBuffer shareHandle,
+                                                     const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_BAD_DISPLAY);
+}
+
+egl::Error DisplayWGL::createPixmapSurface(const egl::Config *configuration, NativePixmapType nativePixmap,
+                                           const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_BAD_DISPLAY);
+}
+
+static int QueryWGLFormatAttrib(HDC dc, int format, int attribName, const FunctionsWGL *functions)
+{
+    int result = 0;
+    if (functions-&gt;getPixelFormatAttribivARB == nullptr ||
+        !functions-&gt;getPixelFormatAttribivARB(dc, format, 0, 1, &amp;attribName, &amp;result))
+    {
+        return 0;
+    }
+    return result;
+}
+
+egl::Error DisplayWGL::getDevice(DeviceImpl **device)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_BAD_DISPLAY);
+}
+
+egl::ConfigSet DisplayWGL::generateConfigs() const
+{
+    egl::ConfigSet configs;
+
+    int minSwapInterval = 1;
+    int maxSwapInterval = 1;
+    if (mFunctionsWGL-&gt;swapIntervalEXT)
+    {
+        // No defined maximum swap interval in WGL_EXT_swap_control, use a reasonable number
+        minSwapInterval = 0;
+        maxSwapInterval = 8;
+    }
+
+    PIXELFORMATDESCRIPTOR pixelFormatDescriptor;
+    DescribePixelFormat(mDeviceContext, mPixelFormat, sizeof(pixelFormatDescriptor), &amp;pixelFormatDescriptor);
+
+    egl::Config config;
+    config.renderTargetFormat = GL_RGBA8; // TODO: use the bit counts to determine the format
+    config.depthStencilFormat = GL_DEPTH24_STENCIL8; // TODO: use the bit counts to determine the format
+    config.bufferSize = pixelFormatDescriptor.cColorBits;
+    config.redSize = pixelFormatDescriptor.cRedBits;
+    config.greenSize = pixelFormatDescriptor.cGreenBits;
+    config.blueSize = pixelFormatDescriptor.cBlueBits;
+    config.luminanceSize = 0;
+    config.alphaSize = pixelFormatDescriptor.cAlphaBits;
+    config.alphaMaskSize = 0;
+    config.bindToTextureRGB = (QueryWGLFormatAttrib(mDeviceContext, mPixelFormat, WGL_BIND_TO_TEXTURE_RGB_ARB, mFunctionsWGL) == TRUE);
+    config.bindToTextureRGBA = (QueryWGLFormatAttrib(mDeviceContext, mPixelFormat, WGL_BIND_TO_TEXTURE_RGBA_ARB, mFunctionsWGL) == TRUE);
+    config.colorBufferType = EGL_RGB_BUFFER;
+    config.configCaveat = EGL_NONE;
+    config.configID = mPixelFormat;
+    config.conformant = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT_KHR; // TODO: determine the GL version and what ES versions it supports
+    config.depthSize = pixelFormatDescriptor.cDepthBits;
+    config.level = 0;
+    config.matchNativePixmap = EGL_NONE;
+    config.maxPBufferWidth = QueryWGLFormatAttrib(mDeviceContext, mPixelFormat, WGL_MAX_PBUFFER_WIDTH_ARB, mFunctionsWGL);
+    config.maxPBufferHeight = QueryWGLFormatAttrib(mDeviceContext, mPixelFormat, WGL_MAX_PBUFFER_HEIGHT_ARB, mFunctionsWGL);
+    config.maxPBufferPixels = QueryWGLFormatAttrib(mDeviceContext, mPixelFormat, WGL_MAX_PBUFFER_PIXELS_ARB, mFunctionsWGL);
+    config.maxSwapInterval = maxSwapInterval;
+    config.minSwapInterval = minSwapInterval;
+    config.nativeRenderable = EGL_TRUE; // Direct rendering
+    config.nativeVisualID = 0;
+    config.nativeVisualType = EGL_NONE;
+    config.renderableType = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT_KHR; // TODO
+    config.sampleBuffers = 0; // FIXME: enumerate multi-sampling
+    config.samples = 0;
+    config.stencilSize = pixelFormatDescriptor.cStencilBits;
+    config.surfaceType = ((pixelFormatDescriptor.dwFlags &amp; PFD_DRAW_TO_WINDOW) ? EGL_WINDOW_BIT : 0) |
+                         ((QueryWGLFormatAttrib(mDeviceContext, mPixelFormat, WGL_DRAW_TO_PBUFFER_ARB, mFunctionsWGL) == TRUE) ? EGL_PBUFFER_BIT : 0) |
+                         EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+    config.transparentType = EGL_NONE;
+    config.transparentRedValue = 0;
+    config.transparentGreenValue = 0;
+    config.transparentBlueValue = 0;
+
+    configs.add(config);
+
+    return configs;
+}
+
+bool DisplayWGL::isDeviceLost() const
+{
+    //UNIMPLEMENTED();
+    return false;
+}
+
+bool DisplayWGL::testDeviceLost()
+{
+    //UNIMPLEMENTED();
+    return false;
+}
+
+egl::Error DisplayWGL::restoreLostDevice()
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_BAD_DISPLAY);
+}
+
+bool DisplayWGL::isValidNativeWindow(EGLNativeWindowType window) const
+{
+    return (IsWindow(window) == TRUE);
+}
+
+std::string DisplayWGL::getVendorString() const
+{
+    //UNIMPLEMENTED();
+    return &quot;&quot;;
+}
+
+const FunctionsGL *DisplayWGL::getFunctionsGL() const
+{
+    return mFunctionsGL;
+}
+
+void DisplayWGL::generateExtensions(egl::DisplayExtensions *outExtensions) const
+{
+    //UNIMPLEMENTED();
+}
+
+void DisplayWGL::generateCaps(egl::Caps *outCaps) const
+{
+    outCaps-&gt;textureNPOT = true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglDisplayWGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/DisplayWGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// DisplayWGL.h: WGL implementation of egl::Display
+
+#ifndef LIBANGLE_RENDERER_GL_WGL_DISPLAYWGL_H_
+#define LIBANGLE_RENDERER_GL_WGL_DISPLAYWGL_H_
+
+#include &quot;libANGLE/renderer/gl/DisplayGL.h&quot;
+
+#include &lt;GL/wglext.h&gt;
+
+namespace rx
+{
+
+class FunctionsWGL;
+
+class DisplayWGL : public DisplayGL
+{
+  public:
+    DisplayWGL();
+    ~DisplayWGL() override;
+
+    egl::Error initialize(egl::Display *display) override;
+    void terminate() override;
+
+    egl::Error createWindowSurface(const egl::Config *configuration, EGLNativeWindowType window, const egl::AttributeMap &amp;attribs,
+                                   SurfaceImpl **outSurface) override;
+    egl::Error createPbufferSurface(const egl::Config *configuration, const egl::AttributeMap &amp;attribs,
+                                    SurfaceImpl **outSurface) override;
+    egl::Error createPbufferFromClientBuffer(const egl::Config *configuration, EGLClientBuffer shareHandle,
+                                             const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface) override;
+    egl::Error createPixmapSurface(const egl::Config *configuration, NativePixmapType nativePixmap,
+                                   const egl::AttributeMap &amp;attribs, SurfaceImpl **outSurface) override;
+
+    egl::ConfigSet generateConfigs() const override;
+
+    bool isDeviceLost() const override;
+    bool testDeviceLost() override;
+    egl::Error restoreLostDevice() override;
+
+    bool isValidNativeWindow(EGLNativeWindowType window) const override;
+
+    egl::Error getDevice(DeviceImpl **device) override;
+
+    std::string getVendorString() const override;
+
+  private:
+    const FunctionsGL *getFunctionsGL() const override;
+
+    void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
+    void generateCaps(egl::Caps *outCaps) const override;
+
+    HMODULE mOpenGLModule;
+
+    FunctionsWGL *mFunctionsWGL;
+    FunctionsGL *mFunctionsGL;
+
+    ATOM mWindowClass;
+    HWND mWindow;
+    HDC mDeviceContext;
+    int mPixelFormat;
+    HGLRC mWGLContext;
+
+    egl::Display *mDisplay;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_WGL_DISPLAYWGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglFunctionsWGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,141 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// FunctionsWGL.h: Implements the FuntionsWGL class.
+
+#include &quot;libANGLE/renderer/gl/wgl/FunctionsWGL.h&quot;
+
+namespace rx
+{
+
+template &lt;typename T&gt;
+static void GetWGLProcAddress(HMODULE glModule, PFNWGLGETPROCADDRESSPROC getProcAddressWGL,
+                              const std::string &amp;procName, T *outProcAddress)
+{
+    T proc = nullptr;
+    if (getProcAddressWGL)
+    {
+        proc = reinterpret_cast&lt;T&gt;(getProcAddressWGL(procName.c_str()));
+    }
+
+    if (!proc)
+    {
+        proc = reinterpret_cast&lt;T&gt;(GetProcAddress(glModule, procName.c_str()));
+    }
+
+    *outProcAddress = proc;
+}
+
+template &lt;typename T&gt;
+static void GetWGLExtensionProcAddress(HMODULE glModule, PFNWGLGETPROCADDRESSPROC getProcAddressWGL,
+                                       const std::string &amp;extensions, const std::string &amp;extensionName,
+                                       const std::string &amp;procName, T *outProcAddress)
+{
+    T proc = nullptr;
+    if (extensions.find(extensionName) != std::string::npos)
+    {
+        GetWGLProcAddress(glModule, getProcAddressWGL, procName, &amp;proc);
+    }
+
+    *outProcAddress = proc;
+}
+
+FunctionsWGL::FunctionsWGL()
+    : copyContext(nullptr),
+      createContext(nullptr),
+      createLayerContext(nullptr),
+      deleteContext(nullptr),
+      getCurrentContext(nullptr),
+      getCurrentDC(nullptr),
+      getProcAddress(nullptr),
+      makeCurrent(nullptr),
+      shareLists(nullptr),
+      useFontBitmapsA(nullptr),
+      useFontBitmapsW(nullptr),
+      swapBuffers(nullptr),
+      useFontOutlinesA(nullptr),
+      useFontOutlinesW(nullptr),
+      describeLayerPlane(nullptr),
+      setLayerPaletteEntries(nullptr),
+      getLayerPaletteEntries(nullptr),
+      realizeLayerPalette(nullptr),
+      swapLayerBuffers(nullptr),
+      swapMultipleBuffers(nullptr),
+      createContextAttribsARB(nullptr),
+      getPixelFormatAttribivARB(nullptr),
+      getExtensionStringEXT(nullptr),
+      getExtensionStringARB(nullptr),
+      swapIntervalEXT(nullptr),
+      createPbufferARB(nullptr),
+      getPbufferDCARB(nullptr),
+      releasePbufferDCARB(nullptr),
+      destroyPbufferARB(nullptr),
+      queryPbufferARB(nullptr),
+      bindTexImageARB(nullptr),
+      releaseTexImageARB(nullptr),
+      setPbufferAttribARB(nullptr)
+{
+}
+
+void FunctionsWGL::initialize(HMODULE glModule, HDC context)
+{
+    // First grab the wglGetProcAddress function from the gl module
+    GetWGLProcAddress(glModule, nullptr, &quot;wglGetProcAddress&quot;, &amp;getProcAddress);
+
+    // Load the core wgl functions
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglCopyContext&quot;, &amp;copyContext);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglCreateContext&quot;, &amp;createContext);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglCreateLayerContext&quot;, &amp;createLayerContext);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglDeleteContext&quot;, &amp;deleteContext);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglGetCurrentContext&quot;, &amp;getCurrentContext);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglGetCurrentDC&quot;, &amp;getCurrentDC);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglMakeCurrent&quot;, &amp;makeCurrent);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglShareLists&quot;, &amp;shareLists);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglUseFontBitmapsA&quot;, &amp;useFontBitmapsA);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglUseFontBitmapsW&quot;, &amp;useFontBitmapsW);
+    swapBuffers = SwapBuffers; // SwapBuffers is statically linked from GDI
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglUseFontOutlinesA&quot;, &amp;useFontOutlinesA);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglUseFontOutlinesW&quot;, &amp;useFontOutlinesW);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglDescribeLayerPlane&quot;, &amp;describeLayerPlane);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglSetLayerPaletteEntries&quot;, &amp;setLayerPaletteEntries);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglGetLayerPaletteEntries&quot;, &amp;getLayerPaletteEntries);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglRealizeLayerPalette&quot;, &amp;realizeLayerPalette);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglSwapLayerBuffers&quot;, &amp;swapLayerBuffers);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglSwapMultipleBuffers&quot;, &amp;swapMultipleBuffers);
+
+    // Load extension string getter functions
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglGetExtensionsStringEXT&quot;, &amp;getExtensionStringEXT);
+    GetWGLProcAddress(glModule, getProcAddress, &quot;wglGetExtensionsStringARB&quot;, &amp;getExtensionStringARB);
+
+    std::string extensions = &quot;&quot;;
+    if (getExtensionStringEXT)
+    {
+        extensions = getExtensionStringEXT();
+    }
+    else if (getExtensionStringARB &amp;&amp; context)
+    {
+        extensions = getExtensionStringARB(context);
+    }
+
+    // Load the wgl extension functions by checking if the context supports the extension first
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_create_context&quot;, &quot;wglCreateContextAttribsARB&quot;, &amp;createContextAttribsARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_pixel_format&quot;, &quot;wglGetPixelFormatAttribivARB&quot;, &amp;getPixelFormatAttribivARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_EXT_swap_control&quot;, &quot;wglSwapIntervalEXT&quot;, &amp;swapIntervalEXT);
+
+    // WGL_ARB_pbuffer
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_pbuffer&quot;, &quot;wglCreatePbufferARB&quot;, &amp;createPbufferARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_pbuffer&quot;, &quot;wglGetPbufferDCARB&quot;, &amp;getPbufferDCARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_pbuffer&quot;, &quot;wglReleasePbufferDCARB&quot;, &amp;releasePbufferDCARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_pbuffer&quot;, &quot;wglDestroyPbufferARB&quot;, &amp;destroyPbufferARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_pbuffer&quot;, &quot;wglQueryPbufferARB&quot;, &amp;queryPbufferARB);
+
+    // WGL_ARB_render_texture
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_render_texture&quot;, &quot;wglBindTexImageARB&quot;, &amp;bindTexImageARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_render_texture&quot;, &quot;wglReleaseTexImageARB&quot;, &amp;releaseTexImageARB);
+    GetWGLExtensionProcAddress(glModule, getProcAddress, extensions, &quot;WGL_ARB_render_texture&quot;, &quot;wglSetPbufferAttribARB&quot;, &amp;setPbufferAttribARB);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglFunctionsWGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/FunctionsWGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// FunctionsWGL.h: Defines the FuntionsWGL class to contain loaded WGL functions
+
+#include &quot;common/angleutils.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/functionswgl_typedefs.h&quot;
+
+namespace rx
+{
+
+class FunctionsWGL : angle::NonCopyable
+{
+  public:
+    FunctionsWGL();
+
+    // Loads all available wgl functions, may be called multiple times
+    void initialize(HMODULE glModule, HDC context);
+
+    // Base WGL functions
+    PFNWGLCOPYCONTEXTPROC copyContext;
+    PFNWGLCREATECONTEXTPROC createContext;
+    PFNWGLCREATELAYERCONTEXTPROC createLayerContext;
+    PFNWGLDELETECONTEXTPROC deleteContext;
+    PFNWGLGETCURRENTCONTEXTPROC getCurrentContext;
+    PFNWGLGETCURRENTDCPROC getCurrentDC;
+    PFNWGLGETPROCADDRESSPROC getProcAddress;
+    PFNWGLMAKECURRENTPROC makeCurrent;
+    PFNWGLSHARELISTSPROC shareLists;
+    PFNWGLUSEFONTBITMAPSAPROC useFontBitmapsA;
+    PFNWGLUSEFONTBITMAPSWPROC useFontBitmapsW;
+    PFNSWAPBUFFERSPROC swapBuffers;
+    PFNWGLUSEFONTOUTLINESAPROC useFontOutlinesA;
+    PFNWGLUSEFONTOUTLINESWPROC useFontOutlinesW;
+    PFNWGLDESCRIBELAYERPLANEPROC describeLayerPlane;
+    PFNWGLSETLAYERPALETTEENTRIESPROC setLayerPaletteEntries;
+    PFNWGLGETLAYERPALETTEENTRIESPROC getLayerPaletteEntries;
+    PFNWGLREALIZELAYERPALETTEPROC realizeLayerPalette;
+    PFNWGLSWAPLAYERBUFFERSPROC swapLayerBuffers;
+    PFNWGLSWAPMULTIPLEBUFFERSPROC swapMultipleBuffers;
+
+    // Extension functions, may be NULL
+    PFNWGLCREATECONTEXTATTRIBSARBPROC createContextAttribsARB;
+    PFNWGLGETPIXELFORMATATTRIBIVARBPROC getPixelFormatAttribivARB;
+    PFNWGLGETEXTENSIONSSTRINGEXTPROC getExtensionStringEXT;
+    PFNWGLGETEXTENSIONSSTRINGARBPROC getExtensionStringARB;
+    PFNWGLSWAPINTERVALEXTPROC swapIntervalEXT;
+
+    // WGL_ARB_pbuffer
+    PFNWGLCREATEPBUFFERARBPROC createPbufferARB;
+    PFNWGLGETPBUFFERDCARBPROC getPbufferDCARB;
+    PFNWGLRELEASEPBUFFERDCARBPROC releasePbufferDCARB;
+    PFNWGLDESTROYPBUFFERARBPROC destroyPbufferARB;
+    PFNWGLQUERYPBUFFERARBPROC queryPbufferARB;
+
+    // WGL_ARB_render_texture
+    PFNWGLBINDTEXIMAGEARBPROC bindTexImageARB;
+    PFNWGLRELEASETEXIMAGEARBPROC releaseTexImageARB;
+    PFNWGLSETPBUFFERATTRIBARBPROC setPbufferAttribARB;
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglPbufferSurfaceWGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,182 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// SurfaceWGL.cpp: WGL implementation of egl::Surface
+
+#include &quot;libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/FunctionsWGL.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/wgl_utils.h&quot;
+
+namespace rx
+{
+
+PbufferSurfaceWGL::PbufferSurfaceWGL(EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget,
+                                     bool largest, int pixelFormat, HDC deviceContext, HGLRC wglContext,
+                                     const FunctionsWGL *functions)
+    : SurfaceGL(),
+      mWidth(width),
+      mHeight(height),
+      mLargest(largest),
+      mTextureFormat(textureFormat),
+      mTextureTarget(textureTarget),
+      mPixelFormat(pixelFormat),
+      mParentDeviceContext(deviceContext),
+      mShareWGLContext(wglContext),
+      mPbuffer(nullptr),
+      mPbufferDeviceContext(nullptr),
+      mFunctionsWGL(functions)
+{
+}
+
+PbufferSurfaceWGL::~PbufferSurfaceWGL()
+{
+    mFunctionsWGL-&gt;releasePbufferDCARB(mPbuffer, mPbufferDeviceContext);
+    mPbufferDeviceContext = nullptr;
+
+    mFunctionsWGL-&gt;destroyPbufferARB(mPbuffer);
+    mPbuffer = nullptr;
+}
+
+static int GetWGLTextureType(EGLenum eglTextureType)
+{
+    switch (eglTextureType)
+    {
+      case EGL_NO_TEXTURE:    return WGL_NO_TEXTURE_ARB;
+      case EGL_TEXTURE_RGB:   return WGL_TEXTURE_RGB_ARB;
+      case EGL_TEXTURE_RGBA:  return WGL_TEXTURE_RGBA_ARB;
+      default: UNREACHABLE(); return 0;
+    }
+}
+
+static int GetWGLTextureTarget(EGLenum eglTextureTarget)
+{
+    switch (eglTextureTarget)
+    {
+      case EGL_NO_TEXTURE:    return WGL_NO_TEXTURE_ARB;
+      case EGL_TEXTURE_2D:    return WGL_TEXTURE_2D_ARB;
+      default: UNREACHABLE(); return 0;
+    }
+}
+
+egl::Error PbufferSurfaceWGL::initialize()
+{
+    const int pbufferCreationAttributes[] =
+    {
+        WGL_PBUFFER_LARGEST_ARB, mLargest ? 1 : 0,
+        WGL_TEXTURE_FORMAT_ARB, GetWGLTextureType(mTextureFormat),
+        WGL_TEXTURE_TARGET_ARB, GetWGLTextureTarget(mTextureTarget),
+        0, 0,
+    };
+
+    mPbuffer = mFunctionsWGL-&gt;createPbufferARB(mParentDeviceContext, mPixelFormat, mWidth, mHeight,
+                                               pbufferCreationAttributes);
+    if (mPbuffer == nullptr)
+    {
+        DWORD error = GetLastError();
+        return egl::Error(EGL_BAD_ALLOC, &quot;Failed to create a native WGL pbuffer, error: 0x%08x.&quot;, HRESULT_CODE(error));
+    }
+
+    // The returned pbuffer may not be as large as requested, update the size members.
+    if (mFunctionsWGL-&gt;queryPbufferARB(mPbuffer, WGL_PBUFFER_WIDTH_ARB, &amp;mWidth) != TRUE ||
+        mFunctionsWGL-&gt;queryPbufferARB(mPbuffer, WGL_PBUFFER_HEIGHT_ARB, &amp;mHeight) != TRUE)
+    {
+        DWORD error = GetLastError();
+        return egl::Error(EGL_BAD_ALLOC, &quot;Failed to query the WGL pbuffer's dimensions, error: 0x%08x.&quot;, HRESULT_CODE(error));
+    }
+
+    mPbufferDeviceContext = mFunctionsWGL-&gt;getPbufferDCARB(mPbuffer);
+    if (mPbufferDeviceContext == nullptr)
+    {
+        mFunctionsWGL-&gt;destroyPbufferARB(mPbuffer);
+        mPbuffer = nullptr;
+
+        DWORD error = GetLastError();
+        return egl::Error(EGL_BAD_ALLOC, &quot;Failed to get the WGL pbuffer handle, error: 0x%08x.&quot;, HRESULT_CODE(error));
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error PbufferSurfaceWGL::makeCurrent()
+{
+    if (!mFunctionsWGL-&gt;makeCurrent(mPbufferDeviceContext, mShareWGLContext))
+    {
+        // TODO: What error type here?
+        return egl::Error(EGL_CONTEXT_LOST, &quot;Failed to make the WGL context current.&quot;);
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error PbufferSurfaceWGL::swap()
+{
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error PbufferSurfaceWGL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error PbufferSurfaceWGL::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_SUCCESS);
+}
+
+static int GetWGLBufferBindTarget(EGLint buffer)
+{
+    switch (buffer)
+    {
+      case EGL_BACK_BUFFER:   return WGL_BACK_LEFT_ARB;
+      default: UNREACHABLE(); return 0;
+    }
+}
+
+egl::Error PbufferSurfaceWGL::bindTexImage(EGLint buffer)
+{
+    if (!mFunctionsWGL-&gt;bindTexImageARB(mPbuffer, GetWGLBufferBindTarget(buffer)))
+    {
+        DWORD error = GetLastError();
+        return egl::Error(EGL_BAD_SURFACE, &quot;Failed to bind native wgl pbuffer, error: 0x%08x.&quot;, HRESULT_CODE(error));
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error PbufferSurfaceWGL::releaseTexImage(EGLint buffer)
+{
+    if (!mFunctionsWGL-&gt;releaseTexImageARB(mPbuffer, GetWGLBufferBindTarget(buffer)))
+    {
+        DWORD error = GetLastError();
+        return egl::Error(EGL_BAD_SURFACE, &quot;Failed to unbind native wgl pbuffer, error: 0x%08x.&quot;, HRESULT_CODE(error));
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+void PbufferSurfaceWGL::setSwapInterval(EGLint interval)
+{
+}
+
+EGLint PbufferSurfaceWGL::getWidth() const
+{
+    return mWidth;
+}
+
+EGLint PbufferSurfaceWGL::getHeight() const
+{
+    return mHeight;
+}
+
+EGLint PbufferSurfaceWGL::isPostSubBufferSupported() const
+{
+    return EGL_FALSE;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglPbufferSurfaceWGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// PBufferSurfaceWGL.h: WGL implementation of egl::Surface for PBuffers
+
+#ifndef LIBANGLE_RENDERER_GL_WGL_PBUFFERSURFACEWGL_H_
+#define LIBANGLE_RENDERER_GL_WGL_PBUFFERSURFACEWGL_H_
+
+#include &quot;libANGLE/renderer/gl/SurfaceGL.h&quot;
+
+#include &lt;GL/wglext.h&gt;
+
+namespace rx
+{
+
+class FunctionsWGL;
+
+class PbufferSurfaceWGL : public SurfaceGL
+{
+  public:
+    PbufferSurfaceWGL(EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget,
+                      bool largest, int pixelFormat, HDC deviceContext, HGLRC wglContext,
+                      const FunctionsWGL *functions);
+    ~PbufferSurfaceWGL() override;
+
+    egl::Error initialize();
+    egl::Error makeCurrent() override;
+
+    egl::Error swap() override;
+    egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override;
+    egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
+    egl::Error bindTexImage(EGLint buffer) override;
+    egl::Error releaseTexImage(EGLint buffer) override;
+    void setSwapInterval(EGLint interval) override;
+
+    EGLint getWidth() const override;
+    EGLint getHeight() const override;
+
+    EGLint isPostSubBufferSupported() const override;
+
+  private:
+    EGLint mWidth;
+    EGLint mHeight;
+    bool mLargest;
+    EGLenum mTextureFormat;
+    EGLenum mTextureTarget;
+
+    int mPixelFormat;
+
+    HGLRC mShareWGLContext;
+
+    HDC mParentDeviceContext;
+
+    HPBUFFERARB mPbuffer;
+    HDC mPbufferDeviceContext;
+
+    const FunctionsWGL *mFunctionsWGL;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_WGL_PBUFFERSURFACEWGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglWindowSurfaceWGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,180 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// WindowSurfaceWGL.cpp: WGL implementation of egl::Surface for windows
+
+#include &quot;libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/FunctionsWGL.h&quot;
+#include &quot;libANGLE/renderer/gl/wgl/wgl_utils.h&quot;
+
+namespace rx
+{
+
+WindowSurfaceWGL::WindowSurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFormat, HGLRC wglContext, const FunctionsWGL *functions)
+    : SurfaceGL(),
+      mWindowClass(windowClass),
+      mPixelFormat(pixelFormat),
+      mShareWGLContext(wglContext),
+      mParentWindow(window),
+      mChildWindow(nullptr),
+      mChildDeviceContext(nullptr),
+      mFunctionsWGL(functions)
+{
+}
+
+WindowSurfaceWGL::~WindowSurfaceWGL()
+{
+    mWindowClass = 0;
+    mPixelFormat = 0;
+    mShareWGLContext = nullptr;
+
+    ReleaseDC(mChildWindow, mChildDeviceContext);
+    mChildDeviceContext = nullptr;
+
+    DestroyWindow(mChildWindow);
+    mChildWindow = nullptr;
+}
+
+egl::Error WindowSurfaceWGL::initialize()
+{
+    // Create a child window of the supplied window to draw to.
+    RECT rect;
+    if (!GetClientRect(mParentWindow, &amp;rect))
+    {
+        return egl::Error(EGL_BAD_NATIVE_WINDOW, &quot;Failed to get the size of the native window.&quot;);
+    }
+
+    mChildWindow = CreateWindowExA(WS_EX_NOPARENTNOTIFY,
+                                   reinterpret_cast&lt;const char*&gt;(mWindowClass),
+                                   &quot;ANGLE Intermediate Surface Window&quot;,
+                                   WS_CHILDWINDOW | WS_DISABLED | WS_VISIBLE,
+                                   0,
+                                   0,
+                                   rect.right - rect.left,
+                                   rect.bottom - rect.top,
+                                   mParentWindow,
+                                   NULL,
+                                   NULL,
+                                   NULL);
+    if (!mChildWindow)
+    {
+        return egl::Error(EGL_BAD_NATIVE_WINDOW, &quot;Failed to create a child window.&quot;);
+    }
+
+    mChildDeviceContext = GetDC(mChildWindow);
+    if (!mChildDeviceContext)
+    {
+        return egl::Error(EGL_BAD_NATIVE_WINDOW, &quot;Failed to get the device context of the child window.&quot;);
+    }
+
+    const PIXELFORMATDESCRIPTOR pixelFormatDescriptor = wgl::GetDefaultPixelFormatDescriptor();
+
+    if (!SetPixelFormat(mChildDeviceContext, mPixelFormat, &amp;pixelFormatDescriptor))
+    {
+        return egl::Error(EGL_BAD_NATIVE_WINDOW, &quot;Failed to set the pixel format on the child window.&quot;);
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error WindowSurfaceWGL::makeCurrent()
+{
+    if (!mFunctionsWGL-&gt;makeCurrent(mChildDeviceContext, mShareWGLContext))
+    {
+        // TODO: What error type here?
+        return egl::Error(EGL_CONTEXT_LOST, &quot;Failed to make the WGL context current.&quot;);
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error WindowSurfaceWGL::swap()
+{
+    // Resize the child window to the interior of the parent window.
+    RECT rect;
+    if (!GetClientRect(mParentWindow, &amp;rect))
+    {
+        // TODO: What error type here?
+        return egl::Error(EGL_CONTEXT_LOST, &quot;Failed to get the size of the native window.&quot;);
+    }
+
+    if (!MoveWindow(mChildWindow, 0, 0, rect.right - rect.left, rect.bottom - rect.top, FALSE))
+    {
+        // TODO: What error type here?
+        return egl::Error(EGL_CONTEXT_LOST, &quot;Failed to move the child window.&quot;);
+    }
+
+    if (!mFunctionsWGL-&gt;swapBuffers(mChildDeviceContext))
+    {
+        // TODO: What error type here?
+        return egl::Error(EGL_CONTEXT_LOST, &quot;Failed to swap buffers on the child window.&quot;);
+    }
+
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error WindowSurfaceWGL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error WindowSurfaceWGL::querySurfacePointerANGLE(EGLint attribute, void **value)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error WindowSurfaceWGL::bindTexImage(EGLint buffer)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_SUCCESS);
+}
+
+egl::Error WindowSurfaceWGL::releaseTexImage(EGLint buffer)
+{
+    UNIMPLEMENTED();
+    return egl::Error(EGL_SUCCESS);
+}
+
+void WindowSurfaceWGL::setSwapInterval(EGLint interval)
+{
+    if (mFunctionsWGL-&gt;swapIntervalEXT)
+    {
+        mFunctionsWGL-&gt;swapIntervalEXT(interval);
+    }
+}
+
+EGLint WindowSurfaceWGL::getWidth() const
+{
+    RECT rect;
+    if (!GetClientRect(mParentWindow, &amp;rect))
+    {
+        return 0;
+    }
+    return rect.right - rect.left;
+}
+
+EGLint WindowSurfaceWGL::getHeight() const
+{
+    RECT rect;
+    if (!GetClientRect(mParentWindow, &amp;rect))
+    {
+        return 0;
+    }
+    return rect.bottom - rect.top;
+}
+
+EGLint WindowSurfaceWGL::isPostSubBufferSupported() const
+{
+    // PostSubBuffer extension not exposed on WGL.
+    UNIMPLEMENTED();
+    return EGL_FALSE;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglWindowSurfaceWGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// WindowSurfaceWGL.h: WGL implementation of egl::Surface for windows
+
+#ifndef LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
+#define LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
+
+#include &quot;libANGLE/renderer/gl/SurfaceGL.h&quot;
+
+#include &lt;GL/wglext.h&gt;
+
+namespace rx
+{
+
+class FunctionsWGL;
+
+class WindowSurfaceWGL : public SurfaceGL
+{
+  public:
+    WindowSurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFormat, HGLRC wglContext, const FunctionsWGL *functions);
+    ~WindowSurfaceWGL() override;
+
+    egl::Error initialize();
+    egl::Error makeCurrent() override;
+
+    egl::Error swap() override;
+    egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override;
+    egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
+    egl::Error bindTexImage(EGLint buffer) override;
+    egl::Error releaseTexImage(EGLint buffer) override;
+    void setSwapInterval(EGLint interval) override;
+
+    EGLint getWidth() const override;
+    EGLint getHeight() const override;
+
+    EGLint isPostSubBufferSupported() const override;
+
+  private:
+    ATOM mWindowClass;
+    int mPixelFormat;
+
+    HGLRC mShareWGLContext;
+
+    HWND mParentWindow;
+    HWND mChildWindow;
+    HDC mChildDeviceContext;
+
+    const FunctionsWGL *mFunctionsWGL;
+};
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglfunctionswgl_typedefsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/functionswgl_typedefs.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/functionswgl_typedefs.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/functionswgl_typedefs.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// functionswgl_typedefs.h: Typedefs of WGL functions.
+
+#ifndef LIBANGLE_RENDERER_GL_WGL_FUNCTIONSWGLTYPEDEFS_H_
+#define LIBANGLE_RENDERER_GL_WGL_FUNCTIONSWGLTYPEDEFS_H_
+
+#include &quot;common/platform.h&quot;
+
+#include &lt;angle_gl.h&gt;
+#include &lt;GL/wglext.h&gt;
+
+namespace rx
+{
+
+typedef BOOL(WINAPI *PFNWGLCOPYCONTEXTPROC)(HGLRC, HGLRC, UINT);
+typedef HGLRC(WINAPI *PFNWGLCREATECONTEXTPROC)(HDC);
+typedef HGLRC(WINAPI *PFNWGLCREATELAYERCONTEXTPROC)(HDC, int);
+typedef BOOL(WINAPI *PFNWGLDELETECONTEXTPROC)(HGLRC);
+typedef HGLRC(WINAPI *PFNWGLGETCURRENTCONTEXTPROC)(VOID);
+typedef HDC(WINAPI *PFNWGLGETCURRENTDCPROC)(VOID);
+typedef PROC(WINAPI *PFNWGLGETPROCADDRESSPROC)(LPCSTR);
+typedef BOOL(WINAPI *PFNWGLMAKECURRENTPROC)(HDC, HGLRC);
+typedef BOOL(WINAPI *PFNWGLSHARELISTSPROC)(HGLRC, HGLRC);
+typedef BOOL(WINAPI *PFNWGLUSEFONTBITMAPSAPROC)(HDC, DWORD, DWORD, DWORD);
+typedef BOOL(WINAPI *PFNWGLUSEFONTBITMAPSWPROC)(HDC, DWORD, DWORD, DWORD);
+typedef BOOL(WINAPI *PFNSWAPBUFFERSPROC)(HDC);
+typedef BOOL(WINAPI *PFNWGLUSEFONTOUTLINESAPROC)(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT);
+typedef BOOL(WINAPI *PFNWGLUSEFONTOUTLINESWPROC)(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT);
+typedef BOOL(WINAPI *PFNWGLDESCRIBELAYERPLANEPROC)(HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR);
+typedef int(WINAPI *PFNWGLSETLAYERPALETTEENTRIESPROC)(HDC, int, int, int, CONST COLORREF *);
+typedef int(WINAPI *PFNWGLGETLAYERPALETTEENTRIESPROC)(HDC, int, int, int, COLORREF *);
+typedef BOOL(WINAPI *PFNWGLREALIZELAYERPALETTEPROC)(HDC, int, BOOL);
+typedef BOOL(WINAPI *PFNWGLSWAPLAYERBUFFERSPROC)(HDC, UINT);
+typedef DWORD(WINAPI *PFNWGLSWAPMULTIPLEBUFFERSPROC)(UINT, CONST WGLSWAP *);
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_WGL_FUNCTIONSWGLTYPEDEFS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglwgl_utilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// wgl_utils.cpp: Utility routines specific to the WGL-&gt;EGL implementation.
+
+#include &quot;libANGLE/renderer/gl/wgl/wgl_utils.h&quot;
+
+namespace rx
+{
+
+namespace wgl
+{
+
+PIXELFORMATDESCRIPTOR GetDefaultPixelFormatDescriptor()
+{
+    PIXELFORMATDESCRIPTOR pixelFormatDescriptor = { 0 };
+    pixelFormatDescriptor.nSize = sizeof(pixelFormatDescriptor);
+    pixelFormatDescriptor.nVersion = 1;
+    pixelFormatDescriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_GENERIC_ACCELERATED | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
+    pixelFormatDescriptor.iPixelType = PFD_TYPE_RGBA;
+    pixelFormatDescriptor.cColorBits = 24;
+    pixelFormatDescriptor.cAlphaBits = 8;
+    pixelFormatDescriptor.cDepthBits = 24;
+    pixelFormatDescriptor.cStencilBits = 8;
+    pixelFormatDescriptor.iLayerType = PFD_MAIN_PLANE;
+
+    return pixelFormatDescriptor;
+}
+
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLErendererglwglwgl_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/renderer/gl/wgl/wgl_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// wgl_utils.h: Utility routines specific to the WGL-&gt;EGL implementation.
+
+#ifndef LIBANGLE_RENDERER_GL_WGL_WGLUTILS_H_
+#define LIBANGLE_RENDERER_GL_WGL_WGLUTILS_H_
+
+#include &quot;common/platform.h&quot;
+
+namespace rx
+{
+
+namespace wgl
+{
+
+PIXELFORMATDESCRIPTOR GetDefaultPixelFormatDescriptor();
+
+}
+
+}
+
+#endif // LIBANGLE_RENDERER_GL_WGL_WGLUTILS_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationEGLcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,501 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// validationEGL.cpp: Validation functions for generic EGL entry point parameters
+
+#include &quot;libANGLE/validationEGL.h&quot;
+
+#include &quot;libANGLE/Config.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+
+namespace egl
+{
+
+Error ValidateDisplay(const Display *display)
+{
+    if (display == EGL_NO_DISPLAY)
+    {
+        return Error(EGL_BAD_DISPLAY);
+    }
+
+    if (!display-&gt;isInitialized())
+    {
+        return Error(EGL_NOT_INITIALIZED);
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+Error ValidateSurface(const Display *display, Surface *surface)
+{
+    Error error = ValidateDisplay(display);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!display-&gt;isValidSurface(surface))
+    {
+        return Error(EGL_BAD_SURFACE);
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+Error ValidateConfig(const Display *display, const Config *config)
+{
+    Error error = ValidateDisplay(display);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!display-&gt;isValidConfig(config))
+    {
+        return Error(EGL_BAD_CONFIG);
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+Error ValidateContext(const Display *display, gl::Context *context)
+{
+    Error error = ValidateDisplay(display);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!display-&gt;isValidContext(context))
+    {
+        return Error(EGL_BAD_CONTEXT);
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+Error ValidateCreateContext(Display *display, Config *configuration, gl::Context *shareContext,
+                            const AttributeMap&amp; attributes)
+{
+    Error error = ValidateConfig(display, configuration);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    // Get the requested client version (default is 1) and check it is 2 or 3.
+    EGLint clientMajorVersion = 1;
+    EGLint clientMinorVersion = 0;
+    EGLint contextFlags = 0;
+    bool resetNotification = false;
+    bool robustAccess = false;
+    for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
+    {
+        EGLint attribute = attributeIter-&gt;first;
+        EGLint value = attributeIter-&gt;second;
+
+        switch (attribute)
+        {
+          case EGL_CONTEXT_CLIENT_VERSION:
+            clientMajorVersion = value;
+            break;
+
+          case EGL_CONTEXT_MINOR_VERSION:
+            clientMinorVersion = value;
+            break;
+
+          case EGL_CONTEXT_FLAGS_KHR:
+            contextFlags = value;
+            break;
+
+          case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
+            // Only valid for OpenGL (non-ES) contexts
+            return Error(EGL_BAD_ATTRIBUTE);
+
+          case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
+            if (!display-&gt;getExtensions().createContextRobustness)
+            {
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            if (value != EGL_TRUE &amp;&amp; value != EGL_FALSE)
+            {
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            robustAccess = (value == EGL_TRUE);
+            break;
+
+          case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
+            static_assert(EGL_LOSE_CONTEXT_ON_RESET_EXT == EGL_LOSE_CONTEXT_ON_RESET_KHR, &quot;EGL extension enums not equal.&quot;);
+            static_assert(EGL_NO_RESET_NOTIFICATION_EXT == EGL_NO_RESET_NOTIFICATION_KHR, &quot;EGL extension enums not equal.&quot;);
+            // same as EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, fall through
+          case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
+            if (!display-&gt;getExtensions().createContextRobustness)
+            {
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            if (value == EGL_LOSE_CONTEXT_ON_RESET_EXT)
+            {
+                resetNotification = true;
+            }
+            else if (value != EGL_NO_RESET_NOTIFICATION_EXT)
+            {
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          default:
+            return Error(EGL_BAD_ATTRIBUTE);
+        }
+    }
+
+    if ((clientMajorVersion != 2 &amp;&amp; clientMajorVersion != 3) || clientMinorVersion != 0)
+    {
+        return Error(EGL_BAD_CONFIG);
+    }
+
+    if (clientMajorVersion == 3 &amp;&amp; !(configuration-&gt;conformant &amp; EGL_OPENGL_ES3_BIT_KHR))
+    {
+        return Error(EGL_BAD_CONFIG);
+    }
+
+    // Note: EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR does not apply to ES
+    const EGLint validContextFlags = (EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR |
+                                      EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR);
+    if ((contextFlags &amp; ~validContextFlags) != 0)
+    {
+        return Error(EGL_BAD_ATTRIBUTE);
+    }
+
+    if ((contextFlags &amp; EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) &gt; 0)
+    {
+        robustAccess = true;
+    }
+
+    if (robustAccess)
+    {
+        // Unimplemented
+        return Error(EGL_BAD_CONFIG);
+    }
+
+    if (shareContext)
+    {
+        // Shared context is invalid or is owned by another display
+        if (!display-&gt;isValidContext(shareContext))
+        {
+            return Error(EGL_BAD_MATCH);
+        }
+
+        if (shareContext-&gt;isResetNotificationEnabled() != resetNotification)
+        {
+            return Error(EGL_BAD_MATCH);
+        }
+
+        if (shareContext-&gt;getClientVersion() != clientMajorVersion)
+        {
+            return Error(EGL_BAD_CONTEXT);
+        }
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWindowType window,
+                                  const AttributeMap&amp; attributes)
+{
+    Error error = ValidateConfig(display, config);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    if (!display-&gt;isValidNativeWindow(window))
+    {
+        return Error(EGL_BAD_NATIVE_WINDOW);
+    }
+
+    const DisplayExtensions &amp;displayExtensions = display-&gt;getExtensions();
+
+    for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
+    {
+        EGLint attribute = attributeIter-&gt;first;
+        EGLint value = attributeIter-&gt;second;
+
+        switch (attribute)
+        {
+          case EGL_RENDER_BUFFER:
+            switch (value)
+            {
+              case EGL_BACK_BUFFER:
+                break;
+              case EGL_SINGLE_BUFFER:
+                return Error(EGL_BAD_MATCH);   // Rendering directly to front buffer not supported
+              default:
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
+            if (!displayExtensions.postSubBuffer)
+            {
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          case EGL_WIDTH:
+          case EGL_HEIGHT:
+            if (!displayExtensions.windowFixedSize)
+            {
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            if (value &lt; 0)
+            {
+                return Error(EGL_BAD_PARAMETER);
+            }
+            break;
+
+          case EGL_FIXED_SIZE_ANGLE:
+            if (!displayExtensions.windowFixedSize)
+            {
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          case EGL_VG_COLORSPACE:
+            return Error(EGL_BAD_MATCH);
+
+          case EGL_VG_ALPHA_FORMAT:
+            return Error(EGL_BAD_MATCH);
+
+          default:
+            return Error(EGL_BAD_ATTRIBUTE);
+        }
+    }
+
+    if (Display::hasExistingWindowSurface(window))
+    {
+        return Error(EGL_BAD_ALLOC);
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+Error ValidateCreatePbufferSurface(Display *display, Config *config, const AttributeMap&amp; attributes)
+{
+    Error error = ValidateConfig(display, config);
+    if (error.isError())
+    {
+        return error;
+    }
+    
+    for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
+    {
+        EGLint attribute = attributeIter-&gt;first;
+        EGLint value = attributeIter-&gt;second;
+
+        switch (attribute)
+        {
+          case EGL_WIDTH:
+          case EGL_HEIGHT:
+            if (value &lt; 0)
+            {
+                return Error(EGL_BAD_PARAMETER);
+            }
+            break;
+
+          case EGL_LARGEST_PBUFFER:
+            break;
+
+          case EGL_TEXTURE_FORMAT:
+            switch (value)
+            {
+              case EGL_NO_TEXTURE:
+              case EGL_TEXTURE_RGB:
+              case EGL_TEXTURE_RGBA:
+                break;
+              default:
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          case EGL_TEXTURE_TARGET:
+            switch (value)
+            {
+              case EGL_NO_TEXTURE:
+              case EGL_TEXTURE_2D:
+                break;
+              default:
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          case EGL_MIPMAP_TEXTURE:
+            break;
+
+          case EGL_VG_COLORSPACE:
+            break;
+
+          case EGL_VG_ALPHA_FORMAT:
+            break;
+
+          default:
+            return Error(EGL_BAD_ATTRIBUTE);
+        }
+    }
+
+    if (!(config-&gt;surfaceType &amp; EGL_PBUFFER_BIT))
+    {
+        return Error(EGL_BAD_MATCH);
+    }
+
+    const Caps &amp;caps = display-&gt;getCaps();
+
+    EGLenum textureFormat = attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
+    EGLenum textureTarget = attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
+
+    if ((textureFormat != EGL_NO_TEXTURE &amp;&amp; textureTarget == EGL_NO_TEXTURE) ||
+        (textureFormat == EGL_NO_TEXTURE &amp;&amp; textureTarget != EGL_NO_TEXTURE))
+    {
+        return Error(EGL_BAD_MATCH);
+    }
+
+    if ((textureFormat == EGL_TEXTURE_RGB  &amp;&amp; config-&gt;bindToTextureRGB != EGL_TRUE) ||
+        (textureFormat == EGL_TEXTURE_RGBA &amp;&amp; config-&gt;bindToTextureRGBA != EGL_TRUE))
+    {
+        return Error(EGL_BAD_ATTRIBUTE);
+    }
+
+    EGLint width = attributes.get(EGL_WIDTH, 0);
+    EGLint height = attributes.get(EGL_HEIGHT, 0);
+    if (textureFormat != EGL_NO_TEXTURE &amp;&amp; !caps.textureNPOT &amp;&amp; (!gl::isPow2(width) || !gl::isPow2(height)))
+    {
+        return Error(EGL_BAD_MATCH);
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, EGLClientBuffer buffer,
+                                            Config *config, const AttributeMap&amp; attributes)
+{
+    Error error = ValidateConfig(display, config);
+    if (error.isError())
+    {
+        return error;
+    }
+
+    const DisplayExtensions &amp;displayExtensions = display-&gt;getExtensions();
+
+    switch (buftype)
+    {
+      case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+        if (!displayExtensions.d3dShareHandleClientBuffer)
+        {
+            return Error(EGL_BAD_PARAMETER);
+        }
+        if (buffer == nullptr)
+        {
+            return Error(EGL_BAD_PARAMETER);
+        }
+        break;
+
+      default:
+        return Error(EGL_BAD_PARAMETER);
+    }
+
+    for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
+    {
+        EGLint attribute = attributeIter-&gt;first;
+        EGLint value = attributeIter-&gt;second;
+
+        switch (attribute)
+        {
+          case EGL_WIDTH:
+          case EGL_HEIGHT:
+            if (!displayExtensions.d3dShareHandleClientBuffer)
+            {
+                return Error(EGL_BAD_PARAMETER);
+            }
+            if (value &lt; 0)
+            {
+                return Error(EGL_BAD_PARAMETER);
+            }
+            break;
+
+          case EGL_TEXTURE_FORMAT:
+            switch (value)
+            {
+              case EGL_NO_TEXTURE:
+              case EGL_TEXTURE_RGB:
+              case EGL_TEXTURE_RGBA:
+                break;
+              default:
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          case EGL_TEXTURE_TARGET:
+            switch (value)
+            {
+              case EGL_NO_TEXTURE:
+              case EGL_TEXTURE_2D:
+                break;
+              default:
+                return Error(EGL_BAD_ATTRIBUTE);
+            }
+            break;
+
+          case EGL_MIPMAP_TEXTURE:
+            break;
+
+          default:
+            return Error(EGL_BAD_ATTRIBUTE);
+        }
+    }
+
+    if (!(config-&gt;surfaceType &amp; EGL_PBUFFER_BIT))
+    {
+        return Error(EGL_BAD_MATCH);
+    }
+
+    EGLenum textureFormat = attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE);
+    EGLenum textureTarget = attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE);
+    if ((textureFormat != EGL_NO_TEXTURE &amp;&amp; textureTarget == EGL_NO_TEXTURE) ||
+        (textureFormat == EGL_NO_TEXTURE &amp;&amp; textureTarget != EGL_NO_TEXTURE))
+    {
+        return Error(EGL_BAD_MATCH);
+    }
+
+    if ((textureFormat == EGL_TEXTURE_RGB  &amp;&amp; config-&gt;bindToTextureRGB  != EGL_TRUE) ||
+        (textureFormat == EGL_TEXTURE_RGBA &amp;&amp; config-&gt;bindToTextureRGBA != EGL_TRUE))
+    {
+        return Error(EGL_BAD_ATTRIBUTE);
+    }
+
+    if (buftype == EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE)
+    {
+        EGLint width = attributes.get(EGL_WIDTH, 0);
+        EGLint height = attributes.get(EGL_HEIGHT, 0);
+
+        if (width == 0 || height == 0)
+        {
+            return Error(EGL_BAD_ATTRIBUTE);
+        }
+
+        const Caps &amp;caps = display-&gt;getCaps();
+        if (textureFormat != EGL_NO_TEXTURE &amp;&amp; !caps.textureNPOT &amp;&amp; (!gl::isPow2(width) || !gl::isPow2(height)))
+        {
+            return Error(EGL_BAD_MATCH);
+        }
+    }
+
+    return Error(EGL_SUCCESS);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationEGLh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationEGL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+//
+// Copyright (c) 2015 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.
+//
+
+// validationEGL.h: Validation functions for generic EGL entry point parameters
+
+#ifndef LIBANGLE_VALIDATIONEGL_H_
+#define LIBANGLE_VALIDATIONEGL_H_
+
+#include &quot;libANGLE/Error.h&quot;
+
+#include &lt;EGL/egl.h&gt;
+
+namespace gl
+{
+class Context;
+}
+
+namespace egl
+{
+
+class AttributeMap;
+struct Config;
+class Display;
+class Surface;
+
+// Object validation
+Error ValidateDisplay(const Display *display);
+Error ValidateSurface(const Display *display, Surface *surface);
+Error ValidateConfig(const Display *display, const Config *config);
+Error ValidateContext(const Display *display, gl::Context *context);
+
+// Entry point validation
+Error ValidateCreateContext(Display *display, Config *configuration, gl::Context *shareContext,
+                            const AttributeMap&amp; attributes);
+
+Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWindowType window,
+                                  const AttributeMap&amp; attributes);
+
+Error ValidateCreatePbufferSurface(Display *display, Config *config, const AttributeMap&amp; attributes);
+Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, EGLClientBuffer buffer,
+                                            Config *config, const AttributeMap&amp; attributes);
+
+
+}
+
+#endif // LIBANGLE_VALIDATIONEGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationEScpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1897 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// validationES.h: Validation functions for generic OpenGL ES entry point parameters
+
+#include &quot;libANGLE/validationES.h&quot;
+#include &quot;libANGLE/validationES2.h&quot;
+#include &quot;libANGLE/validationES3.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Query.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Uniform.h&quot;
+#include &quot;libANGLE/TransformFeedback.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/renderer/BufferImpl.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace gl
+{
+
+bool ValidCap(const Context *context, GLenum cap)
+{
+    switch (cap)
+    {
+      case GL_CULL_FACE:
+      case GL_POLYGON_OFFSET_FILL:
+      case GL_SAMPLE_ALPHA_TO_COVERAGE:
+      case GL_SAMPLE_COVERAGE:
+      case GL_SCISSOR_TEST:
+      case GL_STENCIL_TEST:
+      case GL_DEPTH_TEST:
+      case GL_BLEND:
+      case GL_DITHER:
+        return true;
+      case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+      case GL_RASTERIZER_DISCARD:
+        return (context-&gt;getClientVersion() &gt;= 3);
+      default:
+        return false;
+    }
+}
+
+bool ValidTextureTarget(const Context *context, GLenum target)
+{
+    switch (target)
+    {
+      case GL_TEXTURE_2D:
+      case GL_TEXTURE_CUBE_MAP:
+        return true;
+
+      case GL_TEXTURE_3D:
+      case GL_TEXTURE_2D_ARRAY:
+        return (context-&gt;getClientVersion() &gt;= 3);
+
+      default:
+        return false;
+    }
+}
+
+// This function differs from ValidTextureTarget in that the target must be
+// usable as the destination of a 2D operation-- so a cube face is valid, but
+// GL_TEXTURE_CUBE_MAP is not.
+// Note: duplicate of IsInternalTextureTarget
+bool ValidTexture2DDestinationTarget(const Context *context, GLenum target)
+{
+    switch (target)
+    {
+      case GL_TEXTURE_2D:
+      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:
+        return true;
+      case GL_TEXTURE_2D_ARRAY:
+      case GL_TEXTURE_3D:
+        return (context-&gt;getClientVersion() &gt;= 3);
+      default:
+        return false;
+    }
+}
+
+bool ValidFramebufferTarget(GLenum target)
+{
+    static_assert(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER &amp;&amp; GL_READ_FRAMEBUFFER_ANGLE == GL_READ_FRAMEBUFFER,
+                  &quot;ANGLE framebuffer enums must equal the ES3 framebuffer enums.&quot;);
+
+    switch (target)
+    {
+      case GL_FRAMEBUFFER:      return true;
+      case GL_READ_FRAMEBUFFER: return true;
+      case GL_DRAW_FRAMEBUFFER: return true;
+      default:                  return false;
+    }
+}
+
+bool ValidBufferTarget(const Context *context, GLenum target)
+{
+    switch (target)
+    {
+      case GL_ARRAY_BUFFER:
+      case GL_ELEMENT_ARRAY_BUFFER:
+        return true;
+
+      case GL_PIXEL_PACK_BUFFER:
+      case GL_PIXEL_UNPACK_BUFFER:
+        return context-&gt;getExtensions().pixelBufferObject;
+
+      case GL_COPY_READ_BUFFER:
+      case GL_COPY_WRITE_BUFFER:
+      case GL_TRANSFORM_FEEDBACK_BUFFER:
+      case GL_UNIFORM_BUFFER:
+        return (context-&gt;getClientVersion() &gt;= 3);
+
+      default:
+        return false;
+    }
+}
+
+bool ValidBufferParameter(const Context *context, GLenum pname)
+{
+    const Extensions &amp;extensions = context-&gt;getExtensions();
+
+    switch (pname)
+    {
+      case GL_BUFFER_USAGE:
+      case GL_BUFFER_SIZE:
+        return true;
+
+      case GL_BUFFER_ACCESS_OES:
+        return extensions.mapBuffer;
+
+      case GL_BUFFER_MAPPED:
+        static_assert(GL_BUFFER_MAPPED == GL_BUFFER_MAPPED_OES, &quot;GL enums should be equal.&quot;);
+        return (context-&gt;getClientVersion() &gt;= 3) || extensions.mapBuffer || extensions.mapBufferRange;
+
+      // GL_BUFFER_MAP_POINTER is a special case, and may only be
+      // queried with GetBufferPointerv
+      case GL_BUFFER_ACCESS_FLAGS:
+      case GL_BUFFER_MAP_OFFSET:
+      case GL_BUFFER_MAP_LENGTH:
+        return (context-&gt;getClientVersion() &gt;= 3) || extensions.mapBufferRange;
+
+      default:
+        return false;
+    }
+}
+
+bool ValidMipLevel(const Context *context, GLenum target, GLint level)
+{
+    size_t maxDimension = 0;
+    switch (target)
+    {
+      case GL_TEXTURE_2D:                  maxDimension = context-&gt;getCaps().max2DTextureSize;       break;
+      case GL_TEXTURE_CUBE_MAP:
+      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: maxDimension = context-&gt;getCaps().maxCubeMapTextureSize;  break;
+      case GL_TEXTURE_3D:                  maxDimension = context-&gt;getCaps().max3DTextureSize;       break;
+      case GL_TEXTURE_2D_ARRAY:            maxDimension = context-&gt;getCaps().max2DTextureSize;       break;
+      default: UNREACHABLE();
+    }
+
+    return level &lt;= gl::log2(static_cast&lt;int&gt;(maxDimension));
+}
+
+bool ValidImageSize(const Context *context, GLenum target, GLint level,
+                    GLsizei width, GLsizei height, GLsizei depth)
+{
+    if (level &lt; 0 || width &lt; 0 || height &lt; 0 || depth &lt; 0)
+    {
+        return false;
+    }
+
+    if (!context-&gt;getExtensions().textureNPOT &amp;&amp;
+        (level != 0 &amp;&amp; (!gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth))))
+    {
+        return false;
+    }
+
+    if (!ValidMipLevel(context, target, level))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidCompressedImageSize(const Context *context, GLenum internalFormat, GLsizei width, GLsizei height)
+{
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalFormat);
+    if (!formatInfo.compressed)
+    {
+        return false;
+    }
+
+    if (width  &lt; 0 || (static_cast&lt;GLuint&gt;(width)  &gt; formatInfo.compressedBlockWidth  &amp;&amp; width  % formatInfo.compressedBlockWidth != 0) ||
+        height &lt; 0 || (static_cast&lt;GLuint&gt;(height) &gt; formatInfo.compressedBlockHeight &amp;&amp; height % formatInfo.compressedBlockHeight != 0))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidQueryType(const Context *context, GLenum queryType)
+{
+    static_assert(GL_ANY_SAMPLES_PASSED == GL_ANY_SAMPLES_PASSED_EXT, &quot;GL extension enums not equal.&quot;);
+    static_assert(GL_ANY_SAMPLES_PASSED_CONSERVATIVE == GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, &quot;GL extension enums not equal.&quot;);
+
+    switch (queryType)
+    {
+      case GL_ANY_SAMPLES_PASSED:
+      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+        return true;
+      case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+        return (context-&gt;getClientVersion() &gt;= 3);
+      default:
+        return false;
+    }
+}
+
+bool ValidProgram(Context *context, GLuint id)
+{
+    // ES3 spec (section 2.11.1) -- &quot;Commands that accept shader or program object names will generate the
+    // error INVALID_VALUE if the provided name is not the name of either a shader or program object and
+    // INVALID_OPERATION if the provided name identifies an object that is not the expected type.&quot;
+
+    if (context-&gt;getProgram(id) != NULL)
+    {
+        return true;
+    }
+    else if (context-&gt;getShader(id) != NULL)
+    {
+        // ID is the wrong type
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+    else
+    {
+        // No shader/program object has this ID
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+}
+
+bool ValidateAttachmentTarget(gl::Context *context, GLenum attachment)
+{
+    if (attachment &gt;= GL_COLOR_ATTACHMENT0_EXT &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15_EXT)
+    {
+        const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
+
+        if (colorAttachment &gt;= context-&gt;getCaps().maxColorAttachments)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+    else
+    {
+        switch (attachment)
+        {
+          case GL_DEPTH_ATTACHMENT:
+          case GL_STENCIL_ATTACHMENT:
+            break;
+
+          case GL_DEPTH_STENCIL_ATTACHMENT:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool ValidateRenderbufferStorageParametersBase(gl::Context *context, GLenum target, GLsizei samples,
+                                               GLenum internalformat, GLsizei width, GLsizei height)
+{
+    switch (target)
+    {
+      case GL_RENDERBUFFER:
+        break;
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (width &lt; 0 || height &lt; 0 || samples &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    const TextureCaps &amp;formatCaps = context-&gt;getTextureCaps().get(internalformat);
+    if (!formatCaps.renderable)
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    // ANGLE_framebuffer_multisample does not explicitly state that the internal format must be
+    // sized but it does state that the format must be in the ES2.0 spec table 4.5 which contains
+    // only sized internal formats.
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalformat);
+    if (formatInfo.pixelBytes == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (static_cast&lt;GLuint&gt;(std::max(width, height)) &gt; context-&gt;getCaps().maxRenderbufferSize)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    GLuint handle = context-&gt;getState().getRenderbufferId();
+    if (handle == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateRenderbufferStorageParametersANGLE(gl::Context *context, GLenum target, GLsizei samples,
+                                                GLenum internalformat, GLsizei width, GLsizei height)
+{
+    ASSERT(samples == 0 || context-&gt;getExtensions().framebufferMultisample);
+
+    // ANGLE_framebuffer_multisample states that the value of samples must be less than or equal
+    // to MAX_SAMPLES_ANGLE (Context::getCaps().maxSamples) otherwise GL_INVALID_VALUE is
+    // generated.
+    if (static_cast&lt;GLuint&gt;(samples) &gt; context-&gt;getCaps().maxSamples)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    // ANGLE_framebuffer_multisample states GL_OUT_OF_MEMORY is generated on a failure to create
+    // the specified storage. This is different than ES 3.0 in which a sample number higher
+    // than the maximum sample number supported  by this format generates a GL_INVALID_VALUE.
+    // The TextureCaps::getMaxSamples method is only guarenteed to be valid when the context is ES3.
+    if (context-&gt;getClientVersion() &gt;= 3)
+    {
+        const TextureCaps &amp;formatCaps = context-&gt;getTextureCaps().get(internalformat);
+        if (static_cast&lt;GLuint&gt;(samples) &gt; formatCaps.getMaxSamples())
+        {
+            context-&gt;recordError(Error(GL_OUT_OF_MEMORY));
+            return false;
+        }
+    }
+
+    return ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width, height);
+}
+
+bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum target, GLenum attachment,
+                                               GLenum renderbuffertarget, GLuint renderbuffer)
+{
+    if (!ValidFramebufferTarget(target))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    gl::Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+
+    ASSERT(framebuffer);
+    if (framebuffer-&gt;id() == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION, &quot;Cannot change default FBO's attachments&quot;));
+        return false;
+    }
+
+    if (!ValidateAttachmentTarget(context, attachment))
+    {
+        return false;
+    }
+
+    // [OpenGL ES 2.0.25] Section 4.4.3 page 112
+    // [OpenGL ES 3.0.2] Section 4.4.2 page 201
+    // 'renderbuffer' must be either zero or the name of an existing renderbuffer object of
+    // type 'renderbuffertarget', otherwise an INVALID_OPERATION error is generated.
+    if (renderbuffer != 0)
+    {
+        if (!context-&gt;getRenderbuffer(renderbuffer))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+static bool IsPartialBlit(gl::Context *context, const gl::FramebufferAttachment *readBuffer, const gl::FramebufferAttachment *writeBuffer,
+                          GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+                          GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
+{
+    if (srcX0 != 0 || srcY0 != 0 || dstX0 != 0 || dstY0 != 0 ||
+        dstX1 != writeBuffer-&gt;getWidth() || dstY1 != writeBuffer-&gt;getHeight() ||
+        srcX1 != readBuffer-&gt;getWidth() || srcY1 != readBuffer-&gt;getHeight())
+    {
+        return true;
+    }
+    else if (context-&gt;getState().isScissorTestEnabled())
+    {
+        const Rectangle &amp;scissor = context-&gt;getState().getScissor();
+
+        return scissor.x &gt; 0 || scissor.y &gt; 0 ||
+               scissor.width &lt; writeBuffer-&gt;getWidth() ||
+               scissor.height &lt; writeBuffer-&gt;getHeight();
+    }
+    else
+    {
+        return false;
+    }
+}
+
+bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+                                       GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
+                                       GLenum filter, bool fromAngleExtension)
+{
+    switch (filter)
+    {
+      case GL_NEAREST:
+        break;
+      case GL_LINEAR:
+        if (fromAngleExtension)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if ((mask &amp; ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (mask == 0)
+    {
+        // ES3.0 spec, section 4.3.2 specifies that a mask of zero is valid and no
+        // buffers are copied.
+        return false;
+    }
+
+    if (fromAngleExtension &amp;&amp; (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0))
+    {
+        ERR(&quot;Scaling and flipping in BlitFramebufferANGLE not supported by this implementation.&quot;);
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // ES3.0 spec, section 4.3.2 states that linear filtering is only available for the
+    // color buffer, leaving only nearest being unfiltered from above
+    if ((mask &amp; ~GL_COLOR_BUFFER_BIT) != 0 &amp;&amp; filter != GL_NEAREST)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (context-&gt;getState().getReadFramebuffer()-&gt;id() == context-&gt;getState().getDrawFramebuffer()-&gt;id())
+    {
+        if (fromAngleExtension)
+        {
+            ERR(&quot;Blits with the same source and destination framebuffer are not supported by this &quot;
+                &quot;implementation.&quot;);
+        }
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::Framebuffer *readFramebuffer = context-&gt;getState().getReadFramebuffer();
+    const gl::Framebuffer *drawFramebuffer = context-&gt;getState().getDrawFramebuffer();
+
+    if (!readFramebuffer || !drawFramebuffer)
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    if (!readFramebuffer-&gt;checkStatus(context-&gt;getData()))
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    if (!drawFramebuffer-&gt;checkStatus(context-&gt;getData()))
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    if (drawFramebuffer-&gt;getSamples(context-&gt;getData()) != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    bool sameBounds = srcX0 == dstX0 &amp;&amp; srcY0 == dstY0 &amp;&amp; srcX1 == dstX1 &amp;&amp; srcY1 == dstY1;
+
+    if (mask &amp; GL_COLOR_BUFFER_BIT)
+    {
+        const gl::FramebufferAttachment *readColorBuffer = readFramebuffer-&gt;getReadColorbuffer();
+        const gl::FramebufferAttachment *drawColorBuffer = drawFramebuffer-&gt;getFirstColorbuffer();
+
+        if (readColorBuffer &amp;&amp; drawColorBuffer)
+        {
+            GLenum readInternalFormat = readColorBuffer-&gt;getInternalFormat();
+            const InternalFormat &amp;readFormatInfo = GetInternalFormatInfo(readInternalFormat);
+
+            for (GLuint i = 0; i &lt; context-&gt;getCaps().maxColorAttachments; i++)
+            {
+                if (drawFramebuffer-&gt;isEnabledColorAttachment(i))
+                {
+                    GLenum drawInternalFormat = drawFramebuffer-&gt;getColorbuffer(i)-&gt;getInternalFormat();
+                    const InternalFormat &amp;drawFormatInfo = GetInternalFormatInfo(drawInternalFormat);
+
+                    // The GL ES 3.0.2 spec (pg 193) states that:
+                    // 1) If the read buffer is fixed point format, the draw buffer must be as well
+                    // 2) If the read buffer is an unsigned integer format, the draw buffer must be as well
+                    // 3) If the read buffer is a signed integer format, the draw buffer must be as well
+                    if ( (readFormatInfo.componentType == GL_UNSIGNED_NORMALIZED || readFormatInfo.componentType == GL_SIGNED_NORMALIZED) &amp;&amp;
+                        !(drawFormatInfo.componentType == GL_UNSIGNED_NORMALIZED || drawFormatInfo.componentType == GL_SIGNED_NORMALIZED))
+                    {
+                        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                        return false;
+                    }
+
+                    if (readFormatInfo.componentType == GL_UNSIGNED_INT &amp;&amp; drawFormatInfo.componentType != GL_UNSIGNED_INT)
+                    {
+                        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                        return false;
+                    }
+
+                    if (readFormatInfo.componentType == GL_INT &amp;&amp; drawFormatInfo.componentType != GL_INT)
+                    {
+                        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                        return false;
+                    }
+
+                    if (readColorBuffer-&gt;getSamples() &gt; 0 &amp;&amp; (readInternalFormat != drawInternalFormat || !sameBounds))
+                    {
+                        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                        return false;
+                    }
+                }
+            }
+
+            if ((readFormatInfo.componentType == GL_INT || readFormatInfo.componentType == GL_UNSIGNED_INT) &amp;&amp; filter == GL_LINEAR)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+
+            if (fromAngleExtension)
+            {
+                const FramebufferAttachment *readColorAttachment = readFramebuffer-&gt;getReadColorbuffer();
+                if (!readColorAttachment ||
+                    (!(readColorAttachment-&gt;type() == GL_TEXTURE &amp;&amp; readColorAttachment-&gt;getTextureImageIndex().type == GL_TEXTURE_2D) &amp;&amp;
+                    readColorAttachment-&gt;type() != GL_RENDERBUFFER &amp;&amp;
+                    readColorAttachment-&gt;type() != GL_FRAMEBUFFER_DEFAULT))
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return false;
+                }
+
+                for (GLuint colorAttachment = 0; colorAttachment &lt; context-&gt;getCaps().maxColorAttachments; ++colorAttachment)
+                {
+                    if (drawFramebuffer-&gt;isEnabledColorAttachment(colorAttachment))
+                    {
+                        const FramebufferAttachment *attachment = drawFramebuffer-&gt;getColorbuffer(colorAttachment);
+                        ASSERT(attachment);
+
+                        if (!(attachment-&gt;type() == GL_TEXTURE &amp;&amp; attachment-&gt;getTextureImageIndex().type == GL_TEXTURE_2D) &amp;&amp;
+                            attachment-&gt;type() != GL_RENDERBUFFER &amp;&amp;
+                            attachment-&gt;type() != GL_FRAMEBUFFER_DEFAULT)
+                        {
+                            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                            return false;
+                        }
+
+                        // Return an error if the destination formats do not match
+                        if (attachment-&gt;getInternalFormat() != readColorBuffer-&gt;getInternalFormat())
+                        {
+                            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                            return false;
+                        }
+                    }
+                }
+
+                int readSamples = readFramebuffer-&gt;getSamples(context-&gt;getData());
+
+                if (readSamples != 0 &amp;&amp; IsPartialBlit(context, readColorBuffer, drawColorBuffer,
+                                                      srcX0, srcY0, srcX1, srcY1,
+                                                      dstX0, dstY0, dstX1, dstY1))
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return false;
+                }
+            }
+        }
+    }
+
+    GLenum masks[] = {GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT};
+    GLenum attachments[] = {GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT};
+    for (size_t i = 0; i &lt; 2; i++)
+    {
+        if (mask &amp; masks[i])
+        {
+            const gl::FramebufferAttachment *readBuffer = readFramebuffer-&gt;getAttachment(attachments[i]);
+            const gl::FramebufferAttachment *drawBuffer = drawFramebuffer-&gt;getAttachment(attachments[i]);
+
+            if (readBuffer &amp;&amp; drawBuffer)
+            {
+                if (readBuffer-&gt;getInternalFormat() != drawBuffer-&gt;getInternalFormat())
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return false;
+                }
+
+                if (readBuffer-&gt;getSamples() &gt; 0 &amp;&amp; !sameBounds)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return false;
+                }
+
+                if (fromAngleExtension)
+                {
+                    if (IsPartialBlit(context, readBuffer, drawBuffer,
+                                      srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
+                    {
+                        ERR(&quot;Only whole-buffer depth and stencil blits are supported by this implementation.&quot;);
+                        context-&gt;recordError(Error(GL_INVALID_OPERATION)); // only whole-buffer copies are permitted
+                        return false;
+                    }
+
+                    if (readBuffer-&gt;getSamples() != 0 || drawBuffer-&gt;getSamples() != 0)
+                    {
+                        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                        return false;
+                    }
+                }
+            }
+        }
+    }
+
+    return true;
+}
+
+bool ValidateGetVertexAttribParameters(Context *context, GLenum pname)
+{
+    switch (pname)
+    {
+      case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+      case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+      case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+      case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+      case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+      case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+      case GL_CURRENT_VERTEX_ATTRIB:
+        return true;
+
+      case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
+        // Don't verify ES3 context because GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE uses
+        // the same constant.
+        static_assert(GL_VERTEX_ATTRIB_ARRAY_DIVISOR == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE,
+                      &quot;ANGLE extension enums not equal to GL enums.&quot;);
+        return true;
+
+      case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        return true;
+
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+}
+
+bool ValidateTexParamParameters(gl::Context *context, GLenum pname, GLint param)
+{
+    switch (pname)
+    {
+      case GL_TEXTURE_WRAP_R:
+      case GL_TEXTURE_SWIZZLE_R:
+      case GL_TEXTURE_SWIZZLE_G:
+      case GL_TEXTURE_SWIZZLE_B:
+      case GL_TEXTURE_SWIZZLE_A:
+      case GL_TEXTURE_BASE_LEVEL:
+      case GL_TEXTURE_MAX_LEVEL:
+      case GL_TEXTURE_COMPARE_MODE:
+      case GL_TEXTURE_COMPARE_FUNC:
+      case GL_TEXTURE_MIN_LOD:
+      case GL_TEXTURE_MAX_LOD:
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+
+      default: break;
+    }
+
+    switch (pname)
+    {
+      case GL_TEXTURE_WRAP_S:
+      case GL_TEXTURE_WRAP_T:
+      case GL_TEXTURE_WRAP_R:
+        switch (param)
+        {
+          case GL_REPEAT:
+          case GL_CLAMP_TO_EDGE:
+          case GL_MIRRORED_REPEAT:
+            return true;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+
+      case GL_TEXTURE_MIN_FILTER:
+        switch (param)
+        {
+          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:
+            return true;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_MAG_FILTER:
+        switch (param)
+        {
+          case GL_NEAREST:
+          case GL_LINEAR:
+            return true;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_USAGE_ANGLE:
+        switch (param)
+        {
+          case GL_NONE:
+          case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
+            return true;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+        if (!context-&gt;getExtensions().textureFilterAnisotropic)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+
+        // we assume the parameter passed to this validation method is truncated, not rounded
+        if (param &lt; 1)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        return true;
+
+      case GL_TEXTURE_MIN_LOD:
+      case GL_TEXTURE_MAX_LOD:
+        // any value is permissible
+        return true;
+
+      case GL_TEXTURE_COMPARE_MODE:
+        // Acceptable mode parameters from GLES 3.0.2 spec, table 3.17
+        switch (param)
+        {
+          case GL_NONE:
+          case GL_COMPARE_REF_TO_TEXTURE:
+            return true;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_COMPARE_FUNC:
+        // Acceptable function parameters from GLES 3.0.2 spec, table 3.17
+        switch (param)
+        {
+          case GL_LEQUAL:
+          case GL_GEQUAL:
+          case GL_LESS:
+          case GL_GREATER:
+          case GL_EQUAL:
+          case GL_NOTEQUAL:
+          case GL_ALWAYS:
+          case GL_NEVER:
+            return true;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_SWIZZLE_R:
+      case GL_TEXTURE_SWIZZLE_G:
+      case GL_TEXTURE_SWIZZLE_B:
+      case GL_TEXTURE_SWIZZLE_A:
+        switch (param)
+        {
+          case GL_RED:
+          case GL_GREEN:
+          case GL_BLUE:
+          case GL_ALPHA:
+          case GL_ZERO:
+          case GL_ONE:
+            return true;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_BASE_LEVEL:
+      case GL_TEXTURE_MAX_LEVEL:
+        if (param &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        return true;
+
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+}
+
+bool ValidateSamplerObjectParameter(gl::Context *context, GLenum pname)
+{
+    switch (pname)
+    {
+      case GL_TEXTURE_MIN_FILTER:
+      case GL_TEXTURE_MAG_FILTER:
+      case GL_TEXTURE_WRAP_S:
+      case GL_TEXTURE_WRAP_T:
+      case GL_TEXTURE_WRAP_R:
+      case GL_TEXTURE_MIN_LOD:
+      case GL_TEXTURE_MAX_LOD:
+      case GL_TEXTURE_COMPARE_MODE:
+      case GL_TEXTURE_COMPARE_FUNC:
+        return true;
+
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+}
+
+bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsizei width, GLsizei height,
+                                  GLenum format, GLenum type, GLsizei *bufSize, GLvoid *pixels)
+{
+    gl::Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+    ASSERT(framebuffer);
+
+    if (framebuffer-&gt;checkStatus(context-&gt;getData()) != GL_FRAMEBUFFER_COMPLETE)
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    if (context-&gt;getState().getReadFramebuffer()-&gt;id() != 0 &amp;&amp;
+        framebuffer-&gt;getSamples(context-&gt;getData()) != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const FramebufferAttachment *readBuffer = framebuffer-&gt;getReadColorbuffer();
+    if (!readBuffer)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    GLenum currentFormat = framebuffer-&gt;getImplementationColorReadFormat();
+    GLenum currentType = framebuffer-&gt;getImplementationColorReadType();
+    GLenum currentInternalFormat = readBuffer-&gt;getInternalFormat();
+    GLuint clientVersion = context-&gt;getClientVersion();
+
+    bool validReadFormat = (clientVersion &lt; 3) ? ValidES2ReadFormatType(context, format, type) :
+                                                 ValidES3ReadFormatType(context, currentInternalFormat, format, type);
+
+    if (!(currentFormat == format &amp;&amp; currentType == type) &amp;&amp; !validReadFormat)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    GLenum sizedInternalFormat = GetSizedInternalFormat(format, type);
+    const InternalFormat &amp;sizedFormatInfo = GetInternalFormatInfo(sizedInternalFormat);
+
+    GLsizei outputPitch = sizedFormatInfo.computeRowPitch(type, width, context-&gt;getState().getPackAlignment(), 0);
+    // sized query sanity check
+    if (bufSize)
+    {
+        int requiredSize = outputPitch * height;
+        if (requiredSize &gt; *bufSize)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id)
+{
+    if (!ValidQueryType(context, target))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (id == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an &lt;id&gt;
+    // of zero, if the active query object name for &lt;target&gt; 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 &lt;id&gt; is the name of an
+    // existing query object whose type does not match &lt;target&gt;, or if &lt;id&gt; 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.
+    if (context-&gt;getState().isQueryActive())
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    Query *queryObject = context-&gt;getQuery(id, true, target);
+
+    // check that name was obtained with glGenQueries
+    if (!queryObject)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // check for type mismatch
+    if (queryObject-&gt;getType() != target)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateEndQuery(gl::Context *context, GLenum target)
+{
+    if (!ValidQueryType(context, target))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    const Query *queryObject = context-&gt;getState().getActiveQuery(target);
+
+    if (queryObject == NULL)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+static bool ValidateUniformCommonBase(gl::Context *context, GLenum targetUniformType,
+                                      GLint location, GLsizei count, LinkedUniform **uniformOut)
+{
+    if (count &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    gl::Program *program = context-&gt;getState().getProgram();
+    if (!program)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (location == -1)
+    {
+        // Silently ignore the uniform command
+        return false;
+    }
+
+    if (!program-&gt;isValidUniformLocation(location))
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    LinkedUniform *uniform = program-&gt;getUniformByLocation(location);
+
+    // attempting to write an array to a non-array uniform is an INVALID_OPERATION
+    if (uniform-&gt;elementCount() == 1 &amp;&amp; count &gt; 1)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    *uniformOut = uniform;
+    return true;
+}
+
+bool ValidateUniform(gl::Context *context, GLenum uniformType, GLint location, GLsizei count)
+{
+    // Check for ES3 uniform entry points
+    if (VariableComponentType(uniformType) == GL_UNSIGNED_INT &amp;&amp; context-&gt;getClientVersion() &lt; 3)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    LinkedUniform *uniform = NULL;
+    if (!ValidateUniformCommonBase(context, uniformType, location, count, &amp;uniform))
+    {
+        return false;
+    }
+
+    GLenum targetBoolType = VariableBoolVectorType(uniformType);
+    bool samplerUniformCheck = (IsSamplerType(uniform-&gt;type) &amp;&amp; uniformType == GL_INT);
+    if (!samplerUniformCheck &amp;&amp; uniformType != uniform-&gt;type &amp;&amp; targetBoolType != uniform-&gt;type)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateUniformMatrix(gl::Context *context, GLenum matrixType, GLint location, GLsizei count,
+                           GLboolean transpose)
+{
+    // Check for ES3 uniform entry points
+    int rows = VariableRowCount(matrixType);
+    int cols = VariableColumnCount(matrixType);
+    if (rows != cols &amp;&amp; context-&gt;getClientVersion() &lt; 3)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (transpose != GL_FALSE &amp;&amp; context-&gt;getClientVersion() &lt; 3)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    LinkedUniform *uniform = NULL;
+    if (!ValidateUniformCommonBase(context, matrixType, location, count, &amp;uniform))
+    {
+        return false;
+    }
+
+    if (uniform-&gt;type != matrixType)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateStateQuery(gl::Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams)
+{
+    if (!context-&gt;getQueryParameterInfo(pname, nativeType, numParams))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    const Caps &amp;caps = context-&gt;getCaps();
+
+    if (pname &gt;= GL_DRAW_BUFFER0 &amp;&amp; pname &lt;= GL_DRAW_BUFFER15)
+    {
+        unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0);
+
+        if (colorAttachment &gt;= caps.maxDrawBuffers)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    switch (pname)
+    {
+      case GL_TEXTURE_BINDING_2D:
+      case GL_TEXTURE_BINDING_CUBE_MAP:
+      case GL_TEXTURE_BINDING_3D:
+      case GL_TEXTURE_BINDING_2D_ARRAY:
+        if (context-&gt;getState().getActiveSampler() &gt;= caps.maxCombinedTextureImageUnits)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+        break;
+
+      case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+      case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+        {
+            Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+            ASSERT(framebuffer);
+            if (framebuffer-&gt;checkStatus(context-&gt;getData()) != GL_FRAMEBUFFER_COMPLETE)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+
+            const FramebufferAttachment *attachment = framebuffer-&gt;getReadColorbuffer();
+            if (!attachment)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+        }
+        break;
+
+      default:
+        break;
+    }
+
+    // pname is valid, but there are no parameters to return
+    if (numParams == 0)
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateCopyTexImageParametersBase(gl::Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+                                        GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+                                        GLint border, GLenum *textureFormatOut)
+{
+
+    if (!ValidTexture2DDestinationTarget(context, target))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (level &lt; 0 || xoffset &lt; 0 || yoffset &lt; 0 || zoffset &lt; 0 || width &lt; 0 || height &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width || std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (border != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (!ValidMipLevel(context, target, level))
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    gl::Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+    if (framebuffer-&gt;checkStatus(context-&gt;getData()) != GL_FRAMEBUFFER_COMPLETE)
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    if (context-&gt;getState().getReadFramebuffer()-&gt;id() != 0 &amp;&amp; framebuffer-&gt;getSamples(context-&gt;getData()) != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::Caps &amp;caps = context-&gt;getCaps();
+
+    GLuint maxDimension = 0;
+    switch (target)
+    {
+      case GL_TEXTURE_2D:
+        maxDimension = caps.max2DTextureSize;
+        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:
+        maxDimension = caps.maxCubeMapTextureSize;
+        break;
+
+      case GL_TEXTURE_2D_ARRAY:
+        maxDimension = caps.max2DTextureSize;
+        break;
+
+      case GL_TEXTURE_3D:
+        maxDimension = caps.max3DTextureSize;
+        break;
+
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    gl::Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+    if (!texture)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (texture-&gt;isImmutable() &amp;&amp; !isSubImage)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalformat);
+
+    if (formatInfo.depthBits &gt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (formatInfo.compressed &amp;&amp; !ValidCompressedImageSize(context, internalformat, width, height))
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (isSubImage)
+    {
+        if (static_cast&lt;size_t&gt;(xoffset + width) &gt; texture-&gt;getWidth(target, level) ||
+            static_cast&lt;size_t&gt;(yoffset + height) &gt; texture-&gt;getHeight(target, level) ||
+            static_cast&lt;size_t&gt;(zoffset) &gt;= texture-&gt;getDepth(target, level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+    else
+    {
+        if (IsCubeMapTextureTarget(target) &amp;&amp; width != height)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+
+        if (!formatInfo.textureSupport(context-&gt;getClientVersion(), context-&gt;getExtensions()))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+
+        int maxLevelDimension = (maxDimension &gt;&gt; level);
+        if (static_cast&lt;int&gt;(width) &gt; maxLevelDimension || static_cast&lt;int&gt;(height) &gt; maxLevelDimension)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+
+    *textureFormatOut = texture-&gt;getInternalFormat(target, level);
+    return true;
+}
+
+static bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count, GLsizei maxVertex, GLsizei primcount)
+{
+    switch (mode)
+    {
+      case GL_POINTS:
+      case GL_LINES:
+      case GL_LINE_LOOP:
+      case GL_LINE_STRIP:
+      case GL_TRIANGLES:
+      case GL_TRIANGLE_STRIP:
+      case GL_TRIANGLE_FAN:
+        break;
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (count &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    const State &amp;state = context-&gt;getState();
+
+    // Check for mapped buffers
+    if (state.hasMappedBuffer(GL_ARRAY_BUFFER))
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::DepthStencilState &amp;depthStencilState = state.getDepthStencilState();
+    if (depthStencilState.stencilWritemask != depthStencilState.stencilBackWritemask ||
+        state.getStencilRef() != state.getStencilBackRef() ||
+        depthStencilState.stencilMask != depthStencilState.stencilBackMask)
+    {
+        // Note: these separate values are not supported in WebGL, due to D3D's limitations.
+        // See Section 6.10 of the WebGL 1.0 spec
+        ERR(&quot;This ANGLE implementation does not support separate front/back stencil &quot;
+            &quot;writemasks, reference values, or stencil mask values.&quot;);
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::Framebuffer *fbo = state.getDrawFramebuffer();
+    if (!fbo || fbo-&gt;checkStatus(context-&gt;getData()) != GL_FRAMEBUFFER_COMPLETE)
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    gl::Program *program = state.getProgram();
+    if (!program)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (!program-&gt;validateSamplers(NULL, context-&gt;getCaps()))
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // Buffer validations
+    const VertexArray *vao = state.getVertexArray();
+    const auto &amp;vertexAttribs = vao-&gt;getVertexAttributes();
+    const int *semanticIndexes = program-&gt;getSemanticIndexes();
+    unsigned int maxEnabledAttrib = vao-&gt;getMaxEnabledAttribute();
+    for (size_t attributeIndex = 0; attributeIndex &lt; maxEnabledAttrib; ++attributeIndex)
+    {
+        const VertexAttribute &amp;attrib = vertexAttribs[attributeIndex];
+        bool attribActive = (semanticIndexes[attributeIndex] != -1);
+        if (attribActive &amp;&amp; attrib.enabled)
+        {
+            gl::Buffer *buffer = attrib.buffer.get();
+
+            if (buffer)
+            {
+                GLint64 attribStride = static_cast&lt;GLint64&gt;(ComputeVertexAttributeStride(attrib));
+                GLint64 maxVertexElement = 0;
+
+                if (attrib.divisor &gt; 0)
+                {
+                    maxVertexElement = static_cast&lt;GLint64&gt;(primcount) / static_cast&lt;GLint64&gt;(attrib.divisor);
+                }
+                else
+                {
+                    maxVertexElement = static_cast&lt;GLint64&gt;(maxVertex);
+                }
+
+                GLint64 attribDataSize = maxVertexElement * attribStride;
+
+                // [OpenGL ES 3.0.2] section 2.9.4 page 40:
+                // We can return INVALID_OPERATION if our vertex attribute does not have
+                // enough backing data.
+                if (attribDataSize &gt; buffer-&gt;getSize())
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return false;
+                }
+            }
+            else if (attrib.pointer == NULL)
+            {
+                // This is an application error that would normally result in a crash,
+                // but we catch it and return an error
+                context-&gt;recordError(Error(GL_INVALID_OPERATION, &quot;An enabled vertex array has no buffer and no pointer.&quot;));
+                return false;
+            }
+        }
+    }
+
+    // Uniform buffer validation
+    for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; program-&gt;getActiveUniformBlockCount(); uniformBlockIndex++)
+    {
+        const gl::UniformBlock *uniformBlock = program-&gt;getUniformBlockByIndex(uniformBlockIndex);
+        GLuint blockBinding = program-&gt;getUniformBlockBinding(uniformBlockIndex);
+        const gl::Buffer *uniformBuffer = state.getIndexedUniformBuffer(blockBinding);
+
+        if (!uniformBuffer)
+        {
+            // undefined behaviour
+            context-&gt;recordError(Error(GL_INVALID_OPERATION, &quot;It is undefined behaviour to have a used but unbound uniform buffer.&quot;));
+            return false;
+        }
+
+        size_t uniformBufferSize = state.getIndexedUniformBufferSize(blockBinding);
+
+        if (uniformBufferSize == 0)
+        {
+            // Bind the whole buffer.
+            uniformBufferSize = static_cast&lt;size_t&gt;(uniformBuffer-&gt;getSize());
+        }
+
+        if (uniformBufferSize &lt; uniformBlock-&gt;dataSize)
+        {
+            // undefined behaviour
+            context-&gt;recordError(Error(GL_INVALID_OPERATION, &quot;It is undefined behaviour to use a uniform buffer that is too small.&quot;));
+            return false;
+        }
+    }
+
+    // No-op if zero count
+    return (count &gt; 0);
+}
+
+bool ValidateDrawArrays(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount)
+{
+    if (first &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    const State &amp;state = context-&gt;getState();
+    gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
+    if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isActive() &amp;&amp; !curTransformFeedback-&gt;isPaused() &amp;&amp;
+        curTransformFeedback-&gt;getPrimitiveMode() != mode)
+    {
+        // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode
+        // that does not match the current transform feedback object's draw mode (if transform feedback
+        // is active), (3.0.2, section 2.14, pg 86)
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (!ValidateDrawBase(context, mode, count, count, primcount))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateDrawArraysInstanced(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount)
+{
+    if (primcount &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (!ValidateDrawArrays(context, mode, first, count, primcount))
+    {
+        return false;
+    }
+
+    // No-op if zero primitive count
+    return (primcount &gt; 0);
+}
+
+static bool ValidateDrawInstancedANGLE(Context *context)
+{
+    // Verify there is at least one active attribute with a divisor of zero
+    const gl::State&amp; state = context-&gt;getState();
+
+    gl::Program *program = state.getProgram();
+
+    const VertexArray *vao = state.getVertexArray();
+    for (int attributeIndex = 0; attributeIndex &lt; MAX_VERTEX_ATTRIBS; attributeIndex++)
+    {
+        const VertexAttribute &amp;attrib = vao-&gt;getVertexAttribute(attributeIndex);
+        bool active = (program-&gt;getSemanticIndex(attributeIndex) != -1);
+        if (active &amp;&amp; attrib.divisor == 0)
+        {
+            return true;
+        }
+    }
+
+    context-&gt;recordError(Error(GL_INVALID_OPERATION, &quot;ANGLE_instanced_arrays requires that at least one active attribute&quot;
+                                                     &quot;has a divisor of zero.&quot;));
+    return false;
+}
+
+bool ValidateDrawArraysInstancedANGLE(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount)
+{
+    if (!ValidateDrawInstancedANGLE(context))
+    {
+        return false;
+    }
+
+    return ValidateDrawArraysInstanced(context, mode, first, count, primcount);
+}
+
+bool ValidateDrawElements(Context *context, GLenum mode, GLsizei count, GLenum type,
+                          const GLvoid* indices, GLsizei primcount, rx::RangeUI *indexRangeOut)
+{
+    switch (type)
+    {
+      case GL_UNSIGNED_BYTE:
+      case GL_UNSIGNED_SHORT:
+        break;
+      case GL_UNSIGNED_INT:
+        if (!context-&gt;getExtensions().elementIndexUint)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    const State &amp;state = context-&gt;getState();
+
+    gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback();
+    if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isActive() &amp;&amp; !curTransformFeedback-&gt;isPaused())
+    {
+        // It is an invalid operation to call DrawElements, DrawRangeElements or DrawElementsInstanced
+        // while transform feedback is active, (3.0.2, section 2.14, pg 86)
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // Check for mapped buffers
+    if (state.hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::VertexArray *vao = state.getVertexArray();
+    gl::Buffer *elementArrayBuffer = vao-&gt;getElementArrayBuffer();
+    if (!indices &amp;&amp; !elementArrayBuffer)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (elementArrayBuffer)
+    {
+        const gl::Type &amp;typeInfo = gl::GetTypeInfo(type);
+
+        GLint64 offset = reinterpret_cast&lt;GLint64&gt;(indices);
+        GLint64 byteCount = static_cast&lt;GLint64&gt;(typeInfo.bytes) * static_cast&lt;GLint64&gt;(count)+offset;
+
+        // check for integer overflows
+        if (static_cast&lt;GLuint&gt;(count) &gt; (std::numeric_limits&lt;GLuint&gt;::max() / typeInfo.bytes) ||
+            byteCount &gt; static_cast&lt;GLint64&gt;(std::numeric_limits&lt;GLuint&gt;::max()))
+        {
+            context-&gt;recordError(Error(GL_OUT_OF_MEMORY));
+            return false;
+        }
+
+        // Check for reading past the end of the bound buffer object
+        if (byteCount &gt; elementArrayBuffer-&gt;getSize())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+    else if (!indices)
+    {
+        // Catch this programming error here
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // Use max index to validate if our vertex buffers are large enough for the pull.
+    // TODO: offer fast path, with disabled index validation.
+    // TODO: also disable index checking on back-ends that are robust to out-of-range accesses.
+    if (elementArrayBuffer)
+    {
+        uintptr_t offset = reinterpret_cast&lt;uintptr_t&gt;(indices);
+        if (!elementArrayBuffer-&gt;getIndexRangeCache()-&gt;findRange(type, static_cast&lt;unsigned int&gt;(offset), count, indexRangeOut))
+        {
+            rx::BufferImpl *bufferImpl = elementArrayBuffer-&gt;getImplementation();
+            const uint8_t *dataPointer = NULL;
+            Error error = bufferImpl-&gt;getData(&amp;dataPointer);
+            if (error.isError())
+            {
+                context-&gt;recordError(error);
+                return false;
+            }
+
+            const uint8_t *offsetPointer = dataPointer + offset;
+            *indexRangeOut = rx::IndexRangeCache::ComputeRange(type, offsetPointer, count);
+            elementArrayBuffer-&gt;getIndexRangeCache()-&gt;addRange(type, static_cast&lt;unsigned int&gt;(offset), count, *indexRangeOut);
+        }
+    }
+    else
+    {
+        *indexRangeOut = rx::IndexRangeCache::ComputeRange(type, indices, count);
+    }
+
+    if (!ValidateDrawBase(context, mode, count, static_cast&lt;GLsizei&gt;(indexRangeOut-&gt;end), primcount))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateDrawElementsInstanced(Context *context,
+                                   GLenum mode, GLsizei count, GLenum type,
+                                   const GLvoid *indices, GLsizei primcount,
+                                   rx::RangeUI *indexRangeOut)
+{
+    if (primcount &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (!ValidateDrawElements(context, mode, count, type, indices, primcount, indexRangeOut))
+    {
+        return false;
+    }
+
+    // No-op zero primitive count
+    return (primcount &gt; 0);
+}
+
+bool ValidateDrawElementsInstancedANGLE(Context *context, GLenum mode, GLsizei count, GLenum type,
+                                        const GLvoid *indices, GLsizei primcount, rx::RangeUI *indexRangeOut)
+{
+    if (!ValidateDrawInstancedANGLE(context))
+    {
+        return false;
+    }
+
+    return ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount, indexRangeOut);
+}
+
+bool ValidateFramebufferTextureBase(Context *context, GLenum target, GLenum attachment,
+                                    GLuint texture, GLint level)
+{
+    if (!ValidFramebufferTarget(target))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (!ValidateAttachmentTarget(context, attachment))
+    {
+        return false;
+    }
+
+    if (texture != 0)
+    {
+        gl::Texture *tex = context-&gt;getTexture(texture);
+
+        if (tex == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        if (level &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+
+    const gl::Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+    ASSERT(framebuffer);
+
+    if (framebuffer-&gt;id() == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION, &quot;Cannot change default FBO's attachments&quot;));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateFramebufferTexture2D(Context *context, GLenum target, GLenum attachment,
+                                  GLenum textarget, GLuint texture, GLint level)
+{
+    // Attachments are required to be bound to level 0 without ES3 or the GL_OES_fbo_render_mipmap extension
+    if (context-&gt;getClientVersion() &lt; 3 &amp;&amp; !context-&gt;getExtensions().fboRenderMipmap &amp;&amp; level != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
+    {
+        return false;
+    }
+
+    if (texture != 0)
+    {
+        gl::Texture *tex = context-&gt;getTexture(texture);
+        ASSERT(tex);
+
+        const gl::Caps &amp;caps = context-&gt;getCaps();
+
+        switch (textarget)
+        {
+          case GL_TEXTURE_2D:
+            {
+                if (level &gt; gl::log2(caps.max2DTextureSize))
+                {
+                    context-&gt;recordError(Error(GL_INVALID_VALUE));
+                    return false;
+                }
+                if (tex-&gt;getTarget() != GL_TEXTURE_2D)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return false;
+                }
+            }
+            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 (level &gt; gl::log2(caps.maxCubeMapTextureSize))
+                {
+                    context-&gt;recordError(Error(GL_INVALID_VALUE));
+                    return false;
+                }
+                if (tex-&gt;getTarget() != GL_TEXTURE_CUBE_MAP)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return false;
+                }
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+
+        const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(tex-&gt;getInternalFormat(textarget, level));
+        if (internalFormatInfo.compressed)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool ValidateGetUniformBase(Context *context, GLuint program, GLint location)
+{
+    if (program == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (!ValidProgram(context, program))
+    {
+        return false;
+    }
+
+    gl::Program *programObject = context-&gt;getProgram(program);
+
+    if (!programObject || !programObject-&gt;isLinked())
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (!programObject-&gt;isValidUniformLocation(location))
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat* params)
+{
+    return ValidateGetUniformBase(context, program, location);
+}
+
+bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint* params)
+{
+    return ValidateGetUniformBase(context, program, location);
+}
+
+static bool ValidateSizedGetUniform(Context *context, GLuint program, GLint location, GLsizei bufSize)
+{
+    if (!ValidateGetUniformBase(context, program, location))
+    {
+        return false;
+    }
+
+    gl::Program *programObject = context-&gt;getProgram(program);
+    ASSERT(programObject);
+
+    // sized queries -- ensure the provided buffer is large enough
+    LinkedUniform *uniform = programObject-&gt;getUniformByLocation(location);
+    size_t requiredBytes = VariableExternalSize(uniform-&gt;type);
+    if (static_cast&lt;size_t&gt;(bufSize) &lt; requiredBytes)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateGetnUniformfvEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
+{
+    return ValidateSizedGetUniform(context, program, location, bufSize);
+}
+
+bool ValidateGetnUniformivEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLint* params)
+{
+    return ValidateSizedGetUniform(context, program, location, bufSize);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationESh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// validationES.h: Validation functions for generic OpenGL ES entry point parameters
+
+#ifndef LIBANGLE_VALIDATION_ES_H_
+#define LIBANGLE_VALIDATION_ES_H_
+
+#include &quot;common/mathutil.h&quot;
+
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;GLES3/gl3.h&gt;
+
+namespace gl
+{
+
+class Context;
+
+bool ValidCap(const Context *context, GLenum cap);
+bool ValidTextureTarget(const Context *context, GLenum target);
+bool ValidTexture2DDestinationTarget(const Context *context, GLenum target);
+bool ValidFramebufferTarget(GLenum target);
+bool ValidBufferTarget(const Context *context, GLenum target);
+bool ValidBufferParameter(const Context *context, GLenum pname);
+bool ValidMipLevel(const Context *context, GLenum target, GLint level);
+bool ValidImageSize(const Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth);
+bool ValidCompressedImageSize(const Context *context, GLenum internalFormat, GLsizei width, GLsizei height);
+bool ValidQueryType(const Context *context, GLenum queryType);
+bool ValidProgram(Context *context, GLuint id);
+
+bool ValidateAttachmentTarget(Context *context, GLenum attachment);
+bool ValidateRenderbufferStorageParametersBase(Context *context, GLenum target, GLsizei samples,
+                                               GLenum internalformat, GLsizei width, GLsizei height);
+bool ValidateRenderbufferStorageParametersANGLE(Context *context, GLenum target, GLsizei samples,
+                                                GLenum internalformat, GLsizei width, GLsizei height);
+
+bool ValidateFramebufferRenderbufferParameters(Context *context, GLenum target, GLenum attachment,
+                                               GLenum renderbuffertarget, GLuint renderbuffer);
+
+bool ValidateBlitFramebufferParameters(Context *context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
+                                       GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
+                                       GLenum filter, bool fromAngleExtension);
+
+bool ValidateGetVertexAttribParameters(Context *context, GLenum pname);
+
+bool ValidateTexParamParameters(Context *context, GLenum pname, GLint param);
+
+bool ValidateSamplerObjectParameter(Context *context, GLenum pname);
+
+bool ValidateReadPixelsParameters(Context *context, GLint x, GLint y, GLsizei width, GLsizei height,
+                                               GLenum format, GLenum type, GLsizei *bufSize, GLvoid *pixels);
+
+bool ValidateBeginQuery(Context *context, GLenum target, GLuint id);
+bool ValidateEndQuery(Context *context, GLenum target);
+
+bool ValidateUniform(Context *context, GLenum uniformType, GLint location, GLsizei count);
+bool ValidateUniformMatrix(Context *context, GLenum matrixType, GLint location, GLsizei count,
+                           GLboolean transpose);
+
+bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams);
+
+bool ValidateCopyTexImageParametersBase(Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+                                                     GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+                                                     GLint border, GLenum *textureInternalFormatOut);
+
+bool ValidateDrawArrays(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+bool ValidateDrawArraysInstanced(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+bool ValidateDrawArraysInstancedANGLE(Context *context, GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+
+bool ValidateDrawElements(Context *context, GLenum mode, GLsizei count, GLenum type,
+                          const GLvoid* indices, GLsizei primcount, rx::RangeUI *indexRangeOut);
+
+bool ValidateDrawElementsInstanced(Context *context, GLenum mode, GLsizei count, GLenum type,
+                                   const GLvoid *indices, GLsizei primcount, rx::RangeUI *indexRangeOut);
+bool ValidateDrawElementsInstancedANGLE(Context *context, GLenum mode, GLsizei count, GLenum type,
+                                        const GLvoid *indices, GLsizei primcount, rx::RangeUI *indexRangeOut);
+
+bool ValidateFramebufferTextureBase(Context *context, GLenum target, GLenum attachment,
+                                    GLuint texture, GLint level);
+bool ValidateFramebufferTexture2D(Context *context, GLenum target, GLenum attachment,
+                                   GLenum textarget, GLuint texture, GLint level);
+
+bool ValidateGetUniformBase(Context *context, GLuint program, GLint location);
+bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat* params);
+bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint* params);
+bool ValidateGetnUniformfvEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLfloat* params);
+bool ValidateGetnUniformivEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLint* params);
+
+}
+
+#endif // LIBANGLE_VALIDATION_ES_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationES2cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,882 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// validationES2.cpp: Validation functions for OpenGL ES 2.0 entry point parameters
+
+#include &quot;libANGLE/validationES2.h&quot;
+#include &quot;libANGLE/validationES.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace gl
+{
+
+bool ValidateES2TexImageParameters(Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+                                   GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    if (!ValidTexture2DDestinationTarget(context, target))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (!ValidImageSize(context, target, level, width, height, 1))
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (level &lt; 0 || xoffset &lt; 0 ||
+        std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width ||
+        std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (!isSubImage &amp;&amp; !isCompressed &amp;&amp; internalformat != format)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::Caps &amp;caps = context-&gt;getCaps();
+
+    if (target == GL_TEXTURE_2D)
+    {
+        if (static_cast&lt;GLuint&gt;(width) &gt; (caps.max2DTextureSize &gt;&gt; level) ||
+            static_cast&lt;GLuint&gt;(height) &gt; (caps.max2DTextureSize &gt;&gt; level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+    else if (IsCubeMapTextureTarget(target))
+    {
+        if (!isSubImage &amp;&amp; width != height)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+
+        if (static_cast&lt;GLuint&gt;(width) &gt; (caps.maxCubeMapTextureSize &gt;&gt; level) ||
+            static_cast&lt;GLuint&gt;(height) &gt; (caps.maxCubeMapTextureSize &gt;&gt; level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+    else
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    gl::Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+    if (!texture)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (isSubImage)
+    {
+        if (format != GL_NONE)
+        {
+            if (gl::GetSizedInternalFormat(format, type) != texture-&gt;getInternalFormat(target, level))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+        }
+
+        if (static_cast&lt;size_t&gt;(xoffset + width) &gt; texture-&gt;getWidth(target, level) ||
+            static_cast&lt;size_t&gt;(yoffset + height) &gt; texture-&gt;getHeight(target, level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+    else
+    {
+        if (texture-&gt;isImmutable())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    // Verify zero border
+    if (border != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    GLenum actualInternalFormat = isSubImage ? texture-&gt;getInternalFormat(target, level) : internalformat;
+    const InternalFormat &amp;actualFormatInfo = GetInternalFormatInfo(actualInternalFormat);
+
+    if (isCompressed != actualFormatInfo.compressed)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (isCompressed)
+    {
+        if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        switch (actualInternalFormat)
+        {
+          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+            if (!context-&gt;getExtensions().textureCompressionDXT1)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+            if (!context-&gt;getExtensions().textureCompressionDXT1)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+            if (!context-&gt;getExtensions().textureCompressionDXT5)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+    }
+    else
+    {
+        // validate &lt;type&gt; 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:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+
+        // validate &lt;format&gt; + &lt;type&gt; combinations
+        // - invalid &lt;format&gt; -&gt; sets INVALID_ENUM
+        // - invalid &lt;format&gt;+&lt;type&gt; combination -&gt; 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:
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+            }
+            break;
+          case GL_RED:
+          case GL_RG:
+              if (!context-&gt;getExtensions().textureRG)
+              {
+                  context-&gt;recordError(Error(GL_INVALID_ENUM));
+                  return false;
+              }
+              switch (type)
+              {
+                case GL_UNSIGNED_BYTE:
+                case GL_FLOAT:
+                case GL_HALF_FLOAT_OES:
+                  break;
+                default:
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+              }
+              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:
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            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:
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_BGRA_EXT:
+            switch (type)
+            {
+              case GL_UNSIGNED_BYTE:
+                break;
+              default:
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_SRGB_EXT:
+          case GL_SRGB_ALPHA_EXT:
+            if (!context-&gt;getExtensions().sRGB)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            switch (type)
+            {
+              case GL_UNSIGNED_BYTE:
+                break;
+              default:
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            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:
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_DEPTH_STENCIL_OES:
+            switch (type)
+            {
+              case GL_UNSIGNED_INT_24_8_OES:
+                break;
+              default:
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+
+        switch (format)
+        {
+          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+            if (context-&gt;getExtensions().textureCompressionDXT1)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+            if (context-&gt;getExtensions().textureCompressionDXT3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+            if (context-&gt;getExtensions().textureCompressionDXT5)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          case GL_DEPTH_COMPONENT:
+          case GL_DEPTH_STENCIL_OES:
+            if (!context-&gt;getExtensions().depthTextures)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return false;
+            }
+            if (target != GL_TEXTURE_2D)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            // OES_depth_texture supports loading depth data and multiple levels,
+            // but ANGLE_depth_texture does not
+            if (pixels != NULL || level != 0)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          default:
+            break;
+        }
+
+        if (type == GL_FLOAT)
+        {
+            if (!context-&gt;getExtensions().textureFloat)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+        }
+        else if (type == GL_HALF_FLOAT_OES)
+        {
+            if (!context-&gt;getExtensions().textureHalfFloat)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
+
+
+bool ValidateES2CopyTexImageParameters(Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+                                       GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+                                       GLint border)
+{
+    GLenum textureInternalFormat = GL_NONE;
+
+    if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+                                            xoffset, yoffset, 0, x, y, width, height, border, &amp;textureInternalFormat))
+    {
+        return false;
+    }
+
+    gl::Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+    GLenum colorbufferFormat = framebuffer-&gt;getReadColorbuffer()-&gt;getInternalFormat();
+    const auto &amp;internalFormatInfo = gl::GetInternalFormatInfo(textureInternalFormat);
+    GLenum textureFormat = internalFormatInfo.format;
+
+    // [OpenGL ES 2.0.24] table 3.9
+    if (isSubImage)
+    {
+        switch (textureFormat)
+        {
+          case GL_ALPHA:
+            if (colorbufferFormat != GL_ALPHA8_EXT &amp;&amp;
+                colorbufferFormat != GL_RGBA4 &amp;&amp;
+                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                colorbufferFormat != GL_RGBA8_OES)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_LUMINANCE:
+              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGB565 &amp;&amp;
+                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                  colorbufferFormat != GL_RGBA4 &amp;&amp;
+                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                  colorbufferFormat != GL_RGBA8_OES)
+              {
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+              }
+              break;
+          case GL_RED_EXT:
+              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGB565 &amp;&amp;
+                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                  colorbufferFormat != GL_RGBA4 &amp;&amp;
+                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                  colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                  colorbufferFormat != GL_R32F &amp;&amp;
+                  colorbufferFormat != GL_RG32F &amp;&amp;
+                  colorbufferFormat != GL_RGB32F &amp;&amp;
+                  colorbufferFormat != GL_RGBA32F)
+              {
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+              }
+              break;
+          case GL_RG_EXT:
+              if (colorbufferFormat != GL_RG8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGB565 &amp;&amp;
+                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                  colorbufferFormat != GL_RGBA4 &amp;&amp;
+                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                  colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                  colorbufferFormat != GL_RG32F &amp;&amp;
+                  colorbufferFormat != GL_RGB32F &amp;&amp;
+                  colorbufferFormat != GL_RGBA32F)
+              {
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+              }
+              break;
+          case GL_RGB:
+            if (colorbufferFormat != GL_RGB565 &amp;&amp;
+                colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                colorbufferFormat != GL_RGBA4 &amp;&amp;
+                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                colorbufferFormat != GL_RGB32F &amp;&amp;
+                colorbufferFormat != GL_RGBA32F)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_LUMINANCE_ALPHA:
+          case GL_RGBA:
+            if (colorbufferFormat != GL_RGBA4 &amp;&amp;
+                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                colorbufferFormat != GL_RGBA32F)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            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:
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+          case GL_DEPTH_COMPONENT:
+          case GL_DEPTH_STENCIL_OES:
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        if (internalFormatInfo.type == GL_FLOAT &amp;&amp;
+            !context-&gt;getExtensions().textureFloat)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+    else
+    {
+        switch (internalformat)
+        {
+          case GL_ALPHA:
+            if (colorbufferFormat != GL_ALPHA8_EXT &amp;&amp;
+                colorbufferFormat != GL_RGBA4 &amp;&amp;
+                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
+                colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                colorbufferFormat != GL_BGR5_A1_ANGLEX)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_LUMINANCE:
+              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGB565 &amp;&amp;
+                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                  colorbufferFormat != GL_RGBA4 &amp;&amp;
+                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                  colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                  colorbufferFormat != GL_BGR5_A1_ANGLEX)
+              {
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+              }
+              break;
+          case GL_RED_EXT:
+              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGB565 &amp;&amp;
+                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                  colorbufferFormat != GL_RGBA4 &amp;&amp;
+                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                  colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                  colorbufferFormat != GL_BGR5_A1_ANGLEX)
+              {
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+              }
+              break;
+          case GL_RG_EXT:
+              if (colorbufferFormat != GL_RG8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGB565 &amp;&amp;
+                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                  colorbufferFormat != GL_RGBA4 &amp;&amp;
+                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                  colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
+                  colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                  colorbufferFormat != GL_BGR5_A1_ANGLEX)
+              {
+                  context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                  return false;
+              }
+              break;
+          case GL_RGB:
+            if (colorbufferFormat != GL_RGB565 &amp;&amp;
+                colorbufferFormat != GL_RGB8_OES &amp;&amp;
+                colorbufferFormat != GL_RGBA4 &amp;&amp;
+                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
+                colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                colorbufferFormat != GL_BGR5_A1_ANGLEX)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_LUMINANCE_ALPHA:
+          case GL_RGBA:
+            if (colorbufferFormat != GL_RGBA4 &amp;&amp;
+                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
+                colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
+                colorbufferFormat != GL_RGBA8_OES &amp;&amp;
+                colorbufferFormat != GL_BGR5_A1_ANGLEX)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            break;
+          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+            if (context-&gt;getExtensions().textureCompressionDXT1)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+            if (context-&gt;getExtensions().textureCompressionDXT3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            break;
+          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+            if (context-&gt;getExtensions().textureCompressionDXT5)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+            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-&gt;getExtensions().depthTextures)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+    }
+
+    // If width or height is zero, it is a no-op.  Return false without setting an error.
+    return (width &gt; 0 &amp;&amp; height &gt; 0);
+}
+
+bool ValidateES2TexStorageParameters(Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+                                     GLsizei width, GLsizei height)
+{
+    if (target != GL_TEXTURE_2D &amp;&amp; target != GL_TEXTURE_CUBE_MAP)
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (width &lt; 1 || height &lt; 1 || levels &lt; 1)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (target == GL_TEXTURE_CUBE_MAP &amp;&amp; width != height)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (levels != 1 &amp;&amp; levels != gl::log2(std::max(width, height)) + 1)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalformat);
+    if (formatInfo.format == GL_NONE || formatInfo.type == GL_NONE)
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    const gl::Caps &amp;caps = context-&gt;getCaps();
+
+    switch (target)
+    {
+      case GL_TEXTURE_2D:
+        if (static_cast&lt;GLuint&gt;(width) &gt; caps.max2DTextureSize ||
+            static_cast&lt;GLuint&gt;(height) &gt; caps.max2DTextureSize)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        break;
+      case GL_TEXTURE_CUBE_MAP:
+        if (static_cast&lt;GLuint&gt;(width) &gt; caps.maxCubeMapTextureSize ||
+            static_cast&lt;GLuint&gt;(height) &gt; caps.maxCubeMapTextureSize)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        break;
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (levels != 1 &amp;&amp; !context-&gt;getExtensions().textureNPOT)
+    {
+        if (!gl::isPow2(width) || !gl::isPow2(height))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    switch (internalformat)
+    {
+      case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+      case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+        if (!context-&gt;getExtensions().textureCompressionDXT1)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
+        if (!context-&gt;getExtensions().textureCompressionDXT3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
+        if (!context-&gt;getExtensions().textureCompressionDXT5)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      case GL_RGBA32F_EXT:
+      case GL_RGB32F_EXT:
+      case GL_ALPHA32F_EXT:
+      case GL_LUMINANCE32F_EXT:
+      case GL_LUMINANCE_ALPHA32F_EXT:
+        if (!context-&gt;getExtensions().textureFloat)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      case GL_RGBA16F_EXT:
+      case GL_RGB16F_EXT:
+      case GL_ALPHA16F_EXT:
+      case GL_LUMINANCE16F_EXT:
+      case GL_LUMINANCE_ALPHA16F_EXT:
+        if (!context-&gt;getExtensions().textureHalfFloat)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      case GL_R8_EXT:
+      case GL_RG8_EXT:
+      case GL_R16F_EXT:
+      case GL_RG16F_EXT:
+      case GL_R32F_EXT:
+      case GL_RG32F_EXT:
+        if (!context-&gt;getExtensions().textureRG)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        break;
+      case GL_DEPTH_COMPONENT16:
+      case GL_DEPTH_COMPONENT32_OES:
+      case GL_DEPTH24_STENCIL8_OES:
+        if (!context-&gt;getExtensions().depthTextures)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+        if (target != GL_TEXTURE_2D)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+        // ANGLE_depth_texture only supports 1-level textures
+        if (levels != 1)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+        break;
+      default:
+        break;
+    }
+
+    gl::Texture *texture = context-&gt;getTargetTexture(target);
+    if (!texture || texture-&gt;id() == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (texture-&gt;isImmutable())
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+// check for combinations of format and type that are valid for ReadPixels
+bool ValidES2ReadFormatType(Context *context, 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_RG_EXT:
+      case GL_RED_EXT:
+        if (!context-&gt;getExtensions().textureRG)
+        {
+            return false;
+        }
+        switch (type)
+        {
+          case GL_UNSIGNED_BYTE:
+            break;
+          default:
+            return false;
+        }
+        break;
+
+      default:
+        return false;
+    }
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationES2h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES2.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// validationES2.h: Validation functions for OpenGL ES 2.0 entry point parameters
+
+#ifndef LIBANGLE_VALIDATION_ES2_H_
+#define LIBANGLE_VALIDATION_ES2_H_
+
+#include &lt;GLES2/gl2.h&gt;
+
+namespace gl
+{
+
+class Context;
+
+bool ValidateES2TexImageParameters(Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+                                   GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+
+bool ValidateES2CopyTexImageParameters(Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
+                                       GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height,
+                                       GLint border);
+
+bool ValidateES2TexStorageParameters(Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+                                                   GLsizei width, GLsizei height);
+
+bool ValidES2ReadFormatType(Context *context, GLenum format, GLenum type);
+
+}
+
+#endif // LIBANGLE_VALIDATION_ES2_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationES3cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1282 @@
</span><ins>+//
+// Copyright (c) 2013-2014 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.
+//
+
+// validationES3.cpp: Validation functions for OpenGL ES 3.0 entry point parameters
+
+#include &quot;libANGLE/validationES3.h&quot;
+#include &quot;libANGLE/validationES.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+#include &quot;common/mathutil.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace gl
+{
+
+struct ES3FormatCombination
+{
+    GLenum internalFormat;
+    GLenum format;
+    GLenum type;
+};
+
+bool operator&lt;(const ES3FormatCombination&amp; a, const ES3FormatCombination&amp; b)
+{
+    return memcmp(&amp;a, &amp;b, sizeof(ES3FormatCombination)) &lt; 0;
+}
+
+typedef std::set&lt;ES3FormatCombination&gt; ES3FormatCombinationSet;
+
+static inline void InsertES3FormatCombo(ES3FormatCombinationSet *set, GLenum internalFormat, GLenum format, GLenum type)
+{
+    ES3FormatCombination info;
+    info.internalFormat = internalFormat;
+    info.format = format;
+    info.type = type;
+    set-&gt;insert(info);
+}
+
+ES3FormatCombinationSet BuildES3FormatSet()
+{
+    ES3FormatCombinationSet set;
+
+    // Format combinations from ES 3.0.1 spec, table 3.2
+
+    //                        | Internal format      | Format            | Type                            |
+    //                        |                      |                   |                                 |
+    InsertES3FormatCombo(&amp;set, GL_RGBA8,              GL_RGBA,            GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGB5_A1,            GL_RGBA,            GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGBA4,              GL_RGBA,            GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_SRGB8_ALPHA8,       GL_RGBA,            GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGBA8_SNORM,        GL_RGBA,            GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_RGBA4,              GL_RGBA,            GL_UNSIGNED_SHORT_4_4_4_4        );
+    InsertES3FormatCombo(&amp;set, GL_RGB10_A2,           GL_RGBA,            GL_UNSIGNED_INT_2_10_10_10_REV   );
+    InsertES3FormatCombo(&amp;set, GL_RGB5_A1,            GL_RGBA,            GL_UNSIGNED_INT_2_10_10_10_REV   );
+    InsertES3FormatCombo(&amp;set, GL_RGB5_A1,            GL_RGBA,            GL_UNSIGNED_SHORT_5_5_5_1        );
+    InsertES3FormatCombo(&amp;set, GL_RGBA16F,            GL_RGBA,            GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_RGBA16F,            GL_RGBA,            GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_RGBA32F,            GL_RGBA,            GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_RGBA16F,            GL_RGBA,            GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_RGBA8UI,            GL_RGBA_INTEGER,    GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGBA8I,             GL_RGBA_INTEGER,    GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_RGBA16UI,           GL_RGBA_INTEGER,    GL_UNSIGNED_SHORT                );
+    InsertES3FormatCombo(&amp;set, GL_RGBA16I,            GL_RGBA_INTEGER,    GL_SHORT                         );
+    InsertES3FormatCombo(&amp;set, GL_RGBA32UI,           GL_RGBA_INTEGER,    GL_UNSIGNED_INT                  );
+    InsertES3FormatCombo(&amp;set, GL_RGBA32I,            GL_RGBA_INTEGER,    GL_INT                           );
+    InsertES3FormatCombo(&amp;set, GL_RGB10_A2UI,         GL_RGBA_INTEGER,    GL_UNSIGNED_INT_2_10_10_10_REV   );
+    InsertES3FormatCombo(&amp;set, GL_RGB8,               GL_RGB,             GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGB565,             GL_RGB,             GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_SRGB8,              GL_RGB,             GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGB8_SNORM,         GL_RGB,             GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_RGB565,             GL_RGB,             GL_UNSIGNED_SHORT_5_6_5          );
+    InsertES3FormatCombo(&amp;set, GL_R11F_G11F_B10F,     GL_RGB,             GL_UNSIGNED_INT_10F_11F_11F_REV  );
+    InsertES3FormatCombo(&amp;set, GL_RGB9_E5,            GL_RGB,             GL_UNSIGNED_INT_5_9_9_9_REV      );
+    InsertES3FormatCombo(&amp;set, GL_RGB16F,             GL_RGB,             GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_RGB16F,             GL_RGB,             GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_R11F_G11F_B10F,     GL_RGB,             GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_R11F_G11F_B10F,     GL_RGB,             GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_RGB9_E5,            GL_RGB,             GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_RGB9_E5,            GL_RGB,             GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_RGB32F,             GL_RGB,             GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_RGB16F,             GL_RGB,             GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_R11F_G11F_B10F,     GL_RGB,             GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_RGB9_E5,            GL_RGB,             GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_RGB8UI,             GL_RGB_INTEGER,     GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGB8I,              GL_RGB_INTEGER,     GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_RGB16UI,            GL_RGB_INTEGER,     GL_UNSIGNED_SHORT                );
+    InsertES3FormatCombo(&amp;set, GL_RGB16I,             GL_RGB_INTEGER,     GL_SHORT                         );
+    InsertES3FormatCombo(&amp;set, GL_RGB32UI,            GL_RGB_INTEGER,     GL_UNSIGNED_INT                  );
+    InsertES3FormatCombo(&amp;set, GL_RGB32I,             GL_RGB_INTEGER,     GL_INT                           );
+    InsertES3FormatCombo(&amp;set, GL_RG8,                GL_RG,              GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RG8_SNORM,          GL_RG,              GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_RG16F,              GL_RG,              GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_RG16F,              GL_RG,              GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_RG32F,              GL_RG,              GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_RG16F,              GL_RG,              GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_RG8UI,              GL_RG_INTEGER,      GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RG8I,               GL_RG_INTEGER,      GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_RG16UI,             GL_RG_INTEGER,      GL_UNSIGNED_SHORT                );
+    InsertES3FormatCombo(&amp;set, GL_RG16I,              GL_RG_INTEGER,      GL_SHORT                         );
+    InsertES3FormatCombo(&amp;set, GL_RG32UI,             GL_RG_INTEGER,      GL_UNSIGNED_INT                  );
+    InsertES3FormatCombo(&amp;set, GL_RG32I,              GL_RG_INTEGER,      GL_INT                           );
+    InsertES3FormatCombo(&amp;set, GL_R8,                 GL_RED,             GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_R8_SNORM,           GL_RED,             GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_R16F,               GL_RED,             GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_R16F,               GL_RED,             GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_R32F,               GL_RED,             GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_R16F,               GL_RED,             GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_R8UI,               GL_RED_INTEGER,     GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_R8I,                GL_RED_INTEGER,     GL_BYTE                          );
+    InsertES3FormatCombo(&amp;set, GL_R16UI,              GL_RED_INTEGER,     GL_UNSIGNED_SHORT                );
+    InsertES3FormatCombo(&amp;set, GL_R16I,               GL_RED_INTEGER,     GL_SHORT                         );
+    InsertES3FormatCombo(&amp;set, GL_R32UI,              GL_RED_INTEGER,     GL_UNSIGNED_INT                  );
+    InsertES3FormatCombo(&amp;set, GL_R32I,               GL_RED_INTEGER,     GL_INT                           );
+
+    // Unsized formats
+    InsertES3FormatCombo(&amp;set, GL_RGBA,               GL_RGBA,            GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGBA,               GL_RGBA,            GL_UNSIGNED_SHORT_4_4_4_4        );
+    InsertES3FormatCombo(&amp;set, GL_RGBA,               GL_RGBA,            GL_UNSIGNED_SHORT_5_5_5_1        );
+    InsertES3FormatCombo(&amp;set, GL_RGB,                GL_RGB,             GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_RGB,                GL_RGB,             GL_UNSIGNED_SHORT_5_6_5          );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE_ALPHA,    GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE,          GL_LUMINANCE,       GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_ALPHA,              GL_ALPHA,           GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_SRGB_ALPHA_EXT,     GL_SRGB_ALPHA_EXT,  GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_SRGB_EXT,           GL_SRGB_EXT,        GL_UNSIGNED_BYTE                 );
+
+    // Depth stencil formats
+    InsertES3FormatCombo(&amp;set, GL_DEPTH_COMPONENT16,  GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT                );
+    InsertES3FormatCombo(&amp;set, GL_DEPTH_COMPONENT24,  GL_DEPTH_COMPONENT, GL_UNSIGNED_INT                  );
+    InsertES3FormatCombo(&amp;set, GL_DEPTH_COMPONENT16,  GL_DEPTH_COMPONENT, GL_UNSIGNED_INT                  );
+    InsertES3FormatCombo(&amp;set, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_DEPTH24_STENCIL8,   GL_DEPTH_STENCIL,   GL_UNSIGNED_INT_24_8             );
+    InsertES3FormatCombo(&amp;set, GL_DEPTH32F_STENCIL8,  GL_DEPTH_STENCIL,   GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
+
+    // From GL_EXT_sRGB
+    InsertES3FormatCombo(&amp;set, GL_SRGB8_ALPHA8_EXT,   GL_SRGB_ALPHA_EXT, GL_UNSIGNED_BYTE                  );
+    InsertES3FormatCombo(&amp;set, GL_SRGB8,              GL_SRGB_EXT,       GL_UNSIGNED_BYTE                  );
+
+    // From GL_OES_texture_float
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE_ALPHA,    GL_LUMINANCE_ALPHA, GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE,          GL_LUMINANCE,       GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_ALPHA,              GL_ALPHA,           GL_FLOAT                         );
+
+    // From GL_OES_texture_half_float
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE_ALPHA,    GL_LUMINANCE_ALPHA, GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE_ALPHA,    GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE,          GL_LUMINANCE,       GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE,          GL_LUMINANCE,       GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_ALPHA,              GL_ALPHA,           GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_ALPHA,              GL_ALPHA,           GL_HALF_FLOAT_OES                );
+
+    // From GL_EXT_texture_format_BGRA8888
+    InsertES3FormatCombo(&amp;set, GL_BGRA_EXT,           GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 );
+
+    // From GL_EXT_texture_storage
+    //                    | Internal format          | Format            | Type                            |
+    //                    |                          |                   |                                 |
+    InsertES3FormatCombo(&amp;set, GL_ALPHA8_EXT,             GL_ALPHA,           GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE8_EXT,         GL_LUMINANCE,       GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE8_ALPHA8_EXT,  GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_ALPHA32F_EXT,           GL_ALPHA,           GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE32F_EXT,       GL_LUMINANCE,       GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA, GL_FLOAT                         );
+    InsertES3FormatCombo(&amp;set, GL_ALPHA16F_EXT,           GL_ALPHA,           GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_ALPHA16F_EXT,           GL_ALPHA,           GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE16F_EXT,       GL_LUMINANCE,       GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE16F_EXT,       GL_LUMINANCE,       GL_HALF_FLOAT_OES                );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT                    );
+    InsertES3FormatCombo(&amp;set, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES                );
+
+    // From GL_EXT_texture_storage and GL_EXT_texture_format_BGRA8888
+    InsertES3FormatCombo(&amp;set, GL_BGRA8_EXT,              GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_BGRA4_ANGLEX,           GL_BGRA_EXT,        GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT);
+    InsertES3FormatCombo(&amp;set, GL_BGRA4_ANGLEX,           GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 );
+    InsertES3FormatCombo(&amp;set, GL_BGR5_A1_ANGLEX,         GL_BGRA_EXT,        GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT);
+    InsertES3FormatCombo(&amp;set, GL_BGR5_A1_ANGLEX,         GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 );
+
+    // From GL_ANGLE_depth_texture
+    InsertES3FormatCombo(&amp;set, GL_DEPTH_COMPONENT32_OES,  GL_DEPTH_COMPONENT, GL_UNSIGNED_INT_24_8_OES         );
+
+    // Compressed formats
+    // From ES 3.0.1 spec, table 3.16
+    //                    | Internal format                             | Format                                      | Type           |
+    //                    |                                             |                                             |                |
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_R11_EAC,                        GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_R11_EAC,                        GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_SIGNED_R11_EAC,                 GL_COMPRESSED_SIGNED_R11_EAC,                 GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RG11_EAC,                       GL_COMPRESSED_RG11_EAC,                       GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_SIGNED_RG11_EAC,                GL_COMPRESSED_SIGNED_RG11_EAC,                GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RGB8_ETC2,                      GL_COMPRESSED_RGB8_ETC2,                      GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_SRGB8_ETC2,                     GL_COMPRESSED_SRGB8_ETC2,                     GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RGBA8_ETC2_EAC,                 GL_COMPRESSED_RGBA8_ETC2_EAC,                 GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          GL_UNSIGNED_BYTE);
+
+
+    // From GL_EXT_texture_compression_dxt1
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,              GL_COMPRESSED_RGB_S3TC_DXT1_EXT,              GL_UNSIGNED_BYTE);
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,             GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,             GL_UNSIGNED_BYTE);
+
+    // From GL_ANGLE_texture_compression_dxt3
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,           GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,           GL_UNSIGNED_BYTE);
+
+    // From GL_ANGLE_texture_compression_dxt5
+    InsertES3FormatCombo(&amp;set, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,           GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,           GL_UNSIGNED_BYTE);
+
+    return set;
+}
+
+static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum internalFormat, GLenum format, GLenum type)
+{
+    // Note: dEQP 2013.4 expects an INVALID_VALUE error for TexImage3D with an invalid
+    // internal format. (dEQP-GLES3.functional.negative_api.texture.teximage3d)
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalFormat);
+    if (!formatInfo.textureSupport(context-&gt;getClientVersion(), context-&gt;getExtensions()))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    // The type and format are valid if any supported internal format has that type and format
+    bool formatSupported = false;
+    bool typeSupported = false;
+
+    static const ES3FormatCombinationSet es3FormatSet = BuildES3FormatSet();
+    for (ES3FormatCombinationSet::const_iterator i = es3FormatSet.begin(); i != es3FormatSet.end(); i++)
+    {
+        if (i-&gt;format == format || i-&gt;type == type)
+        {
+            const gl::InternalFormat &amp;info = gl::GetInternalFormatInfo(i-&gt;internalFormat);
+            bool supported = info.textureSupport(context-&gt;getClientVersion(), context-&gt;getExtensions());
+            if (supported &amp;&amp; i-&gt;type == type)
+            {
+                typeSupported = true;
+            }
+            if (supported &amp;&amp; i-&gt;format == format)
+            {
+                formatSupported = true;
+            }
+
+            // Early-out if both type and format are supported now
+            if (typeSupported &amp;&amp; formatSupported)
+            {
+                break;
+            }
+        }
+    }
+
+    if (!typeSupported || !formatSupported)
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    // Check if this is a valid format combination to load texture data
+    ES3FormatCombination searchFormat;
+    searchFormat.internalFormat = internalFormat;
+    searchFormat.format = format;
+    searchFormat.type = type;
+
+    if (es3FormatSet.find(searchFormat) == es3FormatSet.end())
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateES3TexImageParameters(Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+                                   GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+    if (!ValidTexture2DDestinationTarget(context, target))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    // Validate image size
+    if (!ValidImageSize(context, target, level, width, height, depth))
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    // Verify zero border
+    if (border != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (xoffset &lt; 0 || yoffset &lt; 0 || zoffset &lt; 0 ||
+        std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width ||
+        std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height ||
+        std::numeric_limits&lt;GLsizei&gt;::max() - zoffset &lt; depth)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    const gl::Caps &amp;caps = context-&gt;getCaps();
+
+    switch (target)
+    {
+      case GL_TEXTURE_2D:
+        if (static_cast&lt;GLuint&gt;(width) &gt; (caps.max2DTextureSize &gt;&gt; level) ||
+            static_cast&lt;GLuint&gt;(height) &gt; (caps.max2DTextureSize &gt;&gt; level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        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 (!isSubImage &amp;&amp; width != height)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+
+        if (static_cast&lt;GLuint&gt;(width) &gt; (caps.maxCubeMapTextureSize &gt;&gt; level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_3D:
+        if (static_cast&lt;GLuint&gt;(width) &gt; (caps.max3DTextureSize &gt;&gt; level) ||
+            static_cast&lt;GLuint&gt;(height) &gt; (caps.max3DTextureSize &gt;&gt; level) ||
+            static_cast&lt;GLuint&gt;(depth) &gt; (caps.max3DTextureSize &gt;&gt; level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        break;
+
+      case GL_TEXTURE_2D_ARRAY:
+        if (static_cast&lt;GLuint&gt;(width) &gt; (caps.max2DTextureSize &gt;&gt; level) ||
+            static_cast&lt;GLuint&gt;(height) &gt; (caps.max2DTextureSize &gt;&gt; level) ||
+            static_cast&lt;GLuint&gt;(depth) &gt; (caps.maxArrayTextureLayers &gt;&gt; level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+        break;
+
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    gl::Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+    if (!texture)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (texture-&gt;isImmutable() &amp;&amp; !isSubImage)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // Validate texture formats
+    GLenum actualInternalFormat = isSubImage ? texture-&gt;getInternalFormat(target, level) : internalformat;
+    const gl::InternalFormat &amp;actualFormatInfo = gl::GetInternalFormatInfo(actualInternalFormat);
+    if (isCompressed)
+    {
+        if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        if (!actualFormatInfo.compressed)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return false;
+        }
+
+        if (target == GL_TEXTURE_3D)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+    else
+    {
+        if (!ValidateTexImageFormatCombination(context, actualInternalFormat, format, type))
+        {
+            return false;
+        }
+
+        if (target == GL_TEXTURE_3D &amp;&amp; (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    // Validate sub image parameters
+    if (isSubImage)
+    {
+        if (isCompressed != actualFormatInfo.compressed)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        if (width == 0 || height == 0 || depth == 0)
+        {
+            return false;
+        }
+
+        if (xoffset &lt; 0 || yoffset &lt; 0 || zoffset &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+
+        if (std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width ||
+            std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height ||
+            std::numeric_limits&lt;GLsizei&gt;::max() - zoffset &lt; depth)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+
+        if (static_cast&lt;size_t&gt;(xoffset + width) &gt; texture-&gt;getWidth(target, level) ||
+            static_cast&lt;size_t&gt;(yoffset + height) &gt; texture-&gt;getHeight(target, level) ||
+            static_cast&lt;size_t&gt;(zoffset + depth) &gt; texture-&gt;getDepth(target, level))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return false;
+        }
+    }
+
+    // Check for pixel unpack buffer related API errors
+    gl::Buffer *pixelUnpackBuffer = context-&gt;getState().getTargetBuffer(GL_PIXEL_UNPACK_BUFFER);
+    if (pixelUnpackBuffer != NULL)
+    {
+        // ...the data would be unpacked from the buffer object such that the memory reads required
+        // would exceed the data store size.
+        size_t widthSize = static_cast&lt;size_t&gt;(width);
+        size_t heightSize = static_cast&lt;size_t&gt;(height);
+        size_t depthSize = static_cast&lt;size_t&gt;(depth);
+        GLenum sizedFormat = GetSizedInternalFormat(actualInternalFormat, type);
+
+        size_t pixelBytes = static_cast&lt;size_t&gt;(gl::GetInternalFormatInfo(sizedFormat).pixelBytes);
+
+        if (!rx::IsUnsignedMultiplicationSafe(widthSize, heightSize) ||
+            !rx::IsUnsignedMultiplicationSafe(widthSize * heightSize, depthSize) ||
+            !rx::IsUnsignedMultiplicationSafe(widthSize * heightSize * depthSize, pixelBytes))
+        {
+            // Overflow past the end of the buffer
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(sizedFormat);
+        size_t copyBytes = formatInfo.computeBlockSize(type, width, height);
+        size_t offset = reinterpret_cast&lt;size_t&gt;(pixels);
+
+        if (!rx::IsUnsignedAdditionSafe(offset, copyBytes) ||
+            ((offset + copyBytes) &gt; static_cast&lt;size_t&gt;(pixelUnpackBuffer-&gt;getSize())))
+        {
+            // Overflow past the end of the buffer
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        // ...data is not evenly divisible into the number of bytes needed to store in memory a datum
+        // indicated by type.
+        if (!isCompressed)
+        {
+            size_t dataBytesPerPixel = static_cast&lt;size_t&gt;(gl::GetTypeInfo(type).bytes);
+
+            if ((offset % dataBytesPerPixel) != 0)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+        }
+
+        // ...the buffer object's data store is currently mapped.
+        if (pixelUnpackBuffer-&gt;isMapped())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+struct EffectiveInternalFormatInfo
+{
+    GLenum mEffectiveFormat;
+    GLenum mDestFormat;
+    GLuint mMinRedBits;
+    GLuint mMaxRedBits;
+    GLuint mMinGreenBits;
+    GLuint mMaxGreenBits;
+    GLuint mMinBlueBits;
+    GLuint mMaxBlueBits;
+    GLuint mMinAlphaBits;
+    GLuint mMaxAlphaBits;
+
+    EffectiveInternalFormatInfo(GLenum effectiveFormat, GLenum destFormat, GLuint minRedBits, GLuint maxRedBits,
+                                GLuint minGreenBits, GLuint maxGreenBits, GLuint minBlueBits, GLuint maxBlueBits,
+                                GLuint minAlphaBits, GLuint maxAlphaBits)
+        : mEffectiveFormat(effectiveFormat), mDestFormat(destFormat), mMinRedBits(minRedBits),
+          mMaxRedBits(maxRedBits), mMinGreenBits(minGreenBits), mMaxGreenBits(maxGreenBits),
+          mMinBlueBits(minBlueBits), mMaxBlueBits(maxBlueBits), mMinAlphaBits(minAlphaBits),
+          mMaxAlphaBits(maxAlphaBits) {};
+};
+
+typedef std::vector&lt;EffectiveInternalFormatInfo&gt; EffectiveInternalFormatList;
+
+static EffectiveInternalFormatList BuildSizedEffectiveInternalFormatList()
+{
+    EffectiveInternalFormatList list;
+
+    // OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
+    //                                                    linear source buffer component sizes.
+    //                                                                            | Source channel min/max sizes |
+    //                                         Effective Internal Format |  N/A   |  R   |  G   |  B   |  A      |
+    list.push_back(EffectiveInternalFormatInfo(GL_ALPHA8_EXT,              GL_NONE, 0,  0, 0,  0, 0,  0, 1, 8));
+    list.push_back(EffectiveInternalFormatInfo(GL_R8,                      GL_NONE, 1,  8, 0,  0, 0,  0, 0, 0));
+    list.push_back(EffectiveInternalFormatInfo(GL_RG8,                     GL_NONE, 1,  8, 1,  8, 0,  0, 0, 0));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGB565,                  GL_NONE, 1,  5, 1,  6, 1,  5, 0, 0));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGB8,                    GL_NONE, 6,  8, 7,  8, 6,  8, 0, 0));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGBA4,                   GL_NONE, 1,  4, 1,  4, 1,  4, 1, 4));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGB5_A1,                 GL_NONE, 5,  5, 5,  5, 5,  5, 1, 1));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGBA8,                   GL_NONE, 5,  8, 5,  8, 5,  8, 2, 8));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGB10_A2,                GL_NONE, 9, 10, 9, 10, 9, 10, 2, 2));
+
+    return list;
+}
+
+static EffectiveInternalFormatList BuildUnsizedEffectiveInternalFormatList()
+{
+    EffectiveInternalFormatList list;
+
+    // OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
+    //                                                    linear source buffer component sizes.
+    //                                                                                        |          Source channel min/max sizes            |
+    //                                         Effective Internal Format |    Dest Format     |     R     |      G     |      B     |      A     |
+    list.push_back(EffectiveInternalFormatInfo(GL_ALPHA8_EXT,              GL_ALPHA,           0, UINT_MAX, 0, UINT_MAX, 0, UINT_MAX, 1,        8));
+    list.push_back(EffectiveInternalFormatInfo(GL_LUMINANCE8_EXT,          GL_LUMINANCE,       1,        8, 0, UINT_MAX, 0, UINT_MAX, 0, UINT_MAX));
+    list.push_back(EffectiveInternalFormatInfo(GL_LUMINANCE8_ALPHA8_EXT,   GL_LUMINANCE_ALPHA, 1,        8, 0, UINT_MAX, 0, UINT_MAX, 1,        8));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGB565,                  GL_RGB,             1,        5, 1,        6, 1,        5, 0, UINT_MAX));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGB8,                    GL_RGB,             6,        8, 7,        8, 6,        8, 0, UINT_MAX));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGBA4,                   GL_RGBA,            1,        4, 1,        4, 1,        4, 1,        4));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGB5_A1,                 GL_RGBA,            5,        5, 5,        5, 5,        5, 1,        1));
+    list.push_back(EffectiveInternalFormatInfo(GL_RGBA8,                   GL_RGBA,            5,        8, 5,        8, 5,        8, 5,        8));
+
+    return list;
+}
+
+static bool GetEffectiveInternalFormat(const InternalFormat &amp;srcFormat, const InternalFormat &amp;destFormat,
+                                       GLenum *outEffectiveFormat)
+{
+    const EffectiveInternalFormatList *list = NULL;
+    GLenum targetFormat = GL_NONE;
+
+    if (destFormat.pixelBytes &gt; 0)
+    {
+        static const EffectiveInternalFormatList sizedList = BuildSizedEffectiveInternalFormatList();
+        list = &amp;sizedList;
+    }
+    else
+    {
+        static const EffectiveInternalFormatList unsizedList = BuildUnsizedEffectiveInternalFormatList();
+        list = &amp;unsizedList;
+        targetFormat = destFormat.format;
+    }
+
+    for (size_t curFormat = 0; curFormat &lt; list-&gt;size(); ++curFormat)
+    {
+        const EffectiveInternalFormatInfo&amp; formatInfo = list-&gt;at(curFormat);
+        if ((formatInfo.mDestFormat == targetFormat) &amp;&amp;
+            (formatInfo.mMinRedBits   &lt;= srcFormat.redBits   &amp;&amp; formatInfo.mMaxRedBits   &gt;= srcFormat.redBits)   &amp;&amp;
+            (formatInfo.mMinGreenBits &lt;= srcFormat.greenBits &amp;&amp; formatInfo.mMaxGreenBits &gt;= srcFormat.greenBits) &amp;&amp;
+            (formatInfo.mMinBlueBits  &lt;= srcFormat.blueBits  &amp;&amp; formatInfo.mMaxBlueBits  &gt;= srcFormat.blueBits)  &amp;&amp;
+            (formatInfo.mMinAlphaBits &lt;= srcFormat.alphaBits &amp;&amp; formatInfo.mMaxAlphaBits &gt;= srcFormat.alphaBits))
+        {
+            *outEffectiveFormat = formatInfo.mEffectiveFormat;
+            return true;
+        }
+    }
+
+    return false;
+}
+
+struct CopyConversion
+{
+    GLenum mTextureFormat;
+    GLenum mFramebufferFormat;
+
+    CopyConversion(GLenum textureFormat, GLenum framebufferFormat)
+        : mTextureFormat(textureFormat), mFramebufferFormat(framebufferFormat) { }
+
+    bool operator&lt;(const CopyConversion&amp; other) const
+    {
+        return memcmp(this, &amp;other, sizeof(CopyConversion)) &lt; 0;
+    }
+};
+
+typedef std::set&lt;CopyConversion&gt; CopyConversionSet;
+
+static CopyConversionSet BuildValidES3CopyTexImageCombinations()
+{
+    CopyConversionSet set;
+
+    // From ES 3.0.1 spec, table 3.15
+    set.insert(CopyConversion(GL_ALPHA, GL_RGBA));
+    set.insert(CopyConversion(GL_LUMINANCE, GL_RED));
+    set.insert(CopyConversion(GL_LUMINANCE, GL_RG));
+    set.insert(CopyConversion(GL_LUMINANCE, GL_RGB));
+    set.insert(CopyConversion(GL_LUMINANCE, GL_RGBA));
+    set.insert(CopyConversion(GL_LUMINANCE_ALPHA, GL_RGBA));
+    set.insert(CopyConversion(GL_RED, GL_RED));
+    set.insert(CopyConversion(GL_RED, GL_RG));
+    set.insert(CopyConversion(GL_RED, GL_RGB));
+    set.insert(CopyConversion(GL_RED, GL_RGBA));
+    set.insert(CopyConversion(GL_RG, GL_RG));
+    set.insert(CopyConversion(GL_RG, GL_RGB));
+    set.insert(CopyConversion(GL_RG, GL_RGBA));
+    set.insert(CopyConversion(GL_RGB, GL_RGB));
+    set.insert(CopyConversion(GL_RGB, GL_RGBA));
+    set.insert(CopyConversion(GL_RGBA, GL_RGBA));
+
+    // Necessary for ANGLE back-buffers
+    set.insert(CopyConversion(GL_ALPHA, GL_BGRA_EXT));
+    set.insert(CopyConversion(GL_LUMINANCE, GL_BGRA_EXT));
+    set.insert(CopyConversion(GL_LUMINANCE_ALPHA, GL_BGRA_EXT));
+    set.insert(CopyConversion(GL_RED, GL_BGRA_EXT));
+    set.insert(CopyConversion(GL_RG, GL_BGRA_EXT));
+    set.insert(CopyConversion(GL_RGB, GL_BGRA_EXT));
+    set.insert(CopyConversion(GL_RGBA, GL_BGRA_EXT));
+
+    set.insert(CopyConversion(GL_RED_INTEGER, GL_RED_INTEGER));
+    set.insert(CopyConversion(GL_RED_INTEGER, GL_RG_INTEGER));
+    set.insert(CopyConversion(GL_RED_INTEGER, GL_RGB_INTEGER));
+    set.insert(CopyConversion(GL_RED_INTEGER, GL_RGBA_INTEGER));
+    set.insert(CopyConversion(GL_RG_INTEGER, GL_RG_INTEGER));
+    set.insert(CopyConversion(GL_RG_INTEGER, GL_RGB_INTEGER));
+    set.insert(CopyConversion(GL_RG_INTEGER, GL_RGBA_INTEGER));
+    set.insert(CopyConversion(GL_RGB_INTEGER, GL_RGB_INTEGER));
+    set.insert(CopyConversion(GL_RGB_INTEGER, GL_RGBA_INTEGER));
+    set.insert(CopyConversion(GL_RGBA_INTEGER, GL_RGBA_INTEGER));
+
+    return set;
+}
+
+static bool IsValidES3CopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle)
+{
+    const InternalFormat &amp;textureInternalFormatInfo = GetInternalFormatInfo(textureInternalFormat);
+    const InternalFormat &amp;framebufferInternalFormatInfo = GetInternalFormatInfo(frameBufferInternalFormat);
+
+    static const CopyConversionSet conversionSet = BuildValidES3CopyTexImageCombinations();
+    if (conversionSet.find(CopyConversion(textureInternalFormatInfo.format, framebufferInternalFormatInfo.format)) != conversionSet.end())
+    {
+        // Section 3.8.5 of the GLES 3.0.3 spec states that source and destination formats
+        // must both be signed, unsigned, or fixed point and both source and destinations
+        // must be either both SRGB or both not SRGB. EXT_color_buffer_float adds allowed
+        // conversion between fixed and floating point.
+
+        if ((textureInternalFormatInfo.colorEncoding == GL_SRGB) != (framebufferInternalFormatInfo.colorEncoding == GL_SRGB))
+        {
+            return false;
+        }
+
+        if (((textureInternalFormatInfo.componentType == GL_INT)          != (framebufferInternalFormatInfo.componentType == GL_INT         )) ||
+            ((textureInternalFormatInfo.componentType == GL_UNSIGNED_INT) != (framebufferInternalFormatInfo.componentType == GL_UNSIGNED_INT)))
+        {
+            return false;
+        }
+
+        if ((textureInternalFormatInfo.componentType == GL_UNSIGNED_NORMALIZED ||
+             textureInternalFormatInfo.componentType == GL_SIGNED_NORMALIZED ||
+             textureInternalFormatInfo.componentType == GL_FLOAT) &amp;&amp;
+            !(framebufferInternalFormatInfo.componentType == GL_UNSIGNED_NORMALIZED ||
+              framebufferInternalFormatInfo.componentType == GL_SIGNED_NORMALIZED ||
+              framebufferInternalFormatInfo.componentType == GL_FLOAT))
+        {
+            return false;
+        }
+
+        // GLES specification 3.0.3, sec 3.8.5, pg 139-140:
+        // The effective internal format of the source buffer is determined with the following rules applied in order:
+        //    * If the source buffer is a texture or renderbuffer that was created with a sized internal format then the
+        //      effective internal format is the source buffer's sized internal format.
+        //    * If the source buffer is a texture that was created with an unsized base internal format, then the
+        //      effective internal format is the source image array's effective internal format, as specified by table
+        //      3.12, which is determined from the &lt;format&gt; and &lt;type&gt; that were used when the source image array was
+        //      specified by TexImage*.
+        //    * Otherwise the effective internal format is determined by the row in table 3.17 or 3.18 where
+        //      Destination Internal Format matches internalformat and where the [source channel sizes] are consistent
+        //      with the values of the source buffer's [channel sizes]. Table 3.17 is used if the
+        //      FRAMEBUFFER_ATTACHMENT_ENCODING is LINEAR and table 3.18 is used if the FRAMEBUFFER_ATTACHMENT_ENCODING
+        //      is SRGB.
+        const InternalFormat *sourceEffectiveFormat = NULL;
+        if (readBufferHandle != 0)
+        {
+            // Not the default framebuffer, therefore the read buffer must be a user-created texture or renderbuffer
+            if (framebufferInternalFormatInfo.pixelBytes &gt; 0)
+            {
+                sourceEffectiveFormat = &amp;framebufferInternalFormatInfo;
+            }
+            else
+            {
+                // Renderbuffers cannot be created with an unsized internal format, so this must be an unsized-format
+                // texture. We can use the same table we use when creating textures to get its effective sized format.
+                GLenum sizedInternalFormat = GetSizedInternalFormat(framebufferInternalFormatInfo.format, framebufferInternalFormatInfo.type);
+                sourceEffectiveFormat = &amp;GetInternalFormatInfo(sizedInternalFormat);
+            }
+        }
+        else
+        {
+            // The effective internal format must be derived from the source framebuffer's channel sizes.
+            // This is done in GetEffectiveInternalFormat for linear buffers (table 3.17)
+            if (framebufferInternalFormatInfo.colorEncoding == GL_LINEAR)
+            {
+                GLenum effectiveFormat;
+                if (GetEffectiveInternalFormat(framebufferInternalFormatInfo, textureInternalFormatInfo, &amp;effectiveFormat))
+                {
+                    sourceEffectiveFormat = &amp;GetInternalFormatInfo(effectiveFormat);
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            else if (framebufferInternalFormatInfo.colorEncoding == GL_SRGB)
+            {
+                // SRGB buffers can only be copied to sized format destinations according to table 3.18
+                if ((textureInternalFormatInfo.pixelBytes &gt; 0) &amp;&amp;
+                    (framebufferInternalFormatInfo.redBits   &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.redBits   &lt;= 8) &amp;&amp;
+                    (framebufferInternalFormatInfo.greenBits &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.greenBits &lt;= 8) &amp;&amp;
+                    (framebufferInternalFormatInfo.blueBits  &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.blueBits  &lt;= 8) &amp;&amp;
+                    (framebufferInternalFormatInfo.alphaBits &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.alphaBits &lt;= 8))
+                {
+                    sourceEffectiveFormat = &amp;GetInternalFormatInfo(GL_SRGB8_ALPHA8);
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            else
+            {
+                UNREACHABLE();
+                return false;
+            }
+        }
+
+        if (textureInternalFormatInfo.pixelBytes &gt; 0)
+        {
+            // Section 3.8.5 of the GLES 3.0.3 spec, pg 139, requires that, if the destination format is sized,
+            // component sizes of the source and destination formats must exactly match
+            if (textureInternalFormatInfo.redBits   != sourceEffectiveFormat-&gt;redBits   ||
+                textureInternalFormatInfo.greenBits != sourceEffectiveFormat-&gt;greenBits ||
+                textureInternalFormatInfo.blueBits  != sourceEffectiveFormat-&gt;blueBits  ||
+                textureInternalFormatInfo.alphaBits != sourceEffectiveFormat-&gt;alphaBits)
+            {
+                return false;
+            }
+        }
+
+
+        return true; // A conversion function exists, and no rule in the specification has precluded conversion
+                     // between these formats.
+    }
+
+    return false;
+}
+
+bool ValidateES3CopyTexImageParameters(Context *context, GLenum target, GLint level, GLenum internalformat,
+                                       bool isSubImage, GLint xoffset, GLint yoffset, GLint zoffset,
+                                       GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+    GLenum textureInternalFormat;
+    if (!ValidateCopyTexImageParametersBase(context, target, level, internalformat, isSubImage,
+                                            xoffset, yoffset, zoffset, x, y, width, height,
+                                            border, &amp;textureInternalFormat))
+    {
+        return false;
+    }
+
+    gl::Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+
+    if (framebuffer-&gt;checkStatus(context-&gt;getData()) != GL_FRAMEBUFFER_COMPLETE)
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    if (context-&gt;getState().getReadFramebuffer()-&gt;id() != 0 &amp;&amp;
+        framebuffer-&gt;getSamples(context-&gt;getData()) != 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::FramebufferAttachment *source = framebuffer-&gt;getReadColorbuffer();
+    GLenum colorbufferInternalFormat = source-&gt;getInternalFormat();
+
+    if (isSubImage)
+    {
+        if (!IsValidES3CopyTexImageCombination(textureInternalFormat, colorbufferInternalFormat,
+                                               context-&gt;getState().getReadFramebuffer()-&gt;id()))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+    else
+    {
+        if (!gl::IsValidES3CopyTexImageCombination(internalformat, colorbufferInternalFormat,
+                                                context-&gt;getState().getReadFramebuffer()-&gt;id()))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    // If width or height is zero, it is a no-op.  Return false without setting an error.
+    return (width &gt; 0 &amp;&amp; height &gt; 0);
+}
+
+bool ValidateES3TexStorageParameters(Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+                                     GLsizei width, GLsizei height, GLsizei depth)
+{
+    if (width &lt; 1 || height &lt; 1 || depth &lt; 1 || levels &lt; 1)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (levels &gt; gl::log2(std::max(std::max(width, height), depth)) + 1)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::Caps &amp;caps = context-&gt;getCaps();
+
+    switch (target)
+    {
+      case GL_TEXTURE_2D:
+        {
+            if (static_cast&lt;GLuint&gt;(width) &gt; caps.max2DTextureSize ||
+                static_cast&lt;GLuint&gt;(height) &gt; caps.max2DTextureSize)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return false;
+            }
+        }
+        break;
+
+      case GL_TEXTURE_CUBE_MAP:
+        {
+            if (width != height)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return false;
+            }
+
+            if (static_cast&lt;GLuint&gt;(width) &gt; caps.maxCubeMapTextureSize)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return false;
+            }
+        }
+        break;
+
+      case GL_TEXTURE_3D:
+        {
+            if (static_cast&lt;GLuint&gt;(width) &gt; caps.max3DTextureSize ||
+                static_cast&lt;GLuint&gt;(height) &gt; caps.max3DTextureSize ||
+                static_cast&lt;GLuint&gt;(depth) &gt; caps.max3DTextureSize)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return false;
+            }
+        }
+        break;
+
+      case GL_TEXTURE_2D_ARRAY:
+        {
+            if (static_cast&lt;GLuint&gt;(width) &gt; caps.max2DTextureSize ||
+                static_cast&lt;GLuint&gt;(height) &gt; caps.max2DTextureSize ||
+                static_cast&lt;GLuint&gt;(depth) &gt; caps.maxArrayTextureLayers)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return false;
+            }
+        }
+        break;
+
+      default:
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    gl::Texture *texture = context-&gt;getTargetTexture(target);
+    if (!texture || texture-&gt;id() == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (texture-&gt;isImmutable())
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalformat);
+    if (!formatInfo.textureSupport(context-&gt;getClientVersion(), context-&gt;getExtensions()))
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    if (formatInfo.pixelBytes == 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_ENUM));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum attachment,
+                                     GLuint texture, GLint level, GLint layer)
+{
+    if (context-&gt;getClientVersion() &lt; 3)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    if (layer &lt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    if (!ValidateFramebufferTextureBase(context, target, attachment, texture, level))
+    {
+        return false;
+    }
+
+    const gl::Caps &amp;caps = context-&gt;getCaps();
+    if (texture != 0)
+    {
+        gl::Texture *tex = context-&gt;getTexture(texture);
+        ASSERT(tex);
+
+        switch (tex-&gt;getTarget())
+        {
+          case GL_TEXTURE_2D_ARRAY:
+            {
+                if (level &gt; gl::log2(caps.max2DTextureSize))
+                {
+                    context-&gt;recordError(Error(GL_INVALID_VALUE));
+                    return false;
+                }
+
+                if (static_cast&lt;GLuint&gt;(layer) &gt;= caps.maxArrayTextureLayers)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_VALUE));
+                    return false;
+                }
+            }
+            break;
+
+          case GL_TEXTURE_3D:
+            {
+                if (level &gt; gl::log2(caps.max3DTextureSize))
+                {
+                    context-&gt;recordError(Error(GL_INVALID_VALUE));
+                    return false;
+                }
+
+                if (static_cast&lt;GLuint&gt;(layer) &gt;= caps.max3DTextureSize)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_VALUE));
+                    return false;
+                }
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+
+        const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(tex-&gt;getInternalFormat(tex-&gt;getTarget(), level));
+        if (internalFormatInfo.compressed)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+bool ValidES3ReadFormatType(Context *context, GLenum internalFormat, GLenum format, GLenum type)
+{
+    const gl::InternalFormat &amp;internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
+
+    switch (format)
+    {
+      case GL_RGBA:
+        switch (type)
+        {
+          case GL_UNSIGNED_BYTE:
+            break;
+          case GL_UNSIGNED_INT_2_10_10_10_REV:
+            if (internalFormat != GL_RGB10_A2)
+            {
+                return false;
+            }
+            break;
+          case GL_FLOAT:
+            if (internalFormatInfo.componentType != GL_FLOAT)
+            {
+                return false;
+            }
+            break;
+          default:
+            return false;
+        }
+        break;
+      case GL_RGBA_INTEGER:
+        switch (type)
+        {
+          case GL_INT:
+            if (internalFormatInfo.componentType != GL_INT)
+            {
+                return false;
+            }
+            break;
+          case GL_UNSIGNED_INT:
+            if (internalFormatInfo.componentType != GL_UNSIGNED_INT)
+            {
+                return false;
+            }
+            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_RG_EXT:
+      case GL_RED_EXT:
+        if (!context-&gt;getExtensions().textureRG)
+        {
+            return false;
+        }
+        switch (type)
+        {
+        case GL_UNSIGNED_BYTE:
+            break;
+        default:
+            return false;
+        }
+        break;
+      default:
+        return false;
+    }
+    return true;
+}
+
+bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum target, GLsizei samples,
+                                              GLenum internalformat, GLsizei width, GLsizei height)
+{
+    if (!ValidateRenderbufferStorageParametersBase(context, target, samples, internalformat, width, height))
+    {
+        return false;
+    }
+
+    //The ES3 spec(section 4.4.2) states that the internal format must be sized and not an integer format if samples is greater than zero.
+    const gl::InternalFormat &amp;formatInfo = gl::GetInternalFormatInfo(internalformat);
+    if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT) &amp;&amp; samples &gt; 0)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    // The behavior is different than the ANGLE version, which would generate a GL_OUT_OF_MEMORY.
+    const TextureCaps &amp;formatCaps = context-&gt;getTextureCaps().get(internalformat);
+    if (static_cast&lt;GLuint&gt;(samples) &gt; formatCaps.getMaxSamples())
+    {
+        context-&gt;recordError(Error(GL_INVALID_VALUE));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateInvalidateFramebufferParameters(Context *context, GLenum target, GLsizei numAttachments,
+                                             const GLenum* attachments)
+{
+    bool defaultFramebuffer = false;
+
+    switch (target)
+    {
+      case GL_DRAW_FRAMEBUFFER:
+      case GL_FRAMEBUFFER:
+        defaultFramebuffer = context-&gt;getState().getDrawFramebuffer()-&gt;id() == 0;
+        break;
+      case GL_READ_FRAMEBUFFER:
+        defaultFramebuffer = context-&gt;getState().getReadFramebuffer()-&gt;id() == 0;
+        break;
+      default:
+          context-&gt;recordError(Error(GL_INVALID_ENUM));
+          return false;
+    }
+
+    for (int i = 0; i &lt; numAttachments; ++i)
+    {
+        if (attachments[i] &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp; attachments[i] &lt;= GL_COLOR_ATTACHMENT15)
+        {
+            if (defaultFramebuffer)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+
+            if (attachments[i] &gt;= GL_COLOR_ATTACHMENT0 + context-&gt;getCaps().maxColorAttachments)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return false;
+            }
+        }
+        else
+        {
+            switch (attachments[i])
+            {
+              case GL_DEPTH_ATTACHMENT:
+              case GL_STENCIL_ATTACHMENT:
+              case GL_DEPTH_STENCIL_ATTACHMENT:
+                if (defaultFramebuffer)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return false;
+                }
+                break;
+              case GL_COLOR:
+              case GL_DEPTH:
+              case GL_STENCIL:
+                if (!defaultFramebuffer)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return false;
+                }
+                break;
+              default:
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return false;
+            }
+        }
+    }
+
+    return true;
+}
+
+bool ValidateClearBuffer(Context *context)
+{
+    if (context-&gt;getClientVersion() &lt; 3)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    const gl::Framebuffer *fbo = context-&gt;getState().getDrawFramebuffer();
+    if (!fbo || fbo-&gt;checkStatus(context-&gt;getData()) != GL_FRAMEBUFFER_COMPLETE)
+    {
+        context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+        return false;
+    }
+
+    return true;
+}
+
+bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint* params)
+{
+    if (context-&gt;getClientVersion() &lt; 3)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    return ValidateGetUniformBase(context, program, location);
+}
+
+bool ValidateReadBuffer(Context *context, GLenum src)
+{
+    if (context-&gt;getClientVersion() &lt; 3)
+    {
+        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+        return false;
+    }
+
+    Framebuffer *readFBO = context-&gt;getState().getReadFramebuffer();
+
+    if (readFBO == nullptr)
+    {
+        context-&gt;recordError(gl::Error(GL_INVALID_OPERATION, &quot;No active read framebuffer.&quot;));
+        return false;
+    }
+
+    if (src == GL_NONE)
+    {
+        return true;
+    }
+
+    if (src != GL_BACK &amp;&amp; (src &lt; GL_COLOR_ATTACHMENT0 || src &gt; GL_COLOR_ATTACHMENT15))
+    {
+        context-&gt;recordError(gl::Error(GL_INVALID_ENUM, &quot;Unknown enum for 'src' in ReadBuffer&quot;));
+        return false;
+    }
+
+    if (readFBO-&gt;id() == 0)
+    {
+        if (src != GL_BACK)
+        {
+            const char *errorMsg = &quot;'src' must be GL_NONE or GL_BACK when reading from the default framebuffer.&quot;;
+            context-&gt;recordError(gl::Error(GL_INVALID_OPERATION, errorMsg));
+            return false;
+        }
+    }
+    else
+    {
+        GLuint drawBuffer = static_cast&lt;GLuint&gt;(src - GL_COLOR_ATTACHMENT0);
+
+        if (drawBuffer &gt;= context-&gt;getCaps().maxDrawBuffers)
+        {
+            const char *errorMsg = &quot;'src' is greater than MAX_DRAW_BUFFERS.&quot;;
+            context-&gt;recordError(gl::Error(GL_INVALID_OPERATION, errorMsg));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibANGLEvalidationES3h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libANGLE/validationES3.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+//
+// Copyright (c) 2013 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.
+//
+
+// validationES3.h: Validation functions for OpenGL ES 3.0 entry point parameters
+
+#ifndef LIBANGLE_VALIDATION_ES3_H_
+#define LIBANGLE_VALIDATION_ES3_H_
+
+#include &lt;GLES3/gl3.h&gt;
+
+namespace gl
+{
+
+class Context;
+
+bool ValidateES3TexImageParameters(Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
+                                   GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+
+bool ValidateES3CopyTexImageParameters(Context *context, GLenum target, GLint level, GLenum internalformat,
+                                       bool isSubImage, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y,
+                                       GLsizei width, GLsizei height, GLint border);
+
+bool ValidateES3TexStorageParameters(Context *context, GLenum target, GLsizei levels, GLenum internalformat,
+                                     GLsizei width, GLsizei height, GLsizei depth);
+
+bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum attachment,
+                                     GLuint texture, GLint level, GLint layer);
+
+bool ValidES3ReadFormatType(Context *context, GLenum internalFormat, GLenum format, GLenum type);
+
+bool ValidateES3RenderbufferStorageParameters(Context *context, GLenum target, GLsizei samples,
+                                              GLenum internalformat, GLsizei width, GLsizei height);
+
+bool ValidateInvalidateFramebufferParameters(Context *context, GLenum target, GLsizei numAttachments,
+                                             const GLenum* attachments);
+
+bool ValidateClearBuffer(Context *context);
+
+bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLuint* params);
+
+bool ValidateReadBuffer(Context *context, GLenum mode);
+
+}
+
+#endif // LIBANGLE_VALIDATION_ES3_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLConfigcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,356 +0,0 @@
</span><del>-//
-// 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 &quot;libEGL/Config.h&quot;
-
-#include &lt;algorithm&gt;
-#include &lt;vector&gt;
-
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES3/gl3ext.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-#include &lt;GLES2/gl2ext.h&gt;
-#include &lt;EGL/eglext.h&gt;
-
-#include &quot;common/debug.h&quot;
-
-using namespace std;
-
-namespace egl
-{
-Config::Config(rx::ConfigDesc desc, EGLint minInterval, EGLint maxInterval, EGLint texWidth, EGLint texHeight)
-    : mRenderTargetFormat(desc.renderTargetFormat), mDepthStencilFormat(desc.depthStencilFormat), mMultiSample(desc.multiSample)
-{
-    mBindToTextureRGB = EGL_FALSE;
-    mBindToTextureRGBA = EGL_FALSE;
-    switch (desc.renderTargetFormat)
-    {
-      case GL_RGB5_A1:
-        mBufferSize = 16;
-        mRedSize = 5;
-        mGreenSize = 5;
-        mBlueSize = 5;
-        mAlphaSize = 1;
-        break;
-      case GL_BGR5_A1_ANGLEX:
-        mBufferSize = 16;
-        mRedSize = 5;
-        mGreenSize = 5;
-        mBlueSize = 5;
-        mAlphaSize = 1;
-        break;
-      case GL_RGBA8_OES:
-        mBufferSize = 32;
-        mRedSize = 8;
-        mGreenSize = 8;
-        mBlueSize = 8;
-        mAlphaSize = 8;
-        mBindToTextureRGBA = true;
-        break;
-      case GL_RGB565:
-        mBufferSize = 16;
-        mRedSize = 5;
-        mGreenSize = 6;
-        mBlueSize = 5;
-        mAlphaSize = 0;
-        break;
-      case GL_RGB8_OES:
-        mBufferSize = 32;
-        mRedSize = 8;
-        mGreenSize = 8;
-        mBlueSize = 8;
-        mAlphaSize = 0;
-        mBindToTextureRGB = true;
-        break;
-      case GL_BGRA8_EXT:
-        mBufferSize = 32;
-        mRedSize = 8;
-        mGreenSize = 8;
-        mBlueSize = 8;
-        mAlphaSize = 8;
-        mBindToTextureRGBA = true;
-        break;
-      default:
-        UNREACHABLE();   // Other formats should not be valid
-    }
-
-    mLuminanceSize = 0;
-    mAlphaMaskSize = 0;
-    mColorBufferType = EGL_RGB_BUFFER;
-    mConfigCaveat = (desc.fastConfig) ? EGL_NONE : EGL_SLOW_CONFIG;
-    mConfigID = 0;
-    mConformant = EGL_OPENGL_ES2_BIT;
-
-    switch (desc.depthStencilFormat)
-    {
-      case GL_NONE:
-        mDepthSize = 0;
-        mStencilSize = 0;
-        break;
-      case GL_DEPTH_COMPONENT32_OES:
-        mDepthSize = 32;
-        mStencilSize = 0;
-        break;
-      case GL_DEPTH24_STENCIL8_OES:
-        mDepthSize = 24;
-        mStencilSize = 8;
-        break;
-      case GL_DEPTH_COMPONENT24_OES:
-        mDepthSize = 24;
-        mStencilSize = 0;
-        break;
-      case GL_DEPTH_COMPONENT16:
-        mDepthSize = 16;
-        mStencilSize = 0;
-        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 = desc.multiSample ? 1 : 0;
-    mSamples = desc.multiSample;
-    mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
-    mTransparentType = EGL_NONE;
-    mTransparentRedValue = 0;
-    mTransparentGreenValue = 0;
-    mTransparentBlueValue = 0;
-
-    if (desc.es3Capable)
-    {
-        mRenderableType |= EGL_OPENGL_ES3_BIT_KHR;
-        mConformant |= EGL_OPENGL_ES3_BIT_KHR;
-    }
-}
-
-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 &amp;&amp; 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 &amp;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 &amp;x, const Config &amp;y) const
-{
-    #define SORT(attribute)                        \
-        if (x.attribute != y.attribute)            \
-        {                                          \
-            return x.attribute &lt; y.attribute;      \
-        }
-
-    META_ASSERT(EGL_NONE &lt; EGL_SLOW_CONFIG &amp;&amp; EGL_SLOW_CONFIG &lt; EGL_NON_CONFORMANT_CONFIG);
-    SORT(mConfigCaveat);
-
-    META_ASSERT(EGL_RGB_BUFFER &lt; EGL_LUMINANCE_BUFFER);
-    SORT(mColorBufferType);
-
-    // By larger total number of color bits, only considering those that are requested to be &gt; 0.
-    EGLint xComponentsSize = wantedComponentsSize(x);
-    EGLint yComponentsSize = wantedComponentsSize(y);
-    if (xComponentsSize != yComponentsSize)
-    {
-        return xComponentsSize &gt; 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(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight)
-{
-    Config config(desc, minSwapInterval, maxSwapInterval, 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&lt;const Config*&gt; 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-&gt;mBufferSize &gt;= attribute[1];                      break;
-              case EGL_ALPHA_SIZE:                match = config-&gt;mAlphaSize &gt;= attribute[1];                       break;
-              case EGL_BLUE_SIZE:                 match = config-&gt;mBlueSize &gt;= attribute[1];                        break;
-              case EGL_GREEN_SIZE:                match = config-&gt;mGreenSize &gt;= attribute[1];                       break;
-              case EGL_RED_SIZE:                  match = config-&gt;mRedSize &gt;= attribute[1];                         break;
-              case EGL_DEPTH_SIZE:                match = config-&gt;mDepthSize &gt;= attribute[1];                       break;
-              case EGL_STENCIL_SIZE:              match = config-&gt;mStencilSize &gt;= attribute[1];                     break;
-              case EGL_CONFIG_CAVEAT:             match = config-&gt;mConfigCaveat == (EGLenum) attribute[1];          break;
-              case EGL_CONFIG_ID:                 match = config-&gt;mConfigID == attribute[1];                        break;
-              case EGL_LEVEL:                     match = config-&gt;mLevel &gt;= attribute[1];                           break;
-              case EGL_NATIVE_RENDERABLE:         match = config-&gt;mNativeRenderable == (EGLBoolean) attribute[1];   break;
-              case EGL_NATIVE_VISUAL_TYPE:        match = config-&gt;mNativeVisualType == attribute[1];                break;
-              case EGL_SAMPLES:                   match = config-&gt;mSamples &gt;= attribute[1];                         break;
-              case EGL_SAMPLE_BUFFERS:            match = config-&gt;mSampleBuffers &gt;= attribute[1];                   break;
-              case EGL_SURFACE_TYPE:              match = (config-&gt;mSurfaceType &amp; attribute[1]) == attribute[1];    break;
-              case EGL_TRANSPARENT_TYPE:          match = config-&gt;mTransparentType == (EGLenum) attribute[1];       break;
-              case EGL_TRANSPARENT_BLUE_VALUE:    match = config-&gt;mTransparentBlueValue == attribute[1];            break;
-              case EGL_TRANSPARENT_GREEN_VALUE:   match = config-&gt;mTransparentGreenValue == attribute[1];           break;
-              case EGL_TRANSPARENT_RED_VALUE:     match = config-&gt;mTransparentRedValue == attribute[1];             break;
-              case EGL_BIND_TO_TEXTURE_RGB:       match = config-&gt;mBindToTextureRGB == (EGLBoolean) attribute[1];   break;
-              case EGL_BIND_TO_TEXTURE_RGBA:      match = config-&gt;mBindToTextureRGBA == (EGLBoolean) attribute[1];  break;
-              case EGL_MIN_SWAP_INTERVAL:         match = config-&gt;mMinSwapInterval == attribute[1];                 break;
-              case EGL_MAX_SWAP_INTERVAL:         match = config-&gt;mMaxSwapInterval == attribute[1];                 break;
-              case EGL_LUMINANCE_SIZE:            match = config-&gt;mLuminanceSize &gt;= attribute[1];                   break;
-              case EGL_ALPHA_MASK_SIZE:           match = config-&gt;mAlphaMaskSize &gt;= attribute[1];                   break;
-              case EGL_COLOR_BUFFER_TYPE:         match = config-&gt;mColorBufferType == (EGLenum) attribute[1];       break;
-              case EGL_RENDERABLE_TYPE:           match = (config-&gt;mRenderableType &amp; attribute[1]) == attribute[1]; break;
-              case EGL_MATCH_NATIVE_PIXMAP:       match = false; UNIMPLEMENTED();                                   break;
-              case EGL_CONFORMANT:                match = (config-&gt;mConformant &amp; attribute[1]) == attribute[1];     break;
-              case EGL_MAX_PBUFFER_WIDTH:         match = config-&gt;mMaxPBufferWidth &gt;= attribute[1];                 break;
-              case EGL_MAX_PBUFFER_HEIGHT:        match = config-&gt;mMaxPBufferHeight &gt;= attribute[1];                break;
-              case EGL_MAX_PBUFFER_PIXELS:        match = config-&gt;mMaxPBufferPixels &gt;= attribute[1];                break;
-              default:
-                return false;
-            }
-
-            if (!match)
-            {
-                break;
-            }
-
-            attribute += 2;
-        }
-
-        if (match)
-        {
-            passed.push_back(&amp;*config);
-        }
-    }
-
-    if (configs)
-    {
-        sort(passed.begin(), passed.end(), SortConfig(attribList));
-
-        EGLint index;
-        for (index = 0; index &lt; configSize &amp;&amp; index &lt; static_cast&lt;EGLint&gt;(passed.size()); index++)
-        {
-            configs[index] = passed[index]-&gt;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-&gt;getHandle() == configHandle)
-        {
-            return &amp;(*config);
-        }
-    }
-
-    return NULL;
-}
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLConfigh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Config.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,115 +0,0 @@
</span><del>-//
-// 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 &lt;EGL/egl.h&gt;
-
-#include &lt;set&gt;
-
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;common/angleutils.h&quot;
-
-namespace egl
-{
-class Display;
-
-class Config
-{
-  public:
-    Config(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight);
-
-    EGLConfig getHandle() const;
-
-    const GLenum mRenderTargetFormat;
-    const GLenum mDepthStencilFormat;
-    const GLint 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 &amp;x, const Config &amp;y) const;
-
-  private:
-    void scanForWantedComponents(const EGLint *attribList);
-    EGLint wantedComponentsSize(const Config &amp;config) const;
-
-    bool mWantRed;
-    bool mWantGreen;
-    bool mWantBlue;
-    bool mWantAlpha;
-    bool mWantLuminance;
-};
-
-class ConfigSet
-{
-    friend Display;
-
-  public:
-    ConfigSet();
-
-    void add(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, 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&lt;Config, SortConfig&gt; Set;
-    typedef Set::iterator Iterator;
-    Set mSet;
-
-    static const EGLint mSortAttribs[];
-};
-}
-
-#endif   // INCLUDE_CONFIG_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLDisplaycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,573 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &quot;libEGL/Display.h&quot;
-
-#include &lt;algorithm&gt;
-#include &lt;map&gt;
-#include &lt;vector&gt;
-
-#include &quot;common/debug.h&quot;
-#include &quot;common/mathutil.h&quot;
-#include &quot;libGLESv2/main.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/renderer/SwapChain.h&quot;
-
-#include &quot;libEGL/main.h&quot;
-#include &quot;libEGL/Surface.h&quot;
-
-namespace egl
-{
-namespace
-{
-    typedef std::map&lt;EGLNativeDisplayType, Display*&gt; DisplayMap; 
-    DisplayMap displays;
-}
-
-egl::Display *Display::getDisplay(EGLNativeDisplayType displayId)
-{
-    if (displays.find(displayId) != displays.end())
-    {
-        return displays[displayId];
-    }
-    
-    // FIXME: Check if displayId is a valid display device context
-
-    egl::Display *display = new egl::Display(displayId, (HDC)displayId);
-
-    displays[displayId] = display;
-    return display;
-}
-
-Display::Display(EGLNativeDisplayType displayId, HDC deviceContext) : mDc(deviceContext)
-{
-    mDisplayId = displayId;
-    mRenderer = NULL;
-}
-
-Display::~Display()
-{
-    terminate();
-
-    DisplayMap::iterator thisDisplay = displays.find(mDisplayId);
-
-    if (thisDisplay != displays.end())
-    {
-        displays.erase(thisDisplay);
-    }
-}
-
-bool Display::initialize()
-{
-    if (isInitialized())
-    {
-        return true;
-    }
-
-    mRenderer = glCreateRenderer(this, mDc, mDisplayId);
-    
-    if (!mRenderer)
-    {
-        terminate();
-        return error(EGL_NOT_INITIALIZED, false);
-    }
-
-    EGLint minSwapInterval = mRenderer-&gt;getMinSwapInterval();
-    EGLint maxSwapInterval = mRenderer-&gt;getMaxSwapInterval();
-    EGLint maxTextureWidth = mRenderer-&gt;getMaxTextureWidth();
-    EGLint maxTextureHeight = mRenderer-&gt;getMaxTextureHeight();
-
-    rx::ConfigDesc *descList;
-    int numConfigs = mRenderer-&gt;generateConfigs(&amp;descList);
-    ConfigSet configSet;
-
-    for (int i = 0; i &lt; numConfigs; ++i)
-        configSet.add(descList[i], minSwapInterval, maxSwapInterval,
-                      maxTextureWidth, 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);
-    }
-
-    mRenderer-&gt;deleteConfigs(descList);
-    descList = NULL;
-
-    if (!isInitialized())
-    {
-        terminate();
-        return false;
-    }
-
-    initExtensionString();
-    initVendorString();
-
-    return true;
-}
-
-void Display::terminate()
-{
-    while (!mSurfaceSet.empty())
-    {
-        destroySurface(*mSurfaceSet.begin());
-    }
-
-    while (!mContextSet.empty())
-    {
-        destroyContext(*mContextSet.begin());
-    }
-
-    glDestroyRenderer(mRenderer);
-    mRenderer = NULL;
-}
-
-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-&gt;mBufferSize;             break;
-      case EGL_ALPHA_SIZE:                *value = configuration-&gt;mAlphaSize;              break;
-      case EGL_BLUE_SIZE:                 *value = configuration-&gt;mBlueSize;               break;
-      case EGL_GREEN_SIZE:                *value = configuration-&gt;mGreenSize;              break;
-      case EGL_RED_SIZE:                  *value = configuration-&gt;mRedSize;                break;
-      case EGL_DEPTH_SIZE:                *value = configuration-&gt;mDepthSize;              break;
-      case EGL_STENCIL_SIZE:              *value = configuration-&gt;mStencilSize;            break;
-      case EGL_CONFIG_CAVEAT:             *value = configuration-&gt;mConfigCaveat;           break;
-      case EGL_CONFIG_ID:                 *value = configuration-&gt;mConfigID;               break;
-      case EGL_LEVEL:                     *value = configuration-&gt;mLevel;                  break;
-      case EGL_NATIVE_RENDERABLE:         *value = configuration-&gt;mNativeRenderable;       break;
-      case EGL_NATIVE_VISUAL_TYPE:        *value = configuration-&gt;mNativeVisualType;       break;
-      case EGL_SAMPLES:                   *value = configuration-&gt;mSamples;                break;
-      case EGL_SAMPLE_BUFFERS:            *value = configuration-&gt;mSampleBuffers;          break;
-      case EGL_SURFACE_TYPE:              *value = configuration-&gt;mSurfaceType;            break;
-      case EGL_TRANSPARENT_TYPE:          *value = configuration-&gt;mTransparentType;        break;
-      case EGL_TRANSPARENT_BLUE_VALUE:    *value = configuration-&gt;mTransparentBlueValue;   break;
-      case EGL_TRANSPARENT_GREEN_VALUE:   *value = configuration-&gt;mTransparentGreenValue;  break;
-      case EGL_TRANSPARENT_RED_VALUE:     *value = configuration-&gt;mTransparentRedValue;    break;
-      case EGL_BIND_TO_TEXTURE_RGB:       *value = configuration-&gt;mBindToTextureRGB;       break;
-      case EGL_BIND_TO_TEXTURE_RGBA:      *value = configuration-&gt;mBindToTextureRGBA;      break;
-      case EGL_MIN_SWAP_INTERVAL:         *value = configuration-&gt;mMinSwapInterval;        break;
-      case EGL_MAX_SWAP_INTERVAL:         *value = configuration-&gt;mMaxSwapInterval;        break;
-      case EGL_LUMINANCE_SIZE:            *value = configuration-&gt;mLuminanceSize;          break;
-      case EGL_ALPHA_MASK_SIZE:           *value = configuration-&gt;mAlphaMaskSize;          break;
-      case EGL_COLOR_BUFFER_TYPE:         *value = configuration-&gt;mColorBufferType;        break;
-      case EGL_RENDERABLE_TYPE:           *value = configuration-&gt;mRenderableType;         break;
-      case EGL_MATCH_NATIVE_PIXMAP:       *value = false; UNIMPLEMENTED();                 break;
-      case EGL_CONFORMANT:                *value = configuration-&gt;mConformant;             break;
-      case EGL_MAX_PBUFFER_WIDTH:         *value = configuration-&gt;mMaxPBufferWidth;        break;
-      case EGL_MAX_PBUFFER_HEIGHT:        *value = configuration-&gt;mMaxPBufferHeight;       break;
-      case EGL_MAX_PBUFFER_PIXELS:        *value = configuration-&gt;mMaxPBufferPixels;       break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-
-
-EGLSurface Display::createWindowSurface(HWND window, EGLConfig config, const EGLint *attribList)
-{
-    const Config *configuration = mConfigSet.get(config);
-    EGLint postSubBufferSupported = EGL_FALSE;
-
-    EGLint width = 0;
-    EGLint height = 0;
-    EGLint fixedSize = 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_WIDTH:
-                width = attribList[1];
-                break;
-              case EGL_HEIGHT:
-                height = attribList[1];
-                break;
-              case EGL_FIXED_SIZE_ANGLE:
-                fixedSize = 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 (width &lt; 0 || height &lt; 0)
-    {
-        return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
-    }
-
-    if (!fixedSize)
-    {
-        width = -1;
-        height = -1;
-    }
-
-    if (hasExistingWindowSurface(window))
-    {
-        return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
-
-    if (mRenderer-&gt;testDeviceLost(false))
-    {
-        if (!restoreLostDevice())
-            return EGL_NO_SURFACE;
-    }
-
-    Surface *surface = new Surface(this, configuration, window, fixedSize, width, height, postSubBufferSupported);
-
-    if (!surface-&gt;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 &lt; 0 || height &lt; 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 &amp;&amp; !mRenderer-&gt;getNonPower2TextureSupport() &amp;&amp; (!gl::isPow2(width) || !gl::isPow2(height)))
-    {
-        return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-    }
-
-    if ((textureFormat != EGL_NO_TEXTURE &amp;&amp; textureTarget == EGL_NO_TEXTURE) ||
-        (textureFormat == EGL_NO_TEXTURE &amp;&amp; textureTarget != EGL_NO_TEXTURE))
-    {
-        return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-    }
-
-    if (!(configuration-&gt;mSurfaceType &amp; EGL_PBUFFER_BIT))
-    {
-        return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
-    }
-
-    if ((textureFormat == EGL_TEXTURE_RGB &amp;&amp; configuration-&gt;mBindToTextureRGB != EGL_TRUE) ||
-        (textureFormat == EGL_TEXTURE_RGBA &amp;&amp; configuration-&gt;mBindToTextureRGBA != EGL_TRUE))
-    {
-        return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
-    }
-
-    if (mRenderer-&gt;testDeviceLost(false))
-    {
-        if (!restoreLostDevice())
-            return EGL_NO_SURFACE;
-    }
-
-    Surface *surface = new Surface(this, configuration, shareHandle, width, height, textureFormat, textureTarget);
-
-    if (!surface-&gt;initialize())
-    {
-        delete surface;
-        return EGL_NO_SURFACE;
-    }
-
-    mSurfaceSet.insert(surface);
-
-    return success(surface);
-}
-
-EGLContext Display::createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, bool robustAccess)
-{
-    if (!mRenderer)
-    {
-        return EGL_NO_CONTEXT;
-    }
-    else if (mRenderer-&gt;testDeviceLost(false))   // Lost device
-    {
-        if (!restoreLostDevice())
-        {
-            return error(EGL_CONTEXT_LOST, EGL_NO_CONTEXT);
-        }
-    }
-
-    if (clientVersion &gt; 2 &amp;&amp; mRenderer-&gt;getMajorShaderModel() &lt; 4)
-    {
-        return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
-    }
-
-    gl::Context *context = glCreateContext(clientVersion, shareContext, mRenderer, notifyResets, robustAccess);
-    mContextSet.insert(context);
-
-    return success(context);
-}
-
-bool Display::restoreLostDevice()
-{
-    for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++)
-    {
-        if ((*ctx)-&gt;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)-&gt;release();
-    }
-
-    if (!mRenderer-&gt;resetDevice())
-    {
-        return error(EGL_BAD_ALLOC, false);
-    }
-
-    // Restore any surfaces that may have been lost
-    for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
-    {
-        (*surface)-&gt;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)-&gt;markContextLost();
-    }
-    egl::error(EGL_CONTEXT_LOST);
-}
-
-void Display::recreateSwapChains()
-{
-    for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++)
-    {
-        (*surface)-&gt;getSwapChain()-&gt;recreate();
-    }
-}
-
-bool Display::isInitialized() const
-{
-    return mRenderer != NULL &amp;&amp; mConfigSet.size() &gt; 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)-&gt;getWindowHandle() == window)
-        {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-void Display::initExtensionString()
-{
-    HMODULE swiftShader = GetModuleHandle(TEXT(&quot;swiftshader_d3d9.dll&quot;));
-    bool shareHandleSupported = mRenderer-&gt;getShareHandleSupport();
-
-    mExtensionString = &quot;&quot;;
-
-    // Multi-vendor (EXT) extensions
-    mExtensionString += &quot;EGL_EXT_create_context_robustness &quot;;
-
-    // ANGLE-specific extensions
-    if (shareHandleSupported)
-    {
-        mExtensionString += &quot;EGL_ANGLE_d3d_share_handle_client_buffer &quot;;
-    }
-
-    mExtensionString += &quot;EGL_ANGLE_query_surface_pointer &quot;;
-
-    mExtensionString += &quot;EGL_ANGLE_window_fixed_size &quot;;
-
-    if (swiftShader)
-    {
-        mExtensionString += &quot;EGL_ANGLE_software_display &quot;;
-    }
-
-    if (shareHandleSupported)
-    {
-        mExtensionString += &quot;EGL_ANGLE_surface_d3d_texture_2d_share_handle &quot;;
-    }
-
-    if (mRenderer-&gt;getPostSubBufferSupport())
-    {
-        mExtensionString += &quot;EGL_NV_post_sub_buffer &quot;;
-    }
-
-    // TODO: complete support for the EGL_KHR_create_context extension
-    mExtensionString += &quot;EGL_KHR_create_context &quot;;
-
-    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();
-}
-
-void Display::initVendorString()
-{
-    mVendorString = &quot;Google Inc.&quot;;
-
-    LUID adapterLuid = {0};
-
-    if (mRenderer &amp;&amp; mRenderer-&gt;getLUID(&amp;adapterLuid))
-    {
-        char adapterLuidString[64];
-        sprintf_s(adapterLuidString, sizeof(adapterLuidString), &quot; (adapter LUID: %08x%08x)&quot;, adapterLuid.HighPart, adapterLuid.LowPart);
-
-        mVendorString += adapterLuidString;
-    }
-}
-
-const char *Display::getVendorString() const
-{
-    return mVendorString.c_str();
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLDisplayh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Display.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,92 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 LIBEGL_DISPLAY_H_
-#define LIBEGL_DISPLAY_H_
-
-#include &lt;set&gt;
-#include &lt;vector&gt;
-
-#include &quot;libEGL/Config.h&quot;
-
-namespace gl
-{
-class Context;
-}
-
-namespace egl
-{
-class Surface;
-
-class Display
-{
-  public:
-    ~Display();
-
-    bool initialize();
-    void terminate();
-
-    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, EGLint clientVersion, 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);
-
-    rx::Renderer *getRenderer() { return mRenderer; };
-
-    // exported methods must be virtual
-    virtual void notifyDeviceLost();
-    virtual void recreateSwapChains();
-
-    const char *getExtensionString() const;
-    const char *getVendorString() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Display);
-
-    Display(EGLNativeDisplayType displayId, HDC deviceContext);
-
-    bool restoreLostDevice();
-
-    EGLNativeDisplayType mDisplayId;
-    const HDC mDc;
-
-    bool mSoftwareDevice;
-    
-    typedef std::set&lt;Surface*&gt; SurfaceSet;
-    SurfaceSet mSurfaceSet;
-
-    ConfigSet mConfigSet;
-
-    typedef std::set&lt;gl::Context*&gt; ContextSet;
-    ContextSet mContextSet;
-
-    rx::Renderer *mRenderer;
-
-    void initExtensionString();
-    void initVendorString();
-    std::string mExtensionString;
-    std::string mVendorString;
-};
-}
-
-#endif   // LIBEGL_DISPLAY_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLSurfacecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,428 +0,0 @@
</span><del>-//
-// 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.
-//
-
-// 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 &lt;tchar.h&gt;
-
-#include &lt;algorithm&gt;
-
-#include &quot;libEGL/Surface.h&quot;
-
-#include &quot;common/debug.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/renderer/SwapChain.h&quot;
-#include &quot;libGLESv2/main.h&quot;
-
-#include &quot;libEGL/main.h&quot;
-#include &quot;libEGL/Display.h&quot;
-
-namespace egl
-{
-
-Surface::Surface(Display *display, const Config *config, HWND window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported) 
-    : mDisplay(display), mConfig(config), mWindow(window), mPostSubBufferSupported(postSubBufferSupported)
-{
-    mRenderer = mDisplay-&gt;getRenderer();
-    mSwapChain = 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;
-    mWidth = width;
-    mHeight = height;
-    setSwapInterval(1);
-    mFixedSize = fixedSize;
-
-    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)
-{
-    mRenderer = mDisplay-&gt;getRenderer();
-    mSwapChain = 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);
-    // This constructor is for offscreen surfaces, which are always fixed-size.
-    mFixedSize = EGL_TRUE;
-}
-
-Surface::~Surface()
-{
-    unsubclassWindow();
-    release();
-}
-
-bool Surface::initialize()
-{
-    if (!resetSwapChain())
-      return false;
-
-    return true;
-}
-
-void Surface::release()
-{
-    delete mSwapChain;
-    mSwapChain = NULL;
-
-    if (mTexture)
-    {
-        mTexture-&gt;releaseTexImage();
-        mTexture = NULL;
-    }
-}
-
-bool Surface::resetSwapChain()
-{
-    ASSERT(!mSwapChain);
-
-    int width;
-    int height;
-
-    if (!mFixedSize)
-    {
-        RECT windowRect;
-        if (!GetClientRect(getWindowHandle(), &amp;windowRect))
-        {
-            ASSERT(false);
-
-            ERR(&quot;Could not retrieve the window dimensions&quot;);
-            return error(EGL_BAD_SURFACE, false);
-        }
-
-        width = windowRect.right - windowRect.left;
-        height = windowRect.bottom - windowRect.top;
-    }
-    else
-    {
-        // non-window surface - size is determined at creation
-        width = mWidth;
-        height = mHeight;
-    }
-
-    mSwapChain = mRenderer-&gt;createSwapChain(mWindow, mShareHandle,
-                                            mConfig-&gt;mRenderTargetFormat,
-                                            mConfig-&gt;mDepthStencilFormat);
-    if (!mSwapChain)
-    {
-        return error(EGL_BAD_ALLOC, false);
-    }
-
-    if (!resetSwapChain(width, height))
-    {
-        delete mSwapChain;
-        mSwapChain = NULL;
-        return false;
-    }
-
-    return true;
-}
-
-bool Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight)
-{
-    ASSERT(backbufferWidth &gt;= 0 &amp;&amp; backbufferHeight &gt;= 0);
-    ASSERT(mSwapChain);
-
-    EGLint status = mSwapChain-&gt;resize(std::max(1, backbufferWidth), std::max(1, backbufferHeight));
-
-    if (status == EGL_CONTEXT_LOST)
-    {
-        mDisplay-&gt;notifyDeviceLost();
-        return false;
-    }
-    else if (status != EGL_SUCCESS)
-    {
-        return error(status, false);
-    }
-
-    mWidth = backbufferWidth;
-    mHeight = backbufferHeight;
-
-    return true;
-}
-
-bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
-{
-    ASSERT(backbufferWidth &gt;= 0 &amp;&amp; backbufferHeight &gt;= 0);
-    ASSERT(mSwapChain);
-
-    EGLint status = mSwapChain-&gt;reset(std::max(1, backbufferWidth), std::max(1, backbufferHeight), mSwapInterval);
-
-    if (status == EGL_CONTEXT_LOST)
-    {
-        mRenderer-&gt;notifyDeviceLost();
-        return false;
-    }
-    else if (status != EGL_SUCCESS)
-    {
-        return error(status, false);
-    }
-
-    mWidth = backbufferWidth;
-    mHeight = backbufferHeight;
-    mSwapIntervalDirty = false;
-
-    return true;
-}
-
-bool Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
-{
-    if (!mSwapChain)
-    {
-        return true;
-    }
-
-    if (x + width &gt; mWidth)
-    {
-        width = mWidth - x;
-    }
-
-    if (y + height &gt; mHeight)
-    {
-        height = mHeight - y;
-    }
-
-    if (width == 0 || height == 0)
-    {
-        return true;
-    }
-
-    EGLint status = mSwapChain-&gt;swapRect(x, y, width, height);
-
-    if (status == EGL_CONTEXT_LOST)
-    {
-        mRenderer-&gt;notifyDeviceLost();
-        return false;
-    }
-    else if (status != EGL_SUCCESS)
-    {
-        return error(status, false);
-    }
-
-    checkForOutOfDateSwapChain();
-
-    return true;
-}
-
-HWND Surface::getWindowHandle()
-{
-    return mWindow;
-}
-
-
-#define kSurfaceProperty _TEXT(&quot;Egl::SurfaceOwner&quot;)
-#define kParentWndProc _TEXT(&quot;Egl::SurfaceParentWndProc&quot;)
-
-static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
-{
-  if (message == WM_SIZE)
-  {
-      Surface* surf = reinterpret_cast&lt;Surface*&gt;(GetProp(hwnd, kSurfaceProperty));
-      if(surf)
-      {
-          surf-&gt;checkForOutOfDateSwapChain();
-      }
-  }
-  WNDPROC prevWndFunc = reinterpret_cast&lt;WNDPROC &gt;(GetProp(hwnd, kParentWndProc));
-  return CallWindowProc(prevWndFunc, hwnd, message, wparam, lparam);
-}
-
-void Surface::subclassWindow()
-{
-    if (!mWindow)
-    {
-        return;
-    }
-
-    DWORD processId;
-    DWORD threadId = GetWindowThreadProcessId(mWindow, &amp;processId);
-    if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId())
-    {
-        return;
-    }
-
-    SetLastError(0);
-    LONG_PTR oldWndProc = SetWindowLongPtr(mWindow, GWLP_WNDPROC, reinterpret_cast&lt;LONG_PTR&gt;(SurfaceWindowProc));
-    if(oldWndProc == 0 &amp;&amp; GetLastError() != ERROR_SUCCESS)
-    {
-        mWindowSubclassed = false;
-        return;
-    }
-
-    SetProp(mWindow, kSurfaceProperty, reinterpret_cast&lt;HANDLE&gt;(this));
-    SetProp(mWindow, kParentWndProc, reinterpret_cast&lt;HANDLE&gt;(oldWndProc));
-    mWindowSubclassed = true;
-}
-
-void Surface::unsubclassWindow()
-{
-    if(!mWindowSubclassed)
-    {
-        return;
-    }
-
-    // un-subclass
-    LONG_PTR parentWndFunc = reinterpret_cast&lt;LONG_PTR&gt;(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&lt;LONG_PTR&gt;(SurfaceWindowProc));
-    }
-
-    RemoveProp(mWindow, kSurfaceProperty);
-    RemoveProp(mWindow, kParentWndProc);
-    mWindowSubclassed = false;
-}
-
-bool Surface::checkForOutOfDateSwapChain()
-{
-    RECT client;
-    int clientWidth = getWidth();
-    int clientHeight = getHeight();
-    bool sizeDirty = false;
-    if (!mFixedSize &amp;&amp; !IsIconic(getWindowHandle()))
-    {
-        // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized
-        // because that's not a useful size to render to.
-        if (!GetClientRect(getWindowHandle(), &amp;client))
-        {
-            ASSERT(false);
-            return false;
-        }
-
-        // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information.
-        clientWidth = client.right - client.left;
-        clientHeight = client.bottom - client.top;
-        sizeDirty = clientWidth != getWidth() || clientHeight != getHeight();
-    }
-
-    bool wasDirty = (mSwapIntervalDirty || sizeDirty);
-
-    if (mSwapIntervalDirty)
-    {
-        resetSwapChain(clientWidth, clientHeight);
-    }
-    else if (sizeDirty)
-    {
-        resizeSwapChain(clientWidth, clientHeight);
-    }
-
-    if (wasDirty)
-    {
-        if (static_cast&lt;egl::Surface*&gt;(getCurrentDrawSurface()) == this)
-        {
-            glMakeCurrent(glGetCurrentContext(), static_cast&lt;egl::Display*&gt;(getCurrentDisplay()), this);
-        }
-
-        return true;
-    }
-
-    return false;
-}
-
-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;
-}
-
-rx::SwapChain *Surface::getSwapChain() const
-{
-    return mSwapChain;
-}
-
-void Surface::setSwapInterval(EGLint interval)
-{
-    if (mSwapInterval == interval)
-    {
-        return;
-    }
-    
-    mSwapInterval = interval;
-    mSwapInterval = std::max(mSwapInterval, mRenderer-&gt;getMinSwapInterval());
-    mSwapInterval = std::min(mSwapInterval, mRenderer-&gt;getMaxSwapInterval());
-
-    mSwapIntervalDirty = 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;
-}
-
-EGLint Surface::isFixedSize() const
-{
-    return mFixedSize;
-}
-
-EGLenum Surface::getFormat() const
-{
-    return mConfig-&gt;mRenderTargetFormat;
-}
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLSurfaceh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/Surface.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,111 +0,0 @@
</span><del>-//
-// 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.
-//
-
-// 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 LIBEGL_SURFACE_H_
-#define LIBEGL_SURFACE_H_
-
-#define EGLAPI
-#include &lt;EGL/egl.h&gt;
-
-#include &quot;common/angleutils.h&quot;
-
-namespace gl
-{
-class Texture2D;
-}
-namespace rx
-{
-class Renderer;
-class SwapChain;
-}
-
-namespace egl
-{
-class Display;
-class Config;
-
-class Surface
-{
-  public:
-    Surface(Display *display, const egl::Config *config, HWND window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported);
-    Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget);
-
-    virtual ~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 rx::SwapChain *getSwapChain() const;
-
-    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 EGLenum getFormat() const;
-
-    virtual void setBoundTexture(gl::Texture2D *texture);
-    virtual gl::Texture2D *getBoundTexture() const;
-
-    EGLint isFixedSize() const;
-
-private:
-    DISALLOW_COPY_AND_ASSIGN(Surface);
-
-    Display *const mDisplay;
-    rx::Renderer *mRenderer;
-
-    HANDLE mShareHandle;
-    rx::SwapChain *mSwapChain;
-
-    void subclassWindow();
-    void unsubclassWindow();
-    bool resizeSwapChain(int backbufferWidth, int backbufferHeight);
-    bool resetSwapChain(int backbufferWidth, int backbufferHeight);
-    bool swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
-
-    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;
-    EGLint mFixedSize;
-    
-    bool mSwapIntervalDirty;
-    gl::Texture2D *mTexture;
-};
-}
-
-#endif   // LIBEGL_SURFACE_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLlibEGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,1202 +1,265 @@
</span><span class="cx"> //
</span><del>-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
</del><ins>+// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</ins><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="cx"> // found in the LICENSE file.
</span><span class="cx"> //
</span><span class="cx"> 
</span><span class="cx"> // libEGL.cpp: Implements the exported EGL functions.
</span><span class="cx"> 
</span><del>-#include &lt;exception&gt;
</del><ins>+#include &quot;libGLESv2/entry_points_egl.h&quot;
+#include &quot;libGLESv2/entry_points_egl_ext.h&quot;
</ins><span class="cx"> 
</span><del>-#include &quot;common/debug.h&quot;
-#include &quot;common/version.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/main.h&quot;
-#include &quot;libGLESv2/renderer/SwapChain.h&quot;
-
-#include &quot;libEGL/main.h&quot;
-#include &quot;libEGL/Display.h&quot;
-#include &quot;libEGL/Surface.h&quot;
-
-bool validateDisplay(egl::Display *display)
</del><ins>+extern &quot;C&quot;
</ins><span class="cx"> {
</span><del>-    if (display == EGL_NO_DISPLAY)
-    {
-        return egl::error(EGL_BAD_DISPLAY, false);
-    }
</del><span class="cx"> 
</span><del>-    if (!display-&gt;isInitialized())
-    {
-        return egl::error(EGL_NOT_INITIALIZED, false);
-    }
-
-    return true;
</del><ins>+EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+    return egl::ChooseConfig(dpy, attrib_list, configs, config_size, num_config);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool validateConfig(egl::Display *display, EGLConfig config)
</del><ins>+EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
</ins><span class="cx"> {
</span><del>-    if (!validateDisplay(display))
-    {
-        return false;
-    }
-
-    if (!display-&gt;isValidConfig(config))
-    {
-        return egl::error(EGL_BAD_CONFIG, false);
-    }
-
-    return true;
</del><ins>+    return egl::CopyBuffers(dpy, surface, target);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool validateContext(egl::Display *display, gl::Context *context)
</del><ins>+EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
</ins><span class="cx"> {
</span><del>-    if (!validateDisplay(display))
-    {
-        return false;
-    }
-
-    if (!display-&gt;isValidContext(context))
-    {
-        return egl::error(EGL_BAD_CONTEXT, false);
-    }
-
-    return true;
</del><ins>+    return egl::CreateContext(dpy, config, share_context, attrib_list);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool validateSurface(egl::Display *display, egl::Surface *surface)
</del><ins>+EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
</ins><span class="cx"> {
</span><del>-    if (!validateDisplay(display))
-    {
-        return false;
-    }
-
-    if (!display-&gt;isValidSurface(surface))
-    {
-        return egl::error(EGL_BAD_SURFACE, false);
-    }
-
-    return true;
</del><ins>+    return egl::CreatePbufferSurface(dpy, config, attrib_list);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-extern &quot;C&quot;
</del><ins>+EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
</ins><span class="cx"> {
</span><del>-EGLint __stdcall eglGetError(void)
-{
-    EVENT(&quot;()&quot;);
-
-    EGLint error = egl::getCurrentError();
-
-    if (error != EGL_SUCCESS)
-    {
-        egl::setCurrentError(EGL_SUCCESS);
-    }
-
-    return error;
</del><ins>+    return egl::CreatePixmapSurface(dpy, config, pixmap, attrib_list);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id)
</del><ins>+EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLNativeDisplayType display_id = 0x%0.8p)&quot;, display_id);
-
-    try
-    {
-        return egl::Display::getDisplay(display_id);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
-    }
</del><ins>+    return egl::CreateWindowSurface(dpy, config, win, attrib_list);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
</del><ins>+EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)&quot;,
-          dpy, major, minor);
-
-    try
-    {
-        if (dpy == EGL_NO_DISPLAY)
-        {
-            return egl::error(EGL_BAD_DISPLAY, EGL_FALSE);
-        }
-
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!display-&gt;initialize())
-        {
-            return egl::error(EGL_NOT_INITIALIZED, EGL_FALSE);
-        }
-
-        if (major) *major = 1;
-        if (minor) *minor = 4;
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::DestroyContext(dpy, ctx);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglTerminate(EGLDisplay dpy)
</del><ins>+EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p)&quot;, dpy);
-
-    try
-    {
-        if (dpy == EGL_NO_DISPLAY)
-        {
-            return egl::error(EGL_BAD_DISPLAY, EGL_FALSE);
-        }
-
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        display-&gt;terminate();
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::DestroySurface(dpy, surface);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name)
</del><ins>+EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLint name = %d)&quot;, dpy, name);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return NULL;
-        }
-
-        switch (name)
-        {
-          case EGL_CLIENT_APIS:
-            return egl::success(&quot;OpenGL_ES&quot;);
-          case EGL_EXTENSIONS:
-            return egl::success(display-&gt;getExtensionString());
-          case EGL_VENDOR:
-            return egl::success(display-&gt;getVendorString());
-          case EGL_VERSION:
-            return egl::success(&quot;1.4 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;);
-        }
-
-        return egl::error(EGL_BAD_PARAMETER, (const char*)NULL);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, (const char*)NULL);
-    }
</del><ins>+    return egl::GetConfigAttrib(dpy, config, attribute, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
</del><ins>+EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, &quot;
-          &quot;EGLint config_size = %d, EGLint *num_config = 0x%0.8p)&quot;,
-          dpy, configs, config_size, num_config);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return EGL_FALSE;
-        }
-
-        if (!num_config)
-        {
-            return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        const EGLint attribList[] =    {EGL_NONE};
-
-        if (!display-&gt;getConfigs(configs, attribList, config_size, num_config))
-        {
-            return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::GetConfigs(dpy, configs, config_size, num_config);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
</del><ins>+EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, &quot;
-          &quot;EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)&quot;,
-          dpy, attrib_list, configs, config_size, num_config);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return EGL_FALSE;
-        }
-
-        if (!num_config)
-        {
-            return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        const EGLint attribList[] =    {EGL_NONE};
-
-        if (!attrib_list)
-        {
-            attrib_list = attribList;
-        }
-
-        display-&gt;getConfigs(configs, attrib_list, config_size, num_config);
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::GetCurrentDisplay();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
</del><ins>+EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)&quot;,
-          dpy, config, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_FALSE;
-        }
-
-        if (!display-&gt;getConfigAttrib(config, attribute, value))
-        {
-            return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::GetCurrentSurface(readdraw);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
</del><ins>+EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, &quot;
-          &quot;const EGLint *attrib_list = 0x%0.8p)&quot;, dpy, config, win, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        HWND window = (HWND)win;
-
-        if (!IsWindow(window))
-        {
-            return egl::error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
-        }
-
-        return display-&gt;createWindowSurface(window, config, attrib_list);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
</del><ins>+    return egl::GetDisplay(display_id);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
</del><ins>+EGLint EGLAPIENTRY eglGetError(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)&quot;,
-          dpy, config, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        return display-&gt;createOffscreenSurface(config, NULL, attrib_list);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
</del><ins>+    return egl::GetError();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
</del><ins>+EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativePixmapType pixmap = 0x%0.8p, &quot;
-          &quot;const EGLint *attrib_list = 0x%0.8p)&quot;, dpy, config, pixmap, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return egl::success(EGL_NO_SURFACE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
</del><ins>+    return egl::Initialize(dpy, major, minor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
</del><ins>+EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)&quot;, dpy, surface);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = static_cast&lt;egl::Surface*&gt;(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        display-&gt;destroySurface((egl::Surface*)surface);
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::MakeCurrent(dpy, draw, read, ctx);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
</del><ins>+EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)&quot;,
-          dpy, surface, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = (egl::Surface*)surface;
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return egl::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-&gt;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-&gt;getWidth();
-            break;
-          case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
-            *value = eglSurface-&gt;isPostSubBufferSupported();
-            break;
-          case EGL_FIXED_SIZE_ANGLE:
-            *value = eglSurface-&gt;isFixedSize();
-            break;
-          default:
-            return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::QueryContext(dpy, ctx, attribute, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
</del><ins>+const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
</ins><span class="cx"> {
</span><del>-    TRACE(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, void **value = 0x%0.8p)&quot;,
-          dpy, surface, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = (egl::Surface*)surface;
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        switch (attribute)
-        {
-          case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
-            {
-                rx::SwapChain *swapchain = eglSurface-&gt;getSwapChain();
-                *value = (void*) (swapchain ? swapchain-&gt;getShareHandle() : NULL);
-            }
-            break;
-          default:
-            return egl::error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
-        }
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::QueryString(dpy, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglBindAPI(EGLenum api)
</del><ins>+EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLenum api = 0x%X)&quot;, api);
-
-    try
-    {
-        switch (api)
-        {
-          case EGL_OPENGL_API:
-          case EGL_OPENVG_API:
-            return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);   // Not supported by this implementation
-          case EGL_OPENGL_ES_API:
-            break;
-          default:
-            return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        egl::setCurrentAPI(api);
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::QuerySurface(dpy, surface, attribute, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLenum __stdcall eglQueryAPI(void)
</del><ins>+EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        EGLenum API = egl::getCurrentAPI();
-
-        return egl::success(API);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::SwapBuffers(dpy, surface);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglWaitClient(void)
</del><ins>+EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-
-        return egl::success(0);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::Terminate(dpy);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglReleaseThread(void)
</del><ins>+EGLBoolean EGLAPIENTRY eglWaitGL(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::WaitGL();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLSurface __stdcall eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
</del><ins>+EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%0.8p, &quot;
-          &quot;EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)&quot;,
-          dpy, buftype, buffer, config, attrib_list);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_SURFACE;
-        }
-
-        if (buftype != EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE || !buffer)
-        {
-            return egl::error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
-        }
-
-        return display-&gt;createOffscreenSurface(config, (HANDLE)buffer, attrib_list);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
</del><ins>+    return egl::WaitNative(engine);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
</del><ins>+EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint value = %d)&quot;,
-          dpy, surface, attribute, value);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = static_cast&lt;egl::Surface*&gt;(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::BindTexImage(dpy, surface, buffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
</del><ins>+EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)&quot;, dpy, surface, buffer);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = static_cast&lt;egl::Surface*&gt;(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (buffer != EGL_BACK_BUFFER)
-        {
-            return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE || eglSurface-&gt;getWindowHandle())
-        {
-            return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface-&gt;getBoundTexture())
-        {
-            return egl::error(EGL_BAD_ACCESS, EGL_FALSE);
-        }
-
-        if (eglSurface-&gt;getTextureFormat() == EGL_NO_TEXTURE)
-        {
-            return egl::error(EGL_BAD_MATCH, EGL_FALSE);
-        }
-
-        if (!glBindTexImage(eglSurface))
-        {
-            return egl::error(EGL_BAD_MATCH, EGL_FALSE);
-        }
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::ReleaseTexImage(dpy, surface, buffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
</del><ins>+EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)&quot;, dpy, surface, buffer);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = static_cast&lt;egl::Surface*&gt;(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (buffer != EGL_BACK_BUFFER)
-        {
-            return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE || eglSurface-&gt;getWindowHandle())
-        {
-            return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface-&gt;getTextureFormat() == EGL_NO_TEXTURE)
-        {
-            return egl::error(EGL_BAD_MATCH, EGL_FALSE);
-        }
-
-        gl::Texture2D *texture = eglSurface-&gt;getBoundTexture();
-
-        if (texture)
-        {
-            texture-&gt;releaseTexImage();
-        }
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::SurfaceAttrib(dpy, surface, attribute, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglSwapInterval(EGLDisplay dpy, EGLint interval)
</del><ins>+EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLint interval = %d)&quot;, dpy, interval);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (!validateDisplay(display))
-        {
-            return EGL_FALSE;
-        }
-
-        egl::Surface *draw_surface = static_cast&lt;egl::Surface*&gt;(egl::getCurrentDrawSurface());
-
-        if (draw_surface == NULL)
-        {
-            return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-        
-        draw_surface-&gt;setSwapInterval(interval);
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::SwapInterval(dpy, interval);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
</del><ins>+EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = 0x%0.8p, &quot;
-          &quot;const EGLint *attrib_list = 0x%0.8p)&quot;, dpy, config, share_context, attrib_list);
-
-    try
-    {
-        // Get the requested client version (default is 1) and check it is 2 or 3.
-        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 egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);   // Unimplemented
-                        // robust_access = true;
-                    }
-                    else if (attribute[1] != EGL_FALSE)
-                        return egl::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 egl::error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
-                    break;
-                  default:
-                    return egl::error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
-                }
-            }
-        }
-
-        if (client_version != 2 &amp;&amp; client_version != 3)
-        {
-            return egl::error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
-        }
-
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-
-        if (share_context)
-        {
-            gl::Context* sharedGLContext = static_cast&lt;gl::Context*&gt;(share_context);
-
-            if (sharedGLContext-&gt;isResetNotificationEnabled() != reset_notification)
-            {
-                return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
-            }
-
-            if (sharedGLContext-&gt;getClientVersion() != client_version)
-            {
-                return egl::error(EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
-            }
-
-            // Can not share contexts between displays
-            if (sharedGLContext-&gt;getRenderer() != display-&gt;getRenderer())
-            {
-                return egl::error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
-            }
-        }
-
-        if (!validateConfig(display, config))
-        {
-            return EGL_NO_CONTEXT;
-        }
-
-        return display-&gt;createContext(config, client_version, static_cast&lt;gl::Context*&gt;(share_context), reset_notification, robust_access);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
-    }
</del><ins>+    return egl::BindAPI(api);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
</del><ins>+EGLenum EGLAPIENTRY eglQueryAPI(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)&quot;, dpy, ctx);
-
-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        gl::Context *context = static_cast&lt;gl::Context*&gt;(ctx);
-
-        if (!validateContext(display, context))
-        {
-            return EGL_FALSE;
-        }
-
-        if (ctx == EGL_NO_CONTEXT)
-        {
-            return egl::error(EGL_BAD_CONTEXT, EGL_FALSE);
-        }
-
-        display-&gt;destroyContext(context);
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+    return egl::QueryAPI();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
</del><ins>+EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface draw = 0x%0.8p, EGLSurface read = 0x%0.8p, EGLContext ctx = 0x%0.8p)&quot;,
-          dpy, draw, read, ctx);
</del><ins>+    return egl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        gl::Context *context = static_cast&lt;gl::Context*&gt;(ctx);
-
-        if (ctx != EGL_NO_CONTEXT &amp;&amp; !validateContext(display, context))
-        {
-            return EGL_FALSE;
-        }
-
-        if (dpy != EGL_NO_DISPLAY)
-        {
-            rx::Renderer *renderer = display-&gt;getRenderer();
-            if (renderer-&gt;testDeviceLost(true))
-            {
-                return EGL_FALSE;
-            }
-
-            if (renderer-&gt;isDeviceLost())
-            {
-                return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
-            }
-        }
-
-        if ((draw != EGL_NO_SURFACE &amp;&amp; !validateSurface(display, static_cast&lt;egl::Surface*&gt;(draw))) ||
-            (read != EGL_NO_SURFACE &amp;&amp; !validateSurface(display, static_cast&lt;egl::Surface*&gt;(read))))
-        {
-            return EGL_FALSE;
-        }
-
-        if (draw != read)
-        {
-            UNIMPLEMENTED();   // FIXME
-        }
-
-        egl::setCurrentDisplay(dpy);
-        egl::setCurrentDrawSurface(draw);
-        egl::setCurrentReadSurface(read);
-
-        glMakeCurrent(context, display, static_cast&lt;egl::Surface*&gt;(draw));
-
-        return egl::success(EGL_TRUE);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+EGLBoolean EGLAPIENTRY eglReleaseThread(void)
+{
+    return egl::ReleaseThread();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLContext __stdcall eglGetCurrentContext(void)
</del><ins>+EGLBoolean EGLAPIENTRY eglWaitClient(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
</del><ins>+    return egl::WaitClient();
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        EGLContext context = glGetCurrentContext();
-
-        return egl::success(context);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
-    }
</del><ins>+EGLContext EGLAPIENTRY eglGetCurrentContext(void)
+{
+    return egl::GetCurrentContext();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw)
</del><ins>+EGLSync EGLAPIENTRY eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLint readdraw = %d)&quot;, readdraw);
</del><ins>+    return egl::CreateSync(dpy, type, attrib_list);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        if (readdraw == EGL_READ)
-        {
-            EGLSurface read = egl::getCurrentReadSurface();
-            return egl::success(read);
-        }
-        else if (readdraw == EGL_DRAW)
-        {
-            EGLSurface draw = egl::getCurrentDrawSurface();
-            return egl::success(draw);
-        }
-        else
-        {
-            return egl::error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
-    }
</del><ins>+EGLBoolean EGLAPIENTRY eglDestroySync(EGLDisplay dpy, EGLSync sync)
+{
+    return egl::DestroySync(dpy, sync);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLDisplay __stdcall eglGetCurrentDisplay(void)
</del><ins>+EGLint EGLAPIENTRY eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
</del><ins>+    return egl::ClientWaitSync(dpy, sync, flags, timeout);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        EGLDisplay dpy = egl::getCurrentDisplay();
-
-        return egl::success(dpy);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_NO_DISPLAY);
-    }
</del><ins>+EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value)
+{
+    return egl::GetSyncAttrib(dpy, sync, attribute, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
</del><ins>+EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)&quot;,
-          dpy, ctx, attribute, value);
</del><ins>+    return egl::CreateImage(dpy, ctx, target, buffer, attrib_list);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        gl::Context *context = static_cast&lt;gl::Context*&gt;(ctx);
-
-        if (!validateContext(display, context))
-        {
-            return EGL_FALSE;
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return egl::success(0);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+EGLBoolean EGLAPIENTRY eglDestroyImage(EGLDisplay dpy, EGLImage image)
+{
+    return egl::DestroyImage(dpy, image);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglWaitGL(void)
</del><ins>+EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
</del><ins>+    return egl::GetPlatformDisplay(platform, native_display, attrib_list);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-
-        return egl::success(0);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
+{
+    return egl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglWaitNative(EGLint engine)
</del><ins>+EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLint engine = %d)&quot;, engine);
</del><ins>+    return egl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-
-        return egl::success(0);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
+{
+    return egl::WaitSync(dpy, sync, flags);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
</del><ins>+EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)&quot;, dpy, surface);
</del><ins>+    return egl::QuerySurfacePointerANGLE(dpy, surface, attribute, value);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = (egl::Surface*)surface;
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (display-&gt;getRenderer()-&gt;isDeviceLost())
-        {
-            return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface-&gt;swap())
-        {
-            return egl::success(EGL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-
-    return EGL_FALSE;
</del><ins>+EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    return egl::PostSubBufferNV(dpy, surface, x, y, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
</del><ins>+EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)&quot;, dpy, surface, target);
</del><ins>+    return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = static_cast&lt;egl::Surface*&gt;(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (display-&gt;getRenderer()-&gt;isDeviceLost())
-        {
-            return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
-        }
-
-        UNIMPLEMENTED();   // FIXME
-
-        return egl::success(0);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
</del><ins>+EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
+{
+    return egl::QueryDisplayAttribEXT(dpy, attribute, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
</del><ins>+EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint x = %d, EGLint y = %d, EGLint width = %d, EGLint height = %d)&quot;, dpy, surface, x, y, width, height);
</del><ins>+    return egl::QueryDeviceAttribEXT(device, attribute, value);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        if (x &lt; 0 || y &lt; 0 || width &lt; 0 || height &lt; 0)
-        {
-            return egl::error(EGL_BAD_PARAMETER, EGL_FALSE);
-        }
-
-        egl::Display *display = static_cast&lt;egl::Display*&gt;(dpy);
-        egl::Surface *eglSurface = static_cast&lt;egl::Surface*&gt;(surface);
-
-        if (!validateSurface(display, eglSurface))
-        {
-            return EGL_FALSE;
-        }
-
-        if (display-&gt;getRenderer()-&gt;isDeviceLost())
-        {
-            return egl::error(EGL_CONTEXT_LOST, EGL_FALSE);
-        }
-
-        if (surface == EGL_NO_SURFACE)
-        {
-            return egl::error(EGL_BAD_SURFACE, EGL_FALSE);
-        }
-
-        if (eglSurface-&gt;postSubBuffer(x, y, width, height))
-        {
-            return egl::success(EGL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, EGL_FALSE);
-    }
-
-    return EGL_FALSE;
</del><ins>+const char * EGLAPIENTRY eglQueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
+{
+    return egl::QueryDeviceStringEXT(device, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-__eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char *procname)
</del><ins>+__eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(const char *procname = \&quot;%s\&quot;)&quot;, procname);
</del><ins>+    return egl::GetProcAddress(procname);
+}
</ins><span class="cx"> 
</span><del>-    try
-    {
-        struct Extension
-        {
-            const char *name;
-            __eglMustCastToProperFunctionPointerType address;
-        };
-
-        static const Extension eglExtensions[] =
-        {
-            {&quot;eglQuerySurfacePointerANGLE&quot;, (__eglMustCastToProperFunctionPointerType)eglQuerySurfacePointerANGLE},
-            {&quot;eglPostSubBufferNV&quot;, (__eglMustCastToProperFunctionPointerType)eglPostSubBufferNV},
-            {&quot;&quot;, NULL},
-        };
-
-        for (unsigned int ext = 0; ext &lt; ArraySize(eglExtensions); ext++)
-        {
-            if (strcmp(procname, eglExtensions[ext].name) == 0)
-            {
-                return (__eglMustCastToProperFunctionPointerType)eglExtensions[ext].address;
-            }
-        }
-
-        return glGetProcAddress(procname);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return egl::error(EGL_BAD_ALLOC, (__eglMustCastToProperFunctionPointerType)NULL);
-    }
</del><span class="cx"> }
</span><del>-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLlibEGLdef"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.def        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,36 +1,56 @@
</span><del>-LIBRARY        libEGL
</del><ins>+LIBRARY libEGL
</ins><span class="cx"> EXPORTS
</span><del>-        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
</del><span class="cx">\ No newline at end of file
</span><ins>+    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
+
+    ; Extensions
+    eglGetPlatformDisplayEXT         @35
+    eglQuerySurfacePointerANGLE      @36
+    eglPostSubBufferNV               @37
+    eglQueryDisplayAttribEXT         @48
+    eglQueryDeviceAttribEXT          @49
+    eglQueryDeviceStringEXT          @50
+
+    ; 1.5 entry points
+    eglCreateSync                    @38
+    eglDestroySync                   @39
+    eglClientWaitSync                @40
+    eglGetSyncAttrib                 @41
+    eglCreateImage                   @42
+    eglDestroyImage                  @43
+    eglGetPlatformDisplay            @44
+    eglCreatePlatformWindowSurface   @45
+    eglCreatePlatformPixmapSurface   @46
+    eglWaitSync                      @47
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLlibEGLrc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/libEGL.rc        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">             VALUE &quot;FileDescription&quot;, &quot;ANGLE libEGL Dynamic Link Library&quot;
</span><span class="cx">             VALUE &quot;FileVersion&quot;, ANGLE_VERSION_STRING
</span><span class="cx">             VALUE &quot;InternalName&quot;, &quot;libEGL&quot;
</span><del>-            VALUE &quot;LegalCopyright&quot;, &quot;Copyright (C) 2011 Google Inc.&quot;
</del><ins>+            VALUE &quot;LegalCopyright&quot;, &quot;Copyright (C) 2015 Google Inc.&quot;
</ins><span class="cx">             VALUE &quot;OriginalFilename&quot;, &quot;libEGL.dll&quot;
</span><span class="cx">             VALUE &quot;PrivateBuild&quot;, ANGLE_VERSION_STRING
</span><span class="cx">             VALUE &quot;ProductName&quot;, &quot;ANGLE libEGL Dynamic Link Library&quot;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLmaincpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/main.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/main.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/main.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,191 +0,0 @@
</span><del>-//
-// 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.
-//
-
-// main.cpp: DLL entry point and management of thread-local data.
-
-#include &quot;libEGL/main.h&quot;
-
-#include &quot;common/debug.h&quot;
-
-static DWORD currentTLS = TLS_OUT_OF_INDEXES;
-
-namespace egl
-{
-
-Current *AllocateCurrent()
-{
-    Current *current = (egl::Current*)LocalAlloc(LPTR, sizeof(egl::Current));
-
-    if (!current)
-    {
-        ERR(&quot;Could not allocate thread local storage.&quot;);
-        return NULL;
-    }
-
-    ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
-    TlsSetValue(currentTLS, current);
-
-    current-&gt;error = EGL_SUCCESS;
-    current-&gt;API = EGL_OPENGL_ES_API;
-    current-&gt;display = EGL_NO_DISPLAY;
-    current-&gt;drawSurface = EGL_NO_SURFACE;
-    current-&gt;readSurface = EGL_NO_SURFACE;
-
-    return current;
-}
-
-void DeallocateCurrent()
-{
-    void *current = TlsGetValue(currentTLS);
-
-    if (current)
-    {
-        LocalFree((HLOCAL)current);
-    }
-}
-
-}
-
-extern &quot;C&quot; BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-{
-    switch (reason)
-    {
-      case DLL_PROCESS_ATTACH:
-        {
-#if defined(ANGLE_ENABLE_TRACE)
-            FILE *debug = fopen(TRACE_OUTPUT_FILE, &quot;rt&quot;);
-
-            if (debug)
-            {
-                fclose(debug);
-                debug = fopen(TRACE_OUTPUT_FILE, &quot;wt&quot;);   // Erase
-                
-                if (debug)
-                {
-                    fclose(debug);
-                }
-            }
-#endif
-
-            currentTLS = TlsAlloc();
-
-            if (currentTLS == TLS_OUT_OF_INDEXES)
-            {
-                return FALSE;
-            }
-        }
-        // Fall throught to initialize index
-      case DLL_THREAD_ATTACH:
-        {
-            egl::AllocateCurrent();
-        }
-        break;
-      case DLL_THREAD_DETACH:
-        {
-            egl::DeallocateCurrent();
-        }
-        break;
-      case DLL_PROCESS_DETACH:
-        {
-            egl::DeallocateCurrent();
-            TlsFree(currentTLS);
-        }
-        break;
-      default:
-        break;
-    }
-
-    return TRUE;
-}
-
-namespace egl
-{
-
-Current *GetCurrentData()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    // ANGLE issue 488: when the dll is loaded after thread initialization,
-    // thread local storage (current) might not exist yet.
-    return (current ? current : AllocateCurrent());
-}
-
-void setCurrentError(EGLint error)
-{
-    Current *current = GetCurrentData();
-
-    current-&gt;error = error;
-}
-
-EGLint getCurrentError()
-{
-    Current *current = GetCurrentData();
-
-    return current-&gt;error;
-}
-
-void setCurrentAPI(EGLenum API)
-{
-    Current *current = GetCurrentData();
-
-    current-&gt;API = API;
-}
-
-EGLenum getCurrentAPI()
-{
-    Current *current = GetCurrentData();
-
-    return current-&gt;API;
-}
-
-void setCurrentDisplay(EGLDisplay dpy)
-{
-    Current *current = GetCurrentData();
-
-    current-&gt;display = dpy;
-}
-
-EGLDisplay getCurrentDisplay()
-{
-    Current *current = GetCurrentData();
-
-    return current-&gt;display;
-}
-
-void setCurrentDrawSurface(EGLSurface surface)
-{
-    Current *current = GetCurrentData();
-
-    current-&gt;drawSurface = surface;
-}
-
-EGLSurface getCurrentDrawSurface()
-{
-    Current *current = GetCurrentData();
-
-    return current-&gt;drawSurface;
-}
-
-void setCurrentReadSurface(EGLSurface surface)
-{
-    Current *current = GetCurrentData();
-
-    current-&gt;readSurface = surface;
-}
-
-EGLSurface getCurrentReadSurface()
-{
-    Current *current = GetCurrentData();
-
-    return current-&gt;readSurface;
-}
-
-void error(EGLint errorCode)
-{
-    egl::setCurrentError(errorCode);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLmainh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libEGL/main.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL/main.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL/main.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,62 +0,0 @@
</span><del>-//
-// 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 &lt;EGL/egl.h&gt;
-#include &lt;EGL/eglext.h&gt;
-
-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&lt;class T&gt;
-const T &amp;error(EGLint errorCode, const T &amp;returnValue)
-{
-    error(errorCode);
-
-    return returnValue;
-}
-
-template&lt;class T&gt;
-const T &amp;success(const T &amp;returnValue)
-{
-    egl::setCurrentError(EGL_SUCCESS);
-
-    return returnValue;
-}
-
-}
-
-#endif  // LIBEGL_MAIN_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibEGLgypi"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libEGL.gypi (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libEGL.gypi                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libEGL.gypi        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+# Copyright (c) 2013 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.
+
+{
+    # Everything below this is duplicated in the GN build. If you change
+    # anything also change angle/BUILD.gn
+    'targets':
+    [
+        {
+            'target_name': 'libEGL',
+            'type': 'shared_library',
+            'dependencies': [ 'libGLESv2', ],
+            'includes': [ '../build/common_defines.gypi', ],
+            'include_dirs':
+            [
+                '.',
+                '../include',
+            ],
+            'sources':
+            [
+                '&lt;@(libegl_sources)',
+            ],
+            'defines':
+            [
+                'GL_APICALL=',
+                'GL_GLEXT_PROTOTYPES=',
+                'EGLAPI=',
+                'LIBEGL_IMPLEMENTATION',
+            ],
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                    'msvs_requires_importlibrary' : 'true',
+                    'msvs_settings':
+                    {
+                        'VCLinkerTool':
+                        {
+                            'EnableCOMDATFolding': '1',
+                            'OptimizeReferences': '1',
+                        }
+                    },
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+            ],
+        },
+    ],
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2BinaryStreamh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/BinaryStream.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/BinaryStream.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/BinaryStream.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,164 +0,0 @@
</span><del>-//
-// 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.
-//
-
-// BinaryStream.h: Provides binary serialization of simple types.
-
-#ifndef LIBGLESV2_BINARYSTREAM_H_
-#define LIBGLESV2_BINARYSTREAM_H_
-
-#include &quot;common/angleutils.h&quot;
-
-namespace gl
-{
-
-class BinaryInputStream
-{
-  public:
-    BinaryInputStream(const void *data, size_t length)
-    {
-        mError = false;
-        mOffset = 0;
-        mData = static_cast&lt;const char*&gt;(data);
-        mLength = length;
-    }
-
-    template &lt;typename T&gt;
-    void read(T *v, size_t num)
-    {
-        union
-        {
-            T dummy;  // Compilation error for non-trivial types
-        } dummy;
-        (void) dummy;
-
-        if (mError)
-        {
-            return;
-        }
-
-        size_t length = num * sizeof(T);
-
-        if (mOffset + length &gt; mLength)
-        {
-            mError = true;
-            return;
-        }
-
-        memcpy(v, mData + mOffset, length);
-        mOffset += length;
-    }
-
-    template &lt;typename T&gt;
-    void read(T * v)
-    {
-        read(v, 1);
-    }
-
-    void read(std::string *v)
-    {
-        size_t length;
-        read(&amp;length);
-
-        if (mError)
-        {
-            return;
-        }
-
-        if (mOffset + length &gt; mLength)
-        {
-            mError = true;
-            return;
-        }
-
-        v-&gt;assign(mData + mOffset, length);
-        mOffset += length;
-    }
-
-    void skip(size_t length)
-    {
-        if (mOffset + length &gt; mLength)
-        {
-            mError = true;
-            return;
-        }
-
-        mOffset += length;
-    }
-
-    size_t offset() const
-    {
-        return mOffset;
-    }
-
-    bool error() const
-    {
-        return mError;
-    }
-
-    bool endOfStream() const
-    {
-        return mOffset == mLength;
-    }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(BinaryInputStream);
-    bool mError;
-    size_t mOffset;
-    const char *mData;
-    size_t mLength;
-};
-
-class BinaryOutputStream
-{
-  public:
-    BinaryOutputStream()
-    {
-    }
-
-    template &lt;typename T&gt;
-    void write(const T *v, size_t num)
-    {
-        union
-        {
-            T dummy;  // Compilation error for non-trivial types
-        } dummy;
-        (void) dummy;
-
-        const char *asBytes = reinterpret_cast&lt;const char*&gt;(v);
-        mData.insert(mData.end(), asBytes, asBytes + num * sizeof(T));
-    }
-
-    template &lt;typename T&gt;
-    void write(const T &amp;v)
-    {
-        write(&amp;v, 1);
-    }
-
-    void write(const std::string &amp;v)
-    {
-        size_t length = v.length();
-        write(length);
-
-        write(v.c_str(), length);
-    }
-
-    size_t length() const
-    {
-        return mData.size();
-    }
-
-    const void* data() const
-    {
-        return mData.size() ? &amp;mData[0] : NULL;
-    }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(BinaryOutputStream);
-    std::vector&lt;char&gt; mData;
-};
-}
-
-#endif  // LIBGLESV2_BINARYSTREAM_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Buffercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,194 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2014 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 &quot;libGLESv2/Buffer.h&quot;
-
-#include &quot;libGLESv2/renderer/VertexBuffer.h&quot;
-#include &quot;libGLESv2/renderer/IndexBuffer.h&quot;
-#include &quot;libGLESv2/renderer/BufferStorage.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-
-namespace gl
-{
-
-Buffer::Buffer(rx::Renderer *renderer, GLuint id)
-    : RefCountObject(id),
-      mRenderer(renderer),
-      mUsage(GL_DYNAMIC_DRAW),
-      mAccessFlags(0),
-      mMapped(GL_FALSE),
-      mMapPointer(NULL),
-      mMapOffset(0),
-      mMapLength(0),
-      mBufferStorage(NULL),
-      mStaticVertexBuffer(NULL),
-      mStaticIndexBuffer(NULL),
-      mUnmodifiedDataUse(0)
-{
-    mBufferStorage = renderer-&gt;createBufferStorage();
-}
-
-Buffer::~Buffer()
-{
-    delete mBufferStorage;
-    delete mStaticVertexBuffer;
-    delete mStaticIndexBuffer;
-}
-
-void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
-{
-    mBufferStorage-&gt;clear();
-    mIndexRangeCache.clear();
-    mBufferStorage-&gt;setData(data, size, 0);
-
-    mUsage = usage;
-
-    invalidateStaticData();
-
-    if (usage == GL_STATIC_DRAW)
-    {
-        mStaticVertexBuffer = new rx::StaticVertexBufferInterface(mRenderer);
-        mStaticIndexBuffer = new rx::StaticIndexBufferInterface(mRenderer);
-    }
-}
-
-void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
-{
-    mBufferStorage-&gt;setData(data, size, offset);
-    mIndexRangeCache.invalidateRange(offset, size);
-    invalidateStaticData();
-}
-
-void Buffer::copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size)
-{
-    mBufferStorage-&gt;copyData(source-&gt;mBufferStorage, size, sourceOffset, destOffset);
-    invalidateStaticData();
-}
-
-GLvoid *Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
-    ASSERT(!mMapped);
-
-    void *dataPointer = mBufferStorage-&gt;map(access);
-
-    mMapped = GL_TRUE;
-    mMapPointer = static_cast&lt;GLvoid*&gt;(static_cast&lt;GLubyte*&gt;(dataPointer) + offset);
-    mMapOffset = static_cast&lt;GLint64&gt;(offset);
-    mMapLength = static_cast&lt;GLint64&gt;(length);
-    mAccessFlags = static_cast&lt;GLint&gt;(access);
-
-    return mMapPointer;
-}
-
-void Buffer::unmap()
-{
-    ASSERT(mMapped);
-
-    mBufferStorage-&gt;unmap();
-
-    mMapped = GL_FALSE;
-    mMapPointer = NULL;
-    mMapOffset = 0;
-    mMapLength = 0;
-    mAccessFlags = 0;
-}
-
-rx::BufferStorage *Buffer::getStorage() const
-{
-    return mBufferStorage;
-}
-
-GLint64 Buffer::size() const
-{
-    return static_cast&lt;GLint64&gt;(mBufferStorage-&gt;getSize());
-}
-
-GLenum Buffer::usage() const
-{
-    return mUsage;
-}
-
-GLint Buffer::accessFlags() const
-{
-    return mAccessFlags;
-}
-
-GLboolean Buffer::mapped() const
-{
-    return mMapped;
-}
-
-GLvoid *Buffer::mapPointer() const
-{
-    return mMapPointer;
-}
-
-GLint64 Buffer::mapOffset() const
-{
-    return mMapOffset;
-}
-
-GLint64 Buffer::mapLength() const
-{
-    return mMapLength;
-}
-
-void Buffer::markTransformFeedbackUsage()
-{
-    mBufferStorage-&gt;markTransformFeedbackUsage();
-    invalidateStaticData();
-}
-
-rx::StaticVertexBufferInterface *Buffer::getStaticVertexBuffer()
-{
-    return mStaticVertexBuffer;
-}
-
-rx::StaticIndexBufferInterface *Buffer::getStaticIndexBuffer()
-{
-    return mStaticIndexBuffer;
-}
-
-void Buffer::invalidateStaticData()
-{
-    if ((mStaticVertexBuffer &amp;&amp; mStaticVertexBuffer-&gt;getBufferSize() != 0) || (mStaticIndexBuffer &amp;&amp; mStaticIndexBuffer-&gt;getBufferSize() != 0))
-    {
-        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 &amp;&amp; !mStaticIndexBuffer)
-    {
-        mUnmodifiedDataUse += dataSize;
-
-        if (mUnmodifiedDataUse &gt; 3 * mBufferStorage-&gt;getSize())
-        {
-            mStaticVertexBuffer = new rx::StaticVertexBufferInterface(mRenderer);
-            mStaticIndexBuffer = new rx::StaticIndexBufferInterface(mRenderer);
-        }
-    }
-}
-
-rx::IndexRangeCache *Buffer::getIndexRangeCache()
-{
-    return &amp;mIndexRangeCache;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Bufferh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Buffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,83 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2014 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 &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-#include &quot;libGLESv2/renderer/IndexRangeCache.h&quot;
-
-namespace rx
-{
-class Renderer;
-class BufferStorage;
-class StaticIndexBufferInterface;
-class StaticVertexBufferInterface;
-};
-
-namespace gl
-{
-
-class Buffer : public RefCountObject
-{
-  public:
-    Buffer(rx::Renderer *renderer, GLuint id);
-
-    virtual ~Buffer();
-
-    void bufferData(const void *data, GLsizeiptr size, GLenum usage);
-    void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
-    void copyBufferSubData(Buffer* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
-    GLvoid *mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
-    void unmap();
-
-    GLenum usage() const;
-    GLint accessFlags() const;
-    GLboolean mapped() const;
-    GLvoid *mapPointer() const;
-    GLint64 mapOffset() const;
-    GLint64 mapLength() const;
-
-    rx::BufferStorage *getStorage() const;
-    GLint64 size() const;
-
-    void markTransformFeedbackUsage();
-
-    rx::StaticVertexBufferInterface *getStaticVertexBuffer();
-    rx::StaticIndexBufferInterface *getStaticIndexBuffer();
-    void invalidateStaticData();
-    void promoteStaticUsage(int dataSize);
-
-    rx::IndexRangeCache *getIndexRangeCache();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Buffer);
-
-    rx::Renderer *mRenderer;
-    GLenum mUsage;
-    GLint mAccessFlags;
-    GLboolean mMapped;
-    GLvoid *mMapPointer;
-    GLint64 mMapOffset;
-    GLint64 mMapLength;
-
-    rx::BufferStorage *mBufferStorage;
-
-    rx::IndexRangeCache mIndexRangeCache;
-
-    rx::StaticVertexBufferInterface *mStaticVertexBuffer;
-    rx::StaticIndexBufferInterface *mStaticIndexBuffer;
-    unsigned int mUnmodifiedDataUse;
-};
-
-}
-
-#endif   // LIBGLESV2_BUFFER_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Contextcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,4117 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2014 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 &quot;libGLESv2/Context.h&quot;
-
-#include &quot;libGLESv2/main.h&quot;
-#include &quot;common/utilities.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/Buffer.h&quot;
-#include &quot;libGLESv2/Fence.h&quot;
-#include &quot;libGLESv2/Framebuffer.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/Program.h&quot;
-#include &quot;libGLESv2/ProgramBinary.h&quot;
-#include &quot;libGLESv2/Query.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/ResourceManager.h&quot;
-#include &quot;libGLESv2/renderer/IndexDataManager.h&quot;
-#include &quot;libGLESv2/renderer/RenderTarget.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/VertexArray.h&quot;
-#include &quot;libGLESv2/Sampler.h&quot;
-#include &quot;libGLESv2/validationES.h&quot;
-#include &quot;libGLESv2/TransformFeedback.h&quot;
-
-#include &quot;libEGL/Surface.h&quot;
-
-#undef near
-#undef far
-
-namespace gl
-{
-static const char* makeStaticString(const std::string&amp; str)
-{
-    static std::set&lt;std::string&gt; strings;
-    std::set&lt;std::string&gt;::iterator it = strings.find(str);
-    if (it != strings.end())
-      return it-&gt;c_str();
-
-    return strings.insert(str).first-&gt;c_str();
-}
-
-Context::Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess) : mRenderer(renderer)
-{
-    ASSERT(robustAccess == false);   // Unimplemented
-
-    mFenceNVHandleAllocator.setBaseHandle(0);
-
-    setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-
-    mClientVersion = clientVersion;
-
-    mState.depthClearValue = 1.0f;
-    mState.stencilClearValue = 0;
-
-    mState.rasterizer.rasterizerDiscard = false;
-    mState.rasterizer.cullFace = false;
-    mState.rasterizer.cullMode = GL_BACK;
-    mState.rasterizer.frontFace = GL_CCW;
-    mState.rasterizer.polygonOffsetFill = false;
-    mState.rasterizer.polygonOffsetFactor = 0.0f;
-    mState.rasterizer.polygonOffsetUnits = 0.0f;
-    mState.rasterizer.pointDrawMode = false;
-    mState.rasterizer.multiSample = false;
-    mState.scissorTest = false;
-    mState.scissor.x = 0;
-    mState.scissor.y = 0;
-    mState.scissor.width = 0;
-    mState.scissor.height = 0;
-
-    mState.blend.blend = false;
-    mState.blend.sourceBlendRGB = GL_ONE;
-    mState.blend.sourceBlendAlpha = GL_ONE;
-    mState.blend.destBlendRGB = GL_ZERO;
-    mState.blend.destBlendAlpha = GL_ZERO;
-    mState.blend.blendEquationRGB = GL_FUNC_ADD;
-    mState.blend.blendEquationAlpha = GL_FUNC_ADD;
-    mState.blend.sampleAlphaToCoverage = false;
-    mState.blend.dither = true;
-
-    mState.blendColor.red = 0;
-    mState.blendColor.green = 0;
-    mState.blendColor.blue = 0;
-    mState.blendColor.alpha = 0;
-
-    mState.depthStencil.depthTest = false;
-    mState.depthStencil.depthFunc = GL_LESS;
-    mState.depthStencil.depthMask = true;
-    mState.depthStencil.stencilTest = false;
-    mState.depthStencil.stencilFunc = GL_ALWAYS;
-    mState.depthStencil.stencilMask = -1;
-    mState.depthStencil.stencilWritemask = -1;
-    mState.depthStencil.stencilBackFunc = GL_ALWAYS;
-    mState.depthStencil.stencilBackMask = - 1;
-    mState.depthStencil.stencilBackWritemask = -1;
-    mState.depthStencil.stencilFail = GL_KEEP;
-    mState.depthStencil.stencilPassDepthFail = GL_KEEP;
-    mState.depthStencil.stencilPassDepthPass = GL_KEEP;
-    mState.depthStencil.stencilBackFail = GL_KEEP;
-    mState.depthStencil.stencilBackPassDepthFail = GL_KEEP;
-    mState.depthStencil.stencilBackPassDepthPass = GL_KEEP;
-
-    mState.stencilRef = 0;
-    mState.stencilBackRef = 0;
-
-    mState.sampleCoverage = false;
-    mState.sampleCoverageValue = 1.0f;
-    mState.sampleCoverageInvert = false;
-    mState.generateMipmapHint = GL_DONT_CARE;
-    mState.fragmentShaderDerivativeHint = GL_DONT_CARE;
-
-    mState.lineWidth = 1.0f;
-
-    mState.viewport.x = 0;
-    mState.viewport.y = 0;
-    mState.viewport.width = 0;
-    mState.viewport.height = 0;
-    mState.zNear = 0.0f;
-    mState.zFar = 1.0f;
-
-    mState.blend.colorMaskRed = true;
-    mState.blend.colorMaskGreen = true;
-    mState.blend.colorMaskBlue = true;
-    mState.blend.colorMaskAlpha = true;
-
-    const GLfloat defaultFloatValues[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-    for (int attribIndex = 0; attribIndex &lt; MAX_VERTEX_ATTRIBS; attribIndex++)
-    {
-        mState.vertexAttribCurrentValues[attribIndex].setFloatValues(defaultFloatValues);
-    }
-
-    if (shareContext != NULL)
-    {
-        mResourceManager = shareContext-&gt;mResourceManager;
-        mResourceManager-&gt;addRef();
-    }
-    else
-    {
-        mResourceManager = new ResourceManager(mRenderer);
-    }
-
-    // [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(mRenderer, 0));
-    mTextureCubeMapZero.set(new TextureCubeMap(mRenderer, 0));
-    mTexture3DZero.set(new Texture3D(mRenderer, 0));
-    mTexture2DArrayZero.set(new Texture2DArray(mRenderer, 0));
-
-    for (unsigned int textureUnit = 0; textureUnit &lt; ArraySize(mState.samplers); textureUnit++)
-    {
-        mState.samplers[textureUnit] = 0;
-    }
-
-    mState.activeSampler = 0;
-    bindVertexArray(0);
-    bindArrayBuffer(0);
-    bindElementArrayBuffer(0);
-    bindTextureCubeMap(0);
-    bindTexture2D(0);
-    bindReadFramebuffer(0);
-    bindDrawFramebuffer(0);
-    bindRenderbuffer(0);
-
-    mState.activeQueries[GL_ANY_SAMPLES_PASSED].set(NULL);
-    mState.activeQueries[GL_ANY_SAMPLES_PASSED_CONSERVATIVE].set(NULL);
-    mState.activeQueries[GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN].set(NULL);
-
-    bindGenericUniformBuffer(0);
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; i++)
-    {
-        bindIndexedUniformBuffer(0, i, 0, -1);
-    }
-
-    bindGenericTransformFeedbackBuffer(0);
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
-    {
-        bindIndexedTransformFeedbackBuffer(0, i, 0, -1);
-    }
-
-    bindCopyReadBuffer(0);
-    bindCopyWriteBuffer(0);
-    bindPixelPackBuffer(0);
-    bindPixelUnpackBuffer(0);
-
-    // [OpenGL ES 3.0.2] section 2.14.1 pg 85:
-    // In the initial state, a default transform feedback object is bound and treated as
-    // a transform feedback object with a name of zero. That object is bound any time
-    // BindTransformFeedback is called with id of zero
-    mTransformFeedbackZero.set(new TransformFeedback(0));
-    bindTransformFeedback(0);
-
-    mState.currentProgram = 0;
-    mCurrentProgramBinary.set(NULL);
-
-    mCombinedExtensionsString = NULL;
-    mRendererString = 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;
-
-    mSupportsBGRATextures = false;
-    mSupportsDXT1Textures = false;
-    mSupportsDXT3Textures = false;
-    mSupportsDXT5Textures = false;
-    mSupportsEventQueries = false;
-    mSupportsOcclusionQueries = false;
-    mNumCompressedTextureFormats = 0;
-}
-
-Context::~Context()
-{
-    if (mState.currentProgram != 0)
-    {
-        Program *programObject = mResourceManager-&gt;getProgram(mState.currentProgram);
-        if (programObject)
-        {
-            programObject-&gt;release();
-        }
-        mState.currentProgram = 0;
-    }
-    mCurrentProgramBinary.set(NULL);
-
-    while (!mFramebufferMap.empty())
-    {
-        deleteFramebuffer(mFramebufferMap.begin()-&gt;first);
-    }
-
-    while (!mFenceNVMap.empty())
-    {
-        deleteFenceNV(mFenceNVMap.begin()-&gt;first);
-    }
-
-    while (!mQueryMap.empty())
-    {
-        deleteQuery(mQueryMap.begin()-&gt;first);
-    }
-
-    while (!mVertexArrayMap.empty())
-    {
-        deleteVertexArray(mVertexArrayMap.begin()-&gt;first);
-    }
-
-    mTransformFeedbackZero.set(NULL);
-    while (!mTransformFeedbackMap.empty())
-    {
-        deleteTransformFeedback(mTransformFeedbackMap.begin()-&gt;first);
-    }
-
-    for (int type = 0; type &lt; TEXTURE_TYPE_COUNT; type++)
-    {
-        for (int sampler = 0; sampler &lt; IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS; sampler++)
-        {
-            mState.samplerTexture[type][sampler].set(NULL);
-        }
-    }
-
-    for (int type = 0; type &lt; TEXTURE_TYPE_COUNT; type++)
-    {
-        mIncompleteTextures[type].set(NULL);
-    }
-
-    const GLfloat defaultFloatValues[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-    for (int attribIndex = 0; attribIndex &lt; MAX_VERTEX_ATTRIBS; attribIndex++)
-    {
-        mState.vertexAttribCurrentValues[attribIndex].setFloatValues(defaultFloatValues);
-    }
-
-    mState.arrayBuffer.set(NULL);
-    mState.renderbuffer.set(NULL);
-
-    mState.transformFeedback.set(NULL);
-
-    mTexture2DZero.set(NULL);
-    mTextureCubeMapZero.set(NULL);
-    mTexture3DZero.set(NULL);
-    mTexture2DArrayZero.set(NULL);
-
-    for (State::ActiveQueryMap::iterator i = mState.activeQueries.begin(); i != mState.activeQueries.end(); i++)
-    {
-        i-&gt;second.set(NULL);
-    }
-
-    mState.genericUniformBuffer.set(NULL);
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; i++)
-    {
-        mState.uniformBuffers[i].set(NULL);
-    }
-
-    mState.genericTransformFeedbackBuffer.set(NULL);
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
-    {
-        mState.transformFeedbackBuffers[i].set(NULL);
-    }
-
-    mState.copyReadBuffer.set(NULL);
-    mState.copyWriteBuffer.set(NULL);
-
-    mState.pack.pixelBuffer.set(NULL);
-    mState.unpack.pixelBuffer.set(NULL);
-
-    mResourceManager-&gt;release();
-}
-
-void Context::makeCurrent(egl::Surface *surface)
-{
-    if (!mHasBeenCurrent)
-    {
-        mMajorShaderModel = mRenderer-&gt;getMajorShaderModel();
-        mMaximumPointSize = mRenderer-&gt;getMaxPointSize();
-        mSupportsVertexTexture = mRenderer-&gt;getVertexTextureSupport();
-        mSupportsNonPower2Texture = mRenderer-&gt;getNonPower2TextureSupport();
-        mSupportsInstancing = mRenderer-&gt;getInstancingSupport();
-
-        mMaxViewportDimension = mRenderer-&gt;getMaxViewportDimension();
-        mMax2DTextureDimension = std::min(std::min(mRenderer-&gt;getMaxTextureWidth(), mRenderer-&gt;getMaxTextureHeight()),
-                                          (int)gl::IMPLEMENTATION_MAX_2D_TEXTURE_SIZE);
-        mMaxCubeTextureDimension = std::min(mMax2DTextureDimension, (int)gl::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE);
-        mMax3DTextureDimension = std::min(std::min(mMax2DTextureDimension, mRenderer-&gt;getMaxTextureDepth()),
-                                          (int)gl::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE);
-        mMax2DArrayTextureLayers = mRenderer-&gt;getMaxTextureArrayLayers();
-        mMaxRenderbufferDimension = mMax2DTextureDimension;
-        mMax2DTextureLevel = log2(mMax2DTextureDimension) + 1;
-        mMaxCubeTextureLevel = log2(mMaxCubeTextureDimension) + 1;
-        mMax3DTextureLevel = log2(mMax3DTextureDimension) + 1;
-        mMax2DArrayTextureLevel = log2(mMax2DTextureDimension) + 1;
-        mMaxTextureAnisotropy = mRenderer-&gt;getTextureMaxAnisotropy();
-        TRACE(&quot;Max2DTextureDimension=%d, MaxCubeTextureDimension=%d, Max3DTextureDimension=%d, Max2DArrayTextureLayers = %d, &quot;
-              &quot;Max2DTextureLevel=%d, MaxCubeTextureLevel=%d, Max3DTextureLevel=%d, Max2DArrayTextureLevel=%d, &quot;
-              &quot;MaxRenderbufferDimension=%d, MaxTextureAnisotropy=%f&quot;,
-              mMax2DTextureDimension, mMaxCubeTextureDimension, mMax3DTextureDimension, mMax2DArrayTextureLayers,
-              mMax2DTextureLevel, mMaxCubeTextureLevel, mMax3DTextureLevel, mMax2DArrayTextureLevel,
-              mMaxRenderbufferDimension, mMaxTextureAnisotropy);
-
-        mSupportsEventQueries = mRenderer-&gt;getEventQuerySupport();
-        mSupportsOcclusionQueries = mRenderer-&gt;getOcclusionQuerySupport();
-        mSupportsBGRATextures = mRenderer-&gt;getBGRATextureSupport();
-        mSupportsDXT1Textures = mRenderer-&gt;getDXT1TextureSupport();
-        mSupportsDXT3Textures = mRenderer-&gt;getDXT3TextureSupport();
-        mSupportsDXT5Textures = mRenderer-&gt;getDXT5TextureSupport();
-        mSupportsFloat32Textures = mRenderer-&gt;getFloat32TextureSupport();
-        mSupportsFloat32LinearFilter = mRenderer-&gt;getFloat32TextureFilteringSupport();
-        mSupportsFloat32RenderableTextures = mRenderer-&gt;getFloat32TextureRenderingSupport();
-        mSupportsFloat16Textures = mRenderer-&gt;getFloat16TextureSupport();
-        mSupportsFloat16LinearFilter = mRenderer-&gt;getFloat16TextureFilteringSupport();
-        mSupportsFloat16RenderableTextures = mRenderer-&gt;getFloat16TextureRenderingSupport();
-        mSupportsLuminanceTextures = mRenderer-&gt;getLuminanceTextureSupport();
-        mSupportsLuminanceAlphaTextures = mRenderer-&gt;getLuminanceAlphaTextureSupport();
-        mSupportsRGTextures = mRenderer-&gt;getRGTextureSupport();
-        mSupportsDepthTextures = mRenderer-&gt;getDepthTextureSupport();
-        mSupportsTextureFilterAnisotropy = mRenderer-&gt;getTextureFilterAnisotropySupport();
-        mSupports32bitIndices = mRenderer-&gt;get32BitIndexSupport();
-        mSupportsPBOs = mRenderer-&gt;getPBOSupport();
-
-        mNumCompressedTextureFormats = 0;
-        if (supportsDXT1Textures())
-        {
-            mNumCompressedTextureFormats += 2;
-        }
-        if (supportsDXT3Textures())
-        {
-            mNumCompressedTextureFormats += 1;
-        }
-        if (supportsDXT5Textures())
-        {
-            mNumCompressedTextureFormats += 1;
-        }
-
-        initExtensionString();
-        initRendererString();
-
-        mState.viewport.x = 0;
-        mState.viewport.y = 0;
-        mState.viewport.width = surface-&gt;getWidth();
-        mState.viewport.height = surface-&gt;getHeight();
-
-        mState.scissor.x = 0;
-        mState.scissor.y = 0;
-        mState.scissor.width = surface-&gt;getWidth();
-        mState.scissor.height = surface-&gt;getHeight();
-
-        mHasBeenCurrent = true;
-    }
-
-    // Wrap the existing swapchain resources into GL objects and assign them to the '0' names
-    rx::SwapChain *swapchain = surface-&gt;getSwapChain();
-
-    Colorbuffer *colorbufferZero = new Colorbuffer(mRenderer, swapchain);
-    DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(mRenderer, swapchain);
-    Framebuffer *framebufferZero = new DefaultFramebuffer(mRenderer, colorbufferZero, depthStencilbufferZero);
-
-    setFramebufferZero(framebufferZero);
-
-    // Store the current client version in the renderer
-    mRenderer-&gt;setCurrentClientVersion(mClientVersion);
-}
-
-// NOTE: this function should not assume that this context is current!
-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::setCap(GLenum cap, bool enabled)
-{
-    switch (cap)
-    {
-      case GL_CULL_FACE:                     setCullFace(enabled);              break;
-      case GL_POLYGON_OFFSET_FILL:           setPolygonOffsetFill(enabled);     break;
-      case GL_SAMPLE_ALPHA_TO_COVERAGE:      setSampleAlphaToCoverage(enabled); break;
-      case GL_SAMPLE_COVERAGE:               setSampleCoverage(enabled);        break;
-      case GL_SCISSOR_TEST:                  setScissorTest(enabled);           break;
-      case GL_STENCIL_TEST:                  setStencilTest(enabled);           break;
-      case GL_DEPTH_TEST:                    setDepthTest(enabled);             break;
-      case GL_BLEND:                         setBlend(enabled);                 break;
-      case GL_DITHER:                        setDither(enabled);                break;
-      case GL_PRIMITIVE_RESTART_FIXED_INDEX: UNIMPLEMENTED();                   break;
-      case GL_RASTERIZER_DISCARD:            setRasterizerDiscard(enabled);     break;
-      default:                               UNREACHABLE();
-    }
-}
-
-bool Context::getCap(GLenum cap)
-{
-    switch (cap)
-    {
-      case GL_CULL_FACE:                     return isCullFaceEnabled();
-      case GL_POLYGON_OFFSET_FILL:           return isPolygonOffsetFillEnabled();
-      case GL_SAMPLE_ALPHA_TO_COVERAGE:      return isSampleAlphaToCoverageEnabled();
-      case GL_SAMPLE_COVERAGE:               return isSampleCoverageEnabled();
-      case GL_SCISSOR_TEST:                  return isScissorTestEnabled();
-      case GL_STENCIL_TEST:                  return isStencilTestEnabled();
-      case GL_DEPTH_TEST:                    return isDepthTestEnabled();
-      case GL_BLEND:                         return isBlendEnabled();
-      case GL_DITHER:                        return isDitherEnabled();
-      case GL_PRIMITIVE_RESTART_FIXED_INDEX: UNIMPLEMENTED(); return false;
-      case GL_RASTERIZER_DISCARD:            return isRasterizerDiscardEnabled();
-      default:                               UNREACHABLE(); return false;
-    }
-}
-
-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::setRasterizerDiscard(bool enabled)
-{
-    mState.rasterizer.rasterizerDiscard = enabled;
-}
-
-bool Context::isRasterizerDiscardEnabled() const
-{
-    return mState.rasterizer.rasterizerDiscard;
-}
-
-void Context::setCullFace(bool enabled)
-{
-    mState.rasterizer.cullFace = enabled;
-}
-
-bool Context::isCullFaceEnabled() const
-{
-    return mState.rasterizer.cullFace;
-}
-
-void Context::setCullMode(GLenum mode)
-{
-    mState.rasterizer.cullMode = mode;
-}
-
-void Context::setFrontFace(GLenum front)
-{
-    mState.rasterizer.frontFace = front;
-}
-
-void Context::setDepthTest(bool enabled)
-{
-    mState.depthStencil.depthTest = enabled;
-}
-
-bool Context::isDepthTestEnabled() const
-{
-    return mState.depthStencil.depthTest;
-}
-
-void Context::setDepthFunc(GLenum depthFunc)
-{
-     mState.depthStencil.depthFunc = depthFunc;
-}
-
-void Context::setDepthRange(float zNear, float zFar)
-{
-    mState.zNear = zNear;
-    mState.zFar = zFar;
-}
-
-void Context::setBlend(bool enabled)
-{
-    mState.blend.blend = enabled;
-}
-
-bool Context::isBlendEnabled() const
-{
-    return mState.blend.blend;
-}
-
-void Context::setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha)
-{
-    mState.blend.sourceBlendRGB = sourceRGB;
-    mState.blend.destBlendRGB = destRGB;
-    mState.blend.sourceBlendAlpha = sourceAlpha;
-    mState.blend.destBlendAlpha = destAlpha;
-}
-
-void Context::setBlendColor(float red, float green, float blue, float alpha)
-{
-    mState.blendColor.red = red;
-    mState.blendColor.green = green;
-    mState.blendColor.blue = blue;
-    mState.blendColor.alpha = alpha;
-}
-
-void Context::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation)
-{
-    mState.blend.blendEquationRGB = rgbEquation;
-    mState.blend.blendEquationAlpha = alphaEquation;
-}
-
-void Context::setStencilTest(bool enabled)
-{
-    mState.depthStencil.stencilTest = enabled;
-}
-
-bool Context::isStencilTestEnabled() const
-{
-    return mState.depthStencil.stencilTest;
-}
-
-void Context::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask)
-{
-    mState.depthStencil.stencilFunc = stencilFunc;
-    mState.stencilRef = (stencilRef &gt; 0) ? stencilRef : 0;
-    mState.depthStencil.stencilMask = stencilMask;
-}
-
-void Context::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask)
-{
-    mState.depthStencil.stencilBackFunc = stencilBackFunc;
-    mState.stencilBackRef = (stencilBackRef &gt; 0) ? stencilBackRef : 0;
-    mState.depthStencil.stencilBackMask = stencilBackMask;
-}
-
-void Context::setStencilWritemask(GLuint stencilWritemask)
-{
-    mState.depthStencil.stencilWritemask = stencilWritemask;
-}
-
-void Context::setStencilBackWritemask(GLuint stencilBackWritemask)
-{
-    mState.depthStencil.stencilBackWritemask = stencilBackWritemask;
-}
-
-void Context::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass)
-{
-    mState.depthStencil.stencilFail = stencilFail;
-    mState.depthStencil.stencilPassDepthFail = stencilPassDepthFail;
-    mState.depthStencil.stencilPassDepthPass = stencilPassDepthPass;
-}
-
-void Context::setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass)
-{
-    mState.depthStencil.stencilBackFail = stencilBackFail;
-    mState.depthStencil.stencilBackPassDepthFail = stencilBackPassDepthFail;
-    mState.depthStencil.stencilBackPassDepthPass = stencilBackPassDepthPass;
-}
-
-void Context::setPolygonOffsetFill(bool enabled)
-{
-     mState.rasterizer.polygonOffsetFill = enabled;
-}
-
-bool Context::isPolygonOffsetFillEnabled() const
-{
-    return mState.rasterizer.polygonOffsetFill;
-}
-
-void Context::setPolygonOffsetParams(GLfloat factor, GLfloat units)
-{
-    // An application can pass NaN values here, so handle this gracefully
-    mState.rasterizer.polygonOffsetFactor = factor != factor ? 0.0f : factor;
-    mState.rasterizer.polygonOffsetUnits = units != units ? 0.0f : units;
-}
-
-void Context::setSampleAlphaToCoverage(bool enabled)
-{
-    mState.blend.sampleAlphaToCoverage = enabled;
-}
-
-bool Context::isSampleAlphaToCoverageEnabled() const
-{
-    return mState.blend.sampleAlphaToCoverage;
-}
-
-void Context::setSampleCoverage(bool enabled)
-{
-    mState.sampleCoverage = enabled;
-}
-
-bool Context::isSampleCoverageEnabled() const
-{
-    return mState.sampleCoverage;
-}
-
-void Context::setSampleCoverageParams(GLclampf value, bool invert)
-{
-    mState.sampleCoverageValue = value;
-    mState.sampleCoverageInvert = invert;
-}
-
-void Context::setScissorTest(bool enabled)
-{
-    mState.scissorTest = enabled;
-}
-
-bool Context::isScissorTestEnabled() const
-{
-    return mState.scissorTest;
-}
-
-void Context::setDither(bool enabled)
-{
-    mState.blend.dither = enabled;
-}
-
-bool Context::isDitherEnabled() const
-{
-    return mState.blend.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.viewport.x = x;
-    mState.viewport.y = y;
-    mState.viewport.width = width;
-    mState.viewport.height = height;
-}
-
-void Context::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    mState.scissor.x = x;
-    mState.scissor.y = y;
-    mState.scissor.width = width;
-    mState.scissor.height = height;
-}
-
-void Context::getScissorParams(GLint *x, GLint *y, GLsizei *width, GLsizei *height)
-{
-    *x = mState.scissor.x;
-    *y = mState.scissor.y;
-    *width = mState.scissor.width;
-    *height = mState.scissor.height;
-}
-
-void Context::setColorMask(bool red, bool green, bool blue, bool alpha)
-{
-    mState.blend.colorMaskRed = red;
-    mState.blend.colorMaskGreen = green;
-    mState.blend.colorMaskBlue = blue;
-    mState.blend.colorMaskAlpha = alpha;
-}
-
-void Context::setDepthMask(bool mask)
-{
-    mState.depthStencil.depthMask = mask;
-}
-
-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::getVertexArrayHandle() const
-{
-    return mState.vertexArray;
-}
-
-GLuint Context::getSamplerHandle(GLuint textureUnit) const
-{
-    ASSERT(textureUnit &lt; ArraySize(mState.samplers));
-    return mState.samplers[textureUnit];
-}
-
-GLuint Context::getArrayBufferHandle() const
-{
-    return mState.arrayBuffer.id();
-}
-
-GLuint Context::getActiveQuery(GLenum target) const
-{
-    // All query types should already exist in the activeQueries map
-    ASSERT(mState.activeQueries.find(target) != mState.activeQueries.end());
-
-    const Query *queryObject = mState.activeQueries.at(target).get();
-    return queryObject ? queryObject-&gt;id() : 0;
-}
-
-void Context::setEnableVertexAttribArray(unsigned int attribNum, bool enabled)
-{
-    getCurrentVertexArray()-&gt;enableAttribute(attribNum, enabled);
-}
-
-const VertexAttribute &amp;Context::getVertexAttribState(unsigned int attribNum) const
-{
-    return getCurrentVertexArray()-&gt;getVertexAttribute(attribNum);
-}
-
-const VertexAttribCurrentValueData &amp;Context::getVertexAttribCurrentValue(unsigned int attribNum) const
-{
-    ASSERT(attribNum &lt; MAX_VERTEX_ATTRIBS);
-    return mState.vertexAttribCurrentValues[attribNum];
-}
-
-void Context::setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
-                                   bool pureInteger, GLsizei stride, const void *pointer)
-{
-    getCurrentVertexArray()-&gt;setAttributeState(attribNum, boundBuffer, size, type, normalized, pureInteger, stride, pointer);
-}
-
-const void *Context::getVertexAttribPointer(unsigned int attribNum) const
-{
-    return getCurrentVertexArray()-&gt;getVertexAttribute(attribNum).mPointer;
-}
-
-void Context::setPackAlignment(GLint alignment)
-{
-    mState.pack.alignment = alignment;
-}
-
-GLint Context::getPackAlignment() const
-{
-    return mState.pack.alignment;
-}
-
-void Context::setUnpackAlignment(GLint alignment)
-{
-    mState.unpack.alignment = alignment;
-}
-
-GLint Context::getUnpackAlignment() const
-{
-    return mState.unpack.alignment;
-}
-
-void Context::setPackReverseRowOrder(bool reverseRowOrder)
-{
-    mState.pack.reverseRowOrder = reverseRowOrder;
-}
-
-bool Context::getPackReverseRowOrder() const
-{
-    return mState.pack.reverseRowOrder;
-}
-
-const PixelUnpackState &amp;Context::getUnpackState() const
-{
-    return mState.unpack;
-}
-
-const PixelPackState &amp;Context::getPackState() const
-{
-    return mState.pack;
-}
-
-GLuint Context::createBuffer()
-{
-    return mResourceManager-&gt;createBuffer();
-}
-
-GLuint Context::createProgram()
-{
-    return mResourceManager-&gt;createProgram();
-}
-
-GLuint Context::createShader(GLenum type)
-{
-    return mResourceManager-&gt;createShader(type);
-}
-
-GLuint Context::createTexture()
-{
-    return mResourceManager-&gt;createTexture();
-}
-
-GLuint Context::createRenderbuffer()
-{
-    return mResourceManager-&gt;createRenderbuffer();
-}
-
-GLsync Context::createFenceSync(GLenum condition)
-{
-    GLuint handle = mResourceManager-&gt;createFenceSync();
-
-    gl::FenceSync *fenceSync = mResourceManager-&gt;getFenceSync(handle);
-    ASSERT(fenceSync);
-
-    fenceSync-&gt;set(condition);
-
-    return reinterpret_cast&lt;GLsync&gt;(handle);
-}
-
-GLuint Context::createVertexArray()
-{
-    GLuint handle = mVertexArrayHandleAllocator.allocate();
-
-    // Although the spec states VAO state is not initialized until the object is bound,
-    // we create it immediately. The resulting behaviour is transparent to the application,
-    // since it's not currently possible to access the state until the object is bound.
-    mVertexArrayMap[handle] = new VertexArray(mRenderer, handle);
-
-    return handle;
-}
-
-GLuint Context::createSampler()
-{
-    return mResourceManager-&gt;createSampler();
-}
-
-GLuint Context::createTransformFeedback()
-{
-    GLuint handle = mTransformFeedbackAllocator.allocate();
-    TransformFeedback *transformFeedback = new TransformFeedback(handle);
-    transformFeedback-&gt;addRef();
-    mTransformFeedbackMap[handle] = transformFeedback;
-    return handle;
-}
-
-// Returns an unused framebuffer name
-GLuint Context::createFramebuffer()
-{
-    GLuint handle = mFramebufferHandleAllocator.allocate();
-
-    mFramebufferMap[handle] = NULL;
-
-    return handle;
-}
-
-GLuint Context::createFenceNV()
-{
-    GLuint handle = mFenceNVHandleAllocator.allocate();
-
-    mFenceNVMap[handle] = new FenceNV(mRenderer);
-
-    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-&gt;getBuffer(buffer))
-    {
-        detachBuffer(buffer);
-    }
-    
-    mResourceManager-&gt;deleteBuffer(buffer);
-}
-
-void Context::deleteShader(GLuint shader)
-{
-    mResourceManager-&gt;deleteShader(shader);
-}
-
-void Context::deleteProgram(GLuint program)
-{
-    mResourceManager-&gt;deleteProgram(program);
-}
-
-void Context::deleteTexture(GLuint texture)
-{
-    if (mResourceManager-&gt;getTexture(texture))
-    {
-        detachTexture(texture);
-    }
-
-    mResourceManager-&gt;deleteTexture(texture);
-}
-
-void Context::deleteRenderbuffer(GLuint renderbuffer)
-{
-    if (mResourceManager-&gt;getRenderbuffer(renderbuffer))
-    {
-        detachRenderbuffer(renderbuffer);
-    }
-    
-    mResourceManager-&gt;deleteRenderbuffer(renderbuffer);
-}
-
-void Context::deleteFenceSync(GLsync fenceSync)
-{
-    // The spec specifies the underlying Fence object is not deleted until all current
-    // wait commands finish. However, since the name becomes invalid, we cannot query the fence,
-    // and since our API is currently designed for being called from a single thread, we can delete
-    // the fence immediately.
-    mResourceManager-&gt;deleteFenceSync(reinterpret_cast&lt;GLuint&gt;(fenceSync));
-}
-
-void Context::deleteVertexArray(GLuint vertexArray)
-{
-    auto vertexArrayObject = mVertexArrayMap.find(vertexArray);
-
-    if (vertexArrayObject != mVertexArrayMap.end())
-    {
-        detachVertexArray(vertexArray);
-
-        mVertexArrayHandleAllocator.release(vertexArrayObject-&gt;first);
-        delete vertexArrayObject-&gt;second;
-        mVertexArrayMap.erase(vertexArrayObject);
-    }
-}
-
-void Context::deleteSampler(GLuint sampler)
-{
-    if (mResourceManager-&gt;getSampler(sampler))
-    {
-        detachSampler(sampler);
-    }
-
-    mResourceManager-&gt;deleteSampler(sampler);
-}
-
-void Context::deleteTransformFeedback(GLuint transformFeedback)
-{
-    TransformFeedbackMap::const_iterator iter = mTransformFeedbackMap.find(transformFeedback);
-    if (iter != mTransformFeedbackMap.end())
-    {
-        detachTransformFeedback(transformFeedback);
-        mTransformFeedbackAllocator.release(transformFeedback);
-        iter-&gt;second-&gt;release();
-        mTransformFeedbackMap.erase(iter);
-    }
-}
-
-void Context::deleteFramebuffer(GLuint framebuffer)
-{
-    FramebufferMap::iterator framebufferObject = mFramebufferMap.find(framebuffer);
-
-    if (framebufferObject != mFramebufferMap.end())
-    {
-        detachFramebuffer(framebuffer);
-
-        mFramebufferHandleAllocator.release(framebufferObject-&gt;first);
-        delete framebufferObject-&gt;second;
-        mFramebufferMap.erase(framebufferObject);
-    }
-}
-
-void Context::deleteFenceNV(GLuint fence)
-{
-    FenceNVMap::iterator fenceObject = mFenceNVMap.find(fence);
-
-    if (fenceObject != mFenceNVMap.end())
-    {
-        mFenceNVHandleAllocator.release(fenceObject-&gt;first);
-        delete fenceObject-&gt;second;
-        mFenceNVMap.erase(fenceObject);
-    }
-}
-
-void Context::deleteQuery(GLuint query)
-{
-    QueryMap::iterator queryObject = mQueryMap.find(query);
-    if (queryObject != mQueryMap.end())
-    {
-        mQueryHandleAllocator.release(queryObject-&gt;first);
-        if (queryObject-&gt;second)
-        {
-            queryObject-&gt;second-&gt;release();
-        }
-        mQueryMap.erase(queryObject);
-    }
-}
-
-Buffer *Context::getBuffer(GLuint handle)
-{
-    return mResourceManager-&gt;getBuffer(handle);
-}
-
-Shader *Context::getShader(GLuint handle) const
-{
-    return mResourceManager-&gt;getShader(handle);
-}
-
-Program *Context::getProgram(GLuint handle) const
-{
-    return mResourceManager-&gt;getProgram(handle);
-}
-
-Texture *Context::getTexture(GLuint handle)
-{
-    return mResourceManager-&gt;getTexture(handle);
-}
-
-Renderbuffer *Context::getRenderbuffer(GLuint handle)
-{
-    return mResourceManager-&gt;getRenderbuffer(handle);
-}
-
-FenceSync *Context::getFenceSync(GLsync handle) const
-{
-    return mResourceManager-&gt;getFenceSync(reinterpret_cast&lt;GLuint&gt;(handle));
-}
-
-VertexArray *Context::getVertexArray(GLuint handle) const
-{
-    auto vertexArray = mVertexArrayMap.find(handle);
-
-    if (vertexArray == mVertexArrayMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return vertexArray-&gt;second;
-    }
-}
-
-Sampler *Context::getSampler(GLuint handle) const
-{
-    return mResourceManager-&gt;getSampler(handle);
-}
-
-TransformFeedback *Context::getTransformFeedback(GLuint handle) const
-{
-    if (handle == 0)
-    {
-        return mTransformFeedbackZero.get();
-    }
-    else
-    {
-        TransformFeedbackMap::const_iterator iter = mTransformFeedbackMap.find(handle);
-        return (iter != mTransformFeedbackMap.end()) ? iter-&gt;second : NULL;
-    }
-}
-
-Framebuffer *Context::getReadFramebuffer()
-{
-    return getFramebuffer(mState.readFramebuffer);
-}
-
-Framebuffer *Context::getDrawFramebuffer()
-{
-    return mBoundDrawFramebuffer;
-}
-
-VertexArray *Context::getCurrentVertexArray() const
-{
-    VertexArray *vao = getVertexArray(mState.vertexArray);
-    ASSERT(vao != NULL);
-    return vao;
-}
-
-TransformFeedback *Context::getCurrentTransformFeedback() const
-{
-    return mState.transformFeedback.get();
-}
-
-bool Context::isSampler(GLuint samplerName) const
-{
-    return mResourceManager-&gt;isSampler(samplerName);
-}
-
-void Context::bindArrayBuffer(unsigned int buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.arrayBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindElementArrayBuffer(unsigned int buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    getCurrentVertexArray()-&gt;setElementArrayBuffer(getBuffer(buffer));
-}
-
-void Context::bindTexture2D(GLuint texture)
-{
-    mResourceManager-&gt;checkTextureAllocation(texture, TEXTURE_2D);
-
-    mState.samplerTexture[TEXTURE_2D][mState.activeSampler].set(getTexture(texture));
-}
-
-void Context::bindTextureCubeMap(GLuint texture)
-{
-    mResourceManager-&gt;checkTextureAllocation(texture, TEXTURE_CUBE);
-
-    mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].set(getTexture(texture));
-}
-
-void Context::bindTexture3D(GLuint texture)
-{
-    mResourceManager-&gt;checkTextureAllocation(texture, TEXTURE_3D);
-
-    mState.samplerTexture[TEXTURE_3D][mState.activeSampler].set(getTexture(texture));
-}
-
-void Context::bindTexture2DArray(GLuint texture)
-{
-    mResourceManager-&gt;checkTextureAllocation(texture, TEXTURE_2D_ARRAY);
-
-    mState.samplerTexture[TEXTURE_2D_ARRAY][mState.activeSampler].set(getTexture(texture));
-}
-
-void Context::bindReadFramebuffer(GLuint framebuffer)
-{
-    if (!getFramebuffer(framebuffer))
-    {
-        mFramebufferMap[framebuffer] = new Framebuffer(mRenderer);
-    }
-
-    mState.readFramebuffer = framebuffer;
-}
-
-void Context::bindDrawFramebuffer(GLuint framebuffer)
-{
-    if (!getFramebuffer(framebuffer))
-    {
-        mFramebufferMap[framebuffer] = new Framebuffer(mRenderer);
-    }
-
-    mState.drawFramebuffer = framebuffer;
-
-    mBoundDrawFramebuffer = getFramebuffer(framebuffer);
-}
-
-void Context::bindRenderbuffer(GLuint renderbuffer)
-{
-    mResourceManager-&gt;checkRenderbufferAllocation(renderbuffer);
-
-    mState.renderbuffer.set(getRenderbuffer(renderbuffer));
-}
-
-void Context::bindVertexArray(GLuint vertexArray)
-{
-    if (!getVertexArray(vertexArray))
-    {
-        mVertexArrayMap[vertexArray] = new VertexArray(mRenderer, vertexArray);
-    }
-
-    mState.vertexArray = vertexArray;
-}
-
-void Context::bindSampler(GLuint textureUnit, GLuint sampler)
-{
-    ASSERT(textureUnit &lt; ArraySize(mState.samplers));
-    mResourceManager-&gt;checkSamplerAllocation(sampler);
-
-    mState.samplers[textureUnit] = sampler;
-}
-
-void Context::bindGenericUniformBuffer(GLuint buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.genericUniformBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.uniformBuffers[index].set(getBuffer(buffer), offset, size);
-}
-
-void Context::bindGenericTransformFeedbackBuffer(GLuint buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.genericTransformFeedbackBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.transformFeedbackBuffers[index].set(getBuffer(buffer), offset, size);
-}
-
-void Context::bindCopyReadBuffer(GLuint buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.copyReadBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindCopyWriteBuffer(GLuint buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.copyWriteBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindPixelPackBuffer(GLuint buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.pack.pixelBuffer.set(getBuffer(buffer));
-}
-
-void Context::bindPixelUnpackBuffer(GLuint buffer)
-{
-    mResourceManager-&gt;checkBufferAllocation(buffer);
-
-    mState.unpack.pixelBuffer.set(getBuffer(buffer));
-}
-
-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-&gt;getProgram(program);
-        Program *oldProgram = mResourceManager-&gt;getProgram(priorProgram);
-        mCurrentProgramBinary.set(NULL);
-
-        if (newProgram)
-        {
-            newProgram-&gt;addRef();
-            mCurrentProgramBinary.set(newProgram-&gt;getProgramBinary());
-        }
-        
-        if (oldProgram)
-        {
-            oldProgram-&gt;release();
-        }
-    }
-}
-
-void Context::linkProgram(GLuint program)
-{
-    Program *programObject = mResourceManager-&gt;getProgram(program);
-
-    bool linked = programObject-&gt;link();
-
-    // if the current program was relinked successfully we
-    // need to install the new executables
-    if (linked &amp;&amp; program == mState.currentProgram)
-    {
-        mCurrentProgramBinary.set(programObject-&gt;getProgramBinary());
-    }
-}
-
-void Context::setProgramBinary(GLuint program, const void *binary, GLint length)
-{
-    Program *programObject = mResourceManager-&gt;getProgram(program);
-
-    bool loaded = programObject-&gt;setProgramBinary(binary, length);
-
-    // if the current program was reloaded successfully we
-    // need to install the new executables
-    if (loaded &amp;&amp; program == mState.currentProgram)
-    {
-        mCurrentProgramBinary.set(programObject-&gt;getProgramBinary());
-    }
-
-}
-
-void Context::bindTransformFeedback(GLuint transformFeedback)
-{
-    TransformFeedback *transformFeedbackObject = getTransformFeedback(transformFeedback);
-    mState.transformFeedback.set(transformFeedbackObject);
-}
-
-void Context::beginQuery(GLenum target, GLuint query)
-{
-    // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an &lt;id&gt;  
-    // of zero, if the active query object name for &lt;target&gt; 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 &lt;id&gt; is the name of an 
-    // existing query object whose type does not match &lt;target&gt;, or if &lt;id&gt; 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 (State::ActiveQueryMap::iterator i = mState.activeQueries.begin(); i != mState.activeQueries.end(); i++)
-    {
-        if (i-&gt;second.get() != NULL)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-    }
-
-    Query *queryObject = getQuery(query, true, target);
-
-    // check that name was obtained with glGenQueries
-    if (!queryObject)
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    // check for type mismatch
-    if (queryObject-&gt;getType() != target)
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    // set query as active for specified target
-    mState.activeQueries[target].set(queryObject);
-
-    // begin query
-    queryObject-&gt;begin();
-}
-
-void Context::endQuery(GLenum target)
-{
-    Query *queryObject = mState.activeQueries[target].get();
-
-    if (queryObject == NULL)
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    queryObject-&gt;end();
-
-    mState.activeQueries[target].set(NULL);
-}
-
-void Context::setFramebufferZero(Framebuffer *buffer)
-{
-    delete mFramebufferMap[0];
-    mFramebufferMap[0] = buffer;
-    if (mState.drawFramebuffer == 0)
-    {
-        mBoundDrawFramebuffer = buffer;
-    }
-}
-
-void Context::setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples)
-{
-    const bool color = gl::IsColorRenderingSupported(internalformat, this);
-    const bool depth = gl::IsDepthRenderingSupported(internalformat, this);
-    const bool stencil = gl::IsStencilRenderingSupported(internalformat, this);
-
-    RenderbufferStorage *renderbuffer = NULL;
-
-    if (color)
-    {
-        renderbuffer = new gl::Colorbuffer(mRenderer,width, height, internalformat, samples);
-    }
-    else if (depth &amp;&amp; stencil)
-    {
-        renderbuffer = new gl::DepthStencilbuffer(mRenderer, width, height, samples);
-    }
-    else if (depth)
-    {
-        renderbuffer = new gl::Depthbuffer(mRenderer, width, height, samples);
-    }
-    else if (stencil)
-    {
-        renderbuffer = new gl::Stencilbuffer(mRenderer, width, height, samples);
-    }
-    else
-    {
-        UNREACHABLE();
-        return;
-    }
-
-    Renderbuffer *renderbufferObject = mState.renderbuffer.get();
-    renderbufferObject-&gt;setStorage(renderbuffer);
-}
-
-Framebuffer *Context::getFramebuffer(unsigned int handle) const
-{
-    FramebufferMap::const_iterator framebuffer = mFramebufferMap.find(handle);
-
-    if (framebuffer == mFramebufferMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return framebuffer-&gt;second;
-    }
-}
-
-FenceNV *Context::getFenceNV(unsigned int handle)
-{
-    FenceNVMap::iterator fence = mFenceNVMap.find(handle);
-
-    if (fence == mFenceNVMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return fence-&gt;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-&gt;second &amp;&amp; create)
-        {
-            query-&gt;second = new Query(mRenderer, type, handle);
-            query-&gt;second-&gt;addRef();
-        }
-        return query-&gt;second;
-    }
-}
-
-Buffer *Context::getTargetBuffer(GLenum target) const
-{
-    switch (target)
-    {
-      case GL_ARRAY_BUFFER:              return mState.arrayBuffer.get();
-      case GL_COPY_READ_BUFFER:          return mState.copyReadBuffer.get();
-      case GL_COPY_WRITE_BUFFER:         return mState.copyWriteBuffer.get();
-      case GL_ELEMENT_ARRAY_BUFFER:      return getCurrentVertexArray()-&gt;getElementArrayBuffer();
-      case GL_PIXEL_PACK_BUFFER:         return mState.pack.pixelBuffer.get();
-      case GL_PIXEL_UNPACK_BUFFER:       return mState.unpack.pixelBuffer.get();
-      case GL_TRANSFORM_FEEDBACK_BUFFER: return mState.genericTransformFeedbackBuffer.get();
-      case GL_UNIFORM_BUFFER:            return mState.genericUniformBuffer.get();
-      default: UNREACHABLE();            return NULL;
-    }
-}
-
-Buffer *Context::getArrayBuffer()
-{
-    return mState.arrayBuffer.get();
-}
-
-Buffer *Context::getElementArrayBuffer() const
-{
-    return getCurrentVertexArray()-&gt;getElementArrayBuffer();
-}
-
-ProgramBinary *Context::getCurrentProgramBinary()
-{
-    return mCurrentProgramBinary.get();
-}
-
-Texture *Context::getTargetTexture(GLenum target) const
-{
-    if (!ValidTextureTarget(this, target))
-    {
-        return NULL;
-    }
-
-    switch (target)
-    {
-      case GL_TEXTURE_2D:       return getTexture2D();
-      case GL_TEXTURE_CUBE_MAP: return getTextureCubeMap();
-      case GL_TEXTURE_3D:       return getTexture3D();
-      case GL_TEXTURE_2D_ARRAY: return getTexture2DArray();
-      default:                  return NULL;
-    }
-}
-
-GLuint Context::getTargetFramebufferHandle(GLenum target) const
-{
-    if (!ValidFramebufferTarget(target))
-    {
-        return GL_INVALID_INDEX;
-    }
-
-    if (target == GL_READ_FRAMEBUFFER_ANGLE)
-    {
-        return mState.readFramebuffer;
-    }
-    else
-    {
-        return mState.drawFramebuffer;
-    }
-}
-
-Framebuffer *Context::getTargetFramebuffer(GLenum target) const
-{
-    GLuint framebufferHandle = getTargetFramebufferHandle(target);
-    return (framebufferHandle == GL_INVALID_INDEX ? NULL : getFramebuffer(framebufferHandle));
-}
-
-Texture2D *Context::getTexture2D() const
-{
-    return static_cast&lt;Texture2D*&gt;(getSamplerTexture(mState.activeSampler, TEXTURE_2D));
-}
-
-TextureCubeMap *Context::getTextureCubeMap() const
-{
-    return static_cast&lt;TextureCubeMap*&gt;(getSamplerTexture(mState.activeSampler, TEXTURE_CUBE));
-}
-
-Texture3D *Context::getTexture3D() const
-{
-    return static_cast&lt;Texture3D*&gt;(getSamplerTexture(mState.activeSampler, TEXTURE_3D));
-}
-
-Texture2DArray *Context::getTexture2DArray() const
-{
-    return static_cast&lt;Texture2DArray*&gt;(getSamplerTexture(mState.activeSampler, TEXTURE_2D_ARRAY));
-}
-
-Buffer *Context::getGenericUniformBuffer()
-{
-    return mState.genericUniformBuffer.get();
-}
-
-Buffer *Context::getGenericTransformFeedbackBuffer()
-{
-    return mState.genericTransformFeedbackBuffer.get();
-}
-
-Buffer *Context::getCopyReadBuffer()
-{
-    return mState.copyReadBuffer.get();
-}
-
-Buffer *Context::getCopyWriteBuffer()
-{
-    return mState.copyWriteBuffer.get();
-}
-
-Buffer *Context::getPixelPackBuffer()
-{
-    return mState.pack.pixelBuffer.get();
-}
-
-Buffer *Context::getPixelUnpackBuffer()
-{
-    return mState.unpack.pixelBuffer.get();
-}
-
-Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type) const
-{
-    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();
-          case TEXTURE_3D:       return mTexture3DZero.get();
-          case TEXTURE_2D_ARRAY: return mTexture2DArrayZero.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.depthStencil.depthMask;       break;
-      case GL_COLOR_WRITEMASK:
-        params[0] = mState.blend.colorMaskRed;
-        params[1] = mState.blend.colorMaskGreen;
-        params[2] = mState.blend.colorMaskBlue;
-        params[3] = mState.blend.colorMaskAlpha;
-        break;
-      case GL_CULL_FACE:                 *params = mState.rasterizer.cullFace;          break;
-      case GL_POLYGON_OFFSET_FILL:       *params = mState.rasterizer.polygonOffsetFill; break;
-      case GL_SAMPLE_ALPHA_TO_COVERAGE:  *params = mState.blend.sampleAlphaToCoverage;  break;
-      case GL_SAMPLE_COVERAGE:           *params = mState.sampleCoverage;               break;
-      case GL_SCISSOR_TEST:              *params = mState.scissorTest;                  break;
-      case GL_STENCIL_TEST:              *params = mState.depthStencil.stencilTest;     break;
-      case GL_DEPTH_TEST:                *params = mState.depthStencil.depthTest;       break;
-      case GL_BLEND:                     *params = mState.blend.blend;                  break;
-      case GL_DITHER:                    *params = mState.blend.dither;                 break;
-      case GL_CONTEXT_ROBUST_ACCESS_EXT: *params = mRobustAccess ? GL_TRUE : GL_FALSE;  break;
-      case GL_TRANSFORM_FEEDBACK_ACTIVE: *params = getCurrentTransformFeedback()-&gt;isStarted(); break;
-      case GL_TRANSFORM_FEEDBACK_PAUSED: *params = getCurrentTransformFeedback()-&gt;isPaused();  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.rasterizer.polygonOffsetFactor;    break;
-      case GL_POLYGON_OFFSET_UNITS:     *params = mState.rasterizer.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] = getMaximumPointSize();
-        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;
-      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
-        if (!supportsTextureFilterAnisotropy())
-        {
-            return false;
-        }
-        *params = mMaxTextureAnisotropy;
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getIntegerv(GLenum pname, GLint *params)
-{
-    if (pname &gt;= GL_DRAW_BUFFER0_EXT &amp;&amp; pname &lt;= GL_DRAW_BUFFER15_EXT)
-    {
-        unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0_EXT);
-
-        if (colorAttachment &gt;= mRenderer-&gt;getMaxRenderTargets())
-        {
-            // return true to stop further operation in the parent call
-            return gl::error(GL_INVALID_OPERATION, true);
-        }
-
-        Framebuffer *framebuffer = getDrawFramebuffer();
-
-        *params = framebuffer-&gt;getDrawBufferState(colorAttachment);
-        return true;
-    }
-
-    // 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 = mRenderer-&gt;getMaxVertexUniformVectors();              break;
-      case GL_MAX_VERTEX_UNIFORM_COMPONENTS:            *params = mRenderer-&gt;getMaxVertexUniformVectors() * 4;          break;
-      case GL_MAX_VARYING_VECTORS:                      *params = mRenderer-&gt;getMaxVaryingVectors();                    break;
-      case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:         *params = mRenderer-&gt;getMaxCombinedTextureImageUnits();         break;
-      case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:           *params = mRenderer-&gt;getMaxVertexTextureImageUnits();           break;
-      case GL_MAX_TEXTURE_IMAGE_UNITS:                  *params = gl::MAX_TEXTURE_IMAGE_UNITS;                          break;
-      case GL_MAX_FRAGMENT_UNIFORM_VECTORS:             *params = mRenderer-&gt;getMaxFragmentUniformVectors();            break;
-      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:          *params = mRenderer-&gt;getMaxFragmentUniformVectors() * 4;        break;
-      case GL_MAX_RENDERBUFFER_SIZE:                    *params = getMaximumRenderbufferDimension();                    break;
-      case GL_MAX_COLOR_ATTACHMENTS_EXT:                *params = mRenderer-&gt;getMaxRenderTargets();                     break;
-      case GL_MAX_DRAW_BUFFERS_EXT:                     *params = mRenderer-&gt;getMaxRenderTargets();                     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 = getCurrentVertexArray()-&gt;getElementArrayBufferId();   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_VERTEX_ARRAY_BINDING:                     *params = mState.vertexArray;                                   break;
-      case GL_CURRENT_PROGRAM:                          *params = mState.currentProgram;                                break;
-      case GL_PACK_ALIGNMENT:                           *params = mState.pack.alignment;                                break;
-      case GL_PACK_REVERSE_ROW_ORDER_ANGLE:             *params = mState.pack.reverseRowOrder;                          break;
-      case GL_UNPACK_ALIGNMENT:                         *params = mState.unpack.alignment;                              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.depthStencil.stencilFunc;                      break;
-      case GL_STENCIL_REF:                              *params = mState.stencilRef;                                    break;
-      case GL_STENCIL_VALUE_MASK:                       *params = clampToInt(mState.depthStencil.stencilMask);          break;
-      case GL_STENCIL_BACK_FUNC:                        *params = mState.depthStencil.stencilBackFunc;                  break;
-      case GL_STENCIL_BACK_REF:                         *params = mState.stencilBackRef;                                break;
-      case GL_STENCIL_BACK_VALUE_MASK:                  *params = clampToInt(mState.depthStencil.stencilBackMask);      break;
-      case GL_STENCIL_FAIL:                             *params = mState.depthStencil.stencilFail;                      break;
-      case GL_STENCIL_PASS_DEPTH_FAIL:                  *params = mState.depthStencil.stencilPassDepthFail;             break;
-      case GL_STENCIL_PASS_DEPTH_PASS:                  *params = mState.depthStencil.stencilPassDepthPass;             break;
-      case GL_STENCIL_BACK_FAIL:                        *params = mState.depthStencil.stencilBackFail;                  break;
-      case GL_STENCIL_BACK_PASS_DEPTH_FAIL:             *params = mState.depthStencil.stencilBackPassDepthFail;         break;
-      case GL_STENCIL_BACK_PASS_DEPTH_PASS:             *params = mState.depthStencil.stencilBackPassDepthPass;         break;
-      case GL_DEPTH_FUNC:                               *params = mState.depthStencil.depthFunc;                        break;
-      case GL_BLEND_SRC_RGB:                            *params = mState.blend.sourceBlendRGB;                          break;
-      case GL_BLEND_SRC_ALPHA:                          *params = mState.blend.sourceBlendAlpha;                        break;
-      case GL_BLEND_DST_RGB:                            *params = mState.blend.destBlendRGB;                            break;
-      case GL_BLEND_DST_ALPHA:                          *params = mState.blend.destBlendAlpha;                          break;
-      case GL_BLEND_EQUATION_RGB:                       *params = mState.blend.blendEquationRGB;                        break;
-      case GL_BLEND_EQUATION_ALPHA:                     *params = mState.blend.blendEquationAlpha;                      break;
-      case GL_STENCIL_WRITEMASK:                        *params = clampToInt(mState.depthStencil.stencilWritemask);     break;
-      case GL_STENCIL_BACK_WRITEMASK:                   *params = clampToInt(mState.depthStencil.stencilBackWritemask); break;
-      case GL_STENCIL_CLEAR_VALUE:                      *params = mState.stencilClearValue;                             break;
-      case GL_SUBPIXEL_BITS:                            *params = 4;                                                    break;
-      case GL_MAX_TEXTURE_SIZE:                         *params = getMaximum2DTextureDimension();                       break;
-      case GL_MAX_CUBE_MAP_TEXTURE_SIZE:                *params = getMaximumCubeTextureDimension();                     break;
-      case GL_MAX_3D_TEXTURE_SIZE:                      *params = getMaximum3DTextureDimension();                       break;
-      case GL_MAX_ARRAY_TEXTURE_LAYERS:                 *params = getMaximum2DArrayTextureLayers();                     break;
-      case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:          *params = getUniformBufferOffsetAlignment();                    break;
-      case GL_MAX_UNIFORM_BUFFER_BINDINGS:              *params = getMaximumCombinedUniformBufferBindings();            break;
-      case GL_MAX_VERTEX_UNIFORM_BLOCKS:                *params = mRenderer-&gt;getMaxVertexShaderUniformBuffers();        break;
-      case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:              *params = mRenderer-&gt;getMaxFragmentShaderUniformBuffers();      break;
-      case GL_MAX_COMBINED_UNIFORM_BLOCKS:              *params = getMaximumCombinedUniformBufferBindings();            break;
-      case GL_MAJOR_VERSION:                            *params = mClientVersion;                                       break;
-      case GL_MINOR_VERSION:                            *params = 0;                                                    break;
-      case GL_MAX_ELEMENTS_INDICES:                     *params = mRenderer-&gt;getMaxRecommendedElementsIndices();        break;
-      case GL_MAX_ELEMENTS_VERTICES:                    *params = mRenderer-&gt;getMaxRecommendedElementsVertices();       break;
-      case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: *params = mRenderer-&gt;getMaxTransformFeedbackInterleavedComponents(); break;
-      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:       *params = mRenderer-&gt;getMaxTransformFeedbackBuffers();               break;
-      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:    *params = mRenderer-&gt;getMaxTransformFeedbackSeparateComponents();    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-&gt;completeness() == GL_FRAMEBUFFER_COMPLETE)
-            {
-                switch (pname)
-                {
-                  case GL_SAMPLE_BUFFERS:
-                    if (framebuffer-&gt;getSamples() != 0)
-                    {
-                        *params = 1;
-                    }
-                    else
-                    {
-                        *params = 0;
-                    }
-                    break;
-                  case GL_SAMPLES:
-                    *params = framebuffer-&gt;getSamples();
-                    break;
-                }
-            }
-            else 
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_IMPLEMENTATION_COLOR_READ_TYPE:
-      case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
-        {
-            GLenum internalFormat, format, type;
-            if (getCurrentReadFormatType(&amp;internalFormat, &amp;format, &amp;type))
-            {
-                if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT)
-                    *params = format;
-                else
-                    *params = type;
-            }
-        }
-        break;
-      case GL_MAX_VIEWPORT_DIMS:
-        {
-            params[0] = mMaxViewportDimension;
-            params[1] = mMaxViewportDimension;
-        }
-        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.viewport.x;
-        params[1] = mState.viewport.y;
-        params[2] = mState.viewport.width;
-        params[3] = mState.viewport.height;
-        break;
-      case GL_SCISSOR_BOX:
-        params[0] = mState.scissor.x;
-        params[1] = mState.scissor.y;
-        params[2] = mState.scissor.width;
-        params[3] = mState.scissor.height;
-        break;
-      case GL_CULL_FACE_MODE:                   *params = mState.rasterizer.cullMode;   break;
-      case GL_FRONT_FACE:                       *params = mState.rasterizer.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-&gt;getFirstColorbuffer();
-
-            if (colorbuffer)
-            {
-                switch (pname)
-                {
-                  case GL_RED_BITS:   *params = colorbuffer-&gt;getRedSize();      break;
-                  case GL_GREEN_BITS: *params = colorbuffer-&gt;getGreenSize();    break;
-                  case GL_BLUE_BITS:  *params = colorbuffer-&gt;getBlueSize();     break;
-                  case GL_ALPHA_BITS: *params = colorbuffer-&gt;getAlphaSize();    break;
-                }
-            }
-            else
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_DEPTH_BITS:
-        {
-            gl::Framebuffer *framebuffer = getDrawFramebuffer();
-            gl::Renderbuffer *depthbuffer = framebuffer-&gt;getDepthbuffer();
-
-            if (depthbuffer)
-            {
-                *params = depthbuffer-&gt;getDepthSize();
-            }
-            else
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_STENCIL_BITS:
-        {
-            gl::Framebuffer *framebuffer = getDrawFramebuffer();
-            gl::Renderbuffer *stencilbuffer = framebuffer-&gt;getStencilbuffer();
-
-            if (stencilbuffer)
-            {
-                *params = stencilbuffer-&gt;getStencilSize();
-            }
-            else
-            {
-                *params = 0;
-            }
-        }
-        break;
-      case GL_TEXTURE_BINDING_2D:
-        {
-            if (mState.activeSampler &gt; mRenderer-&gt;getMaxCombinedTextureImageUnits() - 1)
-            {
-                gl::error(GL_INVALID_OPERATION);
-                return false;
-            }
-
-            *params = mState.samplerTexture[TEXTURE_2D][mState.activeSampler].id();
-        }
-        break;
-      case GL_TEXTURE_BINDING_CUBE_MAP:
-        {
-            if (mState.activeSampler &gt; mRenderer-&gt;getMaxCombinedTextureImageUnits() - 1)
-            {
-                gl::error(GL_INVALID_OPERATION);
-                return false;
-            }
-
-            *params = mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].id();
-        }
-        break;
-      case GL_TEXTURE_BINDING_3D:
-        {
-            if (mState.activeSampler &gt; mRenderer-&gt;getMaxCombinedTextureImageUnits() - 1)
-            {
-                gl::error(GL_INVALID_OPERATION);
-                return false;
-            }
-
-            *params = mState.samplerTexture[TEXTURE_3D][mState.activeSampler].id();
-        }
-        break;
-      case GL_TEXTURE_BINDING_2D_ARRAY:
-        {
-            if (mState.activeSampler &gt; mRenderer-&gt;getMaxCombinedTextureImageUnits() - 1)
-            {
-                gl::error(GL_INVALID_OPERATION);
-                return false;
-            }
-
-            *params = mState.samplerTexture[TEXTURE_2D_ARRAY][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;
-      case GL_UNIFORM_BUFFER_BINDING:
-        *params = mState.genericUniformBuffer.id();
-        break;
-      case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
-        *params = mState.genericTransformFeedbackBuffer.id();
-        break;
-      case GL_COPY_READ_BUFFER_BINDING:
-        *params = mState.copyReadBuffer.id();
-        break;
-      case GL_COPY_WRITE_BUFFER_BINDING:
-        *params = mState.copyWriteBuffer.id();
-        break;
-      case GL_PIXEL_PACK_BUFFER_BINDING:
-        *params = mState.pack.pixelBuffer.id();
-        break;
-      case GL_PIXEL_UNPACK_BUFFER_BINDING:
-        *params = mState.unpack.pixelBuffer.id();
-        break;
-      case GL_NUM_EXTENSIONS:
-        *params = static_cast&lt;GLint&gt;(getNumExtensions());
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getInteger64v(GLenum pname, GLint64 *params)
-{
-    switch (pname)
-    {
-      case GL_MAX_ELEMENT_INDEX:
-        *params = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;unsigned int&gt;::max());
-        break;
-      case GL_MAX_UNIFORM_BLOCK_SIZE:
-        *params = static_cast&lt;GLint64&gt;(mRenderer-&gt;getMaxUniformBufferSize());
-        break;
-      case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
-        {
-            GLint64 uniformBufferComponents = static_cast&lt;GLint64&gt;(mRenderer-&gt;getMaxVertexShaderUniformBuffers()) * static_cast&lt;GLint64&gt;(mRenderer-&gt;getMaxUniformBufferSize() / 4);
-            GLint64 defaultBufferComponents = static_cast&lt;GLint64&gt;(mRenderer-&gt;getMaxVertexUniformVectors() * 4);
-            *params = uniformBufferComponents + defaultBufferComponents;
-        }
-        break;
-      case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
-        {
-            GLint64 uniformBufferComponents = static_cast&lt;GLint64&gt;(mRenderer-&gt;getMaxFragmentShaderUniformBuffers()) * static_cast&lt;GLint64&gt;(mRenderer-&gt;getMaxUniformBufferSize() / 4);
-            GLint64 defaultBufferComponents = static_cast&lt;GLint64&gt;(mRenderer-&gt;getMaxVertexUniformVectors() * 4);
-            *params = uniformBufferComponents + defaultBufferComponents;
-        }
-        break;
-      case GL_MAX_SERVER_WAIT_TIMEOUT:
-        // We do not wait for server fence objects internally, so report a max timeout of zero.
-        *params = 0;
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getIndexedIntegerv(GLenum target, GLuint index, GLint *data)
-{
-    switch (target)
-    {
-      case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
-        if (index &lt; IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
-        {
-            *data = mState.transformFeedbackBuffers[index].id();
-        }
-        break;
-      case GL_UNIFORM_BUFFER_BINDING:
-        if (index &lt; IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
-        {
-            *data = mState.uniformBuffers[index].id();
-        }
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data)
-{
-    switch (target)
-    {
-      case GL_TRANSFORM_FEEDBACK_BUFFER_START:
-        if (index &lt; IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
-        {
-            *data = mState.transformFeedbackBuffers[index].getOffset();
-        }
-        break;
-      case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
-        if (index &lt; IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS)
-        {
-            *data = mState.transformFeedbackBuffers[index].getSize();
-        }
-        break;
-      case GL_UNIFORM_BUFFER_START:
-        if (index &lt; IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
-        {
-            *data = mState.uniformBuffers[index].getOffset();
-        }
-        break;
-      case GL_UNIFORM_BUFFER_SIZE:
-        if (index &lt; IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS)
-        {
-            *data = mState.uniformBuffers[index].getSize();
-        }
-        break;
-      default:
-        return false;
-    }
-
-    return true;
-}
-
-bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams)
-{
-    if (pname &gt;= GL_DRAW_BUFFER0_EXT &amp;&amp; pname &lt;= GL_DRAW_BUFFER15_EXT)
-    {
-        *type = GL_INT;
-        *numParams = 1;
-        return true;
-    }
-
-    // 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;
-        }
-        return true;
-      case GL_SHADER_BINARY_FORMATS:
-        {
-            *type = GL_INT;
-            *numParams = 0;
-        }
-        return true;
-      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_MAX_COLOR_ATTACHMENTS_EXT:
-      case GL_MAX_DRAW_BUFFERS_EXT:
-      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;
-        }
-        return true;
-      case GL_MAX_SAMPLES_ANGLE:
-        {
-            if (getMaxSupportedSamples() != 0)
-            {
-                *type = GL_INT;
-                *numParams = 1;
-            }
-            else
-            {
-                return false;
-            }
-        }
-        return true;
-      case GL_MAX_VIEWPORT_DIMS:
-        {
-            *type = GL_INT;
-            *numParams = 2;
-        }
-        return true;
-      case GL_VIEWPORT:
-      case GL_SCISSOR_BOX:
-        {
-            *type = GL_INT;
-            *numParams = 4;
-        }
-        return true;
-      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;
-        }
-        return true;
-      case GL_COLOR_WRITEMASK:
-        {
-            *type = GL_BOOL;
-            *numParams = 4;
-        }
-        return true;
-      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;
-        }
-        return true;
-      case GL_ALIASED_LINE_WIDTH_RANGE:
-      case GL_ALIASED_POINT_SIZE_RANGE:
-      case GL_DEPTH_RANGE:
-        {
-            *type = GL_FLOAT;
-            *numParams = 2;
-        }
-        return true;
-      case GL_COLOR_CLEAR_VALUE:
-      case GL_BLEND_COLOR:
-        {
-            *type = GL_FLOAT;
-            *numParams = 4;
-        }
-        return true;
-      case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
-        if (!supportsTextureFilterAnisotropy())
-        {
-            return false;
-        }
-        *type = GL_FLOAT;
-        *numParams = 1;
-        return true;
-    }
-
-    if (mClientVersion &lt; 3)
-    {
-        return false;
-    }
-
-    // Check for ES3.0+ parameter names
-    switch (pname)
-    {
-      case GL_MAX_UNIFORM_BUFFER_BINDINGS:
-      case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
-      case GL_UNIFORM_BUFFER_BINDING:
-      case GL_TRANSFORM_FEEDBACK_BINDING:
-      case GL_COPY_READ_BUFFER_BINDING:
-      case GL_COPY_WRITE_BUFFER_BINDING:
-      case GL_PIXEL_PACK_BUFFER_BINDING:
-      case GL_PIXEL_UNPACK_BUFFER_BINDING:
-      case GL_TEXTURE_BINDING_3D:
-      case GL_TEXTURE_BINDING_2D_ARRAY:
-      case GL_MAX_3D_TEXTURE_SIZE:
-      case GL_MAX_ARRAY_TEXTURE_LAYERS:
-      case GL_MAX_VERTEX_UNIFORM_BLOCKS:
-      case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
-      case GL_MAX_COMBINED_UNIFORM_BLOCKS:
-      case GL_VERTEX_ARRAY_BINDING:
-      case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
-      case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
-      case GL_NUM_EXTENSIONS:
-      case GL_MAJOR_VERSION:
-      case GL_MINOR_VERSION:
-      case GL_MAX_ELEMENTS_INDICES:
-      case GL_MAX_ELEMENTS_VERTICES:
-      case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
-      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
-      case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
-        {
-            *type = GL_INT;
-            *numParams = 1;
-        }
-        return true;
-
-      case GL_MAX_ELEMENT_INDEX:
-      case GL_MAX_UNIFORM_BLOCK_SIZE:
-      case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
-      case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
-      case GL_MAX_SERVER_WAIT_TIMEOUT:
-        {
-            *type = GL_INT_64_ANGLEX;
-            *numParams = 1;
-        }
-        return true;
-
-      case GL_TRANSFORM_FEEDBACK_ACTIVE:
-      case GL_TRANSFORM_FEEDBACK_PAUSED:
-        {
-            *type = GL_BOOL;
-            *numParams = 1;
-        }
-        return true;
-    }
-
-    return false;
-}
-
-bool Context::getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams)
-{
-    if (mClientVersion &lt; 3)
-    {
-        return false;
-    }
-
-    switch (target)
-    {
-      case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
-      case GL_UNIFORM_BUFFER_BINDING:
-        {
-            *type = GL_INT;
-            *numParams = 1;
-        }
-        return true;
-      case GL_TRANSFORM_FEEDBACK_BUFFER_START:
-      case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
-      case GL_UNIFORM_BUFFER_START:
-      case GL_UNIFORM_BUFFER_SIZE:
-        {
-            *type = GL_INT_64_ANGLEX;
-            *numParams = 1;
-        }
-    }
-
-    return false;
-}
-
-// Applies the render target surface, depth stencil surface, viewport rectangle and
-// scissor rectangle to the renderer
-bool Context::applyRenderTarget(GLenum drawMode, bool ignoreViewport)
-{
-    Framebuffer *framebufferObject = getDrawFramebuffer();
-
-    if (!framebufferObject || framebufferObject-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
-    }
-
-    mRenderer-&gt;applyRenderTarget(framebufferObject);
-
-    if (!mRenderer-&gt;setViewport(mState.viewport, mState.zNear, mState.zFar, drawMode, mState.rasterizer.frontFace,
-                                ignoreViewport))
-    {
-        return false;
-    }
-
-    mRenderer-&gt;setScissorRectangle(mState.scissor, mState.scissorTest);
-
-    return true;
-}
-
-// Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc) to the Direct3D 9 device
-void Context::applyState(GLenum drawMode)
-{
-    Framebuffer *framebufferObject = getDrawFramebuffer();
-    int samples = framebufferObject-&gt;getSamples();
-
-    mState.rasterizer.pointDrawMode = (drawMode == GL_POINTS);
-    mState.rasterizer.multiSample = (samples != 0);
-    mRenderer-&gt;setRasterizerState(mState.rasterizer);
-
-    unsigned int mask = 0;
-    if (mState.sampleCoverage)
-    {
-        if (mState.sampleCoverageValue != 0)
-        {
-            
-            float threshold = 0.5f;
-
-            for (int i = 0; i &lt; samples; ++i)
-            {
-                mask &lt;&lt;= 1;
-
-                if ((i + 1) * mState.sampleCoverageValue &gt;= threshold)
-                {
-                    threshold += 1.0f;
-                    mask |= 1;
-                }
-            }
-        }
-
-        if (mState.sampleCoverageInvert)
-        {
-            mask = ~mask;
-        }
-    }
-    else
-    {
-        mask = 0xFFFFFFFF;
-    }
-    mRenderer-&gt;setBlendState(framebufferObject, mState.blend, mState.blendColor, mask);
-
-    mRenderer-&gt;setDepthStencilState(mState.depthStencil, mState.stencilRef, mState.stencilBackRef,
-                                    mState.rasterizer.frontFace == GL_CCW);
-}
-
-// Applies the shaders and shader constants to the Direct3D 9 device
-void Context::applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive)
-{
-    const VertexAttribute *vertexAttributes = getCurrentVertexArray()-&gt;getVertexAttributes();
-
-    VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS];
-    VertexFormat::GetInputLayout(inputLayout, programBinary, vertexAttributes, mState.vertexAttribCurrentValues);
-
-    mRenderer-&gt;applyShaders(programBinary, mState.rasterizer.rasterizerDiscard, transformFeedbackActive, inputLayout);
-
-    programBinary-&gt;applyUniforms();
-}
-
-bool Context::getCurrentTextureAndSamplerState(ProgramBinary *programBinary, SamplerType type, int index, Texture **outTexture,
-                                               TextureType *outTextureType, SamplerState *outSampler)
-{
-    int textureUnit = programBinary-&gt;getSamplerMapping(type, index);   // OpenGL texture image unit index
-
-    if (textureUnit != -1)
-    {
-        TextureType textureType = programBinary-&gt;getSamplerTextureType(type, index);
-        Texture *texture = getSamplerTexture(textureUnit, textureType);
-
-        SamplerState samplerState;
-        texture-&gt;getSamplerState(&amp;samplerState);
-
-        if (mState.samplers[textureUnit] != 0)
-        {
-            Sampler *samplerObject = getSampler(mState.samplers[textureUnit]);
-            samplerObject-&gt;getState(&amp;samplerState);
-        }
-
-        *outTexture = texture;
-        *outTextureType = textureType;
-        *outSampler = samplerState;
-
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-void Context::generateSwizzles(ProgramBinary *programBinary)
-{
-    generateSwizzles(programBinary, SAMPLER_PIXEL);
-
-    if (mSupportsVertexTexture)
-    {
-        generateSwizzles(programBinary, SAMPLER_VERTEX);
-    }
-}
-
-void Context::generateSwizzles(ProgramBinary *programBinary, SamplerType type)
-{
-    // Range of Direct3D samplers of given sampler type
-    int samplerRange = programBinary-&gt;getUsedSamplerRange(type);
-    for (int samplerIndex = 0; samplerIndex &lt; samplerRange; samplerIndex++)
-    {
-        Texture *texture = NULL;
-        TextureType textureType;
-        SamplerState samplerState;
-        if (getCurrentTextureAndSamplerState(programBinary, type, samplerIndex, &amp;texture, &amp;textureType, &amp;samplerState) &amp;&amp; texture-&gt;isSwizzled())
-        {
-            mRenderer-&gt;generateSwizzle(texture);
-        }
-    }
-}
-
-// Applies the textures and sampler states to the Direct3D 9 device
-void Context::applyTextures(ProgramBinary *programBinary)
-{
-    applyTextures(programBinary, SAMPLER_PIXEL);
-
-    if (mSupportsVertexTexture)
-    {
-        applyTextures(programBinary, SAMPLER_VERTEX);
-    }
-}
-
-// For each Direct3D 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(ProgramBinary *programBinary, SamplerType type)
-{
-    FramebufferTextureSerialSet boundFramebufferTextures = getBoundFramebufferTextureSerials();
-
-    // Range of Direct3D samplers of given sampler type
-    int samplerCount = (type == SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : mRenderer-&gt;getMaxVertexTextureImageUnits();
-    int samplerRange = programBinary-&gt;getUsedSamplerRange(type);
-
-    for (int samplerIndex = 0; samplerIndex &lt; samplerRange; samplerIndex++)
-    {
-        Texture *texture = NULL;
-        TextureType textureType;
-        SamplerState samplerState;
-        if (getCurrentTextureAndSamplerState(programBinary, type, samplerIndex, &amp;texture, &amp;textureType, &amp;samplerState))
-        {
-            if (texture-&gt;isSamplerComplete(samplerState) &amp;&amp;
-                boundFramebufferTextures.find(texture-&gt;getTextureSerial()) == boundFramebufferTextures.end())
-            {
-                mRenderer-&gt;setSamplerState(type, samplerIndex, samplerState);
-                mRenderer-&gt;setTexture(type, samplerIndex, texture);
-                texture-&gt;resetDirty();
-            }
-            else
-            {
-                mRenderer-&gt;setTexture(type, samplerIndex, getIncompleteTexture(textureType));
-            }
-        }
-        else
-        {
-            mRenderer-&gt;setTexture(type, samplerIndex, NULL);
-        }
-    }
-
-    for (int samplerIndex = samplerRange; samplerIndex &lt; samplerCount; samplerIndex++)
-    {
-        mRenderer-&gt;setTexture(type, samplerIndex, NULL);
-    }
-}
-
-bool Context::applyUniformBuffers()
-{
-    Program *programObject = getProgram(mState.currentProgram);
-    ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-
-    std::vector&lt;gl::Buffer*&gt; boundBuffers;
-
-    for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; programBinary-&gt;getActiveUniformBlockCount(); uniformBlockIndex++)
-    {
-        GLuint blockBinding = programObject-&gt;getUniformBlockBinding(uniformBlockIndex);
-        const OffsetBindingPointer&lt;Buffer&gt;&amp; boundBuffer = mState.uniformBuffers[blockBinding];
-        if (boundBuffer.id() == 0)
-        {
-            // undefined behaviour
-            return false;
-        }
-        else
-        {
-            gl::Buffer *uniformBuffer = boundBuffer.get();
-            ASSERT(uniformBuffer);
-            boundBuffers.push_back(uniformBuffer);
-        }
-    }
-
-    return programBinary-&gt;applyUniformBuffers(boundBuffers);
-}
-
-bool Context::applyTransformFeedbackBuffers()
-{
-    TransformFeedback *curTransformFeedback = getCurrentTransformFeedback();
-    if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isStarted() &amp;&amp; !curTransformFeedback-&gt;isPaused())
-    {
-        Buffer *transformFeedbackBuffers[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
-        GLintptr transformFeedbackOffsets[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
-        for (size_t i = 0; i &lt; IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
-        {
-            transformFeedbackBuffers[i] = mState.transformFeedbackBuffers[i].get();
-            transformFeedbackOffsets[i] = mState.transformFeedbackBuffers[i].getOffset();
-        }
-        mRenderer-&gt;applyTransformFeedbackBuffers(transformFeedbackBuffers, transformFeedbackOffsets);
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-void Context::markTransformFeedbackUsage()
-{
-    for (size_t i = 0; i &lt; IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS; i++)
-    {
-        Buffer *buffer = mState.transformFeedbackBuffers[i].get();
-        if (buffer)
-        {
-            buffer-&gt;markTransformFeedbackUsage();
-        }
-    }
-}
-
-void Context::clear(GLbitfield mask)
-{
-    if (isRasterizerDiscardEnabled())
-    {
-        return;
-    }
-
-    ClearParameters clearParams = { 0 };
-    for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-    {
-        clearParams.clearColor[i] = false;
-    }
-    clearParams.colorFClearValue = mState.colorClearValue;
-    clearParams.colorClearType = GL_FLOAT;
-    clearParams.colorMaskRed = mState.blend.colorMaskRed;
-    clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
-    clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
-    clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
-    clearParams.clearDepth = false;
-    clearParams.depthClearValue = mState.depthClearValue;
-    clearParams.clearStencil = false;
-    clearParams.stencilClearValue = mState.stencilClearValue;
-    clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
-    clearParams.scissorEnabled = mState.scissorTest;
-    clearParams.scissor = mState.scissor;
-
-    Framebuffer *framebufferObject = getDrawFramebuffer();
-    if (mask &amp; GL_COLOR_BUFFER_BIT)
-    {
-        if (framebufferObject-&gt;hasEnabledColorAttachment())
-        {
-            for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-            {
-                clearParams.clearColor[i] = true;
-            }
-        }
-    }
-
-    if (mask &amp; GL_DEPTH_BUFFER_BIT)
-    {
-        if (mState.depthStencil.depthMask &amp;&amp; framebufferObject-&gt;getDepthbufferType() != GL_NONE)
-        {
-            clearParams.clearDepth = true;
-        }
-    }
-
-    if (mask &amp; GL_STENCIL_BUFFER_BIT)
-    {
-        if (framebufferObject-&gt;getStencilbufferType() != GL_NONE)
-        {
-            rx::RenderTarget *depthStencil = framebufferObject-&gt;getStencilbuffer()-&gt;getDepthStencil();
-            if (!depthStencil)
-            {
-                ERR(&quot;Depth stencil pointer unexpectedly null.&quot;);
-                return;
-            }
-
-            if (gl::GetStencilBits(depthStencil-&gt;getActualFormat(), mClientVersion) &gt; 0)
-            {
-                clearParams.clearStencil = true;
-            }
-        }
-    }
-
-
-    if (!applyRenderTarget(GL_TRIANGLES, true))   // Clips the clear to the scissor rectangle but not the viewport
-    {
-        return;
-    }
-
-    mRenderer-&gt;clear(clearParams, framebufferObject);
-}
-
-void Context::clearBufferfv(GLenum buffer, int drawbuffer, const float *values)
-{
-    if (isRasterizerDiscardEnabled())
-    {
-        return;
-    }
-
-    // glClearBufferfv can be called to clear the color buffer or depth buffer
-    ClearParameters clearParams = { 0 };
-
-    if (buffer == GL_COLOR)
-    {
-        for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-        {
-            clearParams.clearColor[i] = (drawbuffer == static_cast&lt;int&gt;(i));
-        }
-        clearParams.colorFClearValue = ColorF(values[0], values[1], values[2], values[3]);
-        clearParams.colorClearType = GL_FLOAT;
-    }
-    else
-    {
-        for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-        {
-            clearParams.clearColor[i] = false;
-        }
-        clearParams.colorFClearValue = mState.colorClearValue;
-        clearParams.colorClearType = GL_FLOAT;
-    }
-
-    clearParams.colorMaskRed = mState.blend.colorMaskRed;
-    clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
-    clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
-    clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
-
-    if (buffer == GL_DEPTH)
-    {
-        clearParams.clearDepth = true;
-        clearParams.depthClearValue = values[0];
-    }
-    else
-    {
-        clearParams.clearDepth = false;
-        clearParams.depthClearValue = mState.depthClearValue;
-    }
-
-    clearParams.clearStencil = false;
-    clearParams.stencilClearValue = mState.stencilClearValue;
-    clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
-    clearParams.scissorEnabled = mState.scissorTest;
-    clearParams.scissor = mState.scissor;
-
-    if (!applyRenderTarget(GL_TRIANGLES, true))   // Clips the clear to the scissor rectangle but not the viewport
-    {
-        return;
-    }
-
-    mRenderer-&gt;clear(clearParams, getDrawFramebuffer());
-}
-
-void Context::clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values)
-{
-    if (isRasterizerDiscardEnabled())
-    {
-        return;
-    }
-
-    // glClearBufferuv can only be called to clear a color buffer
-    ClearParameters clearParams = { 0 };
-    for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-    {
-        clearParams.clearColor[i] = (drawbuffer == static_cast&lt;int&gt;(i));
-    }
-    clearParams.colorUIClearValue = ColorUI(values[0], values[1], values[2], values[3]);
-    clearParams.colorClearType = GL_UNSIGNED_INT;
-    clearParams.colorMaskRed = mState.blend.colorMaskRed;
-    clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
-    clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
-    clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
-    clearParams.clearDepth = false;
-    clearParams.depthClearValue = mState.depthClearValue;
-    clearParams.clearStencil = false;
-    clearParams.stencilClearValue = mState.stencilClearValue;
-    clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
-    clearParams.scissorEnabled = mState.scissorTest;
-    clearParams.scissor = mState.scissor;
-
-    if (!applyRenderTarget(GL_TRIANGLES, true))   // Clips the clear to the scissor rectangle but not the viewport
-    {
-        return;
-    }
-
-    mRenderer-&gt;clear(clearParams, getDrawFramebuffer());
-}
-
-void Context::clearBufferiv(GLenum buffer, int drawbuffer, const int *values)
-{
-    if (isRasterizerDiscardEnabled())
-    {
-        return;
-    }
-
-    // glClearBufferfv can be called to clear the color buffer or stencil buffer
-    ClearParameters clearParams = { 0 };
-
-    if (buffer == GL_COLOR)
-    {
-        for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-        {
-            clearParams.clearColor[i] = (drawbuffer == static_cast&lt;int&gt;(i));
-        }
-        clearParams.colorIClearValue = ColorI(values[0], values[1], values[2], values[3]);
-        clearParams.colorClearType = GL_INT;
-    }
-    else
-    {
-        for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-        {
-            clearParams.clearColor[i] = false;
-        }
-        clearParams.colorFClearValue = mState.colorClearValue;
-        clearParams.colorClearType = GL_FLOAT;
-    }
-
-    clearParams.colorMaskRed = mState.blend.colorMaskRed;
-    clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
-    clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
-    clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
-
-    clearParams.clearDepth = false;
-    clearParams.depthClearValue = mState.depthClearValue;
-
-    if (buffer == GL_STENCIL)
-    {
-        clearParams.clearStencil = true;
-        clearParams.stencilClearValue = values[1];
-    }
-    else
-    {
-        clearParams.clearStencil = false;
-        clearParams.stencilClearValue = mState.stencilClearValue;
-    }
-    clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
-
-    clearParams.scissorEnabled = mState.scissorTest;
-    clearParams.scissor = mState.scissor;
-
-    if (!applyRenderTarget(GL_TRIANGLES, true))   // Clips the clear to the scissor rectangle but not the viewport
-    {
-        return;
-    }
-
-    mRenderer-&gt;clear(clearParams, getDrawFramebuffer());
-}
-
-void Context::clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil)
-{
-    if (isRasterizerDiscardEnabled())
-    {
-        return;
-    }
-
-    // glClearBufferfi can only be called to clear a depth stencil buffer
-    ClearParameters clearParams = { 0 };
-    for (unsigned int i = 0; i &lt; ArraySize(clearParams.clearColor); i++)
-    {
-        clearParams.clearColor[i] = false;
-    }
-    clearParams.colorFClearValue = mState.colorClearValue;
-    clearParams.colorClearType = GL_FLOAT;
-    clearParams.colorMaskRed = mState.blend.colorMaskRed;
-    clearParams.colorMaskGreen = mState.blend.colorMaskGreen;
-    clearParams.colorMaskBlue = mState.blend.colorMaskBlue;
-    clearParams.colorMaskAlpha = mState.blend.colorMaskAlpha;
-    clearParams.clearDepth = true;
-    clearParams.depthClearValue = depth;
-    clearParams.clearStencil = true;
-    clearParams.stencilClearValue = stencil;
-    clearParams.stencilWriteMask = mState.depthStencil.stencilWritemask;
-    clearParams.scissorEnabled = mState.scissorTest;
-    clearParams.scissor = mState.scissor;
-
-    if (!applyRenderTarget(GL_TRIANGLES, true))   // Clips the clear to the scissor rectangle but not the viewport
-    {
-        return;
-    }
-
-    mRenderer-&gt;clear(clearParams, getDrawFramebuffer());
-}
-
-void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
-                         GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
-{
-    gl::Framebuffer *framebuffer = getReadFramebuffer();
-
-    bool isSized = IsSizedInternalFormat(format, mClientVersion);
-    GLenum sizedInternalFormat = (isSized ? format : GetSizedInternalFormat(format, type, mClientVersion));
-    GLuint outputPitch = GetRowPitch(sizedInternalFormat, type, mClientVersion, width, mState.pack.alignment);
-
-    mRenderer-&gt;readPixels(framebuffer, x, y, width, height, format, type, outputPitch, mState.pack, pixels);
-}
-
-void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instances)
-{
-    if (!mState.currentProgram)
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    ProgramBinary *programBinary = getCurrentProgramBinary();
-    programBinary-&gt;applyUniforms();
-
-    generateSwizzles(programBinary);
-
-    if (!mRenderer-&gt;applyPrimitiveType(mode, count))
-    {
-        return;
-    }
-
-    if (!applyRenderTarget(mode, false))
-    {
-        return;
-    }
-
-    applyState(mode);
-
-    GLenum err = mRenderer-&gt;applyVertexBuffer(programBinary, getCurrentVertexArray()-&gt;getVertexAttributes(), mState.vertexAttribCurrentValues, first, count, instances);
-    if (err != GL_NO_ERROR)
-    {
-        return gl::error(err);
-    }
-
-    bool transformFeedbackActive = applyTransformFeedbackBuffers();
-
-    applyShaders(programBinary, transformFeedbackActive);
-    applyTextures(programBinary);
-
-    if (!applyUniformBuffers())
-    {
-        return;
-    }
-
-    if (!programBinary-&gt;validateSamplers(NULL))
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    if (!skipDraw(mode))
-    {
-        mRenderer-&gt;drawArrays(mode, count, instances, transformFeedbackActive);
-
-        if (transformFeedbackActive)
-        {
-            markTransformFeedbackUsage();
-        }
-    }
-}
-
-void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instances)
-{
-    if (!mState.currentProgram)
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    VertexArray *vao = getCurrentVertexArray();
-    if (!indices &amp;&amp; !vao-&gt;getElementArrayBuffer())
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    ProgramBinary *programBinary = getCurrentProgramBinary();
-    programBinary-&gt;applyUniforms();
-
-    generateSwizzles(programBinary);
-
-    if (!mRenderer-&gt;applyPrimitiveType(mode, count))
-    {
-        return;
-    }
-
-    if (!applyRenderTarget(mode, false))
-    {
-        return;
-    }
-
-    applyState(mode);
-
-    rx::TranslatedIndexData indexInfo;
-    GLenum err = mRenderer-&gt;applyIndexBuffer(indices, vao-&gt;getElementArrayBuffer(), count, mode, type, &amp;indexInfo);
-    if (err != GL_NO_ERROR)
-    {
-        return gl::error(err);
-    }
-
-    GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
-    err = mRenderer-&gt;applyVertexBuffer(programBinary, vao-&gt;getVertexAttributes(), mState.vertexAttribCurrentValues, indexInfo.minIndex, vertexCount, instances);
-    if (err != GL_NO_ERROR)
-    {
-        return gl::error(err);
-    }
-
-    bool transformFeedbackActive = applyTransformFeedbackBuffers();
-    // Transform feedback is not allowed for DrawElements, this error should have been caught at the API validation
-    // layer.
-    ASSERT(!transformFeedbackActive);
-
-    applyShaders(programBinary, transformFeedbackActive);
-    applyTextures(programBinary);
-
-    if (!applyUniformBuffers())
-    {
-        return;
-    }
-
-    if (!programBinary-&gt;validateSamplers(NULL))
-    {
-        return gl::error(GL_INVALID_OPERATION);
-    }
-
-    if (!skipDraw(mode))
-    {
-        mRenderer-&gt;drawElements(mode, count, type, indices, vao-&gt;getElementArrayBuffer(), indexInfo, instances);
-    }
-}
-
-// Implements glFlush when block is false, glFinish when block is true
-void Context::sync(bool block)
-{
-    mRenderer-&gt;sync(block);
-}
-
-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 &amp;&amp; !mContextLost)
-    {
-        // mResetStatus will be set by the markContextLost callback
-        // in the case a notification is sent
-        mRenderer-&gt;testDeviceLost(true);
-    }
-
-    GLenum status = mResetStatus;
-
-    if (mResetStatus != GL_NO_ERROR)
-    {
-        ASSERT(mContextLost);
-
-        if (mRenderer-&gt;testDeviceResettable())
-        {
-            mResetStatus = GL_NO_ERROR;
-        }
-    }
-    
-    return status;
-}
-
-bool Context::isResetNotificationEnabled()
-{
-    return (mResetStrategy == GL_LOSE_CONTEXT_ON_RESET_EXT);
-}
-
-int Context::getClientVersion() const
-{
-    return mClientVersion;
-}
-
-int Context::getMajorShaderModel() const
-{
-    return mMajorShaderModel;
-}
-
-float Context::getMaximumPointSize() const
-{
-    return mMaximumPointSize;
-}
-
-unsigned int Context::getMaximumCombinedTextureImageUnits() const
-{
-    return mRenderer-&gt;getMaxCombinedTextureImageUnits();
-}
-
-unsigned int Context::getMaximumCombinedUniformBufferBindings() const
-{
-    return mRenderer-&gt;getMaxVertexShaderUniformBuffers() +
-           mRenderer-&gt;getMaxFragmentShaderUniformBuffers();
-}
-
-int Context::getMaxSupportedSamples() const
-{
-    return mRenderer-&gt;getMaxSupportedSamples();
-}
-
-GLsizei Context::getMaxSupportedFormatSamples(GLenum internalFormat) const
-{
-    return mRenderer-&gt;getMaxSupportedFormatSamples(internalFormat);
-}
-
-GLsizei Context::getNumSampleCounts(GLenum internalFormat) const
-{
-    return mRenderer-&gt;getNumSampleCounts(internalFormat);
-}
-
-void Context::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
-{
-    mRenderer-&gt;getSampleCounts(internalFormat, bufSize, params);
-}
-
-unsigned int Context::getMaxTransformFeedbackBufferBindings() const
-{
-    return mRenderer-&gt;getMaxTransformFeedbackBuffers();
-}
-
-GLintptr Context::getUniformBufferOffsetAlignment() const
-{
-    // setting a large alignment forces uniform buffers to bind with zero offset
-    return static_cast&lt;GLintptr&gt;(std::numeric_limits&lt;GLint&gt;::max());
-}
-
-unsigned int Context::getMaximumRenderTargets() const
-{
-    return mRenderer-&gt;getMaxRenderTargets();
-}
-
-bool Context::supportsEventQueries() const
-{
-    return mSupportsEventQueries;
-}
-
-bool Context::supportsOcclusionQueries() const
-{
-    return mSupportsOcclusionQueries;
-}
-
-bool Context::supportsBGRATextures() const
-{
-    return mSupportsBGRATextures;
-}
-
-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::getMaximum2DTextureDimension() const
-{
-    return mMax2DTextureDimension;
-}
-
-int Context::getMaximumCubeTextureDimension() const
-{
-    return mMaxCubeTextureDimension;
-}
-
-int Context::getMaximum3DTextureDimension() const
-{
-    return mMax3DTextureDimension;
-}
-
-int Context::getMaximum2DArrayTextureLayers() const
-{
-    return mMax2DArrayTextureLayers;
-}
-
-int Context::getMaximum2DTextureLevel() const
-{
-    return mMax2DTextureLevel;
-}
-
-int Context::getMaximumCubeTextureLevel() const
-{
-    return mMaxCubeTextureLevel;
-}
-
-int Context::getMaximum3DTextureLevel() const
-{
-    return mMax3DTextureLevel;
-}
-
-int Context::getMaximum2DArrayTextureLevel() const
-{
-    return mMax2DArrayTextureLevel;
-}
-
-bool Context::supportsLuminanceTextures() const
-{
-    return mSupportsLuminanceTextures;
-}
-
-bool Context::supportsLuminanceAlphaTextures() const
-{
-    return mSupportsLuminanceAlphaTextures;
-}
-
-bool Context::supportsRGTextures() const
-{
-    return mSupportsRGTextures;
-}
-
-bool Context::supportsDepthTextures() const
-{
-    return mSupportsDepthTextures;
-}
-
-bool Context::supports32bitIndices() const
-{
-    return mSupports32bitIndices;
-}
-
-bool Context::supportsNonPower2Texture() const
-{
-    return mSupportsNonPower2Texture;
-}
-
-bool Context::supportsInstancing() const
-{
-    return mSupportsInstancing;
-}
-
-bool Context::supportsTextureFilterAnisotropy() const
-{
-    return mSupportsTextureFilterAnisotropy;
-}
-
-bool Context::supportsPBOs() const
-{
-    return mSupportsPBOs;
-}
-
-float Context::getTextureMaxAnisotropy() const
-{
-    return mMaxTextureAnisotropy;
-}
-
-bool Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type)
-{
-    Framebuffer *framebuffer = getReadFramebuffer();
-    if (!framebuffer || framebuffer-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    Renderbuffer *renderbuffer = framebuffer-&gt;getReadColorbuffer();
-    if (!renderbuffer)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    *internalFormat = renderbuffer-&gt;getActualFormat();
-    *format = gl::GetFormat(renderbuffer-&gt;getActualFormat(), mClientVersion);
-    *type = gl::GetType(renderbuffer-&gt;getActualFormat(), mClientVersion);
-
-    return true;
-}
-
-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);
-    }
-
-    // mark as freed among the vertex array objects
-    for (auto vaoIt = mVertexArrayMap.begin(); vaoIt != mVertexArrayMap.end(); vaoIt++)
-    {
-        vaoIt-&gt;second-&gt;detachBuffer(buffer);
-    }
-}
-
-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 &lt; TEXTURE_TYPE_COUNT; type++)
-    {
-        for (int sampler = 0; sampler &lt; IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS; 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-&gt;detachTexture(texture);
-    }
-
-    if (drawFramebuffer &amp;&amp; drawFramebuffer != readFramebuffer)
-    {
-        drawFramebuffer-&gt;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-&gt;detachRenderbuffer(renderbuffer);
-    }
-
-    if (drawFramebuffer &amp;&amp; drawFramebuffer != readFramebuffer)
-    {
-        drawFramebuffer-&gt;detachRenderbuffer(renderbuffer);
-    }
-}
-
-void Context::detachVertexArray(GLuint vertexArray)
-{
-    // [OpenGL ES 3.0.2] section 2.10 page 43:
-    // If a vertex array object that is currently bound is deleted, the binding
-    // for that object reverts to zero and the default vertex array becomes current.
-    if (mState.vertexArray == vertexArray)
-    {
-        bindVertexArray(0);
-    }
-}
-
-void Context::detachTransformFeedback(GLuint transformFeedback)
-{
-    if (mState.transformFeedback.id() == transformFeedback)
-    {
-        bindTransformFeedback(0);
-    }
-}
-
-void Context::detachSampler(GLuint sampler)
-{
-    // [OpenGL ES 3.0.2] section 3.8.2 pages 123-124:
-    // If a sampler object that is currently bound to one or more texture units is
-    // deleted, it is as though BindSampler is called once for each texture unit to
-    // which the sampler is bound, with unit set to the texture unit and sampler set to zero.
-    for (unsigned int textureUnit = 0; textureUnit &lt; ArraySize(mState.samplers); textureUnit++)
-    {
-        if (mState.samplers[textureUnit] == sampler)
-        {
-            mState.samplers[textureUnit] = 0;
-        }
-    }
-}
-
-Texture *Context::getIncompleteTexture(TextureType type)
-{
-    Texture *t = mIncompleteTextures[type].get();
-
-    if (t == NULL)
-    {
-        const GLubyte color[] = { 0, 0, 0, 255 };
-        const PixelUnpackState incompleteUnpackState(1);
-
-        switch (type)
-        {
-          default:
-            UNREACHABLE();
-            // default falls through to TEXTURE_2D
-
-          case TEXTURE_2D:
-            {
-                Texture2D *incomplete2d = new Texture2D(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
-                incomplete2d-&gt;setImage(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-                t = incomplete2d;
-            }
-            break;
-
-          case TEXTURE_CUBE:
-            {
-              TextureCubeMap *incompleteCube = new TextureCubeMap(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
-
-              incompleteCube-&gt;setImagePosX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-              incompleteCube-&gt;setImageNegX(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-              incompleteCube-&gt;setImagePosY(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-              incompleteCube-&gt;setImageNegY(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-              incompleteCube-&gt;setImagePosZ(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-              incompleteCube-&gt;setImageNegZ(0, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-
-              t = incompleteCube;
-            }
-            break;
-
-          case TEXTURE_3D:
-            {
-                Texture3D *incomplete3d = new Texture3D(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
-                incomplete3d-&gt;setImage(0, 1, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-
-                t = incomplete3d;
-            }
-            break;
-
-          case TEXTURE_2D_ARRAY:
-            {
-                Texture2DArray *incomplete2darray = new Texture2DArray(mRenderer, Texture::INCOMPLETE_TEXTURE_ID);
-                incomplete2darray-&gt;setImage(0, 1, 1, 1, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, incompleteUnpackState, color);
-
-                t = incomplete2darray;
-            }
-            break;
-        }
-
-        mIncompleteTextures[type].set(t);
-    }
-
-    return t;
-}
-
-bool Context::skipDraw(GLenum drawMode)
-{
-    if (drawMode == GL_POINTS)
-    {
-        // ProgramBinary assumes non-point rendering if gl_PointSize isn't written,
-        // which affects varying interpolation. Since the value of gl_PointSize is
-        // undefined when not written, just skip drawing to avoid unexpected results.
-        if (!getCurrentProgramBinary()-&gt;usesPointSize())
-        {
-            // This is stictly speaking not an error, but developers should be 
-            // notified of risking undefined behavior.
-            ERR(&quot;Point rendering without writing to gl_PointSize.&quot;);
-
-            return true;
-        }
-    }
-    else if (IsTriangleMode(drawMode))
-    {
-        if (mState.rasterizer.cullFace &amp;&amp; mState.rasterizer.cullMode == GL_FRONT_AND_BACK)
-        {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-void Context::setVertexAttribf(GLuint index, const GLfloat values[4])
-{
-    ASSERT(index &lt; gl::MAX_VERTEX_ATTRIBS);
-    mState.vertexAttribCurrentValues[index].setFloatValues(values);
-}
-
-void Context::setVertexAttribu(GLuint index, const GLuint values[4])
-{
-    ASSERT(index &lt; gl::MAX_VERTEX_ATTRIBS);
-    mState.vertexAttribCurrentValues[index].setUnsignedIntValues(values);
-}
-
-void Context::setVertexAttribi(GLuint index, const GLint values[4])
-{
-    ASSERT(index &lt; gl::MAX_VERTEX_ATTRIBS);
-    mState.vertexAttribCurrentValues[index].setIntValues(values);
-}
-
-void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
-{
-    getCurrentVertexArray()-&gt;setVertexAttribDivisor(index, divisor);
-}
-
-void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
-    mResourceManager-&gt;checkSamplerAllocation(sampler);
-
-    Sampler *samplerObject = getSampler(sampler);
-    ASSERT(samplerObject);
-
-    switch (pname)
-    {
-      case GL_TEXTURE_MIN_FILTER:    samplerObject-&gt;setMinFilter(static_cast&lt;GLenum&gt;(param));       break;
-      case GL_TEXTURE_MAG_FILTER:    samplerObject-&gt;setMagFilter(static_cast&lt;GLenum&gt;(param));       break;
-      case GL_TEXTURE_WRAP_S:        samplerObject-&gt;setWrapS(static_cast&lt;GLenum&gt;(param));           break;
-      case GL_TEXTURE_WRAP_T:        samplerObject-&gt;setWrapT(static_cast&lt;GLenum&gt;(param));           break;
-      case GL_TEXTURE_WRAP_R:        samplerObject-&gt;setWrapR(static_cast&lt;GLenum&gt;(param));           break;
-      case GL_TEXTURE_MIN_LOD:       samplerObject-&gt;setMinLod(static_cast&lt;GLfloat&gt;(param));         break;
-      case GL_TEXTURE_MAX_LOD:       samplerObject-&gt;setMaxLod(static_cast&lt;GLfloat&gt;(param));         break;
-      case GL_TEXTURE_COMPARE_MODE:  samplerObject-&gt;setComparisonMode(static_cast&lt;GLenum&gt;(param));  break;
-      case GL_TEXTURE_COMPARE_FUNC:  samplerObject-&gt;setComparisonFunc(static_cast&lt;GLenum&gt;(param));  break;
-      default:                       UNREACHABLE(); break;
-    }
-}
-
-void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
-    mResourceManager-&gt;checkSamplerAllocation(sampler);
-
-    Sampler *samplerObject = getSampler(sampler);
-    ASSERT(samplerObject);
-
-    switch (pname)
-    {
-      case GL_TEXTURE_MIN_FILTER:    samplerObject-&gt;setMinFilter(uiround&lt;GLenum&gt;(param));       break;
-      case GL_TEXTURE_MAG_FILTER:    samplerObject-&gt;setMagFilter(uiround&lt;GLenum&gt;(param));       break;
-      case GL_TEXTURE_WRAP_S:        samplerObject-&gt;setWrapS(uiround&lt;GLenum&gt;(param));           break;
-      case GL_TEXTURE_WRAP_T:        samplerObject-&gt;setWrapT(uiround&lt;GLenum&gt;(param));           break;
-      case GL_TEXTURE_WRAP_R:        samplerObject-&gt;setWrapR(uiround&lt;GLenum&gt;(param));           break;
-      case GL_TEXTURE_MIN_LOD:       samplerObject-&gt;setMinLod(param);                                      break;
-      case GL_TEXTURE_MAX_LOD:       samplerObject-&gt;setMaxLod(param);                                      break;
-      case GL_TEXTURE_COMPARE_MODE:  samplerObject-&gt;setComparisonMode(uiround&lt;GLenum&gt;(param));  break;
-      case GL_TEXTURE_COMPARE_FUNC:  samplerObject-&gt;setComparisonFunc(uiround&lt;GLenum&gt;(param));  break;
-      default:                       UNREACHABLE(); break;
-    }
-}
-
-GLint Context::getSamplerParameteri(GLuint sampler, GLenum pname)
-{
-    mResourceManager-&gt;checkSamplerAllocation(sampler);
-
-    Sampler *samplerObject = getSampler(sampler);
-    ASSERT(samplerObject);
-
-    switch (pname)
-    {
-      case GL_TEXTURE_MIN_FILTER:    return static_cast&lt;GLint&gt;(samplerObject-&gt;getMinFilter());
-      case GL_TEXTURE_MAG_FILTER:    return static_cast&lt;GLint&gt;(samplerObject-&gt;getMagFilter());
-      case GL_TEXTURE_WRAP_S:        return static_cast&lt;GLint&gt;(samplerObject-&gt;getWrapS());
-      case GL_TEXTURE_WRAP_T:        return static_cast&lt;GLint&gt;(samplerObject-&gt;getWrapT());
-      case GL_TEXTURE_WRAP_R:        return static_cast&lt;GLint&gt;(samplerObject-&gt;getWrapR());
-      case GL_TEXTURE_MIN_LOD:       return uiround&lt;GLint&gt;(samplerObject-&gt;getMinLod());
-      case GL_TEXTURE_MAX_LOD:       return uiround&lt;GLint&gt;(samplerObject-&gt;getMaxLod());
-      case GL_TEXTURE_COMPARE_MODE:  return static_cast&lt;GLint&gt;(samplerObject-&gt;getComparisonMode());
-      case GL_TEXTURE_COMPARE_FUNC:  return static_cast&lt;GLint&gt;(samplerObject-&gt;getComparisonFunc());
-      default:                       UNREACHABLE(); return 0;
-    }
-}
-
-GLfloat Context::getSamplerParameterf(GLuint sampler, GLenum pname)
-{
-    mResourceManager-&gt;checkSamplerAllocation(sampler);
-
-    Sampler *samplerObject = getSampler(sampler);
-    ASSERT(samplerObject);
-
-    switch (pname)
-    {
-      case GL_TEXTURE_MIN_FILTER:    return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getMinFilter());
-      case GL_TEXTURE_MAG_FILTER:    return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getMagFilter());
-      case GL_TEXTURE_WRAP_S:        return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getWrapS());
-      case GL_TEXTURE_WRAP_T:        return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getWrapT());
-      case GL_TEXTURE_WRAP_R:        return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getWrapR());
-      case GL_TEXTURE_MIN_LOD:       return samplerObject-&gt;getMinLod();
-      case GL_TEXTURE_MAX_LOD:       return samplerObject-&gt;getMaxLod();
-      case GL_TEXTURE_COMPARE_MODE:  return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getComparisonMode());
-      case GL_TEXTURE_COMPARE_FUNC:  return static_cast&lt;GLfloat&gt;(samplerObject-&gt;getComparisonFunc());
-      default:                       UNREACHABLE(); return 0;
-    }
-}
-
-// keep list sorted in following order
-// OES extensions
-// EXT extensions
-// Vendor extensions
-void Context::initExtensionString()
-{
-    // Do not report extension in GLES 3 contexts for now
-    if (mClientVersion == 2)
-    {
-        // OES extensions
-        if (supports32bitIndices())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_element_index_uint&quot;);
-        }
-
-        mExtensionStringList.push_back(&quot;GL_OES_packed_depth_stencil&quot;);
-        mExtensionStringList.push_back(&quot;GL_OES_get_program_binary&quot;);
-        mExtensionStringList.push_back(&quot;GL_OES_rgb8_rgba8&quot;);
-
-        if (supportsPBOs())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_mapbuffer&quot;);
-            mExtensionStringList.push_back(&quot;GL_EXT_map_buffer_range&quot;);
-        }
-
-        if (mRenderer-&gt;getDerivativeInstructionSupport())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_standard_derivatives&quot;);
-        }
-
-        if (supportsFloat16Textures())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_texture_half_float&quot;);
-        }
-        if (supportsFloat16LinearFilter())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_texture_half_float_linear&quot;);
-        }
-        if (supportsFloat32Textures())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_texture_float&quot;);
-        }
-        if (supportsFloat32LinearFilter())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_texture_float_linear&quot;);
-        }
-
-        if (supportsRGTextures())
-        {
-            mExtensionStringList.push_back(&quot;GL_EXT_texture_rg&quot;);
-        }
-
-        if (supportsNonPower2Texture())
-        {
-            mExtensionStringList.push_back(&quot;GL_OES_texture_npot&quot;);
-        }
-
-        // Multi-vendor (EXT) extensions
-        if (supportsOcclusionQueries())
-        {
-            mExtensionStringList.push_back(&quot;GL_EXT_occlusion_query_boolean&quot;);
-        }
-
-        mExtensionStringList.push_back(&quot;GL_EXT_read_format_bgra&quot;);
-        mExtensionStringList.push_back(&quot;GL_EXT_robustness&quot;);
-        mExtensionStringList.push_back(&quot;GL_EXT_shader_texture_lod&quot;);
-
-        if (supportsDXT1Textures())
-        {
-            mExtensionStringList.push_back(&quot;GL_EXT_texture_compression_dxt1&quot;);
-        }
-
-        if (supportsTextureFilterAnisotropy())
-        {
-            mExtensionStringList.push_back(&quot;GL_EXT_texture_filter_anisotropic&quot;);
-        }
-
-        if (supportsBGRATextures())
-        {
-            mExtensionStringList.push_back(&quot;GL_EXT_texture_format_BGRA8888&quot;);
-        }
-
-        if (mRenderer-&gt;getMaxRenderTargets() &gt; 1)
-        {
-            mExtensionStringList.push_back(&quot;GL_EXT_draw_buffers&quot;);
-        }
-
-        mExtensionStringList.push_back(&quot;GL_EXT_texture_storage&quot;);
-        mExtensionStringList.push_back(&quot;GL_EXT_frag_depth&quot;);
-        mExtensionStringList.push_back(&quot;GL_EXT_blend_minmax&quot;);
-
-        // ANGLE-specific extensions
-        if (supportsDepthTextures())
-        {
-            mExtensionStringList.push_back(&quot;GL_ANGLE_depth_texture&quot;);
-        }
-
-        mExtensionStringList.push_back(&quot;GL_ANGLE_framebuffer_blit&quot;);
-        if (getMaxSupportedSamples() != 0)
-        {
-            mExtensionStringList.push_back(&quot;GL_ANGLE_framebuffer_multisample&quot;);
-        }
-
-        if (supportsInstancing())
-        {
-            mExtensionStringList.push_back(&quot;GL_ANGLE_instanced_arrays&quot;);
-        }
-
-        mExtensionStringList.push_back(&quot;GL_ANGLE_pack_reverse_row_order&quot;);
-
-        if (supportsDXT3Textures())
-        {
-            mExtensionStringList.push_back(&quot;GL_ANGLE_texture_compression_dxt3&quot;);
-        }
-        if (supportsDXT5Textures())
-        {
-            mExtensionStringList.push_back(&quot;GL_ANGLE_texture_compression_dxt5&quot;);
-        }
-
-        mExtensionStringList.push_back(&quot;GL_ANGLE_texture_usage&quot;);
-        mExtensionStringList.push_back(&quot;GL_ANGLE_translated_shader_source&quot;);
-
-        // Other vendor-specific extensions
-        if (supportsEventQueries())
-        {
-            mExtensionStringList.push_back(&quot;GL_NV_fence&quot;);
-        }
-    }
-
-    if (mClientVersion == 3)
-    {
-        mExtensionStringList.push_back(&quot;GL_EXT_color_buffer_float&quot;);
-
-        mExtensionStringList.push_back(&quot;GL_EXT_read_format_bgra&quot;);
-
-        if (supportsBGRATextures())
-        {
-            mExtensionStringList.push_back(&quot;GL_EXT_texture_format_BGRA8888&quot;);
-        }
-    }
-
-    // Join the extension strings to one long string for use with GetString
-    std::stringstream strstr;
-    for (unsigned int extensionIndex = 0; extensionIndex &lt; mExtensionStringList.size(); extensionIndex++)
-    {
-        strstr &lt;&lt; mExtensionStringList[extensionIndex];
-        strstr &lt;&lt; &quot; &quot;;
-    }
-
-    mCombinedExtensionsString = makeStaticString(strstr.str());
-}
-
-const char *Context::getCombinedExtensionsString() const
-{
-    return mCombinedExtensionsString;
-}
-
-const char *Context::getExtensionString(const GLuint index) const
-{
-    ASSERT(index &lt; mExtensionStringList.size());
-    return mExtensionStringList[index].c_str();
-}
-
-unsigned int Context::getNumExtensions() const
-{
-    return mExtensionStringList.size();
-}
-
-void Context::initRendererString()
-{
-    std::ostringstream rendererString;
-    rendererString &lt;&lt; &quot;ANGLE (&quot;;
-    rendererString &lt;&lt; mRenderer-&gt;getRendererDescription();
-    rendererString &lt;&lt; &quot;)&quot;;
-
-    mRendererString = makeStaticString(rendererString.str());
-}
-
-const char *Context::getRendererString() const
-{
-    return mRendererString;
-}
-
-Context::FramebufferTextureSerialSet Context::getBoundFramebufferTextureSerials()
-{
-    FramebufferTextureSerialSet set;
-
-    Framebuffer *drawFramebuffer = getDrawFramebuffer();
-    for (unsigned int i = 0; i &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
-    {
-        Renderbuffer *renderBuffer = drawFramebuffer-&gt;getColorbuffer(i);
-        if (renderBuffer &amp;&amp; renderBuffer-&gt;getTextureSerial() != 0)
-        {
-            set.insert(renderBuffer-&gt;getTextureSerial());
-        }
-    }
-
-    Renderbuffer *depthStencilBuffer = drawFramebuffer-&gt;getDepthOrStencilbuffer();
-    if (depthStencilBuffer &amp;&amp; depthStencilBuffer-&gt;getTextureSerial() != 0)
-    {
-        set.insert(depthStencilBuffer-&gt;getTextureSerial());
-    }
-
-    return set;
-}
-
-void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
-                              GLbitfield mask, GLenum filter)
-{
-    Framebuffer *readFramebuffer = getReadFramebuffer();
-    Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
-    bool blitRenderTarget = false;
-    bool blitDepth = false;
-    bool blitStencil = false;
-    if ((mask &amp; GL_COLOR_BUFFER_BIT) &amp;&amp; readFramebuffer-&gt;getReadColorbuffer() &amp;&amp; drawFramebuffer-&gt;getFirstColorbuffer())
-    {
-        blitRenderTarget = true;
-    }
-    if ((mask &amp; GL_STENCIL_BUFFER_BIT) &amp;&amp; readFramebuffer-&gt;getStencilbuffer() &amp;&amp; drawFramebuffer-&gt;getStencilbuffer())
-    {
-        blitStencil = true;
-    }
-    if ((mask &amp; GL_DEPTH_BUFFER_BIT) &amp;&amp; readFramebuffer-&gt;getDepthbuffer() &amp;&amp; drawFramebuffer-&gt;getDepthbuffer())
-    {
-        blitDepth = true;
-    }
-
-    gl::Rectangle srcRect(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
-    gl::Rectangle dstRect(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
-    if (blitRenderTarget || blitDepth || blitStencil)
-    {
-        const gl::Rectangle *scissor = mState.scissorTest ? &amp;mState.scissor : NULL;
-        mRenderer-&gt;blitRect(readFramebuffer, srcRect, drawFramebuffer, dstRect, scissor,
-                            blitRenderTarget, blitDepth, blitStencil, filter);
-    }
-}
-
-void Context::invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
-                                    GLint x, GLint y, GLsizei width, GLsizei height)
-{
-    Framebuffer *frameBuffer = NULL;
-    switch (target)
-    {
-      case GL_FRAMEBUFFER:
-      case GL_DRAW_FRAMEBUFFER:
-        frameBuffer = getDrawFramebuffer();
-        break;
-      case GL_READ_FRAMEBUFFER:
-        frameBuffer = getReadFramebuffer();
-        break;
-      default:
-        UNREACHABLE();
-    }
-
-    if (frameBuffer &amp;&amp; frameBuffer-&gt;completeness() == GL_FRAMEBUFFER_COMPLETE)
-    {
-        for (int i = 0; i &lt; numAttachments; ++i)
-        {
-            rx::RenderTarget *renderTarget = NULL;
-
-            if (attachments[i] &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp; attachments[i] &lt;= GL_COLOR_ATTACHMENT15)
-            {
-                gl::Renderbuffer *renderBuffer = frameBuffer-&gt;getColorbuffer(attachments[i] - GL_COLOR_ATTACHMENT0);
-                if (renderBuffer)
-                {
-                    renderTarget = renderBuffer-&gt;getRenderTarget();
-                }
-            }
-            else if (attachments[i] == GL_COLOR)
-            {
-                 gl::Renderbuffer *renderBuffer = frameBuffer-&gt;getColorbuffer(0);
-                 if (renderBuffer)
-                 {
-                     renderTarget = renderBuffer-&gt;getRenderTarget();
-                 }
-            }
-            else
-            {
-                gl::Renderbuffer *renderBuffer = NULL;
-                switch (attachments[i])
-                {
-                  case GL_DEPTH_ATTACHMENT:
-                  case GL_DEPTH:
-                    renderBuffer = frameBuffer-&gt;getDepthbuffer();
-                    break;
-                  case GL_STENCIL_ATTACHMENT:
-                  case GL_STENCIL:
-                    renderBuffer = frameBuffer-&gt;getStencilbuffer();
-                    break;
-                  case GL_DEPTH_STENCIL_ATTACHMENT:
-                    renderBuffer = frameBuffer-&gt;getDepthOrStencilbuffer();
-                    break;
-                  default:
-                    UNREACHABLE();
-                }
-
-                if (renderBuffer)
-                {
-                    renderTarget = renderBuffer-&gt;getDepthStencil();
-                }
-            }
-
-            if (renderTarget)
-            {
-                renderTarget-&gt;invalidate(x, y, width, height);
-            }
-        }
-    }
-}
-
-bool Context::hasMappedBuffer(GLenum target) const
-{
-    if (target == GL_ARRAY_BUFFER)
-    {
-        for (unsigned int attribIndex = 0; attribIndex &lt; gl::MAX_VERTEX_ATTRIBS; attribIndex++)
-        {
-            const gl::VertexAttribute &amp;vertexAttrib = getVertexAttribState(attribIndex);
-            gl::Buffer *boundBuffer = vertexAttrib.mBoundBuffer.get();
-            if (vertexAttrib.mArrayEnabled &amp;&amp; boundBuffer &amp;&amp; boundBuffer-&gt;mapped())
-            {
-                return true;
-            }
-        }
-    }
-    else if (target == GL_ELEMENT_ARRAY_BUFFER)
-    {
-        Buffer *elementBuffer = getElementArrayBuffer();
-        return (elementBuffer &amp;&amp; elementBuffer-&gt;mapped());
-    }
-    else if (target == GL_TRANSFORM_FEEDBACK_BUFFER)
-    {
-        UNIMPLEMENTED();
-    }
-    else UNREACHABLE();
-    return false;
-}
-
-}
-
-extern &quot;C&quot;
-{
-gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess)
-{
-    return new gl::Context(clientVersion, shareContext, renderer, 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();
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Contexth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Context.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,592 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2014 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_
-
-#ifndef GL_APICALL
-#define GL_APICALL
-#endif
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES3/gl3ext.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-#include &lt;GLES2/gl2ext.h&gt;
-#define EGLAPI
-#include &lt;EGL/egl.h&gt;
-
-#include &lt;string&gt;
-#include &lt;set&gt;
-#include &lt;map&gt;
-#include &lt;unordered_map&gt;
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-#include &quot;libGLESv2/HandleAllocator.h&quot;
-#include &quot;libGLESv2/angletypes.h&quot;
-#include &quot;libGLESv2/Constants.h&quot;
-#include &quot;libGLESv2/VertexAttribute.h&quot;
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace egl
-{
-class Surface;
-}
-
-namespace gl
-{
-class Shader;
-class Program;
-class ProgramBinary;
-class Texture;
-class Texture2D;
-class TextureCubeMap;
-class Texture3D;
-class Texture2DArray;
-class Framebuffer;
-class Renderbuffer;
-class RenderbufferStorage;
-class Colorbuffer;
-class Depthbuffer;
-class Stencilbuffer;
-class DepthStencilbuffer;
-class FenceNV;
-class FenceSync;
-class Query;
-class ResourceManager;
-class Buffer;
-class VertexAttribute;
-class VertexArray;
-class Sampler;
-class TransformFeedback;
-
-// Helper structure to store all raw state
-struct State
-{
-    ColorF colorClearValue;
-    GLclampf depthClearValue;
-    int stencilClearValue;
-
-    RasterizerState rasterizer;
-    bool scissorTest;
-    Rectangle scissor;
-
-    BlendState blend;
-    ColorF blendColor;
-    bool sampleCoverage;
-    GLclampf sampleCoverageValue;
-    bool sampleCoverageInvert;
-
-    DepthStencilState depthStencil;
-    GLint stencilRef;
-    GLint stencilBackRef;
-
-    GLfloat lineWidth;
-
-    GLenum generateMipmapHint;
-    GLenum fragmentShaderDerivativeHint;
-
-    Rectangle viewport;
-    float zNear;
-    float zFar;
-
-    unsigned int activeSampler;   // Active texture unit selector - GL_TEXTURE0
-    BindingPointer&lt;Buffer&gt; arrayBuffer;
-    GLuint readFramebuffer;
-    GLuint drawFramebuffer;
-    BindingPointer&lt;Renderbuffer&gt; renderbuffer;
-    GLuint currentProgram;
-
-    VertexAttribCurrentValueData vertexAttribCurrentValues[MAX_VERTEX_ATTRIBS]; // From glVertexAttrib
-    unsigned int vertexArray;
-
-    BindingPointer&lt;Texture&gt; samplerTexture[TEXTURE_TYPE_COUNT][IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-    GLuint samplers[IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-
-    typedef std::map&lt; GLenum, BindingPointer&lt;Query&gt; &gt; ActiveQueryMap;
-    ActiveQueryMap activeQueries;
-
-    BindingPointer&lt;Buffer&gt; genericUniformBuffer;
-    OffsetBindingPointer&lt;Buffer&gt; uniformBuffers[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
-
-    BindingPointer&lt;TransformFeedback&gt; transformFeedback;
-    BindingPointer&lt;Buffer&gt; genericTransformFeedbackBuffer;
-    OffsetBindingPointer&lt;Buffer&gt; transformFeedbackBuffers[IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS];
-
-    BindingPointer&lt;Buffer&gt; copyReadBuffer;
-    BindingPointer&lt;Buffer&gt; copyWriteBuffer;
-
-    PixelUnpackState unpack;
-    PixelPackState pack;
-};
-
-class Context
-{
-  public:
-    Context(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
-
-    virtual ~Context();
-
-    void makeCurrent(egl::Surface *surface);
-
-    virtual void markContextLost();
-    bool isContextLost();
-
-    // State manipulation
-    void setCap(GLenum cap, bool enabled);
-    bool getCap(GLenum cap);
-
-    void setClearColor(float red, float green, float blue, float alpha);
-
-    void setClearDepth(float depth);
-
-    void setClearStencil(int stencil);
-
-    void setRasterizerDiscard(bool enabled);
-    bool isRasterizerDiscardEnabled() const;
-
-    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 getScissorParams(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 getVertexArrayHandle() const;
-    GLuint getSamplerHandle(GLuint textureUnit) const;
-
-    GLuint getArrayBufferHandle() const;
-
-    GLuint getActiveQuery(GLenum target) const;
-
-    void setEnableVertexAttribArray(unsigned int attribNum, bool enabled);
-    const VertexAttribute &amp;getVertexAttribState(unsigned int attribNum) const;
-    const VertexAttribCurrentValueData &amp;getVertexAttribCurrentValue(unsigned int attribNum) const;
-    void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
-                              bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
-    const void *getVertexAttribPointer(unsigned int attribNum) const;
-
-    void setUnpackAlignment(GLint alignment);
-    GLint getUnpackAlignment() const;
-    const PixelUnpackState &amp;getUnpackState() const;
-
-    void setPackAlignment(GLint alignment);
-    GLint getPackAlignment() const;
-    const PixelPackState &amp;getPackState() 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();
-    GLuint createSampler();
-    GLuint createTransformFeedback();
-    GLsync createFenceSync(GLenum condition);
-
-    void deleteBuffer(GLuint buffer);
-    void deleteShader(GLuint shader);
-    void deleteProgram(GLuint program);
-    void deleteTexture(GLuint texture);
-    void deleteRenderbuffer(GLuint renderbuffer);
-    void deleteSampler(GLuint sampler);
-    void deleteTransformFeedback(GLuint transformFeedback);
-    void deleteFenceSync(GLsync fenceSync);
-
-    // Framebuffers are owned by the Context, so these methods do not pass through
-    GLuint createFramebuffer();
-    void deleteFramebuffer(GLuint framebuffer);
-
-    // NV Fences are owned by the Context.
-    GLuint createFenceNV();
-    void deleteFenceNV(GLuint fence);
-    
-    // Queries are owned by the Context;
-    GLuint createQuery();
-    void deleteQuery(GLuint query);
-
-    // Vertex arrays are owned by the Context
-    GLuint createVertexArray();
-    void deleteVertexArray(GLuint vertexArray);
-
-    void bindArrayBuffer(GLuint buffer);
-    void bindElementArrayBuffer(GLuint buffer);
-    void bindTexture2D(GLuint texture);
-    void bindTextureCubeMap(GLuint texture);
-    void bindTexture3D(GLuint texture);
-    void bindTexture2DArray(GLuint texture);
-    void bindReadFramebuffer(GLuint framebuffer);
-    void bindDrawFramebuffer(GLuint framebuffer);
-    void bindRenderbuffer(GLuint renderbuffer);
-    void bindVertexArray(GLuint vertexArray);
-    void bindSampler(GLuint textureUnit, GLuint sampler);
-    void bindGenericUniformBuffer(GLuint buffer);
-    void bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
-    void bindGenericTransformFeedbackBuffer(GLuint buffer);
-    void bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
-    void bindCopyReadBuffer(GLuint buffer);
-    void bindCopyWriteBuffer(GLuint buffer);
-    void bindPixelPackBuffer(GLuint buffer);
-    void bindPixelUnpackBuffer(GLuint buffer);
-    void useProgram(GLuint program);
-    void linkProgram(GLuint program);
-    void setProgramBinary(GLuint program, const void *binary, GLint length);
-    void bindTransformFeedback(GLuint transformFeedback);
-
-    void beginQuery(GLenum target, GLuint query);
-    void endQuery(GLenum target);
-
-    void setFramebufferZero(Framebuffer *framebuffer);
-
-    void setRenderbufferStorage(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
-
-    void setVertexAttribf(GLuint index, const GLfloat values[4]);
-    void setVertexAttribu(GLuint index, const GLuint values[4]);
-    void setVertexAttribi(GLuint index, const GLint values[4]);
-    void setVertexAttribDivisor(GLuint index, GLuint divisor);
-
-    void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
-    void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
-    GLint getSamplerParameteri(GLuint sampler, GLenum pname);
-    GLfloat getSamplerParameterf(GLuint sampler, GLenum pname);
-
-    Buffer *getBuffer(GLuint handle);
-    FenceNV *getFenceNV(GLuint handle);
-    FenceSync *getFenceSync(GLsync handle) const;
-    Shader *getShader(GLuint handle) const;
-    Program *getProgram(GLuint handle) const;
-    Texture *getTexture(GLuint handle);
-    Framebuffer *getFramebuffer(GLuint handle) const;
-    Renderbuffer *getRenderbuffer(GLuint handle);
-    VertexArray *getVertexArray(GLuint handle) const;
-    Sampler *getSampler(GLuint handle) const;
-    Query *getQuery(GLuint handle, bool create, GLenum type);
-    TransformFeedback *getTransformFeedback(GLuint handle) const;
-
-    Buffer *getTargetBuffer(GLenum target) const;
-    Buffer *getArrayBuffer();
-    Buffer *getElementArrayBuffer() const;
-    ProgramBinary *getCurrentProgramBinary();
-
-    Texture *getTargetTexture(GLenum target) const;
-    Texture2D *getTexture2D() const;
-    TextureCubeMap *getTextureCubeMap() const;
-    Texture3D *getTexture3D() const;
-    Texture2DArray *getTexture2DArray() const;
-
-    Buffer *getGenericUniformBuffer();
-    Buffer *getGenericTransformFeedbackBuffer();
-    Buffer *getCopyReadBuffer();
-    Buffer *getCopyWriteBuffer();
-    Buffer *getPixelPackBuffer();
-    Buffer *getPixelUnpackBuffer();
-    Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
-
-    Framebuffer *getTargetFramebuffer(GLenum target) const;
-    GLuint getTargetFramebufferHandle(GLenum target) const;
-    Framebuffer *getReadFramebuffer();
-    Framebuffer *getDrawFramebuffer();
-    VertexArray *getCurrentVertexArray() const;
-    TransformFeedback *getCurrentTransformFeedback() const;
-
-    bool isSampler(GLuint samplerName) const;
-
-    bool getBooleanv(GLenum pname, GLboolean *params);
-    bool getFloatv(GLenum pname, GLfloat *params);
-    bool getIntegerv(GLenum pname, GLint *params);
-    bool getInteger64v(GLenum pname, GLint64 *params);
-
-    bool getIndexedIntegerv(GLenum target, GLuint index, GLint *data);
-    bool getIndexedInteger64v(GLenum target, GLuint index, GLint64 *data);
-
-    bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams);
-    bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams);
-
-    void clear(GLbitfield mask);
-    void clearBufferfv(GLenum buffer, int drawbuffer, const float *values);
-    void clearBufferuiv(GLenum buffer, int drawbuffer, const unsigned int *values);
-    void clearBufferiv(GLenum buffer, int drawbuffer, const int *values);
-    void clearBufferfi(GLenum buffer, int drawbuffer, float depth, int stencil);
-
-    void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
-    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 recordInvalidEnum();
-    void recordInvalidValue();
-    void recordInvalidOperation();
-    void recordOutOfMemory();
-    void recordInvalidFramebufferOperation();
-
-    GLenum getError();
-    GLenum getResetStatus();
-    virtual bool isResetNotificationEnabled();
-
-    virtual int getClientVersion() const;
-
-    int getMajorShaderModel() const;
-    float getMaximumPointSize() const;
-    unsigned int getMaximumCombinedTextureImageUnits() const;
-    unsigned int getMaximumCombinedUniformBufferBindings() const;
-    int getMaximumRenderbufferDimension() const;
-    int getMaximum2DTextureDimension() const;
-    int getMaximumCubeTextureDimension() const;
-    int getMaximum3DTextureDimension() const;
-    int getMaximum2DArrayTextureLayers() const;
-    int getMaximum2DTextureLevel() const;
-    int getMaximumCubeTextureLevel() const;
-    int getMaximum3DTextureLevel() const;
-    int getMaximum2DArrayTextureLevel() const;
-    unsigned int getMaximumRenderTargets() const;
-    GLsizei getMaxSupportedSamples() const;
-    GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
-    GLsizei getNumSampleCounts(GLenum internalFormat) const;
-    void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
-    unsigned int getMaxTransformFeedbackBufferBindings() const;
-    GLintptr getUniformBufferOffsetAlignment() const;
-    const char *getCombinedExtensionsString() const;
-    const char *getExtensionString(const GLuint index) const;
-    unsigned int getNumExtensions() const;
-    const char *getRendererString() const;
-    bool supportsEventQueries() const;
-    bool supportsOcclusionQueries() const;
-    bool supportsBGRATextures() 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 supportsRGTextures() const;
-    bool supportsDepthTextures() const;
-    bool supports32bitIndices() const;
-    bool supportsNonPower2Texture() const;
-    bool supportsInstancing() const;
-    bool supportsTextureFilterAnisotropy() const;
-    bool supportsPBOs() const;
-
-    bool getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type);
-
-    float getTextureMaxAnisotropy() const;
-
-    void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
-                         GLbitfield mask, GLenum filter);
-
-    void invalidateFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments,
-                               GLint x, GLint y, GLsizei width, GLsizei height);
-
-    bool hasMappedBuffer(GLenum target) const;
-
-    rx::Renderer *getRenderer() { return mRenderer; }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Context);
-
-    bool applyRenderTarget(GLenum drawMode, bool ignoreViewport);
-    void applyState(GLenum drawMode);
-    void applyShaders(ProgramBinary *programBinary, bool transformFeedbackActive);
-    void applyTextures(ProgramBinary *programBinary);
-    void applyTextures(ProgramBinary *programBinary, SamplerType type);
-    bool applyUniformBuffers();
-    bool applyTransformFeedbackBuffers();
-    void markTransformFeedbackUsage();
-
-    void detachBuffer(GLuint buffer);
-    void detachTexture(GLuint texture);
-    void detachFramebuffer(GLuint framebuffer);
-    void detachRenderbuffer(GLuint renderbuffer);
-    void detachVertexArray(GLuint vertexArray);
-    void detachTransformFeedback(GLuint transformFeedback);
-    void detachSampler(GLuint sampler);
-
-    void generateSwizzles(ProgramBinary *programBinary);
-    void generateSwizzles(ProgramBinary *programBinary, SamplerType type);
-    bool getCurrentTextureAndSamplerState(ProgramBinary *programBinary, SamplerType type, int index, Texture **outTexture,
-                                   TextureType *outTextureType, SamplerState *outSampler);
-    Texture *getIncompleteTexture(TextureType type);
-
-    bool skipDraw(GLenum drawMode);
-
-    void initExtensionString();
-    void initRendererString();
-
-    typedef std::set&lt;unsigned&gt; FramebufferTextureSerialSet;
-    FramebufferTextureSerialSet getBoundFramebufferTextureSerials();
-
-    rx::Renderer *const mRenderer;
-
-    int mClientVersion;
-
-    State mState;
-
-    BindingPointer&lt;Texture2D&gt; mTexture2DZero;
-    BindingPointer&lt;TextureCubeMap&gt; mTextureCubeMapZero;
-    BindingPointer&lt;Texture3D&gt; mTexture3DZero;
-    BindingPointer&lt;Texture2DArray&gt; mTexture2DArrayZero;
-
-    typedef std::unordered_map&lt;GLuint, Framebuffer*&gt; FramebufferMap;
-    FramebufferMap mFramebufferMap;
-    HandleAllocator mFramebufferHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, FenceNV*&gt; FenceNVMap;
-    FenceNVMap mFenceNVMap;
-    HandleAllocator mFenceNVHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, Query*&gt; QueryMap;
-    QueryMap mQueryMap;
-    HandleAllocator mQueryHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, VertexArray*&gt; VertexArrayMap;
-    VertexArrayMap mVertexArrayMap;
-    HandleAllocator mVertexArrayHandleAllocator;
-
-    BindingPointer&lt;TransformFeedback&gt; mTransformFeedbackZero;
-    typedef std::unordered_map&lt;GLuint, TransformFeedback*&gt; TransformFeedbackMap;
-    TransformFeedbackMap mTransformFeedbackMap;
-    HandleAllocator mTransformFeedbackAllocator;
-
-    std::vector&lt;std::string&gt; mExtensionStringList;
-    const char *mCombinedExtensionsString;
-    const char *mRendererString;
-    
-    BindingPointer&lt;Texture&gt; 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;
-
-    BindingPointer&lt;ProgramBinary&gt; mCurrentProgramBinary;
-    Framebuffer *mBoundDrawFramebuffer;
-
-    int mMajorShaderModel;
-    float mMaximumPointSize;
-    bool mSupportsVertexTexture;
-    bool mSupportsNonPower2Texture;
-    bool mSupportsInstancing;
-    int  mMaxViewportDimension;
-    int  mMaxRenderbufferDimension;
-    int  mMax2DTextureDimension;
-    int  mMaxCubeTextureDimension;
-    int  mMax3DTextureDimension;
-    int  mMax2DArrayTextureLayers;
-    int  mMax2DTextureLevel;
-    int  mMaxCubeTextureLevel;
-    int  mMax3DTextureLevel;
-    int  mMax2DArrayTextureLevel;
-    float mMaxTextureAnisotropy;
-    bool mSupportsEventQueries;
-    bool mSupportsOcclusionQueries;
-    bool mSupportsBGRATextures;
-    bool mSupportsDXT1Textures;
-    bool mSupportsDXT3Textures;
-    bool mSupportsDXT5Textures;
-    bool mSupportsFloat32Textures;
-    bool mSupportsFloat32LinearFilter;
-    bool mSupportsFloat32RenderableTextures;
-    bool mSupportsFloat16Textures;
-    bool mSupportsFloat16LinearFilter;
-    bool mSupportsFloat16RenderableTextures;
-    bool mSupportsLuminanceTextures;
-    bool mSupportsLuminanceAlphaTextures;
-    bool mSupportsRGTextures;
-    bool mSupportsDepthTextures;
-    bool mSupports32bitIndices;
-    bool mSupportsTextureFilterAnisotropy;
-    bool mSupportsPBOs;
-    int mNumCompressedTextureFormats;
-
-    ResourceManager *mResourceManager;
-};
-}
-
-#endif   // INCLUDE_CONTEXT_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2DynamicHLSLcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,1047 +0,0 @@
</span><del>-//
-// Copyright (c) 2014 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.
-//
-// DynamicHLSL.cpp: Implementation for link and run-time HLSL generation
-//
-
-#include &quot;precompiled.h&quot;
-
-#include &quot;libGLESv2/DynamicHLSL.h&quot;
-#include &quot;libGLESv2/Shader.h&quot;
-#include &quot;libGLESv2/Program.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;common/utilities.h&quot;
-#include &quot;libGLESv2/ProgramBinary.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;common/blocklayout.h&quot;
-
-static std::string Str(int i)
-{
-    char buffer[20];
-    snprintf(buffer, sizeof(buffer), &quot;%d&quot;, i);
-    return buffer;
-}
-
-namespace gl_d3d
-{
-
-std::string HLSLComponentTypeString(GLenum componentType)
-{
-    switch (componentType)
-    {
-      case GL_UNSIGNED_INT:         return &quot;uint&quot;;
-      case GL_INT:                  return &quot;int&quot;;
-      case GL_UNSIGNED_NORMALIZED:
-      case GL_SIGNED_NORMALIZED:
-      case GL_FLOAT:                return &quot;float&quot;;
-      default: UNREACHABLE();       return &quot;not-component-type&quot;;
-    }
-}
-
-std::string HLSLComponentTypeString(GLenum componentType, int componentCount)
-{
-    return HLSLComponentTypeString(componentType) + (componentCount &gt; 1 ? Str(componentCount) : &quot;&quot;);
-}
-
-std::string HLSLMatrixTypeString(GLenum type)
-{
-    switch (type)
-    {
-      case GL_FLOAT_MAT2:     return &quot;float2x2&quot;;
-      case GL_FLOAT_MAT3:     return &quot;float3x3&quot;;
-      case GL_FLOAT_MAT4:     return &quot;float4x4&quot;;
-      case GL_FLOAT_MAT2x3:   return &quot;float2x3&quot;;
-      case GL_FLOAT_MAT3x2:   return &quot;float3x2&quot;;
-      case GL_FLOAT_MAT2x4:   return &quot;float2x4&quot;;
-      case GL_FLOAT_MAT4x2:   return &quot;float4x2&quot;;
-      case GL_FLOAT_MAT3x4:   return &quot;float3x4&quot;;
-      case GL_FLOAT_MAT4x3:   return &quot;float4x3&quot;;
-      default: UNREACHABLE(); return &quot;not-matrix-type&quot;;
-    }
-}
-
-std::string HLSLTypeString(GLenum type)
-{
-    if (gl::IsMatrixType(type))
-    {
-        return HLSLMatrixTypeString(type);
-    }
-
-    return HLSLComponentTypeString(gl::UniformComponentType(type), gl::UniformComponentCount(type));
-}
-
-}
-
-namespace gl
-{
-
-std::string ArrayString(unsigned int i)
-{
-    return (i == GL_INVALID_INDEX ? &quot;&quot; : &quot;[&quot; + Str(i) + &quot;]&quot;);
-}
-
-const std::string DynamicHLSL::VERTEX_ATTRIBUTE_STUB_STRING = &quot;@@ VERTEX ATTRIBUTES @@&quot;;
-
-DynamicHLSL::DynamicHLSL(rx::Renderer *const renderer)
-    : mRenderer(renderer)
-{
-}
-
-static bool packVarying(Varying *varying, const int maxVaryingVectors, const ShaderVariable *packing[][4])
-{
-    GLenum transposedType = TransposeMatrixType(varying-&gt;type);
-
-    // matrices within varying structs are not transposed
-    int registers = (varying-&gt;isStruct() ? HLSLVariableRegisterCount(*varying) : VariableRowCount(transposedType)) * varying-&gt;elementCount();
-    int elements = (varying-&gt;isStruct() ? 4 : VariableColumnCount(transposedType));
-    bool success = false;
-
-    if (elements == 2 || elements == 3 || elements == 4)
-    {
-        for (int r = 0; r &lt;= maxVaryingVectors - registers &amp;&amp; !success; r++)
-        {
-            bool available = true;
-
-            for (int y = 0; y &lt; registers &amp;&amp; available; y++)
-            {
-                for (int x = 0; x &lt; elements &amp;&amp; available; x++)
-                {
-                    if (packing[r + y][x])
-                    {
-                        available = false;
-                    }
-                }
-            }
-
-            if (available)
-            {
-                varying-&gt;registerIndex = r;
-                varying-&gt;elementIndex = 0;
-
-                for (int y = 0; y &lt; registers; y++)
-                {
-                    for (int x = 0; x &lt; elements; x++)
-                    {
-                        packing[r + y][x] = &amp;*varying;
-                    }
-                }
-
-                success = true;
-            }
-        }
-
-        if (!success &amp;&amp; elements == 2)
-        {
-            for (int r = maxVaryingVectors - registers; r &gt;= 0 &amp;&amp; !success; r--)
-            {
-                bool available = true;
-
-                for (int y = 0; y &lt; registers &amp;&amp; available; y++)
-                {
-                    for (int x = 2; x &lt; 4 &amp;&amp; available; x++)
-                    {
-                        if (packing[r + y][x])
-                        {
-                            available = false;
-                        }
-                    }
-                }
-
-                if (available)
-                {
-                    varying-&gt;registerIndex = r;
-                    varying-&gt;elementIndex = 2;
-
-                    for (int y = 0; y &lt; registers; y++)
-                    {
-                        for (int x = 2; x &lt; 4; x++)
-                        {
-                            packing[r + y][x] = &amp;*varying;
-                        }
-                    }
-
-                    success = true;
-                }
-            }
-        }
-    }
-    else if (elements == 1)
-    {
-        int space[4] = { 0 };
-
-        for (int y = 0; y &lt; maxVaryingVectors; y++)
-        {
-            for (int x = 0; x &lt; 4; x++)
-            {
-                space[x] += packing[y][x] ? 0 : 1;
-            }
-        }
-
-        int column = 0;
-
-        for (int x = 0; x &lt; 4; x++)
-        {
-            if (space[x] &gt;= registers &amp;&amp; space[x] &lt; space[column])
-            {
-                column = x;
-            }
-        }
-
-        if (space[column] &gt;= registers)
-        {
-            for (int r = 0; r &lt; maxVaryingVectors; r++)
-            {
-                if (!packing[r][column])
-                {
-                    varying-&gt;registerIndex = r;
-
-                    for (int y = r; y &lt; r + registers; y++)
-                    {
-                        packing[y][column] = &amp;*varying;
-                    }
-
-                    break;
-                }
-            }
-
-            varying-&gt;elementIndex = column;
-
-            success = true;
-        }
-    }
-    else UNREACHABLE();
-
-    return success;
-}
-
-// 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 DynamicHLSL::packVaryings(InfoLog &amp;infoLog, const ShaderVariable *packing[][4], FragmentShader *fragmentShader,
-                              VertexShader *vertexShader, const std::vector&lt;std::string&gt;&amp; transformFeedbackVaryings)
-{
-    const int maxVaryingVectors = mRenderer-&gt;getMaxVaryingVectors();
-
-    vertexShader-&gt;resetVaryingsRegisterAssignment();
-    fragmentShader-&gt;resetVaryingsRegisterAssignment();
-
-    std::set&lt;std::string&gt; packedVaryings;
-
-    for (unsigned int varyingIndex = 0; varyingIndex &lt; fragmentShader-&gt;mVaryings.size(); varyingIndex++)
-    {
-        Varying *varying = &amp;fragmentShader-&gt;mVaryings[varyingIndex];
-        if (packVarying(varying, maxVaryingVectors, packing))
-        {
-            packedVaryings.insert(varying-&gt;name);
-        }
-        else
-        {
-            infoLog.append(&quot;Could not pack varying %s&quot;, varying-&gt;name.c_str());
-            return -1;
-        }
-    }
-
-    for (unsigned int feedbackVaryingIndex = 0; feedbackVaryingIndex &lt; transformFeedbackVaryings.size(); feedbackVaryingIndex++)
-    {
-        const std::string &amp;transformFeedbackVarying = transformFeedbackVaryings[feedbackVaryingIndex];
-        if (packedVaryings.find(transformFeedbackVarying) == packedVaryings.end())
-        {
-            bool found = false;
-            for (unsigned int varyingIndex = 0; varyingIndex &lt; vertexShader-&gt;mVaryings.size(); varyingIndex++)
-            {
-                Varying *varying = &amp;vertexShader-&gt;mVaryings[varyingIndex];
-                if (transformFeedbackVarying == varying-&gt;name)
-                {
-                    if (!packVarying(varying, maxVaryingVectors, packing))
-                    {
-                        infoLog.append(&quot;Could not pack varying %s&quot;, varying-&gt;name.c_str());
-                        return -1;
-                    }
-
-                    found = true;
-                    break;
-                }
-            }
-
-            if (!found &amp;&amp; transformFeedbackVarying != &quot;gl_Position&quot; &amp;&amp; transformFeedbackVarying != &quot;gl_PointSize&quot;)
-            {
-                infoLog.append(&quot;Transform feedback varying %s does not exist in the vertex shader.&quot;, transformFeedbackVarying.c_str());
-                return -1;
-            }
-        }
-    }
-
-    // Return the number of used registers
-    int registers = 0;
-
-    for (int r = 0; r &lt; maxVaryingVectors; r++)
-    {
-        if (packing[r][0] || packing[r][1] || packing[r][2] || packing[r][3])
-        {
-            registers++;
-        }
-    }
-
-    return registers;
-}
-
-std::string DynamicHLSL::generateVaryingHLSL(VertexShader *shader, const std::string &amp;varyingSemantic,
-                                             std::vector&lt;LinkedVarying&gt; *linkedVaryings) const
-{
-    std::string varyingHLSL;
-
-    for (unsigned int varyingIndex = 0; varyingIndex &lt; shader-&gt;mVaryings.size(); varyingIndex++)
-    {
-        Varying *varying = &amp;shader-&gt;mVaryings[varyingIndex];
-        if (varying-&gt;registerAssigned())
-        {
-            GLenum transposedType = TransposeMatrixType(varying-&gt;type);
-            int variableRows = (varying-&gt;isStruct() ? 1 : VariableRowCount(transposedType));
-
-            for (unsigned int elementIndex = 0; elementIndex &lt; varying-&gt;elementCount(); elementIndex++)
-            {
-                for (int row = 0; row &lt; variableRows; row++)
-                {
-                    switch (varying-&gt;interpolation)
-                    {
-                      case INTERPOLATION_SMOOTH:   varyingHLSL += &quot;    &quot;;                 break;
-                      case INTERPOLATION_FLAT:     varyingHLSL += &quot;    nointerpolation &quot;; break;
-                      case INTERPOLATION_CENTROID: varyingHLSL += &quot;    centroid &quot;;        break;
-                      default:  UNREACHABLE();
-                    }
-
-                    unsigned int semanticIndex = elementIndex * variableRows + varying-&gt;registerIndex + row;
-                    std::string n = Str(semanticIndex);
-
-                    std::string typeString;
-
-                    if (varying-&gt;isStruct())
-                    {
-                        // matrices within structs are not transposed, so
-                        // do not use the special struct prefix &quot;rm&quot;
-                        typeString = decorateVariable(varying-&gt;structName);
-                    }
-                    else
-                    {
-                        GLenum componentType = UniformComponentType(transposedType);
-                        int columnCount = VariableColumnCount(transposedType);
-                        typeString = gl_d3d::HLSLComponentTypeString(componentType, columnCount);
-                    }
-                    varyingHLSL += typeString + &quot; v&quot; + n + &quot; : &quot; + varyingSemantic + n + &quot;;\n&quot;;
-                }
-            }
-
-            if (linkedVaryings)
-            {
-                linkedVaryings-&gt;push_back(LinkedVarying(varying-&gt;name, varying-&gt;type, varying-&gt;elementCount(),
-                                                        varyingSemantic, varying-&gt;registerIndex,
-                                                        variableRows * varying-&gt;elementCount()));
-            }
-        }
-    }
-
-    return varyingHLSL;
-}
-
-std::string DynamicHLSL::generateInputLayoutHLSL(const VertexFormat inputLayout[], const Attribute shaderAttributes[]) const
-{
-    std::string structHLSL, initHLSL;
-
-    int semanticIndex = 0;
-    unsigned int inputIndex = 0;
-
-    for (unsigned int attributeIndex = 0; attributeIndex &lt; MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        ASSERT(inputIndex &lt; MAX_VERTEX_ATTRIBS);
-
-        const VertexFormat &amp;vertexFormat = inputLayout[inputIndex];
-        const Attribute &amp;shaderAttribute = shaderAttributes[attributeIndex];
-
-        if (!shaderAttribute.name.empty())
-        {
-            // HLSL code for input structure
-            if (IsMatrixType(shaderAttribute.type))
-            {
-                // Matrix types are always transposed
-                structHLSL += &quot;    &quot; + gl_d3d::HLSLMatrixTypeString(TransposeMatrixType(shaderAttribute.type));
-            }
-            else
-            {
-                GLenum componentType = mRenderer-&gt;getVertexComponentType(vertexFormat);
-                structHLSL += &quot;    &quot; + gl_d3d::HLSLComponentTypeString(componentType, UniformComponentCount(shaderAttribute.type));
-            }
-
-            structHLSL += &quot; &quot; + decorateVariable(shaderAttribute.name) + &quot; : TEXCOORD&quot; + Str(semanticIndex) + &quot;;\n&quot;;
-            semanticIndex += AttributeRegisterCount(shaderAttribute.type);
-
-            // HLSL code for initialization
-            initHLSL += &quot;    &quot; + decorateVariable(shaderAttribute.name) + &quot; = &quot;;
-
-            // Mismatched vertex attribute to vertex input may result in an undefined
-            // data reinterpretation (eg for pure integer-&gt;float, float-&gt;pure integer)
-            // TODO: issue warning with gl debug info extension, when supported
-            if (IsMatrixType(shaderAttribute.type) ||
-                (mRenderer-&gt;getVertexConversionType(vertexFormat) &amp; rx::VERTEX_CONVERT_GPU) != 0)
-            {
-                initHLSL += generateAttributeConversionHLSL(vertexFormat, shaderAttribute);
-            }
-            else
-            {
-                initHLSL += &quot;input.&quot; + decorateVariable(shaderAttribute.name);
-            }
-
-            initHLSL += &quot;;\n&quot;;
-
-            inputIndex += VariableRowCount(TransposeMatrixType(shaderAttribute.type));
-        }
-    }
-
-    return &quot;struct VS_INPUT\n&quot;
-           &quot;{\n&quot; +
-           structHLSL +
-           &quot;};\n&quot;
-           &quot;\n&quot;
-           &quot;void initAttributes(VS_INPUT input)\n&quot;
-           &quot;{\n&quot; +
-           initHLSL +
-           &quot;}\n&quot;;
-}
-
-bool DynamicHLSL::generateShaderLinkHLSL(InfoLog &amp;infoLog, int registers, const ShaderVariable *packing[][4],
-                                         std::string&amp; pixelHLSL, std::string&amp; vertexHLSL,
-                                         FragmentShader *fragmentShader, VertexShader *vertexShader,
-                                         const std::vector&lt;std::string&gt;&amp; transformFeedbackVaryings,
-                                         std::vector&lt;LinkedVarying&gt; *linkedVaryings,
-                                         std::map&lt;int, VariableLocation&gt; *programOutputVars) const
-{
-    if (pixelHLSL.empty() || vertexHLSL.empty())
-    {
-        return false;
-    }
-
-    bool usesMRT = fragmentShader-&gt;mUsesMultipleRenderTargets;
-    bool usesFragColor = fragmentShader-&gt;mUsesFragColor;
-    bool usesFragData = fragmentShader-&gt;mUsesFragData;
-    if (usesFragColor &amp;&amp; usesFragData)
-    {
-        infoLog.append(&quot;Cannot use both gl_FragColor and gl_FragData in the same fragment shader.&quot;);
-        return false;
-    }
-
-    // Write the HLSL input/output declarations
-    const int shaderModel = mRenderer-&gt;getMajorShaderModel();
-    const int maxVaryingVectors = mRenderer-&gt;getMaxVaryingVectors();
-
-    const int registersNeeded = registers + (fragmentShader-&gt;mUsesFragCoord ? 1 : 0) + (fragmentShader-&gt;mUsesPointCoord ? 1 : 0);
-
-    // Two cases when writing to gl_FragColor and using ESSL 1.0:
-    // - with a 3.0 context, the output color is copied to channel 0
-    // - with a 2.0 context, the output color is broadcast to all channels
-    const bool broadcast = (fragmentShader-&gt;mUsesFragColor &amp;&amp; mRenderer-&gt;getCurrentClientVersion() &lt; 3);
-    const unsigned int numRenderTargets = (broadcast || usesMRT ? mRenderer-&gt;getMaxRenderTargets() : 1);
-
-    int shaderVersion = vertexShader-&gt;getShaderVersion();
-
-    if (registersNeeded &gt; maxVaryingVectors)
-    {
-        infoLog.append(&quot;No varying registers left to support gl_FragCoord/gl_PointCoord&quot;);
-
-        return false;
-    }
-
-    std::string varyingSemantic = (vertexShader-&gt;mUsesPointSize &amp;&amp; shaderModel == 3) ? &quot;COLOR&quot; : &quot;TEXCOORD&quot;;
-    std::string targetSemantic = (shaderModel &gt;= 4) ? &quot;SV_Target&quot; : &quot;COLOR&quot;;
-    std::string dxPositionSemantic = (shaderModel &gt;= 4) ? &quot;SV_Position&quot; : &quot;POSITION&quot;;
-    std::string depthSemantic = (shaderModel &gt;= 4) ? &quot;SV_Depth&quot; : &quot;DEPTH&quot;;
-
-    std::string varyingHLSL = generateVaryingHLSL(vertexShader, varyingSemantic, linkedVaryings);
-
-    // special varyings that use reserved registers
-    int reservedRegisterIndex = registers;
-
-    unsigned int glPositionSemanticIndex = reservedRegisterIndex++;
-    std::string glPositionSemantic = varyingSemantic;
-
-    std::string fragCoordSemantic;
-    unsigned int fragCoordSemanticIndex = 0;
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        fragCoordSemanticIndex = reservedRegisterIndex++;
-        fragCoordSemantic = varyingSemantic;
-    }
-
-    std::string pointCoordSemantic;
-    unsigned int pointCoordSemanticIndex = 0;
-    if (fragmentShader-&gt;mUsesPointCoord)
-    {
-        // Shader model 3 uses a special TEXCOORD semantic for point sprite texcoords.
-        // In DX11 we compute this in the GS.
-        if (shaderModel == 3)
-        {
-            pointCoordSemanticIndex = 0;
-            pointCoordSemantic = &quot;TEXCOORD0&quot;;
-        }
-        else if (shaderModel &gt;= 4)
-        {
-            pointCoordSemanticIndex = reservedRegisterIndex++;
-            pointCoordSemantic = varyingSemantic;
-        }
-    }
-
-    // Add stub string to be replaced when shader is dynamically defined by its layout
-    vertexHLSL += &quot;\n&quot; + VERTEX_ATTRIBUTE_STUB_STRING + &quot;\n&quot;;
-
-    vertexHLSL += &quot;struct VS_OUTPUT\n&quot;
-                  &quot;{\n&quot;;
-
-    if (shaderModel &lt; 4)
-    {
-        vertexHLSL += &quot;    float4 _dx_Position : &quot; + dxPositionSemantic + &quot;;\n&quot;;
-        vertexHLSL += &quot;    float4 gl_Position : &quot; + glPositionSemantic + Str(glPositionSemanticIndex) + &quot;;\n&quot;;
-        linkedVaryings-&gt;push_back(LinkedVarying(&quot;gl_Position&quot;, GL_FLOAT_VEC4, 1, glPositionSemantic, glPositionSemanticIndex, 1));
-
-    }
-
-    vertexHLSL += varyingHLSL;
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        vertexHLSL += &quot;    float4 gl_FragCoord : &quot; + fragCoordSemantic + Str(fragCoordSemanticIndex) + &quot;;\n&quot;;
-        linkedVaryings-&gt;push_back(LinkedVarying(&quot;gl_FragCoord&quot;, GL_FLOAT_VEC4, 1, fragCoordSemantic, fragCoordSemanticIndex, 1));
-    }
-
-    if (vertexShader-&gt;mUsesPointSize &amp;&amp; shaderModel &gt;= 3)
-    {
-        vertexHLSL += &quot;    float gl_PointSize : PSIZE;\n&quot;;
-        linkedVaryings-&gt;push_back(LinkedVarying(&quot;gl_PointSize&quot;, GL_FLOAT, 1, &quot;PSIZE&quot;, 0, 1));
-    }
-
-    if (shaderModel &gt;= 4)
-    {
-        vertexHLSL += &quot;    float4 _dx_Position : &quot; + dxPositionSemantic + &quot;;\n&quot;;
-        vertexHLSL += &quot;    float4 gl_Position : &quot; + glPositionSemantic + Str(glPositionSemanticIndex) + &quot;;\n&quot;;
-        linkedVaryings-&gt;push_back(LinkedVarying(&quot;gl_Position&quot;, GL_FLOAT_VEC4, 1, glPositionSemantic, glPositionSemanticIndex, 1));
-    }
-
-    vertexHLSL += &quot;};\n&quot;
-                  &quot;\n&quot;
-                  &quot;VS_OUTPUT main(VS_INPUT input)\n&quot;
-                  &quot;{\n&quot;
-                  &quot;    initAttributes(input);\n&quot;;
-
-    if (shaderModel &gt;= 4)
-    {
-        vertexHLSL += &quot;\n&quot;
-                      &quot;    gl_main();\n&quot;
-                      &quot;\n&quot;
-                      &quot;    VS_OUTPUT output;\n&quot;
-                      &quot;    output.gl_Position = gl_Position;\n&quot;
-                      &quot;    output._dx_Position.x = gl_Position.x;\n&quot;
-                      &quot;    output._dx_Position.y = -gl_Position.y;\n&quot;
-                      &quot;    output._dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n&quot;
-                      &quot;    output._dx_Position.w = gl_Position.w;\n&quot;;
-    }
-    else
-    {
-        vertexHLSL += &quot;\n&quot;
-                      &quot;    gl_main();\n&quot;
-                      &quot;\n&quot;
-                      &quot;    VS_OUTPUT output;\n&quot;
-                      &quot;    output.gl_Position = gl_Position;\n&quot;
-                      &quot;    output._dx_Position.x = gl_Position.x * dx_ViewAdjust.z + dx_ViewAdjust.x * gl_Position.w;\n&quot;
-                      &quot;    output._dx_Position.y = -(gl_Position.y * dx_ViewAdjust.w + dx_ViewAdjust.y * gl_Position.w);\n&quot;
-                      &quot;    output._dx_Position.z = (gl_Position.z + gl_Position.w) * 0.5;\n&quot;
-                      &quot;    output._dx_Position.w = gl_Position.w;\n&quot;;
-    }
-
-    if (vertexShader-&gt;mUsesPointSize &amp;&amp; shaderModel &gt;= 3)
-    {
-        vertexHLSL += &quot;    output.gl_PointSize = gl_PointSize;\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        vertexHLSL += &quot;    output.gl_FragCoord = gl_Position;\n&quot;;
-    }
-
-    for (unsigned int vertVaryingIndex = 0; vertVaryingIndex &lt; vertexShader-&gt;mVaryings.size(); vertVaryingIndex++)
-    {
-        Varying *varying = &amp;vertexShader-&gt;mVaryings[vertVaryingIndex];
-        if (varying-&gt;registerAssigned())
-        {
-            for (unsigned int elementIndex = 0; elementIndex &lt; varying-&gt;elementCount(); elementIndex++)
-            {
-                int variableRows = (varying-&gt;isStruct() ? 1 : VariableRowCount(TransposeMatrixType(varying-&gt;type)));
-
-                for (int row = 0; row &lt; variableRows; row++)
-                {
-                    int r = varying-&gt;registerIndex + elementIndex * variableRows + row;
-                    vertexHLSL += &quot;    output.v&quot; + Str(r);
-
-                    bool sharedRegister = false;   // Register used by multiple varyings
-
-                    for (int x = 0; x &lt; 4; x++)
-                    {
-                        if (packing[r][x] &amp;&amp; packing[r][x] != packing[r][0])
-                        {
-                            sharedRegister = true;
-                            break;
-                        }
-                    }
-
-                    if(sharedRegister)
-                    {
-                        vertexHLSL += &quot;.&quot;;
-
-                        for (int x = 0; x &lt; 4; x++)
-                        {
-                            if (packing[r][x] == &amp;*varying)
-                            {
-                                switch(x)
-                                {
-                                  case 0: vertexHLSL += &quot;x&quot;; break;
-                                  case 1: vertexHLSL += &quot;y&quot;; break;
-                                  case 2: vertexHLSL += &quot;z&quot;; break;
-                                  case 3: vertexHLSL += &quot;w&quot;; break;
-                                }
-                            }
-                        }
-                    }
-
-                    vertexHLSL += &quot; = _&quot; + varying-&gt;name;
-
-                    if (varying-&gt;isArray())
-                    {
-                        vertexHLSL += ArrayString(elementIndex);
-                    }
-
-                    if (variableRows &gt; 1)
-                    {
-                        vertexHLSL += ArrayString(row);
-                    }
-
-                    vertexHLSL += &quot;;\n&quot;;
-                }
-            }
-        }
-    }
-
-    vertexHLSL += &quot;\n&quot;
-                  &quot;    return output;\n&quot;
-                  &quot;}\n&quot;;
-
-    pixelHLSL += &quot;struct PS_INPUT\n&quot;
-                 &quot;{\n&quot;;
-
-    pixelHLSL += varyingHLSL;
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        pixelHLSL += &quot;    float4 gl_FragCoord : &quot; + fragCoordSemantic + Str(fragCoordSemanticIndex) + &quot;;\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesPointCoord &amp;&amp; shaderModel &gt;= 3)
-    {
-        pixelHLSL += &quot;    float2 gl_PointCoord : &quot; + pointCoordSemantic + Str(pointCoordSemanticIndex) + &quot;;\n&quot;;
-    }
-
-    // Must consume the PSIZE element if the geometry shader is not active
-    // We won't know if we use a GS until we draw
-    if (vertexShader-&gt;mUsesPointSize &amp;&amp; shaderModel &gt;= 4)
-    {
-        pixelHLSL += &quot;    float gl_PointSize : PSIZE;\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        if (shaderModel &gt;= 4)
-        {
-            pixelHLSL += &quot;    float4 dx_VPos : SV_Position;\n&quot;;
-        }
-        else if (shaderModel &gt;= 3)
-        {
-            pixelHLSL += &quot;    float2 dx_VPos : VPOS;\n&quot;;
-        }
-    }
-
-    pixelHLSL += &quot;};\n&quot;
-                 &quot;\n&quot;
-                 &quot;struct PS_OUTPUT\n&quot;
-                 &quot;{\n&quot;;
-
-    if (shaderVersion &lt; 300)
-    {
-        for (unsigned int renderTargetIndex = 0; renderTargetIndex &lt; numRenderTargets; renderTargetIndex++)
-        {
-            pixelHLSL += &quot;    float4 gl_Color&quot; + Str(renderTargetIndex) + &quot; : &quot; + targetSemantic + Str(renderTargetIndex) + &quot;;\n&quot;;
-        }
-
-        if (fragmentShader-&gt;mUsesFragDepth)
-        {
-            pixelHLSL += &quot;    float gl_Depth : &quot; + depthSemantic + &quot;;\n&quot;;
-        }
-    }
-    else
-    {
-        defineOutputVariables(fragmentShader, programOutputVars);
-
-        const std::vector&lt;Attribute&gt; &amp;shaderOutputVars = fragmentShader-&gt;getOutputVariables();
-        for (auto locationIt = programOutputVars-&gt;begin(); locationIt != programOutputVars-&gt;end(); locationIt++)
-        {
-            const VariableLocation &amp;outputLocation = locationIt-&gt;second;
-            const ShaderVariable &amp;outputVariable = shaderOutputVars[outputLocation.index];
-            const std::string &amp;elementString = (outputLocation.element == GL_INVALID_INDEX ? &quot;&quot; : Str(outputLocation.element));
-
-            pixelHLSL += &quot;    &quot; + gl_d3d::HLSLTypeString(outputVariable.type) +
-                         &quot; out_&quot; + outputLocation.name + elementString +
-                         &quot; : &quot; + targetSemantic + Str(locationIt-&gt;first) + &quot;;\n&quot;;
-        }
-    }
-
-    pixelHLSL += &quot;};\n&quot;
-                 &quot;\n&quot;;
-
-    if (fragmentShader-&gt;mUsesFrontFacing)
-    {
-        if (shaderModel &gt;= 4)
-        {
-            pixelHLSL += &quot;PS_OUTPUT main(PS_INPUT input, bool isFrontFace : SV_IsFrontFace)\n&quot;
-                         &quot;{\n&quot;;
-        }
-        else
-        {
-            pixelHLSL += &quot;PS_OUTPUT main(PS_INPUT input, float vFace : VFACE)\n&quot;
-                         &quot;{\n&quot;;
-        }
-    }
-    else
-    {
-        pixelHLSL += &quot;PS_OUTPUT main(PS_INPUT input)\n&quot;
-                     &quot;{\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        pixelHLSL += &quot;    float rhw = 1.0 / input.gl_FragCoord.w;\n&quot;;
-
-        if (shaderModel &gt;= 4)
-        {
-            pixelHLSL += &quot;    gl_FragCoord.x = input.dx_VPos.x;\n&quot;
-                         &quot;    gl_FragCoord.y = input.dx_VPos.y;\n&quot;;
-        }
-        else if (shaderModel &gt;= 3)
-        {
-            pixelHLSL += &quot;    gl_FragCoord.x = input.dx_VPos.x + 0.5;\n&quot;
-                         &quot;    gl_FragCoord.y = input.dx_VPos.y + 0.5;\n&quot;;
-        }
-        else
-        {
-            // dx_ViewCoords contains the viewport width/2, height/2, center.x and center.y. See Renderer::setViewport()
-            pixelHLSL += &quot;    gl_FragCoord.x = (input.gl_FragCoord.x * rhw) * dx_ViewCoords.x + dx_ViewCoords.z;\n&quot;
-                         &quot;    gl_FragCoord.y = (input.gl_FragCoord.y * rhw) * dx_ViewCoords.y + dx_ViewCoords.w;\n&quot;;
-        }
-
-        pixelHLSL += &quot;    gl_FragCoord.z = (input.gl_FragCoord.z * rhw) * dx_DepthFront.x + dx_DepthFront.y;\n&quot;
-                     &quot;    gl_FragCoord.w = rhw;\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesPointCoord &amp;&amp; shaderModel &gt;= 3)
-    {
-        pixelHLSL += &quot;    gl_PointCoord.x = input.gl_PointCoord.x;\n&quot;;
-        pixelHLSL += &quot;    gl_PointCoord.y = 1.0 - input.gl_PointCoord.y;\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesFrontFacing)
-    {
-        if (shaderModel &lt;= 3)
-        {
-            pixelHLSL += &quot;    gl_FrontFacing = (vFace * dx_DepthFront.z &gt;= 0.0);\n&quot;;
-        }
-        else
-        {
-            pixelHLSL += &quot;    gl_FrontFacing = isFrontFace;\n&quot;;
-        }
-    }
-
-    for (unsigned int varyingIndex = 0; varyingIndex &lt; fragmentShader-&gt;mVaryings.size(); varyingIndex++)
-    {
-        Varying *varying = &amp;fragmentShader-&gt;mVaryings[varyingIndex];
-        if (varying-&gt;registerAssigned())
-        {
-            for (unsigned int elementIndex = 0; elementIndex &lt; varying-&gt;elementCount(); elementIndex++)
-            {
-                GLenum transposedType = TransposeMatrixType(varying-&gt;type);
-                int variableRows = (varying-&gt;isStruct() ? 1 : VariableRowCount(transposedType));
-                for (int row = 0; row &lt; variableRows; row++)
-                {
-                    std::string n = Str(varying-&gt;registerIndex + elementIndex * variableRows + row);
-                    pixelHLSL += &quot;    _&quot; + varying-&gt;name;
-
-                    if (varying-&gt;isArray())
-                    {
-                        pixelHLSL += ArrayString(elementIndex);
-                    }
-
-                    if (variableRows &gt; 1)
-                    {
-                        pixelHLSL += ArrayString(row);
-                    }
-
-                    if (varying-&gt;isStruct())
-                    {
-                        pixelHLSL += &quot; = input.v&quot; + n + &quot;;\n&quot;;   break;
-                    }
-                    else
-                    {
-                        switch (VariableColumnCount(transposedType))
-                        {
-                          case 1: pixelHLSL += &quot; = input.v&quot; + n + &quot;.x;\n&quot;;   break;
-                          case 2: pixelHLSL += &quot; = input.v&quot; + n + &quot;.xy;\n&quot;;  break;
-                          case 3: pixelHLSL += &quot; = input.v&quot; + n + &quot;.xyz;\n&quot;; break;
-                          case 4: pixelHLSL += &quot; = input.v&quot; + n + &quot;;\n&quot;;     break;
-                          default: UNREACHABLE();
-                        }
-                    }
-                }
-            }
-        }
-        else UNREACHABLE();
-    }
-
-    pixelHLSL += &quot;\n&quot;
-                 &quot;    gl_main();\n&quot;
-                 &quot;\n&quot;
-                 &quot;    PS_OUTPUT output;\n&quot;;
-
-    if (shaderVersion &lt; 300)
-    {
-        for (unsigned int renderTargetIndex = 0; renderTargetIndex &lt; numRenderTargets; renderTargetIndex++)
-        {
-            unsigned int sourceColorIndex = broadcast ? 0 : renderTargetIndex;
-
-            pixelHLSL += &quot;    output.gl_Color&quot; + Str(renderTargetIndex) + &quot; = gl_Color[&quot; + Str(sourceColorIndex) + &quot;];\n&quot;;
-        }
-
-        if (fragmentShader-&gt;mUsesFragDepth)
-        {
-            pixelHLSL += &quot;    output.gl_Depth = gl_Depth;\n&quot;;
-        }
-    }
-    else
-    {
-        for (auto locationIt = programOutputVars-&gt;begin(); locationIt != programOutputVars-&gt;end(); locationIt++)
-        {
-            const VariableLocation &amp;outputLocation = locationIt-&gt;second;
-            const std::string &amp;variableName = &quot;out_&quot; + outputLocation.name;
-            const std::string &amp;outVariableName = variableName + (outputLocation.element == GL_INVALID_INDEX ? &quot;&quot; : Str(outputLocation.element));
-            const std::string &amp;staticVariableName = variableName + ArrayString(outputLocation.element);
-
-            pixelHLSL += &quot;    output.&quot; + outVariableName + &quot; = &quot; + staticVariableName + &quot;;\n&quot;;
-        }
-    }
-
-    pixelHLSL += &quot;\n&quot;
-                 &quot;    return output;\n&quot;
-                 &quot;}\n&quot;;
-
-    return true;
-}
-
-void DynamicHLSL::defineOutputVariables(FragmentShader *fragmentShader, std::map&lt;int, VariableLocation&gt; *programOutputVars) const
-{
-    const std::vector&lt;Attribute&gt; &amp;shaderOutputVars = fragmentShader-&gt;getOutputVariables();
-
-    for (unsigned int outputVariableIndex = 0; outputVariableIndex &lt; shaderOutputVars.size(); outputVariableIndex++)
-    {
-        const Attribute &amp;outputVariable = shaderOutputVars[outputVariableIndex];
-        const int baseLocation = outputVariable.location == -1 ? 0 : outputVariable.location;
-
-        if (outputVariable.arraySize &gt; 0)
-        {
-            for (unsigned int elementIndex = 0; elementIndex &lt; outputVariable.arraySize; elementIndex++)
-            {
-                const int location = baseLocation + elementIndex;
-                ASSERT(programOutputVars-&gt;count(location) == 0);
-                (*programOutputVars)[location] = VariableLocation(outputVariable.name, elementIndex, outputVariableIndex);
-            }
-        }
-        else
-        {
-            ASSERT(programOutputVars-&gt;count(baseLocation) == 0);
-            (*programOutputVars)[baseLocation] = VariableLocation(outputVariable.name, GL_INVALID_INDEX, outputVariableIndex);
-        }
-    }
-}
-
-std::string DynamicHLSL::generateGeometryShaderHLSL(int registers, const ShaderVariable *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const
-{
-    // for now we only handle point sprite emulation
-    ASSERT(vertexShader-&gt;mUsesPointSize &amp;&amp; mRenderer-&gt;getMajorShaderModel() &gt;= 4);
-    return generatePointSpriteHLSL(registers, packing, fragmentShader, vertexShader);
-}
-
-std::string DynamicHLSL::generatePointSpriteHLSL(int registers, const ShaderVariable *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const
-{
-    ASSERT(registers &gt;= 0);
-    ASSERT(vertexShader-&gt;mUsesPointSize);
-    ASSERT(mRenderer-&gt;getMajorShaderModel() &gt;= 4);
-
-    std::string geomHLSL;
-
-    std::string varyingSemantic = &quot;TEXCOORD&quot;;
-
-    std::string fragCoordSemantic;
-    std::string pointCoordSemantic;
-
-    int reservedRegisterIndex = registers;
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        fragCoordSemantic = varyingSemantic + Str(reservedRegisterIndex++);
-    }
-
-    if (fragmentShader-&gt;mUsesPointCoord)
-    {
-        pointCoordSemantic = varyingSemantic + Str(reservedRegisterIndex++);
-    }
-
-    geomHLSL += &quot;uniform float4 dx_ViewCoords : register(c1);\n&quot;
-                &quot;\n&quot;
-                &quot;struct GS_INPUT\n&quot;
-                &quot;{\n&quot;;
-
-    std::string varyingHLSL = generateVaryingHLSL(vertexShader, varyingSemantic, NULL);
-
-    geomHLSL += varyingHLSL;
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        geomHLSL += &quot;    float4 gl_FragCoord : &quot; + fragCoordSemantic + &quot;;\n&quot;;
-    }
-
-    geomHLSL += &quot;    float gl_PointSize : PSIZE;\n&quot;
-                &quot;    float4 gl_Position : SV_Position;\n&quot;
-                &quot;};\n&quot;
-                &quot;\n&quot;
-                &quot;struct GS_OUTPUT\n&quot;
-                &quot;{\n&quot;;
-
-    geomHLSL += varyingHLSL;
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        geomHLSL += &quot;    float4 gl_FragCoord : &quot; + fragCoordSemantic + &quot;;\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesPointCoord)
-    {
-        geomHLSL += &quot;    float2 gl_PointCoord : &quot; + pointCoordSemantic + &quot;;\n&quot;;
-    }
-
-    geomHLSL +=   &quot;    float gl_PointSize : PSIZE;\n&quot;
-                  &quot;    float4 gl_Position : SV_Position;\n&quot;
-                  &quot;};\n&quot;
-                  &quot;\n&quot;
-                  &quot;static float2 pointSpriteCorners[] = \n&quot;
-                  &quot;{\n&quot;
-                  &quot;    float2( 0.5f, -0.5f),\n&quot;
-                  &quot;    float2( 0.5f,  0.5f),\n&quot;
-                  &quot;    float2(-0.5f, -0.5f),\n&quot;
-                  &quot;    float2(-0.5f,  0.5f)\n&quot;
-                  &quot;};\n&quot;
-                  &quot;\n&quot;
-                  &quot;static float2 pointSpriteTexcoords[] = \n&quot;
-                  &quot;{\n&quot;
-                  &quot;    float2(1.0f, 1.0f),\n&quot;
-                  &quot;    float2(1.0f, 0.0f),\n&quot;
-                  &quot;    float2(0.0f, 1.0f),\n&quot;
-                  &quot;    float2(0.0f, 0.0f)\n&quot;
-                  &quot;};\n&quot;
-                  &quot;\n&quot;
-                  &quot;static float minPointSize = &quot; + Str(ALIASED_POINT_SIZE_RANGE_MIN) + &quot;.0f;\n&quot;
-                  &quot;static float maxPointSize = &quot; + Str(mRenderer-&gt;getMaxPointSize()) + &quot;.0f;\n&quot;
-                  &quot;\n&quot;
-                  &quot;[maxvertexcount(4)]\n&quot;
-                  &quot;void main(point GS_INPUT input[1], inout TriangleStream&lt;GS_OUTPUT&gt; outStream)\n&quot;
-                  &quot;{\n&quot;
-                  &quot;    GS_OUTPUT output = (GS_OUTPUT)0;\n&quot;
-                  &quot;    output.gl_PointSize = input[0].gl_PointSize;\n&quot;;
-
-    for (int r = 0; r &lt; registers; r++)
-    {
-        geomHLSL += &quot;    output.v&quot; + Str(r) + &quot; = input[0].v&quot; + Str(r) + &quot;;\n&quot;;
-    }
-
-    if (fragmentShader-&gt;mUsesFragCoord)
-    {
-        geomHLSL += &quot;    output.gl_FragCoord = input[0].gl_FragCoord;\n&quot;;
-    }
-
-    geomHLSL += &quot;    \n&quot;
-                &quot;    float gl_PointSize = clamp(input[0].gl_PointSize, minPointSize, maxPointSize);\n&quot;
-                &quot;    float4 gl_Position = input[0].gl_Position;\n&quot;
-                &quot;    float2 viewportScale = float2(1.0f / dx_ViewCoords.x, 1.0f / dx_ViewCoords.y) * gl_Position.w;\n&quot;;
-
-    for (int corner = 0; corner &lt; 4; corner++)
-    {
-        geomHLSL += &quot;    \n&quot;
-                    &quot;    output.gl_Position = gl_Position + float4(pointSpriteCorners[&quot; + Str(corner) + &quot;] * viewportScale * gl_PointSize, 0.0f, 0.0f);\n&quot;;
-
-        if (fragmentShader-&gt;mUsesPointCoord)
-        {
-            geomHLSL += &quot;    output.gl_PointCoord = pointSpriteTexcoords[&quot; + Str(corner) + &quot;];\n&quot;;
-        }
-
-        geomHLSL += &quot;    outStream.Append(output);\n&quot;;
-    }
-
-    geomHLSL += &quot;    \n&quot;
-                &quot;    outStream.RestartStrip();\n&quot;
-                &quot;}\n&quot;;
-
-    return geomHLSL;
-}
-
-// This method needs to match OutputHLSL::decorate
-std::string DynamicHLSL::decorateVariable(const std::string &amp;name)
-{
-    if (name.compare(0, 3, &quot;gl_&quot;) != 0 &amp;&amp; name.compare(0, 3, &quot;dx_&quot;) != 0)
-    {
-        return &quot;_&quot; + name;
-    }
-
-    return name;
-}
-
-std::string DynamicHLSL::generateAttributeConversionHLSL(const VertexFormat &amp;vertexFormat, const ShaderVariable &amp;shaderAttrib) const
-{
-    std::string attribString = &quot;input.&quot; + decorateVariable(shaderAttrib.name);
-
-    // Matrix
-    if (IsMatrixType(shaderAttrib.type))
-    {
-        return &quot;transpose(&quot; + attribString + &quot;)&quot;;
-    }
-
-    GLenum shaderComponentType = UniformComponentType(shaderAttrib.type);
-    int shaderComponentCount = UniformComponentCount(shaderAttrib.type);
-
-    std::string padString = &quot;&quot;;
-
-    // Perform integer to float conversion (if necessary)
-    bool requiresTypeConversion = (shaderComponentType == GL_FLOAT &amp;&amp; vertexFormat.mType != GL_FLOAT);
-
-    // TODO: normalization for 32-bit integer formats
-    ASSERT(!requiresTypeConversion || !vertexFormat.mNormalized);
-
-    if (requiresTypeConversion || !padString.empty())
-    {
-        return &quot;float&quot; + Str(shaderComponentCount) + &quot;(&quot; + attribString + padString + &quot;)&quot;;
-    }
-
-    // No conversion necessary
-    return attribString;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2DynamicHLSLh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/DynamicHLSL.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,72 +0,0 @@
</span><del>-//
-// Copyright (c) 2014 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.
-//
-// DynamicHLSL.h: Interface for link and run-time HLSL generation
-//
-
-#ifndef LIBGLESV2_DYNAMIC_HLSL_H_
-#define LIBGLESV2_DYNAMIC_HLSL_H_
-
-#include &quot;common/angleutils.h&quot;
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace gl
-{
-
-class InfoLog;
-class FragmentShader;
-class VertexShader;
-struct VariableLocation;
-struct LinkedVarying;
-class VertexAttribute;
-struct VertexFormat;
-struct ShaderVariable;
-struct Attribute;
-
-class DynamicHLSL
-{
-  public:
-    explicit DynamicHLSL(rx::Renderer *const renderer);
-
-    int packVaryings(InfoLog &amp;infoLog, const ShaderVariable *packing[][4], FragmentShader *fragmentShader,
-                     VertexShader *vertexShader, const std::vector&lt;std::string&gt;&amp; transformFeedbackVaryings);
-    std::string generateInputLayoutHLSL(const VertexFormat inputLayout[], const Attribute shaderAttributes[]) const;
-    bool generateShaderLinkHLSL(InfoLog &amp;infoLog, int registers, const ShaderVariable *packing[][4],
-                                std::string&amp; pixelHLSL, std::string&amp; vertexHLSL,
-                                FragmentShader *fragmentShader, VertexShader *vertexShader,
-                                const std::vector&lt;std::string&gt;&amp; transformFeedbackVaryings,
-                                std::vector&lt;LinkedVarying&gt; *linkedVaryings,
-                                std::map&lt;int, VariableLocation&gt; *programOutputVars) const;
-
-    std::string generateGeometryShaderHLSL(int registers, const ShaderVariable *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const;
-
-    static const std::string VERTEX_ATTRIBUTE_STUB_STRING;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(DynamicHLSL);
-
-    rx::Renderer *const mRenderer;
-
-    std::string generateVaryingHLSL(VertexShader *shader, const std::string &amp;varyingSemantic,
-                                    std::vector&lt;LinkedVarying&gt; *linkedVaryings) const;
-    void defineOutputVariables(FragmentShader *fragmentShader, std::map&lt;int, VariableLocation&gt; *programOutputVars) const;
-    std::string generatePointSpriteHLSL(int registers, const ShaderVariable *packing[][4], FragmentShader *fragmentShader, VertexShader *vertexShader) const;
-
-    // Prepend an underscore
-    static std::string decorateVariable(const std::string &amp;name);
-
-    std::string generateAttributeConversionHLSL(const VertexFormat &amp;vertexFormat, const ShaderVariable &amp;shaderAttrib) const;
-};
-
-// Utility method shared between ProgramBinary and DynamicHLSL
-std::string ArrayString(unsigned int i);
-
-}
-
-#endif // LIBGLESV2_DYNAMIC_HLSL_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Fencecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,190 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// Fence.cpp: Implements the gl::Fence class, which supports the GL_NV_fence extension.
-
-// Important note on accurate timers in Windows:
-//
-// QueryPerformanceCounter has a few major issues, including being 10x as expensive to call
-// as timeGetTime on laptops and &quot;jumping&quot; during certain hardware events.
-//
-// See the comments at the top of the Chromium source file &quot;chromium/src/base/time/time_win.cc&quot;
-//   https://code.google.com/p/chromium/codesearch#chromium/src/base/time/time_win.cc
-//
-// We still opt to use QPC. In the present and moving forward, most newer systems will not suffer
-// from buggy implementations.
-
-#include &quot;libGLESv2/Fence.h&quot;
-#include &quot;libGLESv2/renderer/FenceImpl.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/main.h&quot;
-
-namespace gl
-{
-
-FenceNV::FenceNV(rx::Renderer *renderer)
-{
-    mFence = renderer-&gt;createFence();
-}
-
-FenceNV::~FenceNV()
-{
-    delete mFence;
-}
-
-GLboolean FenceNV::isFence() const
-{
-    // GL_NV_fence spec:
-    // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
-    return (mFence-&gt;isSet() ? GL_TRUE : GL_FALSE);
-}
-
-void FenceNV::setFence(GLenum condition)
-{
-    mFence-&gt;set();
-
-    mCondition = condition;
-    mStatus = GL_FALSE;
-}
-
-GLboolean FenceNV::testFence()
-{
-    // Flush the command buffer by default
-    bool result = mFence-&gt;test(true);
-
-    mStatus = (result ? GL_TRUE : GL_FALSE);
-    return mStatus;
-}
-
-void FenceNV::finishFence()
-{
-    ASSERT(mFence-&gt;isSet());
-
-    while (!mFence-&gt;test(true))
-    {
-        Sleep(0);
-    }
-}
-
-GLint FenceNV::getFencei(GLenum pname)
-{
-    ASSERT(mFence-&gt;isSet());
-
-    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 == GL_TRUE)
-            {
-                return GL_TRUE;
-            }
-
-            mStatus = (mFence-&gt;test(false) ? GL_TRUE : GL_FALSE);
-            return mStatus;
-        }
-
-      case GL_FENCE_CONDITION_NV:
-        return mCondition;
-
-      default: UNREACHABLE(); return 0;
-    }
-}
-
-FenceSync::FenceSync(rx::Renderer *renderer, GLuint id)
-    : RefCountObject(id)
-{
-    mFence = renderer-&gt;createFence();
-
-    LARGE_INTEGER counterFreqency = { 0 };
-    BOOL success = QueryPerformanceFrequency(&amp;counterFreqency);
-    ASSERT(success);
-
-    mCounterFrequency = counterFreqency.QuadPart;
-}
-
-FenceSync::~FenceSync()
-{
-    delete mFence;
-}
-
-void FenceSync::set(GLenum condition)
-{
-    mCondition = condition;
-    mFence-&gt;set();
-}
-
-GLenum FenceSync::clientWait(GLbitfield flags, GLuint64 timeout)
-{
-    ASSERT(mFence-&gt;isSet());
-
-    bool flushCommandBuffer = ((flags &amp; GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
-
-    if (mFence-&gt;test(flushCommandBuffer))
-    {
-        return GL_ALREADY_SIGNALED;
-    }
-
-    if (mFence-&gt;hasError())
-    {
-        return GL_WAIT_FAILED;
-    }
-
-    if (timeout == 0)
-    {
-        return GL_TIMEOUT_EXPIRED;
-    }
-
-    LARGE_INTEGER currentCounter = { 0 };
-    BOOL success = QueryPerformanceCounter(&amp;currentCounter);
-    ASSERT(success);
-
-    LONGLONG timeoutInSeconds = static_cast&lt;LONGLONG&gt;(timeout) * static_cast&lt;LONGLONG&gt;(1000000ll);
-    LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
-
-    while (currentCounter.QuadPart &lt; endCounter &amp;&amp; !mFence-&gt;test(flushCommandBuffer))
-    {
-        Sleep(0);
-        BOOL success = QueryPerformanceCounter(&amp;currentCounter);
-        ASSERT(success);
-    }
-
-    if (mFence-&gt;hasError())
-    {
-        return GL_WAIT_FAILED;
-    }
-
-    if (currentCounter.QuadPart &gt;= endCounter)
-    {
-        return GL_TIMEOUT_EXPIRED;
-    }
-
-    return GL_CONDITION_SATISFIED;
-}
-
-void FenceSync::serverWait()
-{
-    // Because our API is currently designed to be called from a single thread, we don't need to do
-    // extra work for a server-side fence. GPU commands issued after the fence is created will always
-    // be processed after the fence is signaled.
-}
-
-GLenum FenceSync::getStatus() const
-{
-    if (mFence-&gt;test(false))
-    {
-        // The spec does not specify any way to report errors during the status test (e.g. device lost)
-        // so we report the fence is unblocked in case of error or signaled.
-        return GL_SIGNALED;
-    }
-
-    return GL_UNSIGNALED;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Fenceh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Fence.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,72 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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_
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-
-namespace rx
-{
-class Renderer;
-class FenceImpl;
-}
-
-namespace gl
-{
-
-class FenceNV
-{
-  public:
-    explicit FenceNV(rx::Renderer *renderer);
-    virtual ~FenceNV();
-
-    GLboolean isFence() const;
-    void setFence(GLenum condition);
-    GLboolean testFence();
-    void finishFence();
-    GLint getFencei(GLenum pname);
-
-    GLboolean getStatus() const { return mStatus; }
-    GLuint getCondition() const { return mCondition; }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(FenceNV);
-
-    rx::FenceImpl *mFence;
-
-    GLboolean mStatus;
-    GLenum mCondition;
-};
-
-class FenceSync : public RefCountObject
-{
-  public:
-    explicit FenceSync(rx::Renderer *renderer, GLuint id);
-    virtual ~FenceSync();
-
-    void set(GLenum condition);
-    GLenum clientWait(GLbitfield flags, GLuint64 timeout);
-    void serverWait();
-    GLenum getStatus() const;
-
-    GLuint getCondition() const { return mCondition; }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(FenceSync);
-
-    rx::FenceImpl *mFence;
-    LONGLONG mCounterFrequency;
-
-    GLenum mCondition;
-};
-
-}
-
-#endif   // LIBGLESV2_FENCE_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Float16ToFloat32cpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,2204 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// 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.
-//
-
-// This file is automatically generated.
-
-namespace gl
-{
-
-const static unsigned g_mantissa[2048] = {
-    0x00000000,
-    0x33800000,
-    0x34000000,
-    0x34400000,
-    0x34800000,
-    0x34a00000,
-    0x34c00000,
-    0x34e00000,
-    0x35000000,
-    0x35100000,
-    0x35200000,
-    0x35300000,
-    0x35400000,
-    0x35500000,
-    0x35600000,
-    0x35700000,
-    0x35800000,
-    0x35880000,
-    0x35900000,
-    0x35980000,
-    0x35a00000,
-    0x35a80000,
-    0x35b00000,
-    0x35b80000,
-    0x35c00000,
-    0x35c80000,
-    0x35d00000,
-    0x35d80000,
-    0x35e00000,
-    0x35e80000,
-    0x35f00000,
-    0x35f80000,
-    0x36000000,
-    0x36040000,
-    0x36080000,
-    0x360c0000,
-    0x36100000,
-    0x36140000,
-    0x36180000,
-    0x361c0000,
-    0x36200000,
-    0x36240000,
-    0x36280000,
-    0x362c0000,
-    0x36300000,
-    0x36340000,
-    0x36380000,
-    0x363c0000,
-    0x36400000,
-    0x36440000,
-    0x36480000,
-    0x364c0000,
-    0x36500000,
-    0x36540000,
-    0x36580000,
-    0x365c0000,
-    0x36600000,
-    0x36640000,
-    0x36680000,
-    0x366c0000,
-    0x36700000,
-    0x36740000,
-    0x36780000,
-    0x367c0000,
-    0x36800000,
-    0x36820000,
-    0x36840000,
-    0x36860000,
-    0x36880000,
-    0x368a0000,
-    0x368c0000,
-    0x368e0000,
-    0x36900000,
-    0x36920000,
-    0x36940000,
-    0x36960000,
-    0x36980000,
-    0x369a0000,
-    0x369c0000,
-    0x369e0000,
-    0x36a00000,
-    0x36a20000,
-    0x36a40000,
-    0x36a60000,
-    0x36a80000,
-    0x36aa0000,
-    0x36ac0000,
-    0x36ae0000,
-    0x36b00000,
-    0x36b20000,
-    0x36b40000,
-    0x36b60000,
-    0x36b80000,
-    0x36ba0000,
-    0x36bc0000,
-    0x36be0000,
-    0x36c00000,
-    0x36c20000,
-    0x36c40000,
-    0x36c60000,
-    0x36c80000,
-    0x36ca0000,
-    0x36cc0000,
-    0x36ce0000,
-    0x36d00000,
-    0x36d20000,
-    0x36d40000,
-    0x36d60000,
-    0x36d80000,
-    0x36da0000,
-    0x36dc0000,
-    0x36de0000,
-    0x36e00000,
-    0x36e20000,
-    0x36e40000,
-    0x36e60000,
-    0x36e80000,
-    0x36ea0000,
-    0x36ec0000,
-    0x36ee0000,
-    0x36f00000,
-    0x36f20000,
-    0x36f40000,
-    0x36f60000,
-    0x36f80000,
-    0x36fa0000,
-    0x36fc0000,
-    0x36fe0000,
-    0x37000000,
-    0x37010000,
-    0x37020000,
-    0x37030000,
-    0x37040000,
-    0x37050000,
-    0x37060000,
-    0x37070000,
-    0x37080000,
-    0x37090000,
-    0x370a0000,
-    0x370b0000,
-    0x370c0000,
-    0x370d0000,
-    0x370e0000,
-    0x370f0000,
-    0x37100000,
-    0x37110000,
-    0x37120000,
-    0x37130000,
-    0x37140000,
-    0x37150000,
-    0x37160000,
-    0x37170000,
-    0x37180000,
-    0x37190000,
-    0x371a0000,
-    0x371b0000,
-    0x371c0000,
-    0x371d0000,
-    0x371e0000,
-    0x371f0000,
-    0x37200000,
-    0x37210000,
-    0x37220000,
-    0x37230000,
-    0x37240000,
-    0x37250000,
-    0x37260000,
-    0x37270000,
-    0x37280000,
-    0x37290000,
-    0x372a0000,
-    0x372b0000,
-    0x372c0000,
-    0x372d0000,
-    0x372e0000,
-    0x372f0000,
-    0x37300000,
-    0x37310000,
-    0x37320000,
-    0x37330000,
-    0x37340000,
-    0x37350000,
-    0x37360000,
-    0x37370000,
-    0x37380000,
-    0x37390000,
-    0x373a0000,
-    0x373b0000,
-    0x373c0000,
-    0x373d0000,
-    0x373e0000,
-    0x373f0000,
-    0x37400000,
-    0x37410000,
-    0x37420000,
-    0x37430000,
-    0x37440000,
-    0x37450000,
-    0x37460000,
-    0x37470000,
-    0x37480000,
-    0x37490000,
-    0x374a0000,
-    0x374b0000,
-    0x374c0000,
-    0x374d0000,
-    0x374e0000,
-    0x374f0000,
-    0x37500000,
-    0x37510000,
-    0x37520000,
-    0x37530000,
-    0x37540000,
-    0x37550000,
-    0x37560000,
-    0x37570000,
-    0x37580000,
-    0x37590000,
-    0x375a0000,
-    0x375b0000,
-    0x375c0000,
-    0x375d0000,
-    0x375e0000,
-    0x375f0000,
-    0x37600000,
-    0x37610000,
-    0x37620000,
-    0x37630000,
-    0x37640000,
-    0x37650000,
-    0x37660000,
-    0x37670000,
-    0x37680000,
-    0x37690000,
-    0x376a0000,
-    0x376b0000,
-    0x376c0000,
-    0x376d0000,
-    0x376e0000,
-    0x376f0000,
-    0x37700000,
-    0x37710000,
-    0x37720000,
-    0x37730000,
-    0x37740000,
-    0x37750000,
-    0x37760000,
-    0x37770000,
-    0x37780000,
-    0x37790000,
-    0x377a0000,
-    0x377b0000,
-    0x377c0000,
-    0x377d0000,
-    0x377e0000,
-    0x377f0000,
-    0x37800000,
-    0x37808000,
-    0x37810000,
-    0x37818000,
-    0x37820000,
-    0x37828000,
-    0x37830000,
-    0x37838000,
-    0x37840000,
-    0x37848000,
-    0x37850000,
-    0x37858000,
-    0x37860000,
-    0x37868000,
-    0x37870000,
-    0x37878000,
-    0x37880000,
-    0x37888000,
-    0x37890000,
-    0x37898000,
-    0x378a0000,
-    0x378a8000,
-    0x378b0000,
-    0x378b8000,
-    0x378c0000,
-    0x378c8000,
-    0x378d0000,
-    0x378d8000,
-    0x378e0000,
-    0x378e8000,
-    0x378f0000,
-    0x378f8000,
-    0x37900000,
-    0x37908000,
-    0x37910000,
-    0x37918000,
-    0x37920000,
-    0x37928000,
-    0x37930000,
-    0x37938000,
-    0x37940000,
-    0x37948000,
-    0x37950000,
-    0x37958000,
-    0x37960000,
-    0x37968000,
-    0x37970000,
-    0x37978000,
-    0x37980000,
-    0x37988000,
-    0x37990000,
-    0x37998000,
-    0x379a0000,
-    0x379a8000,
-    0x379b0000,
-    0x379b8000,
-    0x379c0000,
-    0x379c8000,
-    0x379d0000,
-    0x379d8000,
-    0x379e0000,
-    0x379e8000,
-    0x379f0000,
-    0x379f8000,
-    0x37a00000,
-    0x37a08000,
-    0x37a10000,
-    0x37a18000,
-    0x37a20000,
-    0x37a28000,
-    0x37a30000,
-    0x37a38000,
-    0x37a40000,
-    0x37a48000,
-    0x37a50000,
-    0x37a58000,
-    0x37a60000,
-    0x37a68000,
-    0x37a70000,
-    0x37a78000,
-    0x37a80000,
-    0x37a88000,
-    0x37a90000,
-    0x37a98000,
-    0x37aa0000,
-    0x37aa8000,
-    0x37ab0000,
-    0x37ab8000,
-    0x37ac0000,
-    0x37ac8000,
-    0x37ad0000,
-    0x37ad8000,
-    0x37ae0000,
-    0x37ae8000,
-    0x37af0000,
-    0x37af8000,
-    0x37b00000,
-    0x37b08000,
-    0x37b10000,
-    0x37b18000,
-    0x37b20000,
-    0x37b28000,
-    0x37b30000,
-    0x37b38000,
-    0x37b40000,
-    0x37b48000,
-    0x37b50000,
-    0x37b58000,
-    0x37b60000,
-    0x37b68000,
-    0x37b70000,
-    0x37b78000,
-    0x37b80000,
-    0x37b88000,
-    0x37b90000,
-    0x37b98000,
-    0x37ba0000,
-    0x37ba8000,
-    0x37bb0000,
-    0x37bb8000,
-    0x37bc0000,
-    0x37bc8000,
-    0x37bd0000,
-    0x37bd8000,
-    0x37be0000,
-    0x37be8000,
-    0x37bf0000,
-    0x37bf8000,
-    0x37c00000,
-    0x37c08000,
-    0x37c10000,
-    0x37c18000,
-    0x37c20000,
-    0x37c28000,
-    0x37c30000,
-    0x37c38000,
-    0x37c40000,
-    0x37c48000,
-    0x37c50000,
-    0x37c58000,
-    0x37c60000,
-    0x37c68000,
-    0x37c70000,
-    0x37c78000,
-    0x37c80000,
-    0x37c88000,
-    0x37c90000,
-    0x37c98000,
-    0x37ca0000,
-    0x37ca8000,
-    0x37cb0000,
-    0x37cb8000,
-    0x37cc0000,
-    0x37cc8000,
-    0x37cd0000,
-    0x37cd8000,
-    0x37ce0000,
-    0x37ce8000,
-    0x37cf0000,
-    0x37cf8000,
-    0x37d00000,
-    0x37d08000,
-    0x37d10000,
-    0x37d18000,
-    0x37d20000,
-    0x37d28000,
-    0x37d30000,
-    0x37d38000,
-    0x37d40000,
-    0x37d48000,
-    0x37d50000,
-    0x37d58000,
-    0x37d60000,
-    0x37d68000,
-    0x37d70000,
-    0x37d78000,
-    0x37d80000,
-    0x37d88000,
-    0x37d90000,
-    0x37d98000,
-    0x37da0000,
-    0x37da8000,
-    0x37db0000,
-    0x37db8000,
-    0x37dc0000,
-    0x37dc8000,
-    0x37dd0000,
-    0x37dd8000,
-    0x37de0000,
-    0x37de8000,
-    0x37df0000,
-    0x37df8000,
-    0x37e00000,
-    0x37e08000,
-    0x37e10000,
-    0x37e18000,
-    0x37e20000,
-    0x37e28000,
-    0x37e30000,
-    0x37e38000,
-    0x37e40000,
-    0x37e48000,
-    0x37e50000,
-    0x37e58000,
-    0x37e60000,
-    0x37e68000,
-    0x37e70000,
-    0x37e78000,
-    0x37e80000,
-    0x37e88000,
-    0x37e90000,
-    0x37e98000,
-    0x37ea0000,
-    0x37ea8000,
-    0x37eb0000,
-    0x37eb8000,
-    0x37ec0000,
-    0x37ec8000,
-    0x37ed0000,
-    0x37ed8000,
-    0x37ee0000,
-    0x37ee8000,
-    0x37ef0000,
-    0x37ef8000,
-    0x37f00000,
-    0x37f08000,
-    0x37f10000,
-    0x37f18000,
-    0x37f20000,
-    0x37f28000,
-    0x37f30000,
-    0x37f38000,
-    0x37f40000,
-    0x37f48000,
-    0x37f50000,
-    0x37f58000,
-    0x37f60000,
-    0x37f68000,
-    0x37f70000,
-    0x37f78000,
-    0x37f80000,
-    0x37f88000,
-    0x37f90000,
-    0x37f98000,
-    0x37fa0000,
-    0x37fa8000,
-    0x37fb0000,
-    0x37fb8000,
-    0x37fc0000,
-    0x37fc8000,
-    0x37fd0000,
-    0x37fd8000,
-    0x37fe0000,
-    0x37fe8000,
-    0x37ff0000,
-    0x37ff8000,
-    0x38000000,
-    0x38004000,
-    0x38008000,
-    0x3800c000,
-    0x38010000,
-    0x38014000,
-    0x38018000,
-    0x3801c000,
-    0x38020000,
-    0x38024000,
-    0x38028000,
-    0x3802c000,
-    0x38030000,
-    0x38034000,
-    0x38038000,
-    0x3803c000,
-    0x38040000,
-    0x38044000,
-    0x38048000,
-    0x3804c000,
-    0x38050000,
-    0x38054000,
-    0x38058000,
-    0x3805c000,
-    0x38060000,
-    0x38064000,
-    0x38068000,
-    0x3806c000,
-    0x38070000,
-    0x38074000,
-    0x38078000,
-    0x3807c000,
-    0x38080000,
-    0x38084000,
-    0x38088000,
-    0x3808c000,
-    0x38090000,
-    0x38094000,
-    0x38098000,
-    0x3809c000,
-    0x380a0000,
-    0x380a4000,
-    0x380a8000,
-    0x380ac000,
-    0x380b0000,
-    0x380b4000,
-    0x380b8000,
-    0x380bc000,
-    0x380c0000,
-    0x380c4000,
-    0x380c8000,
-    0x380cc000,
-    0x380d0000,
-    0x380d4000,
-    0x380d8000,
-    0x380dc000,
-    0x380e0000,
-    0x380e4000,
-    0x380e8000,
-    0x380ec000,
-    0x380f0000,
-    0x380f4000,
-    0x380f8000,
-    0x380fc000,
-    0x38100000,
-    0x38104000,
-    0x38108000,
-    0x3810c000,
-    0x38110000,
-    0x38114000,
-    0x38118000,
-    0x3811c000,
-    0x38120000,
-    0x38124000,
-    0x38128000,
-    0x3812c000,
-    0x38130000,
-    0x38134000,
-    0x38138000,
-    0x3813c000,
-    0x38140000,
-    0x38144000,
-    0x38148000,
-    0x3814c000,
-    0x38150000,
-    0x38154000,
-    0x38158000,
-    0x3815c000,
-    0x38160000,
-    0x38164000,
-    0x38168000,
-    0x3816c000,
-    0x38170000,
-    0x38174000,
-    0x38178000,
-    0x3817c000,
-    0x38180000,
-    0x38184000,
-    0x38188000,
-    0x3818c000,
-    0x38190000,
-    0x38194000,
-    0x38198000,
-    0x3819c000,
-    0x381a0000,
-    0x381a4000,
-    0x381a8000,
-    0x381ac000,
-    0x381b0000,
-    0x381b4000,
-    0x381b8000,
-    0x381bc000,
-    0x381c0000,
-    0x381c4000,
-    0x381c8000,
-    0x381cc000,
-    0x381d0000,
-    0x381d4000,
-    0x381d8000,
-    0x381dc000,
-    0x381e0000,
-    0x381e4000,
-    0x381e8000,
-    0x381ec000,
-    0x381f0000,
-    0x381f4000,
-    0x381f8000,
-    0x381fc000,
-    0x38200000,
-    0x38204000,
-    0x38208000,
-    0x3820c000,
-    0x38210000,
-    0x38214000,
-    0x38218000,
-    0x3821c000,
-    0x38220000,
-    0x38224000,
-    0x38228000,
-    0x3822c000,
-    0x38230000,
-    0x38234000,
-    0x38238000,
-    0x3823c000,
-    0x38240000,
-    0x38244000,
-    0x38248000,
-    0x3824c000,
-    0x38250000,
-    0x38254000,
-    0x38258000,
-    0x3825c000,
-    0x38260000,
-    0x38264000,
-    0x38268000,
-    0x3826c000,
-    0x38270000,
-    0x38274000,
-    0x38278000,
-    0x3827c000,
-    0x38280000,
-    0x38284000,
-    0x38288000,
-    0x3828c000,
-    0x38290000,
-    0x38294000,
-    0x38298000,
-    0x3829c000,
-    0x382a0000,
-    0x382a4000,
-    0x382a8000,
-    0x382ac000,
-    0x382b0000,
-    0x382b4000,
-    0x382b8000,
-    0x382bc000,
-    0x382c0000,
-    0x382c4000,
-    0x382c8000,
-    0x382cc000,
-    0x382d0000,
-    0x382d4000,
-    0x382d8000,
-    0x382dc000,
-    0x382e0000,
-    0x382e4000,
-    0x382e8000,
-    0x382ec000,
-    0x382f0000,
-    0x382f4000,
-    0x382f8000,
-    0x382fc000,
-    0x38300000,
-    0x38304000,
-    0x38308000,
-    0x3830c000,
-    0x38310000,
-    0x38314000,
-    0x38318000,
-    0x3831c000,
-    0x38320000,
-    0x38324000,
-    0x38328000,
-    0x3832c000,
-    0x38330000,
-    0x38334000,
-    0x38338000,
-    0x3833c000,
-    0x38340000,
-    0x38344000,
-    0x38348000,
-    0x3834c000,
-    0x38350000,
-    0x38354000,
-    0x38358000,
-    0x3835c000,
-    0x38360000,
-    0x38364000,
-    0x38368000,
-    0x3836c000,
-    0x38370000,
-    0x38374000,
-    0x38378000,
-    0x3837c000,
-    0x38380000,
-    0x38384000,
-    0x38388000,
-    0x3838c000,
-    0x38390000,
-    0x38394000,
-    0x38398000,
-    0x3839c000,
-    0x383a0000,
-    0x383a4000,
-    0x383a8000,
-    0x383ac000,
-    0x383b0000,
-    0x383b4000,
-    0x383b8000,
-    0x383bc000,
-    0x383c0000,
-    0x383c4000,
-    0x383c8000,
-    0x383cc000,
-    0x383d0000,
-    0x383d4000,
-    0x383d8000,
-    0x383dc000,
-    0x383e0000,
-    0x383e4000,
-    0x383e8000,
-    0x383ec000,
-    0x383f0000,
-    0x383f4000,
-    0x383f8000,
-    0x383fc000,
-    0x38400000,
-    0x38404000,
-    0x38408000,
-    0x3840c000,
-    0x38410000,
-    0x38414000,
-    0x38418000,
-    0x3841c000,
-    0x38420000,
-    0x38424000,
-    0x38428000,
-    0x3842c000,
-    0x38430000,
-    0x38434000,
-    0x38438000,
-    0x3843c000,
-    0x38440000,
-    0x38444000,
-    0x38448000,
-    0x3844c000,
-    0x38450000,
-    0x38454000,
-    0x38458000,
-    0x3845c000,
-    0x38460000,
-    0x38464000,
-    0x38468000,
-    0x3846c000,
-    0x38470000,
-    0x38474000,
-    0x38478000,
-    0x3847c000,
-    0x38480000,
-    0x38484000,
-    0x38488000,
-    0x3848c000,
-    0x38490000,
-    0x38494000,
-    0x38498000,
-    0x3849c000,
-    0x384a0000,
-    0x384a4000,
-    0x384a8000,
-    0x384ac000,
-    0x384b0000,
-    0x384b4000,
-    0x384b8000,
-    0x384bc000,
-    0x384c0000,
-    0x384c4000,
-    0x384c8000,
-    0x384cc000,
-    0x384d0000,
-    0x384d4000,
-    0x384d8000,
-    0x384dc000,
-    0x384e0000,
-    0x384e4000,
-    0x384e8000,
-    0x384ec000,
-    0x384f0000,
-    0x384f4000,
-    0x384f8000,
-    0x384fc000,
-    0x38500000,
-    0x38504000,
-    0x38508000,
-    0x3850c000,
-    0x38510000,
-    0x38514000,
-    0x38518000,
-    0x3851c000,
-    0x38520000,
-    0x38524000,
-    0x38528000,
-    0x3852c000,
-    0x38530000,
-    0x38534000,
-    0x38538000,
-    0x3853c000,
-    0x38540000,
-    0x38544000,
-    0x38548000,
-    0x3854c000,
-    0x38550000,
-    0x38554000,
-    0x38558000,
-    0x3855c000,
-    0x38560000,
-    0x38564000,
-    0x38568000,
-    0x3856c000,
-    0x38570000,
-    0x38574000,
-    0x38578000,
-    0x3857c000,
-    0x38580000,
-    0x38584000,
-    0x38588000,
-    0x3858c000,
-    0x38590000,
-    0x38594000,
-    0x38598000,
-    0x3859c000,
-    0x385a0000,
-    0x385a4000,
-    0x385a8000,
-    0x385ac000,
-    0x385b0000,
-    0x385b4000,
-    0x385b8000,
-    0x385bc000,
-    0x385c0000,
-    0x385c4000,
-    0x385c8000,
-    0x385cc000,
-    0x385d0000,
-    0x385d4000,
-    0x385d8000,
-    0x385dc000,
-    0x385e0000,
-    0x385e4000,
-    0x385e8000,
-    0x385ec000,
-    0x385f0000,
-    0x385f4000,
-    0x385f8000,
-    0x385fc000,
-    0x38600000,
-    0x38604000,
-    0x38608000,
-    0x3860c000,
-    0x38610000,
-    0x38614000,
-    0x38618000,
-    0x3861c000,
-    0x38620000,
-    0x38624000,
-    0x38628000,
-    0x3862c000,
-    0x38630000,
-    0x38634000,
-    0x38638000,
-    0x3863c000,
-    0x38640000,
-    0x38644000,
-    0x38648000,
-    0x3864c000,
-    0x38650000,
-    0x38654000,
-    0x38658000,
-    0x3865c000,
-    0x38660000,
-    0x38664000,
-    0x38668000,
-    0x3866c000,
-    0x38670000,
-    0x38674000,
-    0x38678000,
-    0x3867c000,
-    0x38680000,
-    0x38684000,
-    0x38688000,
-    0x3868c000,
-    0x38690000,
-    0x38694000,
-    0x38698000,
-    0x3869c000,
-    0x386a0000,
-    0x386a4000,
-    0x386a8000,
-    0x386ac000,
-    0x386b0000,
-    0x386b4000,
-    0x386b8000,
-    0x386bc000,
-    0x386c0000,
-    0x386c4000,
-    0x386c8000,
-    0x386cc000,
-    0x386d0000,
-    0x386d4000,
-    0x386d8000,
-    0x386dc000,
-    0x386e0000,
-    0x386e4000,
-    0x386e8000,
-    0x386ec000,
-    0x386f0000,
-    0x386f4000,
-    0x386f8000,
-    0x386fc000,
-    0x38700000,
-    0x38704000,
-    0x38708000,
-    0x3870c000,
-    0x38710000,
-    0x38714000,
-    0x38718000,
-    0x3871c000,
-    0x38720000,
-    0x38724000,
-    0x38728000,
-    0x3872c000,
-    0x38730000,
-    0x38734000,
-    0x38738000,
-    0x3873c000,
-    0x38740000,
-    0x38744000,
-    0x38748000,
-    0x3874c000,
-    0x38750000,
-    0x38754000,
-    0x38758000,
-    0x3875c000,
-    0x38760000,
-    0x38764000,
-    0x38768000,
-    0x3876c000,
-    0x38770000,
-    0x38774000,
-    0x38778000,
-    0x3877c000,
-    0x38780000,
-    0x38784000,
-    0x38788000,
-    0x3878c000,
-    0x38790000,
-    0x38794000,
-    0x38798000,
-    0x3879c000,
-    0x387a0000,
-    0x387a4000,
-    0x387a8000,
-    0x387ac000,
-    0x387b0000,
-    0x387b4000,
-    0x387b8000,
-    0x387bc000,
-    0x387c0000,
-    0x387c4000,
-    0x387c8000,
-    0x387cc000,
-    0x387d0000,
-    0x387d4000,
-    0x387d8000,
-    0x387dc000,
-    0x387e0000,
-    0x387e4000,
-    0x387e8000,
-    0x387ec000,
-    0x387f0000,
-    0x387f4000,
-    0x387f8000,
-    0x387fc000,
-    0x38000000,
-    0x38002000,
-    0x38004000,
-    0x38006000,
-    0x38008000,
-    0x3800a000,
-    0x3800c000,
-    0x3800e000,
-    0x38010000,
-    0x38012000,
-    0x38014000,
-    0x38016000,
-    0x38018000,
-    0x3801a000,
-    0x3801c000,
-    0x3801e000,
-    0x38020000,
-    0x38022000,
-    0x38024000,
-    0x38026000,
-    0x38028000,
-    0x3802a000,
-    0x3802c000,
-    0x3802e000,
-    0x38030000,
-    0x38032000,
-    0x38034000,
-    0x38036000,
-    0x38038000,
-    0x3803a000,
-    0x3803c000,
-    0x3803e000,
-    0x38040000,
-    0x38042000,
-    0x38044000,
-    0x38046000,
-    0x38048000,
-    0x3804a000,
-    0x3804c000,
-    0x3804e000,
-    0x38050000,
-    0x38052000,
-    0x38054000,
-    0x38056000,
-    0x38058000,
-    0x3805a000,
-    0x3805c000,
-    0x3805e000,
-    0x38060000,
-    0x38062000,
-    0x38064000,
-    0x38066000,
-    0x38068000,
-    0x3806a000,
-    0x3806c000,
-    0x3806e000,
-    0x38070000,
-    0x38072000,
-    0x38074000,
-    0x38076000,
-    0x38078000,
-    0x3807a000,
-    0x3807c000,
-    0x3807e000,
-    0x38080000,
-    0x38082000,
-    0x38084000,
-    0x38086000,
-    0x38088000,
-    0x3808a000,
-    0x3808c000,
-    0x3808e000,
-    0x38090000,
-    0x38092000,
-    0x38094000,
-    0x38096000,
-    0x38098000,
-    0x3809a000,
-    0x3809c000,
-    0x3809e000,
-    0x380a0000,
-    0x380a2000,
-    0x380a4000,
-    0x380a6000,
-    0x380a8000,
-    0x380aa000,
-    0x380ac000,
-    0x380ae000,
-    0x380b0000,
-    0x380b2000,
-    0x380b4000,
-    0x380b6000,
-    0x380b8000,
-    0x380ba000,
-    0x380bc000,
-    0x380be000,
-    0x380c0000,
-    0x380c2000,
-    0x380c4000,
-    0x380c6000,
-    0x380c8000,
-    0x380ca000,
-    0x380cc000,
-    0x380ce000,
-    0x380d0000,
-    0x380d2000,
-    0x380d4000,
-    0x380d6000,
-    0x380d8000,
-    0x380da000,
-    0x380dc000,
-    0x380de000,
-    0x380e0000,
-    0x380e2000,
-    0x380e4000,
-    0x380e6000,
-    0x380e8000,
-    0x380ea000,
-    0x380ec000,
-    0x380ee000,
-    0x380f0000,
-    0x380f2000,
-    0x380f4000,
-    0x380f6000,
-    0x380f8000,
-    0x380fa000,
-    0x380fc000,
-    0x380fe000,
-    0x38100000,
-    0x38102000,
-    0x38104000,
-    0x38106000,
-    0x38108000,
-    0x3810a000,
-    0x3810c000,
-    0x3810e000,
-    0x38110000,
-    0x38112000,
-    0x38114000,
-    0x38116000,
-    0x38118000,
-    0x3811a000,
-    0x3811c000,
-    0x3811e000,
-    0x38120000,
-    0x38122000,
-    0x38124000,
-    0x38126000,
-    0x38128000,
-    0x3812a000,
-    0x3812c000,
-    0x3812e000,
-    0x38130000,
-    0x38132000,
-    0x38134000,
-    0x38136000,
-    0x38138000,
-    0x3813a000,
-    0x3813c000,
-    0x3813e000,
-    0x38140000,
-    0x38142000,
-    0x38144000,
-    0x38146000,
-    0x38148000,
-    0x3814a000,
-    0x3814c000,
-    0x3814e000,
-    0x38150000,
-    0x38152000,
-    0x38154000,
-    0x38156000,
-    0x38158000,
-    0x3815a000,
-    0x3815c000,
-    0x3815e000,
-    0x38160000,
-    0x38162000,
-    0x38164000,
-    0x38166000,
-    0x38168000,
-    0x3816a000,
-    0x3816c000,
-    0x3816e000,
-    0x38170000,
-    0x38172000,
-    0x38174000,
-    0x38176000,
-    0x38178000,
-    0x3817a000,
-    0x3817c000,
-    0x3817e000,
-    0x38180000,
-    0x38182000,
-    0x38184000,
-    0x38186000,
-    0x38188000,
-    0x3818a000,
-    0x3818c000,
-    0x3818e000,
-    0x38190000,
-    0x38192000,
-    0x38194000,
-    0x38196000,
-    0x38198000,
-    0x3819a000,
-    0x3819c000,
-    0x3819e000,
-    0x381a0000,
-    0x381a2000,
-    0x381a4000,
-    0x381a6000,
-    0x381a8000,
-    0x381aa000,
-    0x381ac000,
-    0x381ae000,
-    0x381b0000,
-    0x381b2000,
-    0x381b4000,
-    0x381b6000,
-    0x381b8000,
-    0x381ba000,
-    0x381bc000,
-    0x381be000,
-    0x381c0000,
-    0x381c2000,
-    0x381c4000,
-    0x381c6000,
-    0x381c8000,
-    0x381ca000,
-    0x381cc000,
-    0x381ce000,
-    0x381d0000,
-    0x381d2000,
-    0x381d4000,
-    0x381d6000,
-    0x381d8000,
-    0x381da000,
-    0x381dc000,
-    0x381de000,
-    0x381e0000,
-    0x381e2000,
-    0x381e4000,
-    0x381e6000,
-    0x381e8000,
-    0x381ea000,
-    0x381ec000,
-    0x381ee000,
-    0x381f0000,
-    0x381f2000,
-    0x381f4000,
-    0x381f6000,
-    0x381f8000,
-    0x381fa000,
-    0x381fc000,
-    0x381fe000,
-    0x38200000,
-    0x38202000,
-    0x38204000,
-    0x38206000,
-    0x38208000,
-    0x3820a000,
-    0x3820c000,
-    0x3820e000,
-    0x38210000,
-    0x38212000,
-    0x38214000,
-    0x38216000,
-    0x38218000,
-    0x3821a000,
-    0x3821c000,
-    0x3821e000,
-    0x38220000,
-    0x38222000,
-    0x38224000,
-    0x38226000,
-    0x38228000,
-    0x3822a000,
-    0x3822c000,
-    0x3822e000,
-    0x38230000,
-    0x38232000,
-    0x38234000,
-    0x38236000,
-    0x38238000,
-    0x3823a000,
-    0x3823c000,
-    0x3823e000,
-    0x38240000,
-    0x38242000,
-    0x38244000,
-    0x38246000,
-    0x38248000,
-    0x3824a000,
-    0x3824c000,
-    0x3824e000,
-    0x38250000,
-    0x38252000,
-    0x38254000,
-    0x38256000,
-    0x38258000,
-    0x3825a000,
-    0x3825c000,
-    0x3825e000,
-    0x38260000,
-    0x38262000,
-    0x38264000,
-    0x38266000,
-    0x38268000,
-    0x3826a000,
-    0x3826c000,
-    0x3826e000,
-    0x38270000,
-    0x38272000,
-    0x38274000,
-    0x38276000,
-    0x38278000,
-    0x3827a000,
-    0x3827c000,
-    0x3827e000,
-    0x38280000,
-    0x38282000,
-    0x38284000,
-    0x38286000,
-    0x38288000,
-    0x3828a000,
-    0x3828c000,
-    0x3828e000,
-    0x38290000,
-    0x38292000,
-    0x38294000,
-    0x38296000,
-    0x38298000,
-    0x3829a000,
-    0x3829c000,
-    0x3829e000,
-    0x382a0000,
-    0x382a2000,
-    0x382a4000,
-    0x382a6000,
-    0x382a8000,
-    0x382aa000,
-    0x382ac000,
-    0x382ae000,
-    0x382b0000,
-    0x382b2000,
-    0x382b4000,
-    0x382b6000,
-    0x382b8000,
-    0x382ba000,
-    0x382bc000,
-    0x382be000,
-    0x382c0000,
-    0x382c2000,
-    0x382c4000,
-    0x382c6000,
-    0x382c8000,
-    0x382ca000,
-    0x382cc000,
-    0x382ce000,
-    0x382d0000,
-    0x382d2000,
-    0x382d4000,
-    0x382d6000,
-    0x382d8000,
-    0x382da000,
-    0x382dc000,
-    0x382de000,
-    0x382e0000,
-    0x382e2000,
-    0x382e4000,
-    0x382e6000,
-    0x382e8000,
-    0x382ea000,
-    0x382ec000,
-    0x382ee000,
-    0x382f0000,
-    0x382f2000,
-    0x382f4000,
-    0x382f6000,
-    0x382f8000,
-    0x382fa000,
-    0x382fc000,
-    0x382fe000,
-    0x38300000,
-    0x38302000,
-    0x38304000,
-    0x38306000,
-    0x38308000,
-    0x3830a000,
-    0x3830c000,
-    0x3830e000,
-    0x38310000,
-    0x38312000,
-    0x38314000,
-    0x38316000,
-    0x38318000,
-    0x3831a000,
-    0x3831c000,
-    0x3831e000,
-    0x38320000,
-    0x38322000,
-    0x38324000,
-    0x38326000,
-    0x38328000,
-    0x3832a000,
-    0x3832c000,
-    0x3832e000,
-    0x38330000,
-    0x38332000,
-    0x38334000,
-    0x38336000,
-    0x38338000,
-    0x3833a000,
-    0x3833c000,
-    0x3833e000,
-    0x38340000,
-    0x38342000,
-    0x38344000,
-    0x38346000,
-    0x38348000,
-    0x3834a000,
-    0x3834c000,
-    0x3834e000,
-    0x38350000,
-    0x38352000,
-    0x38354000,
-    0x38356000,
-    0x38358000,
-    0x3835a000,
-    0x3835c000,
-    0x3835e000,
-    0x38360000,
-    0x38362000,
-    0x38364000,
-    0x38366000,
-    0x38368000,
-    0x3836a000,
-    0x3836c000,
-    0x3836e000,
-    0x38370000,
-    0x38372000,
-    0x38374000,
-    0x38376000,
-    0x38378000,
-    0x3837a000,
-    0x3837c000,
-    0x3837e000,
-    0x38380000,
-    0x38382000,
-    0x38384000,
-    0x38386000,
-    0x38388000,
-    0x3838a000,
-    0x3838c000,
-    0x3838e000,
-    0x38390000,
-    0x38392000,
-    0x38394000,
-    0x38396000,
-    0x38398000,
-    0x3839a000,
-    0x3839c000,
-    0x3839e000,
-    0x383a0000,
-    0x383a2000,
-    0x383a4000,
-    0x383a6000,
-    0x383a8000,
-    0x383aa000,
-    0x383ac000,
-    0x383ae000,
-    0x383b0000,
-    0x383b2000,
-    0x383b4000,
-    0x383b6000,
-    0x383b8000,
-    0x383ba000,
-    0x383bc000,
-    0x383be000,
-    0x383c0000,
-    0x383c2000,
-    0x383c4000,
-    0x383c6000,
-    0x383c8000,
-    0x383ca000,
-    0x383cc000,
-    0x383ce000,
-    0x383d0000,
-    0x383d2000,
-    0x383d4000,
-    0x383d6000,
-    0x383d8000,
-    0x383da000,
-    0x383dc000,
-    0x383de000,
-    0x383e0000,
-    0x383e2000,
-    0x383e4000,
-    0x383e6000,
-    0x383e8000,
-    0x383ea000,
-    0x383ec000,
-    0x383ee000,
-    0x383f0000,
-    0x383f2000,
-    0x383f4000,
-    0x383f6000,
-    0x383f8000,
-    0x383fa000,
-    0x383fc000,
-    0x383fe000,
-    0x38400000,
-    0x38402000,
-    0x38404000,
-    0x38406000,
-    0x38408000,
-    0x3840a000,
-    0x3840c000,
-    0x3840e000,
-    0x38410000,
-    0x38412000,
-    0x38414000,
-    0x38416000,
-    0x38418000,
-    0x3841a000,
-    0x3841c000,
-    0x3841e000,
-    0x38420000,
-    0x38422000,
-    0x38424000,
-    0x38426000,
-    0x38428000,
-    0x3842a000,
-    0x3842c000,
-    0x3842e000,
-    0x38430000,
-    0x38432000,
-    0x38434000,
-    0x38436000,
-    0x38438000,
-    0x3843a000,
-    0x3843c000,
-    0x3843e000,
-    0x38440000,
-    0x38442000,
-    0x38444000,
-    0x38446000,
-    0x38448000,
-    0x3844a000,
-    0x3844c000,
-    0x3844e000,
-    0x38450000,
-    0x38452000,
-    0x38454000,
-    0x38456000,
-    0x38458000,
-    0x3845a000,
-    0x3845c000,
-    0x3845e000,
-    0x38460000,
-    0x38462000,
-    0x38464000,
-    0x38466000,
-    0x38468000,
-    0x3846a000,
-    0x3846c000,
-    0x3846e000,
-    0x38470000,
-    0x38472000,
-    0x38474000,
-    0x38476000,
-    0x38478000,
-    0x3847a000,
-    0x3847c000,
-    0x3847e000,
-    0x38480000,
-    0x38482000,
-    0x38484000,
-    0x38486000,
-    0x38488000,
-    0x3848a000,
-    0x3848c000,
-    0x3848e000,
-    0x38490000,
-    0x38492000,
-    0x38494000,
-    0x38496000,
-    0x38498000,
-    0x3849a000,
-    0x3849c000,
-    0x3849e000,
-    0x384a0000,
-    0x384a2000,
-    0x384a4000,
-    0x384a6000,
-    0x384a8000,
-    0x384aa000,
-    0x384ac000,
-    0x384ae000,
-    0x384b0000,
-    0x384b2000,
-    0x384b4000,
-    0x384b6000,
-    0x384b8000,
-    0x384ba000,
-    0x384bc000,
-    0x384be000,
-    0x384c0000,
-    0x384c2000,
-    0x384c4000,
-    0x384c6000,
-    0x384c8000,
-    0x384ca000,
-    0x384cc000,
-    0x384ce000,
-    0x384d0000,
-    0x384d2000,
-    0x384d4000,
-    0x384d6000,
-    0x384d8000,
-    0x384da000,
-    0x384dc000,
-    0x384de000,
-    0x384e0000,
-    0x384e2000,
-    0x384e4000,
-    0x384e6000,
-    0x384e8000,
-    0x384ea000,
-    0x384ec000,
-    0x384ee000,
-    0x384f0000,
-    0x384f2000,
-    0x384f4000,
-    0x384f6000,
-    0x384f8000,
-    0x384fa000,
-    0x384fc000,
-    0x384fe000,
-    0x38500000,
-    0x38502000,
-    0x38504000,
-    0x38506000,
-    0x38508000,
-    0x3850a000,
-    0x3850c000,
-    0x3850e000,
-    0x38510000,
-    0x38512000,
-    0x38514000,
-    0x38516000,
-    0x38518000,
-    0x3851a000,
-    0x3851c000,
-    0x3851e000,
-    0x38520000,
-    0x38522000,
-    0x38524000,
-    0x38526000,
-    0x38528000,
-    0x3852a000,
-    0x3852c000,
-    0x3852e000,
-    0x38530000,
-    0x38532000,
-    0x38534000,
-    0x38536000,
-    0x38538000,
-    0x3853a000,
-    0x3853c000,
-    0x3853e000,
-    0x38540000,
-    0x38542000,
-    0x38544000,
-    0x38546000,
-    0x38548000,
-    0x3854a000,
-    0x3854c000,
-    0x3854e000,
-    0x38550000,
-    0x38552000,
-    0x38554000,
-    0x38556000,
-    0x38558000,
-    0x3855a000,
-    0x3855c000,
-    0x3855e000,
-    0x38560000,
-    0x38562000,
-    0x38564000,
-    0x38566000,
-    0x38568000,
-    0x3856a000,
-    0x3856c000,
-    0x3856e000,
-    0x38570000,
-    0x38572000,
-    0x38574000,
-    0x38576000,
-    0x38578000,
-    0x3857a000,
-    0x3857c000,
-    0x3857e000,
-    0x38580000,
-    0x38582000,
-    0x38584000,
-    0x38586000,
-    0x38588000,
-    0x3858a000,
-    0x3858c000,
-    0x3858e000,
-    0x38590000,
-    0x38592000,
-    0x38594000,
-    0x38596000,
-    0x38598000,
-    0x3859a000,
-    0x3859c000,
-    0x3859e000,
-    0x385a0000,
-    0x385a2000,
-    0x385a4000,
-    0x385a6000,
-    0x385a8000,
-    0x385aa000,
-    0x385ac000,
-    0x385ae000,
-    0x385b0000,
-    0x385b2000,
-    0x385b4000,
-    0x385b6000,
-    0x385b8000,
-    0x385ba000,
-    0x385bc000,
-    0x385be000,
-    0x385c0000,
-    0x385c2000,
-    0x385c4000,
-    0x385c6000,
-    0x385c8000,
-    0x385ca000,
-    0x385cc000,
-    0x385ce000,
-    0x385d0000,
-    0x385d2000,
-    0x385d4000,
-    0x385d6000,
-    0x385d8000,
-    0x385da000,
-    0x385dc000,
-    0x385de000,
-    0x385e0000,
-    0x385e2000,
-    0x385e4000,
-    0x385e6000,
-    0x385e8000,
-    0x385ea000,
-    0x385ec000,
-    0x385ee000,
-    0x385f0000,
-    0x385f2000,
-    0x385f4000,
-    0x385f6000,
-    0x385f8000,
-    0x385fa000,
-    0x385fc000,
-    0x385fe000,
-    0x38600000,
-    0x38602000,
-    0x38604000,
-    0x38606000,
-    0x38608000,
-    0x3860a000,
-    0x3860c000,
-    0x3860e000,
-    0x38610000,
-    0x38612000,
-    0x38614000,
-    0x38616000,
-    0x38618000,
-    0x3861a000,
-    0x3861c000,
-    0x3861e000,
-    0x38620000,
-    0x38622000,
-    0x38624000,
-    0x38626000,
-    0x38628000,
-    0x3862a000,
-    0x3862c000,
-    0x3862e000,
-    0x38630000,
-    0x38632000,
-    0x38634000,
-    0x38636000,
-    0x38638000,
-    0x3863a000,
-    0x3863c000,
-    0x3863e000,
-    0x38640000,
-    0x38642000,
-    0x38644000,
-    0x38646000,
-    0x38648000,
-    0x3864a000,
-    0x3864c000,
-    0x3864e000,
-    0x38650000,
-    0x38652000,
-    0x38654000,
-    0x38656000,
-    0x38658000,
-    0x3865a000,
-    0x3865c000,
-    0x3865e000,
-    0x38660000,
-    0x38662000,
-    0x38664000,
-    0x38666000,
-    0x38668000,
-    0x3866a000,
-    0x3866c000,
-    0x3866e000,
-    0x38670000,
-    0x38672000,
-    0x38674000,
-    0x38676000,
-    0x38678000,
-    0x3867a000,
-    0x3867c000,
-    0x3867e000,
-    0x38680000,
-    0x38682000,
-    0x38684000,
-    0x38686000,
-    0x38688000,
-    0x3868a000,
-    0x3868c000,
-    0x3868e000,
-    0x38690000,
-    0x38692000,
-    0x38694000,
-    0x38696000,
-    0x38698000,
-    0x3869a000,
-    0x3869c000,
-    0x3869e000,
-    0x386a0000,
-    0x386a2000,
-    0x386a4000,
-    0x386a6000,
-    0x386a8000,
-    0x386aa000,
-    0x386ac000,
-    0x386ae000,
-    0x386b0000,
-    0x386b2000,
-    0x386b4000,
-    0x386b6000,
-    0x386b8000,
-    0x386ba000,
-    0x386bc000,
-    0x386be000,
-    0x386c0000,
-    0x386c2000,
-    0x386c4000,
-    0x386c6000,
-    0x386c8000,
-    0x386ca000,
-    0x386cc000,
-    0x386ce000,
-    0x386d0000,
-    0x386d2000,
-    0x386d4000,
-    0x386d6000,
-    0x386d8000,
-    0x386da000,
-    0x386dc000,
-    0x386de000,
-    0x386e0000,
-    0x386e2000,
-    0x386e4000,
-    0x386e6000,
-    0x386e8000,
-    0x386ea000,
-    0x386ec000,
-    0x386ee000,
-    0x386f0000,
-    0x386f2000,
-    0x386f4000,
-    0x386f6000,
-    0x386f8000,
-    0x386fa000,
-    0x386fc000,
-    0x386fe000,
-    0x38700000,
-    0x38702000,
-    0x38704000,
-    0x38706000,
-    0x38708000,
-    0x3870a000,
-    0x3870c000,
-    0x3870e000,
-    0x38710000,
-    0x38712000,
-    0x38714000,
-    0x38716000,
-    0x38718000,
-    0x3871a000,
-    0x3871c000,
-    0x3871e000,
-    0x38720000,
-    0x38722000,
-    0x38724000,
-    0x38726000,
-    0x38728000,
-    0x3872a000,
-    0x3872c000,
-    0x3872e000,
-    0x38730000,
-    0x38732000,
-    0x38734000,
-    0x38736000,
-    0x38738000,
-    0x3873a000,
-    0x3873c000,
-    0x3873e000,
-    0x38740000,
-    0x38742000,
-    0x38744000,
-    0x38746000,
-    0x38748000,
-    0x3874a000,
-    0x3874c000,
-    0x3874e000,
-    0x38750000,
-    0x38752000,
-    0x38754000,
-    0x38756000,
-    0x38758000,
-    0x3875a000,
-    0x3875c000,
-    0x3875e000,
-    0x38760000,
-    0x38762000,
-    0x38764000,
-    0x38766000,
-    0x38768000,
-    0x3876a000,
-    0x3876c000,
-    0x3876e000,
-    0x38770000,
-    0x38772000,
-    0x38774000,
-    0x38776000,
-    0x38778000,
-    0x3877a000,
-    0x3877c000,
-    0x3877e000,
-    0x38780000,
-    0x38782000,
-    0x38784000,
-    0x38786000,
-    0x38788000,
-    0x3878a000,
-    0x3878c000,
-    0x3878e000,
-    0x38790000,
-    0x38792000,
-    0x38794000,
-    0x38796000,
-    0x38798000,
-    0x3879a000,
-    0x3879c000,
-    0x3879e000,
-    0x387a0000,
-    0x387a2000,
-    0x387a4000,
-    0x387a6000,
-    0x387a8000,
-    0x387aa000,
-    0x387ac000,
-    0x387ae000,
-    0x387b0000,
-    0x387b2000,
-    0x387b4000,
-    0x387b6000,
-    0x387b8000,
-    0x387ba000,
-    0x387bc000,
-    0x387be000,
-    0x387c0000,
-    0x387c2000,
-    0x387c4000,
-    0x387c6000,
-    0x387c8000,
-    0x387ca000,
-    0x387cc000,
-    0x387ce000,
-    0x387d0000,
-    0x387d2000,
-    0x387d4000,
-    0x387d6000,
-    0x387d8000,
-    0x387da000,
-    0x387dc000,
-    0x387de000,
-    0x387e0000,
-    0x387e2000,
-    0x387e4000,
-    0x387e6000,
-    0x387e8000,
-    0x387ea000,
-    0x387ec000,
-    0x387ee000,
-    0x387f0000,
-    0x387f2000,
-    0x387f4000,
-    0x387f6000,
-    0x387f8000,
-    0x387fa000,
-    0x387fc000,
-    0x387fe000,
-};
-
-const static unsigned g_exponent[64] = {
-    0x00000000,
-    0x00800000,
-    0x01000000,
-    0x01800000,
-    0x02000000,
-    0x02800000,
-    0x03000000,
-    0x03800000,
-    0x04000000,
-    0x04800000,
-    0x05000000,
-    0x05800000,
-    0x06000000,
-    0x06800000,
-    0x07000000,
-    0x07800000,
-    0x08000000,
-    0x08800000,
-    0x09000000,
-    0x09800000,
-    0x0a000000,
-    0x0a800000,
-    0x0b000000,
-    0x0b800000,
-    0x0c000000,
-    0x0c800000,
-    0x0d000000,
-    0x0d800000,
-    0x0e000000,
-    0x0e800000,
-    0x0f000000,
-    0x47800000,
-    0x80000000,
-    0x80800000,
-    0x81000000,
-    0x81800000,
-    0x82000000,
-    0x82800000,
-    0x83000000,
-    0x83800000,
-    0x84000000,
-    0x84800000,
-    0x85000000,
-    0x85800000,
-    0x86000000,
-    0x86800000,
-    0x87000000,
-    0x87800000,
-    0x88000000,
-    0x88800000,
-    0x89000000,
-    0x89800000,
-    0x8a000000,
-    0x8a800000,
-    0x8b000000,
-    0x8b800000,
-    0x8c000000,
-    0x8c800000,
-    0x8d000000,
-    0x8d800000,
-    0x8e000000,
-    0x8e800000,
-    0x8f000000,
-    0xc7800000,
-};
-
-const static unsigned g_offset[64] = {
-    0x00000000,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000000,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-    0x00000400,
-};
-
-float float16ToFloat32(unsigned short h)
-{
-    unsigned i32 = g_mantissa[g_offset[h &gt;&gt; 10] + (h &amp; 0x3ff)] + g_exponent[h &gt;&gt; 10];
-    return *(float*) &amp;i32;
-}
-}
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Float16ToFloat32py"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.py (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.py        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Float16ToFloat32.py        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,78 +0,0 @@
</span><del>-# 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.
-#
-
-# This script generates a function that converts 16-bit precision floating
-# point numbers to 32-bit.
-# It is based on ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf.
-
-def convertMantissa(i):
-    if i == 0:
-        return 0
-    elif i &lt; 1024:
-        m = i &lt;&lt; 13
-        e = 0
-        while not (m &amp; 0x00800000):
-            e -= 0x00800000
-            m = m &lt;&lt; 1
-        m &amp;= ~0x00800000
-        e += 0x38800000
-        return m | e
-    else:
-        return 0x38000000 + ((i - 1024) &lt;&lt; 13)
-
-def convertExponent(i):
-    if i == 0:
-        return 0
-    elif i in range(1, 31):
-        return i &lt;&lt; 23
-    elif i == 31:
-        return 0x47800000
-    elif i == 32:
-        return 0x80000000
-    elif i in range(33, 63):
-        return 0x80000000 + ((i - 32) &lt;&lt; 23)
-    else:
-        return 0xC7800000
-
-def convertOffset(i):
-    if i == 0 or i == 32:
-        return 0
-    else:
-        return 1024
-
-print &quot;&quot;&quot;//
-// 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.
-//
-
-// This file is automatically generated.
-
-namespace gl
-{
-&quot;&quot;&quot;
-
-print &quot;const static unsigned g_mantissa[2048] = {&quot;
-for i in range(0, 2048):
-    print &quot;    %#010x,&quot; % convertMantissa(i)
-print &quot;};\n&quot;
-
-print &quot;const static unsigned g_exponent[64] = {&quot;
-for i in range(0, 64):
-    print &quot;    %#010x,&quot; % convertExponent(i)
-print &quot;};\n&quot;
-
-print &quot;const static unsigned g_offset[64] = {&quot;
-for i in range(0, 64):
-    print &quot;    %#010x,&quot; % convertOffset(i)
-print &quot;};\n&quot;
-
-print &quot;&quot;&quot;float float16ToFloat32(unsigned short h)
-{
-    unsigned i32 = g_mantissa[g_offset[h &gt;&gt; 10] + (h &amp; 0x3ff)] + g_exponent[h &gt;&gt; 10];
-    return *(float*) &amp;i32;
-}
-}
-&quot;&quot;&quot;
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Framebuffercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,728 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &quot;libGLESv2/Framebuffer.h&quot;
-
-#include &quot;libGLESv2/main.h&quot;
-#include &quot;common/utilities.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-
-namespace gl
-{
-
-Framebuffer::Framebuffer(rx::Renderer *renderer)
-    : mRenderer(renderer)
-{
-    for (unsigned int colorAttachment = 0; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        mDrawBufferStates[colorAttachment] = GL_NONE;
-    }
-    mDrawBufferStates[0] = GL_COLOR_ATTACHMENT0_EXT;
-    mReadBufferState = GL_COLOR_ATTACHMENT0_EXT;
-}
-
-Framebuffer::~Framebuffer()
-{
-    for (unsigned int colorAttachment = 0; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
-    }
-    mDepthbuffer.set(NULL, GL_NONE, 0, 0);
-    mStencilbuffer.set(NULL, GL_NONE, 0, 0);
-}
-
-Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint level, GLint layer) const
-{
-    gl::Context *context = gl::getContext();
-
-    switch (type)
-    {
-      case GL_NONE:
-        return NULL;
-
-      case GL_RENDERBUFFER:
-        return context-&gt;getRenderbuffer(handle);
-
-      case GL_TEXTURE_2D:
-        {
-            Texture *texture = context-&gt;getTexture(handle);
-            if (texture &amp;&amp; texture-&gt;getTarget() == GL_TEXTURE_2D)
-            {
-                return static_cast&lt;Texture2D*&gt;(texture)-&gt;getRenderbuffer(level);
-            }
-            else
-            {
-                return NULL;
-            }
-        }
-
-      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 *texture = context-&gt;getTexture(handle);
-            if (texture &amp;&amp; texture-&gt;getTarget() == GL_TEXTURE_CUBE_MAP)
-            {
-                return static_cast&lt;TextureCubeMap*&gt;(texture)-&gt;getRenderbuffer(type, level);
-            }
-            else
-            {
-                return NULL;
-            }
-        }
-
-      case GL_TEXTURE_3D:
-        {
-            Texture *texture = context-&gt;getTexture(handle);
-            if (texture &amp;&amp; texture-&gt;getTarget() == GL_TEXTURE_3D)
-            {
-                return static_cast&lt;Texture3D*&gt;(texture)-&gt;getRenderbuffer(level, layer);
-            }
-            else
-            {
-                return NULL;
-            }
-        }
-
-      case GL_TEXTURE_2D_ARRAY:
-        {
-            Texture *texture = context-&gt;getTexture(handle);
-            if (texture &amp;&amp; texture-&gt;getTarget() == GL_TEXTURE_2D_ARRAY)
-            {
-                return static_cast&lt;Texture2DArray*&gt;(texture)-&gt;getRenderbuffer(level, layer);
-            }
-            else
-            {
-                return NULL;
-            }
-        }
-
-      default:
-        UNREACHABLE();
-        return NULL;
-    }
-}
-
-void Framebuffer::setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer)
-{
-    ASSERT(colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS);
-    Renderbuffer *renderBuffer = lookupRenderbuffer(type, colorbuffer, level, layer);
-    if (renderBuffer)
-    {
-        mColorbuffers[colorAttachment].set(renderBuffer, type, level, layer);
-    }
-    else
-    {
-        mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
-    }
-}
-
-void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer)
-{
-    Renderbuffer *renderBuffer = lookupRenderbuffer(type, depthbuffer, level, layer);
-    if (renderBuffer)
-    {
-        mDepthbuffer.set(renderBuffer, type, level, layer);
-    }
-    else
-    {
-        mDepthbuffer.set(NULL, GL_NONE, 0, 0);
-    }
-}
-
-void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer)
-{
-    Renderbuffer *renderBuffer = lookupRenderbuffer(type, stencilbuffer, level, layer);
-    if (renderBuffer)
-    {
-        mStencilbuffer.set(renderBuffer, type, level, layer);
-    }
-    else
-    {
-        mStencilbuffer.set(NULL, GL_NONE, 0, 0);
-    }
-}
-
-void Framebuffer::setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer)
-{
-    Renderbuffer *renderBuffer = lookupRenderbuffer(type, depthStencilBuffer, level, layer);
-    if (renderBuffer &amp;&amp; renderBuffer-&gt;getDepthSize() &gt; 0 &amp;&amp; renderBuffer-&gt;getStencilSize() &gt; 0)
-    {
-        mDepthbuffer.set(renderBuffer, type, level, layer);
-        mStencilbuffer.set(renderBuffer, type, level, layer);
-    }
-    else
-    {
-        mDepthbuffer.set(NULL, GL_NONE, 0, 0);
-        mStencilbuffer.set(NULL, GL_NONE, 0, 0);
-    }
-}
-
-void Framebuffer::detachTexture(GLuint texture)
-{
-    for (unsigned int colorAttachment = 0; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        if (mColorbuffers[colorAttachment].id() == texture &amp;&amp;
-            IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer-&gt;getCurrentClientVersion()))
-        {
-            mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
-        }
-    }
-
-    if (mDepthbuffer.id() == texture &amp;&amp; IsInternalTextureTarget(mDepthbuffer.type(), mRenderer-&gt;getCurrentClientVersion()))
-    {
-        mDepthbuffer.set(NULL, GL_NONE, 0, 0);
-    }
-
-    if (mStencilbuffer.id() == texture &amp;&amp; IsInternalTextureTarget(mStencilbuffer.type(), mRenderer-&gt;getCurrentClientVersion()))
-    {
-        mStencilbuffer.set(NULL, GL_NONE, 0, 0);
-    }
-}
-
-void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
-{
-    for (unsigned int colorAttachment = 0; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        if (mColorbuffers[colorAttachment].id() == renderbuffer &amp;&amp; mColorbuffers[colorAttachment].type() == GL_RENDERBUFFER)
-        {
-            mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
-        }
-    }
-
-    if (mDepthbuffer.id() == renderbuffer &amp;&amp; mDepthbuffer.type() == GL_RENDERBUFFER)
-    {
-        mDepthbuffer.set(NULL, GL_NONE, 0, 0);
-    }
-
-    if (mStencilbuffer.id() == renderbuffer &amp;&amp; mStencilbuffer.type() == GL_RENDERBUFFER)
-    {
-        mStencilbuffer.set(NULL, GL_NONE, 0, 0);
-    }
-}
-
-unsigned int Framebuffer::getRenderTargetSerial(unsigned int colorAttachment) const
-{
-    ASSERT(colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS);
-
-    Renderbuffer *colorbuffer = mColorbuffers[colorAttachment].get();
-
-    if (colorbuffer)
-    {
-        return colorbuffer-&gt;getSerial();
-    }
-
-    return 0;
-}
-
-unsigned int Framebuffer::getDepthbufferSerial() const
-{
-    Renderbuffer *depthbuffer = mDepthbuffer.get();
-
-    if (depthbuffer)
-    {
-        return depthbuffer-&gt;getSerial();
-    }
-
-    return 0;
-}
-
-unsigned int Framebuffer::getStencilbufferSerial() const
-{
-    Renderbuffer *stencilbuffer = mStencilbuffer.get();
-
-    if (stencilbuffer)
-    {
-        return stencilbuffer-&gt;getSerial();
-    }
-
-    return 0;
-}
-
-Renderbuffer *Framebuffer::getColorbuffer(unsigned int colorAttachment) const
-{
-    ASSERT(colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS);
-    return mColorbuffers[colorAttachment].get();
-}
-
-Renderbuffer *Framebuffer::getDepthbuffer() const
-{
-    return mDepthbuffer.get();
-}
-
-Renderbuffer *Framebuffer::getStencilbuffer() const
-{
-    return mStencilbuffer.get();
-}
-
-Renderbuffer *Framebuffer::getDepthStencilBuffer() const
-{
-    return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.get() : NULL;
-}
-
-Renderbuffer *Framebuffer::getDepthOrStencilbuffer() const
-{
-    Renderbuffer *depthstencilbuffer = mDepthbuffer.get();
-    
-    if (!depthstencilbuffer)
-    {
-        depthstencilbuffer = mStencilbuffer.get();
-    }
-
-    return depthstencilbuffer;
-}
-
-Renderbuffer *Framebuffer::getReadColorbuffer() const
-{
-    // Will require more logic if glReadBuffers is supported
-    return mColorbuffers[0].get();
-}
-
-GLenum Framebuffer::getReadColorbufferType() const
-{
-    // Will require more logic if glReadBuffers is supported
-    return mColorbuffers[0].type();
-}
-
-Renderbuffer *Framebuffer::getFirstColorbuffer() const
-{
-    for (unsigned int colorAttachment = 0; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        if (mColorbuffers[colorAttachment].type() != GL_NONE)
-        {
-            return mColorbuffers[colorAttachment].get();
-        }
-    }
-
-    return NULL;
-}
-
-GLenum Framebuffer::getColorbufferType(unsigned int colorAttachment) const
-{
-    ASSERT(colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS);
-    return mColorbuffers[colorAttachment].type();
-}
-
-GLenum Framebuffer::getDepthbufferType() const
-{
-    return mDepthbuffer.type();
-}
-
-GLenum Framebuffer::getStencilbufferType() const
-{
-    return mStencilbuffer.type();
-}
-
-GLenum Framebuffer::getDepthStencilbufferType() const
-{
-    return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.type() : GL_NONE;
-}
-
-GLuint Framebuffer::getColorbufferHandle(unsigned int colorAttachment) const
-{
-    ASSERT(colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS);
-    return mColorbuffers[colorAttachment].id();
-}
-
-GLuint Framebuffer::getDepthbufferHandle() const
-{
-    return mDepthbuffer.id();
-}
-
-GLuint Framebuffer::getStencilbufferHandle() const
-{
-    return mStencilbuffer.id();
-}
-
-GLenum Framebuffer::getDepthStencilbufferHandle() const
-{
-    return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.id() : 0;
-}
-
-GLenum Framebuffer::getColorbufferMipLevel(unsigned int colorAttachment) const
-{
-    ASSERT(colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS);
-    return mColorbuffers[colorAttachment].mipLevel();
-}
-
-GLenum Framebuffer::getDepthbufferMipLevel() const
-{
-    return mDepthbuffer.mipLevel();
-}
-
-GLenum Framebuffer::getStencilbufferMipLevel() const
-{
-    return mStencilbuffer.mipLevel();
-}
-
-GLenum Framebuffer::getDepthStencilbufferMipLevel() const
-{
-    return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.mipLevel() : 0;
-}
-
-GLenum Framebuffer::getColorbufferLayer(unsigned int colorAttachment) const
-{
-    ASSERT(colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS);
-    return mColorbuffers[colorAttachment].layer();
-}
-
-GLenum Framebuffer::getDepthbufferLayer() const
-{
-    return mDepthbuffer.layer();
-}
-
-GLenum Framebuffer::getStencilbufferLayer() const
-{
-    return mStencilbuffer.layer();
-}
-
-GLenum Framebuffer::getDepthStencilbufferLayer() const
-{
-    return (mDepthbuffer.id() == mStencilbuffer.id()) ? mDepthbuffer.layer() : 0;
-}
-
-GLenum Framebuffer::getDrawBufferState(unsigned int colorAttachment) const
-{
-    return mDrawBufferStates[colorAttachment];
-}
-
-void Framebuffer::setDrawBufferState(unsigned int colorAttachment, GLenum drawBuffer)
-{
-    mDrawBufferStates[colorAttachment] = drawBuffer;
-}
-
-bool Framebuffer::isEnabledColorAttachment(unsigned int colorAttachment) const
-{
-    return (mColorbuffers[colorAttachment].type() != GL_NONE &amp;&amp; mDrawBufferStates[colorAttachment] != GL_NONE);
-}
-
-bool Framebuffer::hasEnabledColorAttachment() const
-{
-    for (unsigned int colorAttachment = 0; colorAttachment &lt; gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        if (isEnabledColorAttachment(colorAttachment))
-        {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-bool Framebuffer::hasStencil() const
-{
-    if (mStencilbuffer.type() != GL_NONE)
-    {
-        const Renderbuffer *stencilbufferObject = getStencilbuffer();
-
-        if (stencilbufferObject)
-        {
-            return stencilbufferObject-&gt;getStencilSize() &gt; 0;
-        }
-    }
-
-    return false;
-}
-
-bool Framebuffer::usingExtendedDrawBuffers() const
-{
-    for (unsigned int colorAttachment = 1; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        if (isEnabledColorAttachment(colorAttachment))
-        {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-GLenum Framebuffer::completeness() const
-{
-    int width = 0;
-    int height = 0;
-    unsigned int colorbufferSize = 0;
-    int samples = -1;
-    bool missingAttachment = true;
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-
-    for (unsigned int colorAttachment = 0; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-    {
-        if (mColorbuffers[colorAttachment].type() != GL_NONE)
-        {
-            const Renderbuffer *colorbuffer = getColorbuffer(colorAttachment);
-
-            if (!colorbuffer)
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-
-            if (colorbuffer-&gt;getWidth() == 0 || colorbuffer-&gt;getHeight() == 0)
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-
-            if (mColorbuffers[colorAttachment].type() == GL_RENDERBUFFER)
-            {
-                if (!gl::IsColorRenderingSupported(colorbuffer-&gt;getInternalFormat(), mRenderer))
-                {
-                    return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-                }
-            }
-            else if (IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer-&gt;getCurrentClientVersion()))
-            {
-                GLenum internalformat = colorbuffer-&gt;getInternalFormat();
-
-                if (!gl::IsColorRenderingSupported(internalformat, mRenderer))
-                {
-                    return GL_FRAMEBUFFER_UNSUPPORTED;
-                }
-
-                if (gl::GetDepthBits(internalformat, clientVersion) &gt; 0 ||
-                    gl::GetStencilBits(internalformat, clientVersion) &gt; 0)
-                {
-                    return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-                }
-            }
-            else
-            {
-                UNREACHABLE();
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-
-            if (!missingAttachment)
-            {
-                // all color attachments must have the same width and height
-                if (colorbuffer-&gt;getWidth() != width || colorbuffer-&gt;getHeight() != height)
-                {
-                    return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
-                }
-
-                // APPLE_framebuffer_multisample, which EXT_draw_buffers refers to, requires that
-                // all color attachments have the same number of samples for the FBO to be complete.
-                if (colorbuffer-&gt;getSamples() != samples)
-                {
-                    return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT;
-                }
-
-                // in GLES 2.0, all color attachments attachments must have the same number of bitplanes
-                // in GLES 3.0, there is no such restriction
-                if (clientVersion &lt; 3)
-                {
-                    if (gl::GetPixelBytes(colorbuffer-&gt;getInternalFormat(), clientVersion) != colorbufferSize)
-                    {
-                        return GL_FRAMEBUFFER_UNSUPPORTED;
-                    }
-                }
-
-                // D3D11 does not allow for overlapping RenderTargetViews, so ensure uniqueness
-                for (unsigned int previousColorAttachment = 0; previousColorAttachment &lt; colorAttachment; previousColorAttachment++)
-                {
-                    if (mColorbuffers[colorAttachment].get() == mColorbuffers[previousColorAttachment].get())
-                    {
-                        return GL_FRAMEBUFFER_UNSUPPORTED;
-                    }
-                }
-            }
-            else
-            {
-                width = colorbuffer-&gt;getWidth();
-                height = colorbuffer-&gt;getHeight();
-                samples = colorbuffer-&gt;getSamples();
-                colorbufferSize = gl::GetPixelBytes(colorbuffer-&gt;getInternalFormat(), clientVersion);
-                missingAttachment = false;
-            }
-        }
-    }
-
-    const Renderbuffer *depthbuffer = NULL;
-    const Renderbuffer *stencilbuffer = NULL;
-
-    if (mDepthbuffer.type() != GL_NONE)
-    {
-        depthbuffer = getDepthbuffer();
-
-        if (!depthbuffer)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (depthbuffer-&gt;getWidth() == 0 || depthbuffer-&gt;getHeight() == 0)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (mDepthbuffer.type() == GL_RENDERBUFFER)
-        {
-            if (!gl::IsDepthRenderingSupported(depthbuffer-&gt;getInternalFormat(), mRenderer))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else if (IsInternalTextureTarget(mDepthbuffer.type(), mRenderer-&gt;getCurrentClientVersion()))
-        {
-            GLenum internalformat = depthbuffer-&gt;getInternalFormat();
-
-            // depth texture attachments require OES/ANGLE_depth_texture
-            if (!mRenderer-&gt;getDepthTextureSupport())
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-
-            if (gl::GetDepthBits(internalformat, clientVersion) == 0)
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else
-        {
-            UNREACHABLE();
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (missingAttachment)
-        {
-            width = depthbuffer-&gt;getWidth();
-            height = depthbuffer-&gt;getHeight();
-            samples = depthbuffer-&gt;getSamples();
-            missingAttachment = false;
-        }
-        else if (width != depthbuffer-&gt;getWidth() || height != depthbuffer-&gt;getHeight())
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
-        }
-        else if (samples != depthbuffer-&gt;getSamples())
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE;
-        }
-    }
-
-    if (mStencilbuffer.type() != GL_NONE)
-    {
-        stencilbuffer = getStencilbuffer();
-
-        if (!stencilbuffer)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (stencilbuffer-&gt;getWidth() == 0 || stencilbuffer-&gt;getHeight() == 0)
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (mStencilbuffer.type() == GL_RENDERBUFFER)
-        {
-            if (!gl::IsStencilRenderingSupported(stencilbuffer-&gt;getInternalFormat(), mRenderer))
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else if (IsInternalTextureTarget(mStencilbuffer.type(), mRenderer-&gt;getCurrentClientVersion()))
-        {
-            GLenum internalformat = stencilbuffer-&gt;getInternalFormat();
-
-            // texture stencil attachments come along as part
-            // of OES_packed_depth_stencil + OES/ANGLE_depth_texture
-            if (!mRenderer-&gt;getDepthTextureSupport())
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-
-            if (gl::GetStencilBits(internalformat, clientVersion) == 0)
-            {
-                return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-            }
-        }
-        else
-        {
-            UNREACHABLE();
-            return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
-        }
-
-        if (missingAttachment)
-        {
-            width = stencilbuffer-&gt;getWidth();
-            height = stencilbuffer-&gt;getHeight();
-            samples = stencilbuffer-&gt;getSamples();
-            missingAttachment = false;
-        }
-        else if (width != stencilbuffer-&gt;getWidth() || height != stencilbuffer-&gt;getHeight())
-        {
-            return GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
-        }
-        else if (samples != stencilbuffer-&gt;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 &amp;&amp; stencilbuffer &amp;&amp; (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(rx::Renderer *renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
-    : Framebuffer(renderer)
-{
-    mColorbuffers[0].set(new Renderbuffer(mRenderer, 0, colorbuffer), GL_RENDERBUFFER, 0, 0);
-
-    Renderbuffer *depthStencilRenderbuffer = new Renderbuffer(mRenderer, 0, depthStencil);
-    mDepthbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer-&gt;getDepthSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
-    mStencilbuffer.set(depthStencilRenderbuffer, (depthStencilRenderbuffer-&gt;getStencilSize() != 0) ? GL_RENDERBUFFER : GL_NONE, 0, 0);
-
-    mDrawBufferStates[0] = GL_BACK;
-    mReadBufferState = GL_BACK;
-}
-
-int Framebuffer::getSamples() const
-{
-    if (completeness() == GL_FRAMEBUFFER_COMPLETE)
-    {
-        // for a complete framebuffer, all attachments must have the same sample count
-        // in this case return the first nonzero sample size
-        for (unsigned int colorAttachment = 0; colorAttachment &lt; IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-        {
-            if (mColorbuffers[colorAttachment].type() != GL_NONE)
-            {
-                return getColorbuffer(colorAttachment)-&gt;getSamples();
-            }
-        }
-    }
-
-    return 0;
-}
-
-GLenum DefaultFramebuffer::completeness() const
-{
-    // The default framebuffer *must* always be complete, though it may not be
-    // subject to the same rules as application FBOs. ie, it could have 0x0 size.
-    return GL_FRAMEBUFFER_COMPLETE;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Framebufferh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Framebuffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,118 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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_
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-#include &quot;constants.h&quot;
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace gl
-{
-class Renderbuffer;
-class Colorbuffer;
-class Depthbuffer;
-class Stencilbuffer;
-class DepthStencilbuffer;
-
-class Framebuffer
-{
-  public:
-    explicit Framebuffer(rx::Renderer *renderer);
-
-    virtual ~Framebuffer();
-
-    void setColorbuffer(unsigned int colorAttachment, GLenum type, GLuint colorbuffer, GLint level, GLint layer);
-    void setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer);
-    void setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer);
-    void setDepthStencilBuffer(GLenum type, GLuint depthStencilBuffer, GLint level, GLint layer);
-
-    void detachTexture(GLuint texture);
-    void detachRenderbuffer(GLuint renderbuffer);
-
-    unsigned int getRenderTargetSerial(unsigned int colorAttachment) const;
-    unsigned int getDepthbufferSerial() const;
-    unsigned int getStencilbufferSerial() const;
-
-    Renderbuffer *getColorbuffer(unsigned int colorAttachment) const;
-    Renderbuffer *getDepthbuffer() const;
-    Renderbuffer *getStencilbuffer() const;
-    Renderbuffer *getDepthStencilBuffer() const;
-    Renderbuffer *getDepthOrStencilbuffer() const;
-    Renderbuffer *getReadColorbuffer() const;
-    GLenum getReadColorbufferType() const;
-    Renderbuffer *getFirstColorbuffer() const;
-
-    GLenum getColorbufferType(unsigned int colorAttachment) const;
-    GLenum getDepthbufferType() const;
-    GLenum getStencilbufferType() const;
-    GLenum getDepthStencilbufferType() const;
-
-    GLuint getColorbufferHandle(unsigned int colorAttachment) const;
-    GLuint getDepthbufferHandle() const;
-    GLuint getStencilbufferHandle() const;
-    GLenum getDepthStencilbufferHandle() const;
-
-    GLenum getColorbufferMipLevel(unsigned int colorAttachment) const;
-    GLenum getDepthbufferMipLevel() const;
-    GLenum getStencilbufferMipLevel() const;
-    GLenum getDepthStencilbufferMipLevel() const;
-
-    GLenum getColorbufferLayer(unsigned int colorAttachment) const;
-    GLenum getDepthbufferLayer() const;
-    GLenum getStencilbufferLayer() const;
-    GLenum getDepthStencilbufferLayer() const;
-
-    GLenum getDrawBufferState(unsigned int colorAttachment) const;
-    void setDrawBufferState(unsigned int colorAttachment, GLenum drawBuffer);
-
-    bool isEnabledColorAttachment(unsigned int colorAttachment) const;
-    bool hasEnabledColorAttachment() const;
-    bool hasStencil() const;
-    int getSamples() const;
-    bool usingExtendedDrawBuffers() const;
-
-    virtual GLenum completeness() const;
-
-  protected:
-    FramebufferTextureBindingPointer&lt;Renderbuffer&gt; mColorbuffers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
-    GLenum mDrawBufferStates[IMPLEMENTATION_MAX_DRAW_BUFFERS];
-    GLenum mReadBufferState;
-
-    FramebufferTextureBindingPointer&lt;Renderbuffer&gt; mDepthbuffer;
-    FramebufferTextureBindingPointer&lt;Renderbuffer&gt; mStencilbuffer;
-
-    rx::Renderer *mRenderer;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Framebuffer);
-
-    Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle, GLint level, GLint layer) const;
-};
-
-class DefaultFramebuffer : public Framebuffer
-{
-  public:
-    DefaultFramebuffer(rx::Renderer *Renderer, Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil);
-
-    virtual GLenum completeness() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(DefaultFramebuffer);
-};
-
-}
-
-#endif   // LIBGLESV2_FRAMEBUFFER_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2HandleAllocatorcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// 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 &quot;libGLESv2/HandleAllocator.h&quot;
-
-#include &quot;libGLESv2/main.h&quot;
-
-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 &gt; mBaseValue)
-        {
-            mNextValue--;
-        }
-    }
-    else
-    {
-        // Only free handles that we own - don't drop below the base value
-        if (handle &gt;= mBaseValue)
-        {
-            mFreeValues.push_back(handle);
-        }
-    }
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2HandleAllocatorh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/HandleAllocator.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,46 +0,0 @@
</span><del>-//
-// 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 &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &lt;vector&gt;
-
-#include &quot;common/angleutils.h&quot;
-
-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&lt;GLuint&gt; HandleList;
-    HandleList mFreeValues;
-};
-
-}
-
-#endif   // LIBGLESV2_HANDLEALLOCATOR_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Programcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,667 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2014 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 &quot;libGLESv2/Program.h&quot;
-#include &quot;libGLESv2/ProgramBinary.h&quot;
-#include &quot;libGLESv2/ResourceManager.h&quot;
-
-namespace gl
-{
-const char * const g_fakepath = &quot;C:\\fakepath&quot;;
-
-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 &gt; 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(&quot;%s&quot;, msg.c_str());
-}
-
-void InfoLog::append(const char *format, ...)
-{
-    if (!format)
-    {
-        return;
-    }
-
-    va_list vararg;
-    va_start(vararg, format);
-    size_t infoLength = vsnprintf(NULL, 0, format, vararg);
-    va_end(vararg);
-
-    char *logPointer = NULL;
-    size_t logLength = 0;
-
-    if (!mInfoLog)
-    {
-        mInfoLog = new char[infoLength + 2];
-        logPointer = mInfoLog;
-        logLength = infoLength + 2;
-    }
-    else
-    {
-        size_t currentlogLength = strlen(mInfoLog);
-        size_t newInfoLogLength = currentlogLength + infoLength + 2;
-        char *newLog = new char[newInfoLogLength];
-        strncpy(newLog, mInfoLog, newInfoLogLength);
-        newLog[newInfoLogLength - 1] = '\0';
-
-        delete[] mInfoLog;
-        mInfoLog = newLog;
-
-        logPointer = mInfoLog + currentlogLength;
-        logLength = newInfoLogLength - currentlogLength;
-    }
-
-    va_start(vararg, format);
-    vsnprintf(logPointer, infoLength, format, vararg);
-    va_end(vararg);
-
-    logPointer[infoLength] = 0;
-    strncpy(logPointer + infoLength, &quot;\n&quot;, logLength - infoLength);
-    logPointer[logLength - 1] = '\0';
-}
-
-void InfoLog::reset()
-{
-    if (mInfoLog)
-    {
-        delete [] mInfoLog;
-        mInfoLog = NULL;
-    }
-}
-
-Program::Program(rx::Renderer *renderer, ResourceManager *manager, GLuint handle) : mResourceManager(manager), mHandle(handle)
-{
-    mFragmentShader = NULL;
-    mVertexShader = NULL;
-    mProgramBinary.set(NULL);
-    mDeleteStatus = false;
-    mLinked = false;
-    mRefCount = 0;
-    mRenderer = renderer;
-
-    resetUniformBlockBindings();
-}
-
-Program::~Program()
-{
-    unlink(true);
-
-    if (mVertexShader != NULL)
-    {
-        mVertexShader-&gt;release();
-    }
-
-    if (mFragmentShader != NULL)
-    {
-        mFragmentShader-&gt;release();
-    }
-}
-
-bool Program::attachShader(Shader *shader)
-{
-    if (shader-&gt;getType() == GL_VERTEX_SHADER)
-    {
-        if (mVertexShader)
-        {
-            return false;
-        }
-
-        mVertexShader = (VertexShader*)shader;
-        mVertexShader-&gt;addRef();
-    }
-    else if (shader-&gt;getType() == GL_FRAGMENT_SHADER)
-    {
-        if (mFragmentShader)
-        {
-            return false;
-        }
-
-        mFragmentShader = (FragmentShader*)shader;
-        mFragmentShader-&gt;addRef();
-    }
-    else UNREACHABLE();
-
-    return true;
-}
-
-bool Program::detachShader(Shader *shader)
-{
-    if (shader-&gt;getType() == GL_VERTEX_SHADER)
-    {
-        if (mVertexShader != shader)
-        {
-            return false;
-        }
-
-        mVertexShader-&gt;release();
-        mVertexShader = NULL;
-    }
-    else if (shader-&gt;getType() == GL_FRAGMENT_SHADER)
-    {
-        if (mFragmentShader != shader)
-        {
-            return false;
-        }
-
-        mFragmentShader-&gt;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 &lt; MAX_VERTEX_ATTRIBS)
-    {
-        for (int i = 0; i &lt; 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
-bool Program::link()
-{
-    unlink(false);
-
-    mInfoLog.reset();
-    resetUniformBlockBindings();
-
-    mProgramBinary.set(new ProgramBinary(mRenderer));
-    mLinked = mProgramBinary-&gt;link(mInfoLog, mAttributeBindings, mFragmentShader, mVertexShader,
-                                   mTransformFeedbackVaryings, mTransformFeedbackBufferMode);
-
-    return mLinked;
-}
-
-int AttributeBindings::getAttributeBinding(const std::string &amp;name) const
-{
-    for (int location = 0; location &lt; 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-&gt;release();
-            mFragmentShader = NULL;
-        }
-
-        if (mVertexShader)
-        {
-            mVertexShader-&gt;release();
-            mVertexShader = NULL;
-        }
-    }
-
-    mProgramBinary.set(NULL);
-    mLinked = false;
-}
-
-bool Program::isLinked()
-{
-    return mLinked;
-}
-
-ProgramBinary* Program::getProgramBinary() const
-{
-    return mProgramBinary.get();
-}
-
-bool Program::setProgramBinary(const void *binary, GLsizei length)
-{
-    unlink(false);
-
-    mInfoLog.reset();
-
-    mProgramBinary.set(new ProgramBinary(mRenderer));
-    mLinked = mProgramBinary-&gt;load(mInfoLog, binary, length);
-    if (!mLinked)
-    {
-        mProgramBinary.set(NULL);
-    }
-
-    return mLinked;
-}
-
-void Program::release()
-{
-    mRefCount--;
-
-    if (mRefCount == 0 &amp;&amp; mDeleteStatus)
-    {
-        mResourceManager-&gt;deleteProgram(mHandle);
-    }
-}
-
-void Program::addRef()
-{
-    mRefCount++;
-}
-
-unsigned int Program::getRefCount() const
-{
-    return mRefCount;
-}
-
-GLint Program::getProgramBinaryLength() const
-{
-    ProgramBinary *programBinary = mProgramBinary.get();
-    if (programBinary)
-    {
-        return programBinary-&gt;getLength();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-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 &lt; maxCount)
-        {
-            shaders[total] = mVertexShader-&gt;getHandle();
-        }
-
-        total++;
-    }
-
-    if (mFragmentShader)
-    {
-        if (total &lt; maxCount)
-        {
-            shaders[total] = mFragmentShader-&gt;getHandle();
-        }
-
-        total++;
-    }
-
-    if (count)
-    {
-        *count = total;
-    }
-}
-
-void Program::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        programBinary-&gt;getActiveAttribute(index, bufsize, length, size, type, name);
-    }
-    else
-    {
-        if (bufsize &gt; 0)
-        {
-            name[0] = '\0';
-        }
-        
-        if (length)
-        {
-            *length = 0;
-        }
-
-        *type = GL_NONE;
-        *size = 1;
-    }
-}
-
-GLint Program::getActiveAttributeCount()
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return programBinary-&gt;getActiveAttributeCount();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLint Program::getActiveAttributeMaxLength()
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return programBinary-&gt;getActiveAttributeMaxLength();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-void Program::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return programBinary-&gt;getActiveUniform(index, bufsize, length, size, type, name);
-    }
-    else
-    {
-        if (bufsize &gt; 0)
-        {
-            name[0] = '\0';
-        }
-
-        if (length)
-        {
-            *length = 0;
-        }
-
-        *size = 0;
-        *type = GL_NONE;
-    }
-}
-
-GLint Program::getActiveUniformCount()
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return programBinary-&gt;getActiveUniformCount();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLint Program::getActiveUniformMaxLength()
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return programBinary-&gt;getActiveUniformMaxLength();
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-void Program::flagForDeletion()
-{
-    mDeleteStatus = true;
-}
-
-bool Program::isFlaggedForDeletion() const
-{
-    return mDeleteStatus;
-}
-
-void Program::validate()
-{
-    mInfoLog.reset();
-
-    ProgramBinary *programBinary = getProgramBinary();
-    if (isLinked() &amp;&amp; programBinary)
-    {
-        programBinary-&gt;validate(mInfoLog);
-    }
-    else
-    {
-        mInfoLog.append(&quot;Program has not been successfully linked.&quot;);
-    }
-}
-
-bool Program::isValidated() const
-{
-    ProgramBinary *programBinary = mProgramBinary.get();
-    if (programBinary)
-    {
-        return programBinary-&gt;isValidated();
-    }
-    else
-    {
-        return false;
-    }
-}
-
-GLint Program::getActiveUniformBlockCount()
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return static_cast&lt;GLint&gt;(programBinary-&gt;getActiveUniformBlockCount());
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLint Program::getActiveUniformBlockMaxLength()
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return static_cast&lt;GLint&gt;(programBinary-&gt;getActiveUniformBlockMaxLength());
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-void Program::bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
-    mUniformBlockBindings[uniformBlockIndex] = uniformBlockBinding;
-}
-
-GLuint Program::getUniformBlockBinding(GLuint uniformBlockIndex) const
-{
-    return mUniformBlockBindings[uniformBlockIndex];
-}
-
-void Program::resetUniformBlockBindings()
-{
-    for (unsigned int blockId = 0; blockId &lt; IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS; blockId++)
-    {
-        mUniformBlockBindings[blockId] = 0;
-    }
-}
-
-void Program::setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
-{
-    mTransformFeedbackVaryings.resize(count);
-    for (GLsizei i = 0; i &lt; count; i++)
-    {
-        mTransformFeedbackVaryings[i] = varyings[i];
-    }
-
-    mTransformFeedbackBufferMode = bufferMode;
-}
-
-void Program::getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary &amp;&amp; index &lt; programBinary-&gt;getTransformFeedbackVaryingCount())
-    {
-        const LinkedVarying &amp;varying = programBinary-&gt;getTransformFeedbackVarying(index);
-        GLsizei lastNameIdx = std::min(bufSize - 1, static_cast&lt;GLsizei&gt;(varying.name.length()));
-        if (length)
-        {
-            *length = lastNameIdx;
-        }
-        if (size)
-        {
-            *size = varying.size;
-        }
-        if (type)
-        {
-            *type = varying.type;
-        }
-        if (name)
-        {
-            memcpy(name, varying.name.c_str(), lastNameIdx);
-            name[lastNameIdx] = '\0';
-        }
-    }
-}
-
-GLsizei Program::getTransformFeedbackVaryingCount() const
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return static_cast&lt;GLsizei&gt;(programBinary-&gt;getTransformFeedbackVaryingCount());
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLsizei Program::getTransformFeedbackVaryingMaxLength() const
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        GLsizei maxSize = 0;
-        for (size_t i = 0; i &lt; programBinary-&gt;getTransformFeedbackVaryingCount(); i++)
-        {
-            const LinkedVarying &amp;varying = programBinary-&gt;getTransformFeedbackVarying(i);
-            maxSize = std::max(maxSize, static_cast&lt;GLsizei&gt;(varying.name.length() + 1));
-        }
-
-        return maxSize;
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-GLenum Program::getTransformFeedbackBufferMode() const
-{
-    ProgramBinary *programBinary = getProgramBinary();
-    if (programBinary)
-    {
-        return programBinary-&gt;getTransformFeedbackBufferMode();
-    }
-    else
-    {
-        return mTransformFeedbackBufferMode;
-    }
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Programh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Program.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,148 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2014 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 &lt;string&gt;
-#include &lt;set&gt;
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-#include &quot;libGLESv2/Constants.h&quot;
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace gl
-{
-class ResourceManager;
-class FragmentShader;
-class VertexShader;
-class ProgramBinary;
-class Shader;
-
-extern const char * const g_fakepath;
-
-class AttributeBindings
-{
-  public:
-    AttributeBindings();
-    ~AttributeBindings();
-
-    void bindAttributeLocation(GLuint index, const char *name);
-    int getAttributeBinding(const std::string &amp;name) const;
-
-  private:
-    std::set&lt;std::string&gt; 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(rx::Renderer *renderer, ResourceManager *manager, GLuint handle);
-
-    ~Program();
-
-    bool attachShader(Shader *shader);
-    bool detachShader(Shader *shader);
-    int getAttachedShadersCount() const;
-
-    void bindAttributeLocation(GLuint index, const char *name);
-
-    bool link();
-    bool isLinked();
-    bool setProgramBinary(const void *binary, GLsizei length);
-    ProgramBinary *getProgramBinary() const;
-
-    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();
-
-    GLint getActiveUniformBlockCount();
-    GLint getActiveUniformBlockMaxLength();
-
-    void bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-    GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const;
-
-    void setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode);
-    void getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const;
-    GLsizei getTransformFeedbackVaryingCount() const;
-    GLsizei getTransformFeedbackVaryingMaxLength() const;
-    GLenum getTransformFeedbackBufferMode() const;
-
-    void addRef();
-    void release();
-    unsigned int getRefCount() const;
-    void flagForDeletion();
-    bool isFlaggedForDeletion() const;
-
-    void validate();
-    bool isValidated() const;
-
-    GLint getProgramBinaryLength() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Program);
-
-    void unlink(bool destroy = false);
-    void resetUniformBlockBindings();
-
-    FragmentShader *mFragmentShader;
-    VertexShader *mVertexShader;
-
-    AttributeBindings mAttributeBindings;
-
-    GLuint mUniformBlockBindings[IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS];
-
-    std::vector&lt;std::string&gt; mTransformFeedbackVaryings;
-    GLuint mTransformFeedbackBufferMode;
-
-    BindingPointer&lt;ProgramBinary&gt; mProgramBinary;
-    bool mLinked;
-    bool mDeleteStatus;   // Flag to indicate that the program can be deleted when no longer in use
-
-    unsigned int mRefCount;
-
-    ResourceManager *mResourceManager;
-    rx::Renderer *mRenderer;
-    const GLuint mHandle;
-
-    InfoLog mInfoLog;
-};
-}
-
-#endif   // LIBGLESV2_PROGRAM_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ProgramBinarycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,2742 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2014 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 &quot;libGLESv2/BinaryStream.h&quot;
-#include &quot;libGLESv2/ProgramBinary.h&quot;
-#include &quot;libGLESv2/renderer/ShaderExecutable.h&quot;
-
-#include &quot;common/debug.h&quot;
-#include &quot;common/version.h&quot;
-#include &quot;common/utilities.h&quot;
-
-#include &quot;libGLESv2/main.h&quot;
-#include &quot;libGLESv2/Shader.h&quot;
-#include &quot;libGLESv2/Program.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/renderer/VertexDataManager.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/Buffer.h&quot;
-#include &quot;libGLESv2/DynamicHLSL.h&quot;
-
-#undef near
-#undef far
-
-namespace gl
-{
-
-namespace 
-{
-
-unsigned int ParseAndStripArrayIndex(std::string* name)
-{
-    unsigned int subscript = GL_INVALID_INDEX;
-
-    // Strip any trailing array operator and retrieve the subscript
-    size_t open = name-&gt;find_last_of('[');
-    size_t close = name-&gt;find_last_of(']');
-    if (open != std::string::npos &amp;&amp; close == name-&gt;length() - 1)
-    {
-        subscript = atoi(name-&gt;substr(open + 1).c_str());
-        name-&gt;erase(open);
-    }
-
-    return subscript;
-}
-
-void GetInputLayoutFromShader(const std::vector&lt;gl::Attribute&gt; &amp;shaderAttributes, VertexFormat inputLayout[MAX_VERTEX_ATTRIBS])
-{
-    size_t layoutIndex = 0;
-    for (size_t attributeIndex = 0; attributeIndex &lt; shaderAttributes.size(); attributeIndex++)
-    {
-        ASSERT(layoutIndex &lt; MAX_VERTEX_ATTRIBS);
-
-        const gl::Attribute &amp;shaderAttr = shaderAttributes[attributeIndex];
-
-        if (shaderAttr.type != GL_NONE)
-        {
-            GLenum transposedType = TransposeMatrixType(shaderAttr.type);
-
-            for (size_t rowIndex = 0; static_cast&lt;int&gt;(rowIndex) &lt; VariableRowCount(transposedType); rowIndex++, layoutIndex++)
-            {
-                VertexFormat *defaultFormat = &amp;inputLayout[layoutIndex];
-
-                defaultFormat-&gt;mType = UniformComponentType(transposedType);
-                defaultFormat-&gt;mNormalized = false;
-                defaultFormat-&gt;mPureInteger = (defaultFormat-&gt;mType != GL_FLOAT); // note: inputs can not be bool
-                defaultFormat-&gt;mComponents = VariableColumnCount(transposedType);
-            }
-        }
-    }
-}
-
-}
-
-VariableLocation::VariableLocation(const std::string &amp;name, unsigned int element, unsigned int index) 
-    : name(name), element(element), index(index)
-{
-}
-
-ProgramBinary::VertexExecutable::VertexExecutable(rx::Renderer *const renderer,
-                                                  const VertexFormat inputLayout[],
-                                                  rx::ShaderExecutable *shaderExecutable)
-    : mShaderExecutable(shaderExecutable)
-{
-    for (size_t attributeIndex = 0; attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        mInputs[attributeIndex] = inputLayout[attributeIndex];
-    }
-}
-
-ProgramBinary::VertexExecutable::~VertexExecutable()
-{
-    delete mShaderExecutable;
-}
-
-bool ProgramBinary::VertexExecutable::matchesInputLayout(const VertexFormat attributes[]) const
-{
-    for (size_t attributeIndex = 0; attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        if (mInputs[attributeIndex] != attributes[attributeIndex])
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-LinkedVarying::LinkedVarying()
-{
-}
-
-LinkedVarying::LinkedVarying(const std::string &amp;name, GLenum type, GLsizei size, const std::string &amp;semanticName,
-                             unsigned int semanticIndex, unsigned int semanticIndexCount)
-    : name(name), type(type), size(size), semanticName(semanticName), semanticIndex(semanticIndex), semanticIndexCount(semanticIndexCount)
-{
-}
-
-unsigned int ProgramBinary::mCurrentSerial = 1;
-
-ProgramBinary::ProgramBinary(rx::Renderer *renderer)
-    : RefCountObject(0),
-      mRenderer(renderer),
-      mDynamicHLSL(NULL),
-      mVertexWorkarounds(rx::ANGLE_D3D_WORKAROUND_NONE),
-      mPixelExecutable(NULL),
-      mGeometryExecutable(NULL),
-      mUsedVertexSamplerRange(0),
-      mUsedPixelSamplerRange(0),
-      mUsesPointSize(false),
-      mShaderVersion(100),
-      mVertexUniformStorage(NULL),
-      mFragmentUniformStorage(NULL),
-      mValidated(false),
-      mSerial(issueSerial())
-{
-    for (int index = 0; index &lt; MAX_VERTEX_ATTRIBS; index++)
-    {
-        mSemanticIndex[index] = -1;
-    }
-
-    for (int index = 0; index &lt; MAX_TEXTURE_IMAGE_UNITS; index++)
-    {
-        mSamplersPS[index].active = false;
-    }
-
-    for (int index = 0; index &lt; IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; index++)
-    {
-        mSamplersVS[index].active = false;
-    }
-
-    mDynamicHLSL = new DynamicHLSL(renderer);
-}
-
-ProgramBinary::~ProgramBinary()
-{
-    while (!mVertexExecutables.empty())
-    {
-        delete mVertexExecutables.back();
-        mVertexExecutables.pop_back();
-    }
-
-    SafeDelete(mGeometryExecutable);
-    SafeDelete(mPixelExecutable);
-
-    while (!mUniforms.empty())
-    {
-        delete mUniforms.back();
-        mUniforms.pop_back();
-    }
-
-    while (!mUniformBlocks.empty())
-    {
-        delete mUniformBlocks.back();
-        mUniformBlocks.pop_back();
-    }
-
-    SafeDelete(mVertexUniformStorage);
-    SafeDelete(mFragmentUniformStorage);
-    SafeDelete(mDynamicHLSL);
-}
-
-unsigned int ProgramBinary::getSerial() const
-{
-    return mSerial;
-}
-
-int ProgramBinary::getShaderVersion() const
-{
-    return mShaderVersion;
-}
-
-unsigned int ProgramBinary::issueSerial()
-{
-    return mCurrentSerial++;
-}
-
-rx::ShaderExecutable *ProgramBinary::getPixelExecutable() const
-{
-    return mPixelExecutable;
-}
-
-rx::ShaderExecutable *ProgramBinary::getVertexExecutableForInputLayout(const VertexFormat inputLayout[gl::MAX_VERTEX_ATTRIBS])
-{
-    for (size_t executableIndex = 0; executableIndex &lt; mVertexExecutables.size(); executableIndex++)
-    {
-        if (mVertexExecutables[executableIndex]-&gt;matchesInputLayout(inputLayout))
-        {
-            return mVertexExecutables[executableIndex]-&gt;shaderExecutable();
-        }
-    }
-
-    // Generate new dynamic layout with attribute conversions
-    const std::string &amp;layoutHLSL = mDynamicHLSL-&gt;generateInputLayoutHLSL(inputLayout, mShaderAttributes);
-
-    // Generate new shader source by replacing the attributes stub with the defined input layout
-    std::string vertexHLSL = mVertexHLSL;
-    size_t insertPos = vertexHLSL.find(DynamicHLSL::VERTEX_ATTRIBUTE_STUB_STRING);
-    vertexHLSL.replace(insertPos, DynamicHLSL::VERTEX_ATTRIBUTE_STUB_STRING.length(), layoutHLSL);
-
-    // Generate new vertex executable
-    InfoLog tempInfoLog;
-    rx::ShaderExecutable *vertexExecutable = mRenderer-&gt;compileToExecutable(tempInfoLog, vertexHLSL.c_str(),
-                                                                            rx::SHADER_VERTEX,
-                                                                            mTransformFeedbackLinkedVaryings,
-                                                                            (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
-                                                                            mVertexWorkarounds);
-
-    if (!vertexExecutable)
-    {
-        std::vector&lt;char&gt; tempCharBuffer(tempInfoLog.getLength()+3);
-        tempInfoLog.getLog(tempInfoLog.getLength(), NULL, &amp;tempCharBuffer[0]);
-        ERR(&quot;Error compiling dynamic vertex executable:\n%s\n&quot;, &amp;tempCharBuffer[0]);
-    }
-    else
-    {
-        mVertexExecutables.push_back(new VertexExecutable(mRenderer, inputLayout, vertexExecutable));
-    }
-
-    return vertexExecutable;
-}
-
-rx::ShaderExecutable *ProgramBinary::getGeometryExecutable() const
-{
-    return mGeometryExecutable;
-}
-
-GLuint ProgramBinary::getAttributeLocation(const char *name)
-{
-    if (name)
-    {
-        for (int index = 0; index &lt; MAX_VERTEX_ATTRIBS; index++)
-        {
-            if (mLinkedAttribute[index].name == std::string(name))
-            {
-                return index;
-            }
-        }
-    }
-
-    return -1;
-}
-
-int ProgramBinary::getSemanticIndex(int attributeIndex)
-{
-    ASSERT(attributeIndex &gt;= 0 &amp;&amp; attributeIndex &lt; 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;
-    }
-}
-
-bool ProgramBinary::usesPointSize() const
-{
-    return mUsesPointSize;
-}
-
-bool ProgramBinary::usesPointSpriteEmulation() const
-{
-    return mUsesPointSize &amp;&amp; mRenderer-&gt;getMajorShaderModel() &gt;= 4;
-}
-
-bool ProgramBinary::usesGeometryShader() const
-{
-    return usesPointSpriteEmulation();
-}
-
-// 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 &lt; sizeof(mSamplersPS)/sizeof(mSamplersPS[0]));
-
-        if (mSamplersPS[samplerIndex].active)
-        {
-            logicalTextureUnit = mSamplersPS[samplerIndex].logicalTextureUnit;
-        }
-        break;
-      case SAMPLER_VERTEX:
-        ASSERT(samplerIndex &lt; sizeof(mSamplersVS)/sizeof(mSamplersVS[0]));
-
-        if (mSamplersVS[samplerIndex].active)
-        {
-            logicalTextureUnit = mSamplersVS[samplerIndex].logicalTextureUnit;
-        }
-        break;
-      default: UNREACHABLE();
-    }
-
-    if (logicalTextureUnit &gt;= 0 &amp;&amp; logicalTextureUnit &lt; (GLint)mRenderer-&gt;getMaxCombinedTextureImageUnits())
-    {
-        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 &lt; sizeof(mSamplersPS)/sizeof(mSamplersPS[0]));
-        ASSERT(mSamplersPS[samplerIndex].active);
-        return mSamplersPS[samplerIndex].textureType;
-      case SAMPLER_VERTEX:
-        ASSERT(samplerIndex &lt; 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 = ParseAndStripArrayIndex(&amp;name);
-
-    unsigned int numUniforms = mUniformIndex.size();
-    for (unsigned int location = 0; location &lt; numUniforms; location++)
-    {
-        if (mUniformIndex[location].name == name)
-        {
-            const int index = mUniformIndex[location].index;
-            const bool isArray = mUniforms[index]-&gt;isArray();
-
-            if ((isArray &amp;&amp; mUniformIndex[location].element == subscript) || 
-                (subscript == GL_INVALID_INDEX))
-            {
-                return location;
-            }
-        }
-    }
-
-    return -1;
-}
-
-GLuint ProgramBinary::getUniformIndex(std::string name)
-{
-    unsigned int subscript = ParseAndStripArrayIndex(&amp;name);
-
-    // The app is not allowed to specify array indices other than 0 for arrays of basic types
-    if (subscript != 0 &amp;&amp; subscript != GL_INVALID_INDEX)
-    {
-        return GL_INVALID_INDEX;
-    }
-
-    unsigned int numUniforms = mUniforms.size();
-    for (unsigned int index = 0; index &lt; numUniforms; index++)
-    {
-        if (mUniforms[index]-&gt;name == name)
-        {
-            if (mUniforms[index]-&gt;isArray() || subscript == GL_INVALID_INDEX)
-            {
-                return index;
-            }
-        }
-    }
-
-    return GL_INVALID_INDEX;
-}
-
-GLuint ProgramBinary::getUniformBlockIndex(std::string name)
-{
-    unsigned int subscript = ParseAndStripArrayIndex(&amp;name);
-
-    unsigned int numUniformBlocks = mUniformBlocks.size();
-    for (unsigned int blockIndex = 0; blockIndex &lt; numUniformBlocks; blockIndex++)
-    {
-        const UniformBlock &amp;uniformBlock = *mUniformBlocks[blockIndex];
-        if (uniformBlock.name == name)
-        {
-            const bool arrayElementZero = (subscript == GL_INVALID_INDEX &amp;&amp; uniformBlock.elementIndex == 0);
-            if (subscript == uniformBlock.elementIndex || arrayElementZero)
-            {
-                return blockIndex;
-            }
-        }
-    }
-
-    return GL_INVALID_INDEX;
-}
-
-UniformBlock *ProgramBinary::getUniformBlockByIndex(GLuint blockIndex)
-{
-    ASSERT(blockIndex &lt; mUniformBlocks.size());
-    return mUniformBlocks[blockIndex];
-}
-
-GLint ProgramBinary::getFragDataLocation(const char *name) const
-{
-    std::string baseName(name);
-    unsigned int arrayIndex;
-    arrayIndex = ParseAndStripArrayIndex(&amp;baseName);
-
-    for (auto locationIt = mOutputVariables.begin(); locationIt != mOutputVariables.end(); locationIt++)
-    {
-        const VariableLocation &amp;outputVariable = locationIt-&gt;second;
-
-        if (outputVariable.name == baseName &amp;&amp; (arrayIndex == GL_INVALID_INDEX || arrayIndex == outputVariable.element))
-        {
-            return static_cast&lt;GLint&gt;(locationIt-&gt;first);
-        }
-    }
-
-    return -1;
-}
-
-size_t ProgramBinary::getTransformFeedbackVaryingCount() const
-{
-    return mTransformFeedbackLinkedVaryings.size();
-}
-
-const LinkedVarying &amp;ProgramBinary::getTransformFeedbackVarying(size_t idx) const
-{
-    return mTransformFeedbackLinkedVaryings[idx];
-}
-
-GLenum ProgramBinary::getTransformFeedbackBufferMode() const
-{
-    return mTransformFeedbackBufferMode;
-}
-
-template &lt;typename T&gt;
-bool ProgramBinary::setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType)
-{
-    if (location &lt; 0 || location &gt;= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    const int components = UniformComponentCount(targetUniformType);
-    const GLenum targetBoolType = UniformBoolVectorType(targetUniformType);
-
-    LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform-&gt;dirty = true;
-
-    int elementCount = targetUniform-&gt;elementCount();
-
-    if (elementCount == 1 &amp;&amp; count &gt; 1)
-        return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
-    count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-
-    if (targetUniform-&gt;type == targetUniformType)
-    {
-        T *target = (T*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-        for (int i = 0; i &lt; count; i++)
-        {
-            for (int c = 0; c &lt; components; c++)
-            {
-                target[c] = v[c];
-            }
-            for (int c = components; c &lt; 4; c++)
-            {
-                target[c] = 0;
-            }
-            target += 4;
-            v += components;
-        }
-    }
-    else if (targetUniform-&gt;type == targetBoolType)
-    {
-        GLint *boolParams = (GLint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-        for (int i = 0; i &lt; count; i++)
-        {
-            for (int c = 0; c &lt; components; c++)
-            {
-                boolParams[c] = (v[c] == static_cast&lt;T&gt;(0)) ? GL_FALSE : GL_TRUE;
-            }
-            for (int c = components; c &lt; 4; c++)
-            {
-                boolParams[c] = GL_FALSE;
-            }
-            boolParams += 4;
-            v += components;
-        }
-    }
-    else
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
-    return setUniform(location, count, v, GL_FLOAT);
-}
-
-bool ProgramBinary::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
-{
-    return setUniform(location, count, v, GL_FLOAT_VEC2);
-}
-
-bool ProgramBinary::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
-{
-    return setUniform(location, count, v, GL_FLOAT_VEC3);
-}
-
-bool ProgramBinary::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
-{
-    return setUniform(location, count, v, GL_FLOAT_VEC4);
-}
-
-template&lt;typename T&gt;
-void transposeMatrix(T *target, const GLfloat *value, int targetWidth, int targetHeight, int srcWidth, int srcHeight)
-{
-    int copyWidth = std::min(targetHeight, srcWidth);
-    int copyHeight = std::min(targetWidth, srcHeight);
-
-    for (int x = 0; x &lt; copyWidth; x++)
-    {
-        for (int y = 0; y &lt; copyHeight; y++)
-        {
-            target[x * targetWidth + y] = static_cast&lt;T&gt;(value[y * srcWidth + x]);
-        }
-    }
-    // clear unfilled right side
-    for (int y = 0; y &lt; copyWidth; y++)
-    {
-        for (int x = copyHeight; x &lt; targetWidth; x++)
-        {
-            target[y * targetWidth + x] = static_cast&lt;T&gt;(0);
-        }
-    }
-    // clear unfilled bottom.
-    for (int y = copyWidth; y &lt; targetHeight; y++)
-    {
-        for (int x = 0; x &lt; targetWidth; x++)
-        {
-            target[y * targetWidth + x] = static_cast&lt;T&gt;(0);
-        }
-    }
-}
-
-template&lt;typename T&gt;
-void expandMatrix(T *target, const GLfloat *value, int targetWidth, int targetHeight, int srcWidth, int srcHeight)
-{
-    int copyWidth = std::min(targetWidth, srcWidth);
-    int copyHeight = std::min(targetHeight, srcHeight);
-
-    for (int y = 0; y &lt; copyHeight; y++)
-    {
-        for (int x = 0; x &lt; copyWidth; x++)
-        {
-            target[y * targetWidth + x] = static_cast&lt;T&gt;(value[y * srcWidth + x]);
-        }
-    }
-    // clear unfilled right side
-    for (int y = 0; y &lt; copyHeight; y++)
-    {
-        for (int x = copyWidth; x &lt; targetWidth; x++)
-        {
-            target[y * targetWidth + x] = static_cast&lt;T&gt;(0);
-        }
-    }
-    // clear unfilled bottom.
-    for (int y = copyHeight; y &lt; targetHeight; y++)
-    {
-        for (int x = 0; x &lt; targetWidth; x++)
-        {
-            target[y * targetWidth + x] = static_cast&lt;T&gt;(0);
-        }
-    }
-}
-
-template &lt;int cols, int rows&gt;
-bool ProgramBinary::setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType) 
-{
-    if (location &lt; 0 || location &gt;= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform-&gt;dirty = true;
-
-    if (targetUniform-&gt;type != targetUniformType)
-    {
-        return false;
-    }
-
-    int elementCount = targetUniform-&gt;elementCount();
-
-    if (elementCount == 1 &amp;&amp; count &gt; 1)
-        return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
-    count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-    const unsigned int targetMatrixStride = (4 * rows);
-    GLfloat *target = (GLfloat*)(targetUniform-&gt;data + mUniformIndex[location].element * sizeof(GLfloat) * targetMatrixStride);
-
-    for (int i = 0; i &lt; count; i++)
-    {
-        // Internally store matrices as transposed versions to accomodate HLSL matrix indexing
-        if (transpose == GL_FALSE)
-        {
-            transposeMatrix&lt;GLfloat&gt;(target, value, 4, rows, rows, cols);
-        }
-        else
-        {
-            expandMatrix&lt;GLfloat&gt;(target, value, 4, rows, cols, rows);
-        }
-        target += targetMatrixStride;
-        value += cols * rows;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;2, 2&gt;(location, count, transpose, value, GL_FLOAT_MAT2);
-}
-
-bool ProgramBinary::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;3, 3&gt;(location, count, transpose, value, GL_FLOAT_MAT3);
-}
-
-bool ProgramBinary::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;4, 4&gt;(location, count, transpose, value, GL_FLOAT_MAT4);
-}
-
-bool ProgramBinary::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;2, 3&gt;(location, count, transpose, value, GL_FLOAT_MAT2x3);
-}
-
-bool ProgramBinary::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;3, 2&gt;(location, count, transpose, value, GL_FLOAT_MAT3x2);
-}
-
-bool ProgramBinary::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;2, 4&gt;(location, count, transpose, value, GL_FLOAT_MAT2x4);
-}
-
-bool ProgramBinary::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;4, 2&gt;(location, count, transpose, value, GL_FLOAT_MAT4x2);
-}
-
-bool ProgramBinary::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;3, 4&gt;(location, count, transpose, value, GL_FLOAT_MAT3x4);
-}
-
-bool ProgramBinary::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
-    return setUniformMatrixfv&lt;4, 3&gt;(location, count, transpose, value, GL_FLOAT_MAT4x3);
-}
-
-bool ProgramBinary::setUniform1iv(GLint location, GLsizei count, const GLint *v)
-{
-    if (location &lt; 0 || location &gt;= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
-    targetUniform-&gt;dirty = true;
-
-    int elementCount = targetUniform-&gt;elementCount();
-
-    if (elementCount == 1 &amp;&amp; count &gt; 1)
-        return false; // attempting to write an array to a non-array uniform is an INVALID_OPERATION
-
-    count = std::min(elementCount - (int)mUniformIndex[location].element, count);
-
-    if (targetUniform-&gt;type == GL_INT || IsSampler(targetUniform-&gt;type))
-    {
-        GLint *target = (GLint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-        for (int i = 0; i &lt; count; i++)
-        {
-            target[0] = v[0];
-            target[1] = 0;
-            target[2] = 0;
-            target[3] = 0;
-            target += 4;
-            v += 1;
-        }
-    }
-    else if (targetUniform-&gt;type == GL_BOOL)
-    {
-        GLint *boolParams = (GLint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-        for (int i = 0; i &lt; count; i++)
-        {
-            boolParams[0] = (v[0] == 0) ? GL_FALSE : GL_TRUE;
-            boolParams[1] = GL_FALSE;
-            boolParams[2] = GL_FALSE;
-            boolParams[3] = GL_FALSE;
-            boolParams += 4;
-            v += 1;
-        }
-    }
-    else
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::setUniform2iv(GLint location, GLsizei count, const GLint *v)
-{
-    return setUniform(location, count, v, GL_INT_VEC2);
-}
-
-bool ProgramBinary::setUniform3iv(GLint location, GLsizei count, const GLint *v)
-{
-    return setUniform(location, count, v, GL_INT_VEC3);
-}
-
-bool ProgramBinary::setUniform4iv(GLint location, GLsizei count, const GLint *v)
-{
-    return setUniform(location, count, v, GL_INT_VEC4);
-}
-
-bool ProgramBinary::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
-{
-    return setUniform(location, count, v, GL_UNSIGNED_INT);
-}
-
-bool ProgramBinary::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
-{
-    return setUniform(location, count, v, GL_UNSIGNED_INT_VEC2);
-}
-
-bool ProgramBinary::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
-{
-    return setUniform(location, count, v, GL_UNSIGNED_INT_VEC3);
-}
-
-bool ProgramBinary::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
-{
-    return setUniform(location, count, v, GL_UNSIGNED_INT_VEC4);
-}
-
-template &lt;typename T&gt;
-bool ProgramBinary::getUniformv(GLint location, GLsizei *bufSize, T *params, GLenum uniformType)
-{
-    if (location &lt; 0 || location &gt;= (int)mUniformIndex.size())
-    {
-        return false;
-    }
-
-    LinkedUniform *targetUniform = mUniforms[mUniformIndex[location].index];
-
-    // sized queries -- ensure the provided buffer is large enough
-    if (bufSize)
-    {
-        int requiredBytes = UniformExternalSize(targetUniform-&gt;type);
-        if (*bufSize &lt; requiredBytes)
-        {
-            return false;
-        }
-    }
-
-    if (IsMatrixType(targetUniform-&gt;type))
-    {
-        const int rows = VariableRowCount(targetUniform-&gt;type);
-        const int cols = VariableColumnCount(targetUniform-&gt;type);
-        transposeMatrix(params, (GLfloat*)targetUniform-&gt;data + mUniformIndex[location].element * 4 * rows, rows, cols, 4, rows);
-    }
-    else if (uniformType == UniformComponentType(targetUniform-&gt;type))
-    {
-        unsigned int size = UniformComponentCount(targetUniform-&gt;type);
-        memcpy(params, targetUniform-&gt;data + mUniformIndex[location].element * 4 * sizeof(T),
-                size * sizeof(T));
-    }
-    else
-    {
-        unsigned int size = UniformComponentCount(targetUniform-&gt;type);
-        switch (UniformComponentType(targetUniform-&gt;type))
-        {
-          case GL_BOOL:
-            {
-                GLint *boolParams = (GLint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-                for (unsigned int i = 0; i &lt; size; i++)
-                {
-                    params[i] = (boolParams[i] == GL_FALSE) ? static_cast&lt;T&gt;(0) : static_cast&lt;T&gt;(1);
-                }
-            }
-            break;
-
-          case GL_FLOAT:
-            {
-                GLfloat *floatParams = (GLfloat*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-                for (unsigned int i = 0; i &lt; size; i++)
-                {
-                    params[i] = static_cast&lt;T&gt;(floatParams[i]);
-                }
-            }
-            break;
-
-          case GL_INT:
-            {
-                GLint *intParams = (GLint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-                for (unsigned int i = 0; i &lt; size; i++)
-                {
-                    params[i] = static_cast&lt;T&gt;(intParams[i]);
-                }
-            }
-            break;
-       
-          case GL_UNSIGNED_INT:
-            {
-                GLuint *uintParams = (GLuint*)targetUniform-&gt;data + mUniformIndex[location].element * 4;
-
-                for (unsigned int i = 0; i &lt; size; i++)
-                {
-                    params[i] = static_cast&lt;T&gt;(uintParams[i]);
-                }
-            }
-            break;
-          
-          default: UNREACHABLE();
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params)
-{
-    return getUniformv(location, bufSize, params, GL_FLOAT);
-}
-
-bool ProgramBinary::getUniformiv(GLint location, GLsizei *bufSize, GLint *params)
-{
-    return getUniformv(location, bufSize, params, GL_INT);
-}
-
-bool ProgramBinary::getUniformuiv(GLint location, GLsizei *bufSize, GLuint *params)
-{
-    return getUniformv(location, bufSize, params, GL_UNSIGNED_INT);
-}
-
-void ProgramBinary::dirtyAllUniforms()
-{
-    unsigned int numUniforms = mUniforms.size();
-    for (unsigned int index = 0; index &lt; numUniforms; index++)
-    {
-        mUniforms[index]-&gt;dirty = true;
-    }
-}
-
-// Applies all the uniforms set for this program object to the renderer
-void ProgramBinary::applyUniforms()
-{
-    // Retrieve sampler uniform values
-    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
-    {
-        LinkedUniform *targetUniform = mUniforms[uniformIndex];
-
-        if (targetUniform-&gt;dirty)
-        {
-            if (IsSampler(targetUniform-&gt;type))
-            {
-                int count = targetUniform-&gt;elementCount();
-                GLint (*v)[4] = (GLint(*)[4])targetUniform-&gt;data;
-
-                if (targetUniform-&gt;isReferencedByFragmentShader())
-                {
-                    unsigned int firstIndex = targetUniform-&gt;psRegisterIndex;
-
-                    for (int i = 0; i &lt; count; i++)
-                    {
-                        unsigned int samplerIndex = firstIndex + i;
-
-                        if (samplerIndex &lt; MAX_TEXTURE_IMAGE_UNITS)
-                        {
-                            ASSERT(mSamplersPS[samplerIndex].active);
-                            mSamplersPS[samplerIndex].logicalTextureUnit = v[i][0];
-                        }
-                    }
-                }
-
-                if (targetUniform-&gt;isReferencedByVertexShader())
-                {
-                    unsigned int firstIndex = targetUniform-&gt;vsRegisterIndex;
-
-                    for (int i = 0; i &lt; count; i++)
-                    {
-                        unsigned int samplerIndex = firstIndex + i;
-
-                        if (samplerIndex &lt; IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS)
-                        {
-                            ASSERT(mSamplersVS[samplerIndex].active);
-                            mSamplersVS[samplerIndex].logicalTextureUnit = v[i][0];
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    mRenderer-&gt;applyUniforms(*this);
-
-    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
-    {
-        mUniforms[uniformIndex]-&gt;dirty = false;
-    }
-}
-
-bool ProgramBinary::applyUniformBuffers(const std::vector&lt;gl::Buffer*&gt; boundBuffers)
-{
-    const gl::Buffer *vertexUniformBuffers[gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS] = {NULL};
-    const gl::Buffer *fragmentUniformBuffers[gl::IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS] = {NULL};
-
-    const unsigned int reservedBuffersInVS = mRenderer-&gt;getReservedVertexUniformBuffers();
-    const unsigned int reservedBuffersInFS = mRenderer-&gt;getReservedFragmentUniformBuffers();
-
-    ASSERT(boundBuffers.size() == mUniformBlocks.size());
-
-    for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; mUniformBlocks.size(); uniformBlockIndex++)
-    {
-        gl::UniformBlock *uniformBlock = getUniformBlockByIndex(uniformBlockIndex);
-        gl::Buffer *uniformBuffer = boundBuffers[uniformBlockIndex];
-
-        ASSERT(uniformBlock &amp;&amp; uniformBuffer);
-
-        if (uniformBuffer-&gt;size() &lt; uniformBlock-&gt;dataSize)
-        {
-            // undefined behaviour
-            return false;
-        }
-
-        ASSERT(uniformBlock-&gt;isReferencedByVertexShader() || uniformBlock-&gt;isReferencedByFragmentShader());
-
-        if (uniformBlock-&gt;isReferencedByVertexShader())
-        {
-            unsigned int registerIndex = uniformBlock-&gt;vsRegisterIndex - reservedBuffersInVS;
-            ASSERT(vertexUniformBuffers[registerIndex] == NULL);
-            ASSERT(registerIndex &lt; mRenderer-&gt;getMaxVertexShaderUniformBuffers());
-            vertexUniformBuffers[registerIndex] = uniformBuffer;
-        }
-
-        if (uniformBlock-&gt;isReferencedByFragmentShader())
-        {
-            unsigned int registerIndex = uniformBlock-&gt;psRegisterIndex - reservedBuffersInFS;
-            ASSERT(fragmentUniformBuffers[registerIndex] == NULL);
-            ASSERT(registerIndex &lt; mRenderer-&gt;getMaxFragmentShaderUniformBuffers());
-            fragmentUniformBuffers[registerIndex] = uniformBuffer;
-        }
-    }
-
-    return mRenderer-&gt;setUniformBuffers(vertexUniformBuffers, fragmentUniformBuffers);
-}
-
-bool ProgramBinary::linkVaryings(InfoLog &amp;infoLog, FragmentShader *fragmentShader, VertexShader *vertexShader)
-{
-    std::vector&lt;gl::Varying&gt; &amp;fragmentVaryings = fragmentShader-&gt;getVaryings();
-    std::vector&lt;gl::Varying&gt; &amp;vertexVaryings = vertexShader-&gt;getVaryings();
-
-    for (size_t fragVaryingIndex = 0; fragVaryingIndex &lt; fragmentVaryings.size(); fragVaryingIndex++)
-    {
-        gl::Varying *input = &amp;fragmentVaryings[fragVaryingIndex];
-        bool matched = false;
-
-        for (size_t vertVaryingIndex = 0; vertVaryingIndex &lt; vertexVaryings.size(); vertVaryingIndex++)
-        {
-            gl::Varying *output = &amp;vertexVaryings[vertVaryingIndex];
-            if (output-&gt;name == input-&gt;name)
-            {
-                if (!linkValidateVariables(infoLog, output-&gt;name, *input, *output))
-                {
-                    return false;
-                }
-
-                output-&gt;registerIndex = input-&gt;registerIndex;
-                output-&gt;elementIndex = input-&gt;elementIndex;
-
-                matched = true;
-                break;
-            }
-        }
-
-        if (!matched)
-        {
-            infoLog.append(&quot;Fragment varying %s does not match any vertex varying&quot;, input-&gt;name.c_str());
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::load(InfoLog &amp;infoLog, const void *binary, GLsizei length)
-{
-    BinaryInputStream stream(binary, length);
-
-    int format = 0;
-    stream.read(&amp;format);
-    if (format != GL_PROGRAM_BINARY_ANGLE)
-    {
-        infoLog.append(&quot;Invalid program binary format.&quot;);
-        return false;
-    }
-
-    int majorVersion = 0;
-    int minorVersion = 0;
-    stream.read(&amp;majorVersion);
-    stream.read(&amp;minorVersion);
-    if (majorVersion != ANGLE_MAJOR_VERSION || minorVersion != ANGLE_MINOR_VERSION)
-    {
-        infoLog.append(&quot;Invalid program binary version.&quot;);
-        return false;
-    }
-
-    unsigned char commitString[ANGLE_COMMIT_HASH_SIZE];
-    stream.read(commitString, ANGLE_COMMIT_HASH_SIZE);
-    if (memcmp(commitString, ANGLE_COMMIT_HASH, sizeof(unsigned char) * ANGLE_COMMIT_HASH_SIZE) != 0)
-    {
-        infoLog.append(&quot;Invalid program binary version.&quot;);
-        return false;
-    }
-
-    int compileFlags = 0;
-    stream.read(&amp;compileFlags);
-    if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
-    {
-        infoLog.append(&quot;Mismatched compilation flags.&quot;);
-        return false;
-    }
-
-    for (int i = 0; i &lt; MAX_VERTEX_ATTRIBS; ++i)
-    {
-        stream.read(&amp;mLinkedAttribute[i].type);
-        std::string name;
-        stream.read(&amp;name);
-        mLinkedAttribute[i].name = name;
-        stream.read(&amp;mShaderAttributes[i].type);
-        stream.read(&amp;mShaderAttributes[i].name);
-        stream.read(&amp;mSemanticIndex[i]);
-    }
-
-    initAttributesByLayout();
-
-    for (unsigned int i = 0; i &lt; MAX_TEXTURE_IMAGE_UNITS; ++i)
-    {
-        stream.read(&amp;mSamplersPS[i].active);
-        stream.read(&amp;mSamplersPS[i].logicalTextureUnit);
-        
-        int textureType;
-        stream.read(&amp;textureType);
-        mSamplersPS[i].textureType = (TextureType) textureType;
-    }
-
-    for (unsigned int i = 0; i &lt; IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; ++i)
-    {
-        stream.read(&amp;mSamplersVS[i].active);
-        stream.read(&amp;mSamplersVS[i].logicalTextureUnit);
-        
-        int textureType;
-        stream.read(&amp;textureType);
-        mSamplersVS[i].textureType = (TextureType) textureType;
-    }
-
-    stream.read(&amp;mUsedVertexSamplerRange);
-    stream.read(&amp;mUsedPixelSamplerRange);
-    stream.read(&amp;mUsesPointSize);
-    stream.read(&amp;mShaderVersion);
-
-    size_t size;
-    stream.read(&amp;size);
-    if (stream.error())
-    {
-        infoLog.append(&quot;Invalid program binary.&quot;);
-        return false;
-    }
-
-    mUniforms.resize(size);
-    for (unsigned int i = 0; i &lt; size; ++i)
-    {
-        GLenum type;
-        GLenum precision;
-        std::string name;
-        unsigned int arraySize;
-        int blockIndex;
-
-        stream.read(&amp;type);
-        stream.read(&amp;precision);
-        stream.read(&amp;name);
-        stream.read(&amp;arraySize);
-        stream.read(&amp;blockIndex);
-
-        int offset;
-        int arrayStride;
-        int matrixStride;
-        bool isRowMajorMatrix;
-
-        stream.read(&amp;offset);
-        stream.read(&amp;arrayStride);
-        stream.read(&amp;matrixStride);
-        stream.read(&amp;isRowMajorMatrix);
-
-        const gl::BlockMemberInfo blockInfo(offset, arrayStride, matrixStride, isRowMajorMatrix);
-
-        mUniforms[i] = new LinkedUniform(type, precision, name, arraySize, blockIndex, blockInfo);
-        
-        stream.read(&amp;mUniforms[i]-&gt;psRegisterIndex);
-        stream.read(&amp;mUniforms[i]-&gt;vsRegisterIndex);
-        stream.read(&amp;mUniforms[i]-&gt;registerCount);
-        stream.read(&amp;mUniforms[i]-&gt;registerElement);
-    }
-
-    stream.read(&amp;size);
-    if (stream.error())
-    {
-        infoLog.append(&quot;Invalid program binary.&quot;);
-        return false;
-    }
-
-    mUniformBlocks.resize(size);
-    for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; size; ++uniformBlockIndex)
-    {
-        std::string name;
-        unsigned int elementIndex;
-        unsigned int dataSize;
-
-        stream.read(&amp;name);
-        stream.read(&amp;elementIndex);
-        stream.read(&amp;dataSize);
-
-        mUniformBlocks[uniformBlockIndex] = new UniformBlock(name, elementIndex, dataSize);
-
-        UniformBlock&amp; uniformBlock = *mUniformBlocks[uniformBlockIndex];
-        stream.read(&amp;uniformBlock.psRegisterIndex);
-        stream.read(&amp;uniformBlock.vsRegisterIndex);
-
-        size_t numMembers;
-        stream.read(&amp;numMembers);
-        uniformBlock.memberUniformIndexes.resize(numMembers);
-        for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; numMembers; blockMemberIndex++)
-        {
-            stream.read(&amp;uniformBlock.memberUniformIndexes[blockMemberIndex]);
-        }
-    }
-
-    stream.read(&amp;size);
-    if (stream.error())
-    {
-        infoLog.append(&quot;Invalid program binary.&quot;);
-        return false;
-    }
-
-    mUniformIndex.resize(size);
-    for (unsigned int i = 0; i &lt; size; ++i)
-    {
-        stream.read(&amp;mUniformIndex[i].name);
-        stream.read(&amp;mUniformIndex[i].element);
-        stream.read(&amp;mUniformIndex[i].index);
-    }
-
-    stream.read(&amp;mTransformFeedbackBufferMode);
-    stream.read(&amp;size);
-    mTransformFeedbackLinkedVaryings.resize(size);
-    for (size_t i = 0; i &lt; mTransformFeedbackLinkedVaryings.size(); i++)
-    {
-        LinkedVarying &amp;varying = mTransformFeedbackLinkedVaryings[i];
-
-        stream.read(&amp;varying.name);
-        stream.read(&amp;varying.type);
-        stream.read(&amp;varying.size);
-        stream.read(&amp;varying.semanticName);
-        stream.read(&amp;varying.semanticIndex);
-        stream.read(&amp;varying.semanticIndexCount);
-    }
-
-    stream.read(&amp;mVertexHLSL);
-    stream.read(&amp;mVertexWorkarounds);
-
-    unsigned int vertexShaderCount;
-    stream.read(&amp;vertexShaderCount);
-
-    for (unsigned int vertexShaderIndex = 0; vertexShaderIndex &lt; vertexShaderCount; vertexShaderIndex++)
-    {
-        VertexFormat vertexInputs[gl::MAX_VERTEX_ATTRIBS];
-
-        for (size_t inputIndex = 0; inputIndex &lt; gl::MAX_VERTEX_ATTRIBS; inputIndex++)
-        {
-            VertexFormat *vertexInput = &amp;vertexInputs[inputIndex];
-            stream.read(&amp;vertexInput-&gt;mType);
-            stream.read(&amp;vertexInput-&gt;mNormalized);
-            stream.read(&amp;vertexInput-&gt;mComponents);
-            stream.read(&amp;vertexInput-&gt;mPureInteger);
-        }
-
-        unsigned int vertexShaderSize;
-        stream.read(&amp;vertexShaderSize);
-
-        const char *vertexShaderFunction = (const char*) binary + stream.offset();
-
-        rx::ShaderExecutable *shaderExecutable = mRenderer-&gt;loadExecutable(reinterpret_cast&lt;const DWORD*&gt;(vertexShaderFunction),
-                                                                           vertexShaderSize, rx::SHADER_VERTEX,
-                                                                           mTransformFeedbackLinkedVaryings,
-                                                                           (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
-        if (!shaderExecutable)
-        {
-            infoLog.append(&quot;Could not create vertex shader.&quot;);
-            return false;
-        }
-
-        mVertexExecutables.push_back(new VertexExecutable(mRenderer, vertexInputs, shaderExecutable));
-
-        stream.skip(vertexShaderSize);
-    }
-
-    unsigned int pixelShaderSize;
-    stream.read(&amp;pixelShaderSize);
-
-    const char *pixelShaderFunction = (const char*) binary + stream.offset();
-    mPixelExecutable = mRenderer-&gt;loadExecutable(reinterpret_cast&lt;const DWORD*&gt;(pixelShaderFunction),
-                                                 pixelShaderSize, rx::SHADER_PIXEL, mTransformFeedbackLinkedVaryings,
-                                                 (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
-    if (!mPixelExecutable)
-    {
-        infoLog.append(&quot;Could not create pixel shader.&quot;);
-        return false;
-    }
-    stream.skip(pixelShaderSize);
-
-    unsigned int geometryShaderSize;
-    stream.read(&amp;geometryShaderSize);
-
-    if (geometryShaderSize &gt; 0)
-    {
-        const char *geometryShaderFunction = (const char*) binary + stream.offset();
-        mGeometryExecutable = mRenderer-&gt;loadExecutable(reinterpret_cast&lt;const DWORD*&gt;(geometryShaderFunction),
-                                                        geometryShaderSize, rx::SHADER_GEOMETRY, mTransformFeedbackLinkedVaryings,
-                                                        (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS));
-        if (!mGeometryExecutable)
-        {
-            infoLog.append(&quot;Could not create geometry shader.&quot;);
-            SafeDelete(mPixelExecutable);
-            return false;
-        }
-        stream.skip(geometryShaderSize);
-    }
-
-    const char *ptr = (const char*) binary + stream.offset();
-
-    const GUID *binaryIdentifier = (const GUID *) ptr;
-    ptr += sizeof(GUID);
-
-    GUID identifier = mRenderer-&gt;getAdapterIdentifier();
-    if (memcmp(&amp;identifier, binaryIdentifier, sizeof(GUID)) != 0)
-    {
-        infoLog.append(&quot;Invalid program binary.&quot;);
-        return false;
-    }
-
-    initializeUniformStorage();
-
-    return true;
-}
-
-bool ProgramBinary::save(void* binary, GLsizei bufSize, GLsizei *length)
-{
-    BinaryOutputStream stream;
-
-    stream.write(GL_PROGRAM_BINARY_ANGLE);
-    stream.write(ANGLE_MAJOR_VERSION);
-    stream.write(ANGLE_MINOR_VERSION);
-    stream.write(ANGLE_COMMIT_HASH, ANGLE_COMMIT_HASH_SIZE);
-    stream.write(ANGLE_COMPILE_OPTIMIZATION_LEVEL);
-
-    for (unsigned int i = 0; i &lt; MAX_VERTEX_ATTRIBS; ++i)
-    {
-        stream.write(mLinkedAttribute[i].type);
-        stream.write(mLinkedAttribute[i].name);
-        stream.write(mShaderAttributes[i].type);
-        stream.write(mShaderAttributes[i].name);
-        stream.write(mSemanticIndex[i]);
-    }
-
-    for (unsigned int i = 0; i &lt; MAX_TEXTURE_IMAGE_UNITS; ++i)
-    {
-        stream.write(mSamplersPS[i].active);
-        stream.write(mSamplersPS[i].logicalTextureUnit);
-        stream.write((int) mSamplersPS[i].textureType);
-    }
-
-    for (unsigned int i = 0; i &lt; IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS; ++i)
-    {
-        stream.write(mSamplersVS[i].active);
-        stream.write(mSamplersVS[i].logicalTextureUnit);
-        stream.write((int) mSamplersVS[i].textureType);
-    }
-
-    stream.write(mUsedVertexSamplerRange);
-    stream.write(mUsedPixelSamplerRange);
-    stream.write(mUsesPointSize);
-    stream.write(mShaderVersion);
-
-    stream.write(mUniforms.size());
-    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); ++uniformIndex)
-    {
-        const LinkedUniform &amp;uniform = *mUniforms[uniformIndex];
-
-        stream.write(uniform.type);
-        stream.write(uniform.precision);
-        stream.write(uniform.name);
-        stream.write(uniform.arraySize);
-        stream.write(uniform.blockIndex);
-
-        stream.write(uniform.blockInfo.offset);
-        stream.write(uniform.blockInfo.arrayStride);
-        stream.write(uniform.blockInfo.matrixStride);
-        stream.write(uniform.blockInfo.isRowMajorMatrix);
-
-        stream.write(uniform.psRegisterIndex);
-        stream.write(uniform.vsRegisterIndex);
-        stream.write(uniform.registerCount);
-        stream.write(uniform.registerElement);
-    }
-
-    stream.write(mUniformBlocks.size());
-    for (size_t uniformBlockIndex = 0; uniformBlockIndex &lt; mUniformBlocks.size(); ++uniformBlockIndex)
-    {
-        const UniformBlock&amp; uniformBlock = *mUniformBlocks[uniformBlockIndex];
-
-        stream.write(uniformBlock.name);
-        stream.write(uniformBlock.elementIndex);
-        stream.write(uniformBlock.dataSize);
-
-        stream.write(uniformBlock.memberUniformIndexes.size());
-        for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
-        {
-            stream.write(uniformBlock.memberUniformIndexes[blockMemberIndex]);
-        }
-
-        stream.write(uniformBlock.psRegisterIndex);
-        stream.write(uniformBlock.vsRegisterIndex);
-    }
-
-    stream.write(mUniformIndex.size());
-    for (size_t i = 0; i &lt; mUniformIndex.size(); ++i)
-    {
-        stream.write(mUniformIndex[i].name);
-        stream.write(mUniformIndex[i].element);
-        stream.write(mUniformIndex[i].index);
-    }
-
-    stream.write(mTransformFeedbackBufferMode);
-    stream.write(mTransformFeedbackLinkedVaryings.size());
-    for (size_t i = 0; i &lt; mTransformFeedbackLinkedVaryings.size(); i++)
-    {
-        const LinkedVarying &amp;varying = mTransformFeedbackLinkedVaryings[i];
-
-        stream.write(varying.name);
-        stream.write(varying.type);
-        stream.write(varying.size);
-        stream.write(varying.semanticName);
-        stream.write(varying.semanticIndex);
-        stream.write(varying.semanticIndexCount);
-    }
-
-    stream.write(mVertexHLSL);
-    stream.write(mVertexWorkarounds);
-
-    stream.write(mVertexExecutables.size());
-    for (size_t vertexExecutableIndex = 0; vertexExecutableIndex &lt; mVertexExecutables.size(); vertexExecutableIndex++)
-    {
-        VertexExecutable *vertexExecutable = mVertexExecutables[vertexExecutableIndex];
-
-        for (size_t inputIndex = 0; inputIndex &lt; gl::MAX_VERTEX_ATTRIBS; inputIndex++)
-        {
-            const VertexFormat &amp;vertexInput = vertexExecutable-&gt;inputs()[inputIndex];
-            stream.write(vertexInput.mType);
-            stream.write(vertexInput.mNormalized);
-            stream.write(vertexInput.mComponents);
-            stream.write(vertexInput.mPureInteger);
-        }
-
-        UINT vertexShaderSize = vertexExecutable-&gt;shaderExecutable()-&gt;getLength();
-        stream.write(vertexShaderSize);
-
-        unsigned char *vertexBlob = static_cast&lt;unsigned char *&gt;(vertexExecutable-&gt;shaderExecutable()-&gt;getFunction());
-        stream.write(vertexBlob, vertexShaderSize);
-    }
-
-    UINT pixelShaderSize = mPixelExecutable-&gt;getLength();
-    stream.write(pixelShaderSize);
-
-    unsigned char *pixelBlob = static_cast&lt;unsigned char *&gt;(mPixelExecutable-&gt;getFunction());
-    stream.write(pixelBlob, pixelShaderSize);
-
-    UINT geometryShaderSize = (mGeometryExecutable != NULL) ? mGeometryExecutable-&gt;getLength() : 0;
-    stream.write(geometryShaderSize);
-
-    if (mGeometryExecutable != NULL &amp;&amp; geometryShaderSize &gt; 0)
-    {
-        unsigned char *geometryBlob = static_cast&lt;unsigned char *&gt;(mGeometryExecutable-&gt;getFunction());
-        stream.write(geometryBlob, geometryShaderSize);
-    }
-
-    GUID identifier = mRenderer-&gt;getAdapterIdentifier();
-
-    GLsizei streamLength = stream.length();
-    const void *streamData = stream.data();
-
-    GLsizei totalLength = streamLength + sizeof(GUID);
-    if (totalLength &gt; bufSize)
-    {
-        if (length)
-        {
-            *length = 0;
-        }
-
-        return false;
-    }
-
-    if (binary)
-    {
-        char *ptr = (char*) binary;
-
-        memcpy(ptr, streamData, streamLength);
-        ptr += streamLength;
-
-        memcpy(ptr, &amp;identifier, sizeof(GUID));
-        ptr += sizeof(GUID);
-
-        ASSERT(ptr - totalLength == binary);
-    }
-
-    if (length)
-    {
-        *length = totalLength;
-    }
-
-    return true;
-}
-
-GLint ProgramBinary::getLength()
-{
-    GLint length;
-    if (save(NULL, INT_MAX, &amp;length))
-    {
-        return length;
-    }
-    else
-    {
-        return 0;
-    }
-}
-
-bool ProgramBinary::link(InfoLog &amp;infoLog, const AttributeBindings &amp;attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader,
-                         const std::vector&lt;std::string&gt;&amp; transformFeedbackVaryings, GLenum transformFeedbackBufferMode)
-{
-    if (!fragmentShader || !fragmentShader-&gt;isCompiled())
-    {
-        return false;
-    }
-
-    if (!vertexShader || !vertexShader-&gt;isCompiled())
-    {
-        return false;
-    }
-
-    mTransformFeedbackLinkedVaryings.clear();
-    mTransformFeedbackBufferMode = transformFeedbackBufferMode;
-
-    mShaderVersion = vertexShader-&gt;getShaderVersion();
-
-    std::string pixelHLSL = fragmentShader-&gt;getHLSL();
-    mVertexHLSL = vertexShader-&gt;getHLSL();
-    mVertexWorkarounds = vertexShader-&gt;getD3DWorkarounds();
-
-    // Map the varyings to the register file
-    const gl::ShaderVariable *packing[IMPLEMENTATION_MAX_VARYING_VECTORS][4] = {NULL};
-    int registers = mDynamicHLSL-&gt;packVaryings(infoLog, packing, fragmentShader, vertexShader, transformFeedbackVaryings);
-
-    if (registers &lt; 0)
-    {
-        return false;
-    }
-
-    if (!linkVaryings(infoLog, fragmentShader, vertexShader))
-    {
-        return false;
-    }
-
-    mUsesPointSize = vertexShader-&gt;usesPointSize();
-    std::vector&lt;LinkedVarying&gt; linkedVaryings;
-    if (!mDynamicHLSL-&gt;generateShaderLinkHLSL(infoLog, registers, packing, pixelHLSL, mVertexHLSL,
-                                              fragmentShader, vertexShader, transformFeedbackVaryings,
-                                              &amp;linkedVaryings, &amp;mOutputVariables))
-    {
-        return false;
-    }
-
-    bool success = true;
-
-    if (!linkAttributes(infoLog, attributeBindings, fragmentShader, vertexShader))
-    {
-        success = false;
-    }
-
-    if (!linkUniforms(infoLog, vertexShader-&gt;getUniforms(), fragmentShader-&gt;getUniforms()))
-    {
-        success = false;
-    }
-
-    // special case for gl_DepthRange, the only built-in uniform (also a struct)
-    if (vertexShader-&gt;usesDepthRange() || fragmentShader-&gt;usesDepthRange())
-    {
-        mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, &quot;gl_DepthRange.near&quot;, 0, -1, gl::BlockMemberInfo::defaultBlockInfo));
-        mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, &quot;gl_DepthRange.far&quot;, 0, -1, gl::BlockMemberInfo::defaultBlockInfo));
-        mUniforms.push_back(new LinkedUniform(GL_FLOAT, GL_HIGH_FLOAT, &quot;gl_DepthRange.diff&quot;, 0, -1, gl::BlockMemberInfo::defaultBlockInfo));
-    }
-
-    if (!linkUniformBlocks(infoLog, vertexShader-&gt;getInterfaceBlocks(), fragmentShader-&gt;getInterfaceBlocks()))
-    {
-        success = false;
-    }
-
-    if (!gatherTransformFeedbackLinkedVaryings(infoLog, linkedVaryings, transformFeedbackVaryings,
-                                               transformFeedbackBufferMode, &amp;mTransformFeedbackLinkedVaryings))
-    {
-        success = false;
-    }
-
-    if (success)
-    {
-        VertexFormat defaultInputLayout[MAX_VERTEX_ATTRIBS];
-        GetInputLayoutFromShader(vertexShader-&gt;activeAttributes(), defaultInputLayout);
-
-        rx::ShaderExecutable *defaultVertexExecutable = getVertexExecutableForInputLayout(defaultInputLayout);
-        mPixelExecutable = mRenderer-&gt;compileToExecutable(infoLog, pixelHLSL.c_str(), rx::SHADER_PIXEL,
-                                                          mTransformFeedbackLinkedVaryings,
-                                                          (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
-                                                          fragmentShader-&gt;getD3DWorkarounds());
-
-        if (usesGeometryShader())
-        {
-            std::string geometryHLSL = mDynamicHLSL-&gt;generateGeometryShaderHLSL(registers, packing, fragmentShader, vertexShader);
-            mGeometryExecutable = mRenderer-&gt;compileToExecutable(infoLog, geometryHLSL.c_str(), rx::SHADER_GEOMETRY,
-                                                                 mTransformFeedbackLinkedVaryings,
-                                                                 (mTransformFeedbackBufferMode == GL_SEPARATE_ATTRIBS),
-                                                                 rx::ANGLE_D3D_WORKAROUND_NONE);
-        }
-
-        if (!defaultVertexExecutable || !mPixelExecutable || (usesGeometryShader() &amp;&amp; !mGeometryExecutable))
-        {
-            infoLog.append(&quot;Failed to create D3D shaders.&quot;);
-            success = false;
-
-            while (!mVertexExecutables.empty())
-            {
-                delete mVertexExecutables.back();
-                mVertexExecutables.pop_back();
-            }
-
-            SafeDelete(mGeometryExecutable);
-            SafeDelete(mPixelExecutable);
-
-            mTransformFeedbackLinkedVaryings.clear();
-        }
-    }
-
-    return success;
-}
-
-// Determines the mapping between GL attributes and Direct3D 9 vertex stream usage indices
-bool ProgramBinary::linkAttributes(InfoLog &amp;infoLog, const AttributeBindings &amp;attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader)
-{
-    unsigned int usedLocations = 0;
-    const std::vector&lt;gl::Attribute&gt; &amp;activeAttributes = vertexShader-&gt;activeAttributes();
-
-    // Link attributes that have a binding location
-    for (unsigned int attributeIndex = 0; attributeIndex &lt; activeAttributes.size(); attributeIndex++)
-    {
-        const gl::Attribute &amp;attribute = activeAttributes[attributeIndex];
-        const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
-
-        mShaderAttributes[attributeIndex] = attribute;
-
-        if (location != -1)   // Set by glBindAttribLocation or by location layout qualifier
-        {
-            const int rows = AttributeRegisterCount(attribute.type);
-
-            if (rows + location &gt; MAX_VERTEX_ATTRIBS)
-            {
-                infoLog.append(&quot;Active attribute (%s) at location %d is too big to fit&quot;, attribute.name.c_str(), location);
-
-                return false;
-            }
-
-            for (int row = 0; row &lt; rows; row++)
-            {
-                const int rowLocation = location + row;
-                gl::ShaderVariable &amp;linkedAttribute = mLinkedAttribute[rowLocation];
-
-                // In GLSL 3.00, attribute aliasing produces a link error
-                // In GLSL 1.00, attribute aliasing is allowed
-                if (mShaderVersion &gt;= 300)
-                {
-                    if (!linkedAttribute.name.empty())
-                    {
-                        infoLog.append(&quot;Attribute '%s' aliases attribute '%s' at location %d&quot;, attribute.name.c_str(), linkedAttribute.name.c_str(), rowLocation);
-                        return false;
-                    }
-                }
-
-                linkedAttribute = attribute;
-                usedLocations |= 1 &lt;&lt; rowLocation;
-            }
-        }
-    }
-
-    // Link attributes that don't have a binding location
-    for (unsigned int attributeIndex = 0; attributeIndex &lt; activeAttributes.size(); attributeIndex++)
-    {
-        const gl::Attribute &amp;attribute = activeAttributes[attributeIndex];
-        const int location = attribute.location == -1 ? attributeBindings.getAttributeBinding(attribute.name) : attribute.location;
-
-        if (location == -1)   // Not set by glBindAttribLocation or by location layout qualifier
-        {
-            int rows = AttributeRegisterCount(attribute.type);
-            int availableIndex = AllocateFirstFreeBits(&amp;usedLocations, rows, MAX_VERTEX_ATTRIBS);
-
-            if (availableIndex == -1 || availableIndex + rows &gt; MAX_VERTEX_ATTRIBS)
-            {
-                infoLog.append(&quot;Too many active attributes (%s)&quot;, attribute.name.c_str());
-
-                return false;   // Fail to link
-            }
-
-            mLinkedAttribute[availableIndex] = attribute;
-        }
-    }
-
-    for (int attributeIndex = 0; attributeIndex &lt; MAX_VERTEX_ATTRIBS; )
-    {
-        int index = vertexShader-&gt;getSemanticIndex(mLinkedAttribute[attributeIndex].name);
-        int rows = AttributeRegisterCount(mLinkedAttribute[attributeIndex].type);
-
-        for (int r = 0; r &lt; rows; r++)
-        {
-            mSemanticIndex[attributeIndex++] = index++;
-        }
-    }
-
-    initAttributesByLayout();
-
-    return true;
-}
-
-bool ProgramBinary::linkValidateVariablesBase(InfoLog &amp;infoLog, const std::string &amp;variableName, const gl::ShaderVariable &amp;vertexVariable, const gl::ShaderVariable &amp;fragmentVariable, bool validatePrecision)
-{
-    if (vertexVariable.type != fragmentVariable.type)
-    {
-        infoLog.append(&quot;Types for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
-        return false;
-    }
-    if (vertexVariable.arraySize != fragmentVariable.arraySize)
-    {
-        infoLog.append(&quot;Array sizes for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
-        return false;
-    }
-    if (validatePrecision &amp;&amp; vertexVariable.precision != fragmentVariable.precision)
-    {
-        infoLog.append(&quot;Precisions for %s differ between vertex and fragment shaders&quot;, variableName.c_str());
-        return false;
-    }
-
-    return true;
-}
-
-template &lt;class ShaderVarType&gt;
-bool ProgramBinary::linkValidateFields(InfoLog &amp;infoLog, const std::string &amp;varName, const ShaderVarType &amp;vertexVar, const ShaderVarType &amp;fragmentVar)
-{
-    if (vertexVar.fields.size() != fragmentVar.fields.size())
-    {
-        infoLog.append(&quot;Structure lengths for %s differ between vertex and fragment shaders&quot;, varName.c_str());
-        return false;
-    }
-    const unsigned int numMembers = vertexVar.fields.size();
-    for (unsigned int memberIndex = 0; memberIndex &lt; numMembers; memberIndex++)
-    {
-        const ShaderVarType &amp;vertexMember = vertexVar.fields[memberIndex];
-        const ShaderVarType &amp;fragmentMember = fragmentVar.fields[memberIndex];
-
-        if (vertexMember.name != fragmentMember.name)
-        {
-            infoLog.append(&quot;Name mismatch for field '%d' of %s: (in vertex: '%s', in fragment: '%s')&quot;,
-                           memberIndex, varName.c_str(), vertexMember.name.c_str(), fragmentMember.name.c_str());
-            return false;
-        }
-
-        const std::string memberName = varName.substr(0, varName.length()-1) + &quot;.&quot; + vertexVar.name + &quot;'&quot;;
-        if (!linkValidateVariables(infoLog, memberName, vertexMember, fragmentMember))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::linkValidateVariables(InfoLog &amp;infoLog, const std::string &amp;uniformName, const gl::Uniform &amp;vertexUniform, const gl::Uniform &amp;fragmentUniform)
-{
-    if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
-    {
-        return false;
-    }
-
-    if (!linkValidateFields&lt;gl::Uniform&gt;(infoLog, uniformName, vertexUniform, fragmentUniform))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::linkValidateVariables(InfoLog &amp;infoLog, const std::string &amp;varyingName, const gl::Varying &amp;vertexVarying, const gl::Varying &amp;fragmentVarying)
-{
-    if (!linkValidateVariablesBase(infoLog, varyingName, vertexVarying, fragmentVarying, false))
-    {
-        return false;
-    }
-
-    if (vertexVarying.interpolation != fragmentVarying.interpolation)
-    {
-        infoLog.append(&quot;Interpolation types for %s differ between vertex and fragment shaders&quot;, varyingName.c_str());
-        return false;
-    }
-
-    if (!linkValidateFields&lt;gl::Varying&gt;(infoLog, varyingName, vertexVarying, fragmentVarying))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::linkValidateVariables(InfoLog &amp;infoLog, const std::string &amp;uniformName, const gl::InterfaceBlockField &amp;vertexUniform, const gl::InterfaceBlockField &amp;fragmentUniform)
-{
-    if (!linkValidateVariablesBase(infoLog, uniformName, vertexUniform, fragmentUniform, true))
-    {
-        return false;
-    }
-
-    if (vertexUniform.isRowMajorMatrix != fragmentUniform.isRowMajorMatrix)
-    {
-        infoLog.append(&quot;Matrix packings for %s differ between vertex and fragment shaders&quot;, uniformName.c_str());
-        return false;
-    }
-
-    if (!linkValidateFields&lt;gl::InterfaceBlockField&gt;(infoLog, uniformName, vertexUniform, fragmentUniform))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ProgramBinary::linkUniforms(InfoLog &amp;infoLog, const std::vector&lt;gl::Uniform&gt; &amp;vertexUniforms, const std::vector&lt;gl::Uniform&gt; &amp;fragmentUniforms)
-{
-    // Check that uniforms defined in the vertex and fragment shaders are identical
-    typedef std::map&lt;std::string, const gl::Uniform*&gt; UniformMap;
-    UniformMap linkedUniforms;
-
-    for (unsigned int vertexUniformIndex = 0; vertexUniformIndex &lt; vertexUniforms.size(); vertexUniformIndex++)
-    {
-        const gl::Uniform &amp;vertexUniform = vertexUniforms[vertexUniformIndex];
-        linkedUniforms[vertexUniform.name] = &amp;vertexUniform;
-    }
-
-    for (unsigned int fragmentUniformIndex = 0; fragmentUniformIndex &lt; fragmentUniforms.size(); fragmentUniformIndex++)
-    {
-        const gl::Uniform &amp;fragmentUniform = fragmentUniforms[fragmentUniformIndex];
-        UniformMap::const_iterator entry = linkedUniforms.find(fragmentUniform.name);
-        if (entry != linkedUniforms.end())
-        {
-            const gl::Uniform &amp;vertexUniform = *entry-&gt;second;
-            const std::string &amp;uniformName = &quot;uniform '&quot; + vertexUniform.name + &quot;'&quot;;
-            if (!linkValidateVariables(infoLog, uniformName, vertexUniform, fragmentUniform))
-            {
-                return false;
-            }
-        }
-    }
-
-    for (unsigned int uniformIndex = 0; uniformIndex &lt; vertexUniforms.size(); uniformIndex++)
-    {
-        if (!defineUniform(GL_VERTEX_SHADER, vertexUniforms[uniformIndex], infoLog))
-        {
-            return false;
-        }
-    }
-
-    for (unsigned int uniformIndex = 0; uniformIndex &lt; fragmentUniforms.size(); uniformIndex++)
-    {
-        if (!defineUniform(GL_FRAGMENT_SHADER, fragmentUniforms[uniformIndex], infoLog))
-        {
-            return false;
-        }
-    }
-
-    initializeUniformStorage();
-
-    return true;
-}
-
-int totalRegisterCount(const gl::Uniform &amp;uniform)
-{
-    int registerCount = 0;
-
-    if (!uniform.fields.empty())
-    {
-        for (unsigned int fieldIndex = 0; fieldIndex &lt; uniform.fields.size(); fieldIndex++)
-        {
-            registerCount += totalRegisterCount(uniform.fields[fieldIndex]);
-        }
-    }
-    else
-    {
-        registerCount = 1;
-    }
-
-    return (uniform.arraySize &gt; 0) ? uniform.arraySize * registerCount : registerCount;
-}
-
-TextureType ProgramBinary::getTextureType(GLenum samplerType, InfoLog &amp;infoLog)
-{
-    switch(samplerType)
-    {
-      case GL_SAMPLER_2D:
-      case GL_INT_SAMPLER_2D:
-      case GL_UNSIGNED_INT_SAMPLER_2D:
-      case GL_SAMPLER_2D_SHADOW:
-        return TEXTURE_2D;
-      case GL_SAMPLER_3D:
-      case GL_INT_SAMPLER_3D:
-      case GL_UNSIGNED_INT_SAMPLER_3D:
-        return TEXTURE_3D;
-      case GL_SAMPLER_CUBE:
-      case GL_SAMPLER_CUBE_SHADOW:
-        return TEXTURE_CUBE;
-      case GL_INT_SAMPLER_CUBE:
-      case GL_UNSIGNED_INT_SAMPLER_CUBE:
-        return TEXTURE_CUBE;
-      case GL_SAMPLER_2D_ARRAY:
-      case GL_INT_SAMPLER_2D_ARRAY:
-      case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
-      case GL_SAMPLER_2D_ARRAY_SHADOW:
-        return TEXTURE_2D_ARRAY;
-      default: UNREACHABLE();
-    }
-
-    return TEXTURE_2D;
-}
-
-bool ProgramBinary::defineUniform(GLenum shader, const gl::Uniform &amp;constant, InfoLog &amp;infoLog)
-{
-    if (constant.isStruct())
-    {
-        if (constant.arraySize &gt; 0)
-        {
-            unsigned int elementRegisterIndex = constant.registerIndex;
-
-            for (unsigned int elementIndex = 0; elementIndex &lt; constant.arraySize; elementIndex++)
-            {
-                for (size_t fieldIndex = 0; fieldIndex &lt; constant.fields.size(); fieldIndex++)
-                {
-                    const gl::Uniform &amp;field = constant.fields[fieldIndex];
-                    const std::string &amp;uniformName = constant.name + ArrayString(elementIndex) + &quot;.&quot; + field.name;
-                    gl::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
-                                             elementRegisterIndex, field.elementIndex);
-
-                    fieldUniform.fields = field.fields;
-                    if (!defineUniform(shader, fieldUniform, infoLog))
-                    {
-                        return false;
-                    }
-                    elementRegisterIndex += totalRegisterCount(field);
-                }
-            }
-        }
-        else
-        {
-            for (size_t fieldIndex = 0; fieldIndex &lt; constant.fields.size(); fieldIndex++)
-            {
-                const gl::Uniform &amp;field = constant.fields[fieldIndex];
-                const std::string &amp;uniformName = constant.name + &quot;.&quot; + field.name;
-
-                gl::Uniform fieldUniform(field.type, field.precision, uniformName.c_str(), field.arraySize,
-                                         field.registerIndex, field.elementIndex);
-
-                fieldUniform.fields = field.fields;
-
-                if (!defineUniform(shader, fieldUniform, infoLog))
-                {
-                    return false;
-                }
-            }
-        }
-
-        return true;
-    }
-
-    if (IsSampler(constant.type))
-    {
-        unsigned int samplerIndex = constant.registerIndex;
-            
-        do
-        {
-            if (shader == GL_VERTEX_SHADER)
-            {
-                if (samplerIndex &lt; mRenderer-&gt;getMaxVertexTextureImageUnits())
-                {
-                    mSamplersVS[samplerIndex].active = true;
-                    mSamplersVS[samplerIndex].textureType = getTextureType(constant.type, infoLog);
-                    mSamplersVS[samplerIndex].logicalTextureUnit = 0;
-                    mUsedVertexSamplerRange = std::max(samplerIndex + 1, mUsedVertexSamplerRange);
-                }
-                else
-                {
-                    infoLog.append(&quot;Vertex shader sampler count exceeds the maximum vertex texture units (%d).&quot;, mRenderer-&gt;getMaxVertexTextureImageUnits());
-                    return false;
-                }
-            }
-            else if (shader == GL_FRAGMENT_SHADER)
-            {
-                if (samplerIndex &lt; MAX_TEXTURE_IMAGE_UNITS)
-                {
-                    mSamplersPS[samplerIndex].active = true;
-                    mSamplersPS[samplerIndex].textureType = getTextureType(constant.type, infoLog);
-                    mSamplersPS[samplerIndex].logicalTextureUnit = 0;
-                    mUsedPixelSamplerRange = std::max(samplerIndex + 1, mUsedPixelSamplerRange);
-                }
-                else
-                {
-                    infoLog.append(&quot;Pixel shader sampler count exceeds MAX_TEXTURE_IMAGE_UNITS (%d).&quot;, MAX_TEXTURE_IMAGE_UNITS);
-                    return false;
-                }
-            }
-            else UNREACHABLE();
-
-            samplerIndex++;
-        }
-        while (samplerIndex &lt; constant.registerIndex + constant.arraySize);
-    }
-
-    LinkedUniform *uniform = NULL;
-    GLint location = getUniformLocation(constant.name);
-
-    if (location &gt;= 0)   // Previously defined, type and precision must match
-    {
-        uniform = mUniforms[mUniformIndex[location].index];
-    }
-    else
-    {
-        uniform = new LinkedUniform(constant.type, constant.precision, constant.name, constant.arraySize, -1, gl::BlockMemberInfo::defaultBlockInfo);
-        uniform-&gt;registerElement = constant.elementIndex;
-    }
-
-    if (!uniform)
-    {
-        return false;
-    }
-
-    if (shader == GL_FRAGMENT_SHADER)
-    {
-        uniform-&gt;psRegisterIndex = constant.registerIndex;
-    }
-    else if (shader == GL_VERTEX_SHADER)
-    {
-        uniform-&gt;vsRegisterIndex = constant.registerIndex;
-    }
-    else UNREACHABLE();
-
-    if (location &gt;= 0)
-    {
-        return uniform-&gt;type == constant.type;
-    }
-
-    mUniforms.push_back(uniform);
-    unsigned int uniformIndex = mUniforms.size() - 1;
-
-    for (unsigned int arrayElementIndex = 0; arrayElementIndex &lt; uniform-&gt;elementCount(); arrayElementIndex++)
-    {
-        mUniformIndex.push_back(VariableLocation(uniform-&gt;name, arrayElementIndex, uniformIndex));
-    }
-
-    if (shader == GL_VERTEX_SHADER)
-    {
-        if (constant.registerIndex + uniform-&gt;registerCount &gt; mRenderer-&gt;getReservedVertexUniformVectors() + mRenderer-&gt;getMaxVertexUniformVectors())
-        {
-            infoLog.append(&quot;Vertex shader active uniforms exceed GL_MAX_VERTEX_UNIFORM_VECTORS (%u)&quot;, mRenderer-&gt;getMaxVertexUniformVectors());
-            return false;
-        }
-    }
-    else if (shader == GL_FRAGMENT_SHADER)
-    {
-        if (constant.registerIndex + uniform-&gt;registerCount &gt; mRenderer-&gt;getReservedFragmentUniformVectors() + mRenderer-&gt;getMaxFragmentUniformVectors())
-        {
-            infoLog.append(&quot;Fragment shader active uniforms exceed GL_MAX_FRAGMENT_UNIFORM_VECTORS (%u)&quot;, mRenderer-&gt;getMaxFragmentUniformVectors());
-            return false;
-        }
-    }
-    else UNREACHABLE();
-
-    return true;
-}
-
-bool ProgramBinary::areMatchingInterfaceBlocks(InfoLog &amp;infoLog, const gl::InterfaceBlock &amp;vertexInterfaceBlock, const gl::InterfaceBlock &amp;fragmentInterfaceBlock)
-{
-    const char* blockName = vertexInterfaceBlock.name.c_str();
-
-    // validate blocks for the same member types
-    if (vertexInterfaceBlock.fields.size() != fragmentInterfaceBlock.fields.size())
-    {
-        infoLog.append(&quot;Types for interface block '%s' differ between vertex and fragment shaders&quot;, blockName);
-        return false;
-    }
-
-    if (vertexInterfaceBlock.arraySize != fragmentInterfaceBlock.arraySize)
-    {
-        infoLog.append(&quot;Array sizes differ for interface block '%s' between vertex and fragment shaders&quot;, blockName);
-        return false;
-    }
-
-    if (vertexInterfaceBlock.layout != fragmentInterfaceBlock.layout || vertexInterfaceBlock.isRowMajorLayout != fragmentInterfaceBlock.isRowMajorLayout)
-    {
-        infoLog.append(&quot;Layout qualifiers differ for interface block '%s' between vertex and fragment shaders&quot;, blockName);
-        return false;
-    }
-
-    const unsigned int numBlockMembers = vertexInterfaceBlock.fields.size();
-    for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; numBlockMembers; blockMemberIndex++)
-    {
-        const gl::InterfaceBlockField &amp;vertexMember = vertexInterfaceBlock.fields[blockMemberIndex];
-        const gl::InterfaceBlockField &amp;fragmentMember = fragmentInterfaceBlock.fields[blockMemberIndex];
-
-        if (vertexMember.name != fragmentMember.name)
-        {
-            infoLog.append(&quot;Name mismatch for field %d of interface block '%s': (in vertex: '%s', in fragment: '%s')&quot;,
-                           blockMemberIndex, blockName, vertexMember.name.c_str(), fragmentMember.name.c_str());
-            return false;
-        }
-
-        std::string uniformName = &quot;interface block '&quot; + vertexInterfaceBlock.name + &quot;' member '&quot; + vertexMember.name + &quot;'&quot;;
-        if (!linkValidateVariables(infoLog, uniformName, vertexMember, fragmentMember))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::linkUniformBlocks(InfoLog &amp;infoLog, const std::vector&lt;gl::InterfaceBlock&gt; &amp;vertexInterfaceBlocks,
-                                      const std::vector&lt;gl::InterfaceBlock&gt; &amp;fragmentInterfaceBlocks)
-{
-    // Check that interface blocks defined in the vertex and fragment shaders are identical
-    typedef std::map&lt;std::string, const gl::InterfaceBlock*&gt; UniformBlockMap;
-    UniformBlockMap linkedUniformBlocks;
-
-    for (unsigned int blockIndex = 0; blockIndex &lt; vertexInterfaceBlocks.size(); blockIndex++)
-    {
-        const gl::InterfaceBlock &amp;vertexInterfaceBlock = vertexInterfaceBlocks[blockIndex];
-        linkedUniformBlocks[vertexInterfaceBlock.name] = &amp;vertexInterfaceBlock;
-    }
-
-    for (unsigned int blockIndex = 0; blockIndex &lt; fragmentInterfaceBlocks.size(); blockIndex++)
-    {
-        const gl::InterfaceBlock &amp;fragmentInterfaceBlock = fragmentInterfaceBlocks[blockIndex];
-        UniformBlockMap::const_iterator entry = linkedUniformBlocks.find(fragmentInterfaceBlock.name);
-        if (entry != linkedUniformBlocks.end())
-        {
-            const gl::InterfaceBlock &amp;vertexInterfaceBlock = *entry-&gt;second;
-            if (!areMatchingInterfaceBlocks(infoLog, vertexInterfaceBlock, fragmentInterfaceBlock))
-            {
-                return false;
-            }
-        }
-    }
-
-    for (unsigned int blockIndex = 0; blockIndex &lt; vertexInterfaceBlocks.size(); blockIndex++)
-    {
-        if (!defineUniformBlock(infoLog, GL_VERTEX_SHADER, vertexInterfaceBlocks[blockIndex]))
-        {
-            return false;
-        }
-    }
-
-    for (unsigned int blockIndex = 0; blockIndex &lt; fragmentInterfaceBlocks.size(); blockIndex++)
-    {
-        if (!defineUniformBlock(infoLog, GL_FRAGMENT_SHADER, fragmentInterfaceBlocks[blockIndex]))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::gatherTransformFeedbackLinkedVaryings(InfoLog &amp;infoLog, const std::vector&lt;LinkedVarying&gt; &amp;linkedVaryings,
-                                                          const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryingNames,
-                                                          GLenum transformFeedbackBufferMode,
-                                                          std::vector&lt;LinkedVarying&gt; *outTransformFeedbackLinkedVaryings) const
-{
-    size_t totalComponents = 0;
-    const size_t maxSeparateComponents = mRenderer-&gt;getMaxTransformFeedbackSeparateComponents();
-    const size_t maxInterleavedComponents = mRenderer-&gt;getMaxTransformFeedbackInterleavedComponents();
-
-    // Gather the linked varyings that are used for transform feedback, they should all exist.
-    outTransformFeedbackLinkedVaryings-&gt;clear();
-    for (size_t i = 0; i &lt; transformFeedbackVaryingNames.size(); i++)
-    {
-        bool found = false;
-        for (size_t j = 0; j &lt; linkedVaryings.size(); j++)
-        {
-            if (transformFeedbackVaryingNames[i] == linkedVaryings[j].name)
-            {
-                for (size_t k = 0; k &lt; outTransformFeedbackLinkedVaryings-&gt;size(); k++)
-                {
-                    if (outTransformFeedbackLinkedVaryings-&gt;at(k).name == linkedVaryings[j].name)
-                    {
-                        infoLog.append(&quot;Two transform feedback varyings specify the same output variable (%s).&quot;, linkedVaryings[j].name.c_str());
-                        return false;
-                    }
-                }
-
-                size_t componentCount = linkedVaryings[j].semanticIndexCount * 4;
-                if (transformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &amp;&amp;
-                    componentCount &gt; maxSeparateComponents)
-                {
-                    infoLog.append(&quot;Transform feedback varying's %s components (%u) exceed the maximum separate components (%u).&quot;,
-                                   linkedVaryings[j].name.c_str(), componentCount, maxSeparateComponents);
-                    return false;
-                }
-
-                totalComponents += componentCount;
-
-                outTransformFeedbackLinkedVaryings-&gt;push_back(linkedVaryings[j]);
-                found = true;
-                break;
-            }
-        }
-
-        // All transform feedback varyings are expected to exist since packVaryings checks for them.
-        ASSERT(found);
-    }
-
-    if (transformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS &amp;&amp; totalComponents &gt; maxInterleavedComponents)
-    {
-        infoLog.append(&quot;Transform feedback varying total components (%u) exceed the maximum interleaved components (%u).&quot;,
-                       totalComponents, maxInterleavedComponents);
-        return false;
-    }
-
-    return true;
-}
-
-void ProgramBinary::defineUniformBlockMembers(const std::vector&lt;gl::InterfaceBlockField&gt; &amp;fields, const std::string &amp;prefix, int blockIndex, BlockInfoItr *blockInfoItr, std::vector&lt;unsigned int&gt; *blockUniformIndexes)
-{
-    for (unsigned int uniformIndex = 0; uniformIndex &lt; fields.size(); uniformIndex++)
-    {
-        const gl::InterfaceBlockField &amp;field = fields[uniformIndex];
-        const std::string &amp;fieldName = (prefix.empty() ? field.name : prefix + &quot;.&quot; + field.name);
-
-        if (!field.fields.empty())
-        {
-            if (field.arraySize &gt; 0)
-            {
-                for (unsigned int arrayElement = 0; arrayElement &lt; field.arraySize; arrayElement++)
-                {
-                    const std::string uniformElementName = fieldName + ArrayString(arrayElement);
-                    defineUniformBlockMembers(field.fields, uniformElementName, blockIndex, blockInfoItr, blockUniformIndexes);
-                }
-            }
-            else
-            {
-                defineUniformBlockMembers(field.fields, fieldName, blockIndex, blockInfoItr, blockUniformIndexes);
-            }
-        }
-        else
-        {
-            LinkedUniform *newUniform = new LinkedUniform(field.type, field.precision, fieldName, field.arraySize,
-                                                          blockIndex, **blockInfoItr);
-
-            // add to uniform list, but not index, since uniform block uniforms have no location
-            blockUniformIndexes-&gt;push_back(mUniforms.size());
-            mUniforms.push_back(newUniform);
-            (*blockInfoItr)++;
-        }
-    }
-}
-
-bool ProgramBinary::defineUniformBlock(InfoLog &amp;infoLog, GLenum shader, const gl::InterfaceBlock &amp;interfaceBlock)
-{
-    // create uniform block entries if they do not exist
-    if (getUniformBlockIndex(interfaceBlock.name) == GL_INVALID_INDEX)
-    {
-        std::vector&lt;unsigned int&gt; blockUniformIndexes;
-        const unsigned int blockIndex = mUniformBlocks.size();
-
-        // define member uniforms
-        BlockInfoItr blockInfoItr = interfaceBlock.blockInfo.cbegin();
-        defineUniformBlockMembers(interfaceBlock.fields, &quot;&quot;, blockIndex, &amp;blockInfoItr, &amp;blockUniformIndexes);
-
-        // create all the uniform blocks
-        if (interfaceBlock.arraySize &gt; 0)
-        {
-            for (unsigned int uniformBlockElement = 0; uniformBlockElement &lt; interfaceBlock.arraySize; uniformBlockElement++)
-            {
-                gl::UniformBlock *newUniformBlock = new UniformBlock(interfaceBlock.name, uniformBlockElement, interfaceBlock.dataSize);
-                newUniformBlock-&gt;memberUniformIndexes = blockUniformIndexes;
-                mUniformBlocks.push_back(newUniformBlock);
-            }
-        }
-        else
-        {
-            gl::UniformBlock *newUniformBlock = new UniformBlock(interfaceBlock.name, GL_INVALID_INDEX, interfaceBlock.dataSize);
-            newUniformBlock-&gt;memberUniformIndexes = blockUniformIndexes;
-            mUniformBlocks.push_back(newUniformBlock);
-        }
-    }
-
-    // Assign registers to the uniform blocks
-    const GLuint blockIndex = getUniformBlockIndex(interfaceBlock.name);
-    const unsigned int elementCount = std::max(1u, interfaceBlock.arraySize);
-    ASSERT(blockIndex != GL_INVALID_INDEX);
-    ASSERT(blockIndex + elementCount &lt;= mUniformBlocks.size());
-
-    for (unsigned int uniformBlockElement = 0; uniformBlockElement &lt; elementCount; uniformBlockElement++)
-    {
-        gl::UniformBlock *uniformBlock = mUniformBlocks[blockIndex + uniformBlockElement];
-        ASSERT(uniformBlock-&gt;name == interfaceBlock.name);
-
-        if (!assignUniformBlockRegister(infoLog, uniformBlock, shader, interfaceBlock.registerIndex + uniformBlockElement))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool ProgramBinary::assignUniformBlockRegister(InfoLog &amp;infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex)
-{
-    if (shader == GL_VERTEX_SHADER)
-    {
-        uniformBlock-&gt;vsRegisterIndex = registerIndex;
-        unsigned int maximumBlocks = mRenderer-&gt;getMaxVertexShaderUniformBuffers();
-
-        if (registerIndex - mRenderer-&gt;getReservedVertexUniformBuffers() &gt;= maximumBlocks)
-        {
-            infoLog.append(&quot;Vertex shader uniform block count exceed GL_MAX_VERTEX_UNIFORM_BLOCKS (%u)&quot;, maximumBlocks);
-            return false;
-        }
-    }
-    else if (shader == GL_FRAGMENT_SHADER)
-    {
-        uniformBlock-&gt;psRegisterIndex = registerIndex;
-        unsigned int maximumBlocks = mRenderer-&gt;getMaxFragmentShaderUniformBuffers();
-
-        if (registerIndex - mRenderer-&gt;getReservedFragmentUniformBuffers() &gt;= maximumBlocks)
-        {
-            infoLog.append(&quot;Fragment shader uniform block count exceed GL_MAX_FRAGMENT_UNIFORM_BLOCKS (%u)&quot;, maximumBlocks);
-            return false;
-        }
-    }
-    else UNREACHABLE();
-
-    return true;
-}
-
-bool ProgramBinary::isValidated() const 
-{
-    return mValidated;
-}
-
-void ProgramBinary::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const
-{
-    // Skip over inactive attributes
-    unsigned int activeAttribute = 0;
-    unsigned int attribute;
-    for (attribute = 0; attribute &lt; MAX_VERTEX_ATTRIBS; attribute++)
-    {
-        if (mLinkedAttribute[attribute].name.empty())
-        {
-            continue;
-        }
-
-        if (activeAttribute == index)
-        {
-            break;
-        }
-
-        activeAttribute++;
-    }
-
-    if (bufsize &gt; 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() const
-{
-    int count = 0;
-
-    for (int attributeIndex = 0; attributeIndex &lt; MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        if (!mLinkedAttribute[attributeIndex].name.empty())
-        {
-            count++;
-        }
-    }
-
-    return count;
-}
-
-GLint ProgramBinary::getActiveAttributeMaxLength() const
-{
-    int maxLength = 0;
-
-    for (int attributeIndex = 0; attributeIndex &lt; 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) const
-{
-    ASSERT(index &lt; mUniforms.size());   // index must be smaller than getActiveUniformCount()
-
-    if (bufsize &gt; 0)
-    {
-        std::string string = mUniforms[index]-&gt;name;
-
-        if (mUniforms[index]-&gt;isArray())
-        {
-            string += &quot;[0]&quot;;
-        }
-
-        strncpy(name, string.c_str(), bufsize);
-        name[bufsize - 1] = '\0';
-
-        if (length)
-        {
-            *length = strlen(name);
-        }
-    }
-
-    *size = mUniforms[index]-&gt;elementCount();
-
-    *type = mUniforms[index]-&gt;type;
-}
-
-GLint ProgramBinary::getActiveUniformCount() const
-{
-    return mUniforms.size();
-}
-
-GLint ProgramBinary::getActiveUniformMaxLength() const
-{
-    int maxLength = 0;
-
-    unsigned int numUniforms = mUniforms.size();
-    for (unsigned int uniformIndex = 0; uniformIndex &lt; numUniforms; uniformIndex++)
-    {
-        if (!mUniforms[uniformIndex]-&gt;name.empty())
-        {
-            int length = (int)(mUniforms[uniformIndex]-&gt;name.length() + 1);
-            if (mUniforms[uniformIndex]-&gt;isArray())
-            {
-                length += 3;  // Counting in &quot;[0]&quot;.
-            }
-            maxLength = std::max(length, maxLength);
-        }
-    }
-
-    return maxLength;
-}
-
-GLint ProgramBinary::getActiveUniformi(GLuint index, GLenum pname) const
-{
-    const gl::LinkedUniform&amp; uniform = *mUniforms[index];
-
-    switch (pname)
-    {
-      case GL_UNIFORM_TYPE:         return static_cast&lt;GLint&gt;(uniform.type);
-      case GL_UNIFORM_SIZE:         return static_cast&lt;GLint&gt;(uniform.elementCount());
-      case GL_UNIFORM_NAME_LENGTH:  return static_cast&lt;GLint&gt;(uniform.name.size() + 1 + (uniform.isArray() ? 3 : 0));
-      case GL_UNIFORM_BLOCK_INDEX:  return uniform.blockIndex;
-
-      case GL_UNIFORM_OFFSET:       return uniform.blockInfo.offset;
-      case GL_UNIFORM_ARRAY_STRIDE: return uniform.blockInfo.arrayStride;
-      case GL_UNIFORM_MATRIX_STRIDE: return uniform.blockInfo.matrixStride;
-      case GL_UNIFORM_IS_ROW_MAJOR: return static_cast&lt;GLint&gt;(uniform.blockInfo.isRowMajorMatrix);
-
-      default:
-        UNREACHABLE();
-        break;
-    }
-    return 0;
-}
-
-void ProgramBinary::getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const
-{
-    ASSERT(uniformBlockIndex &lt; mUniformBlocks.size());   // index must be smaller than getActiveUniformBlockCount()
-
-    const UniformBlock &amp;uniformBlock = *mUniformBlocks[uniformBlockIndex];
-
-    if (bufSize &gt; 0)
-    {
-        std::string string = uniformBlock.name;
-
-        if (uniformBlock.isArrayElement())
-        {
-            string += ArrayString(uniformBlock.elementIndex);
-        }
-
-        strncpy(uniformBlockName, string.c_str(), bufSize);
-        uniformBlockName[bufSize - 1] = '\0';
-
-        if (length)
-        {
-            *length = strlen(uniformBlockName);
-        }
-    }
-}
-
-void ProgramBinary::getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const
-{
-    ASSERT(uniformBlockIndex &lt; mUniformBlocks.size());   // index must be smaller than getActiveUniformBlockCount()
-
-    const UniformBlock &amp;uniformBlock = *mUniformBlocks[uniformBlockIndex];
-
-    switch (pname)
-    {
-      case GL_UNIFORM_BLOCK_DATA_SIZE:
-        *params = static_cast&lt;GLint&gt;(uniformBlock.dataSize);
-        break;
-      case GL_UNIFORM_BLOCK_NAME_LENGTH:
-        *params = static_cast&lt;GLint&gt;(uniformBlock.name.size() + 1 + (uniformBlock.isArrayElement() ? 3 : 0));
-        break;
-      case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
-        *params = static_cast&lt;GLint&gt;(uniformBlock.memberUniformIndexes.size());
-        break;
-      case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
-        {
-            for (unsigned int blockMemberIndex = 0; blockMemberIndex &lt; uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
-            {
-                params[blockMemberIndex] = static_cast&lt;GLint&gt;(uniformBlock.memberUniformIndexes[blockMemberIndex]);
-            }
-        }
-        break;
-      case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
-        *params = static_cast&lt;GLint&gt;(uniformBlock.isReferencedByVertexShader());
-        break;
-      case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
-        *params = static_cast&lt;GLint&gt;(uniformBlock.isReferencedByFragmentShader());
-        break;
-      default: UNREACHABLE();
-    }
-}
-
-GLuint ProgramBinary::getActiveUniformBlockCount() const
-{
-    return mUniformBlocks.size();
-}
-
-GLuint ProgramBinary::getActiveUniformBlockMaxLength() const
-{
-    unsigned int maxLength = 0;
-
-    unsigned int numUniformBlocks = mUniformBlocks.size();
-    for (unsigned int uniformBlockIndex = 0; uniformBlockIndex &lt; numUniformBlocks; uniformBlockIndex++)
-    {
-        const UniformBlock &amp;uniformBlock = *mUniformBlocks[uniformBlockIndex];
-        if (!uniformBlock.name.empty())
-        {
-            const unsigned int length = uniformBlock.name.length() + 1;
-
-            // Counting in &quot;[0]&quot;.
-            const unsigned int arrayLength = (uniformBlock.isArrayElement() ? 3 : 0);
-
-            maxLength = std::max(length + arrayLength, maxLength);
-        }
-    }
-
-    return maxLength;
-}
-
-void ProgramBinary::validate(InfoLog &amp;infoLog)
-{
-    applyUniforms();
-    if (!validateSamplers(&amp;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 = mRenderer-&gt;getMaxCombinedTextureImageUnits();
-    TextureType textureUnitType[IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-
-    for (unsigned int i = 0; i &lt; IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS; ++i)
-    {
-        textureUnitType[i] = TEXTURE_UNKNOWN;
-    }
-
-    for (unsigned int i = 0; i &lt; mUsedPixelSamplerRange; ++i)
-    {
-        if (mSamplersPS[i].active)
-        {
-            unsigned int unit = mSamplersPS[i].logicalTextureUnit;
-            
-            if (unit &gt;= maxCombinedTextureImageUnits)
-            {
-                if (infoLog)
-                {
-                    infoLog-&gt;append(&quot;Sampler uniform (%d) exceeds IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)&quot;, unit, maxCombinedTextureImageUnits);
-                }
-
-                return false;
-            }
-
-            if (textureUnitType[unit] != TEXTURE_UNKNOWN)
-            {
-                if (mSamplersPS[i].textureType != textureUnitType[unit])
-                {
-                    if (infoLog)
-                    {
-                        infoLog-&gt;append(&quot;Samplers of conflicting types refer to the same texture image unit (%d).&quot;, unit);
-                    }
-
-                    return false;
-                }
-            }
-            else
-            {
-                textureUnitType[unit] = mSamplersPS[i].textureType;
-            }
-        }
-    }
-
-    for (unsigned int i = 0; i &lt; mUsedVertexSamplerRange; ++i)
-    {
-        if (mSamplersVS[i].active)
-        {
-            unsigned int unit = mSamplersVS[i].logicalTextureUnit;
-            
-            if (unit &gt;= maxCombinedTextureImageUnits)
-            {
-                if (infoLog)
-                {
-                    infoLog-&gt;append(&quot;Sampler uniform (%d) exceeds IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)&quot;, unit, maxCombinedTextureImageUnits);
-                }
-
-                return false;
-            }
-
-            if (textureUnitType[unit] != TEXTURE_UNKNOWN)
-            {
-                if (mSamplersVS[i].textureType != textureUnitType[unit])
-                {
-                    if (infoLog)
-                    {
-                        infoLog-&gt;append(&quot;Samplers of conflicting types refer to the same texture image unit (%d).&quot;, unit);
-                    }
-
-                    return false;
-                }
-            }
-            else
-            {
-                textureUnitType[unit] = mSamplersVS[i].textureType;
-            }
-        }
-    }
-
-    return true;
-}
-
-ProgramBinary::Sampler::Sampler() : active(false), logicalTextureUnit(0), textureType(TEXTURE_2D)
-{
-}
-
-struct AttributeSorter
-{
-    AttributeSorter(const int (&amp;semanticIndices)[MAX_VERTEX_ATTRIBS])
-        : originalIndices(semanticIndices)
-    {
-    }
-
-    bool operator()(int a, int b)
-    {
-        if (originalIndices[a] == -1) return false;
-        if (originalIndices[b] == -1) return true;
-        return (originalIndices[a] &lt; originalIndices[b]);
-    }
-
-    const int (&amp;originalIndices)[MAX_VERTEX_ATTRIBS];
-};
-
-void ProgramBinary::initAttributesByLayout()
-{
-    for (int i = 0; i &lt; MAX_VERTEX_ATTRIBS; i++)
-    {
-        mAttributesByLayout[i] = i;
-    }
-
-    std::sort(&amp;mAttributesByLayout[0], &amp;mAttributesByLayout[MAX_VERTEX_ATTRIBS], AttributeSorter(mSemanticIndex));
-}
-
-void ProgramBinary::sortAttributesByLayout(rx::TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const
-{
-    rx::TranslatedAttribute oldTranslatedAttributes[MAX_VERTEX_ATTRIBS];
-
-    for (int i = 0; i &lt; MAX_VERTEX_ATTRIBS; i++)
-    {
-        oldTranslatedAttributes[i] = attributes[i];
-    }
-
-    for (int i = 0; i &lt; MAX_VERTEX_ATTRIBS; i++)
-    {
-        int oldIndex = mAttributesByLayout[i];
-        sortedSemanticIndices[i] = mSemanticIndex[oldIndex];
-        attributes[i] = oldTranslatedAttributes[oldIndex];
-    }
-}
-
-void ProgramBinary::initializeUniformStorage()
-{
-    // Compute total default block size
-    unsigned int vertexRegisters = 0;
-    unsigned int fragmentRegisters = 0;
-    for (size_t uniformIndex = 0; uniformIndex &lt; mUniforms.size(); uniformIndex++)
-    {
-        const LinkedUniform &amp;uniform = *mUniforms[uniformIndex];
-
-        if (!IsSampler(uniform.type))
-        {
-            if (uniform.isReferencedByVertexShader())
-            {
-                vertexRegisters = std::max(vertexRegisters, uniform.vsRegisterIndex + uniform.registerCount);
-            }
-            if (uniform.isReferencedByFragmentShader())
-            {
-                fragmentRegisters = std::max(fragmentRegisters, uniform.psRegisterIndex + uniform.registerCount);
-            }
-        }
-    }
-
-    mVertexUniformStorage = mRenderer-&gt;createUniformStorage(vertexRegisters * 16u);
-    mFragmentUniformStorage = mRenderer-&gt;createUniformStorage(fragmentRegisters * 16u);
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ProgramBinaryh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ProgramBinary.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,284 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2014 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_
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES3/gl3ext.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-#include &lt;GLES2/gl2ext.h&gt;
-
-#include &lt;string&gt;
-#include &lt;vector&gt;
-
-#include &quot;common/RefCountObject.h&quot;
-#include &quot;angletypes.h&quot;
-#include &quot;common/mathutil.h&quot;
-#include &quot;libGLESv2/Uniform.h&quot;
-#include &quot;libGLESv2/Shader.h&quot;
-#include &quot;libGLESv2/Constants.h&quot;
-#include &quot;libGLESv2/renderer/VertexDataManager.h&quot;
-
-namespace rx
-{
-class ShaderExecutable;
-class Renderer;
-struct TranslatedAttribute;
-class UniformStorage;
-class DynamicHLSL;
-}
-
-namespace gl
-{
-class FragmentShader;
-class VertexShader;
-class InfoLog;
-class AttributeBindings;
-class Buffer;
-
-// Struct used for correlating uniforms/elements of uniform arrays to handles
-struct VariableLocation
-{
-    VariableLocation()
-    {
-    }
-
-    VariableLocation(const std::string &amp;name, unsigned int element, unsigned int index);
-
-    std::string name;
-    unsigned int element;
-    unsigned int index;
-};
-
-struct LinkedVarying
-{
-    LinkedVarying();
-    LinkedVarying(const std::string &amp;name, GLenum type, GLsizei size, const std::string &amp;semanticName,
-                  unsigned int semanticIndex, unsigned int semanticIndexCount);
-
-    // Original GL name
-    std::string name;
-
-    GLenum type;
-    GLsizei size;
-
-    // DirectX semantic information
-    std::string semanticName;
-    unsigned int semanticIndex;
-    unsigned int semanticIndexCount;
-};
-
-// This is the result of linking a program. It is the state that would be passed to ProgramBinary.
-class ProgramBinary : public RefCountObject
-{
-  public:
-    explicit ProgramBinary(rx::Renderer *renderer);
-    ~ProgramBinary();
-
-    rx::ShaderExecutable *getPixelExecutable() const;
-    rx::ShaderExecutable *getVertexExecutableForInputLayout(const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS]);
-    rx::ShaderExecutable *getGeometryExecutable() const;
-
-    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);
-    bool usesPointSize() const;
-    bool usesPointSpriteEmulation() const;
-    bool usesGeometryShader() const;
-
-    GLint getUniformLocation(std::string name);
-    GLuint getUniformIndex(std::string name);
-    GLuint getUniformBlockIndex(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 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 setUniform1uiv(GLint location, GLsizei count, const GLuint *v);
-    bool setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
-    bool setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
-    bool setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
-    bool setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-    bool setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-
-    bool getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params);
-    bool getUniformiv(GLint location, GLsizei *bufSize, GLint *params);
-    bool getUniformuiv(GLint location, GLsizei *bufSize, GLuint *params);
-
-    void dirtyAllUniforms();
-    void applyUniforms();
-    bool applyUniformBuffers(const std::vector&lt;Buffer*&gt; boundBuffers);
-
-    bool load(InfoLog &amp;infoLog, const void *binary, GLsizei length);
-    bool save(void* binary, GLsizei bufSize, GLsizei *length);
-    GLint getLength();
-
-    bool link(InfoLog &amp;infoLog, const AttributeBindings &amp;attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader,
-              const std::vector&lt;std::string&gt;&amp; transformFeedbackVaryings, GLenum transformFeedbackBufferMode);
-    void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
-
-    void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
-    GLint getActiveAttributeCount() const;
-    GLint getActiveAttributeMaxLength() const;
-
-    void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
-    GLint getActiveUniformCount() const;
-    GLint getActiveUniformMaxLength() const;
-    GLint getActiveUniformi(GLuint index, GLenum pname) const;
-
-    void getActiveUniformBlockName(GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName) const;
-    void getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const;
-    GLuint getActiveUniformBlockCount() const;
-    GLuint getActiveUniformBlockMaxLength() const;
-    UniformBlock *getUniformBlockByIndex(GLuint blockIndex);
-
-    GLint getFragDataLocation(const char *name) const;
-
-    size_t getTransformFeedbackVaryingCount() const;
-    const LinkedVarying &amp;getTransformFeedbackVarying(size_t idx) const;
-    GLenum getTransformFeedbackBufferMode() const;
-
-    void validate(InfoLog &amp;infoLog);
-    bool validateSamplers(InfoLog *infoLog);
-    bool isValidated() const;
-
-    unsigned int getSerial() const;
-    int getShaderVersion() const;
-
-    void initAttributesByLayout();
-    void sortAttributesByLayout(rx::TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS], int sortedSemanticIndices[MAX_VERTEX_ATTRIBS]) const;
-
-    const std::vector&lt;LinkedUniform*&gt; &amp;getUniforms() const { return mUniforms; }
-    const rx::UniformStorage &amp;getVertexUniformStorage() const { return *mVertexUniformStorage; }
-    const rx::UniformStorage &amp;getFragmentUniformStorage() const { return *mFragmentUniformStorage; }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(ProgramBinary);
-
-    bool linkVaryings(InfoLog &amp;infoLog, FragmentShader *fragmentShader, VertexShader *vertexShader);
-    bool linkAttributes(InfoLog &amp;infoLog, const AttributeBindings &amp;attributeBindings, FragmentShader *fragmentShader, VertexShader *vertexShader);
-
-    typedef BlockMemberInfoArray::const_iterator BlockInfoItr;
-
-    template &lt;class ShaderVarType&gt;
-    bool linkValidateFields(InfoLog &amp;infoLog, const std::string &amp;varName, const ShaderVarType &amp;vertexVar, const ShaderVarType &amp;fragmentVar);
-    bool linkValidateVariablesBase(InfoLog &amp;infoLog, const std::string &amp;variableName, const ShaderVariable &amp;vertexVariable, const ShaderVariable &amp;fragmentVariable, bool validatePrecision);
-
-    bool linkValidateVariables(InfoLog &amp;infoLog, const std::string &amp;uniformName, const Uniform &amp;vertexUniform, const Uniform &amp;fragmentUniform);
-    bool linkValidateVariables(InfoLog &amp;infoLog, const std::string &amp;varyingName, const Varying &amp;vertexVarying, const Varying &amp;fragmentVarying);
-    bool linkValidateVariables(InfoLog &amp;infoLog, const std::string &amp;uniformName, const InterfaceBlockField &amp;vertexUniform, const InterfaceBlockField &amp;fragmentUniform);
-    bool linkUniforms(InfoLog &amp;infoLog, const std::vector&lt;Uniform&gt; &amp;vertexUniforms, const std::vector&lt;Uniform&gt; &amp;fragmentUniforms);
-    bool defineUniform(GLenum shader, const Uniform &amp;constant, InfoLog &amp;infoLog);
-    bool areMatchingInterfaceBlocks(InfoLog &amp;infoLog, const InterfaceBlock &amp;vertexInterfaceBlock, const InterfaceBlock &amp;fragmentInterfaceBlock);
-    bool linkUniformBlocks(InfoLog &amp;infoLog, const std::vector&lt;InterfaceBlock&gt; &amp;vertexUniformBlocks, const std::vector&lt;InterfaceBlock&gt; &amp;fragmentUniformBlocks);
-    bool gatherTransformFeedbackLinkedVaryings(InfoLog &amp;infoLog, const std::vector&lt;LinkedVarying&gt; &amp;linkedVaryings,
-                                               const std::vector&lt;std::string&gt; &amp;transformFeedbackVaryingNames,
-                                               GLenum transformFeedbackBufferMode,
-                                               std::vector&lt;LinkedVarying&gt; *outTransformFeedbackLinkedVaryings) const;
-    void defineUniformBlockMembers(const std::vector&lt;InterfaceBlockField&gt; &amp;fields, const std::string &amp;prefix, int blockIndex, BlockInfoItr *blockInfoItr, std::vector&lt;unsigned int&gt; *blockUniformIndexes);
-    bool defineUniformBlock(InfoLog &amp;infoLog, GLenum shader, const InterfaceBlock &amp;interfaceBlock);
-    bool assignUniformBlockRegister(InfoLog &amp;infoLog, UniformBlock *uniformBlock, GLenum shader, unsigned int registerIndex);
-    void defineOutputVariables(FragmentShader *fragmentShader);
-    void initializeUniformStorage();
-
-    template &lt;typename T&gt;
-    bool setUniform(GLint location, GLsizei count, const T* v, GLenum targetUniformType);
-
-    template &lt;int cols, int rows&gt;
-    bool setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum targetUniformType);
-
-    template &lt;typename T&gt;
-    bool getUniformv(GLint location, GLsizei *bufSize, T *params, GLenum uniformType);
-
-    static TextureType getTextureType(GLenum samplerType, InfoLog &amp;infoLog);
-
-    class VertexExecutable
-    {
-      public:
-        VertexExecutable(rx::Renderer *const renderer,
-                         const VertexFormat inputLayout[MAX_VERTEX_ATTRIBS],
-                         rx::ShaderExecutable *shaderExecutable);
-        ~VertexExecutable();
-
-        bool matchesInputLayout(const VertexFormat attributes[MAX_VERTEX_ATTRIBS]) const;
-
-        const VertexFormat *inputs() const { return mInputs; }
-        rx::ShaderExecutable *shaderExecutable() const { return mShaderExecutable; }
-
-      private:
-        VertexFormat mInputs[MAX_VERTEX_ATTRIBS];
-        rx::ShaderExecutable *mShaderExecutable;
-    };
-
-    rx::Renderer *const mRenderer;
-    DynamicHLSL *mDynamicHLSL;
-
-    std::string mVertexHLSL;
-    rx::D3DWorkaroundType mVertexWorkarounds;
-    std::vector&lt;VertexExecutable *&gt; mVertexExecutables;
-    rx::ShaderExecutable *mGeometryExecutable;
-    rx::ShaderExecutable *mPixelExecutable;
-
-    Attribute mLinkedAttribute[MAX_VERTEX_ATTRIBS];
-    Attribute mShaderAttributes[MAX_VERTEX_ATTRIBS];
-    int mSemanticIndex[MAX_VERTEX_ATTRIBS];
-    int mAttributesByLayout[MAX_VERTEX_ATTRIBS];
-
-    GLenum mTransformFeedbackBufferMode;
-    std::vector&lt;LinkedVarying&gt; mTransformFeedbackLinkedVaryings;
-
-    struct Sampler
-    {
-        Sampler();
-
-        bool active;
-        GLint logicalTextureUnit;
-        TextureType textureType;
-    };
-
-    Sampler mSamplersPS[MAX_TEXTURE_IMAGE_UNITS];
-    Sampler mSamplersVS[IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS];
-    GLuint mUsedVertexSamplerRange;
-    GLuint mUsedPixelSamplerRange;
-    bool mUsesPointSize;
-    int mShaderVersion;
-
-    std::vector&lt;LinkedUniform*&gt; mUniforms;
-    std::vector&lt;UniformBlock*&gt; mUniformBlocks;
-    std::vector&lt;VariableLocation&gt; mUniformIndex;
-    std::map&lt;int, VariableLocation&gt; mOutputVariables;
-    rx::UniformStorage *mVertexUniformStorage;
-    rx::UniformStorage *mFragmentUniformStorage;
-
-    bool mValidated;
-
-    const unsigned int mSerial;
-
-    static unsigned int issueSerial();
-    static unsigned int mCurrentSerial;
-};
-
-}
-
-#endif   // LIBGLESV2_PROGRAM_BINARY_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Querycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,52 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// 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 &quot;libGLESv2/Query.h&quot;
-#include &quot;libGLESv2/renderer/QueryImpl.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-
-namespace gl
-{
-
-Query::Query(rx::Renderer *renderer, GLenum type, GLuint id) : RefCountObject(id)
-{ 
-    mQuery = renderer-&gt;createQuery(type);
-}
-
-Query::~Query()
-{
-    delete mQuery;
-}
-
-void Query::begin()
-{
-    mQuery-&gt;begin();
-}
-
-void Query::end()
-{
-    mQuery-&gt;end();
-}
-
-GLuint Query::getResult()
-{
-    return mQuery-&gt;getResult();
-}
-
-GLboolean Query::isResultAvailable()
-{
-    return mQuery-&gt;isResultAvailable();
-}
-
-GLenum Query::getType() const
-{
-    return mQuery-&gt;getType();
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Queryh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Query.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,50 +0,0 @@
</span><del>-//
-// 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 &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-
-namespace rx
-{
-class Renderer;
-class QueryImpl;
-}
-
-namespace gl
-{
-
-class Query : public RefCountObject
-{
-  public:
-    Query(rx::Renderer *renderer, GLenum type, GLuint id);
-    virtual ~Query();
-
-    void begin();
-    void end();
-
-    GLuint getResult();
-    GLboolean isResultAvailable();
-
-    GLenum getType() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Query);
-
-    rx::QueryImpl *mQuery;
-};
-
-}
-
-#endif   // LIBGLESV2_QUERY_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Renderbuffercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,639 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// 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.
-//
-
-// 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 &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/renderer/RenderTarget.h&quot;
-
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/renderer/TextureStorage.h&quot;
-#include &quot;common/utilities.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-
-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)
-{
-}
-
-///// RenderbufferTexture2D Implementation ////////
-
-RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLint level) : mLevel(level)
-{
-    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-&gt;addProxyRef(proxy);
-}
-
-void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy)
-{
-    mTexture2D-&gt;releaseProxy(proxy);
-}
-
-rx::RenderTarget *RenderbufferTexture2D::getRenderTarget()
-{
-    return mTexture2D-&gt;getRenderTarget(mLevel);
-}
-
-rx::RenderTarget *RenderbufferTexture2D::getDepthStencil()
-{
-    return mTexture2D-&gt;getDepthSencil(mLevel);
-}
-
-rx::TextureStorage *RenderbufferTexture2D::getTextureStorage()
-{
-    return mTexture2D-&gt;getNativeTexture()-&gt;getStorageInstance();
-}
-
-GLsizei RenderbufferTexture2D::getWidth() const
-{
-    return mTexture2D-&gt;getWidth(mLevel);
-}
-
-GLsizei RenderbufferTexture2D::getHeight() const
-{
-    return mTexture2D-&gt;getHeight(mLevel);
-}
-
-GLenum RenderbufferTexture2D::getInternalFormat() const
-{
-    return mTexture2D-&gt;getInternalFormat(mLevel);
-}
-
-GLenum RenderbufferTexture2D::getActualFormat() const
-{
-    return mTexture2D-&gt;getActualFormat(mLevel);
-}
-
-GLsizei RenderbufferTexture2D::getSamples() const
-{
-    return 0;
-}
-
-unsigned int RenderbufferTexture2D::getSerial() const
-{
-    return mTexture2D-&gt;getRenderTargetSerial(mLevel);
-}
-
-unsigned int RenderbufferTexture2D::getTextureSerial() const
-{
-    return mTexture2D-&gt;getTextureSerial();
-}
-
-///// RenderbufferTextureCubeMap Implementation ////////
-
-RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum faceTarget, GLint level)
-    : mFaceTarget(faceTarget), mLevel(level)
-{
-    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-&gt;addProxyRef(proxy);
-}
-
-void RenderbufferTextureCubeMap::releaseProxy(const Renderbuffer *proxy)
-{
-    mTextureCubeMap-&gt;releaseProxy(proxy);
-}
-
-rx::RenderTarget *RenderbufferTextureCubeMap::getRenderTarget()
-{
-    return mTextureCubeMap-&gt;getRenderTarget(mFaceTarget, mLevel);
-}
-
-rx::RenderTarget *RenderbufferTextureCubeMap::getDepthStencil()
-{
-    return mTextureCubeMap-&gt;getDepthStencil(mFaceTarget, mLevel);
-}
-
-rx::TextureStorage *RenderbufferTextureCubeMap::getTextureStorage()
-{
-    return mTextureCubeMap-&gt;getNativeTexture()-&gt;getStorageInstance();
-}
-
-GLsizei RenderbufferTextureCubeMap::getWidth() const
-{
-    return mTextureCubeMap-&gt;getWidth(mFaceTarget, mLevel);
-}
-
-GLsizei RenderbufferTextureCubeMap::getHeight() const
-{
-    return mTextureCubeMap-&gt;getHeight(mFaceTarget, mLevel);
-}
-
-GLenum RenderbufferTextureCubeMap::getInternalFormat() const
-{
-    return mTextureCubeMap-&gt;getInternalFormat(mFaceTarget, mLevel);
-}
-
-GLenum RenderbufferTextureCubeMap::getActualFormat() const
-{
-    return mTextureCubeMap-&gt;getActualFormat(mFaceTarget, mLevel);
-}
-
-GLsizei RenderbufferTextureCubeMap::getSamples() const
-{
-    return 0;
-}
-
-unsigned int RenderbufferTextureCubeMap::getSerial() const
-{
-    return mTextureCubeMap-&gt;getRenderTargetSerial(mFaceTarget, mLevel);
-}
-
-unsigned int RenderbufferTextureCubeMap::getTextureSerial() const
-{
-    return mTextureCubeMap-&gt;getTextureSerial();
-}
-
-///// RenderbufferTexture3DLayer Implementation ////////
-
-RenderbufferTexture3DLayer::RenderbufferTexture3DLayer(Texture3D *texture, GLint level, GLint layer)
-    : mLevel(level), mLayer(layer)
-{
-    mTexture3D.set(texture);
-}
-
-RenderbufferTexture3DLayer::~RenderbufferTexture3DLayer()
-{
-    mTexture3D.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 RenderbufferTexture3DLayer::addProxyRef(const Renderbuffer *proxy)
-{
-    mTexture3D-&gt;addProxyRef(proxy);
-}
-
-void RenderbufferTexture3DLayer::releaseProxy(const Renderbuffer *proxy)
-{
-    mTexture3D-&gt;releaseProxy(proxy);
-}
-
-rx::RenderTarget *RenderbufferTexture3DLayer::getRenderTarget()
-{
-    return mTexture3D-&gt;getRenderTarget(mLevel, mLayer);
-}
-
-rx::RenderTarget *RenderbufferTexture3DLayer::getDepthStencil()
-{
-    return mTexture3D-&gt;getDepthStencil(mLevel, mLayer);
-}
-
-rx::TextureStorage *RenderbufferTexture3DLayer::getTextureStorage()
-{
-    return mTexture3D-&gt;getNativeTexture()-&gt;getStorageInstance();
-}
-
-GLsizei RenderbufferTexture3DLayer::getWidth() const
-{
-    return mTexture3D-&gt;getWidth(mLevel);
-}
-
-GLsizei RenderbufferTexture3DLayer::getHeight() const
-{
-    return mTexture3D-&gt;getHeight(mLevel);
-}
-
-GLenum RenderbufferTexture3DLayer::getInternalFormat() const
-{
-    return mTexture3D-&gt;getInternalFormat(mLevel);
-}
-
-GLenum RenderbufferTexture3DLayer::getActualFormat() const
-{
-    return mTexture3D-&gt;getActualFormat(mLevel);
-}
-
-GLsizei RenderbufferTexture3DLayer::getSamples() const
-{
-    return 0;
-}
-
-unsigned int RenderbufferTexture3DLayer::getSerial() const
-{
-    return mTexture3D-&gt;getRenderTargetSerial(mLevel, mLayer);
-}
-
-unsigned int RenderbufferTexture3DLayer::getTextureSerial() const
-{
-    return mTexture3D-&gt;getTextureSerial();
-}
-
-////// RenderbufferTexture2DArrayLayer Implementation //////
-
-RenderbufferTexture2DArrayLayer::RenderbufferTexture2DArrayLayer(Texture2DArray *texture, GLint level, GLint layer)
-    : mLevel(level), mLayer(layer)
-{
-    mTexture2DArray.set(texture);
-}
-
-RenderbufferTexture2DArrayLayer::~RenderbufferTexture2DArrayLayer()
-{
-    mTexture2DArray.set(NULL);
-}
-
-void RenderbufferTexture2DArrayLayer::addProxyRef(const Renderbuffer *proxy)
-{
-    mTexture2DArray-&gt;addProxyRef(proxy);
-}
-
-void RenderbufferTexture2DArrayLayer::releaseProxy(const Renderbuffer *proxy)
-{
-    mTexture2DArray-&gt;releaseProxy(proxy);
-}
-
-rx::RenderTarget *RenderbufferTexture2DArrayLayer::getRenderTarget()
-{
-    return mTexture2DArray-&gt;getRenderTarget(mLevel, mLayer);
-}
-
-rx::RenderTarget *RenderbufferTexture2DArrayLayer::getDepthStencil()
-{
-    return mTexture2DArray-&gt;getDepthStencil(mLevel, mLayer);
-}
-
-rx::TextureStorage *RenderbufferTexture2DArrayLayer::getTextureStorage()
-{
-    return mTexture2DArray-&gt;getNativeTexture()-&gt;getStorageInstance();
-}
-
-GLsizei RenderbufferTexture2DArrayLayer::getWidth() const
-{
-    return mTexture2DArray-&gt;getWidth(mLevel);
-}
-
-GLsizei RenderbufferTexture2DArrayLayer::getHeight() const
-{
-    return mTexture2DArray-&gt;getHeight(mLevel);
-}
-
-GLenum RenderbufferTexture2DArrayLayer::getInternalFormat() const
-{
-    return mTexture2DArray-&gt;getInternalFormat(mLevel);
-}
-
-GLenum RenderbufferTexture2DArrayLayer::getActualFormat() const
-{
-    return mTexture2DArray-&gt;getActualFormat(mLevel);
-}
-
-GLsizei RenderbufferTexture2DArrayLayer::getSamples() const
-{
-    return 0;
-}
-
-unsigned int RenderbufferTexture2DArrayLayer::getSerial() const
-{
-    return mTexture2DArray-&gt;getRenderTargetSerial(mLevel, mLayer);
-}
-
-unsigned int RenderbufferTexture2DArrayLayer::getTextureSerial() const
-{
-    return mTexture2DArray-&gt;getTextureSerial();
-}
-
-////// Renderbuffer Implementation //////
-
-Renderbuffer::Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterface *instance) : RefCountObject(id)
-{
-    ASSERT(instance != NULL);
-    mInstance = instance;
-
-    ASSERT(renderer != NULL);
-    mRenderer = renderer;
-}
-
-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-&gt;addProxyRef(this);
-
-    RefCountObject::addRef();
-}
-
-void Renderbuffer::release() const
-{
-    mInstance-&gt;releaseProxy(this);
-
-    RefCountObject::release();
-}
-
-rx::RenderTarget *Renderbuffer::getRenderTarget()
-{
-    return mInstance-&gt;getRenderTarget();
-}
-
-rx::RenderTarget *Renderbuffer::getDepthStencil()
-{
-    return mInstance-&gt;getDepthStencil();
-}
-
-rx::TextureStorage *Renderbuffer::getTextureStorage()
-{
-    return mInstance-&gt;getTextureStorage();
-}
-
-GLsizei Renderbuffer::getWidth() const
-{
-    return mInstance-&gt;getWidth();
-}
-
-GLsizei Renderbuffer::getHeight() const
-{
-    return mInstance-&gt;getHeight();
-}
-
-GLenum Renderbuffer::getInternalFormat() const
-{
-    return mInstance-&gt;getInternalFormat();
-}
-
-GLenum Renderbuffer::getActualFormat() const
-{
-    return mInstance-&gt;getActualFormat();
-}
-
-GLuint Renderbuffer::getRedSize() const
-{
-    return gl::GetRedBits(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLuint Renderbuffer::getGreenSize() const
-{
-    return gl::GetGreenBits(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLuint Renderbuffer::getBlueSize() const
-{
-    return gl::GetBlueBits(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLuint Renderbuffer::getAlphaSize() const
-{
-    return gl::GetAlphaBits(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLuint Renderbuffer::getDepthSize() const
-{
-    return gl::GetDepthBits(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLuint Renderbuffer::getStencilSize() const
-{
-    return gl::GetStencilBits(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLenum Renderbuffer::getComponentType() const
-{
-    return gl::GetComponentType(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLenum Renderbuffer::getColorEncoding() const
-{
-    return gl::GetColorEncoding(getActualFormat(), mRenderer-&gt;getCurrentClientVersion());
-}
-
-GLsizei Renderbuffer::getSamples() const
-{
-    return mInstance-&gt;getSamples();
-}
-
-unsigned int Renderbuffer::getSerial() const
-{
-    return mInstance-&gt;getSerial();
-}
-
-unsigned int Renderbuffer::getTextureSerial() const
-{
-    return mInstance-&gt;getTextureSerial();
-}
-
-void Renderbuffer::setStorage(RenderbufferStorage *newStorage)
-{
-    ASSERT(newStorage != NULL);
-
-    delete mInstance;
-    mInstance = newStorage;
-}
-
-RenderbufferStorage::RenderbufferStorage() : mSerial(issueSerials(1))
-{
-    mWidth = 0;
-    mHeight = 0;
-    mInternalFormat = GL_RGBA4;
-    mActualFormat = GL_RGBA8_OES;
-    mSamples = 0;
-}
-
-RenderbufferStorage::~RenderbufferStorage()
-{
-}
-
-rx::RenderTarget *RenderbufferStorage::getRenderTarget()
-{
-    return NULL;
-}
-
-rx::RenderTarget *RenderbufferStorage::getDepthStencil()
-{
-    return NULL;
-}
-
-rx::TextureStorage *RenderbufferStorage::getTextureStorage()
-{
-    return NULL;
-}
-
-GLsizei RenderbufferStorage::getWidth() const
-{
-    return mWidth;
-}
-
-GLsizei RenderbufferStorage::getHeight() const
-{
-    return mHeight;
-}
-
-GLenum RenderbufferStorage::getInternalFormat() const
-{
-    return mInternalFormat;
-}
-
-GLenum RenderbufferStorage::getActualFormat() const
-{
-    return mActualFormat;
-}
-
-GLsizei RenderbufferStorage::getSamples() const
-{
-    return mSamples;
-}
-
-unsigned int RenderbufferStorage::getSerial() const
-{
-    return mSerial;
-}
-
-unsigned int RenderbufferStorage::issueSerials(GLuint count)
-{
-    unsigned int firstSerial = mCurrentSerial;
-    mCurrentSerial += count;
-    return firstSerial;
-}
-
-Colorbuffer::Colorbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain)
-{
-    mRenderTarget = renderer-&gt;createRenderTarget(swapChain, false); 
-
-    if (mRenderTarget)
-    {
-        mWidth = mRenderTarget-&gt;getWidth();
-        mHeight = mRenderTarget-&gt;getHeight();
-        mInternalFormat = mRenderTarget-&gt;getInternalFormat();
-        mActualFormat = mRenderTarget-&gt;getActualFormat();
-        mSamples = mRenderTarget-&gt;getSamples();
-    }
-}
-
-Colorbuffer::Colorbuffer(rx::Renderer *renderer, int width, int height, GLenum format, GLsizei samples) : mRenderTarget(NULL)
-{
-    mRenderTarget = renderer-&gt;createRenderTarget(width, height, format, samples);
-
-    if (mRenderTarget)
-    {
-        mWidth = width;
-        mHeight = height;
-        mInternalFormat = format;
-        mActualFormat = mRenderTarget-&gt;getActualFormat();
-        mSamples = mRenderTarget-&gt;getSamples();
-    }
-}
-
-Colorbuffer::~Colorbuffer()
-{
-    if (mRenderTarget)
-    {
-        delete mRenderTarget;
-    }
-}
-
-rx::RenderTarget *Colorbuffer::getRenderTarget()
-{
-    return mRenderTarget;
-}
-
-DepthStencilbuffer::DepthStencilbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain)
-{
-    mDepthStencil = renderer-&gt;createRenderTarget(swapChain, true);
-    if (mDepthStencil)
-    {
-        mWidth = mDepthStencil-&gt;getWidth();
-        mHeight = mDepthStencil-&gt;getHeight();
-        mInternalFormat = mDepthStencil-&gt;getInternalFormat();
-        mSamples = mDepthStencil-&gt;getSamples();
-        mActualFormat = mDepthStencil-&gt;getActualFormat();
-    }
-}
-
-DepthStencilbuffer::DepthStencilbuffer(rx::Renderer *renderer, int width, int height, GLsizei samples)
-{
-
-    mDepthStencil = renderer-&gt;createRenderTarget(width, height, GL_DEPTH24_STENCIL8_OES, samples);
-
-    mWidth = mDepthStencil-&gt;getWidth();
-    mHeight = mDepthStencil-&gt;getHeight();
-    mInternalFormat = GL_DEPTH24_STENCIL8_OES;
-    mActualFormat = mDepthStencil-&gt;getActualFormat();
-    mSamples = mDepthStencil-&gt;getSamples();
-}
-
-DepthStencilbuffer::~DepthStencilbuffer()
-{
-    if (mDepthStencil)
-    {
-        delete mDepthStencil;
-    }
-}
-
-rx::RenderTarget *DepthStencilbuffer::getDepthStencil()
-{
-    return mDepthStencil;
-}
-
-Depthbuffer::Depthbuffer(rx::Renderer *renderer, int width, int height, GLsizei samples) : DepthStencilbuffer(renderer, 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(rx::Renderer *renderer, int width, int height, GLsizei samples) : DepthStencilbuffer(renderer, 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()
-{
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Renderbufferh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Renderbuffer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,333 +0,0 @@
</span><del>-//
-// 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 &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-
-namespace rx
-{
-class Renderer;
-class SwapChain;
-class RenderTarget;
-class TextureStorage;
-}
-
-namespace gl
-{
-class Texture2D;
-class TextureCubeMap;
-class Texture3D;
-class Texture2DArray;
-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 rx::RenderTarget *getRenderTarget() = 0;
-    virtual rx::RenderTarget *getDepthStencil() = 0;
-    virtual rx::TextureStorage *getTextureStorage() = 0;
-
-    virtual GLsizei getWidth() const = 0;
-    virtual GLsizei getHeight() const = 0;
-    virtual GLenum getInternalFormat() const = 0;
-    virtual GLenum getActualFormat() const = 0;
-    virtual GLsizei getSamples() const = 0;
-
-    virtual unsigned int getSerial() const = 0;
-    virtual unsigned int getTextureSerial() const = 0;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(RenderbufferInterface);
-};
-
-class RenderbufferTexture2D : public RenderbufferInterface
-{
-  public:
-    RenderbufferTexture2D(Texture2D *texture, GLint level);
-
-    virtual ~RenderbufferTexture2D();
-
-    void addProxyRef(const Renderbuffer *proxy);
-    void releaseProxy(const Renderbuffer *proxy);
-
-    rx::RenderTarget *getRenderTarget();
-    rx::RenderTarget *getDepthStencil();
-    rx::TextureStorage *getTextureStorage();
-
-    virtual GLsizei getWidth() const;
-    virtual GLsizei getHeight() const;
-    virtual GLenum getInternalFormat() const;
-    virtual GLenum getActualFormat() const;
-    virtual GLsizei getSamples() const;
-
-    virtual unsigned int getSerial() const;
-    virtual unsigned int getTextureSerial() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2D);
-
-    BindingPointer &lt;Texture2D&gt; mTexture2D;
-    const GLint mLevel;
-};
-
-class RenderbufferTextureCubeMap : public RenderbufferInterface
-{
-  public:
-    RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum faceTarget, GLint level);
-
-    virtual ~RenderbufferTextureCubeMap();
-
-    void addProxyRef(const Renderbuffer *proxy);
-    void releaseProxy(const Renderbuffer *proxy);
-
-    rx::RenderTarget *getRenderTarget();
-    rx::RenderTarget *getDepthStencil();
-    rx::TextureStorage *getTextureStorage();
-
-    virtual GLsizei getWidth() const;
-    virtual GLsizei getHeight() const;
-    virtual GLenum getInternalFormat() const;
-    virtual GLenum getActualFormat() const;
-    virtual GLsizei getSamples() const;
-
-    virtual unsigned int getSerial() const;
-    virtual unsigned int getTextureSerial() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(RenderbufferTextureCubeMap);
-
-    BindingPointer &lt;TextureCubeMap&gt; mTextureCubeMap;
-    const GLint mLevel;
-    const GLenum mFaceTarget;
-};
-
-class RenderbufferTexture3DLayer : public RenderbufferInterface
-{
-public:
-    RenderbufferTexture3DLayer(Texture3D *texture, GLint level, GLint layer);
-
-    virtual ~RenderbufferTexture3DLayer();
-
-    void addProxyRef(const Renderbuffer *proxy);
-    void releaseProxy(const Renderbuffer *proxy);
-
-    rx::RenderTarget *getRenderTarget();
-    rx::RenderTarget *getDepthStencil();
-    rx::TextureStorage *getTextureStorage();
-
-    virtual GLsizei getWidth() const;
-    virtual GLsizei getHeight() const;
-    virtual GLenum getInternalFormat() const;
-    virtual GLenum getActualFormat() const;
-    virtual GLsizei getSamples() const;
-
-    virtual unsigned int getSerial() const;
-    virtual unsigned int getTextureSerial() const;
-
-private:
-    DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture3DLayer);
-
-    BindingPointer&lt;Texture3D&gt; mTexture3D;
-    const GLint mLevel;
-    const GLint mLayer;
-};
-
-class RenderbufferTexture2DArrayLayer : public RenderbufferInterface
-{
-public:
-    RenderbufferTexture2DArrayLayer(Texture2DArray *texture, GLint level, GLint layer);
-
-    virtual ~RenderbufferTexture2DArrayLayer();
-
-    void addProxyRef(const Renderbuffer *proxy);
-    void releaseProxy(const Renderbuffer *proxy);
-
-    rx::RenderTarget *getRenderTarget();
-    rx::RenderTarget *getDepthStencil();
-    rx::TextureStorage *getTextureStorage();
-
-    virtual GLsizei getWidth() const;
-    virtual GLsizei getHeight() const;
-    virtual GLenum getInternalFormat() const;
-    virtual GLenum getActualFormat() const;
-    virtual GLsizei getSamples() const;
-
-    virtual unsigned int getSerial() const;
-    virtual unsigned int getTextureSerial() const;
-
-private:
-    DISALLOW_COPY_AND_ASSIGN(RenderbufferTexture2DArrayLayer);
-
-    BindingPointer&lt;Texture2DArray&gt; mTexture2DArray;
-    const GLint mLevel;
-    const GLint mLayer;
-};
-
-// 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 rx::RenderTarget *getRenderTarget();
-    virtual rx::RenderTarget *getDepthStencil();
-    virtual rx::TextureStorage *getTextureStorage();
-
-    virtual GLsizei getWidth() const;
-    virtual GLsizei getHeight() const;
-    virtual GLenum getInternalFormat() const;
-    virtual GLenum getActualFormat() const;
-    virtual GLsizei getSamples() const;
-
-    virtual unsigned int getSerial() const;
-    virtual unsigned int getTextureSerial() const { return 0; }
-
-    static unsigned int issueSerials(GLuint count);
-
-  protected:
-    GLsizei mWidth;
-    GLsizei mHeight;
-    GLenum mInternalFormat;
-    GLenum mActualFormat;
-    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(rx::Renderer *renderer, 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;
-
-    rx::RenderTarget *getRenderTarget();
-    rx::RenderTarget *getDepthStencil();
-    rx::TextureStorage *getTextureStorage();
-
-    GLsizei getWidth() const;
-    GLsizei getHeight() const;
-    GLenum getInternalFormat() const;
-    GLenum getActualFormat() const;
-    GLuint getRedSize() const;
-    GLuint getGreenSize() const;
-    GLuint getBlueSize() const;
-    GLuint getAlphaSize() const;
-    GLuint getDepthSize() const;
-    GLuint getStencilSize() const;
-    GLenum getComponentType() const;
-    GLenum getColorEncoding() const;
-    GLsizei getSamples() const;
-
-    unsigned int getSerial() const;
-    unsigned int getTextureSerial() const;
-
-    void setStorage(RenderbufferStorage *newStorage);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
-
-    rx::Renderer const *mRenderer;
-    RenderbufferInterface *mInstance;
-};
-
-class Colorbuffer : public RenderbufferStorage
-{
-  public:
-    Colorbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain);
-    Colorbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLenum format, GLsizei samples);
-
-    virtual ~Colorbuffer();
-
-    virtual rx::RenderTarget *getRenderTarget();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Colorbuffer);
-
-    rx::RenderTarget *mRenderTarget;
-};
-
-class DepthStencilbuffer : public RenderbufferStorage
-{
-  public:
-    DepthStencilbuffer(rx::Renderer *renderer, rx::SwapChain *swapChain);
-    DepthStencilbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples);
-
-    ~DepthStencilbuffer();
-
-    virtual rx::RenderTarget *getDepthStencil();
-
-  protected:
-    rx::RenderTarget  *mDepthStencil;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(DepthStencilbuffer);
-};
-
-class Depthbuffer : public DepthStencilbuffer
-{
-  public:
-    Depthbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples);
-
-    virtual ~Depthbuffer();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Depthbuffer);
-};
-
-class Stencilbuffer : public DepthStencilbuffer
-{
-  public:
-    Stencilbuffer(rx::Renderer *renderer, GLsizei width, GLsizei height, GLsizei samples);
-
-    virtual ~Stencilbuffer();
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Stencilbuffer);
-};
-}
-
-#endif   // LIBGLESV2_RENDERBUFFER_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2RenderbufferProxySetcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,87 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-
-// RenderbufferProxySet.cpp: Implements the gl::RenderbufferProxySet, a class for
-// maintaining a Texture's weak references to the Renderbuffers that represent it.
-
-#include &quot;libGLESv2/RenderbufferProxySet.h&quot;
-#include &quot;common/debug.h&quot;
-
-namespace gl
-{
-
-void RenderbufferProxySet::addRef(const Renderbuffer *proxy)
-{
-    RefCountMap::iterator i = mRefCountMap.find(proxy);
-    if (i != mRefCountMap.end())
-    {
-        i-&gt;second++;
-    }
-}
-
-void RenderbufferProxySet::release(const Renderbuffer *proxy)
-{
-    RefCountMap::iterator i = mRefCountMap.find(proxy);
-    if (i != mRefCountMap.end())
-    {
-        if (i-&gt;second &gt; 0)
-        {
-            i-&gt;second--;
-        }
-
-        if (i-&gt;second == 0)
-        {
-            // Clear the buffer map of references to this Renderbuffer
-            BufferMap::iterator j = mBufferMap.begin();
-            while (j != mBufferMap.end())
-            {
-                if (j-&gt;second == proxy)
-                {
-                    j = mBufferMap.erase(j);
-                }
-                else
-                {
-                    ++j;
-                }
-            }
-
-            mRefCountMap.erase(i);
-        }
-    }
-}
-
-void RenderbufferProxySet::add(unsigned int mipLevel, unsigned int layer, Renderbuffer *renderBuffer)
-{
-    if (mRefCountMap.find(renderBuffer) == mRefCountMap.end())
-    {
-        mRefCountMap.insert(std::make_pair(renderBuffer, 0));
-    }
-
-    RenderbufferKey key;
-    key.mipLevel = mipLevel;
-    key.layer = layer;
-    if (mBufferMap.find(key) == mBufferMap.end())
-    {
-        mBufferMap.insert(std::make_pair(key, renderBuffer));
-    }
-}
-
-Renderbuffer *RenderbufferProxySet::get(unsigned int mipLevel, unsigned int layer) const
-{
-    RenderbufferKey key;
-    key.mipLevel = mipLevel;
-    key.layer = layer;
-    BufferMap::const_iterator i = mBufferMap.find(key);
-    return (i != mBufferMap.end()) ? i-&gt;second : NULL;
-}
-
-bool RenderbufferProxySet::RenderbufferKey::operator&lt;(const RenderbufferKey &amp;other) const
-{
-    return (mipLevel != other.mipLevel) ? mipLevel &lt; other.mipLevel : layer &lt; other.layer;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2RenderbufferProxySeth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/RenderbufferProxySet.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,46 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// RenderbufferProxySet.h: Defines the gl::RenderbufferProxySet, a class for
-// maintaining a Texture's weak references to the Renderbuffers that represent it.
-
-#ifndef LIBGLESV2_RENDERBUFFERPROXYSET_H_
-#define LIBGLESV2_RENDERBUFFERPROXYSET_H_
-
-#include &lt;map&gt;
-
-namespace gl
-{
-class Renderbuffer;
-
-class RenderbufferProxySet
-{
-  public:
-    void addRef(const Renderbuffer *proxy);
-    void release(const Renderbuffer *proxy);
-
-    void add(unsigned int mipLevel, unsigned int layer, Renderbuffer *renderBuffer);
-    Renderbuffer *get(unsigned int mipLevel, unsigned int layer) const;
-
-  private:
-    struct RenderbufferKey
-    {
-        unsigned int mipLevel;
-        unsigned int layer;
-
-        bool operator&lt;(const RenderbufferKey &amp;other) const;
-    };
-
-    typedef std::map&lt;RenderbufferKey, Renderbuffer*&gt; BufferMap;
-    BufferMap mBufferMap;
-
-    typedef std::map&lt;const Renderbuffer*, unsigned int&gt; RefCountMap;
-    RefCountMap mRefCountMap;
-};
-
-}
-
-#endif // LIBGLESV2_RENDERBUFFERPROXYSET_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ResourceManagercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,429 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &quot;libGLESv2/ResourceManager.h&quot;
-
-#include &quot;libGLESv2/Buffer.h&quot;
-#include &quot;libGLESv2/Program.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/Shader.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/Sampler.h&quot;
-#include &quot;libGLESv2/Fence.h&quot;
-
-namespace gl
-{
-ResourceManager::ResourceManager(rx::Renderer *renderer)
-{
-    mRefCount = 1;
-    mRenderer = renderer;
-}
-
-ResourceManager::~ResourceManager()
-{
-    while (!mBufferMap.empty())
-    {
-        deleteBuffer(mBufferMap.begin()-&gt;first);
-    }
-
-    while (!mProgramMap.empty())
-    {
-        deleteProgram(mProgramMap.begin()-&gt;first);
-    }
-
-    while (!mShaderMap.empty())
-    {
-        deleteShader(mShaderMap.begin()-&gt;first);
-    }
-
-    while (!mRenderbufferMap.empty())
-    {
-        deleteRenderbuffer(mRenderbufferMap.begin()-&gt;first);
-    }
-
-    while (!mTextureMap.empty())
-    {
-        deleteTexture(mTextureMap.begin()-&gt;first);
-    }
-
-    while (!mSamplerMap.empty())
-    {
-        deleteSampler(mSamplerMap.begin()-&gt;first);
-    }
-
-    while (!mFenceSyncMap.empty())
-    {
-        deleteFenceSync(mFenceSyncMap.begin()-&gt;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, mRenderer, handle);
-    }
-    else if (type == GL_FRAGMENT_SHADER)
-    {
-        mShaderMap[handle] = new FragmentShader(this, mRenderer, handle);
-    }
-    else UNREACHABLE();
-
-    return handle;
-}
-
-// Returns an unused program/shader name
-GLuint ResourceManager::createProgram()
-{
-    GLuint handle = mProgramShaderHandleAllocator.allocate();
-
-    mProgramMap[handle] = new Program(mRenderer, 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;
-}
-
-// Returns an unused sampler name
-GLuint ResourceManager::createSampler()
-{
-    GLuint handle = mSamplerHandleAllocator.allocate();
-
-    mSamplerMap[handle] = NULL;
-
-    return handle;
-}
-
-// Returns the next unused fence name, and allocates the fence
-GLuint ResourceManager::createFenceSync()
-{
-    GLuint handle = mFenceSyncHandleAllocator.allocate();
-
-    mFenceSyncMap[handle] = new FenceSync(mRenderer, handle);
-
-    return handle;
-}
-
-void ResourceManager::deleteBuffer(GLuint buffer)
-{
-    BufferMap::iterator bufferObject = mBufferMap.find(buffer);
-
-    if (bufferObject != mBufferMap.end())
-    {
-        mBufferHandleAllocator.release(bufferObject-&gt;first);
-        if (bufferObject-&gt;second) bufferObject-&gt;second-&gt;release();
-        mBufferMap.erase(bufferObject);
-    }
-}
-
-void ResourceManager::deleteShader(GLuint shader)
-{
-    ShaderMap::iterator shaderObject = mShaderMap.find(shader);
-
-    if (shaderObject != mShaderMap.end())
-    {
-        if (shaderObject-&gt;second-&gt;getRefCount() == 0)
-        {
-            mProgramShaderHandleAllocator.release(shaderObject-&gt;first);
-            delete shaderObject-&gt;second;
-            mShaderMap.erase(shaderObject);
-        }
-        else
-        {
-            shaderObject-&gt;second-&gt;flagForDeletion();
-        }
-    }
-}
-
-void ResourceManager::deleteProgram(GLuint program)
-{
-    ProgramMap::iterator programObject = mProgramMap.find(program);
-
-    if (programObject != mProgramMap.end())
-    {
-        if (programObject-&gt;second-&gt;getRefCount() == 0)
-        {
-            mProgramShaderHandleAllocator.release(programObject-&gt;first);
-            delete programObject-&gt;second;
-            mProgramMap.erase(programObject);
-        }
-        else
-        { 
-            programObject-&gt;second-&gt;flagForDeletion();
-        }
-    }
-}
-
-void ResourceManager::deleteTexture(GLuint texture)
-{
-    TextureMap::iterator textureObject = mTextureMap.find(texture);
-
-    if (textureObject != mTextureMap.end())
-    {
-        mTextureHandleAllocator.release(textureObject-&gt;first);
-        if (textureObject-&gt;second) textureObject-&gt;second-&gt;release();
-        mTextureMap.erase(textureObject);
-    }
-}
-
-void ResourceManager::deleteRenderbuffer(GLuint renderbuffer)
-{
-    RenderbufferMap::iterator renderbufferObject = mRenderbufferMap.find(renderbuffer);
-
-    if (renderbufferObject != mRenderbufferMap.end())
-    {
-        mRenderbufferHandleAllocator.release(renderbufferObject-&gt;first);
-        if (renderbufferObject-&gt;second) renderbufferObject-&gt;second-&gt;release();
-        mRenderbufferMap.erase(renderbufferObject);
-    }
-}
-
-void ResourceManager::deleteSampler(GLuint sampler)
-{
-    auto samplerObject = mSamplerMap.find(sampler);
-
-    if (samplerObject != mSamplerMap.end())
-    {
-        mSamplerHandleAllocator.release(samplerObject-&gt;first);
-        if (samplerObject-&gt;second) samplerObject-&gt;second-&gt;release();
-        mSamplerMap.erase(samplerObject);
-    }
-}
-
-void ResourceManager::deleteFenceSync(GLuint fenceSync)
-{
-    auto fenceObjectIt = mFenceSyncMap.find(fenceSync);
-
-    if (fenceObjectIt != mFenceSyncMap.end())
-    {
-        mFenceSyncHandleAllocator.release(fenceObjectIt-&gt;first);
-        if (fenceObjectIt-&gt;second) fenceObjectIt-&gt;second-&gt;release();
-        mFenceSyncMap.erase(fenceObjectIt);
-    }
-}
-
-Buffer *ResourceManager::getBuffer(unsigned int handle)
-{
-    BufferMap::iterator buffer = mBufferMap.find(handle);
-
-    if (buffer == mBufferMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return buffer-&gt;second;
-    }
-}
-
-Shader *ResourceManager::getShader(unsigned int handle)
-{
-    ShaderMap::iterator shader = mShaderMap.find(handle);
-
-    if (shader == mShaderMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return shader-&gt;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-&gt;second;
-    }
-}
-
-Program *ResourceManager::getProgram(unsigned int handle)
-{
-    ProgramMap::iterator program = mProgramMap.find(handle);
-
-    if (program == mProgramMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return program-&gt;second;
-    }
-}
-
-Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
-{
-    RenderbufferMap::iterator renderbuffer = mRenderbufferMap.find(handle);
-
-    if (renderbuffer == mRenderbufferMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return renderbuffer-&gt;second;
-    }
-}
-
-Sampler *ResourceManager::getSampler(unsigned int handle)
-{
-    auto sampler = mSamplerMap.find(handle);
-
-    if (sampler == mSamplerMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return sampler-&gt;second;
-    }
-}
-
-FenceSync *ResourceManager::getFenceSync(unsigned int handle)
-{
-    auto fenceObjectIt = mFenceSyncMap.find(handle);
-
-    if (fenceObjectIt == mFenceSyncMap.end())
-    {
-        return NULL;
-    }
-    else
-    {
-        return fenceObjectIt-&gt;second;
-    }
-}
-
-void ResourceManager::setRenderbuffer(GLuint handle, Renderbuffer *buffer)
-{
-    mRenderbufferMap[handle] = buffer;
-}
-
-void ResourceManager::checkBufferAllocation(unsigned int buffer)
-{
-    if (buffer != 0 &amp;&amp; !getBuffer(buffer))
-    {
-        Buffer *bufferObject = new Buffer(mRenderer, buffer);
-        mBufferMap[buffer] = bufferObject;
-        bufferObject-&gt;addRef();
-    }
-}
-
-void ResourceManager::checkTextureAllocation(GLuint texture, TextureType type)
-{
-    if (!getTexture(texture) &amp;&amp; texture != 0)
-    {
-        Texture *textureObject;
-
-        if (type == TEXTURE_2D)
-        {
-            textureObject = new Texture2D(mRenderer, texture);
-        }
-        else if (type == TEXTURE_CUBE)
-        {
-            textureObject = new TextureCubeMap(mRenderer, texture);
-        }
-        else if (type == TEXTURE_3D)
-        {
-            textureObject = new Texture3D(mRenderer, texture);
-        }
-        else if (type == TEXTURE_2D_ARRAY)
-        {
-            textureObject = new Texture2DArray(mRenderer, texture);
-        }
-        else
-        {
-            UNREACHABLE();
-            return;
-        }
-
-        mTextureMap[texture] = textureObject;
-        textureObject-&gt;addRef();
-    }
-}
-
-void ResourceManager::checkRenderbufferAllocation(GLuint renderbuffer)
-{
-    if (renderbuffer != 0 &amp;&amp; !getRenderbuffer(renderbuffer))
-    {
-        Renderbuffer *renderbufferObject = new Renderbuffer(mRenderer, renderbuffer, new Colorbuffer(mRenderer, 0, 0, GL_RGBA4, 0));
-        mRenderbufferMap[renderbuffer] = renderbufferObject;
-        renderbufferObject-&gt;addRef();
-    }
-}
-
-void ResourceManager::checkSamplerAllocation(GLuint sampler)
-{
-    if (sampler != 0 &amp;&amp; !getSampler(sampler))
-    {
-        Sampler *samplerObject = new Sampler(sampler);
-        mSamplerMap[sampler] = samplerObject;
-        samplerObject-&gt;addRef();
-    }
-}
-
-bool ResourceManager::isSampler(GLuint sampler)
-{
-    return mSamplerMap.find(sampler) != mSamplerMap.end();
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2ResourceManagerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/ResourceManager.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,116 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &lt;unordered_map&gt;
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;libGLESv2/angletypes.h&quot;
-#include &quot;libGLESv2/HandleAllocator.h&quot;
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace gl
-{
-class Buffer;
-class Shader;
-class Program;
-class Texture;
-class Renderbuffer;
-class Sampler;
-class FenceSync;
-
-class ResourceManager
-{
-  public:
-    explicit ResourceManager(rx::Renderer *renderer);
-    ~ResourceManager();
-
-    void addRef();
-    void release();
-
-    GLuint createBuffer();
-    GLuint createShader(GLenum type);
-    GLuint createProgram();
-    GLuint createTexture();
-    GLuint createRenderbuffer();
-    GLuint createSampler();
-    GLuint createFenceSync();
-
-    void deleteBuffer(GLuint buffer);
-    void deleteShader(GLuint shader);
-    void deleteProgram(GLuint program);
-    void deleteTexture(GLuint texture);
-    void deleteRenderbuffer(GLuint renderbuffer);
-    void deleteSampler(GLuint sampler);
-    void deleteFenceSync(GLuint fenceSync);
-
-    Buffer *getBuffer(GLuint handle);
-    Shader *getShader(GLuint handle);
-    Program *getProgram(GLuint handle);
-    Texture *getTexture(GLuint handle);
-    Renderbuffer *getRenderbuffer(GLuint handle);
-    Sampler *getSampler(GLuint handle);
-    FenceSync *getFenceSync(GLuint handle);
-    
-    void setRenderbuffer(GLuint handle, Renderbuffer *renderbuffer);
-
-    void checkBufferAllocation(unsigned int buffer);
-    void checkTextureAllocation(GLuint texture, TextureType type);
-    void checkRenderbufferAllocation(GLuint renderbuffer);
-    void checkSamplerAllocation(GLuint sampler);
-
-    bool isSampler(GLuint sampler);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(ResourceManager);
-
-    std::size_t mRefCount;
-    rx::Renderer *mRenderer;
-
-    typedef std::unordered_map&lt;GLuint, Buffer*&gt; BufferMap;
-    BufferMap mBufferMap;
-    HandleAllocator mBufferHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, Shader*&gt; ShaderMap;
-    ShaderMap mShaderMap;
-
-    typedef std::unordered_map&lt;GLuint, Program*&gt; ProgramMap;
-    ProgramMap mProgramMap;
-    HandleAllocator mProgramShaderHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, Texture*&gt; TextureMap;
-    TextureMap mTextureMap;
-    HandleAllocator mTextureHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, Renderbuffer*&gt; RenderbufferMap;
-    RenderbufferMap mRenderbufferMap;
-    HandleAllocator mRenderbufferHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, Sampler*&gt; SamplerMap;
-    SamplerMap mSamplerMap;
-    HandleAllocator mSamplerHandleAllocator;
-
-    typedef std::unordered_map&lt;GLuint, FenceSync*&gt; FenceMap;
-    FenceMap mFenceSyncMap;
-    HandleAllocator mFenceSyncHandleAllocator;
-};
-
-}
-
-#endif // LIBGLESV2_RESOURCEMANAGER_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Samplercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,44 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-
-// Sampler.cpp : Implements the Sampler class, which represents a GLES 3
-// sampler object. Sampler objects store some state needed to sample textures.
-
-#include &quot;libGLESv2/Sampler.h&quot;
-#include &quot;libGLESv2/angletypes.h&quot;
-
-namespace gl
-{
-
-Sampler::Sampler(GLuint id)
-    : RefCountObject(id),
-      mMinFilter(GL_NEAREST_MIPMAP_LINEAR),
-      mMagFilter(GL_LINEAR),
-      mWrapS(GL_REPEAT),
-      mWrapT(GL_REPEAT),
-      mWrapR(GL_REPEAT),
-      mMinLod(-1000.0f),
-      mMaxLod(1000.0f),
-      mComparisonMode(GL_NONE),
-      mComparisonFunc(GL_LEQUAL)
-{
-}
-
-void Sampler::getState(SamplerState *samplerState) const
-{
-    samplerState-&gt;minFilter   = mMinFilter;
-    samplerState-&gt;magFilter   = mMagFilter;
-    samplerState-&gt;wrapS       = mWrapS;
-    samplerState-&gt;wrapT       = mWrapT;
-    samplerState-&gt;wrapR       = mWrapR;
-    samplerState-&gt;minLod      = mMinLod;
-    samplerState-&gt;maxLod      = mMaxLod;
-    samplerState-&gt;compareMode = mComparisonMode;
-    samplerState-&gt;compareFunc = mComparisonFunc;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Samplerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Sampler.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,60 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// Sampler.h : Defines the Sampler class, which represents a GLES 3
-// sampler object. Sampler objects store some state needed to sample textures.
-
-#ifndef LIBGLESV2_SAMPLER_H_
-#define LIBGLESV2_SAMPLER_H_
-
-#include &quot;common/RefCountObject.h&quot;
-
-namespace gl
-{
-struct SamplerState;
-
-class Sampler : public RefCountObject
-{
-  public:
-    Sampler(GLuint id);
-
-    void setMinFilter(GLenum minFilter) { mMinFilter = minFilter; }
-    void setMagFilter(GLenum magFilter) { mMagFilter = magFilter; }
-    void setWrapS(GLenum wrapS) { mWrapS = wrapS; }
-    void setWrapT(GLenum wrapT) { mWrapT = wrapT; }
-    void setWrapR(GLenum wrapR) { mWrapR = wrapR; }
-    void setMinLod(GLfloat minLod) { mMinLod = minLod; }
-    void setMaxLod(GLfloat maxLod) { mMaxLod = maxLod; }
-    void setComparisonMode(GLenum comparisonMode) { mComparisonMode = comparisonMode; }
-    void setComparisonFunc(GLenum comparisonFunc) { mComparisonFunc = comparisonFunc; }
-
-    GLenum getMinFilter() const { return mMinFilter; }
-    GLenum getMagFilter() const { return mMagFilter; }
-    GLenum getWrapS() const { return mWrapS; }
-    GLenum getWrapT() const { return mWrapT; }
-    GLenum getWrapR() const { return mWrapR; }
-    GLfloat getMinLod() const { return mMinLod; }
-    GLfloat getMaxLod() const { return mMaxLod; }
-    GLenum getComparisonMode() const { return mComparisonMode; }
-    GLenum getComparisonFunc() const { return mComparisonFunc; }
-
-    void getState(SamplerState *samplerState) const;
-
-  private:
-    GLenum mMinFilter;
-    GLenum mMagFilter;
-    GLenum mWrapS;
-    GLenum mWrapT;
-    GLenum mWrapR;
-    GLfloat mMinLod;
-    GLfloat mMaxLod;
-    GLenum mComparisonMode;
-    GLenum mComparisonFunc;
-};
-
-}
-
-#endif // LIBGLESV2_SAMPLER_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Shadercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,582 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &quot;libGLESv2/Shader.h&quot;
-
-#include &quot;GLSLANG/ShaderLang.h&quot;
-#include &quot;common/utilities.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/Constants.h&quot;
-#include &quot;libGLESv2/ResourceManager.h&quot;
-
-namespace gl
-{
-void *Shader::mFragmentCompiler = NULL;
-void *Shader::mVertexCompiler = NULL;
-
-Shader::Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
-    : mHandle(handle), mRenderer(renderer), mResourceManager(manager)
-{
-    uncompile();
-    initializeCompiler();
-
-    mRefCount = 0;
-    mDeleteStatus = false;
-    mShaderVersion = 100;
-}
-
-Shader::~Shader()
-{
-}
-
-GLuint Shader::getHandle() const
-{
-    return mHandle;
-}
-
-void Shader::setSource(GLsizei count, const char *const *string, const GLint *length)
-{
-    std::ostringstream stream;
-
-    for (int i = 0; i &lt; count; i++)
-    {
-        stream &lt;&lt; string[i];
-    }
-
-    mSource = stream.str();
-}
-
-int Shader::getInfoLogLength() const
-{
-    return mInfoLog.empty() ? 0 : (mInfoLog.length() + 1);
-}
-
-void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
-{
-    int index = 0;
-
-    if (bufSize &gt; 0)
-    {
-        index = std::min(bufSize - 1, static_cast&lt;GLsizei&gt;(mInfoLog.length()));
-        memcpy(infoLog, mInfoLog.c_str(), index);
-
-        infoLog[index] = '\0';
-    }
-
-    if (length)
-    {
-        *length = index;
-    }
-}
-
-int Shader::getSourceLength() const
-{
-    return mSource.empty() ? 0 : (mSource.length() + 1);
-}
-
-int Shader::getTranslatedSourceLength() const
-{
-    return mHlsl.empty() ? 0 : (mHlsl.length() + 1);
-}
-
-void Shader::getSourceImpl(const std::string &amp;source, GLsizei bufSize, GLsizei *length, char *buffer) const
-{
-    int index = 0;
-
-    if (bufSize &gt; 0)
-    {
-        index = std::min(bufSize - 1, static_cast&lt;GLsizei&gt;(source.length()));
-        memcpy(buffer, source.c_str(), index);
-
-        buffer[index] = '\0';
-    }
-
-    if (length)
-    {
-        *length = index;
-    }
-}
-
-void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer) const
-{
-    getSourceImpl(mSource, bufSize, length, buffer);
-}
-
-void Shader::getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const
-{
-    getSourceImpl(mHlsl, bufSize, length, buffer);
-}
-
-const std::vector&lt;Uniform&gt; &amp;Shader::getUniforms() const
-{
-    return mActiveUniforms;
-}
-
-const std::vector&lt;InterfaceBlock&gt; &amp;Shader::getInterfaceBlocks() const
-{
-    return mActiveInterfaceBlocks;
-}
-
-std::vector&lt;Varying&gt; &amp;Shader::getVaryings()
-{
-    return mVaryings;
-}
-
-bool Shader::isCompiled() const
-{
-    return !mHlsl.empty();
-}
-
-const std::string &amp;Shader::getHLSL() const
-{
-    return mHlsl;
-}
-
-void Shader::addRef()
-{
-    mRefCount++;
-}
-
-void Shader::release()
-{
-    mRefCount--;
-
-    if (mRefCount == 0 &amp;&amp; mDeleteStatus)
-    {
-        mResourceManager-&gt;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)
-        {
-            ShShaderOutput hlslVersion = (mRenderer-&gt;getMajorShaderModel() &gt;= 4) ? SH_HLSL11_OUTPUT : SH_HLSL9_OUTPUT;
-
-            ShBuiltInResources resources;
-            ShInitBuiltInResources(&amp;resources);
-
-            resources.MaxVertexAttribs = MAX_VERTEX_ATTRIBS;
-            resources.MaxVertexUniformVectors = mRenderer-&gt;getMaxVertexUniformVectors();
-            resources.MaxVaryingVectors = mRenderer-&gt;getMaxVaryingVectors();
-            resources.MaxVertexTextureImageUnits = mRenderer-&gt;getMaxVertexTextureImageUnits();
-            resources.MaxCombinedTextureImageUnits = mRenderer-&gt;getMaxCombinedTextureImageUnits();
-            resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
-            resources.MaxFragmentUniformVectors = mRenderer-&gt;getMaxFragmentUniformVectors();
-            resources.MaxDrawBuffers = mRenderer-&gt;getMaxRenderTargets();
-            resources.OES_standard_derivatives = mRenderer-&gt;getDerivativeInstructionSupport();
-            resources.EXT_draw_buffers = mRenderer-&gt;getMaxRenderTargets() &gt; 1;
-            resources.EXT_shader_texture_lod = 1;
-            // resources.OES_EGL_image_external = mRenderer-&gt;getShareHandleSupport() ? 1 : 0; // TODO: commented out until the extension is actually supported.
-            resources.FragmentPrecisionHigh = 1;   // Shader Model 2+ always supports FP24 (s16e7) which corresponds to highp
-            resources.EXT_frag_depth = 1; // Shader Model 2+ always supports explicit depth output
-            // GLSL ES 3.0 constants
-            resources.MaxVertexOutputVectors = mRenderer-&gt;getMaxVaryingVectors();
-            resources.MaxFragmentInputVectors = mRenderer-&gt;getMaxVaryingVectors();
-            resources.MinProgramTexelOffset = -8;   // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE
-            resources.MaxProgramTexelOffset = 7;    // D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE
-
-            mFragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_GLES2_SPEC, hlslVersion, &amp;resources);
-            mVertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_GLES2_SPEC, hlslVersion, &amp;resources);
-        }
-    }
-}
-
-void Shader::releaseCompiler()
-{
-    ShDestruct(mFragmentCompiler);
-    ShDestruct(mVertexCompiler);
-
-    mFragmentCompiler = NULL;
-    mVertexCompiler = NULL;
-
-    ShFinalize();
-}
-
-void Shader::parseVaryings(void *compiler)
-{
-    if (!mHlsl.empty())
-    {
-        std::vector&lt;Varying&gt; *activeVaryings;
-        ShGetInfoPointer(compiler, SH_ACTIVE_VARYINGS_ARRAY, reinterpret_cast&lt;void**&gt;(&amp;activeVaryings));
-        mVaryings = *activeVaryings;
-
-        mUsesMultipleRenderTargets = mHlsl.find(&quot;GL_USES_MRT&quot;)          != std::string::npos;
-        mUsesFragColor             = mHlsl.find(&quot;GL_USES_FRAG_COLOR&quot;)   != std::string::npos;
-        mUsesFragData              = mHlsl.find(&quot;GL_USES_FRAG_DATA&quot;)    != std::string::npos;
-        mUsesFragCoord             = mHlsl.find(&quot;GL_USES_FRAG_COORD&quot;)   != std::string::npos;
-        mUsesFrontFacing           = mHlsl.find(&quot;GL_USES_FRONT_FACING&quot;) != std::string::npos;
-        mUsesPointSize             = mHlsl.find(&quot;GL_USES_POINT_SIZE&quot;)   != std::string::npos;
-        mUsesPointCoord            = mHlsl.find(&quot;GL_USES_POINT_COORD&quot;)  != std::string::npos;
-        mUsesDepthRange            = mHlsl.find(&quot;GL_USES_DEPTH_RANGE&quot;)  != std::string::npos;
-        mUsesFragDepth             = mHlsl.find(&quot;GL_USES_FRAG_DEPTH&quot;)   != std::string::npos;
-        mUsesDiscardRewriting      = mHlsl.find(&quot;ANGLE_USES_DISCARD_REWRITING&quot;) != std::string::npos;
-        mUsesNestedBreak           = mHlsl.find(&quot;ANGLE_USES_NESTED_BREAK&quot;) != std::string::npos;
-    }
-}
-
-void Shader::resetVaryingsRegisterAssignment()
-{
-    for (unsigned int varyingIndex = 0; varyingIndex &lt; mVaryings.size(); varyingIndex++)
-    {
-        mVaryings[varyingIndex].resetRegisterAssignment();
-    }
-}
-
-// initialize/clean up previous state
-void Shader::uncompile()
-{
-    // set by compileToHLSL
-    mHlsl.clear();
-    mInfoLog.clear();
-
-    // set by parseVaryings
-    mVaryings.clear();
-
-    mUsesMultipleRenderTargets = false;
-    mUsesFragColor = false;
-    mUsesFragData = false;
-    mUsesFragCoord = false;
-    mUsesFrontFacing = false;
-    mUsesPointSize = false;
-    mUsesPointCoord = false;
-    mUsesDepthRange = false;
-    mUsesFragDepth = false;
-    mShaderVersion = 100;
-    mUsesDiscardRewriting = false;
-    mUsesNestedBreak = false;
-
-    mActiveUniforms.clear();
-    mActiveInterfaceBlocks.clear();
-}
-
-void Shader::compileToHLSL(void *compiler)
-{
-    // ensure the compiler is loaded
-    initializeCompiler();
-
-    int compileOptions = SH_OBJECT_CODE;
-    std::string sourcePath;
-    if (perfActive())
-    {
-        sourcePath = getTempPath();
-        writeFile(sourcePath.c_str(), mSource.c_str(), mSource.length());
-        compileOptions |= SH_LINE_DIRECTIVES;
-    }
-
-    int result;
-    if (sourcePath.empty())
-    {
-        const char* sourceStrings[] =
-        {
-            mSource.c_str(),
-        };
-
-        result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions);
-    }
-    else
-    {
-        const char* sourceStrings[] =
-        {
-            sourcePath.c_str(),
-            mSource.c_str(),
-        };
-
-        result = ShCompile(compiler, sourceStrings, ArraySize(sourceStrings), compileOptions | SH_SOURCE_PATH);
-    }
-
-    size_t shaderVersion = 100;
-    ShGetInfo(compiler, SH_SHADER_VERSION, &amp;shaderVersion);
-
-    mShaderVersion = static_cast&lt;int&gt;(shaderVersion);
-
-    if (shaderVersion == 300 &amp;&amp; mRenderer-&gt;getCurrentClientVersion() &lt; 3)
-    {
-        mInfoLog = &quot;GLSL ES 3.00 is not supported by OpenGL ES 2.0 contexts&quot;;
-        TRACE(&quot;\n%s&quot;, mInfoLog.c_str());
-    }
-    else if (result)
-    {
-        size_t objCodeLen = 0;
-        ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &amp;objCodeLen);
-
-        char* outputHLSL = new char[objCodeLen];
-        ShGetObjectCode(compiler, outputHLSL);
-
-#ifdef _DEBUG
-        std::ostringstream hlslStream;
-        hlslStream &lt;&lt; &quot;// GLSL\n&quot;;
-        hlslStream &lt;&lt; &quot;//\n&quot;;
-
-        size_t curPos = 0;
-        while (curPos != std::string::npos)
-        {
-            size_t nextLine = mSource.find(&quot;\n&quot;, curPos);
-            size_t len = (nextLine == std::string::npos) ? std::string::npos : (nextLine - curPos + 1);
-
-            hlslStream &lt;&lt; &quot;// &quot; &lt;&lt; mSource.substr(curPos, len);
-
-            curPos = (nextLine == std::string::npos) ? std::string::npos : (nextLine + 1);
-        }
-        hlslStream &lt;&lt; &quot;\n\n&quot;;
-        hlslStream &lt;&lt; outputHLSL;
-        mHlsl = hlslStream.str();
-#else
-        mHlsl = outputHLSL;
-#endif
-
-        delete[] outputHLSL;
-
-        void *activeUniforms;
-        ShGetInfoPointer(compiler, SH_ACTIVE_UNIFORMS_ARRAY, &amp;activeUniforms);
-        mActiveUniforms = *(std::vector&lt;Uniform&gt;*)activeUniforms;
-
-        void *activeInterfaceBlocks;
-        ShGetInfoPointer(compiler, SH_ACTIVE_INTERFACE_BLOCKS_ARRAY, &amp;activeInterfaceBlocks);
-        mActiveInterfaceBlocks = *(std::vector&lt;InterfaceBlock&gt;*)activeInterfaceBlocks;
-    }
-    else
-    {
-        size_t infoLogLen = 0;
-        ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &amp;infoLogLen);
-
-        char* infoLog = new char[infoLogLen];
-        ShGetInfoLog(compiler, infoLog);
-        mInfoLog = infoLog;
-
-        TRACE(&quot;\n%s&quot;, mInfoLog.c_str());
-    }
-}
-
-rx::D3DWorkaroundType Shader::getD3DWorkarounds() const
-{
-    if (mUsesDiscardRewriting)
-    {
-        // ANGLE issue 486:
-        // Work-around a D3D9 compiler bug that presents itself when using conditional discard, by disabling optimization
-        return rx::ANGLE_D3D_WORKAROUND_SKIP_OPTIMIZATION;
-    }
-
-    if (mUsesNestedBreak)
-    {
-        // ANGLE issue 603:
-        // Work-around a D3D9 compiler bug that presents itself when using break in a nested loop, by maximizing optimization
-        // We want to keep the use of ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION minimal to prevent hangs, so usesDiscard takes precedence
-        return rx::ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION;
-    }
-
-    return rx::ANGLE_D3D_WORKAROUND_NONE;
-}
-
-// [OpenGL ES SL 3.00.4] Section 11 p. 120
-// Vertex Outs/Fragment Ins packing priorities
-static const GLenum varyingPriorityList[] =
-{
-    // 1. Arrays of mat4 and mat4
-    GL_FLOAT_MAT4,
-
-    // Non-square matrices of type matCxR consume the same space as a square
-    // matrix of type matN where N is the greater of C and R
-    GL_FLOAT_MAT3x4,
-    GL_FLOAT_MAT4x3,
-    GL_FLOAT_MAT2x4,
-    GL_FLOAT_MAT4x2,
-
-    // 2. Arrays of mat2 and mat2 (since they occupy full rows)
-    GL_FLOAT_MAT2,
-
-    // 3. Arrays of vec4 and vec4
-    GL_FLOAT_VEC4,
-    GL_INT_VEC4,
-    GL_UNSIGNED_INT_VEC4,
-
-    // 4. Arrays of mat3 and mat3
-    GL_FLOAT_MAT3,
-    GL_FLOAT_MAT2x3,
-    GL_FLOAT_MAT3x2,
-
-    // 5. Arrays of vec3 and vec3
-    GL_FLOAT_VEC3,
-    GL_INT_VEC3,
-    GL_UNSIGNED_INT_VEC3,
-
-    // 6. Arrays of vec2 and vec2
-    GL_FLOAT_VEC2,
-    GL_INT_VEC2,
-    GL_UNSIGNED_INT_VEC2,
-
-    // 7. Arrays of float and float
-    GL_FLOAT,
-    GL_INT,
-    GL_UNSIGNED_INT,
-};
-
-// true if varying x has a higher priority in packing than y
-bool Shader::compareVarying(const ShaderVariable &amp;x, const ShaderVariable &amp;y)
-{
-    if (x.type == y.type)
-    {
-        return x.arraySize &gt; y.arraySize;
-    }
-
-    // Special case for handling structs: we sort these to the end of the list
-    if (x.type == GL_STRUCT_ANGLEX)
-    {
-        return false;
-    }
-
-    unsigned int xPriority = GL_INVALID_INDEX;
-    unsigned int yPriority = GL_INVALID_INDEX;
-
-    for (unsigned int priorityIndex = 0; priorityIndex &lt; ArraySize(varyingPriorityList); priorityIndex++)
-    {
-        if (varyingPriorityList[priorityIndex] == x.type) xPriority = priorityIndex;
-        if (varyingPriorityList[priorityIndex] == y.type) yPriority = priorityIndex;
-        if (xPriority != GL_INVALID_INDEX &amp;&amp; yPriority != GL_INVALID_INDEX) break;
-    }
-
-    ASSERT(xPriority != GL_INVALID_INDEX &amp;&amp; yPriority != GL_INVALID_INDEX);
-
-    return xPriority &lt;= yPriority;
-}
-
-int Shader::getShaderVersion() const
-{
-    return mShaderVersion;
-}
-
-VertexShader::VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
-    : Shader(manager, renderer, handle)
-{
-}
-
-VertexShader::~VertexShader()
-{
-}
-
-GLenum VertexShader::getType()
-{
-    return GL_VERTEX_SHADER;
-}
-
-void VertexShader::uncompile()
-{
-    Shader::uncompile();
-
-    // set by ParseAttributes
-    mActiveAttributes.clear();
-}
-
-void VertexShader::compile()
-{
-    uncompile();
-
-    compileToHLSL(mVertexCompiler);
-    parseAttributes();
-    parseVaryings(mVertexCompiler);
-}
-
-int VertexShader::getSemanticIndex(const std::string &amp;attributeName)
-{
-    if (!attributeName.empty())
-    {
-        int semanticIndex = 0;
-        for (unsigned int attributeIndex = 0; attributeIndex &lt; mActiveAttributes.size(); attributeIndex++)
-        {
-            const ShaderVariable &amp;attribute = mActiveAttributes[attributeIndex];
-
-            if (attribute.name == attributeName)
-            {
-                return semanticIndex;
-            }
-
-            semanticIndex += AttributeRegisterCount(attribute.type);
-        }
-    }
-
-    return -1;
-}
-
-void VertexShader::parseAttributes()
-{
-    const std::string &amp;hlsl = getHLSL();
-    if (!hlsl.empty())
-    {
-        void *activeAttributes;
-        ShGetInfoPointer(mVertexCompiler, SH_ACTIVE_ATTRIBUTES_ARRAY, &amp;activeAttributes);
-        mActiveAttributes = *(std::vector&lt;Attribute&gt;*)activeAttributes;
-    }
-}
-
-FragmentShader::FragmentShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle)
-    : Shader(manager, renderer, handle)
-{
-}
-
-FragmentShader::~FragmentShader()
-{
-}
-
-GLenum FragmentShader::getType()
-{
-    return GL_FRAGMENT_SHADER;
-}
-
-void FragmentShader::compile()
-{
-    uncompile();
-
-    compileToHLSL(mFragmentCompiler);
-    parseVaryings(mFragmentCompiler);
-    std::sort(mVaryings.begin(), mVaryings.end(), compareVarying);
-
-    const std::string &amp;hlsl = getHLSL();
-    if (!hlsl.empty())
-    {
-        void *activeOutputVariables;
-        ShGetInfoPointer(mFragmentCompiler, SH_ACTIVE_OUTPUT_VARIABLES_ARRAY, &amp;activeOutputVariables);
-        mActiveOutputVariables = *(std::vector&lt;Attribute&gt;*)activeOutputVariables;
-    }
-}
-
-void FragmentShader::uncompile()
-{
-    Shader::uncompile();
-
-    mActiveOutputVariables.clear();
-}
-
-const std::vector&lt;Attribute&gt; &amp;FragmentShader::getOutputVariables() const
-{
-    return mActiveOutputVariables;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Shaderh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Shader.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,168 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-#include &lt;string&gt;
-#include &lt;list&gt;
-#include &lt;vector&gt;
-
-#include &quot;common/shadervars.h&quot;
-#include &quot;common/angleutils.h&quot;
-#include &quot;libGLESv2/angletypes.h&quot;
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace gl
-{
-class ResourceManager;
-
-class Shader
-{
-    friend class DynamicHLSL;
-
-  public:
-    Shader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle);
-
-    virtual ~Shader();
-
-    virtual GLenum getType() = 0;
-    GLuint getHandle() const;
-
-    void deleteSource();
-    void setSource(GLsizei count, const char *const *string, const GLint *length);
-    int getInfoLogLength() const;
-    void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const;
-    int getSourceLength() const;
-    void getSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
-    int getTranslatedSourceLength() const;
-    void getTranslatedSource(GLsizei bufSize, GLsizei *length, char *buffer) const;
-    const std::vector&lt;Uniform&gt; &amp;getUniforms() const;
-    const std::vector&lt;InterfaceBlock&gt; &amp;getInterfaceBlocks() const;
-    std::vector&lt;Varying&gt; &amp;getVaryings();
-
-    virtual void compile() = 0;
-    virtual void uncompile();
-    bool isCompiled() const;
-    const std::string &amp;getHLSL() const;
-
-    void addRef();
-    void release();
-    unsigned int getRefCount() const;
-    bool isFlaggedForDeletion() const;
-    void flagForDeletion();
-    int getShaderVersion() const;
-    void resetVaryingsRegisterAssignment();
-
-    static void releaseCompiler();
-
-    bool usesDepthRange() const { return mUsesDepthRange; }
-    bool usesPointSize() const { return mUsesPointSize; }
-    rx::D3DWorkaroundType getD3DWorkarounds() const;
-
-  protected:
-    void parseVaryings(void *compiler);
-
-    void compileToHLSL(void *compiler);
-
-    void getSourceImpl(const std::string &amp;source, GLsizei bufSize, GLsizei *length, char *buffer) const;
-
-    static bool compareVarying(const ShaderVariable &amp;x, const ShaderVariable &amp;y);
-
-    const rx::Renderer *const mRenderer;
-
-    std::vector&lt;Varying&gt; mVaryings;
-
-    bool mUsesMultipleRenderTargets;
-    bool mUsesFragColor;
-    bool mUsesFragData;
-    bool mUsesFragCoord;
-    bool mUsesFrontFacing;
-    bool mUsesPointSize;
-    bool mUsesPointCoord;
-    bool mUsesDepthRange;
-    bool mUsesFragDepth;
-    int mShaderVersion;
-    bool mUsesDiscardRewriting;
-    bool mUsesNestedBreak;
-
-    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
-
-    std::string mSource;
-    std::string mHlsl;
-    std::string mInfoLog;
-    std::vector&lt;Uniform&gt; mActiveUniforms;
-    std::vector&lt;InterfaceBlock&gt; mActiveInterfaceBlocks;
-
-    ResourceManager *mResourceManager;
-};
-
-class VertexShader : public Shader
-{
-    friend class DynamicHLSL;
-
-  public:
-    VertexShader(ResourceManager *manager, const rx::Renderer *renderer, GLuint handle);
-
-    ~VertexShader();
-
-    virtual GLenum getType();
-    virtual void compile();
-    virtual void uncompile();
-    int getSemanticIndex(const std::string &amp;attributeName);
-
-    const std::vector&lt;Attribute&gt; &amp;activeAttributes() const { return mActiveAttributes; }
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(VertexShader);
-
-    void parseAttributes();
-
-    std::vector&lt;Attribute&gt; mActiveAttributes;
-};
-
-class FragmentShader : public Shader
-{
-  public:
-    FragmentShader(ResourceManager *manager,const rx::Renderer *renderer, GLuint handle);
-
-    ~FragmentShader();
-
-    virtual GLenum getType();
-    virtual void compile();
-    virtual void uncompile();
-    const std::vector&lt;Attribute&gt; &amp;getOutputVariables() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(FragmentShader);
-
-    std::vector&lt;Attribute&gt; mActiveOutputVariables;
-};
-}
-
-#endif   // LIBGLESV2_SHADER_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Texturecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,2837 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &quot;libGLESv2/Texture.h&quot;
-
-#include &quot;libGLESv2/main.h&quot;
-#include &quot;common/mathutil.h&quot;
-#include &quot;common/utilities.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/renderer/Image.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/renderer/TextureStorage.h&quot;
-#include &quot;libEGL/Surface.h&quot;
-#include &quot;libGLESv2/Buffer.h&quot;
-#include &quot;libGLESv2/renderer/BufferStorage.h&quot;
-#include &quot;libGLESv2/renderer/RenderTarget.h&quot;
-
-namespace gl
-{
-
-bool IsMipmapFiltered(const SamplerState &amp;samplerState)
-{
-    switch (samplerState.minFilter)
-    {
-      case GL_NEAREST:
-      case GL_LINEAR:
-        return false;
-      case GL_NEAREST_MIPMAP_NEAREST:
-      case GL_LINEAR_MIPMAP_NEAREST:
-      case GL_NEAREST_MIPMAP_LINEAR:
-      case GL_LINEAR_MIPMAP_LINEAR:
-        return true;
-      default: UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsRenderTargetUsage(GLenum usage)
-{
-    return (usage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
-}
-
-Texture::Texture(rx::Renderer *renderer, GLuint id, GLenum target) : RefCountObject(id)
-{
-    mRenderer = renderer;
-
-    mSamplerState.minFilter = GL_NEAREST_MIPMAP_LINEAR;
-    mSamplerState.magFilter = GL_LINEAR;
-    mSamplerState.wrapS = GL_REPEAT;
-    mSamplerState.wrapT = GL_REPEAT;
-    mSamplerState.wrapR = GL_REPEAT;
-    mSamplerState.maxAnisotropy = 1.0f;
-    mSamplerState.baseLevel = 0;
-    mSamplerState.maxLevel = 1000;
-    mSamplerState.minLod = -1000.0f;
-    mSamplerState.maxLod = 1000.0f;
-    mSamplerState.compareMode = GL_NONE;
-    mSamplerState.compareFunc = GL_LEQUAL;
-    mSamplerState.swizzleRed = GL_RED;
-    mSamplerState.swizzleGreen = GL_GREEN;
-    mSamplerState.swizzleBlue = GL_BLUE;
-    mSamplerState.swizzleAlpha = GL_ALPHA;
-    mUsage = GL_NONE;
-
-    mDirtyImages = true;
-
-    mImmutable = false;
-
-    mTarget = target;
-}
-
-Texture::~Texture()
-{
-}
-
-GLenum Texture::getTarget() const
-{
-    return mTarget;
-}
-
-void Texture::addProxyRef(const Renderbuffer *proxy)
-{
-    mRenderbufferProxies.addRef(proxy);
-}
-
-void Texture::releaseProxy(const Renderbuffer *proxy)
-{
-    mRenderbufferProxies.release(proxy);
-}
-
-void Texture::setMinFilter(GLenum filter)
-{
-    mSamplerState.minFilter = filter;
-}
-
-void Texture::setMagFilter(GLenum filter)
-{
-    mSamplerState.magFilter = filter;
-}
-
-void Texture::setWrapS(GLenum wrap)
-{
-    mSamplerState.wrapS = wrap;
-}
-
-void Texture::setWrapT(GLenum wrap)
-{
-    mSamplerState.wrapT = wrap;
-}
-
-void Texture::setWrapR(GLenum wrap)
-{
-    mSamplerState.wrapR = wrap;
-}
-
-void Texture::setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy)
-{
-    mSamplerState.maxAnisotropy = std::min(textureMaxAnisotropy, contextMaxAnisotropy);
-}
-
-void Texture::setCompareMode(GLenum mode)
-{
-    mSamplerState.compareMode = mode;
-}
-
-void Texture::setCompareFunc(GLenum func)
-{
-    mSamplerState.compareFunc = func;
-}
-
-void Texture::setSwizzleRed(GLenum swizzle)
-{
-    mSamplerState.swizzleRed = swizzle;
-}
-
-void Texture::setSwizzleGreen(GLenum swizzle)
-{
-    mSamplerState.swizzleGreen = swizzle;
-}
-
-void Texture::setSwizzleBlue(GLenum swizzle)
-{
-    mSamplerState.swizzleBlue = swizzle;
-}
-
-void Texture::setSwizzleAlpha(GLenum swizzle)
-{
-    mSamplerState.swizzleAlpha = swizzle;
-}
-
-void Texture::setBaseLevel(GLint baseLevel)
-{
-    mSamplerState.baseLevel = baseLevel;
-}
-
-void Texture::setMaxLevel(GLint maxLevel)
-{
-    mSamplerState.maxLevel = maxLevel;
-}
-
-void Texture::setMinLod(GLfloat minLod)
-{
-    mSamplerState.minLod = minLod;
-}
-
-void Texture::setMaxLod(GLfloat maxLod)
-{
-    mSamplerState.maxLod = maxLod;
-}
-
-void Texture::setUsage(GLenum usage)
-{
-    mUsage = usage;
-}
-
-GLenum Texture::getMinFilter() const
-{
-    return mSamplerState.minFilter;
-}
-
-GLenum Texture::getMagFilter() const
-{
-    return mSamplerState.magFilter;
-}
-
-GLenum Texture::getWrapS() const
-{
-    return mSamplerState.wrapS;
-}
-
-GLenum Texture::getWrapT() const
-{
-    return mSamplerState.wrapT;
-}
-
-GLenum Texture::getWrapR() const
-{
-    return mSamplerState.wrapR;
-}
-
-float Texture::getMaxAnisotropy() const
-{
-    return mSamplerState.maxAnisotropy;
-}
-
-GLenum Texture::getSwizzleRed() const
-{
-    return mSamplerState.swizzleRed;
-}
-
-GLenum Texture::getSwizzleGreen() const
-{
-    return mSamplerState.swizzleGreen;
-}
-
-GLenum Texture::getSwizzleBlue() const
-{
-    return mSamplerState.swizzleBlue;
-}
-
-GLenum Texture::getSwizzleAlpha() const
-{
-    return mSamplerState.swizzleAlpha;
-}
-
-GLint Texture::getBaseLevel() const
-{
-    return mSamplerState.baseLevel;
-}
-
-GLint Texture::getMaxLevel() const
-{
-    return mSamplerState.maxLevel;
-}
-
-GLfloat Texture::getMinLod() const
-{
-    return mSamplerState.minLod;
-}
-
-GLfloat Texture::getMaxLod() const
-{
-    return mSamplerState.maxLod;
-}
-
-bool Texture::isSwizzled() const
-{
-    return mSamplerState.swizzleRed   != GL_RED   ||
-           mSamplerState.swizzleGreen != GL_GREEN ||
-           mSamplerState.swizzleBlue  != GL_BLUE  ||
-           mSamplerState.swizzleAlpha != GL_ALPHA;
-}
-
-void Texture::getSamplerState(SamplerState *sampler)
-{
-    *sampler = mSamplerState;
-
-    // Offset the effective base level by the texture storage's top level
-    rx::TextureStorageInterface *texture = getNativeTexture();
-    int topLevel = texture ? texture-&gt;getTopLevel() : 0;
-    sampler-&gt;baseLevel = topLevel + mSamplerState.baseLevel;
-}
-
-GLenum Texture::getUsage() const
-{
-    return mUsage;
-}
-
-GLint Texture::getBaseLevelWidth() const
-{
-    const rx::Image *baseImage = getBaseLevelImage();
-    return (baseImage ? baseImage-&gt;getWidth() : 0);
-}
-
-GLint Texture::getBaseLevelHeight() const
-{
-    const rx::Image *baseImage = getBaseLevelImage();
-    return (baseImage ? baseImage-&gt;getHeight() : 0);
-}
-
-GLint Texture::getBaseLevelDepth() const
-{
-    const rx::Image *baseImage = getBaseLevelImage();
-    return (baseImage ? baseImage-&gt;getDepth() : 0);
-}
-
-// Note: &quot;base level image&quot; is loosely defined to be any image from the base level,
-// where in the base of 2D array textures and cube maps there are several. Don't use
-// the base level image for anything except querying texture format and size.
-GLenum Texture::getBaseLevelInternalFormat() const
-{
-    const rx::Image *baseImage = getBaseLevelImage();
-    return (baseImage ? baseImage-&gt;getInternalFormat() : GL_NONE);
-}
-
-void Texture::setImage(const PixelUnpackState &amp;unpack, GLenum type, const void *pixels, rx::Image *image)
-{
-    // No-op
-    if (image-&gt;getWidth() == 0 || image-&gt;getHeight() == 0 || image-&gt;getDepth() == 0)
-    {
-        return;
-    }
-
-    // We no longer need the &quot;GLenum format&quot; parameter to TexImage to determine what data format &quot;pixels&quot; contains.
-    // From our image internal format we know how many channels to expect, and &quot;type&quot; gives the format of pixel's components.
-    const void *pixelData = pixels;
-
-    if (unpack.pixelBuffer.id() != 0)
-    {
-        // Do a CPU readback here, if we have an unpack buffer bound and the fast GPU path is not supported
-        Buffer *pixelBuffer = unpack.pixelBuffer.get();
-        ptrdiff_t offset = reinterpret_cast&lt;ptrdiff_t&gt;(pixels);
-        const void *bufferData = pixelBuffer-&gt;getStorage()-&gt;getData();
-        pixelData = static_cast&lt;const unsigned char *&gt;(bufferData) + offset;
-    }
-
-    if (pixelData != NULL)
-    {
-        image-&gt;loadData(0, 0, 0, image-&gt;getWidth(), image-&gt;getHeight(), image-&gt;getDepth(), unpack.alignment, type, pixelData);
-        mDirtyImages = true;
-    }
-}
-
-bool Texture::isFastUnpackable(const PixelUnpackState &amp;unpack, GLenum sizedInternalFormat)
-{
-    return unpack.pixelBuffer.id() != 0 &amp;&amp; mRenderer-&gt;supportsFastCopyBufferToTexture(sizedInternalFormat);
-}
-
-bool Texture::fastUnpackPixels(const PixelUnpackState &amp;unpack, const void *pixels, const Box &amp;destArea,
-                               GLenum sizedInternalFormat, GLenum type, rx::RenderTarget *destRenderTarget)
-{
-    if (destArea.width &lt;= 0 &amp;&amp; destArea.height &lt;= 0 &amp;&amp; destArea.depth &lt;= 0)
-    {
-        return true;
-    }
-
-    // In order to perform the fast copy through the shader, we must have the right format, and be able
-    // to create a render target.
-    ASSERT(mRenderer-&gt;supportsFastCopyBufferToTexture(sizedInternalFormat));
-
-    unsigned int offset = reinterpret_cast&lt;unsigned int&gt;(pixels);
-
-    return mRenderer-&gt;fastCopyBufferToTexture(unpack, offset, destRenderTarget, sizedInternalFormat, type, destArea);
-}
-
-void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image)
-{
-    if (pixels != NULL)
-    {
-        image-&gt;loadCompressedData(0, 0, 0, image-&gt;getWidth(), image-&gt;getHeight(), image-&gt;getDepth(), pixels);
-        mDirtyImages = true;
-    }
-}
-
-bool Texture::subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
-                       GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels, rx::Image *image)
-{
-    const void *pixelData = pixels;
-
-    // CPU readback &amp; copy where direct GPU copy is not supported
-    if (unpack.pixelBuffer.id() != 0)
-    {
-        Buffer *pixelBuffer = unpack.pixelBuffer.get();
-        unsigned int offset = reinterpret_cast&lt;unsigned int&gt;(pixels);
-        const void *bufferData = pixelBuffer-&gt;getStorage()-&gt;getData();
-        pixelData = static_cast&lt;const unsigned char *&gt;(bufferData) + offset;
-    }
-
-    if (pixelData != NULL)
-    {
-        image-&gt;loadData(xoffset, yoffset, zoffset, width, height, depth, unpack.alignment, type, pixelData);
-        mDirtyImages = true;
-    }
-
-    return true;
-}
-
-bool Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
-                                 GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image)
-{
-    if (pixels != NULL)
-    {
-        image-&gt;loadCompressedData(xoffset, yoffset, zoffset, width, height, depth, pixels);
-        mDirtyImages = true;
-    }
-
-    return true;
-}
-
-rx::TextureStorageInterface *Texture::getNativeTexture()
-{
-    // ensure the underlying texture is created
-    initializeStorage(false);
-
-    rx::TextureStorageInterface *storage = getBaseLevelStorage();
-    if (storage)
-    {
-        updateStorage();
-    }
-
-    return storage;
-}
-
-bool Texture::hasDirtyImages() const
-{
-    return mDirtyImages;
-}
-
-void Texture::resetDirty()
-{
-    mDirtyImages = false;
-}
-
-unsigned int Texture::getTextureSerial()
-{
-    rx::TextureStorageInterface *texture = getNativeTexture();
-    return texture ? texture-&gt;getTextureSerial() : 0;
-}
-
-bool Texture::isImmutable() const
-{
-    return mImmutable;
-}
-
-int Texture::immutableLevelCount()
-{
-    return (mImmutable ? getNativeTexture()-&gt;getStorageInstance()-&gt;getLevelCount() : 0);
-}
-
-GLint Texture::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
-{
-    if ((isPow2(width) &amp;&amp; isPow2(height) &amp;&amp; isPow2(depth)) || mRenderer-&gt;getNonPower2TextureSupport())
-    {
-        // Maximum number of levels
-        return log2(std::max(std::max(width, height), depth)) + 1;
-    }
-    else
-    {
-        // OpenGL ES 2.0 without GL_OES_texture_npot does not permit NPOT mipmaps.
-        return 1;
-    }
-}
-
-int Texture::mipLevels() const
-{
-    return log2(std::max(std::max(getBaseLevelWidth(), getBaseLevelHeight()), getBaseLevelDepth())) + 1;
-}
-
-Texture2D::Texture2D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_2D)
-{
-    mTexStorage = NULL;
-    mSurface = NULL;
-
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
-    {
-        mImageArray[i] = renderer-&gt;createImage();
-    }
-}
-
-Texture2D::~Texture2D()
-{
-    delete mTexStorage;
-    mTexStorage = NULL;
-    
-    if (mSurface)
-    {
-        mSurface-&gt;setBoundTexture(NULL);
-        mSurface = NULL;
-    }
-
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
-    {
-        delete mImageArray[i];
-    }
-}
-
-GLsizei Texture2D::getWidth(GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[level]-&gt;getWidth();
-    else
-        return 0;
-}
-
-GLsizei Texture2D::getHeight(GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[level]-&gt;getHeight();
-    else
-        return 0;
-}
-
-GLenum Texture2D::getInternalFormat(GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[level]-&gt;getInternalFormat();
-    else
-        return GL_NONE;
-}
-
-GLenum Texture2D::getActualFormat(GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[level]-&gt;getActualFormat();
-    else
-        return GL_NONE;
-}
-
-void Texture2D::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height)
-{
-    releaseTexImage();
-
-    // If there currently is a corresponding storage texture image, it has these parameters
-    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
-    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
-    const GLenum storageFormat = getBaseLevelInternalFormat();
-
-    mImageArray[level]-&gt;redefine(mRenderer, GL_TEXTURE_2D, internalformat, width, height, 1, false);
-
-    if (mTexStorage)
-    {
-        const int storageLevels = mTexStorage-&gt;getLevelCount();
-
-        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
-            width != storageWidth ||
-            height != storageHeight ||
-            internalformat != storageFormat)   // Discard mismatched storage
-        {
-            for (int i = 0; i &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
-            {
-                mImageArray[i]-&gt;markDirty();
-            }
-
-            delete mTexStorage;
-            mTexStorage = NULL;
-            mDirtyImages = true;
-        }
-    }
-}
-
-void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
-    redefineImage(level, sizedInternalFormat, width, height);
-
-    bool fastUnpacked = false;
-
-    // Attempt a fast gpu copy of the pixel data to the surface
-    if (isFastUnpackable(unpack, sizedInternalFormat) &amp;&amp; isLevelComplete(level))
-    {
-        // Will try to create RT storage if it does not exist
-        rx::RenderTarget *destRenderTarget = getRenderTarget(level);
-        Box destArea(0, 0, 0, getWidth(level), getHeight(level), 1);
-
-        if (destRenderTarget &amp;&amp; fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget))
-        {
-            // Ensure we don't overwrite our newly initialized data
-            mImageArray[level]-&gt;markClean();
-
-            fastUnpacked = true;
-        }
-    }
-
-    if (!fastUnpacked)
-    {
-        Texture::setImage(unpack, type, pixels, mImageArray[level]);
-    }
-}
-
-void Texture2D::bindTexImage(egl::Surface *surface)
-{
-    releaseTexImage();
-
-    GLenum internalformat = surface-&gt;getFormat();
-
-    mImageArray[0]-&gt;redefine(mRenderer, GL_TEXTURE_2D, internalformat, surface-&gt;getWidth(), surface-&gt;getHeight(), 1, true);
-
-    delete mTexStorage;
-    mTexStorage = new rx::TextureStorageInterface2D(mRenderer, surface-&gt;getSwapChain());
-
-    mDirtyImages = true;
-    mSurface = surface;
-    mSurface-&gt;setBoundTexture(this);
-}
-
-void Texture2D::releaseTexImage()
-{
-    if (mSurface)
-    {
-        mSurface-&gt;setBoundTexture(NULL);
-        mSurface = NULL;
-
-        if (mTexStorage)
-        {
-            delete mTexStorage;
-            mTexStorage = NULL;
-        }
-
-        for (int i = 0; i &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
-        {
-            mImageArray[i]-&gt;redefine(mRenderer, GL_TEXTURE_2D, GL_NONE, 0, 0, 0, true);
-        }
-    }
-}
-
-void Texture2D::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
-{
-    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
-    redefineImage(level, format, width, height);
-
-    Texture::setCompressedImage(imageSize, pixels, mImageArray[level]);
-}
-
-void Texture2D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
-{
-    if (isValidLevel(level))
-    {
-        rx::Image *image = mImageArray[level];
-        if (image-&gt;copyToStorage(mTexStorage, level, xoffset, yoffset, width, height))
-        {
-            image-&gt;markClean();
-        }
-    }
-}
-
-void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    bool fastUnpacked = false;
-
-    if (isFastUnpackable(unpack, getInternalFormat(level)) &amp;&amp; isLevelComplete(level))
-    {
-        rx::RenderTarget *renderTarget = getRenderTarget(level);
-        Box destArea(xoffset, yoffset, 0, width, height, 1);
-
-        if (renderTarget &amp;&amp; fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, renderTarget))
-        {
-            // Ensure we don't overwrite our newly initialized data
-            mImageArray[level]-&gt;markClean();
-
-            fastUnpacked = true;
-        }
-    }
-
-    if (!fastUnpacked &amp;&amp; Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, 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, 0, width, height, 1, 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)
-{
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
-                                                                              : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
-    redefineImage(level, sizedInternalFormat, width, height);
-
-    if (!mImageArray[level]-&gt;isRenderableFormat())
-    {
-        mImageArray[level]-&gt;copy(0, 0, 0, x, y, width, height, source);
-        mDirtyImages = true;
-    }
-    else
-    {
-        ensureRenderTarget();
-        mImageArray[level]-&gt;markClean();
-
-        if (width != 0 &amp;&amp; height != 0 &amp;&amp; isValidLevel(level))
-        {
-            gl::Rectangle sourceRect;
-            sourceRect.x = x;
-            sourceRect.width = width;
-            sourceRect.y = y;
-            sourceRect.height = height;
-
-            mRenderer-&gt;copyImage(source, sourceRect, format, 0, 0, mTexStorage, level);
-        }
-    }
-}
-
-void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    if (xoffset + width &gt; mImageArray[level]-&gt;getWidth() || yoffset + height &gt; mImageArray[level]-&gt;getHeight() || zoffset != 0)
-    {
-        return gl::error(GL_INVALID_VALUE);
-    }
-
-    // can only make our texture storage to a render target if level 0 is defined (with a width &amp; height) and
-    // the current level we're copying to is defined (with appropriate format, width &amp; height)
-    bool canCreateRenderTarget = isLevelComplete(level) &amp;&amp; isLevelComplete(0);
-
-    if (!mImageArray[level]-&gt;isRenderableFormat() || (!mTexStorage &amp;&amp; !canCreateRenderTarget))
-    {
-        mImageArray[level]-&gt;copy(xoffset, yoffset, 0, x, y, width, height, source);
-        mDirtyImages = true;
-    }
-    else
-    {
-        ensureRenderTarget();
-        
-        if (isValidLevel(level))
-        {
-            updateStorageLevel(level);
-
-            GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-
-            gl::Rectangle sourceRect;
-            sourceRect.x = x;
-            sourceRect.width = width;
-            sourceRect.y = y;
-            sourceRect.height = height;
-
-            mRenderer-&gt;copyImage(source, sourceRect,
-                                 gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
-                                 xoffset, yoffset, mTexStorage, level);
-        }
-    }
-}
-
-void Texture2D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
-    for (int level = 0; level &lt; levels; level++)
-    {
-        GLsizei levelWidth = std::max(1, width &gt;&gt; level);
-        GLsizei levelHeight = std::max(1, height &gt;&gt; level);
-        mImageArray[level]-&gt;redefine(mRenderer, GL_TEXTURE_2D, internalformat, levelWidth, levelHeight, 1, true);
-    }
-
-    for (int level = levels; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        mImageArray[level]-&gt;redefine(mRenderer, GL_TEXTURE_2D, GL_NONE, 0, 0, 0, true);
-    }
-
-    mImmutable = true;
-
-    setCompleteTexStorage(new rx::TextureStorageInterface2D(mRenderer, internalformat, IsRenderTargetUsage(mUsage), width, height, levels));
-}
-
-void Texture2D::setCompleteTexStorage(rx::TextureStorageInterface2D *newCompleteTexStorage)
-{
-    SafeDelete(mTexStorage);
-    mTexStorage = newCompleteTexStorage;
-
-    if (mTexStorage &amp;&amp; mTexStorage-&gt;isManaged())
-    {
-        for (int level = 0; level &lt; mTexStorage-&gt;getLevelCount(); level++)
-        {
-            mImageArray[level]-&gt;setManagedSurface(mTexStorage, level);
-        }
-    }
-
-    mDirtyImages = true;
-}
-
-// Tests for 2D texture sampling completeness. [OpenGL ES 2.0.24] section 3.8.2 page 85.
-bool Texture2D::isSamplerComplete(const SamplerState &amp;samplerState) const
-{
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-
-    if (width &lt;= 0 || height &lt;= 0)
-    {
-        return false;
-    }
-
-    if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
-    {
-        if (samplerState.magFilter != GL_NEAREST ||
-            (samplerState.minFilter != GL_NEAREST &amp;&amp; samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
-        {
-            return false;
-        }
-    }
-
-    bool npotSupport = mRenderer-&gt;getNonPower2TextureSupport();
-
-    if (!npotSupport)
-    {
-        if ((samplerState.wrapS != GL_CLAMP_TO_EDGE &amp;&amp; !isPow2(width)) ||
-            (samplerState.wrapT != GL_CLAMP_TO_EDGE &amp;&amp; !isPow2(height)))
-        {
-            return false;
-        }
-    }
-
-    if (IsMipmapFiltered(samplerState))
-    {
-        if (!npotSupport)
-        {
-            if (!isPow2(width) || !isPow2(height))
-            {
-                return false;
-            }
-        }
-
-        if (!isMipmapComplete())
-        {
-            return false;
-        }
-    }
-
-    // OpenGLES 3.0.2 spec section 3.8.13 states that a texture is not mipmap complete if:
-    // The internalformat specified for the texture arrays is a sized internal depth or
-    // depth and stencil format (see table 3.13), the value of TEXTURE_COMPARE_-
-    // MODE is NONE, and either the magnification filter is not NEAREST or the mini-
-    // fication filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST.
-    if (gl::GetDepthBits(getInternalFormat(0), mRenderer-&gt;getCurrentClientVersion()) &gt; 0 &amp;&amp;
-        mRenderer-&gt;getCurrentClientVersion() &gt; 2)
-    {
-        if (mSamplerState.compareMode == GL_NONE)
-        {
-            if ((mSamplerState.minFilter != GL_NEAREST &amp;&amp; mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST) ||
-                mSamplerState.magFilter != GL_NEAREST)
-            {
-                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
-{
-    int levelCount = mipLevels();
-
-    for (int level = 0; level &lt; levelCount; level++)
-    {
-        if (!isLevelComplete(level))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool Texture2D::isLevelComplete(int level) const
-{
-    if (isImmutable())
-    {
-        return true;
-    }
-
-    const rx::Image *baseImage = getBaseLevelImage();
-
-    GLsizei width = baseImage-&gt;getWidth();
-    GLsizei height = baseImage-&gt;getHeight();
-
-    if (width &lt;= 0 || height &lt;= 0)
-    {
-        return false;
-    }
-
-    // The base image level is complete if the width and height are positive
-    if (level == 0)
-    {
-        return true;
-    }
-
-    ASSERT(level &gt;= 1 &amp;&amp; level &lt;= (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
-    rx::Image *image = mImageArray[level];
-
-    if (image-&gt;getInternalFormat() != baseImage-&gt;getInternalFormat())
-    {
-        return false;
-    }
-
-    if (image-&gt;getWidth() != std::max(1, width &gt;&gt; level))
-    {
-        return false;
-    }
-
-    if (image-&gt;getHeight() != std::max(1, height &gt;&gt; level))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool Texture2D::isCompressed(GLint level) const
-{
-    return IsFormatCompressed(getInternalFormat(level), mRenderer-&gt;getCurrentClientVersion());
-}
-
-bool Texture2D::isDepth(GLint level) const
-{
-    return GetDepthBits(getInternalFormat(level), mRenderer-&gt;getCurrentClientVersion()) &gt; 0;
-}
-
-// Constructs a native texture resource from the texture images
-void Texture2D::initializeStorage(bool renderTarget)
-{
-    // Only initialize the first time this texture is used as a render target or shader resource
-    if (mTexStorage)
-    {
-        return;
-    }
-
-    // do not attempt to create storage for nonexistant data
-    if (!isLevelComplete(0))
-    {
-        return;
-    }
-
-    bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
-
-    setCompleteTexStorage(createCompleteStorage(createRenderTarget));
-    ASSERT(mTexStorage);
-
-    // flush image data to the storage
-    updateStorage();
-}
-
-rx::TextureStorageInterface2D *Texture2D::createCompleteStorage(bool renderTarget) const
-{
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-
-    ASSERT(width &gt; 0 &amp;&amp; height &gt; 0);
-
-    // use existing storage level count, when previously specified by TexStorage*D
-    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(width, height, 1));
-
-    return new rx::TextureStorageInterface2D(mRenderer, getBaseLevelInternalFormat(), renderTarget, width, height, levels);
-}
-
-void Texture2D::updateStorage()
-{
-    for (int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        if (mImageArray[level]-&gt;isDirty() &amp;&amp; isLevelComplete(level))
-        {
-            updateStorageLevel(level);
-        }
-    }
-}
-
-void Texture2D::updateStorageLevel(int level)
-{
-    ASSERT(level &lt;= (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
-    ASSERT(isLevelComplete(level));
-
-    if (mImageArray[level]-&gt;isDirty())
-    {
-        commitRect(level, 0, 0, getWidth(level), getHeight(level));
-    }
-}
-
-bool Texture2D::ensureRenderTarget()
-{
-    initializeStorage(true);
-
-    if (getBaseLevelWidth() &gt; 0 &amp;&amp; getBaseLevelHeight() &gt; 0)
-    {
-        ASSERT(mTexStorage);
-        if (!mTexStorage-&gt;isRenderTarget())
-        {
-            rx::TextureStorageInterface2D *newRenderTargetStorage = createCompleteStorage(true);
-
-            if (!mRenderer-&gt;copyToRenderTarget(newRenderTargetStorage, mTexStorage))
-            {
-                delete newRenderTargetStorage;
-                return gl::error(GL_OUT_OF_MEMORY, false);
-            }
-
-            setCompleteTexStorage(newRenderTargetStorage);
-        }
-    }
-
-    return (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget());
-}
-
-void Texture2D::generateMipmaps()
-{
-    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
-    int levelCount = mipLevels();
-    for (int level = 1; level &lt; levelCount; level++)
-    {
-        redefineImage(level, getBaseLevelInternalFormat(),
-                      std::max(getBaseLevelWidth() &gt;&gt; level, 1),
-                      std::max(getBaseLevelHeight() &gt;&gt; level, 1));
-    }
-
-    if (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget())
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            mTexStorage-&gt;generateMipmap(level);
-
-            mImageArray[level]-&gt;markClean();
-        }
-    }
-    else
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            mRenderer-&gt;generateMipmap(mImageArray[level], mImageArray[level - 1]);
-        }
-    }
-}
-
-const rx::Image *Texture2D::getBaseLevelImage() const
-{
-    return mImageArray[0];
-}
-
-rx::TextureStorageInterface *Texture2D::getBaseLevelStorage()
-{
-    return mTexStorage;
-}
-
-Renderbuffer *Texture2D::getRenderbuffer(GLint level)
-{
-    Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, 0);
-    if (!renderBuffer)
-    {
-        renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTexture2D(this, level));
-        mRenderbufferProxies.add(level, 0, renderBuffer);
-    }
-
-    return renderBuffer;
-}
-
-unsigned int Texture2D::getRenderTargetSerial(GLint level)
-{
-    return (ensureRenderTarget() ? mTexStorage-&gt;getRenderTargetSerial(level) : 0);
-}
-
-rx::RenderTarget *Texture2D::getRenderTarget(GLint level)
-{
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageLevel(level);
-
-    // ensure this is NOT a depth texture
-    if (isDepth(level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(level);
-}
-
-rx::RenderTarget *Texture2D::getDepthSencil(GLint level)
-{
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageLevel(level);
-
-    // ensure this is actually a depth texture
-    if (!isDepth(level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(level);
-}
-
-bool Texture2D::isValidLevel(int level) const
-{
-    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : false);
-}
-
-TextureCubeMap::TextureCubeMap(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_CUBE_MAP)
-{
-    mTexStorage = NULL;
-    for (int i = 0; i &lt; 6; i++)
-    {
-        for (int j = 0; j &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
-        {
-            mImageArray[i][j] = renderer-&gt;createImage();
-        }
-    }
-}
-
-TextureCubeMap::~TextureCubeMap()
-{
-    for (int i = 0; i &lt; 6; i++)
-    {
-        for (int j = 0; j &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++j)
-        {
-            delete mImageArray[i][j];
-        }
-    }
-
-    delete mTexStorage;
-    mTexStorage = NULL;
-}
-
-GLsizei TextureCubeMap::getWidth(GLenum target, GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[targetToIndex(target)][level]-&gt;getWidth();
-    else
-        return 0;
-}
-
-GLsizei TextureCubeMap::getHeight(GLenum target, GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[targetToIndex(target)][level]-&gt;getHeight();
-    else
-        return 0;
-}
-
-GLenum TextureCubeMap::getInternalFormat(GLenum target, GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[targetToIndex(target)][level]-&gt;getInternalFormat();
-    else
-        return GL_NONE;
-}
-
-GLenum TextureCubeMap::getActualFormat(GLenum target, GLint level) const
-{
-    if (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS)
-        return mImageArray[targetToIndex(target)][level]-&gt;getActualFormat();
-    else
-        return GL_NONE;
-}
-
-void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    setImage(0, level, width, height, internalFormat, format, type, unpack, pixels);
-}
-
-void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    setImage(1, level, width, height, internalFormat, format, type, unpack, pixels);
-}
-
-void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    setImage(2, level, width, height, internalFormat, format, type, unpack, pixels);
-}
-
-void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    setImage(3, level, width, height, internalFormat, format, type, unpack, pixels);
-}
-
-void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    setImage(4, level, width, height, internalFormat, format, type, unpack, pixels);
-}
-
-void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    setImage(5, level, width, height, internalFormat, format, type, unpack, pixels);
-}
-
-void TextureCubeMap::setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
-{
-    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
-    int faceIndex = targetToIndex(target);
-    redefineImage(faceIndex, level, format, width, height);
-
-    Texture::setCompressedImage(imageSize, pixels, mImageArray[faceIndex][level]);
-}
-
-void TextureCubeMap::commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height)
-{
-    if (isValidFaceLevel(faceIndex, level))
-    {
-        rx::Image *image = mImageArray[faceIndex][level];
-        if (image-&gt;copyToStorage(mTexStorage, faceIndex, level, xoffset, yoffset, width, height))
-            image-&gt;markClean();
-    }
-}
-
-void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    int faceIndex = targetToIndex(target);
-    if (Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpack, pixels, mImageArray[faceIndex][level]))
-    {
-        commitRect(faceIndex, 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)
-{
-    int faceIndex = targetToIndex(target);
-    if (Texture::subImageCompressed(xoffset, yoffset, 0, width, height, 1, format, imageSize, pixels, mImageArray[faceIndex][level]))
-    {
-        commitRect(faceIndex, 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 SamplerState &amp;samplerState) const
-{
-    int size = getBaseLevelWidth();
-
-    bool mipmapping = IsMipmapFiltered(samplerState);
-
-    if (!IsTextureFilteringSupported(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0), mRenderer))
-    {
-        if (samplerState.magFilter != GL_NEAREST ||
-            (samplerState.minFilter != GL_NEAREST &amp;&amp; samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
-        {
-            return false;
-        }
-    }
-
-    if (!isPow2(size) &amp;&amp; !mRenderer-&gt;getNonPower2TextureSupport())
-    {
-        if (samplerState.wrapS != GL_CLAMP_TO_EDGE || samplerState.wrapT != 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
-{
-    int    baseWidth  = getBaseLevelWidth();
-    int    baseHeight = getBaseLevelHeight();
-    GLenum baseFormat = getBaseLevelInternalFormat();
-
-    if (baseWidth &lt;= 0 || baseWidth != baseHeight)
-    {
-        return false;
-    }
-
-    for (int faceIndex = 1; faceIndex &lt; 6; faceIndex++)
-    {
-        const rx::Image &amp;faceBaseImage = *mImageArray[faceIndex][0];
-
-        if (faceBaseImage.getWidth()          != baseWidth  ||
-            faceBaseImage.getHeight()         != baseHeight ||
-            faceBaseImage.getInternalFormat() != baseFormat )
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool TextureCubeMap::isMipmapCubeComplete() const
-{
-    if (isImmutable())
-    {
-        return true;
-    }
-
-    if (!isCubeComplete())
-    {
-        return false;
-    }
-
-    int levelCount = mipLevels();
-
-    for (int face = 0; face &lt; 6; face++)
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            if (!isFaceLevelComplete(face, level))
-            {
-                return false;
-            }
-        }
-    }
-
-    return true;
-}
-
-bool TextureCubeMap::isFaceLevelComplete(int faceIndex, int level) const
-{
-    ASSERT(level &gt;= 0 &amp;&amp; faceIndex &lt; 6 &amp;&amp; level &lt; (int)ArraySize(mImageArray[faceIndex]) &amp;&amp; mImageArray[faceIndex][level] != NULL);
-
-    if (isImmutable())
-    {
-        return true;
-    }
-
-    int baseSize = getBaseLevelWidth();
-
-    if (baseSize &lt;= 0)
-    {
-        return false;
-    }
-
-    // &quot;isCubeComplete&quot; checks for base level completeness and we must call that
-    // to determine if any face at level 0 is complete. We omit that check here
-    // to avoid re-checking cube-completeness for every face at level 0.
-    if (level == 0)
-    {
-        return true;
-    }
-
-    // Check that non-zero levels are consistent with the base level.
-    const rx::Image *faceLevelImage = mImageArray[faceIndex][level];
-
-    if (faceLevelImage-&gt;getInternalFormat() != getBaseLevelInternalFormat())
-    {
-        return false;
-    }
-
-    if (faceLevelImage-&gt;getWidth() != std::max(1, baseSize &gt;&gt; level))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool TextureCubeMap::isCompressed(GLenum target, GLint level) const
-{
-    return IsFormatCompressed(getInternalFormat(target, level), mRenderer-&gt;getCurrentClientVersion());
-}
-
-bool TextureCubeMap::isDepth(GLenum target, GLint level) const
-{
-    return GetDepthBits(getInternalFormat(target, level), mRenderer-&gt;getCurrentClientVersion()) &gt; 0;
-}
-
-void TextureCubeMap::initializeStorage(bool renderTarget)
-{
-    // Only initialize the first time this texture is used as a render target or shader resource
-    if (mTexStorage)
-    {
-        return;
-    }
-
-    // do not attempt to create storage for nonexistant data
-    if (!isFaceLevelComplete(0, 0))
-    {
-        return;
-    }
-
-    bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mUsage));
-
-    setCompleteTexStorage(createCompleteStorage(createRenderTarget));
-    ASSERT(mTexStorage);
-
-    // flush image data to the storage
-    updateStorage();
-}
-
-rx::TextureStorageInterfaceCube *TextureCubeMap::createCompleteStorage(bool renderTarget) const
-{
-    GLsizei size = getBaseLevelWidth();
-
-    ASSERT(size &gt; 0);
-
-    // use existing storage level count, when previously specified by TexStorage*D
-    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(size, size, 1));
-
-    return new rx::TextureStorageInterfaceCube(mRenderer, getBaseLevelInternalFormat(), renderTarget, size, levels);
-}
-
-void TextureCubeMap::setCompleteTexStorage(rx::TextureStorageInterfaceCube *newCompleteTexStorage)
-{
-    SafeDelete(mTexStorage);
-    mTexStorage = newCompleteTexStorage;
-
-    if (mTexStorage &amp;&amp; mTexStorage-&gt;isManaged())
-    {
-        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
-        {
-            for (int level = 0; level &lt; mTexStorage-&gt;getLevelCount(); level++)
-            {
-                mImageArray[faceIndex][level]-&gt;setManagedSurface(mTexStorage, faceIndex, level);
-            }
-        }
-    }
-
-    mDirtyImages = true;
-}
-
-void TextureCubeMap::updateStorage()
-{
-    for (int face = 0; face &lt; 6; face++)
-    {
-        for (int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-        {
-            if (isFaceLevelComplete(face, level))
-            {
-                updateStorageFaceLevel(face, level);
-            }
-        }
-    }
-}
-
-void TextureCubeMap::updateStorageFaceLevel(int faceIndex, int level)
-{
-    ASSERT(level &gt;= 0 &amp;&amp; faceIndex &lt; 6 &amp;&amp; level &lt; (int)ArraySize(mImageArray[faceIndex]) &amp;&amp; mImageArray[faceIndex][level] != NULL);
-    rx::Image *image = mImageArray[faceIndex][level];
-
-    if (image-&gt;isDirty())
-    {
-        commitRect(faceIndex, level, 0, 0, image-&gt;getWidth(), image-&gt;getHeight());
-    }
-}
-
-bool TextureCubeMap::ensureRenderTarget()
-{
-    initializeStorage(true);
-
-    if (getBaseLevelWidth() &gt; 0)
-    {
-        ASSERT(mTexStorage);
-        if (!mTexStorage-&gt;isRenderTarget())
-        {
-            rx::TextureStorageInterfaceCube *newRenderTargetStorage = createCompleteStorage(true);
-
-            if (!mRenderer-&gt;copyToRenderTarget(newRenderTargetStorage, mTexStorage))
-            {
-                delete newRenderTargetStorage;
-                return gl::error(GL_OUT_OF_MEMORY, false);
-            }
-
-            setCompleteTexStorage(newRenderTargetStorage);
-        }
-    }
-
-    return (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget());
-}
-
-void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
-
-    redefineImage(faceIndex, level, sizedInternalFormat, width, height);
-
-    Texture::setImage(unpack, type, pixels, mImageArray[faceIndex][level]);
-}
-
-int TextureCubeMap::targetToIndex(GLenum target)
-{
-    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 target - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-}
-
-void TextureCubeMap::redefineImage(int faceIndex, GLint level, GLenum internalformat, GLsizei width, GLsizei height)
-{
-    // If there currently is a corresponding storage texture image, it has these parameters
-    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
-    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
-    const GLenum storageFormat = getBaseLevelInternalFormat();
-
-    mImageArray[faceIndex][level]-&gt;redefine(mRenderer, GL_TEXTURE_CUBE_MAP, internalformat, width, height, 1, false);
-
-    if (mTexStorage)
-    {
-        const int storageLevels = mTexStorage-&gt;getLevelCount();
-
-        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
-            width != storageWidth ||
-            height != storageHeight ||
-            internalformat != storageFormat)   // Discard mismatched storage
-        {
-            for (int level = 0; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-            {
-                for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
-                {
-                    mImageArray[faceIndex][level]-&gt;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)
-{
-    int faceIndex = targetToIndex(target);
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
-                                                                              : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
-    redefineImage(faceIndex, level, sizedInternalFormat, width, height);
-
-    if (!mImageArray[faceIndex][level]-&gt;isRenderableFormat())
-    {
-        mImageArray[faceIndex][level]-&gt;copy(0, 0, 0, x, y, width, height, source);
-        mDirtyImages = true;
-    }
-    else
-    {
-        ensureRenderTarget();
-        mImageArray[faceIndex][level]-&gt;markClean();
-
-        ASSERT(width == height);
-
-        if (width &gt; 0 &amp;&amp; isValidFaceLevel(faceIndex, level))
-        {
-            gl::Rectangle sourceRect;
-            sourceRect.x = x;
-            sourceRect.width = width;
-            sourceRect.y = y;
-            sourceRect.height = height;
-
-            mRenderer-&gt;copyImage(source, sourceRect, format, 0, 0, mTexStorage, target, level);
-        }
-    }
-}
-
-void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    int faceIndex = targetToIndex(target);
-
-    GLsizei size = mImageArray[faceIndex][level]-&gt;getWidth();
-
-    if (xoffset + width &gt; size || yoffset + height &gt; size || zoffset != 0)
-    {
-        return gl::error(GL_INVALID_VALUE);
-    }
-
-    // We can only make our texture storage to a render target if the level we're copying *to* is complete
-    // and the base level is cube-complete. The base level must be cube complete (common case) because we cannot
-    // rely on the &quot;getBaseLevel*&quot; methods reliably otherwise.
-    bool canCreateRenderTarget = isFaceLevelComplete(faceIndex, level) &amp;&amp; isCubeComplete();
-
-    if (!mImageArray[faceIndex][level]-&gt;isRenderableFormat() || (!mTexStorage &amp;&amp; !canCreateRenderTarget))
-    {
-        mImageArray[faceIndex][level]-&gt;copy(0, 0, 0, x, y, width, height, source);
-        mDirtyImages = true;
-    }
-    else
-    {
-        ensureRenderTarget();
-        
-        if (isValidFaceLevel(faceIndex, level))
-        {
-            updateStorageFaceLevel(faceIndex, level);
-
-            GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-
-            gl::Rectangle sourceRect;
-            sourceRect.x = x;
-            sourceRect.width = width;
-            sourceRect.y = y;
-            sourceRect.height = height;
-
-            mRenderer-&gt;copyImage(source, sourceRect, gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
-                                 xoffset, yoffset, mTexStorage, target, level);
-        }
-    }
-}
-
-void TextureCubeMap::storage(GLsizei levels, GLenum internalformat, GLsizei size)
-{
-    for (int level = 0; level &lt; levels; level++)
-    {
-        GLsizei mipSize = std::max(1, size &gt;&gt; level);
-        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
-        {
-            mImageArray[faceIndex][level]-&gt;redefine(mRenderer, GL_TEXTURE_CUBE_MAP, internalformat, mipSize, mipSize, 1, true);
-        }
-    }
-
-    for (int level = levels; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
-        {
-            mImageArray[faceIndex][level]-&gt;redefine(mRenderer, GL_TEXTURE_CUBE_MAP, GL_NONE, 0, 0, 0, true);
-        }
-    }
-
-    mImmutable = true;
-
-    setCompleteTexStorage(new rx::TextureStorageInterfaceCube(mRenderer, internalformat, IsRenderTargetUsage(mUsage), size, levels));
-}
-
-void TextureCubeMap::generateMipmaps()
-{
-    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
-    int levelCount = mipLevels();
-    for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            int faceLevelSize = (std::max(mImageArray[faceIndex][0]-&gt;getWidth() &gt;&gt; level, 1));
-            redefineImage(faceIndex, level, mImageArray[faceIndex][0]-&gt;getInternalFormat(), faceLevelSize, faceLevelSize);
-        }
-    }
-
-    if (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget())
-    {
-        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
-        {
-            for (int level = 1; level &lt; levelCount; level++)
-            {
-                mTexStorage-&gt;generateMipmap(faceIndex, level);
-
-                mImageArray[faceIndex][level]-&gt;markClean();
-            }
-        }
-    }
-    else
-    {
-        for (int faceIndex = 0; faceIndex &lt; 6; faceIndex++)
-        {
-            for (int level = 1; level &lt; levelCount; level++)
-            {
-                mRenderer-&gt;generateMipmap(mImageArray[faceIndex][level], mImageArray[faceIndex][level - 1]);
-            }
-        }
-    }
-}
-
-const rx::Image *TextureCubeMap::getBaseLevelImage() const
-{
-    // Note: if we are not cube-complete, there is no single base level image that can describe all
-    // cube faces, so this method is only well-defined for a cube-complete base level.
-    return mImageArray[0][0];
-}
-
-rx::TextureStorageInterface *TextureCubeMap::getBaseLevelStorage()
-{
-    return mTexStorage;
-}
-
-Renderbuffer *TextureCubeMap::getRenderbuffer(GLenum target, GLint level)
-{
-    if (!IsCubemapTextureTarget(target))
-    {
-        return gl::error(GL_INVALID_OPERATION, (Renderbuffer *)NULL);
-    }
-
-    int faceIndex = targetToIndex(target);
-
-    Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, faceIndex);
-    if (!renderBuffer)
-    {
-        renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTextureCubeMap(this, target, level));
-        mRenderbufferProxies.add(level, faceIndex, renderBuffer);
-    }
-
-    return renderBuffer;
-}
-
-unsigned int TextureCubeMap::getRenderTargetSerial(GLenum target, GLint level)
-{
-    return (ensureRenderTarget() ? mTexStorage-&gt;getRenderTargetSerial(target, level) : 0);
-}
-
-rx::RenderTarget *TextureCubeMap::getRenderTarget(GLenum target, GLint level)
-{
-    ASSERT(IsCubemapTextureTarget(target));
-
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageFaceLevel(targetToIndex(target), level);
-
-    // ensure this is NOT a depth texture
-    if (isDepth(target, level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(target, level);
-}
-
-rx::RenderTarget *TextureCubeMap::getDepthStencil(GLenum target, GLint level)
-{
-    ASSERT(IsCubemapTextureTarget(target));
-
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageFaceLevel(targetToIndex(target), level);
-
-    // ensure this is a depth texture
-    if (!isDepth(target, level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(target, level);
-}
-
-bool TextureCubeMap::isValidFaceLevel(int faceIndex, int level) const
-{
-    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : 0);
-}
-
-Texture3D::Texture3D(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_3D)
-{
-    mTexStorage = NULL;
-
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
-    {
-        mImageArray[i] = renderer-&gt;createImage();
-    }
-}
-
-Texture3D::~Texture3D()
-{
-    delete mTexStorage;
-    mTexStorage = NULL;
-
-    for (int i = 0; i &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++i)
-    {
-        delete mImageArray[i];
-    }
-}
-
-GLsizei Texture3D::getWidth(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]-&gt;getWidth() : 0;
-}
-
-GLsizei Texture3D::getHeight(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]-&gt;getHeight() : 0;
-}
-
-GLsizei Texture3D::getDepth(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]-&gt;getDepth() : 0;
-}
-
-GLenum Texture3D::getInternalFormat(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]-&gt;getInternalFormat() : GL_NONE;
-}
-
-GLenum Texture3D::getActualFormat(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? mImageArray[level]-&gt;getActualFormat() : GL_NONE;
-}
-
-bool Texture3D::isCompressed(GLint level) const
-{
-    return IsFormatCompressed(getInternalFormat(level), mRenderer-&gt;getCurrentClientVersion());
-}
-
-bool Texture3D::isDepth(GLint level) const
-{
-    return GetDepthBits(getInternalFormat(level), mRenderer-&gt;getCurrentClientVersion()) &gt; 0;
-}
-
-void Texture3D::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
-    redefineImage(level, sizedInternalFormat, width, height, depth);
-
-    bool fastUnpacked = false;
-
-    // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
-    if (isFastUnpackable(unpack, sizedInternalFormat))
-    {
-        // Will try to create RT storage if it does not exist
-        rx::RenderTarget *destRenderTarget = getRenderTarget(level);
-        Box destArea(0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
-
-        if (destRenderTarget &amp;&amp; fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget))
-        {
-            // Ensure we don't overwrite our newly initialized data
-            mImageArray[level]-&gt;markClean();
-
-            fastUnpacked = true;
-        }
-    }
-
-    if (!fastUnpacked)
-    {
-        Texture::setImage(unpack, type, pixels, mImageArray[level]);
-    }
-}
-
-void Texture3D::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
-{
-    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
-    redefineImage(level, format, width, height, depth);
-
-    Texture::setCompressedImage(imageSize, pixels, mImageArray[level]);
-}
-
-void Texture3D::subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    bool fastUnpacked = false;
-
-    // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer
-    if (isFastUnpackable(unpack, getInternalFormat(level)))
-    {
-        rx::RenderTarget *destRenderTarget = getRenderTarget(level);
-        Box destArea(xoffset, yoffset, zoffset, width, height, depth);
-
-        if (destRenderTarget &amp;&amp; fastUnpackPixels(unpack, pixels, destArea, getInternalFormat(level), type, destRenderTarget))
-        {
-            // Ensure we don't overwrite our newly initialized data
-            mImageArray[level]-&gt;markClean();
-
-            fastUnpacked = true;
-        }
-    }
-
-    if (!fastUnpacked &amp;&amp; Texture::subImage(xoffset, yoffset, zoffset, width, height, depth, format, type, unpack, pixels, mImageArray[level]))
-    {
-        commitRect(level, xoffset, yoffset, zoffset, width, height, depth);
-    }
-}
-
-void Texture3D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels)
-{
-    if (Texture::subImageCompressed(xoffset, yoffset, zoffset, width, height, depth, format, imageSize, pixels, mImageArray[level]))
-    {
-        commitRect(level, xoffset, yoffset, zoffset, width, height, depth);
-    }
-}
-
-void Texture3D::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
-    for (int level = 0; level &lt; levels; level++)
-    {
-        GLsizei levelWidth = std::max(1, width &gt;&gt; level);
-        GLsizei levelHeight = std::max(1, height &gt;&gt; level);
-        GLsizei levelDepth = std::max(1, depth &gt;&gt; level);
-        mImageArray[level]-&gt;redefine(mRenderer, GL_TEXTURE_3D, internalformat, levelWidth, levelHeight, levelDepth, true);
-    }
-
-    for (int level = levels; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        mImageArray[level]-&gt;redefine(mRenderer, GL_TEXTURE_3D, GL_NONE, 0, 0, 0, true);
-    }
-
-    mImmutable = true;
-
-    setCompleteTexStorage(new rx::TextureStorageInterface3D(mRenderer, internalformat, IsRenderTargetUsage(mUsage), width, height, depth, levels));
-}
-
-void Texture3D::generateMipmaps()
-{
-    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
-    int levelCount = mipLevels();
-    for (int level = 1; level &lt; levelCount; level++)
-    {
-        redefineImage(level, getBaseLevelInternalFormat(),
-                      std::max(getBaseLevelWidth() &gt;&gt; level, 1),
-                      std::max(getBaseLevelHeight() &gt;&gt; level, 1),
-                      std::max(getBaseLevelDepth() &gt;&gt; level, 1));
-    }
-
-    if (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget())
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            mTexStorage-&gt;generateMipmap(level);
-
-            mImageArray[level]-&gt;markClean();
-        }
-    }
-    else
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            mRenderer-&gt;generateMipmap(mImageArray[level], mImageArray[level - 1]);
-        }
-    }
-}
-
-const rx::Image *Texture3D::getBaseLevelImage() const
-{
-    return mImageArray[0];
-}
-
-rx::TextureStorageInterface *Texture3D::getBaseLevelStorage()
-{
-    return mTexStorage;
-}
-
-void Texture3D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    if (xoffset + width &gt; mImageArray[level]-&gt;getWidth() || yoffset + height &gt; mImageArray[level]-&gt;getHeight() || zoffset &gt;= mImageArray[level]-&gt;getDepth())
-    {
-        return gl::error(GL_INVALID_VALUE);
-    }
-
-    // can only make our texture storage to a render target if level 0 is defined (with a width &amp; height) and
-    // the current level we're copying to is defined (with appropriate format, width &amp; height)
-    bool canCreateRenderTarget = isLevelComplete(level) &amp;&amp; isLevelComplete(0);
-
-    if (!mImageArray[level]-&gt;isRenderableFormat() || (!mTexStorage &amp;&amp; !canCreateRenderTarget))
-    {
-        mImageArray[level]-&gt;copy(xoffset, yoffset, zoffset, x, y, width, height, source);
-        mDirtyImages = true;
-    }
-    else
-    {
-        ensureRenderTarget();
-
-        if (isValidLevel(level))
-        {
-            updateStorageLevel(level);
-
-            gl::Rectangle sourceRect;
-            sourceRect.x = x;
-            sourceRect.width = width;
-            sourceRect.y = y;
-            sourceRect.height = height;
-
-            GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-
-            mRenderer-&gt;copyImage(source, sourceRect,
-                                 gl::GetFormat(getBaseLevelInternalFormat(), clientVersion),
-                                 xoffset, yoffset, zoffset, mTexStorage, level);
-        }
-    }
-}
-
-bool Texture3D::isSamplerComplete(const SamplerState &amp;samplerState) const
-{
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-    GLsizei depth = getBaseLevelDepth();
-
-    if (width &lt;= 0 || height &lt;= 0 || depth &lt;= 0)
-    {
-        return false;
-    }
-
-    if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
-    {
-        if (samplerState.magFilter != GL_NEAREST ||
-            (samplerState.minFilter != GL_NEAREST &amp;&amp; samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
-        {
-            return false;
-        }
-    }
-
-    if (IsMipmapFiltered(samplerState) &amp;&amp; !isMipmapComplete())
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool Texture3D::isMipmapComplete() const
-{
-    int levelCount = mipLevels();
-
-    for (int level = 0; level &lt; levelCount; level++)
-    {
-        if (!isLevelComplete(level))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool Texture3D::isLevelComplete(int level) const
-{
-    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
-
-    if (isImmutable())
-    {
-        return true;
-    }
-
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-    GLsizei depth = getBaseLevelDepth();
-
-    if (width &lt;= 0 || height &lt;= 0 || depth &lt;= 0)
-    {
-        return false;
-    }
-
-    if (level == 0)
-    {
-        return true;
-    }
-
-    rx::Image *levelImage = mImageArray[level];
-
-    if (levelImage-&gt;getInternalFormat() != getBaseLevelInternalFormat())
-    {
-        return false;
-    }
-
-    if (levelImage-&gt;getWidth() != std::max(1, width &gt;&gt; level))
-    {
-        return false;
-    }
-
-    if (levelImage-&gt;getHeight() != std::max(1, height &gt;&gt; level))
-    {
-        return false;
-    }
-
-    if (levelImage-&gt;getDepth() != std::max(1, depth &gt;&gt; level))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-Renderbuffer *Texture3D::getRenderbuffer(GLint level, GLint layer)
-{
-    Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, layer);
-    if (!renderBuffer)
-    {
-        renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTexture3DLayer(this, level, layer));
-        mRenderbufferProxies.add(level, 0, renderBuffer);
-    }
-
-    return renderBuffer;
-}
-
-unsigned int Texture3D::getRenderTargetSerial(GLint level, GLint layer)
-{
-    return (ensureRenderTarget() ? mTexStorage-&gt;getRenderTargetSerial(level, layer) : 0);
-}
-
-bool Texture3D::isValidLevel(int level) const
-{
-    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : 0);
-}
-
-void Texture3D::initializeStorage(bool renderTarget)
-{
-    // Only initialize the first time this texture is used as a render target or shader resource
-    if (mTexStorage)
-    {
-        return;
-    }
-
-    // do not attempt to create storage for nonexistant data
-    if (!isLevelComplete(0))
-    {
-        return;
-    }
-
-    bool createRenderTarget = (renderTarget || mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
-
-    setCompleteTexStorage(createCompleteStorage(createRenderTarget));
-    ASSERT(mTexStorage);
-
-    // flush image data to the storage
-    updateStorage();
-}
-
-rx::TextureStorageInterface3D *Texture3D::createCompleteStorage(bool renderTarget) const
-{
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-    GLsizei depth = getBaseLevelDepth();
-
-    ASSERT(width &gt; 0 &amp;&amp; height &gt; 0 &amp;&amp; depth &gt; 0);
-
-    // use existing storage level count, when previously specified by TexStorage*D
-    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(width, height, depth));
-
-    return new rx::TextureStorageInterface3D(mRenderer, getBaseLevelInternalFormat(), renderTarget, width, height, depth, levels);
-}
-
-void Texture3D::setCompleteTexStorage(rx::TextureStorageInterface3D *newCompleteTexStorage)
-{
-    SafeDelete(mTexStorage);
-    mTexStorage = newCompleteTexStorage;
-    mDirtyImages = true;
-
-    // We do not support managed 3D storage, as that is D3D9/ES2-only
-    ASSERT(!mTexStorage-&gt;isManaged());
-}
-
-void Texture3D::updateStorage()
-{
-    for (int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        if (isLevelComplete(level))
-        {
-            updateStorageLevel(level);
-        }
-    }
-}
-
-void Texture3D::updateStorageLevel(int level)
-{
-    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mImageArray) &amp;&amp; mImageArray[level] != NULL);
-    ASSERT(isLevelComplete(level));
-
-    if (mImageArray[level]-&gt;isDirty())
-    {
-        commitRect(level, 0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
-    }
-}
-
-bool Texture3D::ensureRenderTarget()
-{
-    initializeStorage(true);
-
-    if (getBaseLevelWidth() &gt; 0 &amp;&amp; getBaseLevelHeight() &gt; 0 &amp;&amp; getBaseLevelDepth() &gt; 0)
-    {
-        ASSERT(mTexStorage);
-        if (!mTexStorage-&gt;isRenderTarget())
-        {
-            rx::TextureStorageInterface3D *newRenderTargetStorage = createCompleteStorage(true);
-
-            if (!mRenderer-&gt;copyToRenderTarget(newRenderTargetStorage, mTexStorage))
-            {
-                delete newRenderTargetStorage;
-                return gl::error(GL_OUT_OF_MEMORY, false);
-            }
-
-            setCompleteTexStorage(newRenderTargetStorage);
-        }
-    }
-
-    return (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget());
-}
-
-rx::RenderTarget *Texture3D::getRenderTarget(GLint level)
-{
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageLevel(level);
-
-    // ensure this is NOT a depth texture
-    if (isDepth(level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(level);
-}
-
-rx::RenderTarget *Texture3D::getRenderTarget(GLint level, GLint layer)
-{
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorage();
-
-    // ensure this is NOT a depth texture
-    if (isDepth(level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(level, layer);
-}
-
-rx::RenderTarget *Texture3D::getDepthStencil(GLint level, GLint layer)
-{
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageLevel(level);
-
-    // ensure this is a depth texture
-    if (!isDepth(level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(level, layer);
-}
-
-void Texture3D::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
-    // If there currently is a corresponding storage texture image, it has these parameters
-    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
-    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
-    const int storageDepth = std::max(1, getBaseLevelDepth() &gt;&gt; level);
-    const GLenum storageFormat = getBaseLevelInternalFormat();
-
-    mImageArray[level]-&gt;redefine(mRenderer, GL_TEXTURE_3D, internalformat, width, height, depth, false);
-
-    if (mTexStorage)
-    {
-        const int storageLevels = mTexStorage-&gt;getLevelCount();
-
-        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
-            width != storageWidth ||
-            height != storageHeight ||
-            depth != storageDepth ||
-            internalformat != storageFormat)   // Discard mismatched storage
-        {
-            for (int i = 0; i &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
-            {
-                mImageArray[i]-&gt;markDirty();
-            }
-
-            delete mTexStorage;
-            mTexStorage = NULL;
-            mDirtyImages = true;
-        }
-    }
-}
-
-void Texture3D::commitRect(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth)
-{
-    if (isValidLevel(level))
-    {
-        rx::Image *image = mImageArray[level];
-        if (image-&gt;copyToStorage(mTexStorage, level, xoffset, yoffset, zoffset, width, height, depth))
-        {
-            image-&gt;markClean();
-        }
-    }
-}
-
-Texture2DArray::Texture2DArray(rx::Renderer *renderer, GLuint id) : Texture(renderer, id, GL_TEXTURE_2D_ARRAY)
-{
-    mTexStorage = NULL;
-
-    for (int level = 0; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
-    {
-        mLayerCounts[level] = 0;
-        mImageArray[level] = NULL;
-    }
-}
-
-Texture2DArray::~Texture2DArray()
-{
-    delete mTexStorage;
-    mTexStorage = NULL;
-
-    deleteImages();
-}
-
-void Texture2DArray::deleteImages()
-{
-    for (int level = 0; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; ++level)
-    {
-        for (int layer = 0; layer &lt; mLayerCounts[level]; ++layer)
-        {
-            delete mImageArray[level][layer];
-        }
-        delete[] mImageArray[level];
-        mImageArray[level] = NULL;
-        mLayerCounts[level] = 0;
-    }
-}
-
-GLsizei Texture2DArray::getWidth(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mImageArray[level][0]-&gt;getWidth() : 0;
-}
-
-GLsizei Texture2DArray::getHeight(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mImageArray[level][0]-&gt;getHeight() : 0;
-}
-
-GLsizei Texture2DArray::getLayers(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mLayerCounts[level] : 0;
-}
-
-GLenum Texture2DArray::getInternalFormat(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mImageArray[level][0]-&gt;getInternalFormat() : GL_NONE;
-}
-
-GLenum Texture2DArray::getActualFormat(GLint level) const
-{
-    return (level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS &amp;&amp; mLayerCounts[level] &gt; 0) ? mImageArray[level][0]-&gt;getActualFormat() : GL_NONE;
-}
-
-bool Texture2DArray::isCompressed(GLint level) const
-{
-    return IsFormatCompressed(getInternalFormat(level), mRenderer-&gt;getCurrentClientVersion());
-}
-
-bool Texture2DArray::isDepth(GLint level) const
-{
-    return GetDepthBits(getInternalFormat(level), mRenderer-&gt;getCurrentClientVersion()) &gt; 0;
-}
-
-void Texture2DArray::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
-    redefineImage(level, sizedInternalFormat, width, height, depth);
-
-    GLsizei inputDepthPitch = gl::GetDepthPitch(sizedInternalFormat, type, clientVersion, width, height, unpack.alignment);
-
-    for (int i = 0; i &lt; depth; i++)
-    {
-        const void *layerPixels = pixels ? (reinterpret_cast&lt;const unsigned char*&gt;(pixels) + (inputDepthPitch * i)) : NULL;
-        Texture::setImage(unpack, type, layerPixels, mImageArray[level][i]);
-    }
-}
-
-void Texture2DArray::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
-{
-    // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly
-    redefineImage(level, format, width, height, depth);
-
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLsizei inputDepthPitch = gl::GetDepthPitch(format, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
-
-    for (int i = 0; i &lt; depth; i++)
-    {
-        const void *layerPixels = pixels ? (reinterpret_cast&lt;const unsigned char*&gt;(pixels) + (inputDepthPitch * i)) : NULL;
-        Texture::setCompressedImage(imageSize, layerPixels, mImageArray[level][i]);
-    }
-}
-
-void Texture2DArray::subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels)
-{
-    GLenum internalformat = getInternalFormat(level);
-    GLuint clientVersion =  mRenderer-&gt;getCurrentClientVersion();
-    GLsizei inputDepthPitch = gl::GetDepthPitch(internalformat, type, clientVersion, width, height, unpack.alignment);
-
-    for (int i = 0; i &lt; depth; i++)
-    {
-        int layer = zoffset + i;
-        const void *layerPixels = pixels ? (reinterpret_cast&lt;const unsigned char*&gt;(pixels) + (inputDepthPitch * i)) : NULL;
-
-        if (Texture::subImage(xoffset, yoffset, zoffset, width, height, 1, format, type, unpack, layerPixels, mImageArray[level][layer]))
-        {
-            commitRect(level, xoffset, yoffset, layer, width, height);
-        }
-    }
-}
-
-void Texture2DArray::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels)
-{
-    GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-    GLsizei inputDepthPitch = gl::GetDepthPitch(format, GL_UNSIGNED_BYTE, clientVersion, width, height, 1);
-
-    for (int i = 0; i &lt; depth; i++)
-    {
-        int layer = zoffset + i;
-        const void *layerPixels = pixels ? (reinterpret_cast&lt;const unsigned char*&gt;(pixels) + (inputDepthPitch * i)) : NULL;
-
-        if (Texture::subImageCompressed(xoffset, yoffset, zoffset, width, height, 1, format, imageSize, layerPixels, mImageArray[level][layer]))
-        {
-            commitRect(level, xoffset, yoffset, layer, width, height);
-        }
-    }
-}
-
-void Texture2DArray::storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
-    deleteImages();
-
-    for (int level = 0; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        GLsizei levelWidth = std::max(1, width &gt;&gt; level);
-        GLsizei levelHeight = std::max(1, height &gt;&gt; level);
-
-        mLayerCounts[level] = (level &lt; levels ? depth : 0);
-
-        if (mLayerCounts[level] &gt; 0)
-        {
-            // Create new images for this level
-            mImageArray[level] = new rx::Image*[mLayerCounts[level]];
-
-            for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
-            {
-                mImageArray[level][layer] = mRenderer-&gt;createImage();
-                mImageArray[level][layer]-&gt;redefine(mRenderer, GL_TEXTURE_2D_ARRAY, internalformat, levelWidth,
-                                                    levelHeight, 1, true);
-            }
-        }
-    }
-
-    mImmutable = true;
-    setCompleteTexStorage(new rx::TextureStorageInterface2DArray(mRenderer, internalformat, IsRenderTargetUsage(mUsage), width, height, depth, levels));
-}
-
-void Texture2DArray::generateMipmaps()
-{
-    int baseWidth = getBaseLevelWidth();
-    int baseHeight = getBaseLevelHeight();
-    int baseDepth = getBaseLevelDepth();
-    GLenum baseFormat = getBaseLevelInternalFormat();
-
-    // Purge array levels 1 through q and reset them to represent the generated mipmap levels.
-    int levelCount = mipLevels();
-    for (int level = 1; level &lt; levelCount; level++)
-    {
-        redefineImage(level, baseFormat, std::max(baseWidth &gt;&gt; level, 1), std::max(baseHeight &gt;&gt; level, 1), baseDepth);
-    }
-
-    if (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget())
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            mTexStorage-&gt;generateMipmap(level);
-
-            for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
-            {
-                mImageArray[level][layer]-&gt;markClean();
-            }
-        }
-    }
-    else
-    {
-        for (int level = 1; level &lt; levelCount; level++)
-        {
-            for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
-            {
-                mRenderer-&gt;generateMipmap(mImageArray[level][layer], mImageArray[level - 1][layer]);
-            }
-        }
-    }
-}
-
-const rx::Image *Texture2DArray::getBaseLevelImage() const
-{
-    return (mLayerCounts[0] &gt; 0 ? mImageArray[0][0] : NULL);
-}
-
-rx::TextureStorageInterface *Texture2DArray::getBaseLevelStorage()
-{
-    return mTexStorage;
-}
-
-void Texture2DArray::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
-{
-    if (xoffset + width &gt; getWidth(level) || yoffset + height &gt; getHeight(level) || zoffset &gt;= getLayers(level) || getLayers(level) == 0)
-    {
-        return gl::error(GL_INVALID_VALUE);
-    }
-
-    // can only make our texture storage to a render target if level 0 is defined (with a width &amp; height) and
-    // the current level we're copying to is defined (with appropriate format, width &amp; height)
-    bool canCreateRenderTarget = isLevelComplete(level) &amp;&amp; isLevelComplete(0);
-
-    if (!mImageArray[level][0]-&gt;isRenderableFormat() || (!mTexStorage &amp;&amp; !canCreateRenderTarget))
-    {
-        mImageArray[level][zoffset]-&gt;copy(xoffset, yoffset, 0, x, y, width, height, source);
-        mDirtyImages = true;
-    }
-    else
-    {
-        ensureRenderTarget();
-
-        if (isValidLevel(level))
-        {
-            updateStorageLevel(level);
-
-            GLuint clientVersion = mRenderer-&gt;getCurrentClientVersion();
-
-            gl::Rectangle sourceRect;
-            sourceRect.x = x;
-            sourceRect.width = width;
-            sourceRect.y = y;
-            sourceRect.height = height;
-
-            mRenderer-&gt;copyImage(source, sourceRect, gl::GetFormat(getInternalFormat(0), clientVersion),
-                                 xoffset, yoffset, zoffset, mTexStorage, level);
-        }
-    }
-}
-
-bool Texture2DArray::isSamplerComplete(const SamplerState &amp;samplerState) const
-{
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-    GLsizei depth = getLayers(0);
-
-    if (width &lt;= 0 || height &lt;= 0 || depth &lt;= 0)
-    {
-        return false;
-    }
-
-    if (!IsTextureFilteringSupported(getBaseLevelInternalFormat(), mRenderer))
-    {
-        if (samplerState.magFilter != GL_NEAREST ||
-            (samplerState.minFilter != GL_NEAREST &amp;&amp; samplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
-        {
-            return false;
-        }
-    }
-
-    if (IsMipmapFiltered(samplerState) &amp;&amp; !isMipmapComplete())
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool Texture2DArray::isMipmapComplete() const
-{
-    int levelCount = mipLevels();
-
-    for (int level = 1; level &lt; levelCount; level++)
-    {
-        if (!isLevelComplete(level))
-        {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-bool Texture2DArray::isLevelComplete(int level) const
-{
-    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mImageArray));
-
-    if (isImmutable())
-    {
-        return true;
-    }
-
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-    GLsizei layers = getLayers(0);
-
-    if (width &lt;= 0 || height &lt;= 0 || layers &lt;= 0)
-    {
-        return false;
-    }
-
-    if (level == 0)
-    {
-        return true;
-    }
-
-    if (getInternalFormat(level) != getInternalFormat(0))
-    {
-        return false;
-    }
-
-    if (getWidth(level) != std::max(1, width &gt;&gt; level))
-    {
-        return false;
-    }
-
-    if (getHeight(level) != std::max(1, height &gt;&gt; level))
-    {
-        return false;
-    }
-
-    if (getLayers(level) != layers)
-    {
-        return false;
-    }
-
-    return true;
-}
-
-Renderbuffer *Texture2DArray::getRenderbuffer(GLint level, GLint layer)
-{
-    Renderbuffer *renderBuffer = mRenderbufferProxies.get(level, layer);
-    if (!renderBuffer)
-    {
-        renderBuffer = new Renderbuffer(mRenderer, id(), new RenderbufferTexture2DArrayLayer(this, level, layer));
-        mRenderbufferProxies.add(level, 0, renderBuffer);
-    }
-
-    return renderBuffer;
-}
-
-unsigned int Texture2DArray::getRenderTargetSerial(GLint level, GLint layer)
-{
-    return (ensureRenderTarget() ? mTexStorage-&gt;getRenderTargetSerial(level, layer) : 0);
-}
-
-bool Texture2DArray::isValidLevel(int level) const
-{
-    return (mTexStorage ? (level &gt;= 0 &amp;&amp; level &lt; mTexStorage-&gt;getLevelCount()) : 0);
-}
-
-void Texture2DArray::initializeStorage(bool renderTarget)
-{
-    // Only initialize the first time this texture is used as a render target or shader resource
-    if (mTexStorage)
-    {
-        return;
-    }
-
-    // do not attempt to create storage for nonexistant data
-    if (!isLevelComplete(0))
-    {
-        return;
-    }
-
-    bool createRenderTarget = (renderTarget || mUsage == GL_FRAMEBUFFER_ATTACHMENT_ANGLE);
-
-    setCompleteTexStorage(createCompleteStorage(createRenderTarget));
-    ASSERT(mTexStorage);
-
-    // flush image data to the storage
-    updateStorage();
-}
-
-rx::TextureStorageInterface2DArray *Texture2DArray::createCompleteStorage(bool renderTarget) const
-{
-    GLsizei width = getBaseLevelWidth();
-    GLsizei height = getBaseLevelHeight();
-    GLsizei depth = getLayers(0);
-
-    ASSERT(width &gt; 0 &amp;&amp; height &gt; 0 &amp;&amp; depth &gt; 0);
-
-    // use existing storage level count, when previously specified by TexStorage*D
-    GLint levels = (mTexStorage ? mTexStorage-&gt;getLevelCount() : creationLevels(width, height, 1));
-
-    return new rx::TextureStorageInterface2DArray(mRenderer, getBaseLevelInternalFormat(), renderTarget, width, height, depth, levels);
-}
-
-void Texture2DArray::setCompleteTexStorage(rx::TextureStorageInterface2DArray *newCompleteTexStorage)
-{
-    SafeDelete(mTexStorage);
-    mTexStorage = newCompleteTexStorage;
-    mDirtyImages = true;
-
-    // We do not support managed 2D array storage, as managed storage is ES2/D3D9 only
-    ASSERT(!mTexStorage-&gt;isManaged());
-}
-
-void Texture2DArray::updateStorage()
-{
-    for (int level = 0; level &lt; gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-    {
-        if (isLevelComplete(level))
-        {
-            updateStorageLevel(level);
-        }
-    }
-}
-
-void Texture2DArray::updateStorageLevel(int level)
-{
-    ASSERT(level &gt;= 0 &amp;&amp; level &lt; (int)ArraySize(mLayerCounts));
-    ASSERT(isLevelComplete(level));
-
-    for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
-    {
-        ASSERT(mImageArray[level] != NULL &amp;&amp; mImageArray[level][layer] != NULL);
-        if (mImageArray[level][layer]-&gt;isDirty())
-        {
-            commitRect(level, 0, 0, layer, getWidth(level), getHeight(level));
-        }
-    }
-}
-
-bool Texture2DArray::ensureRenderTarget()
-{
-    initializeStorage(true);
-
-    if (getBaseLevelWidth() &gt; 0 &amp;&amp; getBaseLevelHeight() &gt; 0 &amp;&amp; getLayers(0) &gt; 0)
-    {
-        ASSERT(mTexStorage);
-        if (!mTexStorage-&gt;isRenderTarget())
-        {
-            rx::TextureStorageInterface2DArray *newRenderTargetStorage = createCompleteStorage(true);
-
-            if (!mRenderer-&gt;copyToRenderTarget(newRenderTargetStorage, mTexStorage))
-            {
-                delete newRenderTargetStorage;
-                return gl::error(GL_OUT_OF_MEMORY, false);
-            }
-
-            setCompleteTexStorage(newRenderTargetStorage);
-        }
-    }
-
-    return (mTexStorage &amp;&amp; mTexStorage-&gt;isRenderTarget());
-}
-
-rx::RenderTarget *Texture2DArray::getRenderTarget(GLint level, GLint layer)
-{
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageLevel(level);
-
-    // ensure this is NOT a depth texture
-    if (isDepth(level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(level, layer);
-}
-
-rx::RenderTarget *Texture2DArray::getDepthStencil(GLint level, GLint layer)
-{
-    // ensure the underlying texture is created
-    if (!ensureRenderTarget())
-    {
-        return NULL;
-    }
-
-    updateStorageLevel(level);
-
-    // ensure this is a depth texture
-    if (!isDepth(level))
-    {
-        return NULL;
-    }
-
-    return mTexStorage-&gt;getRenderTarget(level, layer);
-}
-
-void Texture2DArray::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
-    // If there currently is a corresponding storage texture image, it has these parameters
-    const int storageWidth = std::max(1, getBaseLevelWidth() &gt;&gt; level);
-    const int storageHeight = std::max(1, getBaseLevelHeight() &gt;&gt; level);
-    const int storageDepth = getLayers(0);
-    const GLenum storageFormat = getBaseLevelInternalFormat();
-
-    for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
-    {
-        delete mImageArray[level][layer];
-    }
-    delete[] mImageArray[level];
-    mImageArray[level] = NULL;
-    mLayerCounts[level] = depth;
-
-    if (depth &gt; 0)
-    {
-        mImageArray[level] = new rx::Image*[depth]();
-
-        for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
-        {
-            mImageArray[level][layer] = mRenderer-&gt;createImage();
-            mImageArray[level][layer]-&gt;redefine(mRenderer, GL_TEXTURE_2D_ARRAY, internalformat, width, height, 1, false);
-        }
-    }
-
-    if (mTexStorage)
-    {
-        const int storageLevels = mTexStorage-&gt;getLevelCount();
-
-        if ((level &gt;= storageLevels &amp;&amp; storageLevels != 0) ||
-            width != storageWidth ||
-            height != storageHeight ||
-            depth != storageDepth ||
-            internalformat != storageFormat)   // Discard mismatched storage
-        {
-            for (int level = 0; level &lt; IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
-            {
-                for (int layer = 0; layer &lt; mLayerCounts[level]; layer++)
-                {
-                    mImageArray[level][layer]-&gt;markDirty();
-                }
-            }
-
-            delete mTexStorage;
-            mTexStorage = NULL;
-            mDirtyImages = true;
-        }
-    }
-}
-
-void Texture2DArray::commitRect(GLint level, GLint xoffset, GLint yoffset, GLint layerTarget, GLsizei width, GLsizei height)
-{
-    if (isValidLevel(level) &amp;&amp; layerTarget &lt; getLayers(level))
-    {
-        rx::Image *image = mImageArray[level][layerTarget];
-        if (image-&gt;copyToStorage(mTexStorage, level, xoffset, yoffset, layerTarget, width, height))
-        {
-            image-&gt;markClean();
-        }
-    }
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Textureh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Texture.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,436 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// 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 &lt;vector&gt;
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &quot;common/debug.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-#include &quot;libGLESv2/angletypes.h&quot;
-#include &quot;libGLESv2/RenderbufferProxySet.h&quot;
-
-namespace egl
-{
-class Surface;
-}
-
-namespace rx
-{
-class Renderer;
-class TextureStorageInterface;
-class TextureStorageInterface2D;
-class TextureStorageInterfaceCube;
-class TextureStorageInterface3D;
-class TextureStorageInterface2DArray;
-class RenderTarget;
-class Image;
-}
-
-namespace gl
-{
-class Framebuffer;
-class Renderbuffer;
-
-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_2D_TEXTURE_SIZE = 16384,
-    IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = 16384,
-    IMPLEMENTATION_MAX_3D_TEXTURE_SIZE = 2048,
-    IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS = 2048,
-
-    IMPLEMENTATION_MAX_TEXTURE_LEVELS = 15   // 1+log2 of MAX_TEXTURE_SIZE
-};
-
-bool IsMipmapFiltered(const SamplerState &amp;samplerState);
-
-class Texture : public RefCountObject
-{
-  public:
-    Texture(rx::Renderer *renderer, GLuint id, GLenum target);
-
-    virtual ~Texture();
-
-    void addProxyRef(const Renderbuffer *proxy);
-    void releaseProxy(const Renderbuffer *proxy);
-
-    GLenum getTarget() const;
-
-    void setMinFilter(GLenum filter);
-    void setMagFilter(GLenum filter);
-    void setWrapS(GLenum wrap);
-    void setWrapT(GLenum wrap);
-    void setWrapR(GLenum wrap);
-    void setMaxAnisotropy(float textureMaxAnisotropy, float contextMaxAnisotropy);
-    void setCompareMode(GLenum mode);
-    void setCompareFunc(GLenum func);
-    void setSwizzleRed(GLenum swizzle);
-    void setSwizzleGreen(GLenum swizzle);
-    void setSwizzleBlue(GLenum swizzle);
-    void setSwizzleAlpha(GLenum swizzle);
-    void setBaseLevel(GLint baseLevel);
-    void setMaxLevel(GLint maxLevel);
-    void setMinLod(GLfloat minLod);
-    void setMaxLod(GLfloat maxLod);
-    void setUsage(GLenum usage);
-
-    GLenum getMinFilter() const;
-    GLenum getMagFilter() const;
-    GLenum getWrapS() const;
-    GLenum getWrapT() const;
-    GLenum getWrapR() const;
-    float getMaxAnisotropy() const;
-    GLenum getSwizzleRed() const;
-    GLenum getSwizzleGreen() const;
-    GLenum getSwizzleBlue() const;
-    GLenum getSwizzleAlpha() const;
-    GLint getBaseLevel() const;
-    GLint getMaxLevel() const;
-    GLfloat getMinLod() const;
-    GLfloat getMaxLod() const;
-    bool isSwizzled() const;
-    void getSamplerState(SamplerState *sampler);
-    GLenum getUsage() const;
-
-    GLint getBaseLevelWidth() const;
-    GLint getBaseLevelHeight() const;
-    GLint getBaseLevelDepth() const;
-    GLenum getBaseLevelInternalFormat() const;
-
-    virtual bool isSamplerComplete(const SamplerState &amp;samplerState) const = 0;
-
-    rx::TextureStorageInterface *getNativeTexture();
-
-    virtual void generateMipmaps() = 0;
-    virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source) = 0;
-
-    bool hasDirtyParameters() const;
-    bool hasDirtyImages() const;
-    void resetDirty();
-    unsigned int getTextureSerial();
-
-    bool isImmutable() const;
-    int immutableLevelCount();
-
-    static const GLuint INCOMPLETE_TEXTURE_ID = static_cast&lt;GLuint&gt;(-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(const PixelUnpackState &amp;unpack, GLenum type, const void *pixels, rx::Image *image);
-    bool subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
-                  GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels, rx::Image *image);
-    void setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image);
-    bool subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
-                            GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image);
-    bool isFastUnpackable(const PixelUnpackState &amp;unpack, GLenum sizedInternalFormat);
-    bool fastUnpackPixels(const PixelUnpackState &amp;unpack, const void *pixels, const Box &amp;destArea,
-                          GLenum sizedInternalFormat, GLenum type, rx::RenderTarget *destRenderTarget);
-
-    GLint creationLevels(GLsizei width, GLsizei height, GLsizei depth) const;
-    int mipLevels() const;
-
-    virtual void initializeStorage(bool renderTarget) = 0;
-    virtual void updateStorage() = 0;
-    virtual bool ensureRenderTarget() = 0;
-
-    rx::Renderer *mRenderer;
-
-    SamplerState mSamplerState;
-    GLenum mUsage;
-
-    bool mDirtyImages;
-
-    bool mImmutable;
-
-    GLenum mTarget;
-
-    // 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.
-    RenderbufferProxySet mRenderbufferProxies;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Texture);
-
-    virtual rx::TextureStorageInterface *getBaseLevelStorage() = 0;
-    virtual const rx::Image *getBaseLevelImage() const = 0;
-};
-
-class Texture2D : public Texture
-{
-  public:
-    Texture2D(rx::Renderer *renderer, GLuint id);
-
-    ~Texture2D();
-
-    GLsizei getWidth(GLint level) const;
-    GLsizei getHeight(GLint level) const;
-    GLenum getInternalFormat(GLint level) const;
-    GLenum getActualFormat(GLint level) const;
-    bool isCompressed(GLint level) const;
-    bool isDepth(GLint level) const;
-
-    void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, 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, const PixelUnpackState &amp;unpack, 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 zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-    void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-
-    virtual bool isSamplerComplete(const SamplerState &amp;samplerState) const;
-    virtual void bindTexImage(egl::Surface *surface);
-    virtual void releaseTexImage();
-
-    virtual void generateMipmaps();
-
-    Renderbuffer *getRenderbuffer(GLint level);
-    unsigned int getRenderTargetSerial(GLint level);
-
-  protected:
-    friend class RenderbufferTexture2D;
-    rx::RenderTarget *getRenderTarget(GLint level);
-    rx::RenderTarget *getDepthSencil(GLint level);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Texture2D);
-
-    virtual void initializeStorage(bool renderTarget);
-    rx::TextureStorageInterface2D *createCompleteStorage(bool renderTarget) const;
-    void setCompleteTexStorage(rx::TextureStorageInterface2D *newCompleteTexStorage);
-
-    virtual void updateStorage();
-    virtual bool ensureRenderTarget();
-    virtual rx::TextureStorageInterface *getBaseLevelStorage();
-    virtual const rx::Image *getBaseLevelImage() const;
-
-    bool isMipmapComplete() const;
-    bool isValidLevel(int level) const;
-    bool isLevelComplete(int level) const;
-    void updateStorageLevel(int level);
-
-    void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height);
-    void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
-
-    rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
-
-    rx::TextureStorageInterface2D *mTexStorage;
-    egl::Surface *mSurface;
-};
-
-class TextureCubeMap : public Texture
-{
-  public:
-    TextureCubeMap(rx::Renderer *renderer, GLuint id);
-
-    ~TextureCubeMap();
-
-    GLsizei getWidth(GLenum target, GLint level) const;
-    GLsizei getHeight(GLenum target, GLint level) const;
-    GLenum getInternalFormat(GLenum target, GLint level) const;
-    GLenum getActualFormat(GLenum target, GLint level) const;
-    bool isCompressed(GLenum target, GLint level) const;
-    bool isDepth(GLenum target, GLint level) const;
-
-    void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-
-    void setCompressedImage(GLenum target, 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, const PixelUnpackState &amp;unpack, 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 zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-    void storage(GLsizei levels, GLenum internalformat, GLsizei size);
-
-    virtual bool isSamplerComplete(const SamplerState &amp;samplerState) const;
-    bool isCubeComplete() const;
-
-    virtual void generateMipmaps();
-
-    Renderbuffer *getRenderbuffer(GLenum target, GLint level);
-    unsigned int getRenderTargetSerial(GLenum target, GLint level);
-
-    static int targetToIndex(GLenum target);
-
-  protected:
-    friend class RenderbufferTextureCubeMap;
-    rx::RenderTarget *getRenderTarget(GLenum target, GLint level);
-    rx::RenderTarget *getDepthStencil(GLenum target, GLint level);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(TextureCubeMap);
-
-    virtual void initializeStorage(bool renderTarget);
-    rx::TextureStorageInterfaceCube *createCompleteStorage(bool renderTarget) const;
-    void setCompleteTexStorage(rx::TextureStorageInterfaceCube *newCompleteTexStorage);
-
-    virtual void updateStorage();
-    virtual bool ensureRenderTarget();
-    virtual rx::TextureStorageInterface *getBaseLevelStorage();
-    virtual const rx::Image *getBaseLevelImage() const;
-
-    bool isMipmapCubeComplete() const;
-    bool isValidFaceLevel(int faceIndex, int level) const;
-    bool isFaceLevelComplete(int faceIndex, int level) const;
-    void updateStorageFaceLevel(int faceIndex, int level);
-
-    void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
-    void redefineImage(int faceIndex, GLint level, GLenum internalformat, GLsizei width, GLsizei height);
-
-    rx::Image *mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
-
-    rx::TextureStorageInterfaceCube *mTexStorage;
-};
-
-class Texture3D : public Texture
-{
-  public:
-    Texture3D(rx::Renderer *renderer, GLuint id);
-
-    ~Texture3D();
-
-    GLsizei getWidth(GLint level) const;
-    GLsizei getHeight(GLint level) const;
-    GLsizei getDepth(GLint level) const;
-    GLenum getInternalFormat(GLint level) const;
-    GLenum getActualFormat(GLint level) const;
-    bool isCompressed(GLint level) const;
-    bool isDepth(GLint level) const;
-
-    void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
-    void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
-    void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-
-    virtual void generateMipmaps();
-    virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-
-    virtual bool isSamplerComplete(const SamplerState &amp;samplerState) const;
-    virtual bool isMipmapComplete() const;
-
-    Renderbuffer *getRenderbuffer(GLint level, GLint layer);
-    unsigned int getRenderTargetSerial(GLint level, GLint layer);
-
-  protected:
-    friend class RenderbufferTexture3DLayer;
-    rx::RenderTarget *getRenderTarget(GLint level);
-    rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
-    rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Texture3D);
-
-    virtual void initializeStorage(bool renderTarget);
-    rx::TextureStorageInterface3D *createCompleteStorage(bool renderTarget) const;
-    void setCompleteTexStorage(rx::TextureStorageInterface3D *newCompleteTexStorage);
-
-    virtual void updateStorage();
-    virtual bool ensureRenderTarget();
-
-    virtual rx::TextureStorageInterface *getBaseLevelStorage();
-    virtual const rx::Image *getBaseLevelImage() const;
-
-    void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-    void commitRect(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
-
-    bool isValidLevel(int level) const;
-    bool isLevelComplete(int level) const;
-    void updateStorageLevel(int level);
-
-    rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
-
-    rx::TextureStorageInterface3D *mTexStorage;
-};
-
-class Texture2DArray : public Texture
-{
-  public:
-    Texture2DArray(rx::Renderer *renderer, GLuint id);
-
-    ~Texture2DArray();
-
-    GLsizei getWidth(GLint level) const;
-    GLsizei getHeight(GLint level) const;
-    GLsizei getLayers(GLint level) const;
-    GLenum getInternalFormat(GLint level) const;
-    GLenum getActualFormat(GLint level) const;
-    bool isCompressed(GLint level) const;
-    bool isDepth(GLint level) const;
-
-    void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
-    void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &amp;unpack, const void *pixels);
-    void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
-    void storage(GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-
-    virtual void generateMipmaps();
-    virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source);
-
-    virtual bool isSamplerComplete(const SamplerState &amp;samplerState) const;
-    virtual bool isMipmapComplete() const;
-
-    Renderbuffer *getRenderbuffer(GLint level, GLint layer);
-    unsigned int getRenderTargetSerial(GLint level, GLint layer);
-
-  protected:
-    friend class RenderbufferTexture2DArrayLayer;
-    rx::RenderTarget *getRenderTarget(GLint level, GLint layer);
-    rx::RenderTarget *getDepthStencil(GLint level, GLint layer);
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(Texture2DArray);
-
-    virtual void initializeStorage(bool renderTarget);
-    rx::TextureStorageInterface2DArray *createCompleteStorage(bool renderTarget) const;
-    void setCompleteTexStorage(rx::TextureStorageInterface2DArray *newCompleteTexStorage);
-
-    virtual void updateStorage();
-    virtual bool ensureRenderTarget();
-
-    virtual rx::TextureStorageInterface *getBaseLevelStorage();
-    virtual const rx::Image *getBaseLevelImage() const;
-
-    void deleteImages();
-    void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-    void commitRect(GLint level, GLint xoffset, GLint yoffset, GLint layerTarget, GLsizei width, GLsizei height);
-
-    bool isValidLevel(int level) const;
-    bool isLevelComplete(int level) const;
-    void updateStorageLevel(int level);
-
-    // Storing images as an array of single depth textures since D3D11 treats each array level of a
-    // Texture2D object as a separate subresource.  Each layer would have to be looped over
-    // to update all the texture layers since they cannot all be updated at once and it makes the most
-    // sense for the Image class to not have to worry about layer subresource as well as mip subresources.
-    GLsizei mLayerCounts[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
-    rx::Image **mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
-
-    rx::TextureStorageInterface2DArray *mTexStorage;
-};
-
-}
-
-#endif   // LIBGLESV2_TEXTURE_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2TransformFeedbackcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,63 +0,0 @@
</span><del>-//
-// Copyright (c) 2014 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 &quot;libGLESv2/TransformFeedback.h&quot;
-
-namespace gl
-{
-
-TransformFeedback::TransformFeedback(GLuint id)
-    : RefCountObject(id),
-      mStarted(GL_FALSE),
-      mPrimitiveMode(GL_NONE),
-      mPaused(GL_FALSE)
-{
-}
-
-TransformFeedback::~TransformFeedback()
-{
-}
-
-void TransformFeedback::start(GLenum primitiveMode)
-{
-    mStarted = GL_TRUE;
-    mPrimitiveMode = primitiveMode;
-    mPaused = GL_FALSE;
-}
-
-void TransformFeedback::stop()
-{
-    mStarted = GL_FALSE;
-    mPrimitiveMode = GL_NONE;
-    mPaused = GL_FALSE;
-}
-
-GLboolean TransformFeedback::isStarted() const
-{
-    return mStarted;
-}
-
-GLenum TransformFeedback::getDrawMode() const
-{
-    return mPrimitiveMode;
-}
-
-void TransformFeedback::pause()
-{
-    mPaused = GL_TRUE;
-}
-
-void TransformFeedback::resume()
-{
-    mPaused = GL_FALSE;
-}
-
-GLboolean TransformFeedback::isPaused() const
-{
-    return mPaused;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2TransformFeedbackh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/TransformFeedback.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,46 +0,0 @@
</span><del>-//
-// Copyright (c) 2014 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 LIBGLESV2_TRANSFORM_FEEDBACK_H_
-#define LIBGLESV2_TRANSFORM_FEEDBACK_H_
-
-#include &quot;common/angleutils.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-namespace gl
-{
-
-class TransformFeedback : public RefCountObject
-{
-  public:
-    explicit TransformFeedback(GLuint id);
-    virtual ~TransformFeedback();
-
-    void start(GLenum primitiveMode);
-    void stop();
-    GLboolean isStarted() const;
-
-    GLenum getDrawMode() const;
-
-    void pause();
-    void resume();
-    GLboolean isPaused() const;
-
-  private:
-    DISALLOW_COPY_AND_ASSIGN(TransformFeedback);
-
-    GLboolean mStarted;
-    GLenum mPrimitiveMode;
-    GLboolean mPaused;
-};
-
-}
-
-#endif // LIBGLESV2_TRANSFORM_FEEDBACK_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Uniformcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,106 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2010-2013 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 &quot;libGLESv2/Uniform.h&quot;
-
-#include &quot;common/utilities.h&quot;
-
-namespace gl
-{
-
-LinkedUniform::LinkedUniform(GLenum type, GLenum precision, const std::string &amp;name, unsigned int arraySize,
-                             const int blockIndex, const BlockMemberInfo &amp;blockInfo)
-    : type(type),
-      precision(precision),
-      name(name),
-      arraySize(arraySize),
-      blockIndex(blockIndex),
-      blockInfo(blockInfo),
-      data(NULL),
-      dirty(true),
-      psRegisterIndex(GL_INVALID_INDEX),
-      vsRegisterIndex(GL_INVALID_INDEX),
-      registerCount(0),
-      registerElement(0)
-{
-    // We use data storage for default block uniforms to cache values that are sent to D3D during rendering
-    // Uniform blocks/buffers are treated separately by the Renderer (ES3 path only)
-    if (isInDefaultBlock())
-    {
-        size_t bytes = dataSize();
-        data = new unsigned char[bytes];
-        memset(data, 0, bytes);
-        registerCount = VariableRowCount(type) * elementCount();
-    }
-}
-
-LinkedUniform::~LinkedUniform()
-{
-    delete[] data;
-}
-
-bool LinkedUniform::isArray() const
-{
-    return arraySize &gt; 0;
-}
-
-unsigned int LinkedUniform::elementCount() const
-{
-    return arraySize &gt; 0 ? arraySize : 1;
-}
-
-bool LinkedUniform::isReferencedByVertexShader() const
-{
-    return vsRegisterIndex != GL_INVALID_INDEX;
-}
-
-bool LinkedUniform::isReferencedByFragmentShader() const
-{
-    return psRegisterIndex != GL_INVALID_INDEX;
-}
-
-bool LinkedUniform::isInDefaultBlock() const
-{
-    return blockIndex == -1;
-}
-
-size_t LinkedUniform::dataSize() const
-{
-    ASSERT(type != GL_STRUCT_ANGLEX);
-    return UniformInternalSize(type) * elementCount();
-}
-
-bool LinkedUniform::isSampler() const
-{
-    return IsSampler(type);
-}
-
-UniformBlock::UniformBlock(const std::string &amp;name, unsigned int elementIndex, unsigned int dataSize)
-    : name(name),
-      elementIndex(elementIndex),
-      dataSize(dataSize),
-      psRegisterIndex(GL_INVALID_INDEX),
-      vsRegisterIndex(GL_INVALID_INDEX)
-{
-}
-
-bool UniformBlock::isArrayElement() const
-{
-    return elementIndex != GL_INVALID_INDEX;
-}
-
-bool UniformBlock::isReferencedByVertexShader() const
-{
-    return vsRegisterIndex != GL_INVALID_INDEX;
-}
-
-bool UniformBlock::isReferencedByFragmentShader() const
-{
-    return psRegisterIndex != GL_INVALID_INDEX;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2Uniformh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/Uniform.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,80 +0,0 @@
</span><del>-//
-// Copyright (c) 2010-2013 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 LIBGLESV2_UNIFORM_H_
-#define LIBGLESV2_UNIFORM_H_
-
-#include &lt;string&gt;
-#include &lt;vector&gt;
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#include &quot;common/debug.h&quot;
-#include &quot;angletypes.h&quot;
-#include &quot;common/shadervars.h&quot;
-
-namespace gl
-{
-
-// Helper struct representing a single shader uniform
-struct LinkedUniform
-{
-    LinkedUniform(GLenum type, GLenum precision, const std::string &amp;name, unsigned int arraySize, const int blockIndex, const BlockMemberInfo &amp;blockInfo);
-
-    ~LinkedUniform();
-
-    bool isArray() const;
-    unsigned int elementCount() const;
-    bool isReferencedByVertexShader() const;
-    bool isReferencedByFragmentShader() const;
-    bool isInDefaultBlock() const;
-    size_t dataSize() const;
-    bool isSampler() const;
-
-    const GLenum type;
-    const GLenum precision;
-    const std::string name;
-    const unsigned int arraySize;
-    const int blockIndex;
-    const BlockMemberInfo blockInfo;
-
-    unsigned char *data;
-    bool dirty;
-
-    unsigned int psRegisterIndex;
-    unsigned int vsRegisterIndex;
-    unsigned int registerCount;
-
-    // Register &quot;elements&quot; are used for uniform structs in ES3, to appropriately identify single uniforms
-    // inside aggregate types, which are packed according C-like structure rules.
-    unsigned int registerElement;
-};
-
-// Helper struct representing a single shader uniform block
-struct UniformBlock
-{
-    // use GL_INVALID_INDEX for non-array elements
-    UniformBlock(const std::string &amp;name, unsigned int elementIndex, unsigned int dataSize);
-
-    bool isArrayElement() const;
-    bool isReferencedByVertexShader() const;
-    bool isReferencedByFragmentShader() const;
-
-    const std::string name;
-    const unsigned int elementIndex;
-    const unsigned int dataSize;
-
-    std::vector&lt;unsigned int&gt; memberUniformIndexes;
-
-    unsigned int psRegisterIndex;
-    unsigned int vsRegisterIndex;
-};
-
-}
-
-#endif   // LIBGLESV2_UNIFORM_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2VertexArraycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,71 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-// Implementation of the state class for mananging GLES 3 Vertex Array Objects.
-//
-
-#include &quot;libGLESv2/VertexArray.h&quot;
-#include &quot;libGLESv2/Buffer.h&quot;
-
-namespace gl
-{
-
-VertexArray::VertexArray(rx::Renderer *renderer, GLuint id)
-    : RefCountObject(id)
-{
-}
-
-VertexArray::~VertexArray()
-{
-    for (int i = 0; i &lt; MAX_VERTEX_ATTRIBS; i++)
-    {
-        mVertexAttributes[i].mBoundBuffer.set(NULL);
-    }
-    mElementArrayBuffer.set(NULL);
-}
-
-void VertexArray::detachBuffer(GLuint bufferName)
-{
-    for (int attribute = 0; attribute &lt; MAX_VERTEX_ATTRIBS; attribute++)
-    {
-        if (mVertexAttributes[attribute].mBoundBuffer.id() == bufferName)
-        {
-            mVertexAttributes[attribute].mBoundBuffer.set(NULL);
-        }
-    }
-
-    if (mElementArrayBuffer.id() == bufferName)
-    {
-        mElementArrayBuffer.set(NULL);
-    }
-}
-
-const VertexAttribute&amp; VertexArray::getVertexAttribute(unsigned int attributeIndex) const
-{
-    ASSERT(attributeIndex &lt; MAX_VERTEX_ATTRIBS);
-    return mVertexAttributes[attributeIndex];
-}
-
-void VertexArray::setVertexAttribDivisor(GLuint index, GLuint divisor)
-{
-    ASSERT(index &lt; gl::MAX_VERTEX_ATTRIBS);
-    mVertexAttributes[index].mDivisor = divisor;
-}
-
-void VertexArray::enableAttribute(unsigned int attributeIndex, bool enabledState)
-{
-    ASSERT(attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS);
-    mVertexAttributes[attributeIndex].mArrayEnabled = enabledState;
-}
-
-void VertexArray::setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
-                                    bool normalized, bool pureInteger, GLsizei stride, const void *pointer)
-{
-    ASSERT(attributeIndex &lt; gl::MAX_VERTEX_ATTRIBS);
-    mVertexAttributes[attributeIndex].setState(boundBuffer, size, type, normalized, pureInteger, stride, pointer);
-}
-
-}
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2VertexArrayh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexArray.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,54 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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 class contains prototypes for representing GLES 3 Vertex Array Objects:
-//
-//   The buffer objects that are to be used by the vertex stage of the GL are collected
-//   together to form a vertex array object. All state related to the definition of data used
-//   by the vertex processor is encapsulated in a vertex array object.
-//
-
-#ifndef LIBGLESV2_VERTEXARRAY_H_
-#define LIBGLESV2_VERTEXARRAY_H_
-
-#include &quot;common/RefCountObject.h&quot;
-#include &quot;libGLESv2/constants.h&quot;
-#include &quot;libGLESv2/VertexAttribute.h&quot;
-
-namespace rx
-{
-class Renderer;
-}
-
-namespace gl
-{
-class Buffer;
-
-class VertexArray : public RefCountObject
-{
-  public:
-    VertexArray(rx::Renderer *renderer, GLuint id);
-    ~VertexArray();
-
-    const VertexAttribute&amp; getVertexAttribute(unsigned int attributeIndex) const;
-    void detachBuffer(GLuint bufferName);
-    void setVertexAttribDivisor(GLuint index, GLuint divisor);
-    void enableAttribute(unsigned int attributeIndex, bool enabledState);
-    void setAttributeState(unsigned int attributeIndex, gl::Buffer *boundBuffer, GLint size, GLenum type,
-                           bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
-
-    const VertexAttribute* getVertexAttributes() const { return mVertexAttributes; }
-    Buffer *getElementArrayBuffer() const { return mElementArrayBuffer.get(); }
-    void setElementArrayBuffer(Buffer *elementArrayBuffer) { mElementArrayBuffer.set(elementArrayBuffer); }
-    GLuint getElementArrayBufferId() const { return mElementArrayBuffer.id(); }
-
-  private:
-    VertexAttribute mVertexAttributes[MAX_VERTEX_ATTRIBS];
-    BindingPointer&lt;Buffer&gt; mElementArrayBuffer;
-};
-
-}
-
-#endif // LIBGLESV2_VERTEXARRAY_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2VertexAttributeh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexAttribute.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexAttribute.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/VertexAttribute.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,156 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-// Helper structure describing a single vertex attribute
-//
-
-#ifndef LIBGLESV2_VERTEXATTRIBUTE_H_
-#define LIBGLESV2_VERTEXATTRIBUTE_H_
-
-#include &quot;libGLESv2/Buffer.h&quot;
-
-namespace gl
-{
-
-class VertexAttribute
-{
-  public:
-    VertexAttribute() : mType(GL_FLOAT), mSize(4), mNormalized(false), mPureInteger(false),
-                        mStride(0), mPointer(NULL), mArrayEnabled(false), mDivisor(0)
-    {
-    }
-
-    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_INT:                         return mSize * sizeof(GLint);
-          case GL_UNSIGNED_INT:                return mSize * sizeof(GLuint);
-          case GL_INT_2_10_10_10_REV:          return 4;
-          case GL_UNSIGNED_INT_2_10_10_10_REV: return 4;
-          case GL_FIXED:                       return mSize * sizeof(GLfixed);
-          case GL_HALF_FLOAT:                  return mSize * sizeof(GLhalf);
-          case GL_FLOAT:                       return mSize * sizeof(GLfloat);
-          default: UNREACHABLE();              return mSize * sizeof(GLfloat);
-        }
-    }
-
-    GLsizei stride() const
-    {
-        return (mArrayEnabled ? (mStride ? mStride : typeSize()) : 16);
-    }
-
-    void setState(gl::Buffer *boundBuffer, GLint size, GLenum type, bool normalized,
-                  bool pureInteger, GLsizei stride, const void *pointer)
-    {
-        mBoundBuffer.set(boundBuffer);
-        mSize = size;
-        mType = type;
-        mNormalized = normalized;
-        mPureInteger = pureInteger;
-        mStride = stride;
-        mPointer = pointer;
-    }
-
-    template &lt;typename T&gt;
-    T querySingleParameter(GLenum pname) const
-    {
-        switch (pname)
-        {
-          case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
-            return static_cast&lt;T&gt;(mArrayEnabled ? GL_TRUE : GL_FALSE);
-          case GL_VERTEX_ATTRIB_ARRAY_SIZE:
-            return static_cast&lt;T&gt;(mSize);
-          case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
-            return static_cast&lt;T&gt;(mStride);
-          case GL_VERTEX_ATTRIB_ARRAY_TYPE:
-            return static_cast&lt;T&gt;(mType);
-          case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
-            return static_cast&lt;T&gt;(mNormalized ? GL_TRUE : GL_FALSE);
-          case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
-            return static_cast&lt;T&gt;(mBoundBuffer.id());
-          case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
-            return static_cast&lt;T&gt;(mDivisor);
-          case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
-            return static_cast&lt;T&gt;(mPureInteger ? GL_TRUE : GL_FALSE);
-          default:
-            UNREACHABLE();
-            return static_cast&lt;T&gt;(0);
-        }
-    }
-
-    // From glVertexAttribPointer
-    GLenum mType;
-    GLint mSize;
-    bool mNormalized;
-    bool mPureInteger;
-    GLsizei mStride;   // 0 means natural stride
-
-    union
-    {
-        const void *mPointer;
-        intptr_t mOffset;
-    };
-
-    BindingPointer&lt;Buffer&gt; mBoundBuffer;   // Captured when glVertexAttribPointer is called.
-    bool mArrayEnabled;   // From glEnable/DisableVertexAttribArray
-    unsigned int mDivisor;
-};
-
-struct VertexAttribCurrentValueData
-{
-    union
-    {
-        GLfloat FloatValues[4];
-        GLint IntValues[4];
-        GLuint UnsignedIntValues[4];
-    };
-    GLenum Type;
-
-    void setFloatValues(const GLfloat floatValues[4])
-    {
-        for (unsigned int valueIndex = 0; valueIndex &lt; 4; valueIndex++)
-        {
-            FloatValues[valueIndex] = floatValues[valueIndex];
-        }
-        Type = GL_FLOAT;
-    }
-
-    void setIntValues(const GLint intValues[4])
-    {
-        for (unsigned int valueIndex = 0; valueIndex &lt; 4; valueIndex++)
-        {
-            IntValues[valueIndex] = intValues[valueIndex];
-        }
-        Type = GL_INT;
-    }
-
-    void setUnsignedIntValues(const GLuint unsignedIntValues[4])
-    {
-        for (unsigned int valueIndex = 0; valueIndex &lt; 4; valueIndex++)
-        {
-            UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex];
-        }
-        Type = GL_UNSIGNED_INT;
-    }
-
-    bool operator==(const VertexAttribCurrentValueData &amp;other)
-    {
-        return (Type == other.Type &amp;&amp; memcmp(FloatValues, other.FloatValues, sizeof(float) * 4) == 0);
-    }
-
-    bool operator!=(const VertexAttribCurrentValueData &amp;other)
-    {
-        return !(*this == other);
-    }
-};
-
-}
-
-#endif // LIBGLESV2_VERTEXATTRIBUTE_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2angletypescpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,177 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-
-// angletypes.h : Defines a variety of structures and enum types that are used throughout libGLESv2
-
-#include &quot;libGLESv2/angletypes.h&quot;
-#include &quot;libGLESv2/ProgramBinary.h&quot;
-#include &quot;libGLESv2/VertexAttribute.h&quot;
-
-namespace gl
-{
-
-bool SamplerState::swizzleRequired() const
-{
-    return swizzleRed != GL_RED || swizzleGreen != GL_GREEN ||
-           swizzleBlue != GL_BLUE || swizzleAlpha != GL_ALPHA;
-}
-
-static void MinMax(int a, int b, int *minimum, int *maximum)
-{
-    if (a &lt; b)
-    {
-        *minimum = a;
-        *maximum = b;
-    }
-    else
-    {
-        *minimum = b;
-        *maximum = a;
-    }
-}
-
-bool ClipRectangle(const Rectangle &amp;source, const Rectangle &amp;clip, Rectangle *intersection)
-{
-    int minSourceX, maxSourceX, minSourceY, maxSourceY;
-    MinMax(source.x, source.x + source.width, &amp;minSourceX, &amp;maxSourceX);
-    MinMax(source.y, source.y + source.height, &amp;minSourceY, &amp;maxSourceY);
-
-    int minClipX, maxClipX, minClipY, maxClipY;
-    MinMax(clip.x, clip.x + clip.width, &amp;minClipX, &amp;maxClipX);
-    MinMax(clip.y, clip.y + clip.height, &amp;minClipY, &amp;maxClipY);
-
-    if (minSourceX &gt;= maxClipX || maxSourceX &lt;= minClipX || minSourceY &gt;= maxClipY || maxSourceY &lt;= minClipY)
-    {
-        if (intersection)
-        {
-            intersection-&gt;x = minSourceX;
-            intersection-&gt;y = maxSourceY;
-            intersection-&gt;width = maxSourceX - minSourceX;
-            intersection-&gt;height = maxSourceY - minSourceY;
-        }
-
-        return false;
-    }
-    else
-    {
-        if (intersection)
-        {
-            intersection-&gt;x = std::max(minSourceX, minClipX);
-            intersection-&gt;y = std::max(minSourceY, minClipY);
-            intersection-&gt;width  = std::min(maxSourceX, maxClipX) - std::max(minSourceX, minClipX);
-            intersection-&gt;height = std::min(maxSourceY, maxClipY) - std::max(minSourceY, minClipY);
-        }
-
-        return true;
-    }
-}
-
-VertexFormat::VertexFormat()
-    : mType(GL_NONE),
-      mNormalized(GL_FALSE),
-      mComponents(0),
-      mPureInteger(false)
-{}
-
-VertexFormat::VertexFormat(GLenum type, GLboolean normalized, GLuint components, bool pureInteger)
-    : mType(type),
-      mNormalized(normalized),
-      mComponents(components),
-      mPureInteger(pureInteger)
-{
-    // Float data can not be normalized, so ignore the user setting
-    if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
-    {
-        mNormalized = GL_FALSE;
-    }
-}
-
-VertexFormat::VertexFormat(const VertexAttribute &amp;attribute)
-    : mType(attribute.mType),
-      mNormalized(attribute.mNormalized ? GL_TRUE : GL_FALSE),
-      mComponents(attribute.mSize),
-      mPureInteger(attribute.mPureInteger)
-{
-    // Ensure we aren't initializing a vertex format which should be using
-    // the current-value type
-    ASSERT(attribute.mArrayEnabled);
-
-    // Float data can not be normalized, so ignore the user setting
-    if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
-    {
-        mNormalized = GL_FALSE;
-    }
-}
-
-VertexFormat::VertexFormat(const VertexAttribute &amp;attribute, GLenum currentValueType)
-    : mType(attribute.mType),
-      mNormalized(attribute.mNormalized ? GL_TRUE : GL_FALSE),
-      mComponents(attribute.mSize),
-      mPureInteger(attribute.mPureInteger)
-{
-    if (!attribute.mArrayEnabled)
-    {
-        mType = currentValueType;
-        mNormalized = GL_FALSE;
-        mComponents = 4;
-        mPureInteger = (currentValueType != GL_FLOAT);
-    }
-
-    // Float data can not be normalized, so ignore the user setting
-    if (mType == GL_FLOAT || mType == GL_HALF_FLOAT || mType == GL_FIXED)
-    {
-        mNormalized = GL_FALSE;
-    }
-}
-
-void VertexFormat::GetInputLayout(VertexFormat *inputLayout,
-                                  ProgramBinary *programBinary,
-                                  const VertexAttribute *attributes,
-                                  const gl::VertexAttribCurrentValueData *currentValues)
-{
-    for (unsigned int attributeIndex = 0; attributeIndex &lt; MAX_VERTEX_ATTRIBS; attributeIndex++)
-    {
-        int semanticIndex = programBinary-&gt;getSemanticIndex(attributeIndex);
-
-        if (semanticIndex != -1)
-        {
-            inputLayout[semanticIndex] = VertexFormat(attributes[attributeIndex], currentValues[attributeIndex].Type);
-        }
-    }
-}
-
-bool VertexFormat::operator==(const VertexFormat &amp;other) const
-{
-    return (mType == other.mType                &amp;&amp;
-            mComponents == other.mComponents    &amp;&amp;
-            mNormalized == other.mNormalized    &amp;&amp;
-            mPureInteger == other.mPureInteger  );
-}
-
-bool VertexFormat::operator!=(const VertexFormat &amp;other) const
-{
-    return !(*this == other);
-}
-
-bool VertexFormat::operator&lt;(const VertexFormat&amp; other) const
-{
-    if (mType != other.mType)
-    {
-        return mType &lt; other.mType;
-    }
-    if (mNormalized != other.mNormalized)
-    {
-        return mNormalized &lt; other.mNormalized;
-    }
-    if (mComponents != other.mComponents)
-    {
-        return mComponents &lt; other.mComponents;
-    }
-    return mPureInteger &lt; other.mPureInteger;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2angletypesh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/angletypes.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,271 +0,0 @@
</span><del>-//
-// Copyright (c) 2012-2013 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.
-//
-
-// angletypes.h : Defines a variety of structures and enum types that are used throughout libGLESv2
-
-#ifndef LIBGLESV2_ANGLETYPES_H_
-#define LIBGLESV2_ANGLETYPES_H_
-
-#include &quot;libGLESv2/constants.h&quot;
-#include &quot;common/RefCountObject.h&quot;
-
-namespace gl
-{
-class Buffer;
-class ProgramBinary;
-class VertexAttribute;
-struct VertexAttribCurrentValueData;
-
-enum TextureType
-{
-    TEXTURE_2D,
-    TEXTURE_CUBE,
-    TEXTURE_3D,
-    TEXTURE_2D_ARRAY,
-
-    TEXTURE_TYPE_COUNT,
-    TEXTURE_UNKNOWN
-};
-
-enum SamplerType
-{
-    SAMPLER_PIXEL,
-    SAMPLER_VERTEX
-};
-
-template &lt;typename T&gt;
-struct Color
-{
-    T red;
-    T green;
-    T blue;
-    T alpha;
-
-    Color() : red(0), green(0), blue(0), alpha(0) { }
-    Color(T r, T g, T b, T a) : red(r), green(g), blue(b), alpha(a) { }
-};
-
-typedef Color&lt;float&gt; ColorF;
-typedef Color&lt;int&gt; ColorI;
-typedef Color&lt;unsigned int&gt; ColorUI;
-
-struct Rectangle
-{
-    int x;
-    int y;
-    int width;
-    int height;
-
-    Rectangle() : x(0), y(0), width(0), height(0) { }
-    Rectangle(int x_in, int y_in, int width_in, int height_in) : x(x_in), y(y_in), width(width_in), height(height_in) { }
-};
-
-bool ClipRectangle(const Rectangle &amp;source, const Rectangle &amp;clip, Rectangle *intersection);
-
-struct Box
-{
-    int x;
-    int y;
-    int z;
-    int width;
-    int height;
-    int depth;
-
-    Box() : x(0), y(0), z(0), width(0), height(0), depth(0) { }
-    Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in) : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in) { }
-};
-
-struct Extents
-{
-    int width;
-    int height;
-    int depth;
-
-    Extents() : width(0), height(0), depth(0) { }
-    Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) { }
-};
-
-struct RasterizerState
-{
-    bool cullFace;
-    GLenum cullMode;
-    GLenum frontFace;
-
-    bool polygonOffsetFill;
-    GLfloat polygonOffsetFactor;
-    GLfloat polygonOffsetUnits;
-
-    bool pointDrawMode;
-    bool multiSample;
-
-    bool rasterizerDiscard;
-};
-
-struct BlendState
-{
-    bool blend;
-    GLenum sourceBlendRGB;
-    GLenum destBlendRGB;
-    GLenum sourceBlendAlpha;
-    GLenum destBlendAlpha;
-    GLenum blendEquationRGB;
-    GLenum blendEquationAlpha;
-
-    bool colorMaskRed;
-    bool colorMaskGreen;
-    bool colorMaskBlue;
-    bool colorMaskAlpha;
-
-    bool sampleAlphaToCoverage;
-
-    bool dither;
-};
-
-struct DepthStencilState
-{
-    bool depthTest;
-    GLenum depthFunc;
-    bool depthMask;
-
-    bool stencilTest;
-    GLenum stencilFunc;
-    GLuint stencilMask;
-    GLenum stencilFail;
-    GLenum stencilPassDepthFail;
-    GLenum stencilPassDepthPass;
-    GLuint stencilWritemask;
-    GLenum stencilBackFunc;
-    GLuint stencilBackMask;
-    GLenum stencilBackFail;
-    GLenum stencilBackPassDepthFail;
-    GLenum stencilBackPassDepthPass;
-    GLuint stencilBackWritemask;
-};
-
-struct SamplerState
-{
-    GLenum minFilter;
-    GLenum magFilter;
-    GLenum wrapS;
-    GLenum wrapT;
-    GLenum wrapR;
-    float maxAnisotropy;
-
-    GLint baseLevel;
-    GLint maxLevel;
-    GLfloat minLod;
-    GLfloat maxLod;
-
-    GLenum compareMode;
-    GLenum compareFunc;
-
-    GLenum swizzleRed;
-    GLenum swizzleGreen;
-    GLenum swizzleBlue;
-    GLenum swizzleAlpha;
-
-    bool swizzleRequired() const;
-};
-
-struct ClearParameters
-{
-    bool clearColor[gl::IMPLEMENTATION_MAX_DRAW_BUFFERS];
-    ColorF colorFClearValue;
-    ColorI colorIClearValue;
-    ColorUI colorUIClearValue;
-    GLenum colorClearType;
-    bool colorMaskRed;
-    bool colorMaskGreen;
-    bool colorMaskBlue;
-    bool colorMaskAlpha;
-
-    bool clearDepth;
-    float depthClearValue;
-
-    bool clearStencil;
-    GLint stencilClearValue;
-    GLuint stencilWriteMask;
-
-    bool scissorEnabled;
-    Rectangle scissor;
-};
-
-struct PixelUnpackState
-{
-    BindingPointer&lt;Buffer&gt; pixelBuffer;
-    GLint alignment;
-
-    PixelUnpackState()
-        : alignment(4)
-    {}
-
-    explicit PixelUnpackState(GLint alignmentIn)
-        : alignment(alignmentIn)
-    {}
-};
-
-struct PixelPackState
-{
-    BindingPointer&lt;Buffer&gt; pixelBuffer;
-    GLint alignment;
-    bool reverseRowOrder;
-
-    PixelPackState()
-        : alignment(4),
-          reverseRowOrder(false)
-    {}
-
-    explicit PixelPackState(GLint alignmentIn, bool reverseRowOrderIn)
-        : alignment(alignmentIn),
-          reverseRowOrder(reverseRowOrderIn)
-    {}
-};
-
-struct VertexFormat
-{
-    GLenum      mType;
-    GLboolean   mNormalized;
-    GLuint      mComponents;
-    bool        mPureInteger;
-
-    VertexFormat();
-    VertexFormat(GLenum type, GLboolean normalized, GLuint components, bool pureInteger);
-    explicit VertexFormat(const VertexAttribute &amp;attribute);
-    VertexFormat(const VertexAttribute &amp;attribute, GLenum currentValueType);
-
-    static void GetInputLayout(VertexFormat *inputLayout,
-                               ProgramBinary *programBinary,
-                               const VertexAttribute *attributes,
-                               const gl::VertexAttribCurrentValueData *currentValues);
-
-    bool operator==(const VertexFormat &amp;other) const;
-    bool operator!=(const VertexFormat &amp;other) const;
-    bool operator&lt;(const VertexFormat&amp; other) const;
-};
-
-}
-
-namespace rx
-{
-
-enum VertexConversionType
-{
-    VERTEX_CONVERT_NONE = 0,
-    VERTEX_CONVERT_CPU  = 1,
-    VERTEX_CONVERT_GPU  = 2,
-    VERTEX_CONVERT_BOTH = 3
-};
-
-enum D3DWorkaroundType
-{
-    ANGLE_D3D_WORKAROUND_NONE,
-    ANGLE_D3D_WORKAROUND_SKIP_OPTIMIZATION,
-    ANGLE_D3D_WORKAROUND_MAX_OPTIMIZATION
-};
-
-}
-
-#endif // LIBGLESV2_ANGLETYPES_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2constantsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/constants.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/constants.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/constants.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,41 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// Contants.h: Defines some implementation specific and gl constants
-
-#ifndef LIBGLESV2_CONSTANTS_H_
-#define LIBGLESV2_CONSTANTS_H_
-
-namespace gl
-{
-
-enum
-{
-    MAX_VERTEX_ATTRIBS = 16,
-    MAX_TEXTURE_IMAGE_UNITS = 16,
-
-    // Implementation upper limits, real maximums depend on the hardware
-    IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 16,
-    IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS = MAX_TEXTURE_IMAGE_UNITS + IMPLEMENTATION_MAX_VERTEX_TEXTURE_IMAGE_UNITS,    
-
-    IMPLEMENTATION_MAX_VARYING_VECTORS = 32,
-    IMPLEMENTATION_MAX_DRAW_BUFFERS = 8,
-
-    IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS = 16,
-    IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS = 16,
-    IMPLEMENTATION_MAX_COMBINED_SHADER_UNIFORM_BUFFERS = IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS +
-                                                         IMPLEMENTATION_MAX_FRAGMENT_SHADER_UNIFORM_BUFFERS,
-
-    IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS = 4,
-};
-
-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;
-
-}
-
-#endif // LIBGLESV2_CONSTANTS_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_eglcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1160 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_egl.cpp : Implements the EGL entry points.
+
+#include &quot;libGLESv2/entry_points_egl.h&quot;
+#include &quot;libGLESv2/entry_points_egl_ext.h&quot;
+#include &quot;libGLESv2/entry_points_gles_2_0_ext.h&quot;
+#include &quot;libGLESv2/entry_points_gles_3_0_ext.h&quot;
+#include &quot;libGLESv2/global_state.h&quot;
+
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/validationEGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/version.h&quot;
+
+#include &lt;EGL/eglext.h&gt;
+
+namespace egl
+{
+
+// EGL 1.0
+EGLint EGLAPIENTRY GetError(void)
+{
+    EVENT(&quot;()&quot;);
+
+    EGLint error = GetGlobalError();
+    SetGlobalError(Error(EGL_SUCCESS));
+    return error;
+}
+
+EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id)
+{
+    EVENT(&quot;(EGLNativeDisplayType display_id = 0x%0.8p)&quot;, display_id);
+
+    return Display::getDisplay(display_id, AttributeMap());
+}
+
+EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)&quot;,
+          dpy, major, minor);
+
+    if (dpy == EGL_NO_DISPLAY)
+    {
+        SetGlobalError(Error(EGL_BAD_DISPLAY));
+        return EGL_FALSE;
+    }
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+
+    Error error = display-&gt;initialize();
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (major) *major = 1;
+    if (minor) *minor = 4;
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p)&quot;, dpy);
+
+    if (dpy == EGL_NO_DISPLAY)
+    {
+        SetGlobalError(Error(EGL_BAD_DISPLAY));
+        return EGL_FALSE;
+    }
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    gl::Context *context = GetGlobalContext();
+
+    if (display-&gt;isValidContext(context))
+    {
+        SetGlobalContext(NULL);
+        SetGlobalDisplay(NULL);
+    }
+
+    display-&gt;terminate();
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLint name = %d)&quot;, dpy, name);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    if (!(display == EGL_NO_DISPLAY &amp;&amp; name == EGL_EXTENSIONS))
+    {
+        Error error = ValidateDisplay(display);
+        if (error.isError())
+        {
+            SetGlobalError(error);
+            return NULL;
+        }
+    }
+
+    const char *result;
+    switch (name)
+    {
+      case EGL_CLIENT_APIS:
+        result = &quot;OpenGL_ES&quot;;
+        break;
+      case EGL_EXTENSIONS:
+        if (display == EGL_NO_DISPLAY)
+        {
+            result = Display::getClientExtensionString().c_str();
+        }
+        else
+        {
+            result = display-&gt;getExtensionString().c_str();
+        }
+        break;
+      case EGL_VENDOR:
+        result = display-&gt;getVendorString().c_str();
+        break;
+      case EGL_VERSION:
+        result = &quot;1.4 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
+        break;
+      default:
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return NULL;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return result;
+}
+
+EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, &quot;
+          &quot;EGLint config_size = %d, EGLint *num_config = 0x%0.8p)&quot;,
+          dpy, configs, config_size, num_config);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+
+    Error error = ValidateDisplay(display);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (!num_config)
+    {
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_FALSE;
+    }
+
+    std::vector&lt;const Config*&gt; filteredConfigs = display-&gt;getConfigs(AttributeMap());
+    if (configs)
+    {
+        filteredConfigs.resize(std::min&lt;size_t&gt;(filteredConfigs.size(), config_size));
+        for (size_t i = 0; i &lt; filteredConfigs.size(); i++)
+        {
+            configs[i] = const_cast&lt;Config*&gt;(filteredConfigs[i]);
+        }
+    }
+    *num_config = filteredConfigs.size();
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, &quot;
+          &quot;EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)&quot;,
+          dpy, attrib_list, configs, config_size, num_config);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+
+    Error error = ValidateDisplay(display);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (!num_config)
+    {
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_FALSE;
+    }
+
+    std::vector&lt;const Config*&gt; filteredConfigs = display-&gt;getConfigs(AttributeMap(attrib_list));
+    if (configs)
+    {
+        filteredConfigs.resize(std::min&lt;size_t&gt;(filteredConfigs.size(), config_size));
+        for (size_t i = 0; i &lt; filteredConfigs.size(); i++)
+        {
+            configs[i] = const_cast&lt;Config*&gt;(filteredConfigs[i]);
+        }
+    }
+    *num_config = filteredConfigs.size();
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)&quot;,
+          dpy, config, attribute, value);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Config *configuration = static_cast&lt;Config*&gt;(config);
+
+    Error error = ValidateConfig(display, configuration);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (!display-&gt;getConfigAttrib(configuration, attribute, value))
+    {
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_FALSE;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, &quot;
+          &quot;const EGLint *attrib_list = 0x%0.8p)&quot;, dpy, config, win, attrib_list);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Config *configuration = static_cast&lt;Config*&gt;(config);
+    AttributeMap attributes(attrib_list);
+
+    Error error = ValidateCreateWindowSurface(display, configuration, win, attributes);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_SURFACE;
+    }
+
+    egl::Surface *surface = nullptr;
+    error = display-&gt;createWindowSurface(configuration, win, attributes, &amp;surface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_SURFACE;
+    }
+
+    return static_cast&lt;EGLSurface&gt;(surface);
+}
+
+EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)&quot;,
+          dpy, config, attrib_list);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Config *configuration = static_cast&lt;Config*&gt;(config);
+    AttributeMap attributes(attrib_list);
+
+    Error error = ValidateCreatePbufferSurface(display, configuration, attributes);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_SURFACE;
+    }
+
+    egl::Surface *surface = nullptr;
+    error = display-&gt;createPbufferSurface(configuration, attributes, &amp;surface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_SURFACE;
+    }
+
+    return static_cast&lt;EGLSurface&gt;(surface);
+}
+
+EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativePixmapType pixmap = 0x%0.8p, &quot;
+          &quot;const EGLint *attrib_list = 0x%0.8p)&quot;, dpy, config, pixmap, attrib_list);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Config *configuration = static_cast&lt;Config*&gt;(config);
+
+    Error error = ValidateConfig(display, configuration);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_SURFACE;
+    }
+
+    UNIMPLEMENTED();   // FIXME
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_NO_SURFACE;
+}
+
+EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)&quot;, dpy, surface);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = static_cast&lt;Surface*&gt;(surface);
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (surface == EGL_NO_SURFACE)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    display-&gt;destroySurface((Surface*)surface);
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)&quot;,
+          dpy, surface, attribute, value);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = (Surface*)surface;
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (surface == EGL_NO_SURFACE)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    switch (attribute)
+    {
+      case EGL_VG_ALPHA_FORMAT:
+        UNIMPLEMENTED();   // FIXME
+        break;
+      case EGL_VG_COLORSPACE:
+        UNIMPLEMENTED();   // FIXME
+        break;
+      case EGL_CONFIG_ID:
+        *value = eglSurface-&gt;getConfig()-&gt;configID;
+        break;
+      case EGL_HEIGHT:
+        *value = eglSurface-&gt;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:
+        *value = eglSurface-&gt;getPixelAspectRatio();
+        break;
+      case EGL_RENDER_BUFFER:
+        *value = eglSurface-&gt;getRenderBuffer();
+        break;
+      case EGL_SWAP_BEHAVIOR:
+        *value = eglSurface-&gt;getSwapBehavior();
+        break;
+      case EGL_TEXTURE_FORMAT:
+        *value = eglSurface-&gt;getTextureFormat();
+        break;
+      case EGL_TEXTURE_TARGET:
+        *value = eglSurface-&gt;getTextureTarget();
+        break;
+      case EGL_VERTICAL_RESOLUTION:
+        UNIMPLEMENTED();   // FIXME
+        break;
+      case EGL_WIDTH:
+        *value = eglSurface-&gt;getWidth();
+        break;
+      case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
+        if (!display-&gt;getExtensions().postSubBuffer)
+        {
+            SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+            return EGL_FALSE;
+        }
+        *value = eglSurface-&gt;isPostSubBufferSupported();
+        break;
+      case EGL_FIXED_SIZE_ANGLE:
+        if (!display-&gt;getExtensions().windowFixedSize)
+        {
+            SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+            return EGL_FALSE;
+        }
+        *value = eglSurface-&gt;isFixedSize();
+        break;
+      default:
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_FALSE;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = 0x%0.8p, &quot;
+          &quot;const EGLint *attrib_list = 0x%0.8p)&quot;, dpy, config, share_context, attrib_list);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Config *configuration = static_cast&lt;Config*&gt;(config);
+    gl::Context* sharedGLContext = static_cast&lt;gl::Context*&gt;(share_context);
+    AttributeMap attributes(attrib_list);
+
+    Error error = ValidateCreateContext(display, configuration, sharedGLContext, attributes);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_CONTEXT;
+    }
+
+    gl::Context *context = nullptr;
+    error = display-&gt;createContext(configuration, sharedGLContext, attributes, &amp;context);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_CONTEXT;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return static_cast&lt;EGLContext&gt;(context);
+}
+
+EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)&quot;, dpy, ctx);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    gl::Context *context = static_cast&lt;gl::Context*&gt;(ctx);
+
+    Error error = ValidateContext(display, context);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (ctx == EGL_NO_CONTEXT)
+    {
+        SetGlobalError(Error(EGL_BAD_CONTEXT));
+        return EGL_FALSE;
+    }
+
+    if (context == GetGlobalContext())
+    {
+        SetGlobalDisplay(NULL);
+        SetGlobalContext(NULL);
+    }
+
+    display-&gt;destroyContext(context);
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface draw = 0x%0.8p, EGLSurface read = 0x%0.8p, EGLContext ctx = 0x%0.8p)&quot;,
+          dpy, draw, read, ctx);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    gl::Context *context = static_cast&lt;gl::Context*&gt;(ctx);
+
+    bool noContext = (ctx == EGL_NO_CONTEXT);
+    bool noSurface = (draw == EGL_NO_SURFACE || read == EGL_NO_SURFACE);
+    if (noContext != noSurface)
+    {
+        SetGlobalError(Error(EGL_BAD_MATCH));
+        return EGL_FALSE;
+    }
+
+    if (dpy == EGL_NO_DISPLAY)
+    {
+        SetGlobalError(Error(EGL_BAD_DISPLAY, &quot;'dpy' not a valid EGLDisplay handle&quot;));
+        return EGL_FALSE;
+    }
+
+    // EGL 1.5 spec: dpy can be uninitialized if all other parameters are null
+    if (dpy != EGL_NO_DISPLAY &amp;&amp; !display-&gt;isInitialized() &amp;&amp;
+        (ctx != EGL_NO_CONTEXT || draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
+    {
+        SetGlobalError(Error(EGL_NOT_INITIALIZED, &quot;'dpy' not initialized&quot;));
+        return EGL_FALSE;
+    }
+
+    if (ctx != EGL_NO_CONTEXT)
+    {
+        Error error = ValidateContext(display, context);
+        if (error.isError())
+        {
+            SetGlobalError(error);
+            return EGL_FALSE;
+        }
+    }
+
+    if (dpy != EGL_NO_DISPLAY &amp;&amp; display-&gt;isInitialized())
+    {
+        if (display-&gt;testDeviceLost())
+        {
+            display-&gt;notifyDeviceLost();
+            return EGL_FALSE;
+        }
+
+        if (display-&gt;isDeviceLost())
+        {
+            SetGlobalError(Error(EGL_CONTEXT_LOST));
+            return EGL_FALSE;
+        }
+    }
+
+    Surface *drawSurface = static_cast&lt;Surface*&gt;(draw);
+    if (draw != EGL_NO_SURFACE)
+    {
+        Error error = ValidateSurface(display, drawSurface);
+        if (error.isError())
+        {
+            SetGlobalError(error);
+            return EGL_FALSE;
+        }
+    }
+
+    Surface *readSurface = static_cast&lt;Surface*&gt;(read);
+    if (read != EGL_NO_SURFACE)
+    {
+        Error error = ValidateSurface(display, readSurface);
+        if (error.isError())
+        {
+            SetGlobalError(error);
+            return EGL_FALSE;
+        }
+    }
+
+    if (draw != read)
+    {
+        UNIMPLEMENTED();   // FIXME
+    }
+
+    gl::Context *previousContext = GetGlobalContext();
+
+    SetGlobalDisplay(display);
+    SetGlobalDrawSurface(drawSurface);
+    SetGlobalReadSurface(readSurface);
+    SetGlobalContext(context);
+
+    display-&gt;makeCurrent(drawSurface, readSurface, context);
+
+    // Release the surface from the previously-current context, to allow
+    // destroyed surfaces to delete themselves.
+    if (previousContext != nullptr &amp;&amp; context != previousContext)
+    {
+        previousContext-&gt;releaseSurface();
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw)
+{
+    EVENT(&quot;(EGLint readdraw = %d)&quot;, readdraw);
+
+    if (readdraw == EGL_READ)
+    {
+        SetGlobalError(Error(EGL_SUCCESS));
+        return GetGlobalReadSurface();
+    }
+    else if (readdraw == EGL_DRAW)
+    {
+        SetGlobalError(Error(EGL_SUCCESS));
+        return GetGlobalDrawSurface();
+    }
+    else
+    {
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_NO_SURFACE;
+    }
+}
+
+EGLDisplay EGLAPIENTRY GetCurrentDisplay(void)
+{
+    EVENT(&quot;()&quot;);
+
+    EGLDisplay dpy = GetGlobalDisplay();
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return dpy;
+}
+
+EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)&quot;,
+          dpy, ctx, attribute, value);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    gl::Context *context = static_cast&lt;gl::Context*&gt;(ctx);
+
+    Error error = ValidateContext(display, context);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    switch (attribute)
+    {
+      case EGL_CONFIG_ID:
+        *value = context-&gt;getConfigID();
+        break;
+      case EGL_CONTEXT_CLIENT_TYPE:
+        *value = context-&gt;getClientType();
+        break;
+      case EGL_CONTEXT_CLIENT_VERSION:
+        *value = context-&gt;getClientVersion();
+        break;
+      case EGL_RENDER_BUFFER:
+        *value = context-&gt;getRenderBuffer();
+        break;
+      default:
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_FALSE;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY WaitGL(void)
+{
+    EVENT(&quot;()&quot;);
+
+    UNIMPLEMENTED();   // FIXME
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return 0;
+}
+
+EGLBoolean EGLAPIENTRY WaitNative(EGLint engine)
+{
+    EVENT(&quot;(EGLint engine = %d)&quot;, engine);
+
+    UNIMPLEMENTED();   // FIXME
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return 0;
+}
+
+EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)&quot;, dpy, surface);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = (Surface*)surface;
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (display-&gt;isDeviceLost())
+    {
+        SetGlobalError(Error(EGL_CONTEXT_LOST));
+        return EGL_FALSE;
+    }
+
+    if (surface == EGL_NO_SURFACE)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    error = eglSurface-&gt;swap();
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)&quot;, dpy, surface, target);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = static_cast&lt;Surface*&gt;(surface);
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (display-&gt;isDeviceLost())
+    {
+        SetGlobalError(Error(EGL_CONTEXT_LOST));
+        return EGL_FALSE;
+    }
+
+    UNIMPLEMENTED();   // FIXME
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return 0;
+}
+
+// EGL 1.1
+EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)&quot;, dpy, surface, buffer);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = static_cast&lt;Surface*&gt;(surface);
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (buffer != EGL_BACK_BUFFER)
+    {
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_FALSE;
+    }
+
+    if (surface == EGL_NO_SURFACE || eglSurface-&gt;getType() == EGL_WINDOW_BIT)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    if (eglSurface-&gt;getBoundTexture())
+    {
+        SetGlobalError(Error(EGL_BAD_ACCESS));
+        return EGL_FALSE;
+    }
+
+    if (eglSurface-&gt;getTextureFormat() == EGL_NO_TEXTURE)
+    {
+        SetGlobalError(Error(EGL_BAD_MATCH));
+        return EGL_FALSE;
+    }
+
+    gl::Context *context = GetGlobalContext();
+    if (context)
+    {
+        gl::Texture *textureObject = context-&gt;getTargetTexture(GL_TEXTURE_2D);
+        ASSERT(textureObject != NULL);
+
+        if (textureObject-&gt;isImmutable())
+        {
+            SetGlobalError(Error(EGL_BAD_MATCH));
+            return EGL_FALSE;
+        }
+
+        egl::Error error = eglSurface-&gt;bindTexImage(textureObject, buffer);
+        if (error.isError())
+        {
+            SetGlobalError(error);
+            return EGL_FALSE;
+        }
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint value = %d)&quot;,
+        dpy, surface, attribute, value);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = static_cast&lt;Surface*&gt;(surface);
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    UNIMPLEMENTED();   // FIXME
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)&quot;, dpy, surface, buffer);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = static_cast&lt;Surface*&gt;(surface);
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (buffer != EGL_BACK_BUFFER)
+    {
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_FALSE;
+    }
+
+    if (surface == EGL_NO_SURFACE || eglSurface-&gt;getType() == EGL_WINDOW_BIT)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    if (eglSurface-&gt;getTextureFormat() == EGL_NO_TEXTURE)
+    {
+        SetGlobalError(Error(EGL_BAD_MATCH));
+        return EGL_FALSE;
+    }
+
+    gl::Texture *texture = eglSurface-&gt;getBoundTexture();
+
+    if (texture)
+    {
+        egl::Error error = eglSurface-&gt;releaseTexImage(buffer);
+        if (error.isError())
+        {
+            SetGlobalError(error);
+            return EGL_FALSE;
+        }
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLint interval = %d)&quot;, dpy, interval);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+
+    Error error = ValidateDisplay(display);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    Surface *draw_surface = static_cast&lt;Surface*&gt;(GetGlobalDrawSurface());
+
+    if (draw_surface == NULL)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    const egl::Config *surfaceConfig = draw_surface-&gt;getConfig();
+    EGLint clampedInterval = std::min(std::max(interval, surfaceConfig-&gt;minSwapInterval), surfaceConfig-&gt;maxSwapInterval);
+
+    draw_surface-&gt;setSwapInterval(clampedInterval);
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+
+// EGL 1.2
+EGLBoolean EGLAPIENTRY BindAPI(EGLenum api)
+{
+    EVENT(&quot;(EGLenum api = 0x%X)&quot;, api);
+
+    switch (api)
+    {
+      case EGL_OPENGL_API:
+      case EGL_OPENVG_API:
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_FALSE;   // Not supported by this implementation
+      case EGL_OPENGL_ES_API:
+        break;
+      default:
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_FALSE;
+    }
+
+    SetGlobalAPI(api);
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLenum EGLAPIENTRY QueryAPI(void)
+{
+    EVENT(&quot;()&quot;);
+
+    EGLenum API = GetGlobalAPI();
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return API;
+}
+
+EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%0.8p, &quot;
+          &quot;EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)&quot;,
+          dpy, buftype, buffer, config, attrib_list);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Config *configuration = static_cast&lt;Config*&gt;(config);
+    AttributeMap attributes(attrib_list);
+
+    Error error = ValidateCreatePbufferFromClientBuffer(display, buftype, buffer, configuration, attributes);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_SURFACE;
+    }
+
+    egl::Surface *surface = nullptr;
+    error = display-&gt;createPbufferFromClientBuffer(configuration, buffer, attributes, &amp;surface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_NO_SURFACE;
+    }
+
+    return static_cast&lt;EGLSurface&gt;(surface);
+}
+
+EGLBoolean EGLAPIENTRY ReleaseThread(void)
+{
+    EVENT(&quot;()&quot;);
+
+    MakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+EGLBoolean EGLAPIENTRY WaitClient(void)
+{
+    EVENT(&quot;()&quot;);
+
+    UNIMPLEMENTED();   // FIXME
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return 0;
+}
+
+// EGL 1.4
+EGLContext EGLAPIENTRY GetCurrentContext(void)
+{
+    EVENT(&quot;()&quot;);
+
+    gl::Context *context = GetGlobalContext();
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return static_cast&lt;EGLContext&gt;(context);
+}
+
+// EGL 1.5
+EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLenum type = 0x%X, const EGLint* attrib_list = 0x%0.8p)&quot;, dpy, type, attrib_list);
+
+    UNIMPLEMENTED();
+    return EGL_NO_SYNC;
+}
+
+EGLBoolean EGLAPIENTRY DestroySync(EGLDisplay dpy, EGLSync sync)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p)&quot;, dpy, sync);
+
+    UNIMPLEMENTED();
+    return EGL_FALSE;
+}
+
+EGLint EGLAPIENTRY ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint flags = 0x%X, EGLTime timeout = %d)&quot;, dpy, sync, flags, timeout);
+
+    UNIMPLEMENTED();
+    return 0;
+}
+
+EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint attribute = 0x%X, EGLAttrib *value = 0x%0.8p)&quot;, dpy, sync, attribute, value);
+
+    UNIMPLEMENTED();
+    return EGL_FALSE;
+}
+
+EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLenum target = 0x%X, &quot;
+          &quot;EGLClientBuffer buffer = 0x%0.8p, const EGLAttrib *attrib_list = 0x%0.8p)&quot;,
+          dpy, ctx, target, buffer, attrib_list);
+
+    UNIMPLEMENTED();
+    return EGL_NO_IMAGE;
+}
+
+EGLBoolean EGLAPIENTRY DestroyImage(EGLDisplay dpy, EGLImage image)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLImage image = 0x%0.8p)&quot;, dpy, image);
+
+    UNIMPLEMENTED();
+    return EGL_FALSE;
+}
+
+EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
+{
+    EVENT(&quot;(EGLenum platform = %d, void* native_display = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)&quot;,
+          platform, native_display, attrib_list);
+
+    UNIMPLEMENTED();
+    return EGL_NO_DISPLAY;
+}
+
+EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void* native_window = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)&quot;,
+          dpy, config, native_window, attrib_list);
+
+    UNIMPLEMENTED();
+    return EGL_NO_SURFACE;
+}
+
+EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void* native_pixmap = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)&quot;,
+          dpy, config, native_pixmap, attrib_list);
+
+    UNIMPLEMENTED();
+    return EGL_NO_SURFACE;
+}
+
+EGLBoolean EGLAPIENTRY WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint flags = 0x%X)&quot;, dpy, sync, flags);
+
+    UNIMPLEMENTED();
+    return EGL_FALSE;
+}
+
+__eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname)
+{
+    EVENT(&quot;(const char *procname = \&quot;%s\&quot;)&quot;, procname);
+
+    struct Extension
+    {
+        const char *name;
+        __eglMustCastToProperFunctionPointerType address;
+    };
+
+    static const Extension extensions[] =
+    {
+        { &quot;eglQueryDeviceAttribEXT&quot;, (__eglMustCastToProperFunctionPointerType)QueryDeviceAttribEXT },
+        { &quot;eglQueryDeviceStringEXT&quot;, (__eglMustCastToProperFunctionPointerType)QueryDeviceStringEXT },
+        { &quot;eglQueryDisplayAttribEXT&quot;, (__eglMustCastToProperFunctionPointerType)QueryDisplayAttribEXT },
+        { &quot;eglQuerySurfacePointerANGLE&quot;, (__eglMustCastToProperFunctionPointerType)QuerySurfacePointerANGLE },
+        { &quot;eglPostSubBufferNV&quot;, (__eglMustCastToProperFunctionPointerType)PostSubBufferNV },
+        { &quot;eglGetPlatformDisplayEXT&quot;, (__eglMustCastToProperFunctionPointerType)GetPlatformDisplayEXT },
+        { &quot;glBlitFramebufferANGLE&quot;, (__eglMustCastToProperFunctionPointerType)gl::BlitFramebufferANGLE },
+        { &quot;glRenderbufferStorageMultisampleANGLE&quot;, (__eglMustCastToProperFunctionPointerType)gl::RenderbufferStorageMultisampleANGLE },
+        { &quot;glDeleteFencesNV&quot;, (__eglMustCastToProperFunctionPointerType)gl::DeleteFencesNV },
+        { &quot;glGenFencesNV&quot;, (__eglMustCastToProperFunctionPointerType)gl::GenFencesNV },
+        { &quot;glIsFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)gl::IsFenceNV },
+        { &quot;glTestFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)gl::TestFenceNV },
+        { &quot;glGetFenceivNV&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetFenceivNV },
+        { &quot;glFinishFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)gl::FinishFenceNV },
+        { &quot;glSetFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)gl::SetFenceNV },
+        { &quot;glGetTranslatedShaderSourceANGLE&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetTranslatedShaderSourceANGLE },
+        { &quot;glTexStorage2DEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::TexStorage2DEXT },
+        { &quot;glGetGraphicsResetStatusEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetGraphicsResetStatusEXT },
+        { &quot;glReadnPixelsEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::ReadnPixelsEXT },
+        { &quot;glGetnUniformfvEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetnUniformfvEXT },
+        { &quot;glGetnUniformivEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetnUniformivEXT },
+        { &quot;glGenQueriesEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::GenQueriesEXT },
+        { &quot;glDeleteQueriesEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::DeleteQueriesEXT },
+        { &quot;glIsQueryEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::IsQueryEXT },
+        { &quot;glBeginQueryEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::BeginQueryEXT },
+        { &quot;glEndQueryEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::EndQueryEXT },
+        { &quot;glGetQueryivEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetQueryivEXT },
+        { &quot;glGetQueryObjectuivEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetQueryObjectuivEXT },
+        { &quot;glDrawBuffersEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::DrawBuffersEXT },
+        { &quot;glVertexAttribDivisorANGLE&quot;, (__eglMustCastToProperFunctionPointerType)gl::VertexAttribDivisorANGLE },
+        { &quot;glDrawArraysInstancedANGLE&quot;, (__eglMustCastToProperFunctionPointerType)gl::DrawArraysInstancedANGLE },
+        { &quot;glDrawElementsInstancedANGLE&quot;, (__eglMustCastToProperFunctionPointerType)gl::DrawElementsInstancedANGLE },
+        { &quot;glGetProgramBinaryOES&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetProgramBinaryOES },
+        { &quot;glProgramBinaryOES&quot;, (__eglMustCastToProperFunctionPointerType)gl::ProgramBinaryOES },
+        { &quot;glGetBufferPointervOES&quot;, (__eglMustCastToProperFunctionPointerType)gl::GetBufferPointervOES },
+        { &quot;glMapBufferOES&quot;, (__eglMustCastToProperFunctionPointerType)gl::MapBufferOES },
+        { &quot;glUnmapBufferOES&quot;, (__eglMustCastToProperFunctionPointerType)gl::UnmapBufferOES },
+        { &quot;glMapBufferRangeEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::MapBufferRangeEXT },
+        { &quot;glFlushMappedBufferRangeEXT&quot;, (__eglMustCastToProperFunctionPointerType)gl::FlushMappedBufferRangeEXT },
+        { &quot;&quot;, NULL },
+    };
+
+    for (const Extension *extension = &amp;extensions[0]; extension-&gt;address != nullptr; extension++)
+    {
+        if (strcmp(procname, extension-&gt;name) == 0)
+        {
+            return reinterpret_cast&lt;__eglMustCastToProperFunctionPointerType&gt;(extension-&gt;address);
+        }
+    }
+
+    return NULL;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_eglh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_egl.h : Defines the EGL entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTSEGL_H_
+#define LIBGLESV2_ENTRYPOINTSEGL_H_
+
+#include &lt;EGL/egl.h&gt;
+#include &lt;export.h&gt;
+
+namespace egl
+{
+
+// EGL 1.0
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+ANGLE_EXPORT EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetCurrentDisplay(void);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw);
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id);
+ANGLE_EXPORT EGLint EGLAPIENTRY GetError(void);
+ANGLE_EXPORT __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+ANGLE_EXPORT const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitGL(void);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitNative(EGLint engine);
+
+// EGL 1.1
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval);
+
+// EGL 1.2
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY BindAPI(EGLenum api);
+ANGLE_EXPORT EGLenum EGLAPIENTRY QueryAPI(void);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseThread(void);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitClient(void);
+
+// EGL 1.4
+ANGLE_EXPORT EGLContext EGLAPIENTRY GetCurrentContext(void);
+
+// EGL 1.5
+ANGLE_EXPORT EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroySync(EGLDisplay dpy, EGLSync sync);
+ANGLE_EXPORT EGLint EGLAPIENTRY ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+ANGLE_EXPORT EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyImage(EGLDisplay dpy, EGLImage image);
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags);
+
+}
+
+#endif // LIBGLESV2_ENTRYPOINTSEGL_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_egl_extcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,381 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_ext.cpp : Implements the EGL extension entry points.
+
+#include &quot;libGLESv2/entry_points_egl_ext.h&quot;
+#include &quot;libGLESv2/global_state.h&quot;
+
+#include &quot;libANGLE/Display.h&quot;
+#include &quot;libANGLE/Device.h&quot;
+#include &quot;libANGLE/Surface.h&quot;
+#include &quot;libANGLE/validationEGL.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace egl
+{
+
+// EGL_ANGLE_query_surface_pointer
+EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, void **value = 0x%0.8p)&quot;,
+          dpy, surface, attribute, value);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = static_cast&lt;Surface*&gt;(surface);
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (!display-&gt;getExtensions().querySurfacePointer)
+    {
+        SetGlobalError(Error(EGL_SUCCESS));
+        return EGL_FALSE;
+    }
+
+    if (surface == EGL_NO_SURFACE)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    // validate the attribute parameter
+    switch (attribute)
+    {
+      case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
+        if (!display-&gt;getExtensions().surfaceD3DTexture2DShareHandle)
+        {
+            SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+            return EGL_FALSE;
+        }
+        break;
+
+      default:
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_FALSE;
+    }
+
+    error = eglSurface-&gt;querySurfacePointerANGLE(attribute, value);
+    SetGlobalError(error);
+    return (error.isError() ? EGL_FALSE : EGL_TRUE);
+}
+
+
+// EGL_NV_post_sub_buffer
+EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint x = %d, EGLint y = %d, EGLint width = %d, EGLint height = %d)&quot;, dpy, surface, x, y, width, height);
+
+    if (x &lt; 0 || y &lt; 0 || width &lt; 0 || height &lt; 0)
+    {
+        SetGlobalError(Error(EGL_BAD_PARAMETER));
+        return EGL_FALSE;
+    }
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Surface *eglSurface = static_cast&lt;Surface*&gt;(surface);
+
+    Error error = ValidateSurface(display, eglSurface);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    if (display-&gt;isDeviceLost())
+    {
+        SetGlobalError(Error(EGL_CONTEXT_LOST));
+        return EGL_FALSE;
+    }
+
+    if (surface == EGL_NO_SURFACE)
+    {
+        SetGlobalError(Error(EGL_BAD_SURFACE));
+        return EGL_FALSE;
+    }
+
+    if (!display-&gt;getExtensions().postSubBuffer)
+    {
+        // Spec is not clear about how this should be handled.
+        SetGlobalError(Error(EGL_SUCCESS));
+        return EGL_TRUE;
+    }
+
+    error = eglSurface-&gt;postSubBuffer(x, y, width, height);
+    if (error.isError())
+    {
+        SetGlobalError(error);
+        return EGL_FALSE;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return EGL_TRUE;
+}
+
+// EGL_EXT_platform_base
+EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
+{
+    EVENT(&quot;(EGLenum platform = %d, void* native_display = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)&quot;,
+          platform, native_display, attrib_list);
+
+    const ClientExtensions &amp;clientExtensions = Display::getClientExtensions();
+
+    switch (platform)
+    {
+      case EGL_PLATFORM_ANGLE_ANGLE:
+        if (!clientExtensions.platformANGLE)
+        {
+            SetGlobalError(Error(EGL_BAD_PARAMETER));
+            return EGL_NO_DISPLAY;
+        }
+        break;
+
+      default:
+        SetGlobalError(Error(EGL_BAD_CONFIG));
+        return EGL_NO_DISPLAY;
+    }
+
+    EGLint platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
+    EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE;
+    bool majorVersionSpecified = false;
+    bool minorVersionSpecified = false;
+    bool enableAutoTrimSpecified = false;
+
+    if (attrib_list)
+    {
+        for (const EGLint *curAttrib = attrib_list; curAttrib[0] != EGL_NONE; curAttrib += 2)
+        {
+            switch (curAttrib[0])
+            {
+              case EGL_PLATFORM_ANGLE_TYPE_ANGLE:
+                switch (curAttrib[1])
+                {
+                  case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE:
+                    break;
+
+                  case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
+                  case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
+                    if (!clientExtensions.platformANGLED3D)
+                    {
+                        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+                        return EGL_NO_DISPLAY;
+                    }
+                    break;
+
+                  case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
+                  case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
+                    if (!clientExtensions.platformANGLEOpenGL)
+                    {
+                        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+                        return EGL_NO_DISPLAY;
+                    }
+                    break;
+
+                  default:
+                    SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+                    return EGL_NO_DISPLAY;
+                }
+                platformType = curAttrib[1];
+                break;
+
+              case EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE:
+                if (curAttrib[1] != EGL_DONT_CARE)
+                {
+                    majorVersionSpecified = true;
+                }
+                break;
+
+              case EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE:
+                if (curAttrib[1] != EGL_DONT_CARE)
+                {
+                    minorVersionSpecified = true;
+                }
+                break;
+
+              case EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE:
+                switch (curAttrib[1])
+                {
+                  case EGL_TRUE:
+                  case EGL_FALSE:
+                    break;
+                  default:
+                    SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+                    return EGL_NO_DISPLAY;
+                }
+                enableAutoTrimSpecified = true;
+                break;
+
+              case EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE:
+                if (!clientExtensions.platformANGLED3D)
+                {
+                    SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+                    return EGL_NO_DISPLAY;
+                }
+
+                switch (curAttrib[1])
+                {
+                  case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE:
+                  case EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE:
+                  case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE:
+                  case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE:
+                    break;
+
+                  default:
+                    SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+                    return EGL_NO_DISPLAY;
+                }
+                deviceType = curAttrib[1];
+                break;
+
+              default:
+                break;
+            }
+        }
+    }
+
+    if (!majorVersionSpecified &amp;&amp; minorVersionSpecified)
+    {
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_NO_DISPLAY;
+    }
+
+    if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE &amp;&amp;
+        platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE, &quot;EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE requires a device type of &quot;
+                                                &quot;EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.&quot;));
+        return EGL_NO_DISPLAY;
+    }
+
+    if (enableAutoTrimSpecified &amp;&amp;
+        platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
+    {
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE, &quot;EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE requires a device type of &quot;
+                                                &quot;EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.&quot;));
+        return EGL_NO_DISPLAY;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+
+    EGLNativeDisplayType displayId = static_cast&lt;EGLNativeDisplayType&gt;(native_display);
+    return Display::getDisplay(displayId, AttributeMap(attrib_list));
+}
+
+// EGL_EXT_device_query
+EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value)
+{
+    EVENT(&quot;(EGLDeviceEXT device = 0x%0.8p, EGLint attribute = %d, EGLAttrib *value = 0x%0.8p)&quot;,
+          device, attribute, value);
+
+    Device *dev = static_cast&lt;Device*&gt;(device);
+    if (dev == EGL_NO_DEVICE_EXT)
+    {
+        SetGlobalError(Error(EGL_BAD_ACCESS));
+        return EGL_FALSE;
+    }
+
+    Display *display = dev-&gt;getDisplay();
+    Error error(EGL_SUCCESS);
+
+    if (!display-&gt;getExtensions().deviceQuery)
+    {
+        SetGlobalError(Error(EGL_BAD_ACCESS));
+        return EGL_FALSE;
+    }
+
+    // validate the attribute parameter
+    switch (attribute)
+    {
+      case EGL_D3D11_DEVICE_ANGLE:
+        if (!dev-&gt;getExtensions().deviceD3D || dev-&gt;getType() != EGL_D3D11_DEVICE_ANGLE)
+        {
+            SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+            return EGL_FALSE;
+        }
+        error = dev-&gt;getDevice(value);
+        break;
+      case EGL_D3D9_DEVICE_ANGLE:
+        if (!dev-&gt;getExtensions().deviceD3D || dev-&gt;getType() != EGL_D3D9_DEVICE_ANGLE)
+        {
+            SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+            return EGL_FALSE;
+        }
+        error = dev-&gt;getDevice(value);
+        break;
+      default:
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_FALSE;
+    }
+
+    SetGlobalError(error);
+    return (error.isError() ? EGL_FALSE : EGL_TRUE);
+}
+
+// EGL_EXT_device_query
+const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
+{
+    EVENT(&quot;(EGLDeviceEXT device = 0x%0.8p, EGLint name = %d)&quot;,
+          device, name);
+
+    Device *dev = static_cast&lt;Device*&gt;(device);
+    if (dev == EGL_NO_DEVICE_EXT)
+    {
+        SetGlobalError(Error(EGL_BAD_DEVICE_EXT));
+        return nullptr;
+    }
+
+    const char *result;
+    switch (name)
+    {
+      case EGL_EXTENSIONS:
+        result = dev-&gt;getExtensionString().c_str();
+        break;
+      default:
+        SetGlobalError(Error(EGL_BAD_DEVICE_EXT));
+        return nullptr;
+    }
+
+    SetGlobalError(Error(EGL_SUCCESS));
+    return result;
+}
+
+// EGL_EXT_device_query
+EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
+{
+    EVENT(&quot;(EGLDisplay dpy = 0x%0.8p, EGLint attribute = %d, EGLAttrib *value = 0x%0.8p)&quot;,
+          dpy, attribute, value);
+
+    Display *display = static_cast&lt;Display*&gt;(dpy);
+    Error error(EGL_SUCCESS);
+
+    if (!display-&gt;getExtensions().deviceQuery)
+    {
+        SetGlobalError(Error(EGL_BAD_ACCESS));
+        return EGL_FALSE;
+    }
+
+    // validate the attribute parameter
+    switch (attribute)
+    {
+      case EGL_DEVICE_EXT:
+        *value = reinterpret_cast&lt;EGLAttrib&gt;(display-&gt;getDevice());
+        break;
+
+      default:
+        SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+        return EGL_FALSE;
+    }
+
+    SetGlobalError(error);
+    return (error.isError() ? EGL_FALSE : EGL_TRUE);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_egl_exth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_egl_ext.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_egl_ext.h : Defines the EGL extension entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTSEGLEXT_H_
+#define LIBGLESV2_ENTRYPOINTSEGLEXT_H_
+
+#include &lt;EGL/egl.h&gt;
+#include &lt;EGL/eglext.h&gt;
+#include &lt;export.h&gt;
+
+namespace egl
+{
+
+// EGL_ANGLE_query_surface_pointer
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+
+// EGL_NV_post_sub_buffer
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+
+// EGL_EXT_platform_base
+ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list);
+
+// EGL_EXT_device_query
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+ANGLE_EXPORT const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name);
+
+}
+
+#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,4346 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_2_0.cpp : Implements the GLES 2.0 entry points.
+
+#include &quot;libGLESv2/entry_points_gles_2_0.h&quot;
+#include &quot;libGLESv2/global_state.h&quot;
+
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Compiler.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/Renderbuffer.h&quot;
+#include &quot;libANGLE/Shader.h&quot;
+#include &quot;libANGLE/Program.h&quot;
+#include &quot;libANGLE/Texture.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+#include &quot;libANGLE/VertexAttribute.h&quot;
+#include &quot;libANGLE/FramebufferAttachment.h&quot;
+
+#include &quot;libANGLE/validationES.h&quot;
+#include &quot;libANGLE/validationES2.h&quot;
+#include &quot;libANGLE/validationES3.h&quot;
+#include &quot;libANGLE/queryconversions.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/utilities.h&quot;
+#include &quot;common/version.h&quot;
+
+namespace gl
+{
+
+void GL_APIENTRY ActiveTexture(GLenum texture)
+{
+    EVENT(&quot;(GLenum texture = 0x%X)&quot;, texture);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (texture &lt; GL_TEXTURE0 || texture &gt; GL_TEXTURE0 + context-&gt;getCaps().maxCombinedTextureImageUnits - 1)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        context-&gt;getState().setActiveSampler(texture - GL_TEXTURE0);
+    }
+}
+
+void GL_APIENTRY AttachShader(GLuint program, GLuint shader)
+{
+    EVENT(&quot;(GLuint program = %d, GLuint shader = %d)&quot;, program, shader);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (!shaderObject)
+        {
+            if (context-&gt;getProgram(shader))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (!programObject-&gt;attachShader(shaderObject))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar* name)
+{
+    EVENT(&quot;(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)&quot;, program, index, name);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (strncmp(name, &quot;gl_&quot;, 3) == 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        programObject-&gt;bindAttributeLocation(index, name);
+    }
+}
+
+void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint buffer = %d)&quot;, target, buffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (target)
+        {
+          case GL_ARRAY_BUFFER:
+            context-&gt;bindArrayBuffer(buffer);
+            return;
+          case GL_ELEMENT_ARRAY_BUFFER:
+            context-&gt;bindElementArrayBuffer(buffer);
+            return;
+          case GL_COPY_READ_BUFFER:
+            context-&gt;bindCopyReadBuffer(buffer);
+            return;
+          case GL_COPY_WRITE_BUFFER:
+            context-&gt;bindCopyWriteBuffer(buffer);
+            return;
+          case GL_PIXEL_PACK_BUFFER:
+            context-&gt;bindPixelPackBuffer(buffer);
+            return;
+          case GL_PIXEL_UNPACK_BUFFER:
+            context-&gt;bindPixelUnpackBuffer(buffer);
+            return;
+          case GL_UNIFORM_BUFFER:
+            context-&gt;bindGenericUniformBuffer(buffer);
+            return;
+          case GL_TRANSFORM_FEEDBACK_BUFFER:
+            context-&gt;bindGenericTransformFeedbackBuffer(buffer);
+            return;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint framebuffer = %d)&quot;, target, framebuffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidFramebufferTarget(target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
+        {
+            context-&gt;bindReadFramebuffer(framebuffer);
+        }
+
+        if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
+        {
+            context-&gt;bindDrawFramebuffer(framebuffer);
+        }
+    }
+}
+
+void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint renderbuffer = %d)&quot;, target, renderbuffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (target != GL_RENDERBUFFER)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        context-&gt;bindRenderbuffer(renderbuffer);
+    }
+}
+
+void GL_APIENTRY BindTexture(GLenum target, GLuint texture)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint texture = %d)&quot;, target, texture);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Texture *textureObject = context-&gt;getTexture(texture);
+
+        if (textureObject &amp;&amp; textureObject-&gt;getTarget() != target &amp;&amp; texture != 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        switch (target)
+        {
+          case GL_TEXTURE_2D:
+          case GL_TEXTURE_CUBE_MAP:
+            break;
+
+          case GL_TEXTURE_3D:
+          case GL_TEXTURE_2D_ARRAY:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        context-&gt;bindTexture(target, texture);
+    }
+}
+
+void GL_APIENTRY BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+    EVENT(&quot;(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)&quot;,
+          red, green, blue, alpha);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setBlendColor(clamp01(red), clamp01(green), clamp01(blue), clamp01(alpha));
+    }
+}
+
+void GL_APIENTRY BlendEquation(GLenum mode)
+{
+    BlendEquationSeparate(mode, mode);
+}
+
+void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+    EVENT(&quot;(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)&quot;, modeRGB, modeAlpha);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (modeRGB)
+        {
+          case GL_FUNC_ADD:
+          case GL_FUNC_SUBTRACT:
+          case GL_FUNC_REVERSE_SUBTRACT:
+          case GL_MIN:
+          case GL_MAX:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (modeAlpha)
+        {
+          case GL_FUNC_ADD:
+          case GL_FUNC_SUBTRACT:
+          case GL_FUNC_REVERSE_SUBTRACT:
+          case GL_MIN:
+          case GL_MAX:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        context-&gt;getState().setBlendEquation(modeRGB, modeAlpha);
+    }
+}
+
+void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor)
+{
+    BlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
+}
+
+void GL_APIENTRY BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+    EVENT(&quot;(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)&quot;,
+          srcRGB, dstRGB, srcAlpha, dstAlpha);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        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:
+              context-&gt;recordError(Error(GL_INVALID_ENUM));
+              return;
+        }
+
+        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;
+
+          case GL_SRC_ALPHA_SATURATE:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        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:
+              context-&gt;recordError(Error(GL_INVALID_ENUM));
+              return;
+        }
+
+        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;
+
+          case GL_SRC_ALPHA_SATURATE:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        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 &amp;&amp; constantAlphaUsed)
+        {
+            ERR(&quot;Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL&quot;);
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        context-&gt;getState().setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
+    }
+}
+
+void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p, GLenum usage = %d)&quot;,
+          target, size, data, usage);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (size &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (usage)
+        {
+          case GL_STREAM_DRAW:
+          case GL_STATIC_DRAW:
+          case GL_DYNAMIC_DRAW:
+            break;
+
+          case GL_STREAM_READ:
+          case GL_STREAM_COPY:
+          case GL_STATIC_READ:
+          case GL_STATIC_COPY:
+          case GL_DYNAMIC_READ:
+          case GL_DYNAMIC_COPY:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          default:
+              context-&gt;recordError(Error(GL_INVALID_ENUM));
+              return;
+        }
+
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (!buffer)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Error error = buffer-&gt;bufferData(data, size, usage);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p)&quot;,
+          target, offset, size, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (size &lt; 0 || offset &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (!buffer)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (buffer-&gt;isMapped())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // Check for possible overflow of size + offset
+        if (!rx::IsUnsignedAdditionSafe&lt;size_t&gt;(size, offset))
+        {
+            context-&gt;recordError(Error(GL_OUT_OF_MEMORY));
+            return;
+        }
+
+        if (size + offset &gt; buffer-&gt;getSize())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (data == NULL)
+        {
+            return;
+        }
+
+        Error error = buffer-&gt;bufferSubData(data, size, offset);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target)
+{
+    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidFramebufferTarget(target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return 0;
+        }
+
+        Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+        ASSERT(framebuffer);
+
+        return framebuffer-&gt;checkStatus(context-&gt;getData());
+    }
+
+    return 0;
+}
+
+void GL_APIENTRY Clear(GLbitfield mask)
+{
+    EVENT(&quot;(GLbitfield mask = 0x%X)&quot;, mask);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Framebuffer *framebufferObject = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(framebufferObject);
+
+        if (framebufferObject-&gt;checkStatus(context-&gt;getData()) != GL_FRAMEBUFFER_COMPLETE)
+        {
+            context-&gt;recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
+            return;
+        }
+
+        if ((mask &amp; ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Error error = framebufferObject-&gt;clear(context-&gt;getData(), mask);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+    EVENT(&quot;(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)&quot;,
+          red, green, blue, alpha);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setColorClearValue(red, green, blue, alpha);
+    }
+}
+
+void GL_APIENTRY ClearDepthf(GLclampf depth)
+{
+    EVENT(&quot;(GLclampf depth = %f)&quot;, depth);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setDepthClearValue(depth);
+    }
+}
+
+void GL_APIENTRY ClearStencil(GLint s)
+{
+    EVENT(&quot;(GLint s = %d)&quot;, s);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setStencilClearValue(s);
+    }
+}
+
+void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+    EVENT(&quot;(GLboolean red = %d, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)&quot;,
+          red, green, blue, alpha);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE);
+    }
+}
+
+void GL_APIENTRY CompileShader(GLuint shader)
+{
+    EVENT(&quot;(GLuint shader = %d)&quot;, shader);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!shaderObject)
+        {
+            if (context-&gt;getProgram(shader))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        shaderObject-&gt;compile(context-&gt;getCompiler());
+    }
+}
+
+void GL_APIENTRY CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
+                                      GLint border, GLsizei imageSize, const GLvoid* data)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, &quot;
+          &quot;GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)&quot;,
+          target, level, internalformat, width, height, border, imageSize, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
+            !ValidateES2TexImageParameters(context, target, level, internalformat, true, false,
+                                           0, 0, width, height, border, GL_NONE, GL_NONE, data))
+        {
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
+            !ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
+                                           0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data))
+        {
+            return;
+        }
+
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(internalformat);
+        if (imageSize &lt; 0 || static_cast&lt;GLuint&gt;(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Extents size(width, height, 1);
+        Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+        Error error = texture-&gt;setCompressedImage(target, level, internalformat, size, context-&gt;getState().getUnpackState(), 
+                                                  reinterpret_cast&lt;const uint8_t *&gt;(data));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+                                         GLenum format, GLsizei imageSize, const GLvoid* data)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
+          &quot;GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, &quot;
+          &quot;GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)&quot;,
+          target, level, xoffset, yoffset, width, height, format, imageSize, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
+            !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true,
+                                           xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data))
+        {
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
+            !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
+                                           xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
+        {
+            return;
+        }
+
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(format);
+        if (imageSize &lt; 0 || static_cast&lt;GLuint&gt;(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+
+        Box area(xoffset, yoffset, 0, width, height, 1);
+        Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+        Error error = texture-&gt;setCompressedSubImage(target, level, area, format, context-&gt;getState().getUnpackState(),
+                                                     reinterpret_cast&lt;const uint8_t *&gt;(data));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, &quot;
+          &quot;GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)&quot;,
+          target, level, internalformat, x, y, width, height, border);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
+            !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false,
+                                               0, 0, x, y, width, height, border))
+        {
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
+            !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false,
+                                               0, 0, 0, x, y, width, height, border))
+        {
+            return;
+        }
+
+        Rectangle sourceArea(x, y, width, height);
+
+        const Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+        Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+        Error error = texture-&gt;copyImage(target, level, sourceArea, internalformat, framebuffer);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
+          &quot;GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;,
+          target, level, xoffset, yoffset, x, y, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
+            !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true,
+                                               xoffset, yoffset, x, y, width, height, 0))
+        {
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
+            !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true,
+                                               xoffset, yoffset, 0, x, y, width, height, 0))
+        {
+            return;
+        }
+
+        Offset destOffset(xoffset, yoffset, 0);
+        Rectangle sourceArea(x, y, width, height);
+
+        const Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+        Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+        Error error = texture-&gt;copySubImage(target, level, destOffset, sourceArea, framebuffer);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+GLuint GL_APIENTRY CreateProgram(void)
+{
+    EVENT(&quot;()&quot;);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        return context-&gt;createProgram();
+    }
+
+    return 0;
+}
+
+GLuint GL_APIENTRY CreateShader(GLenum type)
+{
+    EVENT(&quot;(GLenum type = 0x%X)&quot;, type);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (type)
+        {
+          case GL_FRAGMENT_SHADER:
+          case GL_VERTEX_SHADER:
+            return context-&gt;createShader(type);
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return 0;
+        }
+    }
+
+    return 0;
+}
+
+void GL_APIENTRY CullFace(GLenum mode)
+{
+    EVENT(&quot;(GLenum mode = 0x%X)&quot;, mode);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (mode)
+        {
+          case GL_FRONT:
+          case GL_BACK:
+          case GL_FRONT_AND_BACK:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        context-&gt;getState().setCullMode(mode);
+    }
+}
+
+void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* buffers = 0x%0.8p)&quot;, n, buffers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            context-&gt;deleteBuffer(buffers[i]);
+        }
+    }
+}
+
+void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* framebuffers = 0x%0.8p)&quot;, n, framebuffers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            if (framebuffers[i] != 0)
+            {
+                context-&gt;deleteFramebuffer(framebuffers[i]);
+            }
+        }
+    }
+}
+
+void GL_APIENTRY DeleteProgram(GLuint program)
+{
+    EVENT(&quot;(GLuint program = %d)&quot;, program);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (program == 0)
+        {
+            return;
+        }
+
+        if (!context-&gt;getProgram(program))
+        {
+            if(context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        context-&gt;deleteProgram(program);
+    }
+}
+
+void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* renderbuffers = 0x%0.8p)&quot;, n, renderbuffers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            context-&gt;deleteRenderbuffer(renderbuffers[i]);
+        }
+    }
+}
+
+void GL_APIENTRY DeleteShader(GLuint shader)
+{
+    EVENT(&quot;(GLuint shader = %d)&quot;, shader);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (shader == 0)
+        {
+            return;
+        }
+
+        if (!context-&gt;getShader(shader))
+        {
+            if(context-&gt;getProgram(shader))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        context-&gt;deleteShader(shader);
+    }
+}
+
+void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint* textures)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* textures = 0x%0.8p)&quot;, n, textures);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            if (textures[i] != 0)
+            {
+                context-&gt;deleteTexture(textures[i]);
+            }
+        }
+    }
+}
+
+void GL_APIENTRY DepthFunc(GLenum func)
+{
+    EVENT(&quot;(GLenum func = 0x%X)&quot;, func);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        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:
+            context-&gt;getState().setDepthFunc(func);
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY DepthMask(GLboolean flag)
+{
+    EVENT(&quot;(GLboolean flag = %u)&quot;, flag);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setDepthMask(flag != GL_FALSE);
+    }
+}
+
+void GL_APIENTRY DepthRangef(GLclampf zNear, GLclampf zFar)
+{
+    EVENT(&quot;(GLclampf zNear = %f, GLclampf zFar = %f)&quot;, zNear, zFar);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setDepthRange(zNear, zFar);
+    }
+}
+
+void GL_APIENTRY DetachShader(GLuint program, GLuint shader)
+{
+    EVENT(&quot;(GLuint program = %d, GLuint shader = %d)&quot;, program, shader);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!programObject)
+        {
+            Shader *shaderByProgramHandle;
+            shaderByProgramHandle = context-&gt;getShader(program);
+            if (!shaderByProgramHandle)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+        }
+
+        if (!shaderObject)
+        {
+            Program *programByShaderHandle = context-&gt;getProgram(shader);
+            if (!programByShaderHandle)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+        }
+
+        if (!programObject-&gt;detachShader(shaderObject))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY Disable(GLenum cap)
+{
+    EVENT(&quot;(GLenum cap = 0x%X)&quot;, cap);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidCap(context, cap))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        context-&gt;getState().setEnableFeature(cap, false);
+    }
+}
+
+void GL_APIENTRY DisableVertexAttribArray(GLuint index)
+{
+    EVENT(&quot;(GLuint index = %d)&quot;, index);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setEnableVertexAttribArray(index, false);
+    }
+}
+
+void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+    EVENT(&quot;(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)&quot;, mode, first, count);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateDrawArrays(context, mode, first, count, 0))
+        {
+            return;
+        }
+
+        Error error = context-&gt;drawArrays(mode, first, count, 0);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
+{
+    EVENT(&quot;(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p)&quot;,
+          mode, count, type, indices);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        rx::RangeUI indexRange;
+        if (!ValidateDrawElements(context, mode, count, type, indices, 0, &amp;indexRange))
+        {
+            return;
+        }
+
+        Error error = context-&gt;drawElements(mode, count, type, indices, 0, indexRange);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY Enable(GLenum cap)
+{
+    EVENT(&quot;(GLenum cap = 0x%X)&quot;, cap);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidCap(context, cap))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        context-&gt;getState().setEnableFeature(cap, true);
+    }
+}
+
+void GL_APIENTRY EnableVertexAttribArray(GLuint index)
+{
+    EVENT(&quot;(GLuint index = %d)&quot;, index);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setEnableVertexAttribArray(index, true);
+    }
+}
+
+void GL_APIENTRY Finish(void)
+{
+    EVENT(&quot;()&quot;);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Error error = context-&gt;finish();
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY Flush(void)
+{
+    EVENT(&quot;()&quot;);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Error error = context-&gt;flush();
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, &quot;
+          &quot;GLuint renderbuffer = %d)&quot;, target, attachment, renderbuffertarget, renderbuffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER &amp;&amp; renderbuffer != 0))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (!ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer))
+        {
+            return;
+        }
+
+        Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+        ASSERT(framebuffer);
+
+        if (renderbuffer != 0)
+        {
+            Renderbuffer *renderbufferObject = context-&gt;getRenderbuffer(renderbuffer);
+            framebuffer-&gt;setAttachment(GL_RENDERBUFFER, attachment, gl::ImageIndex::MakeInvalid(), renderbufferObject);
+        }
+        else
+        {
+            framebuffer-&gt;resetAttachment(attachment);
+        }
+    }
+}
+
+void GL_APIENTRY FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, &quot;
+          &quot;GLuint texture = %d, GLint level = %d)&quot;, target, attachment, textarget, texture, level);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level))
+        {
+            return;
+        }
+
+        Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+        ASSERT(framebuffer);
+
+        if (texture != 0)
+        {
+            Texture *textureObj = context-&gt;getTexture(texture);
+
+            ImageIndex index = ImageIndex::MakeInvalid();
+
+            if (textarget == GL_TEXTURE_2D)
+            {
+                index = ImageIndex::Make2D(level);
+            }
+            else
+            {
+                ASSERT(IsCubeMapTextureTarget(textarget));
+                index = ImageIndex::MakeCube(textarget, level);
+            }
+
+            framebuffer-&gt;setAttachment(GL_TEXTURE, attachment, index, textureObj);
+        }
+        else
+        {
+            framebuffer-&gt;resetAttachment(attachment);
+        }
+    }
+}
+
+void GL_APIENTRY FrontFace(GLenum mode)
+{
+    EVENT(&quot;(GLenum mode = 0x%X)&quot;, mode);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (mode)
+        {
+          case GL_CW:
+          case GL_CCW:
+            context-&gt;getState().setFrontFace(mode);
+            break;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GenBuffers(GLsizei n, GLuint* buffers)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* buffers = 0x%0.8p)&quot;, n, buffers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            buffers[i] = context-&gt;createBuffer();
+        }
+    }
+}
+
+void GL_APIENTRY GenerateMipmap(GLenum target)
+{
+    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidTextureTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Texture *texture = context-&gt;getTargetTexture(target);
+
+        if (texture == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        GLenum baseTarget = (target == GL_TEXTURE_CUBE_MAP) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : target;
+        GLenum internalFormat = texture-&gt;getInternalFormat(baseTarget, 0);
+        const TextureCaps &amp;formatCaps = context-&gt;getTextureCaps().get(internalFormat);
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(internalFormat);
+
+        // GenerateMipmap should not generate an INVALID_OPERATION for textures created with
+        // unsized formats or that are color renderable and filterable.  Since we do not track if
+        // the texture was created with sized or unsized format (only sized formats are stored),
+        // it is not possible to make sure the the LUMA formats can generate mipmaps (they should
+        // be able to) because they aren't color renderable.  Simply do a special case for LUMA
+        // textures since they're the only texture format that can be created with unsized formats
+        // that is not color renderable.  New unsized formats are unlikely to be added, since ES2
+        // was the last version to use add them.
+        bool isLUMA = internalFormat == GL_LUMINANCE8_EXT ||
+                      internalFormat == GL_LUMINANCE8_ALPHA8_EXT ||
+                      internalFormat == GL_ALPHA8_EXT;
+
+        if (formatInfo.depthBits &gt; 0 || formatInfo.stencilBits &gt; 0 || !formatCaps.filterable ||
+            (!formatCaps.renderable &amp;&amp; !isLUMA) || formatInfo.compressed)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // GL_EXT_sRGB does not support mipmap generation on sRGB textures
+        if (context-&gt;getClientVersion() == 2 &amp;&amp; formatInfo.colorEncoding == GL_SRGB)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // Non-power of 2 ES2 check
+        if (!context-&gt;getExtensions().textureNPOT &amp;&amp; (!isPow2(texture-&gt;getWidth(baseTarget, 0)) || !isPow2(texture-&gt;getHeight(baseTarget, 0))))
+        {
+            ASSERT(context-&gt;getClientVersion() &lt;= 2 &amp;&amp; (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP));
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // Cube completeness check
+        if (target == GL_TEXTURE_CUBE_MAP &amp;&amp; !texture-&gt;isCubeComplete())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Error error = texture-&gt;generateMipmaps();
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)&quot;, n, framebuffers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            framebuffers[i] = context-&gt;createFramebuffer();
+        }
+    }
+}
+
+void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)&quot;, n, renderbuffers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            renderbuffers[i] = context-&gt;createRenderbuffer();
+        }
+    }
+}
+
+void GL_APIENTRY GenTextures(GLsizei n, GLuint* textures)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* textures = 0x%0.8p)&quot;, n, textures);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            textures[i] = context-&gt;createTexture();
+        }
+    }
+}
+
+void GL_APIENTRY GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+    EVENT(&quot;(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, GLsizei *length = 0x%0.8p, &quot;
+          &quot;GLint *size = 0x%0.8p, GLenum *type = %0.8p, GLchar *name = %0.8p)&quot;,
+          program, index, bufsize, length, size, type, name);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (bufsize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (index &gt;= (GLuint)programObject-&gt;getActiveAttributeCount())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        programObject-&gt;getActiveAttribute(index, bufsize, length, size, type, name);
+    }
+}
+
+void GL_APIENTRY GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
+{
+    EVENT(&quot;(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, &quot;
+          &quot;GLsizei* length = 0x%0.8p, GLint* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)&quot;,
+          program, index, bufsize, length, size, type, name);
+
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (bufsize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (index &gt;= (GLuint)programObject-&gt;getActiveUniformCount())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        programObject-&gt;getActiveUniform(index, bufsize, length, size, type, name);
+    }
+}
+
+void GL_APIENTRY GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+    EVENT(&quot;(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = 0x%0.8p, GLuint* shaders = 0x%0.8p)&quot;,
+          program, maxcount, count, shaders);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (maxcount &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        return programObject-&gt;getAttachedShaders(maxcount, count, shaders);
+    }
+}
+
+GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar* name)
+{
+    EVENT(&quot;(GLuint program = %d, const GLchar* name = %s)&quot;, program, name);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return -1;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return -1;
+            }
+        }
+
+        if (!programObject-&gt;isLinked())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return -1;
+        }
+
+        return programObject-&gt;getAttributeLocation(name);
+    }
+
+    return -1;
+}
+
+void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean* params)
+{
+    EVENT(&quot;(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)&quot;,  pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        GLenum nativeType;
+        unsigned int numParams = 0;
+        if (!ValidateStateQuery(context, pname, &amp;nativeType, &amp;numParams))
+        {
+            return;
+        }
+
+        if (nativeType == GL_BOOL)
+        {
+            context-&gt;getBooleanv(pname, params);
+        }
+        else
+        {
+            CastStateValues(context, nativeType, pname, numParams, params);
+        }
+    }
+}
+
+void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (!ValidBufferParameter(context, pname))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (!buffer)
+        {
+            // A null buffer means that &quot;0&quot; is bound to the requested buffer target
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_BUFFER_USAGE:
+            *params = static_cast&lt;GLint&gt;(buffer-&gt;getUsage());
+            break;
+          case GL_BUFFER_SIZE:
+            *params = clampCast&lt;GLint&gt;(buffer-&gt;getSize());
+            break;
+          case GL_BUFFER_ACCESS_FLAGS:
+            *params = buffer-&gt;getAccessFlags();
+            break;
+          case GL_BUFFER_ACCESS_OES:
+            *params = buffer-&gt;getAccess();
+            break;
+          case GL_BUFFER_MAPPED:
+            static_assert(GL_BUFFER_MAPPED == GL_BUFFER_MAPPED_OES, &quot;GL enums should be equal.&quot;);
+            *params = static_cast&lt;GLint&gt;(buffer-&gt;isMapped());
+            break;
+          case GL_BUFFER_MAP_OFFSET:
+            *params = clampCast&lt;GLint&gt;(buffer-&gt;getMapOffset());
+            break;
+          case GL_BUFFER_MAP_LENGTH:
+            *params = clampCast&lt;GLint&gt;(buffer-&gt;getMapLength());
+            break;
+          default: UNREACHABLE(); break;
+        }
+    }
+}
+
+GLenum GL_APIENTRY GetError(void)
+{
+    EVENT(&quot;()&quot;);
+
+    Context *context = GetGlobalContext();
+
+    if (context)
+    {
+        return context-&gt;getError();
+    }
+
+    return GL_NO_ERROR;
+}
+
+void GL_APIENTRY GetFloatv(GLenum pname, GLfloat* params)
+{
+    EVENT(&quot;(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        GLenum nativeType;
+        unsigned int numParams = 0;
+        if (!ValidateStateQuery(context, pname, &amp;nativeType, &amp;numParams))
+        {
+            return;
+        }
+
+        if (nativeType == GL_FLOAT)
+        {
+            context-&gt;getFloatv(pname, params);
+        }
+        else
+        {
+            CastStateValues(context, nativeType, pname, numParams, params);
+        }
+    }
+}
+
+void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
+          target, attachment, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidFramebufferTarget(target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        int clientVersion = context-&gt;getClientVersion();
+
+        switch (pname)
+        {
+          case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+          case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+          case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+          case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+            break;
+
+          case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+            if (clientVersion &lt; 3 &amp;&amp; !context-&gt;getExtensions().sRGB)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+          case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+          case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+          case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+          case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+          case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+          case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+          case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+            if (clientVersion &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        // Determine if the attachment is a valid enum
+        switch (attachment)
+        {
+          case GL_BACK:
+          case GL_FRONT:
+          case GL_DEPTH:
+          case GL_STENCIL:
+          case GL_DEPTH_STENCIL_ATTACHMENT:
+            if (clientVersion &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          case GL_DEPTH_ATTACHMENT:
+          case GL_STENCIL_ATTACHMENT:
+            break;
+
+          default:
+            if (attachment &lt; GL_COLOR_ATTACHMENT0_EXT ||
+                (attachment - GL_COLOR_ATTACHMENT0_EXT) &gt;= context-&gt;getCaps().maxColorAttachments)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+        }
+
+        const Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+        ASSERT(framebuffer);
+
+        if (framebuffer-&gt;id() == 0)
+        {
+            if (clientVersion &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+
+            switch (attachment)
+            {
+              case GL_BACK:
+              case GL_DEPTH:
+              case GL_STENCIL:
+                break;
+
+              default:
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+        }
+        else
+        {
+            if (attachment &gt;= GL_COLOR_ATTACHMENT0_EXT &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15_EXT)
+            {
+                // Valid attachment query
+            }
+            else
+            {
+                switch (attachment)
+                {
+                  case GL_DEPTH_ATTACHMENT:
+                  case GL_STENCIL_ATTACHMENT:
+                    break;
+
+                  case GL_DEPTH_STENCIL_ATTACHMENT:
+                    if (framebuffer-&gt;hasValidDepthStencil())
+                    {
+                        context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                        return;
+                    }
+                    break;
+
+                  default:
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+            }
+        }
+
+        const FramebufferAttachment *attachmentObject = framebuffer-&gt;getAttachment(attachment);
+        if (attachmentObject)
+        {
+            ASSERT(attachmentObject-&gt;type() == GL_RENDERBUFFER ||
+                   attachmentObject-&gt;type() == GL_TEXTURE ||
+                   attachmentObject-&gt;type() == GL_FRAMEBUFFER_DEFAULT);
+
+            switch (pname)
+            {
+              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+                *params = attachmentObject-&gt;type();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+                if (attachmentObject-&gt;type() != GL_RENDERBUFFER &amp;&amp; attachmentObject-&gt;type() != GL_TEXTURE)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return;
+                }
+                *params = attachmentObject-&gt;id();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+                if (attachmentObject-&gt;type() != GL_TEXTURE)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return;
+                }
+                *params = attachmentObject-&gt;mipLevel();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+                if (attachmentObject-&gt;type() != GL_TEXTURE)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return;
+                }
+                *params = attachmentObject-&gt;cubeMapFace();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+                *params = attachmentObject-&gt;getRedSize();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+                *params = attachmentObject-&gt;getGreenSize();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+                *params = attachmentObject-&gt;getBlueSize();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+                *params = attachmentObject-&gt;getAlphaSize();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+                *params = attachmentObject-&gt;getDepthSize();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+                *params = attachmentObject-&gt;getStencilSize();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+                if (attachment == GL_DEPTH_STENCIL_ATTACHMENT)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+                *params = attachmentObject-&gt;getComponentType();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+                *params = attachmentObject-&gt;getColorEncoding();
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+                if (attachmentObject-&gt;type() != GL_TEXTURE)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return;
+                }
+                *params = attachmentObject-&gt;layer();
+                break;
+
+              default:
+                UNREACHABLE();
+                break;
+            }
+        }
+        else
+        {
+            // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
+            // is NONE, then querying any other pname will generate INVALID_ENUM.
+
+            // ES 3.0.2 spec pg 235 states that if the attachment type is none,
+            // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
+            // INVALID_OPERATION for all other pnames
+
+            switch (pname)
+            {
+              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+                *params = GL_NONE;
+                break;
+
+              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+                if (clientVersion &lt; 3)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return;
+                }
+                *params = 0;
+                break;
+
+              default:
+                if (clientVersion &lt; 3)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_ENUM));
+                    return;
+                }
+                else
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+            }
+        }
+    }
+}
+
+void GL_APIENTRY GetIntegerv(GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        GLenum nativeType;
+        unsigned int numParams = 0;
+
+        if (!ValidateStateQuery(context, pname, &amp;nativeType, &amp;numParams))
+        {
+            return;
+        }
+
+        if (nativeType == GL_INT)
+        {
+            context-&gt;getIntegerv(pname, params);
+        }
+        else
+        {
+            CastStateValues(context, nativeType, pname, numParams, params);
+        }
+    }
+}
+
+void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLuint program = %d, GLenum pname = %d, GLint* params = 0x%0.8p)&quot;, program, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            switch (pname)
+            {
+              case GL_ACTIVE_UNIFORM_BLOCKS:
+              case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+              case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+              case GL_TRANSFORM_FEEDBACK_VARYINGS:
+              case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+        }
+
+        switch (pname)
+        {
+          case GL_DELETE_STATUS:
+            *params = programObject-&gt;isFlaggedForDeletion();
+            return;
+          case GL_LINK_STATUS:
+            *params = programObject-&gt;isLinked();
+            return;
+          case GL_VALIDATE_STATUS:
+            *params = programObject-&gt;isValidated();
+            return;
+          case GL_INFO_LOG_LENGTH:
+            *params = programObject-&gt;getInfoLogLength();
+            return;
+          case GL_ATTACHED_SHADERS:
+            *params = programObject-&gt;getAttachedShadersCount();
+            return;
+          case GL_ACTIVE_ATTRIBUTES:
+            *params = programObject-&gt;getActiveAttributeCount();
+            return;
+          case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+            *params = programObject-&gt;getActiveAttributeMaxLength();
+            return;
+          case GL_ACTIVE_UNIFORMS:
+            *params = programObject-&gt;getActiveUniformCount();
+            return;
+          case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+            *params = programObject-&gt;getActiveUniformMaxLength();
+            return;
+          case GL_PROGRAM_BINARY_LENGTH_OES:
+            *params = programObject-&gt;getBinaryLength();
+            return;
+          case GL_ACTIVE_UNIFORM_BLOCKS:
+            *params = programObject-&gt;getActiveUniformBlockCount();
+            return;
+          case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+            *params = programObject-&gt;getActiveUniformBlockMaxLength();
+            break;
+          case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+            *params = programObject-&gt;getTransformFeedbackBufferMode();
+            break;
+          case GL_TRANSFORM_FEEDBACK_VARYINGS:
+            *params = programObject-&gt;getTransformFeedbackVaryingCount();
+            break;
+          case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+            *params = programObject-&gt;getTransformFeedbackVaryingMaxLength();
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
+{
+    EVENT(&quot;(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)&quot;,
+          program, bufsize, length, infolog);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (bufsize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        programObject-&gt;getInfoLog(bufsize, length, infolog);
+    }
+}
+
+void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (target != GL_RENDERBUFFER)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (context-&gt;getState().getRenderbufferId() == 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Renderbuffer *renderbuffer = context-&gt;getRenderbuffer(context-&gt;getState().getRenderbufferId());
+
+        switch (pname)
+        {
+          case GL_RENDERBUFFER_WIDTH:           *params = renderbuffer-&gt;getWidth();          break;
+          case GL_RENDERBUFFER_HEIGHT:          *params = renderbuffer-&gt;getHeight();         break;
+          case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer-&gt;getInternalFormat(); break;
+          case GL_RENDERBUFFER_RED_SIZE:        *params = renderbuffer-&gt;getRedSize();        break;
+          case GL_RENDERBUFFER_GREEN_SIZE:      *params = renderbuffer-&gt;getGreenSize();      break;
+          case GL_RENDERBUFFER_BLUE_SIZE:       *params = renderbuffer-&gt;getBlueSize();       break;
+          case GL_RENDERBUFFER_ALPHA_SIZE:      *params = renderbuffer-&gt;getAlphaSize();      break;
+          case GL_RENDERBUFFER_DEPTH_SIZE:      *params = renderbuffer-&gt;getDepthSize();      break;
+          case GL_RENDERBUFFER_STENCIL_SIZE:    *params = renderbuffer-&gt;getStencilSize();    break;
+
+          case GL_RENDERBUFFER_SAMPLES_ANGLE:
+            if (!context-&gt;getExtensions().framebufferMultisample)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = renderbuffer-&gt;getSamples();
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)&quot;, shader, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!shaderObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_SHADER_TYPE:
+            *params = shaderObject-&gt;getType();
+            return;
+          case GL_DELETE_STATUS:
+            *params = shaderObject-&gt;isFlaggedForDeletion();
+            return;
+          case GL_COMPILE_STATUS:
+            *params = shaderObject-&gt;isCompiled() ? GL_TRUE : GL_FALSE;
+            return;
+          case GL_INFO_LOG_LENGTH:
+            *params = shaderObject-&gt;getInfoLogLength();
+            return;
+          case GL_SHADER_SOURCE_LENGTH:
+            *params = shaderObject-&gt;getSourceLength();
+            return;
+          case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
+            *params = shaderObject-&gt;getTranslatedSourceLength();
+            return;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
+{
+    EVENT(&quot;(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)&quot;,
+          shader, bufsize, length, infolog);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (bufsize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!shaderObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        shaderObject-&gt;getInfoLog(bufsize, length, infolog);
+    }
+}
+
+void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+    EVENT(&quot;(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = 0x%0.8p, GLint* precision = 0x%0.8p)&quot;,
+          shadertype, precisiontype, range, precision);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (shadertype)
+        {
+          case GL_VERTEX_SHADER:
+            switch (precisiontype)
+            {
+              case GL_LOW_FLOAT:
+                context-&gt;getCaps().vertexLowpFloat.get(range, precision);
+                break;
+              case GL_MEDIUM_FLOAT:
+                context-&gt;getCaps().vertexMediumpFloat.get(range, precision);
+                break;
+              case GL_HIGH_FLOAT:
+                context-&gt;getCaps().vertexHighpFloat.get(range, precision);
+                break;
+
+              case GL_LOW_INT:
+                context-&gt;getCaps().vertexLowpInt.get(range, precision);
+                break;
+              case GL_MEDIUM_INT:
+                context-&gt;getCaps().vertexMediumpInt.get(range, precision);
+                break;
+              case GL_HIGH_INT:
+                context-&gt;getCaps().vertexHighpInt.get(range, precision);
+                break;
+
+              default:
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+          case GL_FRAGMENT_SHADER:
+            switch (precisiontype)
+            {
+              case GL_LOW_FLOAT:
+                context-&gt;getCaps().fragmentLowpFloat.get(range, precision);
+                break;
+              case GL_MEDIUM_FLOAT:
+                context-&gt;getCaps().fragmentMediumpFloat.get(range, precision);
+                break;
+              case GL_HIGH_FLOAT:
+                context-&gt;getCaps().fragmentHighpFloat.get(range, precision);
+                break;
+
+              case GL_LOW_INT:
+                context-&gt;getCaps().fragmentLowpInt.get(range, precision);
+                break;
+              case GL_MEDIUM_INT:
+                context-&gt;getCaps().fragmentMediumpInt.get(range, precision);
+                break;
+              case GL_HIGH_INT:
+                context-&gt;getCaps().fragmentHighpInt.get(range, precision);
+                break;
+
+              default:
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+    }
+}
+
+void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
+{
+    EVENT(&quot;(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)&quot;,
+          shader, bufsize, length, source);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (bufsize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!shaderObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        shaderObject-&gt;getSource(bufsize, length, source);
+    }
+}
+
+const GLubyte *GL_APIENTRY GetString(GLenum name)
+{
+    EVENT(&quot;(GLenum name = 0x%X)&quot;, name);
+
+    Context *context = GetValidGlobalContext();
+
+    switch (name)
+    {
+      case GL_VENDOR:
+        return (GLubyte*)&quot;Google Inc.&quot;;
+
+      case GL_RENDERER:
+        return (GLubyte*)((context != NULL) ? context-&gt;getRendererString().c_str() : &quot;ANGLE&quot;);
+
+      case GL_VERSION:
+        if (context-&gt;getClientVersion() == 2)
+        {
+            return (GLubyte*)&quot;OpenGL ES 2.0 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
+        }
+        else
+        {
+            return (GLubyte*)&quot;OpenGL ES 3.0 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
+        }
+
+      case GL_SHADING_LANGUAGE_VERSION:
+        if (context-&gt;getClientVersion() == 2)
+        {
+            return (GLubyte*)&quot;OpenGL ES GLSL ES 1.00 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
+        }
+        else
+        {
+            return (GLubyte*)&quot;OpenGL ES GLSL ES 3.00 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
+        }
+
+      case GL_EXTENSIONS:
+        return (GLubyte*)((context != NULL) ? context-&gt;getExtensionString().c_str() : &quot;&quot;);
+
+      default:
+        if (context)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+        }
+        return NULL;
+    }
+}
+
+void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidTextureTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM, &quot;Invalid texture target&quot;));
+            return;
+        }
+
+        Texture *texture = context-&gt;getTargetTexture(target);
+
+        if (!texture)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_TEXTURE_MAG_FILTER:
+            *params = (GLfloat)texture-&gt;getSamplerState().magFilter;
+            break;
+          case GL_TEXTURE_MIN_FILTER:
+            *params = (GLfloat)texture-&gt;getSamplerState().minFilter;
+            break;
+          case GL_TEXTURE_WRAP_S:
+            *params = (GLfloat)texture-&gt;getSamplerState().wrapS;
+            break;
+          case GL_TEXTURE_WRAP_T:
+            *params = (GLfloat)texture-&gt;getSamplerState().wrapT;
+            break;
+          case GL_TEXTURE_WRAP_R:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().wrapR;
+            break;
+          case GL_TEXTURE_IMMUTABLE_FORMAT:
+            // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
+            *params = (GLfloat)(texture-&gt;isImmutable() ? GL_TRUE : GL_FALSE);
+            break;
+          case GL_TEXTURE_IMMUTABLE_LEVELS:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;immutableLevelCount();
+            break;
+          case GL_TEXTURE_USAGE_ANGLE:
+            *params = (GLfloat)texture-&gt;getUsage();
+            break;
+          case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+            if (!context-&gt;getExtensions().textureFilterAnisotropic)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().maxAnisotropy;
+            break;
+          case GL_TEXTURE_SWIZZLE_R:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().swizzleRed;
+            break;
+          case GL_TEXTURE_SWIZZLE_G:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().swizzleGreen;
+            break;
+          case GL_TEXTURE_SWIZZLE_B:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().swizzleBlue;
+            break;
+          case GL_TEXTURE_SWIZZLE_A:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().swizzleAlpha;
+            break;
+          case GL_TEXTURE_BASE_LEVEL:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().baseLevel;
+            break;
+          case GL_TEXTURE_MAX_LEVEL:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLfloat)texture-&gt;getSamplerState().maxLevel;
+            break;
+          case GL_TEXTURE_MIN_LOD:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().minLod;
+            break;
+          case GL_TEXTURE_MAX_LOD:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().maxLod;
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidTextureTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM, &quot;Invalid texture target&quot;));
+            return;
+        }
+
+        Texture *texture = context-&gt;getTargetTexture(target);
+
+        if (!texture)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_TEXTURE_MAG_FILTER:
+            *params = texture-&gt;getSamplerState().magFilter;
+            break;
+          case GL_TEXTURE_MIN_FILTER:
+            *params = texture-&gt;getSamplerState().minFilter;
+            break;
+          case GL_TEXTURE_WRAP_S:
+            *params = texture-&gt;getSamplerState().wrapS;
+            break;
+          case GL_TEXTURE_WRAP_T:
+            *params = texture-&gt;getSamplerState().wrapT;
+            break;
+          case GL_TEXTURE_WRAP_R:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().wrapR;
+            break;
+          case GL_TEXTURE_IMMUTABLE_FORMAT:
+            // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
+            *params = texture-&gt;isImmutable() ? GL_TRUE : GL_FALSE;
+            break;
+          case GL_TEXTURE_IMMUTABLE_LEVELS:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = static_cast&lt;GLint&gt;(texture-&gt;immutableLevelCount());
+            break;
+          case GL_TEXTURE_USAGE_ANGLE:
+            *params = texture-&gt;getUsage();
+            break;
+          case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+            if (!context-&gt;getExtensions().textureFilterAnisotropic)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLint)texture-&gt;getSamplerState().maxAnisotropy;
+            break;
+          case GL_TEXTURE_SWIZZLE_R:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().swizzleRed;
+            break;
+          case GL_TEXTURE_SWIZZLE_G:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().swizzleGreen;
+            break;
+          case GL_TEXTURE_SWIZZLE_B:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().swizzleBlue;
+            break;
+          case GL_TEXTURE_SWIZZLE_A:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().swizzleAlpha;
+            break;
+          case GL_TEXTURE_BASE_LEVEL:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().baseLevel;
+            break;
+          case GL_TEXTURE_MAX_LEVEL:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = texture-&gt;getSamplerState().maxLevel;
+            break;
+          case GL_TEXTURE_MIN_LOD:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLint)texture-&gt;getSamplerState().minLod;
+            break;
+          case GL_TEXTURE_MAX_LOD:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            *params = (GLint)texture-&gt;getSamplerState().maxLod;
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)&quot;, program, location, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateGetUniformfv(context, program, location, params))
+        {
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        ASSERT(programObject);
+
+        programObject-&gt;getUniformfv(location, params);
+    }
+}
+
+void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint* params)
+{
+    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)&quot;, program, location, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateGetUniformiv(context, program, location, params))
+        {
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        ASSERT(programObject);
+
+        programObject-&gt;getUniformiv(location, params);
+    }
+}
+
+GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar* name)
+{
+    EVENT(&quot;(GLuint program = %d, const GLchar* name = 0x%0.8p)&quot;, program, name);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (strstr(name, &quot;gl_&quot;) == name)
+        {
+            return -1;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return -1;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return -1;
+            }
+        }
+
+        if (!programObject-&gt;isLinked())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return -1;
+        }
+
+        return programObject-&gt;getUniformLocation(name);
+    }
+
+    return -1;
+}
+
+void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+{
+    EVENT(&quot;(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, index, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidateGetVertexAttribParameters(context, pname))
+        {
+            return;
+        }
+
+        if (pname == GL_CURRENT_VERTEX_ATTRIB)
+        {
+            const VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getState().getVertexAttribCurrentValue(index);
+            for (int i = 0; i &lt; 4; ++i)
+            {
+                params[i] = currentValueData.FloatValues[i];
+            }
+        }
+        else
+        {
+            const VertexAttribute &amp;attribState = context-&gt;getState().getVertexArray()-&gt;getVertexAttribute(index);
+            *params = QuerySingleVertexAttributeParameter&lt;GLfloat&gt;(attribState, pname);
+        }
+    }
+}
+
+void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, index, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidateGetVertexAttribParameters(context, pname))
+        {
+            return;
+        }
+
+        if (pname == GL_CURRENT_VERTEX_ATTRIB)
+        {
+            const VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getState().getVertexAttribCurrentValue(index);
+            for (int i = 0; i &lt; 4; ++i)
+            {
+                float currentValue = currentValueData.FloatValues[i];
+                params[i] = iround&lt;GLint&gt;(currentValue);
+            }
+        }
+        else
+        {
+            const VertexAttribute &amp;attribState = context-&gt;getState().getVertexArray()-&gt;getVertexAttribute(index);
+            *params = QuerySingleVertexAttributeParameter&lt;GLint&gt;(attribState, pname);
+        }
+    }
+}
+
+void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
+{
+    EVENT(&quot;(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)&quot;, index, pname, pointer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        *pointer = const_cast&lt;GLvoid*&gt;(context-&gt;getState().getVertexAttribPointer(index));
+    }
+}
+
+void GL_APIENTRY Hint(GLenum target, GLenum mode)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum mode = 0x%X)&quot;, target, mode);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (mode)
+        {
+          case GL_FASTEST:
+          case GL_NICEST:
+          case GL_DONT_CARE:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (target)
+        {
+          case GL_GENERATE_MIPMAP_HINT:
+            context-&gt;getState().setGenerateMipmapHint(mode);
+            break;
+
+          case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
+            context-&gt;getState().setFragmentShaderDerivativeHint(mode);
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+GLboolean GL_APIENTRY IsBuffer(GLuint buffer)
+{
+    EVENT(&quot;(GLuint buffer = %d)&quot;, buffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context &amp;&amp; buffer)
+    {
+        Buffer *bufferObject = context-&gt;getBuffer(buffer);
+
+        if (bufferObject)
+        {
+            return GL_TRUE;
+        }
+    }
+
+    return GL_FALSE;
+}
+
+GLboolean GL_APIENTRY IsEnabled(GLenum cap)
+{
+    EVENT(&quot;(GLenum cap = 0x%X)&quot;, cap);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidCap(context, cap))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return GL_FALSE;
+        }
+
+        return context-&gt;getState().getEnableFeature(cap);
+    }
+
+    return false;
+}
+
+GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer)
+{
+    EVENT(&quot;(GLuint framebuffer = %d)&quot;, framebuffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context &amp;&amp; framebuffer)
+    {
+        Framebuffer *framebufferObject = context-&gt;getFramebuffer(framebuffer);
+
+        if (framebufferObject)
+        {
+            return GL_TRUE;
+        }
+    }
+
+    return GL_FALSE;
+}
+
+GLboolean GL_APIENTRY IsProgram(GLuint program)
+{
+    EVENT(&quot;(GLuint program = %d)&quot;, program);
+
+    Context *context = GetValidGlobalContext();
+    if (context &amp;&amp; program)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (programObject)
+        {
+            return GL_TRUE;
+        }
+    }
+
+    return GL_FALSE;
+}
+
+GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer)
+{
+    EVENT(&quot;(GLuint renderbuffer = %d)&quot;, renderbuffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context &amp;&amp; renderbuffer)
+    {
+        Renderbuffer *renderbufferObject = context-&gt;getRenderbuffer(renderbuffer);
+
+        if (renderbufferObject)
+        {
+            return GL_TRUE;
+        }
+    }
+
+    return GL_FALSE;
+}
+
+GLboolean GL_APIENTRY IsShader(GLuint shader)
+{
+    EVENT(&quot;(GLuint shader = %d)&quot;, shader);
+
+    Context *context = GetValidGlobalContext();
+    if (context &amp;&amp; shader)
+    {
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (shaderObject)
+        {
+            return GL_TRUE;
+        }
+    }
+
+    return GL_FALSE;
+}
+
+GLboolean GL_APIENTRY IsTexture(GLuint texture)
+{
+    EVENT(&quot;(GLuint texture = %d)&quot;, texture);
+
+    Context *context = GetValidGlobalContext();
+    if (context &amp;&amp; texture)
+    {
+        Texture *textureObject = context-&gt;getTexture(texture);
+
+        if (textureObject)
+        {
+            return GL_TRUE;
+        }
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY LineWidth(GLfloat width)
+{
+    EVENT(&quot;(GLfloat width = %f)&quot;, width);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (width &lt;= 0.0f)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setLineWidth(width);
+    }
+}
+
+void GL_APIENTRY LinkProgram(GLuint program)
+{
+    EVENT(&quot;(GLuint program = %d)&quot;, program);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        Error error = programObject-&gt;link(context-&gt;getData());
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
+{
+    EVENT(&quot;(GLenum pname = 0x%X, GLint param = %d)&quot;, pname, param);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            switch (pname)
+            {
+              case GL_UNPACK_IMAGE_HEIGHT:
+              case GL_UNPACK_SKIP_IMAGES:
+              case GL_UNPACK_ROW_LENGTH:
+              case GL_UNPACK_SKIP_ROWS:
+              case GL_UNPACK_SKIP_PIXELS:
+              case GL_PACK_ROW_LENGTH:
+              case GL_PACK_SKIP_ROWS:
+              case GL_PACK_SKIP_PIXELS:
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+        }
+
+        if (param &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE, &quot;Cannot use negative values in PixelStorei&quot;));
+            return;
+        }
+
+        State &amp;state = context-&gt;getState();
+
+        switch (pname)
+        {
+          case GL_UNPACK_ALIGNMENT:
+            if (param != 1 &amp;&amp; param != 2 &amp;&amp; param != 4 &amp;&amp; param != 8)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+
+            state.setUnpackAlignment(param);
+            break;
+
+          case GL_PACK_ALIGNMENT:
+            if (param != 1 &amp;&amp; param != 2 &amp;&amp; param != 4 &amp;&amp; param != 8)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+
+            state.setPackAlignment(param);
+            break;
+
+          case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
+            state.setPackReverseRowOrder(param != 0);
+            break;
+
+          case GL_UNPACK_ROW_LENGTH:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.setUnpackRowLength(param);
+            break;
+
+          case GL_UNPACK_IMAGE_HEIGHT:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.getUnpackState().imageHeight = param;
+            break;
+
+          case GL_UNPACK_SKIP_IMAGES:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.getUnpackState().skipImages = param;
+            break;
+
+          case GL_UNPACK_SKIP_ROWS:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.getUnpackState().skipRows = param;
+            break;
+
+          case GL_UNPACK_SKIP_PIXELS:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.getUnpackState().skipPixels = param;
+            break;
+
+          case GL_PACK_ROW_LENGTH:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.getPackState().rowLength = param;
+            break;
+
+          case GL_PACK_SKIP_ROWS:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.getPackState().skipRows = param;
+            break;
+
+          case GL_PACK_SKIP_PIXELS:
+            ASSERT(context-&gt;getClientVersion() &gt;= 3);
+            state.getPackState().skipPixels = param;
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units)
+{
+    EVENT(&quot;(GLfloat factor = %f, GLfloat units = %f)&quot;, factor, units);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        context-&gt;getState().setPolygonOffsetParams(factor, units);
+    }
+}
+
+void GL_APIENTRY ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
+                            GLenum format, GLenum type, GLvoid* pixels)
+{
+    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, &quot;
+          &quot;GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = 0x%0.8p)&quot;,
+          x, y, width, height, format, type,  pixels);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (width &lt; 0 || height &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidateReadPixelsParameters(context, x, y, width, height,
+                                              format, type, NULL, pixels))
+        {
+            return;
+        }
+
+        Framebuffer *framebufferObject = context-&gt;getState().getReadFramebuffer();
+        ASSERT(framebufferObject);
+
+        Rectangle area(x, y, width, height);
+        Error error = framebufferObject-&gt;readPixels(context-&gt;getState(), area, format, type, pixels);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY ReleaseShaderCompiler(void)
+{
+    EVENT(&quot;()&quot;);
+
+    Context *context = GetValidGlobalContext();
+
+    if (context)
+    {
+        Compiler *compiler = context-&gt;getCompiler();
+        Error error = compiler-&gt;release();
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
+          target, internalformat, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateRenderbufferStorageParametersANGLE(context, target, 0, internalformat,
+                                                        width, height))
+        {
+            return;
+        }
+
+        Renderbuffer *renderbuffer = context-&gt;getState().getCurrentRenderbuffer();
+        Error error = renderbuffer-&gt;setStorage(internalformat, width, height);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY SampleCoverage(GLclampf value, GLboolean invert)
+{
+    EVENT(&quot;(GLclampf value = %f, GLboolean invert = %u)&quot;, value, invert);
+
+    Context* context = GetValidGlobalContext();
+
+    if (context)
+    {
+        context-&gt;getState().setSampleCoverageParams(clamp01(value), invert == GL_TRUE);
+    }
+}
+
+void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;, x, y, width, height);
+
+    Context* context = GetValidGlobalContext();
+    if (context)
+    {
+        if (width &lt; 0 || height &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setScissorParams(x, y, width, height);
+    }
+}
+
+void GL_APIENTRY ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* shaders = 0x%0.8p, GLenum binaryformat = 0x%X, &quot;
+          &quot;const GLvoid* binary = 0x%0.8p, GLsizei length = %d)&quot;,
+          n, shaders, binaryformat, binary, length);
+
+    Context* context = GetValidGlobalContext();
+    if (context)
+    {
+        const std::vector&lt;GLenum&gt; &amp;shaderBinaryFormats = context-&gt;getCaps().shaderBinaryFormats;
+        if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end())
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        // No binary shader formats are supported.
+        UNIMPLEMENTED();
+    }
+}
+
+void GL_APIENTRY ShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length)
+{
+    EVENT(&quot;(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)&quot;,
+          shader, count, string, length);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (count &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!shaderObject)
+        {
+            if (context-&gt;getProgram(shader))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        shaderObject-&gt;setSource(count, string, length);
+    }
+}
+
+void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+    StencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask);
+}
+
+void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+    EVENT(&quot;(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)&quot;, face, func, ref, mask);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (face)
+        {
+          case GL_FRONT:
+          case GL_BACK:
+          case GL_FRONT_AND_BACK:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        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:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+        {
+            context-&gt;getState().setStencilParams(func, ref, mask);
+        }
+
+        if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+        {
+            context-&gt;getState().setStencilBackParams(func, ref, mask);
+        }
+    }
+}
+
+void GL_APIENTRY StencilMask(GLuint mask)
+{
+    StencilMaskSeparate(GL_FRONT_AND_BACK, mask);
+}
+
+void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask)
+{
+    EVENT(&quot;(GLenum face = 0x%X, GLuint mask = %d)&quot;, face, mask);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (face)
+        {
+          case GL_FRONT:
+          case GL_BACK:
+          case GL_FRONT_AND_BACK:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+        {
+            context-&gt;getState().setStencilWritemask(mask);
+        }
+
+        if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+        {
+            context-&gt;getState().setStencilBackWritemask(mask);
+        }
+    }
+}
+
+void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+    StencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass);
+}
+
+void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+    EVENT(&quot;(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)&quot;,
+          face, fail, zfail, zpass);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        switch (face)
+        {
+          case GL_FRONT:
+          case GL_BACK:
+          case GL_FRONT_AND_BACK:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        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:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        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:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        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:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
+        {
+            context-&gt;getState().setStencilOperations(fail, zfail, zpass);
+        }
+
+        if (face == GL_BACK || face == GL_FRONT_AND_BACK)
+        {
+            context-&gt;getState().setStencilBackOperations(fail, zfail, zpass);
+        }
+    }
+}
+
+void GL_APIENTRY TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+                            GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, &quot;
+          &quot;GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)&quot;,
+          target, level, internalformat, width, height, border, format, type, pixels);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
+            !ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
+                                           0, 0, width, height, border, format, type, pixels))
+        {
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
+            !ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
+                                           0, 0, 0, width, height, 1, border, format, type, pixels))
+        {
+            return;
+        }
+
+        Extents size(width, height, 1);
+        Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+        Error error = texture-&gt;setImage(target, level, internalformat, size, format, type, context-&gt;getState().getUnpackState(),
+                                        reinterpret_cast&lt;const uint8_t *&gt;(pixels));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)&quot;, target, pname, param);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidTextureTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM, &quot;Invalid texture target&quot;));
+            return;
+        }
+
+        if (!ValidateTexParamParameters(context, pname, static_cast&lt;GLint&gt;(param)))
+        {
+            return;
+        }
+
+        Texture *texture = context-&gt;getTargetTexture(target);
+
+        if (!texture)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_TEXTURE_WRAP_S:               texture-&gt;getSamplerState().wrapS = uiround&lt;GLenum&gt;(param);        break;
+          case GL_TEXTURE_WRAP_T:               texture-&gt;getSamplerState().wrapT = uiround&lt;GLenum&gt;(param);        break;
+          case GL_TEXTURE_WRAP_R:               texture-&gt;getSamplerState().wrapR = uiround&lt;GLenum&gt;(param);        break;
+          case GL_TEXTURE_MIN_FILTER:           texture-&gt;getSamplerState().minFilter = uiround&lt;GLenum&gt;(param);    break;
+          case GL_TEXTURE_MAG_FILTER:           texture-&gt;getSamplerState().magFilter = uiround&lt;GLenum&gt;(param);    break;
+          case GL_TEXTURE_USAGE_ANGLE:          texture-&gt;setUsage(uiround&lt;GLenum&gt;(param));                        break;
+          case GL_TEXTURE_MAX_ANISOTROPY_EXT:   texture-&gt;getSamplerState().maxAnisotropy = std::min(param, context-&gt;getExtensions().maxTextureAnisotropy); break;
+          case GL_TEXTURE_COMPARE_MODE:         texture-&gt;getSamplerState().compareMode = uiround&lt;GLenum&gt;(param);  break;
+          case GL_TEXTURE_COMPARE_FUNC:         texture-&gt;getSamplerState().compareFunc = uiround&lt;GLenum&gt;(param);  break;
+          case GL_TEXTURE_SWIZZLE_R:            texture-&gt;getSamplerState().swizzleRed = uiround&lt;GLenum&gt;(param);   break;
+          case GL_TEXTURE_SWIZZLE_G:            texture-&gt;getSamplerState().swizzleGreen = uiround&lt;GLenum&gt;(param); break;
+          case GL_TEXTURE_SWIZZLE_B:            texture-&gt;getSamplerState().swizzleBlue = uiround&lt;GLenum&gt;(param);  break;
+          case GL_TEXTURE_SWIZZLE_A:            texture-&gt;getSamplerState().swizzleAlpha = uiround&lt;GLenum&gt;(param); break;
+          case GL_TEXTURE_BASE_LEVEL:           texture-&gt;getSamplerState().baseLevel = iround&lt;GLint&gt;(param);      break;
+          case GL_TEXTURE_MAX_LEVEL:            texture-&gt;getSamplerState().maxLevel = iround&lt;GLint&gt;(param);       break;
+          case GL_TEXTURE_MIN_LOD:              texture-&gt;getSamplerState().minLod = param;                            break;
+          case GL_TEXTURE_MAX_LOD:              texture-&gt;getSamplerState().maxLod = param;                            break;
+          default: UNREACHABLE(); break;
+        }
+    }
+}
+
+void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+    TexParameterf(target, pname, (GLfloat)*params);
+}
+
+void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)&quot;, target, pname, param);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidTextureTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM, &quot;Invalid Texture target&quot;));
+            return;
+        }
+
+        if (!ValidateTexParamParameters(context, pname, param))
+        {
+            return;
+        }
+
+        Texture *texture = context-&gt;getTargetTexture(target);
+
+        if (!texture)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_TEXTURE_WRAP_S:               texture-&gt;getSamplerState().wrapS = (GLenum)param;        break;
+          case GL_TEXTURE_WRAP_T:               texture-&gt;getSamplerState().wrapT = (GLenum)param;        break;
+          case GL_TEXTURE_WRAP_R:               texture-&gt;getSamplerState().wrapR = (GLenum)param;        break;
+          case GL_TEXTURE_MIN_FILTER:           texture-&gt;getSamplerState().minFilter = (GLenum)param;    break;
+          case GL_TEXTURE_MAG_FILTER:           texture-&gt;getSamplerState().magFilter = (GLenum)param;    break;
+          case GL_TEXTURE_USAGE_ANGLE:          texture-&gt;setUsage((GLenum)param);                        break;
+          case GL_TEXTURE_MAX_ANISOTROPY_EXT:   texture-&gt;getSamplerState().maxAnisotropy = std::min((float)param, context-&gt;getExtensions().maxTextureAnisotropy); break;
+          case GL_TEXTURE_COMPARE_MODE:         texture-&gt;getSamplerState().compareMode = (GLenum)param;  break;
+          case GL_TEXTURE_COMPARE_FUNC:         texture-&gt;getSamplerState().compareFunc = (GLenum)param;  break;
+          case GL_TEXTURE_SWIZZLE_R:            texture-&gt;getSamplerState().swizzleRed = (GLenum)param;   break;
+          case GL_TEXTURE_SWIZZLE_G:            texture-&gt;getSamplerState().swizzleGreen = (GLenum)param; break;
+          case GL_TEXTURE_SWIZZLE_B:            texture-&gt;getSamplerState().swizzleBlue = (GLenum)param;  break;
+          case GL_TEXTURE_SWIZZLE_A:            texture-&gt;getSamplerState().swizzleAlpha = (GLenum)param; break;
+          case GL_TEXTURE_BASE_LEVEL:           texture-&gt;getSamplerState().baseLevel = param;            break;
+          case GL_TEXTURE_MAX_LEVEL:            texture-&gt;getSamplerState().maxLevel = param;             break;
+          case GL_TEXTURE_MIN_LOD:              texture-&gt;getSamplerState().minLod = (GLfloat)param;      break;
+          case GL_TEXTURE_MAX_LOD:              texture-&gt;getSamplerState().maxLod = (GLfloat)param;      break;
+          default: UNREACHABLE(); break;
+        }
+    }
+}
+
+void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+    TexParameteri(target, pname, *params);
+}
+
+void GL_APIENTRY TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
+                               GLenum format, GLenum type, const GLvoid* pixels)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
+          &quot;GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, &quot;
+          &quot;const GLvoid* pixels = 0x%0.8p)&quot;,
+           target, level, xoffset, yoffset, width, height, format, type, pixels);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
+            !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true,
+                                           xoffset, yoffset, width, height, 0, format, type, pixels))
+        {
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
+            !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
+                                           xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels))
+        {
+            return;
+        }
+
+        // Zero sized uploads are valid but no-ops
+        if (width == 0 || height == 0)
+        {
+            return;
+        }
+
+        Box area(xoffset, yoffset, 0, width, height, 1);
+        Texture *texture = context-&gt;getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
+        Error error = texture-&gt;setSubImage(target, level, area, format, type, context-&gt;getState().getUnpackState(),
+                                           reinterpret_cast&lt;const uint8_t *&gt;(pixels));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY Uniform1f(GLint location, GLfloat x)
+{
+    Uniform1fv(location, 1, &amp;x);
+}
+
+void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_FLOAT, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform1fv(location, count, v);
+    }
+}
+
+void GL_APIENTRY Uniform1i(GLint location, GLint x)
+{
+    Uniform1iv(location, 1, &amp;x);
+}
+
+void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_INT, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform1iv(location, count, v);
+    }
+}
+
+void GL_APIENTRY Uniform2f(GLint location, GLfloat x, GLfloat y)
+{
+    GLfloat xy[2] = {x, y};
+
+    Uniform2fv(location, 1, xy);
+}
+
+void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform2fv(location, count, v);
+    }
+}
+
+void GL_APIENTRY Uniform2i(GLint location, GLint x, GLint y)
+{
+    GLint xy[2] = {x, y};
+
+    Uniform2iv(location, 1, xy);
+}
+
+void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_INT_VEC2, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform2iv(location, count, v);
+    }
+}
+
+void GL_APIENTRY Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+    GLfloat xyz[3] = {x, y, z};
+
+    Uniform3fv(location, 1, xyz);
+}
+
+void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform3fv(location, count, v);
+    }
+}
+
+void GL_APIENTRY Uniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+    GLint xyz[3] = {x, y, z};
+
+    Uniform3iv(location, 1, xyz);
+}
+
+void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_INT_VEC3, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform3iv(location, count, v);
+    }
+}
+
+void GL_APIENTRY Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+    GLfloat xyzw[4] = {x, y, z, w};
+
+    Uniform4fv(location, 1, xyzw);
+}
+
+void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform4fv(location, count, v);
+    }
+}
+
+void GL_APIENTRY Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+    GLint xyzw[4] = {x, y, z, w};
+
+    Uniform4iv(location, 1, xyzw);
+}
+
+void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_INT_VEC4, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform4iv(location, count, v);
+    }
+}
+
+void GL_APIENTRY UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix2fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix3fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix4fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UseProgram(GLuint program)
+{
+    EVENT(&quot;(GLuint program = %d)&quot;, program);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject &amp;&amp; program != 0)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (program != 0 &amp;&amp; !programObject-&gt;isLinked())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        context-&gt;useProgram(program);
+    }
+}
+
+void GL_APIENTRY ValidateProgram(GLuint program)
+{
+    EVENT(&quot;(GLuint program = %d)&quot;, program);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        programObject-&gt;validate(context-&gt;getCaps());
+    }
+}
+
+void GL_APIENTRY VertexAttrib1f(GLuint index, GLfloat x)
+{
+    EVENT(&quot;(GLuint index = %d, GLfloat x = %f)&quot;, index, x);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLfloat vals[4] = { x, 0, 0, 1 };
+        context-&gt;getState().setVertexAttribf(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttrib1fv(GLuint index, const GLfloat* values)
+{
+    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLfloat vals[4] = { values[0], 0, 0, 1 };
+        context-&gt;getState().setVertexAttribf(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+    EVENT(&quot;(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)&quot;, index, x, y);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLfloat vals[4] = { x, y, 0, 1 };
+        context-&gt;getState().setVertexAttribf(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttrib2fv(GLuint index, const GLfloat* values)
+{
+    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLfloat vals[4] = { values[0], values[1], 0, 1 };
+        context-&gt;getState().setVertexAttribf(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+    EVENT(&quot;(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)&quot;, index, x, y, z);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLfloat vals[4] = { x, y, z, 1 };
+        context-&gt;getState().setVertexAttribf(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttrib3fv(GLuint index, const GLfloat* values)
+{
+    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLfloat vals[4] = { values[0], values[1], values[2], 1 };
+        context-&gt;getState().setVertexAttribf(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+    EVENT(&quot;(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)&quot;, index, x, y, z, w);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLfloat vals[4] = { x, y, z, w };
+        context-&gt;getState().setVertexAttribf(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttrib4fv(GLuint index, const GLfloat* values)
+{
+    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setVertexAttribf(index, values);
+    }
+}
+
+void GL_APIENTRY VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
+{
+    EVENT(&quot;(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, &quot;
+          &quot;GLboolean normalized = %u, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)&quot;,
+          index, size, type, normalized, stride, ptr);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (size &lt; 1 || size &gt; 4)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (type)
+        {
+          case GL_BYTE:
+          case GL_UNSIGNED_BYTE:
+          case GL_SHORT:
+          case GL_UNSIGNED_SHORT:
+          case GL_FIXED:
+          case GL_FLOAT:
+            break;
+
+          case GL_HALF_FLOAT:
+          case GL_INT:
+          case GL_UNSIGNED_INT:
+          case GL_INT_2_10_10_10_REV:
+          case GL_UNSIGNED_INT_2_10_10_10_REV:
+            if (context-&gt;getClientVersion() &lt; 3)
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (stride &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) &amp;&amp; size != 4)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // [OpenGL ES 3.0.2] Section 2.8 page 24:
+        // An INVALID_OPERATION error is generated when a non-zero vertex array object
+        // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+        // and the pointer argument is not NULL.
+        if (context-&gt;getState().getVertexArray()-&gt;id() != 0 &amp;&amp; context-&gt;getState().getArrayBufferId() == 0 &amp;&amp; ptr != NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        context-&gt;getState().setVertexAttribState(index, context-&gt;getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type,
+                                                 normalized == GL_TRUE, false, stride, ptr);
+    }
+}
+
+void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;, x, y, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (width &lt; 0 || height &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setViewportParams(x, y, width, height);
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_2_0.h : Defines the GLES 2.0 entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTGLES20_H_
+#define LIBGLESV2_ENTRYPOINTGLES20_H_
+
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;export.h&gt;
+
+namespace gl
+{
+
+ANGLE_EXPORT void GL_APIENTRY ActiveTexture(GLenum texture);
+ANGLE_EXPORT void GL_APIENTRY AttachShader(GLuint program, GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar* name);
+ANGLE_EXPORT void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer);
+ANGLE_EXPORT void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer);
+ANGLE_EXPORT void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY BindTexture(GLenum target, GLuint texture);
+ANGLE_EXPORT void GL_APIENTRY BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY BlendEquation(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+ANGLE_EXPORT void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor);
+ANGLE_EXPORT void GL_APIENTRY BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+ANGLE_EXPORT void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+ANGLE_EXPORT void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY Clear(GLbitfield mask);
+ANGLE_EXPORT void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+ANGLE_EXPORT void GL_APIENTRY ClearDepthf(GLfloat depth);
+ANGLE_EXPORT void GL_APIENTRY ClearStencil(GLint s);
+ANGLE_EXPORT void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+ANGLE_EXPORT void GL_APIENTRY CompileShader(GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+ANGLE_EXPORT void GL_APIENTRY CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+ANGLE_EXPORT GLuint GL_APIENTRY CreateProgram(void);
+ANGLE_EXPORT GLuint GL_APIENTRY CreateShader(GLenum type);
+ANGLE_EXPORT void GL_APIENTRY CullFace(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint* buffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY DeleteShader(GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint* textures);
+ANGLE_EXPORT void GL_APIENTRY DepthFunc(GLenum func);
+ANGLE_EXPORT void GL_APIENTRY DepthMask(GLboolean flag);
+ANGLE_EXPORT void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f);
+ANGLE_EXPORT void GL_APIENTRY DetachShader(GLuint program, GLuint shader);
+ANGLE_EXPORT void GL_APIENTRY Disable(GLenum cap);
+ANGLE_EXPORT void GL_APIENTRY DisableVertexAttribArray(GLuint index);
+ANGLE_EXPORT void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count);
+ANGLE_EXPORT void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+ANGLE_EXPORT void GL_APIENTRY Enable(GLenum cap);
+ANGLE_EXPORT void GL_APIENTRY EnableVertexAttribArray(GLuint index);
+ANGLE_EXPORT void GL_APIENTRY Finish(void);
+ANGLE_EXPORT void GL_APIENTRY Flush(void);
+ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+ANGLE_EXPORT void GL_APIENTRY FrontFace(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY GenBuffers(GLsizei n, GLuint* buffers);
+ANGLE_EXPORT void GL_APIENTRY GenerateMipmap(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint* framebuffers);
+ANGLE_EXPORT void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint* renderbuffers);
+ANGLE_EXPORT void GL_APIENTRY GenTextures(GLsizei n, GLuint* textures);
+ANGLE_EXPORT void GL_APIENTRY GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+ANGLE_EXPORT void GL_APIENTRY GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+ANGLE_EXPORT GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar* name);
+ANGLE_EXPORT void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean* params);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
+ANGLE_EXPORT GLenum GL_APIENTRY GetError(void);
+ANGLE_EXPORT void GL_APIENTRY GetFloatv(GLenum pname, GLfloat* params);
+ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetIntegerv(GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+ANGLE_EXPORT void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+ANGLE_EXPORT void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+ANGLE_EXPORT const GLubyte *GL_APIENTRY GetString(GLenum name);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
+ANGLE_EXPORT void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat* params);
+ANGLE_EXPORT void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint* params);
+ANGLE_EXPORT GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar* name);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
+ANGLE_EXPORT void GL_APIENTRY Hint(GLenum target, GLenum mode);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsBuffer(GLuint buffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabled(GLenum cap);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsProgram(GLuint program);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsShader(GLuint shader);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsTexture(GLuint texture);
+ANGLE_EXPORT void GL_APIENTRY LineWidth(GLfloat width);
+ANGLE_EXPORT void GL_APIENTRY LinkProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY PixelStorei(GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units);
+ANGLE_EXPORT void GL_APIENTRY ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+ANGLE_EXPORT void GL_APIENTRY ReleaseShaderCompiler(void);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert);
+ANGLE_EXPORT void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+ANGLE_EXPORT void GL_APIENTRY ShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
+ANGLE_EXPORT void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilMask(GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask);
+ANGLE_EXPORT void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass);
+ANGLE_EXPORT void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+ANGLE_EXPORT void GL_APIENTRY TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+ANGLE_EXPORT void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
+ANGLE_EXPORT void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint* params);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+ANGLE_EXPORT void GL_APIENTRY Uniform1f(GLint location, GLfloat x);
+ANGLE_EXPORT void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat* v);
+ANGLE_EXPORT void GL_APIENTRY Uniform1i(GLint location, GLint x);
+ANGLE_EXPORT void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint* v);
+ANGLE_EXPORT void GL_APIENTRY Uniform2f(GLint location, GLfloat x, GLfloat y);
+ANGLE_EXPORT void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat* v);
+ANGLE_EXPORT void GL_APIENTRY Uniform2i(GLint location, GLint x, GLint y);
+ANGLE_EXPORT void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint* v);
+ANGLE_EXPORT void GL_APIENTRY Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat* v);
+ANGLE_EXPORT void GL_APIENTRY Uniform3i(GLint location, GLint x, GLint y, GLint z);
+ANGLE_EXPORT void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint* v);
+ANGLE_EXPORT void GL_APIENTRY Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+ANGLE_EXPORT void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat* v);
+ANGLE_EXPORT void GL_APIENTRY Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
+ANGLE_EXPORT void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint* v);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UseProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY ValidateProgram(GLuint program);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib1f(GLuint indx, GLfloat x);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib1fv(GLuint indx, const GLfloat* values);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib2fv(GLuint indx, const GLfloat* values);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib3fv(GLuint indx, const GLfloat* values);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttrib4fv(GLuint indx, const GLfloat* values);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+ANGLE_EXPORT void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
+
+}
+
+#endif // LIBGLESV2_ENTRYPOINTGLES20_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0_extcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,1059 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_2_0_ext.cpp : Implements the GLES 2.0 extension entry points.
+
+#include &quot;libGLESv2/entry_points_gles_2_0_ext.h&quot;
+#include &quot;libGLESv2/global_state.h&quot;
+
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Fence.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/Shader.h&quot;
+#include &quot;libANGLE/Query.h&quot;
+
+#include &quot;libANGLE/validationES.h&quot;
+#include &quot;libANGLE/validationES2.h&quot;
+#include &quot;libANGLE/validationES3.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/utilities.h&quot;
+
+namespace gl
+{
+
+void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint %d)&quot;, target, id);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateBeginQuery(context, target, id))
+        {
+            return;
+        }
+
+        Error error = context-&gt;beginQuery(target, id);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint* fences)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* fences = 0x%0.8p)&quot;, n, fences);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            context-&gt;deleteFenceNV(fences[i]);
+        }
+    }
+}
+
+void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint *ids = 0x%0.8p)&quot;, n, ids);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            context-&gt;deleteQuery(ids[i]);
+        }
+    }
+}
+
+void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
+{
+    EVENT(&quot;(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)&quot;, mode, first, count, primcount);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount))
+        {
+            return;
+        }
+
+        Error error = context-&gt;drawArrays(mode, first, count, primcount);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)
+{
+    EVENT(&quot;(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)&quot;,
+          mode, count, type, indices, primcount);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        rx::RangeUI indexRange;
+        if (!ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount, &amp;indexRange))
+        {
+            return;
+        }
+
+        Error error = context-&gt;drawElements(mode, count, type, indices, primcount, indexRange);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY EndQueryEXT(GLenum target)
+{
+    EVENT(&quot;GLenum target = 0x%X)&quot;, target);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateEndQuery(context, target))
+        {
+            return;
+        }
+
+        Error error = context-&gt;endQuery(target);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY FinishFenceNV(GLuint fence)
+{
+    EVENT(&quot;(GLuint fence = %d)&quot;, fence);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        FenceNV *fenceObject = context-&gt;getFenceNV(fence);
+
+        if (fenceObject == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (fenceObject-&gt;isSet() != GL_TRUE)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        fenceObject-&gt;finish();
+    }
+}
+
+void GL_APIENTRY GenFencesNV(GLsizei n, GLuint* fences)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* fences = 0x%0.8p)&quot;, n, fences);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            fences[i] = context-&gt;createFenceNV();
+        }
+    }
+}
+
+void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint* ids)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (GLsizei i = 0; i &lt; n; i++)
+        {
+            ids[i] = context-&gt;createQuery();
+        }
+    }
+}
+
+void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
+{
+    EVENT(&quot;(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)&quot;, fence, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        FenceNV *fenceObject = context-&gt;getFenceNV(fence);
+
+        if (fenceObject == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (fenceObject-&gt;isSet() != GL_TRUE)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        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.
+                GLboolean status = GL_TRUE;
+                if (fenceObject-&gt;getStatus() != GL_TRUE)
+                {
+                    Error error = fenceObject-&gt;test(&amp;status);
+                    if (error.isError())
+                    {
+                        context-&gt;recordError(error);
+                        return;
+                    }
+                }
+                *params = status;
+                break;
+            }
+
+          case GL_FENCE_CONDITION_NV:
+            {
+                *params = static_cast&lt;GLint&gt;(fenceObject-&gt;getCondition());
+                break;
+            }
+
+          default:
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+        }
+    }
+}
+
+GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void)
+{
+    EVENT(&quot;()&quot;);
+
+    Context *context = GetGlobalContext();
+
+    if (context)
+    {
+        return context-&gt;getResetStatus();
+    }
+
+    return GL_NO_ERROR;
+}
+
+void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params)
+{
+    EVENT(&quot;GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidQueryType(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_CURRENT_QUERY_EXT:
+            params[0] = context-&gt;getState().getActiveQueryId(target);
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
+{
+    EVENT(&quot;(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)&quot;, id, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Query *queryObject = context-&gt;getQuery(id, false, GL_NONE);
+
+        if (!queryObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (context-&gt;getState().getActiveQueryId(queryObject-&gt;getType()) == id)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        switch(pname)
+        {
+          case GL_QUERY_RESULT_EXT:
+            {
+                Error error = queryObject-&gt;getResult(params);
+                if (error.isError())
+                {
+                    context-&gt;recordError(error);
+                    return;
+                }
+            }
+            break;
+
+          case GL_QUERY_RESULT_AVAILABLE_EXT:
+            {
+                Error error = queryObject-&gt;isResultAvailable(params);
+                if (error.isError())
+                {
+                    context-&gt;recordError(error);
+                    return;
+                }
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
+{
+    EVENT(&quot;(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)&quot;,
+          shader, bufsize, length, source);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (bufsize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Shader *shaderObject = context-&gt;getShader(shader);
+
+        if (!shaderObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // Only returns extra info if ANGLE_GENERATE_SHADER_DEBUG_INFO is defined
+        shaderObject-&gt;getTranslatedSourceWithDebugInfo(bufsize, length, source);
+    }
+}
+
+void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
+{
+    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)&quot;,
+          program, location, bufSize, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params))
+        {
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        ASSERT(programObject);
+
+        programObject-&gt;getUniformfv(location, params);
+    }
+}
+
+void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params)
+{
+    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)&quot;,
+          program, location, bufSize, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params))
+        {
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        ASSERT(programObject);
+
+        programObject-&gt;getUniformiv(location, params);
+    }
+}
+
+GLboolean GL_APIENTRY IsFenceNV(GLuint fence)
+{
+    EVENT(&quot;(GLuint fence = %d)&quot;, fence);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        FenceNV *fenceObject = context-&gt;getFenceNV(fence);
+
+        if (fenceObject == NULL)
+        {
+            return GL_FALSE;
+        }
+
+        // GL_NV_fence spec:
+        // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
+        return fenceObject-&gt;isSet();
+    }
+
+    return GL_FALSE;
+}
+
+GLboolean GL_APIENTRY IsQueryEXT(GLuint id)
+{
+    EVENT(&quot;(GLuint id = %d)&quot;, id);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        return (context-&gt;getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY ReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
+                                GLenum format, GLenum type, GLsizei bufSize,
+                                GLvoid *data)
+{
+    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, &quot;
+          &quot;GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)&quot;,
+          x, y, width, height, format, type, bufSize, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (width &lt; 0 || height &lt; 0 || bufSize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidateReadPixelsParameters(context, x, y, width, height,
+                                              format, type, &amp;bufSize, data))
+        {
+            return;
+        }
+
+        Framebuffer *framebufferObject = context-&gt;getState().getReadFramebuffer();
+        ASSERT(framebufferObject);
+
+        Rectangle area(x, y, width, height);
+        Error error = framebufferObject-&gt;readPixels(context-&gt;getState(), area, format, type, data);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
+        target, samples, internalformat, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateRenderbufferStorageParametersANGLE(context, target, samples, internalformat,
+            width, height))
+        {
+            return;
+        }
+
+        Renderbuffer *renderbuffer = context-&gt;getState().getCurrentRenderbuffer();
+        Error error = renderbuffer-&gt;setStorageMultisample(samples, internalformat, width, height);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition)
+{
+    EVENT(&quot;(GLuint fence = %d, GLenum condition = 0x%X)&quot;, fence, condition);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (condition != GL_ALL_COMPLETED_NV)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        FenceNV *fenceObject = context-&gt;getFenceNV(fence);
+
+        if (fenceObject == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Error error = fenceObject-&gt;set(condition);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+GLboolean GL_APIENTRY TestFenceNV(GLuint fence)
+{
+    EVENT(&quot;(GLuint fence = %d)&quot;, fence);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        FenceNV *fenceObject = context-&gt;getFenceNV(fence);
+
+        if (fenceObject == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_TRUE;
+        }
+
+        if (fenceObject-&gt;isSet() != GL_TRUE)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_TRUE;
+        }
+
+        GLboolean result;
+        Error error = fenceObject-&gt;test(&amp;result);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return GL_TRUE;
+        }
+
+        return result;
+    }
+
+    return GL_TRUE;
+}
+
+void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
+           target, levels, internalformat, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!context-&gt;getExtensions().textureStorage)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
+            !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height))
+        {
+            return;
+        }
+
+        if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
+            !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
+        {
+            return;
+        }
+
+        Extents size(width, height, 1);
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;setStorage(target, levels, internalformat, size);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
+{
+    EVENT(&quot;(GLuint index = %d, GLuint divisor = %d)&quot;, index, divisor);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;setVertexAttribDivisor(index, divisor);
+    }
+}
+
+void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
+                          GLbitfield mask, GLenum filter)
+{
+    EVENT(&quot;(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, &quot;
+          &quot;GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, &quot;
+          &quot;GLbitfield mask = 0x%X, GLenum filter = 0x%X)&quot;,
+          srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+                                               dstX0, dstY0, dstX1, dstY1, mask, filter,
+                                               true))
+        {
+            return;
+        }
+
+        Framebuffer *readFramebuffer = context-&gt;getState().getReadFramebuffer();
+        ASSERT(readFramebuffer);
+
+        Framebuffer *drawFramebuffer = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(drawFramebuffer);
+
+        Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
+        Rectangle dstArea(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
+
+        Error error = drawFramebuffer-&gt;blit(context-&gt;getState(), srcArea, dstArea, mask, filter, readFramebuffer);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
+                   GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, &quot;
+          &quot;GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, &quot;
+          &quot;GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* pixels = 0x%0.8p)&quot;,
+          target, level, internalformat, width, height, depth, border, format, type, pixels);
+
+    UNIMPLEMENTED();   // FIXME
+}
+
+void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
+{
+    EVENT(&quot;(GLenum program = 0x%X, bufSize = %d, length = 0x%0.8p, binaryFormat = 0x%0.8p, binary = 0x%0.8p)&quot;,
+          program, bufSize, length, binaryFormat, binary);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject || !programObject-&gt;isLinked())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Error error = programObject-&gt;saveBinary(binaryFormat, binary, bufSize, length);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY ProgramBinaryOES(GLuint program, GLenum binaryFormat, const void *binary, GLint length)
+{
+    EVENT(&quot;(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)&quot;,
+          program, binaryFormat, binary, length);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        const std::vector&lt;GLenum&gt; &amp;programBinaryFormats = context-&gt;getCaps().programBinaryFormats;
+        if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end())
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        if (!programObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Error error = programObject-&gt;loadBinary(binaryFormat, binary, length);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs)
+{
+    EVENT(&quot;(GLenum n = %d, bufs = 0x%0.8p)&quot;, n, bufs);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (n &lt; 0 || static_cast&lt;GLuint&gt;(n) &gt; context-&gt;getCaps().maxDrawBuffers)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        ASSERT(context-&gt;getState().getDrawFramebuffer());
+
+        if (context-&gt;getState().getDrawFramebuffer()-&gt;id() == 0)
+        {
+            if (n != 1)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+
+            if (bufs[0] != GL_NONE &amp;&amp; bufs[0] != GL_BACK)
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+        }
+        else
+        {
+            for (int colorAttachment = 0; colorAttachment &lt; n; colorAttachment++)
+            {
+                const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment;
+                if (bufs[colorAttachment] != GL_NONE &amp;&amp; bufs[colorAttachment] != attachment)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+            }
+        }
+
+        Framebuffer *framebuffer = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(framebuffer);
+
+        framebuffer-&gt;setDrawBuffers(n, bufs);
+    }
+}
+
+void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, void** params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (pname != GL_BUFFER_MAP_POINTER)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (!buffer || !buffer-&gt;isMapped())
+        {
+            *params = NULL;
+        }
+        else
+        {
+            *params = buffer-&gt;getMapPointer();
+        }
+    }
+}
+
+void *GL_APIENTRY MapBufferOES(GLenum target, GLenum access)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLbitfield access = 0x%X)&quot;, target, access);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return NULL;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (buffer == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        if (access != GL_WRITE_ONLY_OES)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return NULL;
+        }
+
+        if (buffer-&gt;isMapped())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        Error error = buffer-&gt;map(access);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return NULL;
+        }
+
+        return buffer-&gt;getMapPointer();
+    }
+
+    return NULL;
+}
+
+GLboolean GL_APIENTRY UnmapBufferOES(GLenum target)
+{
+    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return GL_FALSE;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (buffer == NULL || !buffer-&gt;isMapped())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_FALSE;
+        }
+
+        GLboolean result;
+        Error error = buffer-&gt;unmap(&amp;result);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return GL_FALSE;
+        }
+
+        return result;
+    }
+
+    return GL_FALSE;
+}
+
+void *GL_APIENTRY MapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)&quot;,
+          target, offset, length, access);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return NULL;
+        }
+
+        if (offset &lt; 0 || length &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return NULL;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (buffer == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        // Check for buffer overflow
+        size_t offsetSize = static_cast&lt;size_t&gt;(offset);
+        size_t lengthSize = static_cast&lt;size_t&gt;(length);
+
+        if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+            offsetSize + lengthSize &gt; static_cast&lt;size_t&gt;(buffer-&gt;getSize()))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return NULL;
+        }
+
+        // Check for invalid bits in the mask
+        GLbitfield allAccessBits = GL_MAP_READ_BIT |
+                                   GL_MAP_WRITE_BIT |
+                                   GL_MAP_INVALIDATE_RANGE_BIT |
+                                   GL_MAP_INVALIDATE_BUFFER_BIT |
+                                   GL_MAP_FLUSH_EXPLICIT_BIT |
+                                   GL_MAP_UNSYNCHRONIZED_BIT;
+
+        if (access &amp; ~(allAccessBits))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return NULL;
+        }
+
+        if (length == 0 || buffer-&gt;isMapped())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        // Check for invalid bit combinations
+        if ((access &amp; (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT |
+                                   GL_MAP_INVALIDATE_BUFFER_BIT |
+                                   GL_MAP_UNSYNCHRONIZED_BIT;
+
+        if ((access &amp; GL_MAP_READ_BIT) != 0 &amp;&amp; (access &amp; writeOnlyBits) != 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        if ((access &amp; GL_MAP_WRITE_BIT) == 0 &amp;&amp; (access &amp; GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        Error error = buffer-&gt;mapRange(offset, length, access);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return NULL;
+        }
+
+        return buffer-&gt;getMapPointer();
+    }
+
+    return NULL;
+}
+
+void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)&quot;, target, offset, length);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (offset &lt; 0 || length &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (buffer == NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!buffer-&gt;isMapped() || (buffer-&gt;getAccessFlags() &amp; GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // Check for buffer overflow
+        size_t offsetSize = static_cast&lt;size_t&gt;(offset);
+        size_t lengthSize = static_cast&lt;size_t&gt;(length);
+
+        if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
+            offsetSize + lengthSize &gt; static_cast&lt;size_t&gt;(buffer-&gt;getMapLength()))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        // We do not currently support a non-trivial implementation of FlushMappedBufferRange
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_2_0_exth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_2_0_ext.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_2_0_ext.h : Defines the GLES 2.0 extension entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTGLES20EXT_H_
+#define LIBGLESV2_ENTRYPOINTGLES20EXT_H_
+
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;GLES2/gl2ext.h&gt;
+#include &lt;export.h&gt;
+
+namespace gl
+{
+
+// GL_ANGLE_framebuffer_blit
+ANGLE_EXPORT void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+
+// GL_ANGLE_framebuffer_multisample
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+
+// GL_NV_fence
+ANGLE_EXPORT void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint* fences);
+ANGLE_EXPORT void GL_APIENTRY GenFencesNV(GLsizei n, GLuint* fences);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsFenceNV(GLuint fence);
+ANGLE_EXPORT GLboolean GL_APIENTRY TestFenceNV(GLuint fence);
+ANGLE_EXPORT void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY FinishFenceNV(GLuint fence);
+ANGLE_EXPORT void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition);
+
+// GL_ANGLE_translated_shader_source
+ANGLE_EXPORT void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+
+// GL_EXT_texture_storage
+ANGLE_EXPORT void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+
+// GL_EXT_robustness
+ANGLE_EXPORT GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void);
+ANGLE_EXPORT void GL_APIENTRY ReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params);
+ANGLE_EXPORT void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params);
+
+// GL_EXT_occlusion_query_boolean
+ANGLE_EXPORT void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint *ids);
+ANGLE_EXPORT void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsQueryEXT(GLuint id);
+ANGLE_EXPORT void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY EndQueryEXT(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params);
+
+// GL_EXT_draw_buffers
+ANGLE_EXPORT void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs);
+
+// GL_ANGLE_instanced_arrays
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor);
+
+// GL_OES_get_program_binary
+ANGLE_EXPORT void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+ANGLE_EXPORT void GL_APIENTRY ProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+
+// GL_OES_mapbuffer
+ANGLE_EXPORT void *GL_APIENTRY MapBufferOES(GLenum target, GLenum access);
+ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBufferOES(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, GLvoid **params);
+
+// GL_EXT_map_buffer_range
+ANGLE_EXPORT void *GL_APIENTRY MapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length);
+
+}
+
+#endif // LIBGLESV2_ENTRYPOINTGLES20EXT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0cpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,3394 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_3_0.cpp : Implements the GLES 3.0 entry points.
+
+#include &quot;libGLESv2/entry_points_gles_3_0.h&quot;
+#include &quot;libGLESv2/entry_points_gles_2_0_ext.h&quot;
+#include &quot;libGLESv2/global_state.h&quot;
+
+#include &quot;libANGLE/formatutils.h&quot;
+#include &quot;libANGLE/Buffer.h&quot;
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+#include &quot;libANGLE/Fence.h&quot;
+#include &quot;libANGLE/Framebuffer.h&quot;
+#include &quot;libANGLE/Query.h&quot;
+#include &quot;libANGLE/VertexArray.h&quot;
+
+#include &quot;libANGLE/validationES.h&quot;
+#include &quot;libANGLE/validationES3.h&quot;
+#include &quot;libANGLE/queryconversions.h&quot;
+
+#include &quot;common/debug.h&quot;
+
+namespace gl
+{
+
+void GL_APIENTRY ReadBuffer(GLenum mode)
+{
+    EVENT(&quot;(GLenum mode = 0x%X)&quot;, mode);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateReadBuffer(context, mode))
+        {
+            return;
+        }
+
+        Framebuffer *readFBO = context-&gt;getState().getReadFramebuffer();
+        readFBO-&gt;setReadBuffer(mode);
+    }
+}
+
+void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+{
+    EVENT(&quot;(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, &quot;
+          &quot;const GLvoid* indices = 0x%0.8p)&quot;, mode, start, end, count, type, indices);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        rx::RangeUI indexRange;
+        if (!ValidateDrawElements(context, mode, count, type, indices, 0, &amp;indexRange))
+        {
+            return;
+        }
+        if (indexRange.end &gt; end || indexRange.start &lt; start)
+        {
+            // GL spec says that behavior in this case is undefined - generating an error is fine.
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // As long as index validation is done, it doesn't matter whether the context receives a drawElements or
+        // a drawRangeElements call - the GL back-end is free to choose to call drawRangeElements based on the
+        // validated index range. If index validation is removed, adding drawRangeElements to the context interface
+        // should be reconsidered.
+        Error error = context-&gt;drawElements(mode, count, type, indices, 0, indexRange);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, &quot;
+          &quot;GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, &quot;
+          &quot;GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)&quot;,
+          target, level, internalformat, width, height, depth, border, format, type, pixels);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // validateES3TexImageFormat sets the error code if there is an error
+        if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
+                                           0, 0, 0, width, height, depth, border, format, type, pixels))
+        {
+            return;
+        }
+
+        Extents size(width, height, depth);
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;setImage(target, level, internalformat, size, format, type, context-&gt;getState().getUnpackState(),
+                                        reinterpret_cast&lt;const uint8_t *&gt;(pixels));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
+          &quot;GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, &quot;
+          &quot;GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)&quot;,
+          target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // validateES3TexImageFormat sets the error code if there is an error
+        if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
+                                           xoffset, yoffset, zoffset, width, height, depth, 0,
+                                           format, type, pixels))
+        {
+            return;
+        }
+
+        // Zero sized uploads are valid but no-ops
+        if (width == 0 || height == 0 || depth == 0)
+        {
+            return;
+        }
+
+        Box area(xoffset, yoffset, zoffset, width, height, depth);
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;setSubImage(target, level, area, format, type, context-&gt;getState().getUnpackState(),
+                                           reinterpret_cast&lt;const uint8_t *&gt;(pixels));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
+          &quot;GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;,
+          target, level, xoffset, yoffset, zoffset, x, y, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset,
+                                               x, y, width, height, 0))
+        {
+            return;
+        }
+
+        Offset destOffset(xoffset, yoffset, zoffset);
+        Rectangle sourceArea(x, y, width, height);
+
+        const Framebuffer *framebuffer = context-&gt;getState().getReadFramebuffer();
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;copySubImage(target, level, destOffset, sourceArea, framebuffer);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, &quot;
+          &quot;GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, &quot;
+          &quot;const GLvoid* data = 0x%0.8p)&quot;,
+          target, level, internalformat, width, height, depth, border, imageSize, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(internalformat);
+        if (imageSize &lt; 0 || static_cast&lt;GLuint&gt;(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        // validateES3TexImageFormat sets the error code if there is an error
+        if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
+                                           0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data))
+        {
+            return;
+        }
+
+        Extents size(width, height, depth);
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;setCompressedImage(target, level, internalformat, size, context-&gt;getState().getUnpackState(),
+                                                  reinterpret_cast&lt;const uint8_t *&gt;(data));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
+        &quot;GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, &quot;
+        &quot;GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)&quot;,
+        target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        const InternalFormat &amp;formatInfo = GetInternalFormatInfo(format);
+        if (imageSize &lt; 0 || static_cast&lt;GLuint&gt;(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!data)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        // validateES3TexImageFormat sets the error code if there is an error
+        if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
+                                           0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data))
+        {
+            return;
+        }
+
+        // Zero sized uploads are valid but no-ops
+        if (width == 0 || height == 0)
+        {
+            return;
+        }
+
+        Box area(xoffset, yoffset, zoffset, width, height, depth);
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;setCompressedSubImage(target, level, area, format, context-&gt;getState().getUnpackState(),
+                                                     reinterpret_cast&lt;const uint8_t *&gt;(data));
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GenQueries(GLsizei n, GLuint* ids)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (GLsizei i = 0; i &lt; n; i++)
+        {
+            ids[i] = context-&gt;createQuery();
+        }
+    }
+}
+
+void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint* ids)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (GLsizei i = 0; i &lt; n; i++)
+        {
+            context-&gt;deleteQuery(ids[i]);
+        }
+    }
+}
+
+GLboolean GL_APIENTRY IsQuery(GLuint id)
+{
+    EVENT(&quot;(GLuint id = %u)&quot;, id);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_FALSE;
+        }
+
+        return (context-&gt;getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY BeginQuery(GLenum target, GLuint id)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint id = %u)&quot;, target, id);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateBeginQuery(context, target, id))
+        {
+            return;
+        }
+
+        Error error = context-&gt;beginQuery(target, id);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY EndQuery(GLenum target)
+{
+    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateEndQuery(context, target))
+        {
+            return;
+        }
+
+        Error error = context-&gt;endQuery(target);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidQueryType(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_CURRENT_QUERY:
+            params[0] = static_cast&lt;GLint&gt;(context-&gt;getState().getActiveQueryId(target));
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+{
+    EVENT(&quot;(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, id, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Query *queryObject = context-&gt;getQuery(id, false, GL_NONE);
+
+        if (!queryObject)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (context-&gt;getState().getActiveQueryId(queryObject-&gt;getType()) == id)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        switch(pname)
+        {
+          case GL_QUERY_RESULT_EXT:
+            {
+                Error error = queryObject-&gt;getResult(params);
+                if (error.isError())
+                {
+                    context-&gt;recordError(error);
+                    return;
+                }
+            }
+            break;
+
+          case GL_QUERY_RESULT_AVAILABLE_EXT:
+            {
+                Error error = queryObject-&gt;isResultAvailable(params);
+                if (error.isError())
+                {
+                    context-&gt;recordError(error);
+                    return;
+                }
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+GLboolean GL_APIENTRY UnmapBuffer(GLenum target)
+{
+    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_FALSE;
+        }
+
+        return UnmapBufferOES(target);
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)&quot;, target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        GetBufferPointervOES(target, pname, params);
+    }
+}
+
+void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum* bufs)
+{
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        DrawBuffersEXT(n, bufs);
+    }
+}
+
+void GL_APIENTRY UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x3, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix2x3fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x2, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix3x2fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x4, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix2x4fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x2, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix4x2fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x4, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix3x4fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
+          location, count, transpose, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x3, location, count, transpose))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniformMatrix4x3fv(location, count, transpose, value);
+    }
+}
+
+void GL_APIENTRY BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+    EVENT(&quot;(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, &quot;
+          &quot;GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)&quot;,
+          srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
+                                               dstX0, dstY0, dstX1, dstY1, mask, filter,
+                                               false))
+        {
+            return;
+        }
+
+        Framebuffer *readFramebuffer = context-&gt;getState().getReadFramebuffer();
+        ASSERT(readFramebuffer);
+
+        Framebuffer *drawFramebuffer = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(drawFramebuffer);
+
+        Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0);
+        Rectangle dstArea(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0);
+
+        Error error = drawFramebuffer-&gt;blit(context-&gt;getState(), srcArea, dstArea, mask, filter, readFramebuffer);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
+        target, samples, internalformat, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateES3RenderbufferStorageParameters(context, target, samples, internalformat, width, height))
+        {
+            return;
+        }
+
+        Renderbuffer *renderbuffer = context-&gt;getState().getCurrentRenderbuffer();
+        renderbuffer-&gt;setStorageMultisample(samples, internalformat, width, height);
+    }
+}
+
+void GL_APIENTRY FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)&quot;,
+        target, attachment, texture, level, layer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateFramebufferTextureLayer(context, target, attachment, texture,
+                                             level, layer))
+        {
+            return;
+        }
+
+        Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+        ASSERT(framebuffer);
+
+        if (texture != 0)
+        {
+            Texture *textureObject = context-&gt;getTexture(texture);
+
+            ImageIndex index = ImageIndex::MakeInvalid();
+
+            if (textureObject-&gt;getTarget() == GL_TEXTURE_3D)
+            {
+                index = ImageIndex::Make3D(level, layer);
+            }
+            else
+            {
+                ASSERT(textureObject-&gt;getTarget() == GL_TEXTURE_2D_ARRAY);
+                index = ImageIndex::Make2DArray(level, layer);
+            }
+
+            framebuffer-&gt;setAttachment(GL_TEXTURE, attachment, index, textureObject);
+        }
+        else
+        {
+            framebuffer-&gt;resetAttachment(attachment);
+        }
+    }
+}
+
+GLvoid *GL_APIENTRY MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)&quot;,
+          target, offset, length, access);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        return MapBufferRangeEXT(target, offset, length, access);
+    }
+
+    return NULL;
+}
+
+void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)&quot;, target, offset, length);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        FlushMappedBufferRangeEXT(target, offset, length);
+    }
+}
+
+void GL_APIENTRY BindVertexArray(GLuint array)
+{
+    EVENT(&quot;(GLuint array = %u)&quot;, array);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        VertexArray *vao = context-&gt;getVertexArray(array);
+
+        if (!vao)
+        {
+            // The default VAO should always exist
+            ASSERT(array != 0);
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        context-&gt;bindVertexArray(array);
+    }
+}
+
+void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint* arrays)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)&quot;, n, arrays);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int arrayIndex = 0; arrayIndex &lt; n; arrayIndex++)
+        {
+            if (arrays[arrayIndex] != 0)
+            {
+                context-&gt;deleteVertexArray(arrays[arrayIndex]);
+            }
+        }
+    }
+}
+
+void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint* arrays)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* arrays = 0x%0.8p)&quot;, n, arrays);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (n &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int arrayIndex = 0; arrayIndex &lt; n; arrayIndex++)
+        {
+            arrays[arrayIndex] = context-&gt;createVertexArray();
+        }
+    }
+}
+
+GLboolean GL_APIENTRY IsVertexArray(GLuint array)
+{
+    EVENT(&quot;(GLuint array = %u)&quot;, array);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_FALSE;
+        }
+
+        if (array == 0)
+        {
+            return GL_FALSE;
+        }
+
+        VertexArray *vao = context-&gt;getVertexArray(array);
+
+        return (vao != NULL ? GL_TRUE : GL_FALSE);
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint* data)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)&quot;,
+          target, index, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        const Caps &amp;caps = context-&gt;getCaps();
+        switch (target)
+        {
+          case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+          case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+          case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+            if (index &gt;= caps.maxTransformFeedbackSeparateAttributes)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          case GL_UNIFORM_BUFFER_START:
+          case GL_UNIFORM_BUFFER_SIZE:
+          case GL_UNIFORM_BUFFER_BINDING:
+            if (index &gt;= caps.maxCombinedUniformBlocks)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (!(context-&gt;getIndexedIntegerv(target, index, data)))
+        {
+            GLenum nativeType;
+            unsigned int numParams = 0;
+            if (!context-&gt;getIndexedQueryParameterInfo(target, &amp;nativeType, &amp;numParams))
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+
+            if (numParams == 0)
+            {
+                return; // it is known that pname is valid, but there are no parameters to return
+            }
+
+            if (nativeType == GL_INT_64_ANGLEX)
+            {
+                GLint64 minIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;int&gt;::min());
+                GLint64 maxIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;int&gt;::max());
+                GLint64 *int64Params = new GLint64[numParams];
+
+                context-&gt;getIndexedInteger64v(target, index, int64Params);
+
+                for (unsigned int i = 0; i &lt; numParams; ++i)
+                {
+                    GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue);
+                    data[i] = static_cast&lt;GLint&gt;(clampedValue);
+                }
+
+                delete [] int64Params;
+            }
+            else
+            {
+                UNREACHABLE();
+            }
+        }
+    }
+}
+
+void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode)
+{
+    EVENT(&quot;(GLenum primitiveMode = 0x%X)&quot;, primitiveMode);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        switch (primitiveMode)
+        {
+          case GL_TRIANGLES:
+          case GL_LINES:
+          case GL_POINTS:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        TransformFeedback *transformFeedback = context-&gt;getState().getCurrentTransformFeedback();
+        ASSERT(transformFeedback != NULL);
+
+        if (transformFeedback-&gt;isActive())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (transformFeedback-&gt;isPaused())
+        {
+            transformFeedback-&gt;resume();
+        }
+        else
+        {
+            transformFeedback-&gt;begin(primitiveMode);
+        }
+    }
+}
+
+void GL_APIENTRY EndTransformFeedback(void)
+{
+    EVENT(&quot;(void)&quot;);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        TransformFeedback *transformFeedback = context-&gt;getState().getCurrentTransformFeedback();
+        ASSERT(transformFeedback != NULL);
+
+        if (!transformFeedback-&gt;isActive())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        transformFeedback-&gt;end();
+    }
+}
+
+void GL_APIENTRY BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)&quot;,
+          target, index, buffer, offset, size);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        const Caps &amp;caps = context-&gt;getCaps();
+        switch (target)
+        {
+          case GL_TRANSFORM_FEEDBACK_BUFFER:
+            if (index &gt;= caps.maxTransformFeedbackSeparateAttributes)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          case GL_UNIFORM_BUFFER:
+            if (index &gt;= caps.maxUniformBufferBindings)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (buffer != 0 &amp;&amp; size &lt;= 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (target)
+        {
+          case GL_TRANSFORM_FEEDBACK_BUFFER:
+            {
+                // size and offset must be a multiple of 4
+                if (buffer != 0 &amp;&amp; ((offset % 4) != 0 || (size % 4) != 0))
+                {
+                    context-&gt;recordError(Error(GL_INVALID_VALUE));
+                    return;
+                }
+
+                // Cannot bind a transform feedback buffer if the current transform feedback is active (3.0.4 pg 91 section 2.15.2)
+                TransformFeedback *curTransformFeedback = context-&gt;getState().getCurrentTransformFeedback();
+                if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isActive())
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+
+                context-&gt;bindIndexedTransformFeedbackBuffer(buffer, index, offset, size);
+                context-&gt;bindGenericTransformFeedbackBuffer(buffer);
+                break;
+            }
+
+          case GL_UNIFORM_BUFFER:
+
+            // it is an error to bind an offset not a multiple of the alignment
+            if (buffer != 0 &amp;&amp; (offset % caps.uniformBufferOffsetAlignment) != 0)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+
+            context-&gt;bindIndexedUniformBuffer(buffer, index, offset, size);
+            context-&gt;bindGenericUniformBuffer(buffer);
+            break;
+
+          default:
+            UNREACHABLE();
+        }
+    }
+}
+
+void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)&quot;,
+          target, index, buffer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        const Caps &amp;caps = context-&gt;getCaps();
+        switch (target)
+        {
+          case GL_TRANSFORM_FEEDBACK_BUFFER:
+            if (index &gt;= caps.maxTransformFeedbackSeparateAttributes)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          case GL_UNIFORM_BUFFER:
+            if (index &gt;= caps.maxUniformBufferBindings)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        switch (target)
+        {
+          case GL_TRANSFORM_FEEDBACK_BUFFER:
+            {
+                // Cannot bind a transform feedback buffer if the current transform feedback is active (3.0.4 pg 91 section 2.15.2)
+                TransformFeedback *curTransformFeedback = context-&gt;getState().getCurrentTransformFeedback();
+                if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isActive())
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+
+                context-&gt;bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0);
+                context-&gt;bindGenericTransformFeedbackBuffer(buffer);
+                break;
+            }
+          case GL_UNIFORM_BUFFER:
+            context-&gt;bindIndexedUniformBuffer(buffer, index, 0, 0);
+            context-&gt;bindGenericUniformBuffer(buffer);
+            break;
+
+          default:
+            UNREACHABLE();
+        }
+    }
+}
+
+void GL_APIENTRY TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+{
+    EVENT(&quot;(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)&quot;,
+          program, count, varyings, bufferMode);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (count &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        const Caps &amp;caps = context-&gt;getCaps();
+        switch (bufferMode)
+        {
+          case GL_INTERLEAVED_ATTRIBS:
+            break;
+          case GL_SEPARATE_ATTRIBS:
+            if (static_cast&lt;GLuint&gt;(count) &gt; caps.maxTransformFeedbackSeparateAttributes)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (!ValidProgram(context, program))
+        {
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        ASSERT(programObject);
+
+        programObject-&gt;setTransformFeedbackVaryings(count, varyings, bufferMode);
+    }
+}
+
+void GL_APIENTRY GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+{
+    EVENT(&quot;(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, &quot;
+          &quot;GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)&quot;,
+          program, index, bufSize, length, size, type, name);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (bufSize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidProgram(context, program))
+        {
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        ASSERT(programObject);
+
+        if (index &gt;= static_cast&lt;GLuint&gt;(programObject-&gt;getTransformFeedbackVaryingCount()))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        programObject-&gt;getTransformFeedbackVarying(index, bufSize, length, size, type, name);
+    }
+}
+
+void GL_APIENTRY VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+    EVENT(&quot;(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)&quot;,
+          index, size, type, stride, pointer);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (size &lt; 1 || size &gt; 4)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (type)
+        {
+          case GL_BYTE:
+          case GL_UNSIGNED_BYTE:
+          case GL_SHORT:
+          case GL_UNSIGNED_SHORT:
+          case GL_INT:
+          case GL_UNSIGNED_INT:
+          case GL_INT_2_10_10_10_REV:
+          case GL_UNSIGNED_INT_2_10_10_10_REV:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (stride &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) &amp;&amp; size != 4)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // [OpenGL ES 3.0.2] Section 2.8 page 24:
+        // An INVALID_OPERATION error is generated when a non-zero vertex array object
+        // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+        // and the pointer argument is not NULL.
+        if (context-&gt;getState().getVertexArray()-&gt;id() != 0 &amp;&amp; context-&gt;getState().getArrayBufferId() == 0 &amp;&amp; pointer != NULL)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        context-&gt;getState().setVertexAttribState(index, context-&gt;getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true,
+                                                 stride, pointer);
+    }
+}
+
+void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
+          index, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidateGetVertexAttribParameters(context, pname))
+        {
+            return;
+        }
+
+        if (pname == GL_CURRENT_VERTEX_ATTRIB)
+        {
+            const VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getState().getVertexAttribCurrentValue(index);
+            for (int i = 0; i &lt; 4; ++i)
+            {
+                params[i] = currentValueData.IntValues[i];
+            }
+        }
+        else
+        {
+            const VertexAttribute &amp;attribState = context-&gt;getState().getVertexArray()-&gt;getVertexAttribute(index);
+            *params = QuerySingleVertexAttributeParameter&lt;GLint&gt;(attribState, pname);
+        }
+    }
+}
+
+void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+{
+    EVENT(&quot;(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)&quot;,
+          index, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (!ValidateGetVertexAttribParameters(context, pname))
+        {
+            return;
+        }
+
+        if (pname == GL_CURRENT_VERTEX_ATTRIB)
+        {
+            const VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getState().getVertexAttribCurrentValue(index);
+            for (int i = 0; i &lt; 4; ++i)
+            {
+                params[i] = currentValueData.UnsignedIntValues[i];
+            }
+        }
+        else
+        {
+            const VertexAttribute &amp;attribState = context-&gt;getState().getVertexArray()-&gt;getVertexAttribute(index);
+            *params = QuerySingleVertexAttributeParameter&lt;GLuint&gt;(attribState, pname);
+        }
+    }
+}
+
+void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+    EVENT(&quot;(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)&quot;,
+          index, x, y, z, w);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLint vals[4] = { x, y, z, w };
+        context-&gt;getState().setVertexAttribi(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+    EVENT(&quot;(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)&quot;,
+          index, x, y, z, w);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        GLuint vals[4] = { x, y, z, w };
+        context-&gt;getState().setVertexAttribu(index, vals);
+    }
+}
+
+void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint* v)
+{
+    EVENT(&quot;(GLuint index = %u, const GLint* v = 0x%0.8p)&quot;, index, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setVertexAttribi(index, v);
+    }
+}
+
+void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint* v)
+{
+    EVENT(&quot;(GLuint index = %u, const GLuint* v = 0x%0.8p)&quot;, index, v);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;getState().setVertexAttribu(index, v);
+    }
+}
+
+void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint* params)
+{
+    EVENT(&quot;(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)&quot;,
+          program, location, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateGetUniformuiv(context, program, location, params))
+        {
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+        ASSERT(programObject);
+
+        programObject-&gt;getUniformuiv(location, params);
+    }
+}
+
+GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name)
+{
+    EVENT(&quot;(GLuint program = %u, const GLchar *name = 0x%0.8p)&quot;,
+          program, name);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return -1;
+        }
+
+        if (program == 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return -1;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject || !programObject-&gt;isLinked())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return -1;
+        }
+
+        return programObject-&gt;getFragDataLocation(name);
+    }
+
+    return 0;
+}
+
+void GL_APIENTRY Uniform1ui(GLint location, GLuint v0)
+{
+    Uniform1uiv(location, 1, &amp;v0);
+}
+
+void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+    const GLuint xy[] = { v0, v1 };
+    Uniform2uiv(location, 1, xy);
+}
+
+void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+    const GLuint xyz[] = { v0, v1, v2 };
+    Uniform3uiv(location, 1, xyz);
+}
+
+void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+    const GLuint xyzw[] = { v0, v1, v2, v3 };
+    Uniform4uiv(location, 1, xyzw);
+}
+
+void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)&quot;,
+          location, count, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform1uiv(location, count, value);
+    }
+}
+
+void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)&quot;,
+          location, count, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC2, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform2uiv(location, count, value);
+    }
+}
+
+void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value)&quot;,
+          location, count, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC3, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform3uiv(location, count, value);
+    }
+}
+
+void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint* value)
+{
+    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)&quot;,
+          location, count, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC4, location, count))
+        {
+            return;
+        }
+
+        Program *program = context-&gt;getState().getProgram();
+        program-&gt;setUniform4uiv(location, count, value);
+    }
+}
+
+void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
+{
+    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)&quot;,
+          buffer, drawbuffer, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateClearBuffer(context))
+        {
+            return;
+        }
+
+        switch (buffer)
+        {
+          case GL_COLOR:
+            if (drawbuffer &lt; 0 || static_cast&lt;GLuint&gt;(drawbuffer) &gt;= context-&gt;getCaps().maxDrawBuffers)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          case GL_STENCIL:
+            if (drawbuffer != 0)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Framebuffer *framebufferObject = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(framebufferObject);
+
+        Error error = framebufferObject-&gt;clearBufferiv(context-&gt;getState(), buffer, drawbuffer, value);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+{
+    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)&quot;,
+          buffer, drawbuffer, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateClearBuffer(context))
+        {
+            return;
+        }
+
+        switch (buffer)
+        {
+          case GL_COLOR:
+            if (drawbuffer &lt; 0 || static_cast&lt;GLuint&gt;(drawbuffer) &gt;= context-&gt;getCaps().maxDrawBuffers)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Framebuffer *framebufferObject = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(framebufferObject);
+
+        Error error = framebufferObject-&gt;clearBufferuiv(context-&gt;getState(), buffer, drawbuffer, value);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+{
+    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)&quot;,
+          buffer, drawbuffer, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateClearBuffer(context))
+        {
+            return;
+        }
+
+        switch (buffer)
+        {
+          case GL_COLOR:
+            if (drawbuffer &lt; 0 || static_cast&lt;GLuint&gt;(drawbuffer) &gt;= context-&gt;getCaps().maxDrawBuffers)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          case GL_DEPTH:
+            if (drawbuffer != 0)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Framebuffer *framebufferObject = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(framebufferObject);
+
+        Error error = framebufferObject-&gt;clearBufferfv(context-&gt;getState(), buffer, drawbuffer, value);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)&quot;,
+          buffer, drawbuffer, depth, stencil);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (!ValidateClearBuffer(context))
+        {
+            return;
+        }
+
+        switch (buffer)
+        {
+          case GL_DEPTH_STENCIL:
+            if (drawbuffer != 0)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Framebuffer *framebufferObject = context-&gt;getState().getDrawFramebuffer();
+        ASSERT(framebufferObject);
+
+        Error error = framebufferObject-&gt;clearBufferfi(context-&gt;getState(), buffer, drawbuffer, depth, stencil);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index)
+{
+    EVENT(&quot;(GLenum name = 0x%X, GLuint index = %u)&quot;, name, index);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return NULL;
+        }
+
+        if (name != GL_EXTENSIONS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return NULL;
+        }
+
+        if (index &gt;= context-&gt;getExtensionStringCount())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return NULL;
+        }
+
+        return reinterpret_cast&lt;const GLubyte*&gt;(context-&gt;getExtensionString(index).c_str());
+    }
+
+    return NULL;
+}
+
+void GL_APIENTRY CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+{
+    EVENT(&quot;(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)&quot;,
+          readTarget, writeTarget, readOffset, writeOffset, size);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidBufferTarget(context, readTarget) || !ValidBufferTarget(context, writeTarget))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Buffer *readBuffer = context-&gt;getState().getTargetBuffer(readTarget);
+        Buffer *writeBuffer = context-&gt;getState().getTargetBuffer(writeTarget);
+
+        if (!readBuffer || !writeBuffer)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // Verify that readBuffer and writeBuffer are not currently mapped
+        if (readBuffer-&gt;isMapped() || writeBuffer-&gt;isMapped())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (readOffset &lt; 0 || writeOffset &lt; 0 || size &lt; 0 ||
+            static_cast&lt;unsigned int&gt;(readOffset + size) &gt; readBuffer-&gt;getSize() ||
+            static_cast&lt;unsigned int&gt;(writeOffset + size) &gt; writeBuffer-&gt;getSize())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (readBuffer == writeBuffer &amp;&amp; std::abs(readOffset - writeOffset) &lt; size)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        // if size is zero, the copy is a successful no-op
+        if (size &gt; 0)
+        {
+            Error error = writeBuffer-&gt;copyBufferSubData(readBuffer, readOffset, writeOffset, size);
+            if (error.isError())
+            {
+                context-&gt;recordError(error);
+                return;
+            }
+        }
+    }
+}
+
+void GL_APIENTRY GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+{
+    EVENT(&quot;(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)&quot;,
+          program, uniformCount, uniformNames, uniformIndices);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (uniformCount &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (!programObject-&gt;isLinked())
+        {
+            for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
+            {
+                uniformIndices[uniformId] = GL_INVALID_INDEX;
+            }
+        }
+        else
+        {
+            for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
+            {
+                uniformIndices[uniformId] = programObject-&gt;getUniformIndex(uniformNames[uniformId]);
+            }
+        }
+    }
+}
+
+void GL_APIENTRY GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
+          program, uniformCount, uniformIndices, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (uniformCount &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        switch (pname)
+        {
+          case GL_UNIFORM_TYPE:
+          case GL_UNIFORM_SIZE:
+          case GL_UNIFORM_NAME_LENGTH:
+          case GL_UNIFORM_BLOCK_INDEX:
+          case GL_UNIFORM_OFFSET:
+          case GL_UNIFORM_ARRAY_STRIDE:
+          case GL_UNIFORM_MATRIX_STRIDE:
+          case GL_UNIFORM_IS_ROW_MAJOR:
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (uniformCount &gt; programObject-&gt;getActiveUniformCount())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
+        {
+            const GLuint index = uniformIndices[uniformId];
+
+            if (index &gt;= static_cast&lt;GLuint&gt;(programObject-&gt;getActiveUniformCount()))
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
+        {
+            const GLuint index = uniformIndices[uniformId];
+            params[uniformId] = programObject-&gt;getActiveUniformi(index, pname);
+        }
+    }
+}
+
+GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+{
+    EVENT(&quot;(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)&quot;, program, uniformBlockName);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_INVALID_INDEX;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return GL_INVALID_INDEX;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return GL_INVALID_INDEX;
+            }
+        }
+
+        return programObject-&gt;getUniformBlockIndex(uniformBlockName);
+    }
+
+    return 0;
+}
+
+void GL_APIENTRY GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
+          program, uniformBlockIndex, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (uniformBlockIndex &gt;= programObject-&gt;getActiveUniformBlockCount())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_UNIFORM_BLOCK_BINDING:
+            *params = static_cast&lt;GLint&gt;(programObject-&gt;getUniformBlockBinding(uniformBlockIndex));
+            break;
+
+          case GL_UNIFORM_BLOCK_DATA_SIZE:
+          case GL_UNIFORM_BLOCK_NAME_LENGTH:
+          case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+          case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+          case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+          case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+            programObject-&gt;getActiveUniformBlockiv(uniformBlockIndex, pname, params);
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+{
+    EVENT(&quot;(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)&quot;,
+          program, uniformBlockIndex, bufSize, length, uniformBlockName);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        if (uniformBlockIndex &gt;= programObject-&gt;getActiveUniformBlockCount())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        programObject-&gt;getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
+    }
+}
+
+void GL_APIENTRY UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+    EVENT(&quot;(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)&quot;,
+          program, uniformBlockIndex, uniformBlockBinding);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (uniformBlockBinding &gt;= context-&gt;getCaps().maxUniformBufferBindings)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Program *programObject = context-&gt;getProgram(program);
+
+        if (!programObject)
+        {
+            if (context-&gt;getShader(program))
+            {
+                context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                return;
+            }
+            else
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+        }
+
+        // if never linked, there won't be any uniform blocks
+        if (uniformBlockIndex &gt;= programObject-&gt;getActiveUniformBlockCount())
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        programObject-&gt;bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
+    }
+}
+
+void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+{
+    EVENT(&quot;(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)&quot;,
+          mode, first, count, instanceCount);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateDrawArraysInstanced(context, mode, first, count, instanceCount))
+        {
+            return;
+        }
+
+        Error error = context-&gt;drawArrays(mode, first, count, instanceCount);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+{
+    EVENT(&quot;(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)&quot;,
+          mode, count, type, indices, instanceCount);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        rx::RangeUI indexRange;
+        if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, instanceCount, &amp;indexRange))
+        {
+            return;
+        }
+
+        Error error = context-&gt;drawElements(mode, count, type, indices, instanceCount, indexRange);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+GLsync GL_APIENTRY FenceSync_(GLenum condition, GLbitfield flags)
+{
+    EVENT(&quot;(GLenum condition = 0x%X, GLbitfield flags = 0x%X)&quot;, condition, flags);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return 0;
+        }
+
+        if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return 0;
+        }
+
+        if (flags != 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return 0;
+        }
+
+        GLsync fenceSync = context-&gt;createFenceSync();
+
+        FenceSync *fenceSyncObject = context-&gt;getFenceSync(fenceSync);
+        Error error = fenceSyncObject-&gt;set(condition, flags);
+        if (error.isError())
+        {
+            context-&gt;deleteFenceSync(fenceSync);
+            context-&gt;recordError(error);
+            return NULL;
+        }
+
+        return fenceSync;
+    }
+
+    return NULL;
+}
+
+GLboolean GL_APIENTRY IsSync(GLsync sync)
+{
+    EVENT(&quot;(GLsync sync = 0x%0.8p)&quot;, sync);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_FALSE;
+        }
+
+        return (context-&gt;getFenceSync(sync) != NULL);
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY DeleteSync(GLsync sync)
+{
+    EVENT(&quot;(GLsync sync = 0x%0.8p)&quot;, sync);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (sync != static_cast&lt;GLsync&gt;(0) &amp;&amp; !context-&gt;getFenceSync(sync))
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;deleteFenceSync(sync);
+    }
+}
+
+GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+    EVENT(&quot;(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)&quot;,
+          sync, flags, timeout);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_WAIT_FAILED;
+        }
+
+        if ((flags &amp; ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return GL_WAIT_FAILED;
+        }
+
+        FenceSync *fenceSync = context-&gt;getFenceSync(sync);
+
+        if (!fenceSync)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return GL_WAIT_FAILED;
+        }
+
+        GLenum result = GL_WAIT_FAILED;
+        Error error = fenceSync-&gt;clientWait(flags, timeout, &amp;result);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return GL_WAIT_FAILED;
+        }
+
+        return result;
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+    EVENT(&quot;(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)&quot;,
+          sync, flags, timeout);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (flags != 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        if (timeout != GL_TIMEOUT_IGNORED)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        FenceSync *fenceSync = context-&gt;getFenceSync(sync);
+
+        if (!fenceSync)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        Error error = fenceSync-&gt;serverWait(flags, timeout);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+        }
+    }
+}
+
+void GL_APIENTRY GetInteger64v(GLenum pname, GLint64* params)
+{
+    EVENT(&quot;(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)&quot;,
+          pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        GLenum nativeType;
+        unsigned int numParams = 0;
+        if (!ValidateStateQuery(context, pname, &amp;nativeType, &amp;numParams))
+        {
+            return;
+        }
+
+        if (nativeType == GL_INT_64_ANGLEX)
+        {
+            context-&gt;getInteger64v(pname, params);
+        }
+        else
+        {
+            CastStateValues(context, nativeType, pname, numParams, params);
+        }
+    }
+}
+
+void GL_APIENTRY GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+{
+    EVENT(&quot;(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)&quot;,
+          sync, pname, bufSize, length, values);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (bufSize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        FenceSync *fenceSync = context-&gt;getFenceSync(sync);
+
+        if (!fenceSync)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_OBJECT_TYPE:     values[0] = static_cast&lt;GLint&gt;(GL_SYNC_FENCE);              break;
+          case GL_SYNC_CONDITION:  values[0] = static_cast&lt;GLint&gt;(fenceSync-&gt;getCondition());  break;
+          case GL_SYNC_FLAGS:      values[0] = static_cast&lt;GLint&gt;(fenceSync-&gt;getFlags());      break;
+
+          case GL_SYNC_STATUS:
+            {
+                Error error = fenceSync-&gt;getStatus(values);
+                if (error.isError())
+                {
+                    context-&gt;recordError(error);
+                    return;
+                }
+                break;
+            }
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)&quot;,
+          target, index, data);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        const Caps &amp;caps = context-&gt;getCaps();
+        switch (target)
+        {
+          case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+          case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+          case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+            if (index &gt;= caps.maxTransformFeedbackSeparateAttributes)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          case GL_UNIFORM_BUFFER_START:
+          case GL_UNIFORM_BUFFER_SIZE:
+          case GL_UNIFORM_BUFFER_BINDING:
+            if (index &gt;= caps.maxUniformBufferBindings)
+            {
+                context-&gt;recordError(Error(GL_INVALID_VALUE));
+                return;
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (!(context-&gt;getIndexedInteger64v(target, index, data)))
+        {
+            GLenum nativeType;
+            unsigned int numParams = 0;
+            if (!context-&gt;getIndexedQueryParameterInfo(target, &amp;nativeType, &amp;numParams))
+            {
+                context-&gt;recordError(Error(GL_INVALID_ENUM));
+                return;
+            }
+
+            if (numParams == 0)
+                return; // it is known that pname is valid, but there are no parameters to return
+
+            if (nativeType == GL_INT)
+            {
+                GLint *intParams = new GLint[numParams];
+
+                context-&gt;getIndexedIntegerv(target, index, intParams);
+
+                for (unsigned int i = 0; i &lt; numParams; ++i)
+                {
+                    data[i] = static_cast&lt;GLint64&gt;(intParams[i]);
+                }
+
+                delete [] intParams;
+            }
+            else
+            {
+                UNREACHABLE();
+            }
+        }
+    }
+}
+
+void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)&quot;,
+          target, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidBufferTarget(context, target))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (!ValidBufferParameter(context, pname))
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        Buffer *buffer = context-&gt;getState().getTargetBuffer(target);
+
+        if (!buffer)
+        {
+            // A null buffer means that &quot;0&quot; is bound to the requested buffer target
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_BUFFER_USAGE:
+            *params = static_cast&lt;GLint64&gt;(buffer-&gt;getUsage());
+            break;
+          case GL_BUFFER_SIZE:
+            *params = buffer-&gt;getSize();
+            break;
+          case GL_BUFFER_ACCESS_FLAGS:
+            *params = static_cast&lt;GLint64&gt;(buffer-&gt;getAccessFlags());
+            break;
+          case GL_BUFFER_MAPPED:
+            *params = static_cast&lt;GLint64&gt;(buffer-&gt;isMapped());
+            break;
+          case GL_BUFFER_MAP_OFFSET:
+            *params = buffer-&gt;getMapOffset();
+            break;
+          case GL_BUFFER_MAP_LENGTH:
+            *params = buffer-&gt;getMapLength();
+            break;
+          default: UNREACHABLE(); break;
+        }
+    }
+}
+
+void GL_APIENTRY GenSamplers(GLsizei count, GLuint* samplers)
+{
+    EVENT(&quot;(GLsizei count = %d, GLuint* samplers = 0x%0.8p)&quot;, count, samplers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (count &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; count; i++)
+        {
+            samplers[i] = context-&gt;createSampler();
+        }
+    }
+}
+
+void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint* samplers)
+{
+    EVENT(&quot;(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)&quot;, count, samplers);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (count &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        for (int i = 0; i &lt; count; i++)
+        {
+            context-&gt;deleteSampler(samplers[i]);
+        }
+    }
+}
+
+GLboolean GL_APIENTRY IsSampler(GLuint sampler)
+{
+    EVENT(&quot;(GLuint sampler = %u)&quot;, sampler);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_FALSE;
+        }
+
+        return context-&gt;isSampler(sampler);
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler)
+{
+    EVENT(&quot;(GLuint unit = %u, GLuint sampler = %u)&quot;, unit, sampler);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (sampler != 0 &amp;&amp; !context-&gt;isSampler(sampler))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (unit &gt;= context-&gt;getCaps().maxCombinedTextureImageUnits)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;bindSampler(unit, sampler);
+    }
+}
+
+void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+    EVENT(&quot;(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)&quot;, sampler, pname, param);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateSamplerObjectParameter(context, pname))
+        {
+            return;
+        }
+
+        if (!ValidateTexParamParameters(context, pname, param))
+        {
+            return;
+        }
+
+        if (!context-&gt;isSampler(sampler))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        context-&gt;samplerParameteri(sampler, pname, param);
+    }
+}
+
+void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+{
+    SamplerParameteri(sampler, pname, *param);
+}
+
+void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+    EVENT(&quot;(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)&quot;, sampler, pname, param);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateSamplerObjectParameter(context, pname))
+        {
+            return;
+        }
+
+        if (!ValidateTexParamParameters(context, pname, static_cast&lt;GLint&gt;(param)))
+        {
+            return;
+        }
+
+        if (!context-&gt;isSampler(sampler))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        context-&gt;samplerParameterf(sampler, pname, param);
+    }
+}
+
+void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+{
+    SamplerParameterf(sampler, pname, *param);
+}
+
+void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+{
+    EVENT(&quot;(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, sampler, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateSamplerObjectParameter(context, pname))
+        {
+            return;
+        }
+
+        if (!context-&gt;isSampler(sampler))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        *params = context-&gt;getSamplerParameteri(sampler, pname);
+    }
+}
+
+void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+{
+    EVENT(&quot;(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, sampler, pname, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateSamplerObjectParameter(context, pname))
+        {
+            return;
+        }
+
+        if (!context-&gt;isSampler(sampler))
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        *params = context-&gt;getSamplerParameterf(sampler, pname);
+    }
+}
+
+void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor)
+{
+    EVENT(&quot;(GLuint index = %u, GLuint divisor = %u)&quot;, index, divisor);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (index &gt;= MAX_VERTEX_ATTRIBS)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        context-&gt;setVertexAttribDivisor(index, divisor);
+    }
+}
+
+void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLuint id = %u)&quot;, target, id);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        switch (target)
+        {
+          case GL_TRANSFORM_FEEDBACK:
+            {
+                // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1)
+                TransformFeedback *curTransformFeedback = context-&gt;getState().getCurrentTransformFeedback();
+                if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isActive() &amp;&amp; !curTransformFeedback-&gt;isPaused())
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+
+                // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1)
+                if (context-&gt;getTransformFeedback(id) == NULL)
+                {
+                    context-&gt;recordError(Error(GL_INVALID_OPERATION));
+                    return;
+                }
+
+                context-&gt;bindTransformFeedback(id);
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+{
+    EVENT(&quot;(GLsizei n = %d, const GLuint* ids = 0x%0.8p)&quot;, n, ids);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            context-&gt;deleteTransformFeedback(ids[i]);
+        }
+    }
+}
+
+void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint* ids)
+{
+    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        for (int i = 0; i &lt; n; i++)
+        {
+            ids[i] = context-&gt;createTransformFeedback();
+        }
+    }
+}
+
+GLboolean GL_APIENTRY IsTransformFeedback(GLuint id)
+{
+    EVENT(&quot;(GLuint id = %u)&quot;, id);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return GL_FALSE;
+        }
+
+        return ((context-&gt;getTransformFeedback(id) != NULL) ? GL_TRUE : GL_FALSE);
+    }
+
+    return GL_FALSE;
+}
+
+void GL_APIENTRY PauseTransformFeedback(void)
+{
+    EVENT(&quot;(void)&quot;);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        TransformFeedback *transformFeedback = context-&gt;getState().getCurrentTransformFeedback();
+        ASSERT(transformFeedback != NULL);
+
+        // Current transform feedback must be active and not paused in order to pause (3.0.2 pg 86)
+        if (!transformFeedback-&gt;isActive() || transformFeedback-&gt;isPaused())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        transformFeedback-&gt;pause();
+    }
+}
+
+void GL_APIENTRY ResumeTransformFeedback(void)
+{
+    EVENT(&quot;(void)&quot;);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        TransformFeedback *transformFeedback = context-&gt;getState().getCurrentTransformFeedback();
+        ASSERT(transformFeedback != NULL);
+
+        // Current transform feedback must be active and paused in order to resume (3.0.2 pg 86)
+        if (!transformFeedback-&gt;isActive() || !transformFeedback-&gt;isPaused())
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        transformFeedback-&gt;resume();
+    }
+}
+
+void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+{
+    EVENT(&quot;(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)&quot;,
+          program, bufSize, length, binaryFormat, binary);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // TODO: Pipe through to the OES extension for now, needs proper validation
+        return GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
+    }
+}
+
+void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+{
+    EVENT(&quot;(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)&quot;,
+          program, binaryFormat, binary, length);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // TODO: Pipe through to the OES extension for now, needs proper validation
+        return ProgramBinaryOES(program, binaryFormat, binary, length);
+    }
+}
+
+void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+    EVENT(&quot;(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)&quot;,
+          program, pname, value);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        // glProgramParameteri
+        UNIMPLEMENTED();
+    }
+}
+
+void GL_APIENTRY InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)&quot;,
+          target, numAttachments, attachments);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+        {
+            return;
+        }
+
+        Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+        ASSERT(framebuffer);
+
+        if (framebuffer-&gt;checkStatus(context-&gt;getData()) == GL_FRAMEBUFFER_COMPLETE)
+        {
+            Error error = framebuffer-&gt;invalidate(numAttachments, attachments);
+            if (error.isError())
+            {
+                context-&gt;recordError(error);
+                return;
+            }
+        }
+    }
+}
+
+void GL_APIENTRY InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, &quot;
+          &quot;GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;,
+          target, numAttachments, attachments, x, y, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
+        {
+            return;
+        }
+
+        Framebuffer *framebuffer = context-&gt;getState().getTargetFramebuffer(target);
+        ASSERT(framebuffer);
+
+        if (framebuffer-&gt;checkStatus(context-&gt;getData()) == GL_FRAMEBUFFER_COMPLETE)
+        {
+            Rectangle area(x, y, width, height);
+            Error error = framebuffer-&gt;invalidateSub(numAttachments, attachments, area);
+            if (error.isError())
+            {
+                context-&gt;recordError(error);
+                return;
+            }
+        }
+    }
+}
+
+void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
+          target, levels, internalformat, width, height);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
+        {
+            return;
+        }
+
+        Extents size(width, height, 1);
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;setStorage(target, levels, internalformat, size);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, &quot;
+          &quot;GLsizei height = %d, GLsizei depth = %d)&quot;,
+          target, levels, internalformat, width, height, depth);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth))
+        {
+            return;
+        }
+
+        Extents size(width, height, depth);
+        Texture *texture = context-&gt;getTargetTexture(target);
+        Error error = texture-&gt;setStorage(target, levels, internalformat, size);
+        if (error.isError())
+        {
+            context-&gt;recordError(error);
+            return;
+        }
+    }
+}
+
+void GL_APIENTRY GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+    EVENT(&quot;(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, &quot;
+          &quot;GLint* params = 0x%0.8p)&quot;,
+          target, internalformat, pname, bufSize, params);
+
+    Context *context = GetValidGlobalContext();
+    if (context)
+    {
+        if (context-&gt;getClientVersion() &lt; 3)
+        {
+            context-&gt;recordError(Error(GL_INVALID_OPERATION));
+            return;
+        }
+
+        const TextureCaps &amp;formatCaps = context-&gt;getTextureCaps().get(internalformat);
+        if (!formatCaps.renderable)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (target != GL_RENDERBUFFER)
+        {
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+
+        if (bufSize &lt; 0)
+        {
+            context-&gt;recordError(Error(GL_INVALID_VALUE));
+            return;
+        }
+
+        switch (pname)
+        {
+          case GL_NUM_SAMPLE_COUNTS:
+            if (bufSize != 0)
+            {
+                *params = formatCaps.sampleCounts.size();
+            }
+            break;
+
+          case GL_SAMPLES:
+            {
+                size_t returnCount = std::min&lt;size_t&gt;(bufSize, formatCaps.sampleCounts.size());
+                auto sampleReverseIt = formatCaps.sampleCounts.rbegin();
+                for (size_t sampleIndex = 0; sampleIndex &lt; returnCount; ++sampleIndex)
+                {
+                    params[sampleIndex] = *sampleReverseIt++;;
+                }
+            }
+            break;
+
+          default:
+            context-&gt;recordError(Error(GL_INVALID_ENUM));
+            return;
+        }
+    }
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0h"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,125 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_3_0.h : Defines the GLES 3.0 entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTGLES30_H_
+#define LIBGLESV2_ENTRYPOINTGLES30_H_
+
+#include &lt;GLES3/gl3.h&gt;
+#include &lt;export.h&gt;
+
+namespace gl
+{
+
+ANGLE_EXPORT void GL_APIENTRY ReadBuffer(GLenum mode);
+ANGLE_EXPORT void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices);
+ANGLE_EXPORT void GL_APIENTRY TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+ANGLE_EXPORT void GL_APIENTRY TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+ANGLE_EXPORT void GL_APIENTRY GenQueries(GLsizei n, GLuint* ids);
+ANGLE_EXPORT void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint* ids);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsQuery(GLuint id);
+ANGLE_EXPORT void GL_APIENTRY BeginQuery(GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY EndQuery(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params);
+ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBuffer(GLenum target);
+ANGLE_EXPORT void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params);
+ANGLE_EXPORT void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum* bufs);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+ANGLE_EXPORT GLvoid* GL_APIENTRY MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
+ANGLE_EXPORT void GL_APIENTRY BindVertexArray(GLuint array);
+ANGLE_EXPORT void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint* arrays);
+ANGLE_EXPORT void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint* arrays);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArray(GLuint array);
+ANGLE_EXPORT void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint* data);
+ANGLE_EXPORT void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode);
+ANGLE_EXPORT void GL_APIENTRY EndTransformFeedback(void);
+ANGLE_EXPORT void GL_APIENTRY BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+ANGLE_EXPORT void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer);
+ANGLE_EXPORT void GL_APIENTRY TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode);
+ANGLE_EXPORT void GL_APIENTRY GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint* v);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint* v);
+ANGLE_EXPORT void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint* params);
+ANGLE_EXPORT GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name);
+ANGLE_EXPORT void GL_APIENTRY Uniform1ui(GLint location, GLuint v0);
+ANGLE_EXPORT void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1);
+ANGLE_EXPORT void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
+ANGLE_EXPORT void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+ANGLE_EXPORT void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint* value);
+ANGLE_EXPORT void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint* value);
+ANGLE_EXPORT void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint* value);
+ANGLE_EXPORT void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint* value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value);
+ANGLE_EXPORT void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+ANGLE_EXPORT const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index);
+ANGLE_EXPORT void GL_APIENTRY CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+ANGLE_EXPORT void GL_APIENTRY GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params);
+ANGLE_EXPORT GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName);
+ANGLE_EXPORT void GL_APIENTRY UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+ANGLE_EXPORT void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+ANGLE_EXPORT void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount);
+ANGLE_EXPORT GLsync GL_APIENTRY FenceSync_(GLenum condition, GLbitfield flags);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSync(GLsync sync);
+ANGLE_EXPORT void GL_APIENTRY DeleteSync(GLsync sync);
+ANGLE_EXPORT GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
+ANGLE_EXPORT void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64v(GLenum pname, GLint64* params);
+ANGLE_EXPORT void GL_APIENTRY GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values);
+ANGLE_EXPORT void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64* data);
+ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params);
+ANGLE_EXPORT void GL_APIENTRY GenSamplers(GLsizei count, GLuint* samplers);
+ANGLE_EXPORT void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint* samplers);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsSampler(GLuint sampler);
+ANGLE_EXPORT void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
+ANGLE_EXPORT void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params);
+ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params);
+ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor);
+ANGLE_EXPORT void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id);
+ANGLE_EXPORT void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint* ids);
+ANGLE_EXPORT void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint* ids);
+ANGLE_EXPORT GLboolean GL_APIENTRY IsTransformFeedback(GLuint id);
+ANGLE_EXPORT void GL_APIENTRY PauseTransformFeedback(void);
+ANGLE_EXPORT void GL_APIENTRY ResumeTransformFeedback(void);
+ANGLE_EXPORT void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary);
+ANGLE_EXPORT void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length);
+ANGLE_EXPORT void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value);
+ANGLE_EXPORT void GL_APIENTRY InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments);
+ANGLE_EXPORT void GL_APIENTRY InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+ANGLE_EXPORT void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+ANGLE_EXPORT void GL_APIENTRY GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params);
+
+}
+
+#endif // LIBGLESV2_ENTRYPOINTGLES30_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0_extcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_3_0_ext.cpp : Implements the GLES 3.0 extension entry points.
+
+#include &quot;libGLESv2/entry_points_gles_3_0_ext.h&quot;
+#include &quot;libGLESv2/global_state.h&quot;
+
+namespace gl
+{
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2entry_points_gles_3_0_exth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/entry_points_gles_3_0_ext.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// entry_points_gles_3_0_ext.h : Defines the GLES 3.0 extension entry points.
+
+#ifndef LIBGLESV2_ENTRYPOINTGLES30EXT_H_
+#define LIBGLESV2_ENTRYPOINTGLES30EXT_H_
+
+#include &lt;GLES3/gl3.h&gt;
+#include &lt;GLES3/gl3ext.h&gt;
+#include &lt;export.h&gt;
+
+namespace gl
+{
+
+// No GLES 3.0 extensions yet
+
+}
+
+#endif // LIBGLESV2_ENTRYPOINTGLES30EXT_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2formatutilscpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,1812 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-
-// formatutils.cpp: Queries for GL image formats.
-
-#include &quot;common/mathutil.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/Framebuffer.h&quot;
-#include &quot;libGLESv2/renderer/Renderer.h&quot;
-#include &quot;libGLESv2/renderer/imageformats.h&quot;
-#include &quot;libGLESv2/renderer/copyimage.h&quot;
-
-namespace gl
-{
-
-// ES2 requires that format is equal to internal format at all glTex*Image2D entry points and the implementation
-// can decide the true, sized, internal format. The ES2FormatMap determines the internal format for all valid
-// format and type combinations.
-
-struct FormatTypeInfo
-{
-    GLenum mInternalFormat;
-    ColorWriteFunction mColorWriteFunction;
-
-    FormatTypeInfo(GLenum internalFormat, ColorWriteFunction writeFunc)
-        : mInternalFormat(internalFormat), mColorWriteFunction(writeFunc)
-    { }
-};
-
-typedef std::pair&lt;GLenum, GLenum&gt; FormatTypePair;
-typedef std::pair&lt;FormatTypePair, FormatTypeInfo&gt; FormatPair;
-typedef std::map&lt;FormatTypePair, FormatTypeInfo&gt; FormatMap;
-
-// A helper function to insert data into the format map with fewer characters.
-static inline void InsertFormatMapping(FormatMap *map, GLenum format, GLenum type, GLenum internalFormat, ColorWriteFunction writeFunc)
-{
-    map-&gt;insert(FormatPair(FormatTypePair(format, type), FormatTypeInfo(internalFormat, writeFunc)));
-}
-
-FormatMap BuildES2FormatMap()
-{
-    FormatMap map;
-
-    using namespace rx;
-
-    //                       | Format                            | Type                             | Internal format                   | Color write function             |
-    InsertFormatMapping(&amp;map, GL_ALPHA,                           GL_UNSIGNED_BYTE,                  GL_ALPHA8_EXT,                      WriteColor&lt;A8, GLfloat&gt;           );
-    InsertFormatMapping(&amp;map, GL_ALPHA,                           GL_FLOAT,                          GL_ALPHA32F_EXT,                    WriteColor&lt;A32F, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_ALPHA,                           GL_HALF_FLOAT_OES,                 GL_ALPHA16F_EXT,                    WriteColor&lt;A16F, GLfloat&gt;         );
-
-    InsertFormatMapping(&amp;map, GL_LUMINANCE,                       GL_UNSIGNED_BYTE,                  GL_LUMINANCE8_EXT,                  WriteColor&lt;L8, GLfloat&gt;           );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE,                       GL_FLOAT,                          GL_LUMINANCE32F_EXT,                WriteColor&lt;L32F, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE,                       GL_HALF_FLOAT_OES,                 GL_LUMINANCE16F_EXT,                WriteColor&lt;L16F, GLfloat&gt;         );
-
-    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,                 GL_UNSIGNED_BYTE,                  GL_LUMINANCE8_ALPHA8_EXT,           WriteColor&lt;L8A8, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,                 GL_FLOAT,                          GL_LUMINANCE_ALPHA32F_EXT,          WriteColor&lt;L32A32F, GLfloat&gt;      );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,                 GL_HALF_FLOAT_OES,                 GL_LUMINANCE_ALPHA16F_EXT,          WriteColor&lt;L16A16F, GLfloat&gt;      );
-
-    InsertFormatMapping(&amp;map, GL_RED,                             GL_UNSIGNED_BYTE,                  GL_R8_EXT,                          WriteColor&lt;R8, GLfloat&gt;           );
-    InsertFormatMapping(&amp;map, GL_RED,                             GL_FLOAT,                          GL_R32F_EXT,                        WriteColor&lt;R32F, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_RED,                             GL_HALF_FLOAT_OES,                 GL_R16F_EXT,                        WriteColor&lt;R16F, GLfloat&gt;         );
-
-    InsertFormatMapping(&amp;map, GL_RG,                              GL_UNSIGNED_BYTE,                  GL_RG8_EXT,                         WriteColor&lt;R8G8, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_RG,                              GL_FLOAT,                          GL_RG32F_EXT,                       WriteColor&lt;R32G32F, GLfloat&gt;      );
-    InsertFormatMapping(&amp;map, GL_RG,                              GL_HALF_FLOAT_OES,                 GL_RG16F_EXT,                       WriteColor&lt;R16G16F, GLfloat&gt;      );
-
-    InsertFormatMapping(&amp;map, GL_RGB,                             GL_UNSIGNED_BYTE,                  GL_RGB8_OES,                        WriteColor&lt;R8G8B8, GLfloat&gt;       );
-    InsertFormatMapping(&amp;map, GL_RGB,                             GL_UNSIGNED_SHORT_5_6_5,           GL_RGB565,                          WriteColor&lt;R5G6B5, GLfloat&gt;       );
-    InsertFormatMapping(&amp;map, GL_RGB,                             GL_FLOAT,                          GL_RGB32F_EXT,                      WriteColor&lt;R32G32B32F, GLfloat&gt;   );
-    InsertFormatMapping(&amp;map, GL_RGB,                             GL_HALF_FLOAT_OES,                 GL_RGB16F_EXT,                      WriteColor&lt;R16G16B16F, GLfloat&gt;   );
-
-    InsertFormatMapping(&amp;map, GL_RGBA,                            GL_UNSIGNED_BYTE,                  GL_RGBA8_OES,                       WriteColor&lt;R8G8B8A8, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGBA,                            GL_UNSIGNED_SHORT_4_4_4_4,         GL_RGBA4,                           WriteColor&lt;R4G4B4A4, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGBA,                            GL_UNSIGNED_SHORT_5_5_5_1,         GL_RGB5_A1,                         WriteColor&lt;R5G5B5A1, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGBA,                            GL_FLOAT,                          GL_RGBA32F_EXT,                     WriteColor&lt;R32G32B32A32F, GLfloat&gt;);
-    InsertFormatMapping(&amp;map, GL_RGBA,                            GL_HALF_FLOAT_OES,                 GL_RGBA16F_EXT,                     WriteColor&lt;R16G16B16A16F, GLfloat&gt;);
-
-    InsertFormatMapping(&amp;map, GL_BGRA_EXT,                        GL_UNSIGNED_BYTE,                  GL_BGRA8_EXT,                       WriteColor&lt;B8G8R8A8, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_BGRA_EXT,                        GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_BGRA4_ANGLEX,                    WriteColor&lt;B4G4R4A4, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_BGRA_EXT,                        GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_BGR5_A1_ANGLEX,                  WriteColor&lt;B5G5R5A1, GLfloat&gt;     );
-
-    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    GL_UNSIGNED_BYTE,                  GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    NULL                              );
-    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   GL_UNSIGNED_BYTE,                  GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   NULL                              );
-    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE,                  GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, NULL                              );
-    InsertFormatMapping(&amp;map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE,                  GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, NULL                              );
-
-    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,                 GL_UNSIGNED_SHORT,                 GL_DEPTH_COMPONENT16,               NULL                              );
-    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,                 GL_UNSIGNED_INT,                   GL_DEPTH_COMPONENT32_OES,           NULL                              );
-
-    InsertFormatMapping(&amp;map, GL_DEPTH_STENCIL_OES,               GL_UNSIGNED_INT_24_8_OES,          GL_DEPTH24_STENCIL8_OES,            NULL                              );
-
-    return map;
-}
-
-FormatMap BuildES3FormatMap()
-{
-    FormatMap map;
-
-    using namespace rx;
-
-    //                       | Format               | Type                             | Internal format          | Color write function             |
-    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_BYTE,                  GL_RGBA8,                  WriteColor&lt;R8G8B8A8, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGBA,               GL_BYTE,                           GL_RGBA8_SNORM,            WriteColor&lt;R8G8B8A8S, GLfloat&gt;    );
-    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_4_4_4_4,         GL_RGBA4,                  WriteColor&lt;R4G4B4A4, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_SHORT_5_5_5_1,         GL_RGB5_A1,                WriteColor&lt;R5G5B5A1, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGBA,               GL_UNSIGNED_INT_2_10_10_10_REV,    GL_RGB10_A2,               WriteColor&lt;R10G10B10A2, GLfloat&gt;  );
-    InsertFormatMapping(&amp;map, GL_RGBA,               GL_FLOAT,                          GL_RGBA32F,                WriteColor&lt;R32G32B32A32F, GLfloat&gt;);
-    InsertFormatMapping(&amp;map, GL_RGBA,               GL_HALF_FLOAT,                     GL_RGBA16F,                WriteColor&lt;R16G16B16A16F, GLfloat&gt;);
-
-    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_BYTE,                  GL_RGBA8UI,                WriteColor&lt;R8G8B8A8, GLuint&gt;      );
-    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_BYTE,                           GL_RGBA8I,                 WriteColor&lt;R8G8B8A8S, GLint&gt;      );
-    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_SHORT,                 GL_RGBA16UI,               WriteColor&lt;R16G16B16A16, GLuint&gt;  );
-    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_SHORT,                          GL_RGBA16I,                WriteColor&lt;R16G16B16A16S, GLint&gt;  );
-    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_INT,                   GL_RGBA32UI,               WriteColor&lt;R32G32B32A32, GLuint&gt;  );
-    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_INT,                            GL_RGBA32I,                WriteColor&lt;R32G32B32A32S, GLint&gt;  );
-    InsertFormatMapping(&amp;map, GL_RGBA_INTEGER,       GL_UNSIGNED_INT_2_10_10_10_REV,    GL_RGB10_A2UI,             WriteColor&lt;R10G10B10A2, GLuint&gt;   );
-
-    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_BYTE,                  GL_RGB8,                   WriteColor&lt;R8G8B8, GLfloat&gt;       );
-    InsertFormatMapping(&amp;map, GL_RGB,                GL_BYTE,                           GL_RGB8_SNORM,             WriteColor&lt;R8G8B8S, GLfloat&gt;      );
-    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_SHORT_5_6_5,           GL_RGB565,                 WriteColor&lt;R5G6B5, GLfloat&gt;       );
-    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_INT_10F_11F_11F_REV,   GL_R11F_G11F_B10F,         WriteColor&lt;R11G11B10F, GLfloat&gt;   );
-    InsertFormatMapping(&amp;map, GL_RGB,                GL_UNSIGNED_INT_5_9_9_9_REV,       GL_RGB9_E5,                WriteColor&lt;R9G9B9E5, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGB,                GL_FLOAT,                          GL_RGB32F,                 WriteColor&lt;R32G32B32F, GLfloat&gt;   );
-    InsertFormatMapping(&amp;map, GL_RGB,                GL_HALF_FLOAT,                     GL_RGB16F,                 WriteColor&lt;R16G16B16F, GLfloat&gt;   );
-
-    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_BYTE,                  GL_RGB8UI,                 WriteColor&lt;R8G8B8, GLuint&gt;        );
-    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_BYTE,                           GL_RGB8I,                  WriteColor&lt;R8G8B8S, GLint&gt;        );
-    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_SHORT,                 GL_RGB16UI,                WriteColor&lt;R16G16B16, GLuint&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_SHORT,                          GL_RGB16I,                 WriteColor&lt;R16G16B16S, GLint&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_UNSIGNED_INT,                   GL_RGB32UI,                WriteColor&lt;R32G32B32, GLuint&gt;     );
-    InsertFormatMapping(&amp;map, GL_RGB_INTEGER,        GL_INT,                            GL_RGB32I,                 WriteColor&lt;R32G32B32S, GLint&gt;     );
-
-    InsertFormatMapping(&amp;map, GL_RG,                 GL_UNSIGNED_BYTE,                  GL_RG8,                    WriteColor&lt;R8G8, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_RG,                 GL_BYTE,                           GL_RG8_SNORM,              WriteColor&lt;R8G8S, GLfloat&gt;        );
-    InsertFormatMapping(&amp;map, GL_RG,                 GL_FLOAT,                          GL_RG32F,                  WriteColor&lt;R32G32F, GLfloat&gt;      );
-    InsertFormatMapping(&amp;map, GL_RG,                 GL_HALF_FLOAT,                     GL_RG16F,                  WriteColor&lt;R16G16F, GLfloat&gt;      );
-
-    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_BYTE,                  GL_RG8UI,                  WriteColor&lt;R8G8, GLuint&gt;          );
-    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_BYTE,                           GL_RG8I,                   WriteColor&lt;R8G8S, GLint&gt;          );
-    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_SHORT,                 GL_RG16UI,                 WriteColor&lt;R16G16, GLuint&gt;        );
-    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_SHORT,                          GL_RG16I,                  WriteColor&lt;R16G16S, GLint&gt;        );
-    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_UNSIGNED_INT,                   GL_RG32UI,                 WriteColor&lt;R32G32, GLuint&gt;        );
-    InsertFormatMapping(&amp;map, GL_RG_INTEGER,         GL_INT,                            GL_RG32I,                  WriteColor&lt;R32G32S, GLint&gt;        );
-
-    InsertFormatMapping(&amp;map, GL_RED,                GL_UNSIGNED_BYTE,                  GL_R8,                     WriteColor&lt;R8, GLfloat&gt;           );
-    InsertFormatMapping(&amp;map, GL_RED,                GL_BYTE,                           GL_R8_SNORM,               WriteColor&lt;R8S, GLfloat&gt;          );
-    InsertFormatMapping(&amp;map, GL_RED,                GL_FLOAT,                          GL_R32F,                   WriteColor&lt;R32F, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_RED,                GL_HALF_FLOAT,                     GL_R16F,                   WriteColor&lt;R16F, GLfloat&gt;         );
-
-    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_BYTE,                  GL_R8UI,                   WriteColor&lt;R8, GLuint&gt;            );
-    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_BYTE,                           GL_R8I,                    WriteColor&lt;R8S, GLint&gt;            );
-    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_SHORT,                 GL_R16UI,                  WriteColor&lt;R16, GLuint&gt;           );
-    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_SHORT,                          GL_R16I,                   WriteColor&lt;R16S, GLint&gt;           );
-    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_UNSIGNED_INT,                   GL_R32UI,                  WriteColor&lt;R32, GLuint&gt;           );
-    InsertFormatMapping(&amp;map, GL_RED_INTEGER,        GL_INT,                            GL_R32I,                   WriteColor&lt;R32S, GLint&gt;           );
-
-    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_UNSIGNED_BYTE,                  GL_LUMINANCE8_ALPHA8_EXT,  WriteColor&lt;L8A8, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE,          GL_UNSIGNED_BYTE,                  GL_LUMINANCE8_EXT,         WriteColor&lt;L8, GLfloat&gt;           );
-    InsertFormatMapping(&amp;map, GL_ALPHA,              GL_UNSIGNED_BYTE,                  GL_ALPHA8_EXT,             WriteColor&lt;A8, GLfloat&gt;           );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_FLOAT,                          GL_LUMINANCE_ALPHA32F_EXT, WriteColor&lt;L32A32F, GLfloat&gt;      );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE,          GL_FLOAT,                          GL_LUMINANCE32F_EXT,       WriteColor&lt;L32F, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_ALPHA,              GL_FLOAT,                          GL_ALPHA32F_EXT,           WriteColor&lt;A32F, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE_ALPHA,    GL_HALF_FLOAT,                     GL_LUMINANCE_ALPHA16F_EXT, WriteColor&lt;L16A16F, GLfloat&gt;      );
-    InsertFormatMapping(&amp;map, GL_LUMINANCE,          GL_HALF_FLOAT,                     GL_LUMINANCE16F_EXT,       WriteColor&lt;L16F, GLfloat&gt;         );
-    InsertFormatMapping(&amp;map, GL_ALPHA,              GL_HALF_FLOAT,                     GL_ALPHA16F_EXT,           WriteColor&lt;A16F, GLfloat&gt;         );
-
-    InsertFormatMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_BYTE,                  GL_BGRA8_EXT,              WriteColor&lt;B8G8R8A8, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_BGRA4_ANGLEX,           WriteColor&lt;B4G4R4A4, GLfloat&gt;     );
-    InsertFormatMapping(&amp;map, GL_BGRA_EXT,           GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_BGR5_A1_ANGLEX,         WriteColor&lt;B5G5R5A1, GLfloat&gt;     );
-
-    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_UNSIGNED_SHORT,                 GL_DEPTH_COMPONENT16,      NULL                              );
-    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_UNSIGNED_INT,                   GL_DEPTH_COMPONENT24,      NULL                              );
-    InsertFormatMapping(&amp;map, GL_DEPTH_COMPONENT,    GL_FLOAT,                          GL_DEPTH_COMPONENT32F,     NULL                              );
-
-    InsertFormatMapping(&amp;map, GL_DEPTH_STENCIL,      GL_UNSIGNED_INT_24_8,              GL_DEPTH24_STENCIL8,       NULL                              );
-    InsertFormatMapping(&amp;map, GL_DEPTH_STENCIL,      GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_DEPTH32F_STENCIL8,      NULL                              );
-
-    return map;
-}
-
-static const FormatMap &amp;GetFormatMap(GLuint clientVersion)
-{
-    if (clientVersion == 2)
-    {
-        static const FormatMap formats = BuildES2FormatMap();
-        return formats;
-    }
-    else if (clientVersion == 3)
-    {
-        static const FormatMap formats = BuildES3FormatMap();
-        return formats;
-    }
-    else
-    {
-        UNREACHABLE();
-        static FormatMap emptyMap;
-        return emptyMap;
-    }
-}
-
-struct FormatInfo
-{
-    GLenum mInternalformat;
-    GLenum mFormat;
-    GLenum mType;
-
-    FormatInfo(GLenum internalformat, GLenum format, GLenum type)
-        : mInternalformat(internalformat), mFormat(format), mType(type) { }
-
-    bool operator&lt;(const FormatInfo&amp; other) const
-    {
-        return memcmp(this, &amp;other, sizeof(FormatInfo)) &lt; 0;
-    }
-};
-
-// ES3 has a specific set of permutations of internal formats, formats and types which are acceptable.
-typedef std::set&lt;FormatInfo&gt; ES3FormatSet;
-
-ES3FormatSet BuildES3FormatSet()
-{
-    ES3FormatSet set;
-
-    // Format combinations from ES 3.0.1 spec, table 3.2
-
-    //                   | Internal format      | Format            | Type                            |
-    //                   |                      |                   |                                 |
-    set.insert(FormatInfo(GL_RGBA8,              GL_RGBA,            GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGB5_A1,            GL_RGBA,            GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGBA4,              GL_RGBA,            GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_SRGB8_ALPHA8,       GL_RGBA,            GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGBA8_SNORM,        GL_RGBA,            GL_BYTE                          ));
-    set.insert(FormatInfo(GL_RGBA4,              GL_RGBA,            GL_UNSIGNED_SHORT_4_4_4_4        ));
-    set.insert(FormatInfo(GL_RGB10_A2,           GL_RGBA,            GL_UNSIGNED_INT_2_10_10_10_REV   ));
-    set.insert(FormatInfo(GL_RGB5_A1,            GL_RGBA,            GL_UNSIGNED_INT_2_10_10_10_REV   ));
-    set.insert(FormatInfo(GL_RGB5_A1,            GL_RGBA,            GL_UNSIGNED_SHORT_5_5_5_1        ));
-    set.insert(FormatInfo(GL_RGBA16F,            GL_RGBA,            GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_RGBA32F,            GL_RGBA,            GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_RGBA16F,            GL_RGBA,            GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_RGBA8UI,            GL_RGBA_INTEGER,    GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGBA8I,             GL_RGBA_INTEGER,    GL_BYTE                          ));
-    set.insert(FormatInfo(GL_RGBA16UI,           GL_RGBA_INTEGER,    GL_UNSIGNED_SHORT                ));
-    set.insert(FormatInfo(GL_RGBA16I,            GL_RGBA_INTEGER,    GL_SHORT                         ));
-    set.insert(FormatInfo(GL_RGBA32UI,           GL_RGBA_INTEGER,    GL_UNSIGNED_INT                  ));
-    set.insert(FormatInfo(GL_RGBA32I,            GL_RGBA_INTEGER,    GL_INT                           ));
-    set.insert(FormatInfo(GL_RGB10_A2UI,         GL_RGBA_INTEGER,    GL_UNSIGNED_INT_2_10_10_10_REV   ));
-    set.insert(FormatInfo(GL_RGB8,               GL_RGB,             GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGB565,             GL_RGB,             GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_SRGB8,              GL_RGB,             GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGB8_SNORM,         GL_RGB,             GL_BYTE                          ));
-    set.insert(FormatInfo(GL_RGB565,             GL_RGB,             GL_UNSIGNED_SHORT_5_6_5          ));
-    set.insert(FormatInfo(GL_R11F_G11F_B10F,     GL_RGB,             GL_UNSIGNED_INT_10F_11F_11F_REV  ));
-    set.insert(FormatInfo(GL_RGB9_E5,            GL_RGB,             GL_UNSIGNED_INT_5_9_9_9_REV      ));
-    set.insert(FormatInfo(GL_RGB16F,             GL_RGB,             GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_R11F_G11F_B10F,     GL_RGB,             GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_RGB9_E5,            GL_RGB,             GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_RGB32F,             GL_RGB,             GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_RGB16F,             GL_RGB,             GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_R11F_G11F_B10F,     GL_RGB,             GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_RGB9_E5,            GL_RGB,             GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_RGB8UI,             GL_RGB_INTEGER,     GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGB8I,              GL_RGB_INTEGER,     GL_BYTE                          ));
-    set.insert(FormatInfo(GL_RGB16UI,            GL_RGB_INTEGER,     GL_UNSIGNED_SHORT                ));
-    set.insert(FormatInfo(GL_RGB16I,             GL_RGB_INTEGER,     GL_SHORT                         ));
-    set.insert(FormatInfo(GL_RGB32UI,            GL_RGB_INTEGER,     GL_UNSIGNED_INT                  ));
-    set.insert(FormatInfo(GL_RGB32I,             GL_RGB_INTEGER,     GL_INT                           ));
-    set.insert(FormatInfo(GL_RG8,                GL_RG,              GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RG8_SNORM,          GL_RG,              GL_BYTE                          ));
-    set.insert(FormatInfo(GL_RG16F,              GL_RG,              GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_RG32F,              GL_RG,              GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_RG16F,              GL_RG,              GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_RG8UI,              GL_RG_INTEGER,      GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RG8I,               GL_RG_INTEGER,      GL_BYTE                          ));
-    set.insert(FormatInfo(GL_RG16UI,             GL_RG_INTEGER,      GL_UNSIGNED_SHORT                ));
-    set.insert(FormatInfo(GL_RG16I,              GL_RG_INTEGER,      GL_SHORT                         ));
-    set.insert(FormatInfo(GL_RG32UI,             GL_RG_INTEGER,      GL_UNSIGNED_INT                  ));
-    set.insert(FormatInfo(GL_RG32I,              GL_RG_INTEGER,      GL_INT                           ));
-    set.insert(FormatInfo(GL_R8,                 GL_RED,             GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_R8_SNORM,           GL_RED,             GL_BYTE                          ));
-    set.insert(FormatInfo(GL_R16F,               GL_RED,             GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_R32F,               GL_RED,             GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_R16F,               GL_RED,             GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_R8UI,               GL_RED_INTEGER,     GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_R8I,                GL_RED_INTEGER,     GL_BYTE                          ));
-    set.insert(FormatInfo(GL_R16UI,              GL_RED_INTEGER,     GL_UNSIGNED_SHORT                ));
-    set.insert(FormatInfo(GL_R16I,               GL_RED_INTEGER,     GL_SHORT                         ));
-    set.insert(FormatInfo(GL_R32UI,              GL_RED_INTEGER,     GL_UNSIGNED_INT                  ));
-    set.insert(FormatInfo(GL_R32I,               GL_RED_INTEGER,     GL_INT                           ));
-
-    // Unsized formats
-    set.insert(FormatInfo(GL_RGBA,               GL_RGBA,            GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGBA,               GL_RGBA,            GL_UNSIGNED_SHORT_4_4_4_4        ));
-    set.insert(FormatInfo(GL_RGBA,               GL_RGBA,            GL_UNSIGNED_SHORT_5_5_5_1        ));
-    set.insert(FormatInfo(GL_RGB,                GL_RGB,             GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_RGB,                GL_RGB,             GL_UNSIGNED_SHORT_5_6_5          ));
-    set.insert(FormatInfo(GL_LUMINANCE_ALPHA,    GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_LUMINANCE,          GL_LUMINANCE,       GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_ALPHA,              GL_ALPHA,           GL_UNSIGNED_BYTE                 ));
-
-    // Depth stencil formats
-    set.insert(FormatInfo(GL_DEPTH_COMPONENT16,  GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT                ));
-    set.insert(FormatInfo(GL_DEPTH_COMPONENT24,  GL_DEPTH_COMPONENT, GL_UNSIGNED_INT                  ));
-    set.insert(FormatInfo(GL_DEPTH_COMPONENT16,  GL_DEPTH_COMPONENT, GL_UNSIGNED_INT                  ));
-    set.insert(FormatInfo(GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_DEPTH24_STENCIL8,   GL_DEPTH_STENCIL,   GL_UNSIGNED_INT_24_8             ));
-    set.insert(FormatInfo(GL_DEPTH32F_STENCIL8,  GL_DEPTH_STENCIL,   GL_FLOAT_32_UNSIGNED_INT_24_8_REV));
-
-    // From GL_OES_texture_float
-    set.insert(FormatInfo(GL_LUMINANCE_ALPHA,    GL_LUMINANCE_ALPHA, GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_LUMINANCE,          GL_LUMINANCE,       GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_ALPHA,              GL_ALPHA,           GL_FLOAT                         ));
-
-    // From GL_OES_texture_half_float
-    set.insert(FormatInfo(GL_LUMINANCE_ALPHA,    GL_LUMINANCE_ALPHA, GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_LUMINANCE,          GL_LUMINANCE,       GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_ALPHA,              GL_ALPHA,           GL_HALF_FLOAT                    ));
-
-    // From GL_EXT_texture_format_BGRA8888
-    set.insert(FormatInfo(GL_BGRA_EXT,           GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 ));
-
-    // From GL_EXT_texture_storage
-    //                   | Internal format          | Format            | Type                            |
-    //                   |                          |                   |                                 |
-    set.insert(FormatInfo(GL_ALPHA8_EXT,             GL_ALPHA,           GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_LUMINANCE8_EXT,         GL_LUMINANCE,       GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_LUMINANCE8_ALPHA8_EXT,  GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_ALPHA32F_EXT,           GL_ALPHA,           GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_LUMINANCE32F_EXT,       GL_LUMINANCE,       GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA, GL_FLOAT                         ));
-    set.insert(FormatInfo(GL_ALPHA16F_EXT,           GL_ALPHA,           GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_LUMINANCE16F_EXT,       GL_LUMINANCE,       GL_HALF_FLOAT                    ));
-    set.insert(FormatInfo(GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT                    ));
-
-    // From GL_EXT_texture_storage and GL_EXT_texture_format_BGRA8888
-    set.insert(FormatInfo(GL_BGRA8_EXT,              GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_BGRA4_ANGLEX,           GL_BGRA_EXT,        GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT));
-    set.insert(FormatInfo(GL_BGRA4_ANGLEX,           GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 ));
-    set.insert(FormatInfo(GL_BGR5_A1_ANGLEX,         GL_BGRA_EXT,        GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT));
-    set.insert(FormatInfo(GL_BGR5_A1_ANGLEX,         GL_BGRA_EXT,        GL_UNSIGNED_BYTE                 ));
-
-    // From GL_ANGLE_depth_texture
-    set.insert(FormatInfo(GL_DEPTH_COMPONENT32_OES,  GL_DEPTH_COMPONENT, GL_UNSIGNED_INT_24_8_OES         ));
-
-    // Compressed formats
-    // From ES 3.0.1 spec, table 3.16
-    //                   | Internal format                             | Format                                      | Type           |
-    //                   |                                             |                                             |                |
-    set.insert(FormatInfo(GL_COMPRESSED_R11_EAC,                        GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_R11_EAC,                        GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_SIGNED_R11_EAC,                 GL_COMPRESSED_SIGNED_R11_EAC,                 GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_RG11_EAC,                       GL_COMPRESSED_RG11_EAC,                       GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_SIGNED_RG11_EAC,                GL_COMPRESSED_SIGNED_RG11_EAC,                GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_RGB8_ETC2,                      GL_COMPRESSED_RGB8_ETC2,                      GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_SRGB8_ETC2,                     GL_COMPRESSED_SRGB8_ETC2,                     GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_RGBA8_ETC2_EAC,                 GL_COMPRESSED_RGBA8_ETC2_EAC,                 GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          GL_UNSIGNED_BYTE));
-
-
-    // From GL_EXT_texture_compression_dxt1
-    set.insert(FormatInfo(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,              GL_COMPRESSED_RGB_S3TC_DXT1_EXT,              GL_UNSIGNED_BYTE));
-    set.insert(FormatInfo(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,             GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,             GL_UNSIGNED_BYTE));
-
-    // From GL_ANGLE_texture_compression_dxt3
-    set.insert(FormatInfo(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,           GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,           GL_UNSIGNED_BYTE));
-
-    // From GL_ANGLE_texture_compression_dxt5
-    set.insert(FormatInfo(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,           GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,           GL_UNSIGNED_BYTE));
-
-    return set;
-}
-
-static const ES3FormatSet &amp;GetES3FormatSet()
-{
-    static const ES3FormatSet es3FormatSet = BuildES3FormatSet();
-    return es3FormatSet;
-}
-
-// Map of sizes of input types
-struct TypeInfo
-{
-    GLuint mTypeBytes;
-    bool mSpecialInterpretation;
-
-    TypeInfo()
-        : mTypeBytes(0), mSpecialInterpretation(false) { }
-
-    TypeInfo(GLuint typeBytes, bool specialInterpretation)
-        : mTypeBytes(typeBytes), mSpecialInterpretation(specialInterpretation) { }
-
-    bool operator&lt;(const TypeInfo&amp; other) const
-    {
-        return memcmp(this, &amp;other, sizeof(TypeInfo)) &lt; 0;
-    }
-};
-
-typedef std::pair&lt;GLenum, TypeInfo&gt; TypeInfoPair;
-typedef std::map&lt;GLenum, TypeInfo&gt; TypeInfoMap;
-
-static TypeInfoMap BuildTypeInfoMap()
-{
-    TypeInfoMap map;
-
-    map.insert(TypeInfoPair(GL_UNSIGNED_BYTE,                  TypeInfo( 1, false)));
-    map.insert(TypeInfoPair(GL_BYTE,                           TypeInfo( 1, false)));
-    map.insert(TypeInfoPair(GL_UNSIGNED_SHORT,                 TypeInfo( 2, false)));
-    map.insert(TypeInfoPair(GL_SHORT,                          TypeInfo( 2, false)));
-    map.insert(TypeInfoPair(GL_UNSIGNED_INT,                   TypeInfo( 4, false)));
-    map.insert(TypeInfoPair(GL_INT,                            TypeInfo( 4, false)));
-    map.insert(TypeInfoPair(GL_HALF_FLOAT,                     TypeInfo( 2, false)));
-    map.insert(TypeInfoPair(GL_HALF_FLOAT_OES,                 TypeInfo( 2, false)));
-    map.insert(TypeInfoPair(GL_FLOAT,                          TypeInfo( 4, false)));
-    map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_5_6_5,           TypeInfo( 2, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_4_4_4_4,         TypeInfo( 2, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_5_5_5_1,         TypeInfo( 2, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, TypeInfo( 2, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, TypeInfo( 2, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_INT_2_10_10_10_REV,    TypeInfo( 4, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_INT_24_8,              TypeInfo( 4, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_INT_10F_11F_11F_REV,   TypeInfo( 4, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_INT_5_9_9_9_REV,       TypeInfo( 4, true )));
-    map.insert(TypeInfoPair(GL_UNSIGNED_INT_24_8_OES,          TypeInfo( 4, true )));
-    map.insert(TypeInfoPair(GL_FLOAT_32_UNSIGNED_INT_24_8_REV, TypeInfo( 8, true )));
-
-    return map;
-}
-
-static bool GetTypeInfo(GLenum type, TypeInfo *outTypeInfo)
-{
-    static const TypeInfoMap infoMap = BuildTypeInfoMap();
-    TypeInfoMap::const_iterator iter = infoMap.find(type);
-    if (iter != infoMap.end())
-    {
-        if (outTypeInfo)
-        {
-            *outTypeInfo = iter-&gt;second;
-        }
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-// Information about internal formats
-typedef bool ((Context::*ContextSupportCheckMemberFunction)(void) const);
-typedef bool (*ContextSupportCheckFunction)(const Context *context);
-
-typedef bool ((rx::Renderer::*RendererSupportCheckMemberFunction)(void) const);
-typedef bool (*ContextRendererSupportCheckFunction)(const Context *context, const rx::Renderer *renderer);
-
-template &lt;ContextSupportCheckMemberFunction func&gt;
-bool CheckSupport(const Context *context)
-{
-    return (context-&gt;*func)();
-}
-
-template &lt;ContextSupportCheckMemberFunction contextFunc, RendererSupportCheckMemberFunction rendererFunc&gt;
-bool CheckSupport(const Context *context, const rx::Renderer *renderer)
-{
-    if (context)
-    {
-        return (context-&gt;*contextFunc)();
-    }
-    else if (renderer)
-    {
-        return (renderer-&gt;*rendererFunc)();
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-template &lt;typename objectType&gt;
-bool AlwaysSupported(const objectType*)
-{
-    return true;
-}
-
-template &lt;typename objectTypeA, typename objectTypeB&gt;
-bool AlwaysSupported(const objectTypeA*, const objectTypeB*)
-{
-    return true;
-}
-
-template &lt;typename objectType&gt;
-bool NeverSupported(const objectType*)
-{
-    return false;
-}
-
-template &lt;typename objectTypeA, typename objectTypeB&gt;
-bool NeverSupported(const objectTypeA *, const objectTypeB *)
-{
-    return false;
-}
-
-template &lt;typename objectType&gt;
-bool UnimplementedSupport(const objectType*)
-{
-    UNIMPLEMENTED();
-    return false;
-}
-
-template &lt;typename objectTypeA, typename objectTypeB&gt;
-bool UnimplementedSupport(const objectTypeA*, const objectTypeB*)
-{
-    UNIMPLEMENTED();
-    return false;
-}
-
-struct InternalFormatInfo
-{
-    GLuint mRedBits;
-    GLuint mGreenBits;
-    GLuint mBlueBits;
-
-    GLuint mLuminanceBits;
-
-    GLuint mAlphaBits;
-    GLuint mSharedBits;
-
-    GLuint mDepthBits;
-    GLuint mStencilBits;
-
-    GLuint mPixelBits;
-
-    GLuint mComponentCount;
-
-    GLuint mCompressedBlockWidth;
-    GLuint mCompressedBlockHeight;
-
-    GLenum mFormat;
-    GLenum mType;
-
-    GLenum mComponentType;
-    GLenum mColorEncoding;
-
-    bool mIsCompressed;
-
-    ContextRendererSupportCheckFunction mIsColorRenderable;
-    ContextRendererSupportCheckFunction mIsDepthRenderable;
-    ContextRendererSupportCheckFunction mIsStencilRenderable;
-    ContextRendererSupportCheckFunction mIsTextureFilterable;
-
-    ContextSupportCheckFunction mSupportFunction;
-
-    InternalFormatInfo() : mRedBits(0), mGreenBits(0), mBlueBits(0), mLuminanceBits(0), mAlphaBits(0), mSharedBits(0), mDepthBits(0), mStencilBits(0),
-                           mPixelBits(0), mComponentCount(0), mCompressedBlockWidth(0), mCompressedBlockHeight(0), mFormat(GL_NONE), mType(GL_NONE),
-                           mComponentType(GL_NONE), mColorEncoding(GL_NONE), mIsCompressed(false), mIsColorRenderable(NeverSupported),
-                           mIsDepthRenderable(NeverSupported), mIsStencilRenderable(NeverSupported), mIsTextureFilterable(NeverSupported),
-                           mSupportFunction(NeverSupported)
-    {
-    }
-
-    static InternalFormatInfo UnsizedFormat(GLenum format, ContextSupportCheckFunction supportFunction)
-    {
-        InternalFormatInfo formatInfo;
-        formatInfo.mFormat = format;
-        formatInfo.mSupportFunction = supportFunction;
-
-        if (format == GL_RGB || format == GL_RGBA)
-            formatInfo.mIsColorRenderable = AlwaysSupported;
-
-        return formatInfo;
-    }
-
-    static InternalFormatInfo RGBAFormat(GLuint red, GLuint green, GLuint blue, GLuint alpha, GLuint shared,
-                                         GLenum format, GLenum type, GLenum componentType, bool srgb,
-                                         ContextRendererSupportCheckFunction colorRenderable,
-                                         ContextRendererSupportCheckFunction textureFilterable,
-                                         ContextSupportCheckFunction supportFunction)
-    {
-        InternalFormatInfo formatInfo;
-        formatInfo.mRedBits = red;
-        formatInfo.mGreenBits = green;
-        formatInfo.mBlueBits = blue;
-        formatInfo.mAlphaBits = alpha;
-        formatInfo.mSharedBits = shared;
-        formatInfo.mPixelBits = red + green + blue + alpha + shared;
-        formatInfo.mComponentCount = ((red &gt; 0) ? 1 : 0) + ((green &gt; 0) ? 1 : 0) + ((blue &gt; 0) ? 1 : 0) + ((alpha &gt; 0) ? 1 : 0);
-        formatInfo.mFormat = format;
-        formatInfo.mType = type;
-        formatInfo.mComponentType = componentType;
-        formatInfo.mColorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
-        formatInfo.mIsColorRenderable = colorRenderable;
-        formatInfo.mIsTextureFilterable = textureFilterable;
-        formatInfo.mSupportFunction = supportFunction;
-        return formatInfo;
-    }
-
-    static InternalFormatInfo LUMAFormat(GLuint luminance, GLuint alpha, GLenum format, GLenum type, GLenum componentType,
-                                         ContextSupportCheckFunction supportFunction)
-    {
-        InternalFormatInfo formatInfo;
-        formatInfo.mLuminanceBits = luminance;
-        formatInfo.mAlphaBits = alpha;
-        formatInfo.mPixelBits = luminance + alpha;
-        formatInfo.mComponentCount = ((luminance &gt; 0) ? 1 : 0) + ((alpha &gt; 0) ? 1 : 0);
-        formatInfo.mFormat = format;
-        formatInfo.mType = type;
-        formatInfo.mComponentType = componentType;
-        formatInfo.mColorEncoding = GL_LINEAR;
-        formatInfo.mIsTextureFilterable = AlwaysSupported;
-        formatInfo.mSupportFunction = supportFunction;
-        return formatInfo;
-    }
-
-    static InternalFormatInfo DepthStencilFormat(GLuint depthBits, GLuint stencilBits, GLuint unusedBits, GLenum format,
-                                                 GLenum type, GLenum componentType,
-                                                 ContextRendererSupportCheckFunction depthRenderable,
-                                                 ContextRendererSupportCheckFunction stencilRenderable,
-                                                 ContextSupportCheckFunction supportFunction)
-    {
-        InternalFormatInfo formatInfo;
-        formatInfo.mDepthBits = depthBits;
-        formatInfo.mStencilBits = stencilBits;
-        formatInfo.mPixelBits = depthBits + stencilBits + unusedBits;
-        formatInfo.mComponentCount = ((depthBits &gt; 0) ? 1 : 0) + ((stencilBits &gt; 0) ? 1 : 0);
-        formatInfo.mFormat = format;
-        formatInfo.mType = type;
-        formatInfo.mComponentType = componentType;
-        formatInfo.mColorEncoding = GL_LINEAR;
-        formatInfo.mIsDepthRenderable = depthRenderable;
-        formatInfo.mIsStencilRenderable = stencilRenderable;
-        formatInfo.mIsTextureFilterable = AlwaysSupported;
-        formatInfo.mSupportFunction = supportFunction;
-        return formatInfo;
-    }
-
-    static InternalFormatInfo CompressedFormat(GLuint compressedBlockWidth, GLuint compressedBlockHeight, GLuint compressedBlockSize,
-                                               GLuint componentCount, GLenum format, GLenum type, bool srgb,
-                                               ContextSupportCheckFunction supportFunction)
-    {
-        InternalFormatInfo formatInfo;
-        formatInfo.mCompressedBlockWidth = compressedBlockWidth;
-        formatInfo.mCompressedBlockHeight = compressedBlockHeight;
-        formatInfo.mPixelBits = compressedBlockSize;
-        formatInfo.mComponentCount = componentCount;
-        formatInfo.mFormat = format;
-        formatInfo.mType = type;
-        formatInfo.mComponentType = GL_UNSIGNED_NORMALIZED;
-        formatInfo.mColorEncoding = (srgb ? GL_SRGB : GL_LINEAR);
-        formatInfo.mIsCompressed = true;
-        formatInfo.mIsTextureFilterable = AlwaysSupported;
-        formatInfo.mSupportFunction = supportFunction;
-        return formatInfo;
-    }
-};
-
-typedef std::pair&lt;GLenum, InternalFormatInfo&gt; InternalFormatInfoPair;
-typedef std::map&lt;GLenum, InternalFormatInfo&gt; InternalFormatInfoMap;
-
-static InternalFormatInfoMap BuildES3InternalFormatInfoMap()
-{
-    InternalFormatInfoMap map;
-
-    // From ES 3.0.1 spec, table 3.12
-    map.insert(InternalFormatInfoPair(GL_NONE,              InternalFormatInfo()));
-
-    //                               | Internal format     |                              | R | G | B | A |S | Format         | Type                           | Component type        | SRGB | Color          | Texture        | Supported          |
-    //                               |                     |                              |   |   |   |   |  |                |                                |                       |      | renderable     | filterable     |                    |
-    map.insert(InternalFormatInfoPair(GL_R8,                InternalFormatInfo::RGBAFormat( 8,  0,  0,  0, 0, GL_RED,          GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R8_SNORM,          InternalFormatInfo::RGBAFormat( 8,  0,  0,  0, 0, GL_RED,          GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, NeverSupported,  AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG8,               InternalFormatInfo::RGBAFormat( 8,  8,  0,  0, 0, GL_RG,           GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG8_SNORM,         InternalFormatInfo::RGBAFormat( 8,  8,  0,  0, 0, GL_RG,           GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, NeverSupported,  AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB8,              InternalFormatInfo::RGBAFormat( 8,  8,  8,  0, 0, GL_RGB,          GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB8_SNORM,        InternalFormatInfo::RGBAFormat( 8,  8,  8,  0, 0, GL_RGB,          GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, NeverSupported,  AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB565,            InternalFormatInfo::RGBAFormat( 5,  6,  5,  0, 0, GL_RGB,          GL_UNSIGNED_SHORT_5_6_5,         GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA4,             InternalFormatInfo::RGBAFormat( 4,  4,  4,  4, 0, GL_RGBA,         GL_UNSIGNED_SHORT_4_4_4_4,       GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB5_A1,           InternalFormatInfo::RGBAFormat( 5,  5,  5,  1, 0, GL_RGBA,         GL_UNSIGNED_SHORT_5_5_5_1,       GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA8,             InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA,         GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA8_SNORM,       InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA,         GL_BYTE,                         GL_SIGNED_NORMALIZED,   false, NeverSupported,  AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB10_A2,          InternalFormatInfo::RGBAFormat(10, 10, 10,  2, 0, GL_RGBA,         GL_UNSIGNED_INT_2_10_10_10_REV,  GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB10_A2UI,        InternalFormatInfo::RGBAFormat(10, 10, 10,  2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV,  GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_SRGB8,             InternalFormatInfo::RGBAFormat( 8,  8,  8,  0, 0, GL_RGB,          GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, true,  NeverSupported,  AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_SRGB8_ALPHA8,      InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA,         GL_UNSIGNED_BYTE,                GL_UNSIGNED_NORMALIZED, true,  AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R11F_G11F_B10F,    InternalFormatInfo::RGBAFormat(11, 11, 10,  0, 0, GL_RGB,          GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FLOAT,               false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB9_E5,           InternalFormatInfo::RGBAFormat( 9,  9,  9,  0, 5, GL_RGB,          GL_UNSIGNED_INT_5_9_9_9_REV,     GL_FLOAT,               false, NeverSupported,  AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R8I,               InternalFormatInfo::RGBAFormat( 8,  0,  0,  0, 0, GL_RED_INTEGER,  GL_BYTE,                         GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R8UI,              InternalFormatInfo::RGBAFormat( 8,  0,  0,  0, 0, GL_RED_INTEGER,  GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R16I,              InternalFormatInfo::RGBAFormat(16,  0,  0,  0, 0, GL_RED_INTEGER,  GL_SHORT,                        GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R16UI,             InternalFormatInfo::RGBAFormat(16,  0,  0,  0, 0, GL_RED_INTEGER,  GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R32I,              InternalFormatInfo::RGBAFormat(32,  0,  0,  0, 0, GL_RED_INTEGER,  GL_INT,                          GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R32UI,             InternalFormatInfo::RGBAFormat(32,  0,  0,  0, 0, GL_RED_INTEGER,  GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG8I,              InternalFormatInfo::RGBAFormat( 8,  8,  0,  0, 0, GL_RG_INTEGER,   GL_BYTE,                         GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG8UI,             InternalFormatInfo::RGBAFormat( 8,  8,  0,  0, 0, GL_RG_INTEGER,   GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG16I,             InternalFormatInfo::RGBAFormat(16, 16,  0,  0, 0, GL_RG_INTEGER,   GL_SHORT,                        GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG16UI,            InternalFormatInfo::RGBAFormat(16, 16,  0,  0, 0, GL_RG_INTEGER,   GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG32I,             InternalFormatInfo::RGBAFormat(32, 32,  0,  0, 0, GL_RG_INTEGER,   GL_INT,                          GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG32UI,            InternalFormatInfo::RGBAFormat(32, 32,  0,  0, 0, GL_RG_INTEGER,   GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB8I,             InternalFormatInfo::RGBAFormat( 8,  8,  8,  0, 0, GL_RGB_INTEGER,  GL_BYTE,                         GL_INT,                 false, NeverSupported,  NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB8UI,            InternalFormatInfo::RGBAFormat( 8,  8,  8,  0, 0, GL_RGB_INTEGER,  GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, NeverSupported,  NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB16I,            InternalFormatInfo::RGBAFormat(16, 16, 16,  0, 0, GL_RGB_INTEGER,  GL_SHORT,                        GL_INT,                 false, NeverSupported,  NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB16UI,           InternalFormatInfo::RGBAFormat(16, 16, 16,  0, 0, GL_RGB_INTEGER,  GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, NeverSupported,  NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB32I,            InternalFormatInfo::RGBAFormat(32, 32, 32,  0, 0, GL_RGB_INTEGER,  GL_INT,                          GL_INT,                 false, NeverSupported,  NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB32UI,           InternalFormatInfo::RGBAFormat(32, 32, 32,  0, 0, GL_RGB_INTEGER,  GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, NeverSupported,  NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA8I,            InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA_INTEGER, GL_BYTE,                         GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA8UI,           InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE,                GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA16I,           InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT,                        GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA16UI,          InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT,               GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA32I,           InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT,                          GL_INT,                 false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA32UI,          InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT,                 GL_UNSIGNED_INT,        false, AlwaysSupported, NeverSupported,  AlwaysSupported     )));
-
-    map.insert(InternalFormatInfoPair(GL_BGRA8_EXT,         InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_BGRA_EXT,     GL_UNSIGNED_BYTE,                  GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_BGRA4_ANGLEX,      InternalFormatInfo::RGBAFormat( 4,  4,  4,  4, 0, GL_BGRA_EXT,     GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_BGR5_A1_ANGLEX,    InternalFormatInfo::RGBAFormat( 5,  5,  5,  1, 0, GL_BGRA_EXT,     GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported     )));
-
-    // Floating point renderability and filtering is provided by OES_texture_float and OES_texture_half_float
-    //                               | Internal format        |                                   | D |S | Format             | Type                           | Comp   | SRGB | Color renderable                                                                                           | Texture filterable                                                                                    | Supported          |
-    //                               |                        |                                   |   |  |                    |                                | type   |      |                                                                                                            |                                                                                                       |                    |
-    map.insert(InternalFormatInfoPair(GL_R16F,              InternalFormatInfo::RGBAFormat(16,  0,  0,  0, 0, GL_RED,          GL_HALF_FLOAT,                   GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat16RenderableTextures, &amp;rx::Renderer::getFloat16TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16LinearFilter, &amp;rx::Renderer::getFloat16TextureFilteringSupport&gt;, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG16F,             InternalFormatInfo::RGBAFormat(16, 16,  0,  0, 0, GL_RG,           GL_HALF_FLOAT,                   GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat16RenderableTextures, &amp;rx::Renderer::getFloat16TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16LinearFilter, &amp;rx::Renderer::getFloat16TextureFilteringSupport&gt;, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB16F,            InternalFormatInfo::RGBAFormat(16, 16, 16,  0, 0, GL_RGB,          GL_HALF_FLOAT,                   GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat16RenderableTextures, &amp;rx::Renderer::getFloat16TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16LinearFilter, &amp;rx::Renderer::getFloat16TextureFilteringSupport&gt;, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA16F,           InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA,         GL_HALF_FLOAT,                   GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat16RenderableTextures, &amp;rx::Renderer::getFloat16TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16LinearFilter, &amp;rx::Renderer::getFloat16TextureFilteringSupport&gt;, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_R32F,              InternalFormatInfo::RGBAFormat(32,  0,  0,  0, 0, GL_RED,          GL_FLOAT,                        GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat32RenderableTextures, &amp;rx::Renderer::getFloat32TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32LinearFilter, &amp;rx::Renderer::getFloat32TextureFilteringSupport&gt;, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RG32F,             InternalFormatInfo::RGBAFormat(32, 32,  0,  0, 0, GL_RG,           GL_FLOAT,                        GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat32RenderableTextures, &amp;rx::Renderer::getFloat32TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32LinearFilter, &amp;rx::Renderer::getFloat32TextureFilteringSupport&gt;, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGB32F,            InternalFormatInfo::RGBAFormat(32, 32, 32,  0, 0, GL_RGB,          GL_FLOAT,                        GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat32RenderableTextures, &amp;rx::Renderer::getFloat32TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32LinearFilter, &amp;rx::Renderer::getFloat32TextureFilteringSupport&gt;, AlwaysSupported     )));
-    map.insert(InternalFormatInfoPair(GL_RGBA32F,           InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA,         GL_FLOAT,                        GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat32RenderableTextures, &amp;rx::Renderer::getFloat32TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32LinearFilter, &amp;rx::Renderer::getFloat32TextureFilteringSupport&gt;, AlwaysSupported     )));
-
-    // Depth stencil formats
-    //                               | Internal format         |                                      | D |S | X | Format            | Type                             | Component type        | Depth          | Stencil        | Supported     |
-    //                               |                         |                                      |   |  |   |                   |                                  |                       | renderable     | renderable     |               |
-    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT16,     InternalFormatInfo::DepthStencilFormat(16, 0,  0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT,                 GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported,  AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT24,     InternalFormatInfo::DepthStencilFormat(24, 0,  0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,                   GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported,  AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32F,    InternalFormatInfo::DepthStencilFormat(32, 0,  0, GL_DEPTH_COMPONENT, GL_FLOAT,                          GL_FLOAT,               AlwaysSupported, NeverSupported,  AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32_OES, InternalFormatInfo::DepthStencilFormat(32, 0,  0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,                   GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported,  AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH24_STENCIL8,      InternalFormatInfo::DepthStencilFormat(24, 8,  0, GL_DEPTH_STENCIL,   GL_UNSIGNED_INT_24_8,              GL_UNSIGNED_NORMALIZED, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH32F_STENCIL8,     InternalFormatInfo::DepthStencilFormat(32, 8, 24, GL_DEPTH_STENCIL,   GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT,               AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_STENCIL_INDEX8,        InternalFormatInfo::DepthStencilFormat( 0, 8,  0, GL_DEPTH_STENCIL,   GL_UNSIGNED_BYTE,                  GL_UNSIGNED_INT,        NeverSupported,  AlwaysSupported, AlwaysSupported)));
-
-    // Luminance alpha formats
-    //                               | Internal format          |                              | L | A | Format            | Type            | Component type        | Supported     |
-    map.insert(InternalFormatInfoPair(GL_ALPHA8_EXT,             InternalFormatInfo::LUMAFormat( 0,  8, GL_ALPHA,           GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE8_EXT,         InternalFormatInfo::LUMAFormat( 8,  0, GL_LUMINANCE,       GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_ALPHA32F_EXT,           InternalFormatInfo::LUMAFormat( 0, 32, GL_ALPHA,           GL_FLOAT,         GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE32F_EXT,       InternalFormatInfo::LUMAFormat(32,  0, GL_LUMINANCE,       GL_FLOAT,         GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_ALPHA16F_EXT,           InternalFormatInfo::LUMAFormat( 0, 16, GL_ALPHA,           GL_HALF_FLOAT,    GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE16F_EXT,       InternalFormatInfo::LUMAFormat(16,  0, GL_LUMINANCE,       GL_HALF_FLOAT,    GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE8_ALPHA8_EXT,  InternalFormatInfo::LUMAFormat( 8,  8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA32F_EXT, InternalFormatInfo::LUMAFormat(32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT,         GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA16F_EXT, InternalFormatInfo::LUMAFormat(16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT,    GL_FLOAT,               AlwaysSupported)));
-
-    // Unsized formats
-    //                               | Internal format   |                                 | Format            | Supported     |
-    map.insert(InternalFormatInfoPair(GL_ALPHA,           InternalFormatInfo::UnsizedFormat(GL_ALPHA,           AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE,       InternalFormatInfo::UnsizedFormat(GL_LUMINANCE,       AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE_ALPHA, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RED,             InternalFormatInfo::UnsizedFormat(GL_RED,             AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RG,              InternalFormatInfo::UnsizedFormat(GL_RG,              AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGB,             InternalFormatInfo::UnsizedFormat(GL_RGB,             AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGBA,            InternalFormatInfo::UnsizedFormat(GL_RGBA,            AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RED_INTEGER,     InternalFormatInfo::UnsizedFormat(GL_RED_INTEGER,     AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RG_INTEGER,      InternalFormatInfo::UnsizedFormat(GL_RG_INTEGER,      AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGB_INTEGER,     InternalFormatInfo::UnsizedFormat(GL_RGB_INTEGER,     AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGBA_INTEGER,    InternalFormatInfo::UnsizedFormat(GL_RGBA_INTEGER,    AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_BGRA_EXT,        InternalFormatInfo::UnsizedFormat(GL_BGRA_EXT,        AlwaysSupported)));
-
-    // Compressed formats, From ES 3.0.1 spec, table 3.16
-    //                               | Internal format                             |                                    |W |H | BS |CC| Format                                      | Type            | SRGB | Supported          |
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_R11_EAC,                        InternalFormatInfo::CompressedFormat(4, 4,  64, 1, GL_COMPRESSED_R11_EAC,                        GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_R11_EAC,                 InternalFormatInfo::CompressedFormat(4, 4,  64, 1, GL_COMPRESSED_SIGNED_R11_EAC,                 GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RG11_EAC,                       InternalFormatInfo::CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_RG11_EAC,                       GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_RG11_EAC,                InternalFormatInfo::CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_SIGNED_RG11_EAC,                GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_ETC2,                      InternalFormatInfo::CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_RGB8_ETC2,                      GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ETC2,                     InternalFormatInfo::CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_SRGB8_ETC2,                     GL_UNSIGNED_BYTE, true,  UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  InternalFormatInfo::CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, InternalFormatInfo::CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, true,  UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA8_ETC2_EAC,                 InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA8_ETC2_EAC,                 GL_UNSIGNED_BYTE, false, UnimplementedSupport)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,          GL_UNSIGNED_BYTE, true,  UnimplementedSupport)));
-
-    // From GL_EXT_texture_compression_dxt1
-    //                               | Internal format                   |                                    |W |H | BS |CC| Format                            | Type            | SRGB | Supported     |
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    InternalFormatInfo::CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    GL_UNSIGNED_BYTE, false, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   InternalFormatInfo::CompressedFormat(4, 4,  64, 4, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   GL_UNSIGNED_BYTE, false, AlwaysSupported)));
-
-    // From GL_ANGLE_texture_compression_dxt3
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, false, AlwaysSupported)));
-
-    // From GL_ANGLE_texture_compression_dxt5
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, false, AlwaysSupported)));
-
-    return map;
-}
-
-static InternalFormatInfoMap BuildES2InternalFormatInfoMap()
-{
-    InternalFormatInfoMap map;
-
-    // From ES 2.0.25 table 4.5
-    map.insert(InternalFormatInfoPair(GL_NONE,                 InternalFormatInfo()));
-
-    //                               | Internal format        |                              | R | G | B | A |S | Format          | Type                     | Component type        | SRGB | Color         | Texture        | Supported      |
-    //                               |                        |                              |   |   |   |   |  |                 |                          |                       |      | renderable    | filterable     |                |
-    map.insert(InternalFormatInfoPair(GL_RGBA4,                InternalFormatInfo::RGBAFormat( 4,  4,  4,  4, 0, GL_RGBA,          GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGB5_A1,              InternalFormatInfo::RGBAFormat( 5,  5,  5,  1, 0, GL_RGBA,          GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGB565,               InternalFormatInfo::RGBAFormat( 5,  6,  5,  0, 0, GL_RGB,           GL_UNSIGNED_SHORT_5_6_5,   GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-
-    // Extension formats
-    map.insert(InternalFormatInfoPair(GL_R8_EXT,               InternalFormatInfo::RGBAFormat( 8,  0,  0,  0, 0, GL_RED_EXT,       GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, false, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;, CheckSupport&lt;&amp;Context::supportsRGTextures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_RG8_EXT,              InternalFormatInfo::RGBAFormat( 8,  8,  0,  0, 0, GL_RG_EXT,        GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, false, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;, CheckSupport&lt;&amp;Context::supportsRGTextures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_RGB8_OES,             InternalFormatInfo::RGBAFormat( 8,  8,  8,  0, 0, GL_RGB,           GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGBA8_OES,            InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_RGBA,          GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_BGRA8_EXT,            InternalFormatInfo::RGBAFormat( 8,  8,  8,  8, 0, GL_BGRA_EXT,      GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_BGRA4_ANGLEX,         InternalFormatInfo::RGBAFormat( 4,  4,  4,  4, 0, GL_BGRA_EXT,      GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, NeverSupported,  AlwaysSupported, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_BGR5_A1_ANGLEX,       InternalFormatInfo::RGBAFormat( 5,  5,  5,  1, 0, GL_BGRA_EXT,      GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, NeverSupported,  AlwaysSupported, AlwaysSupported)));
-
-    // Floating point formats have to query the renderer for support
-    //                               | Internal format        |                              | R | G | B | A |S | Format          | Type                     | Comp    | SRGB | Color renderable                                                                                           | Texture filterable                                                                                   | Supported                                     |
-    //                               |                        |                              |   |   |   |   |  |                 |                          | type    |      |                                                                                                            |                                                                                                      |                                               |
-    map.insert(InternalFormatInfoPair(GL_R16F_EXT,             InternalFormatInfo::RGBAFormat(16,  0,  0,  0, 0, GL_RED,           GL_HALF_FLOAT_OES,         GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                              CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                        CheckSupport&lt;&amp;Context::supportsRGTextures&gt;     )));
-    map.insert(InternalFormatInfoPair(GL_R32F_EXT,             InternalFormatInfo::RGBAFormat(32,  0,  0,  0, 0, GL_RED,           GL_FLOAT,                  GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                              CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                        CheckSupport&lt;&amp;Context::supportsRGTextures&gt;     )));
-    map.insert(InternalFormatInfoPair(GL_RG16F_EXT,            InternalFormatInfo::RGBAFormat(16, 16,  0,  0, 0, GL_RG,            GL_HALF_FLOAT_OES,         GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                              CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                        CheckSupport&lt;&amp;Context::supportsRGTextures&gt;     )));
-    map.insert(InternalFormatInfoPair(GL_RG32F_EXT,            InternalFormatInfo::RGBAFormat(32, 32,  0,  0, 0, GL_RG,            GL_FLOAT,                  GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                              CheckSupport&lt;&amp;Context::supportsRGTextures, &amp;rx::Renderer::getRGTextureSupport&gt;,                        CheckSupport&lt;&amp;Context::supportsRGTextures&gt;     )));
-    map.insert(InternalFormatInfoPair(GL_RGB16F_EXT,           InternalFormatInfo::RGBAFormat(16, 16, 16,  0, 0, GL_RGB,           GL_HALF_FLOAT_OES,         GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat16RenderableTextures, &amp;rx::Renderer::getFloat16TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16LinearFilter, &amp;rx::Renderer::getFloat16TextureFilteringSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16Textures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_RGB32F_EXT,           InternalFormatInfo::RGBAFormat(32, 32, 32,  0, 0, GL_RGB,           GL_FLOAT,                  GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat32RenderableTextures, &amp;rx::Renderer::getFloat32TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32LinearFilter, &amp;rx::Renderer::getFloat32TextureFilteringSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32Textures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_RGBA16F_EXT,          InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA,          GL_HALF_FLOAT_OES,         GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat16RenderableTextures, &amp;rx::Renderer::getFloat16TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16LinearFilter, &amp;rx::Renderer::getFloat16TextureFilteringSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat16Textures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_RGBA32F_EXT,          InternalFormatInfo::RGBAFormat(32, 32, 32, 32, 0, GL_RGBA,          GL_FLOAT,                  GL_FLOAT, false, CheckSupport&lt;&amp;Context::supportsFloat32RenderableTextures, &amp;rx::Renderer::getFloat32TextureRenderingSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32LinearFilter, &amp;rx::Renderer::getFloat32TextureFilteringSupport&gt;, CheckSupport&lt;&amp;Context::supportsFloat32Textures&gt;)));
-
-    // Depth and stencil formats
-    //                               | Internal format        |                                      | D |S |X | Format              | Type                     | Internal format     | Depth          | Stencil         | Supported                                  |
-    //                               |                        |                                      |   |  |  |                     |                          | type                | renderable     | renderable      |                                            |
-    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT32_OES,InternalFormatInfo::DepthStencilFormat(32, 0, 0, GL_DEPTH_COMPONENT,   GL_UNSIGNED_INT,           GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported,  CheckSupport&lt;&amp;Context::supportsDepthTextures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH24_STENCIL8_OES, InternalFormatInfo::DepthStencilFormat(24, 8, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES,  GL_UNSIGNED_NORMALIZED, AlwaysSupported, AlwaysSupported, CheckSupport&lt;&amp;Context::supportsDepthTextures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT16,    InternalFormatInfo::DepthStencilFormat(16, 0, 0, GL_DEPTH_COMPONENT,   GL_UNSIGNED_SHORT,         GL_UNSIGNED_NORMALIZED, AlwaysSupported, NeverSupported,  AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_STENCIL_INDEX8,       InternalFormatInfo::DepthStencilFormat( 0, 8, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, NeverSupported,  AlwaysSupported, AlwaysSupported)));
-
-    // Unsized formats
-    //                               | Internal format        |                                 | Format              | Supported     |
-    map.insert(InternalFormatInfoPair(GL_ALPHA,                InternalFormatInfo::UnsizedFormat(GL_ALPHA,             AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE,            InternalFormatInfo::UnsizedFormat(GL_LUMINANCE,         AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA,      InternalFormatInfo::UnsizedFormat(GL_LUMINANCE_ALPHA,   AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RED_EXT,              InternalFormatInfo::UnsizedFormat(GL_RED_EXT,           CheckSupport&lt;&amp;Context::supportsRGTextures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_RG_EXT,               InternalFormatInfo::UnsizedFormat(GL_RG_EXT,            CheckSupport&lt;&amp;Context::supportsRGTextures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_RGB,                  InternalFormatInfo::UnsizedFormat(GL_RGB,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_RGBA,                 InternalFormatInfo::UnsizedFormat(GL_RGBA,              AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_BGRA_EXT,             InternalFormatInfo::UnsizedFormat(GL_BGRA_EXT,          AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH_COMPONENT,      InternalFormatInfo::UnsizedFormat(GL_DEPTH_COMPONENT,   AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_DEPTH_STENCIL_OES,    InternalFormatInfo::UnsizedFormat(GL_DEPTH_STENCIL_OES, AlwaysSupported)));
-
-    // Luminance alpha formats from GL_EXT_texture_storage
-    //                               | Internal format          |                              | L | A | Format                   | Type                     | Component type        | Supported     |
-    map.insert(InternalFormatInfoPair(GL_ALPHA8_EXT,             InternalFormatInfo::LUMAFormat( 0,  8, GL_ALPHA,                  GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE8_EXT,         InternalFormatInfo::LUMAFormat( 8,  0, GL_LUMINANCE,              GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_ALPHA32F_EXT,           InternalFormatInfo::LUMAFormat( 0, 32, GL_ALPHA,                  GL_FLOAT,                  GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE32F_EXT,       InternalFormatInfo::LUMAFormat(32,  0, GL_LUMINANCE,              GL_FLOAT,                  GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_ALPHA16F_EXT,           InternalFormatInfo::LUMAFormat( 0, 16, GL_ALPHA,                  GL_HALF_FLOAT_OES,         GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE16F_EXT,       InternalFormatInfo::LUMAFormat(16,  0, GL_LUMINANCE,              GL_HALF_FLOAT_OES,         GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE8_ALPHA8_EXT,  InternalFormatInfo::LUMAFormat( 8,  8, GL_LUMINANCE_ALPHA,        GL_UNSIGNED_BYTE,          GL_UNSIGNED_NORMALIZED, AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA32F_EXT, InternalFormatInfo::LUMAFormat(32, 32, GL_LUMINANCE_ALPHA,        GL_FLOAT,                  GL_FLOAT,               AlwaysSupported)));
-    map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA16F_EXT, InternalFormatInfo::LUMAFormat(16, 16, GL_LUMINANCE_ALPHA,        GL_HALF_FLOAT_OES,         GL_FLOAT,               AlwaysSupported)));
-
-    // From GL_EXT_texture_compression_dxt1
-    //                               | Internal format                   |                                    |W |H | BS |CC|Format                             | Type            | SRGB | Supported                                  |
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    InternalFormatInfo::CompressedFormat(4, 4,  64, 3, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,    GL_UNSIGNED_BYTE, false, CheckSupport&lt;&amp;Context::supportsDXT1Textures&gt;)));
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   InternalFormatInfo::CompressedFormat(4, 4,  64, 4, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,   GL_UNSIGNED_BYTE, false, CheckSupport&lt;&amp;Context::supportsDXT1Textures&gt;)));
-
-    // From GL_ANGLE_texture_compression_dxt3
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_UNSIGNED_BYTE, false, CheckSupport&lt;&amp;Context::supportsDXT3Textures&gt;)));
-
-    // From GL_ANGLE_texture_compression_dxt5
-    map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, InternalFormatInfo::CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_UNSIGNED_BYTE, false, CheckSupport&lt;&amp;Context::supportsDXT5Textures&gt;)));
-
-    return map;
-}
-
-static bool GetInternalFormatInfo(GLenum internalFormat, GLuint clientVersion, InternalFormatInfo *outFormatInfo)
-{
-    const InternalFormatInfoMap* map = NULL;
-
-    if (clientVersion == 2)
-    {
-        static const InternalFormatInfoMap formatMap = BuildES2InternalFormatInfoMap();
-        map = &amp;formatMap;
-    }
-    else if (clientVersion == 3)
-    {
-        static const InternalFormatInfoMap formatMap = BuildES3InternalFormatInfoMap();
-        map = &amp;formatMap;
-    }
-    else
-    {
-        UNREACHABLE();
-    }
-
-    InternalFormatInfoMap::const_iterator iter = map-&gt;find(internalFormat);
-    if (iter != map-&gt;end())
-    {
-        if (outFormatInfo)
-        {
-            *outFormatInfo = iter-&gt;second;
-        }
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-typedef std::set&lt;GLenum&gt; FormatSet;
-
-static FormatSet BuildES2ValidFormatSet()
-{
-    static const FormatMap &amp;formatMap = GetFormatMap(2);
-
-    FormatSet set;
-
-    for (FormatMap::const_iterator i = formatMap.begin(); i != formatMap.end(); i++)
-    {
-        const FormatTypePair&amp; formatPair = i-&gt;first;
-        set.insert(formatPair.first);
-    }
-
-    return set;
-}
-
-static FormatSet BuildES3ValidFormatSet()
-{
-    static const ES3FormatSet &amp;formatSet = GetES3FormatSet();
-
-    FormatSet set;
-
-    for (ES3FormatSet::const_iterator i = formatSet.begin(); i != formatSet.end(); i++)
-    {
-        const FormatInfo&amp; formatInfo = *i;
-        set.insert(formatInfo.mFormat);
-    }
-
-    return set;
-}
-
-typedef std::set&lt;GLenum&gt; TypeSet;
-
-static TypeSet BuildES2ValidTypeSet()
-{
-    static const FormatMap &amp;formatMap = GetFormatMap(2);
-
-    TypeSet set;
-
-    for (FormatMap::const_iterator i = formatMap.begin(); i != formatMap.end(); i++)
-    {
-        const FormatTypePair&amp; formatPair = i-&gt;first;
-        set.insert(formatPair.second);
-    }
-
-    return set;
-}
-
-static TypeSet BuildES3ValidTypeSet()
-{
-    static const ES3FormatSet &amp;formatSet = GetES3FormatSet();
-
-    TypeSet set;
-
-    for (ES3FormatSet::const_iterator i = formatSet.begin(); i != formatSet.end(); i++)
-    {
-        const FormatInfo&amp; formatInfo = *i;
-        set.insert(formatInfo.mType);
-    }
-
-    return set;
-}
-
-struct EffectiveInternalFormatInfo
-{
-    GLenum mEffectiveFormat;
-    GLenum mDestFormat;
-    GLuint mMinRedBits;
-    GLuint mMaxRedBits;
-    GLuint mMinGreenBits;
-    GLuint mMaxGreenBits;
-    GLuint mMinBlueBits;
-    GLuint mMaxBlueBits;
-    GLuint mMinAlphaBits;
-    GLuint mMaxAlphaBits;
-
-    EffectiveInternalFormatInfo(GLenum effectiveFormat, GLenum destFormat, GLuint minRedBits, GLuint maxRedBits,
-                                GLuint minGreenBits, GLuint maxGreenBits, GLuint minBlueBits, GLuint maxBlueBits,
-                                GLuint minAlphaBits, GLuint maxAlphaBits)
-        : mEffectiveFormat(effectiveFormat), mDestFormat(destFormat), mMinRedBits(minRedBits),
-          mMaxRedBits(maxRedBits), mMinGreenBits(minGreenBits), mMaxGreenBits(maxGreenBits),
-          mMinBlueBits(minBlueBits), mMaxBlueBits(maxBlueBits), mMinAlphaBits(minAlphaBits),
-          mMaxAlphaBits(maxAlphaBits) {};
-};
-
-typedef std::vector&lt;EffectiveInternalFormatInfo&gt; EffectiveInternalFormatList;
-
-static EffectiveInternalFormatList BuildSizedEffectiveInternalFormatList()
-{
-    EffectiveInternalFormatList list;
-
-    // OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
-    //                                                    linear source buffer component sizes.
-    //                                                                            | Source channel min/max sizes |
-    //                                         Effective Internal Format |  N/A   |  R   |  G   |  B   |  A      |
-    list.push_back(EffectiveInternalFormatInfo(GL_ALPHA8_EXT,              GL_NONE, 0,  0, 0,  0, 0,  0, 1, 8));
-    list.push_back(EffectiveInternalFormatInfo(GL_R8,                      GL_NONE, 1,  8, 0,  0, 0,  0, 0, 0));
-    list.push_back(EffectiveInternalFormatInfo(GL_RG8,                     GL_NONE, 1,  8, 1,  8, 0,  0, 0, 0));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGB565,                  GL_NONE, 1,  5, 1,  6, 1,  5, 0, 0));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGB8,                    GL_NONE, 6,  8, 7,  8, 6,  8, 0, 0));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGBA4,                   GL_NONE, 1,  4, 1,  4, 1,  4, 1, 4));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGB5_A1,                 GL_NONE, 5,  5, 5,  5, 5,  5, 1, 1));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGBA8,                   GL_NONE, 5,  8, 5,  8, 5,  8, 2, 8));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGB10_A2,                GL_NONE, 9, 10, 9, 10, 9, 10, 2, 2));
-
-    return list;
-}
-
-
-static EffectiveInternalFormatList BuildUnsizedEffectiveInternalFormatList()
-{
-    EffectiveInternalFormatList list;
-
-    // OpenGL ES 3.0.3 Specification, Table 3.17, pg 141: Effective internal format coresponding to destination internal format and
-    //                                                    linear source buffer component sizes.
-    //                                                                                        |          Source channel min/max sizes            |
-    //                                         Effective Internal Format |    Dest Format     |     R     |      G     |      B     |      A     |
-    list.push_back(EffectiveInternalFormatInfo(GL_ALPHA8_EXT,              GL_ALPHA,           0, UINT_MAX, 0, UINT_MAX, 0, UINT_MAX, 1,        8));
-    list.push_back(EffectiveInternalFormatInfo(GL_LUMINANCE8_EXT,          GL_LUMINANCE,       1,        8, 0, UINT_MAX, 0, UINT_MAX, 0, UINT_MAX));
-    list.push_back(EffectiveInternalFormatInfo(GL_LUMINANCE8_ALPHA8_EXT,   GL_LUMINANCE_ALPHA, 1,        8, 0, UINT_MAX, 0, UINT_MAX, 1,        8));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGB565,                  GL_RGB,             1,        5, 1,        6, 1,        5, 0, UINT_MAX));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGB8,                    GL_RGB,             6,        8, 7,        8, 6,        8, 0, UINT_MAX));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGBA4,                   GL_RGBA,            1,        4, 1,        4, 1,        4, 1,        4));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGB5_A1,                 GL_RGBA,            5,        5, 5,        5, 5,        5, 1,        1));
-    list.push_back(EffectiveInternalFormatInfo(GL_RGBA8,                   GL_RGBA,            5,        8, 5,        8, 5,        8, 5,        8));
-
-    return list;
-}
-
-static bool GetEffectiveInternalFormat(const InternalFormatInfo &amp;srcFormat, const InternalFormatInfo &amp;destFormat,
-                                       GLuint clientVersion, GLenum *outEffectiveFormat)
-{
-    const EffectiveInternalFormatList *list = NULL;
-    GLenum targetFormat = GL_NONE;
-
-    if (gl::IsSizedInternalFormat(destFormat.mFormat, clientVersion))
-    {
-        static const EffectiveInternalFormatList sizedList = BuildSizedEffectiveInternalFormatList();
-        list = &amp;sizedList;
-    }
-    else
-    {
-        static const EffectiveInternalFormatList unsizedList = BuildUnsizedEffectiveInternalFormatList();
-        list = &amp;unsizedList;
-        targetFormat = destFormat.mFormat;
-    }
-
-    for (size_t curFormat = 0; curFormat &lt; list-&gt;size(); ++curFormat)
-    {
-        const EffectiveInternalFormatInfo&amp; formatInfo = list-&gt;at(curFormat);
-        if ((formatInfo.mDestFormat == targetFormat) &amp;&amp;
-            (formatInfo.mMinRedBits   &lt;= srcFormat.mRedBits   &amp;&amp; formatInfo.mMaxRedBits   &gt;= srcFormat.mRedBits)   &amp;&amp;
-            (formatInfo.mMinGreenBits &lt;= srcFormat.mGreenBits &amp;&amp; formatInfo.mMaxGreenBits &gt;= srcFormat.mGreenBits) &amp;&amp;
-            (formatInfo.mMinBlueBits  &lt;= srcFormat.mBlueBits  &amp;&amp; formatInfo.mMaxBlueBits  &gt;= srcFormat.mBlueBits)  &amp;&amp;
-            (formatInfo.mMinAlphaBits &lt;= srcFormat.mAlphaBits &amp;&amp; formatInfo.mMaxAlphaBits &gt;= srcFormat.mAlphaBits))
-        {
-            *outEffectiveFormat = formatInfo.mEffectiveFormat;
-            return true;
-        }
-    }
-
-    return false;
-}
-
-struct CopyConversion
-{
-    GLenum mTextureFormat;
-    GLenum mFramebufferFormat;
-
-    CopyConversion(GLenum textureFormat, GLenum framebufferFormat)
-        : mTextureFormat(textureFormat), mFramebufferFormat(framebufferFormat) { }
-
-    bool operator&lt;(const CopyConversion&amp; other) const
-    {
-        return memcmp(this, &amp;other, sizeof(CopyConversion)) &lt; 0;
-    }
-};
-
-typedef std::set&lt;CopyConversion&gt; CopyConversionSet;
-
-static CopyConversionSet BuildValidES3CopyTexImageCombinations()
-{
-    CopyConversionSet set;
-
-    // From ES 3.0.1 spec, table 3.15
-    set.insert(CopyConversion(GL_ALPHA,           GL_RGBA));
-    set.insert(CopyConversion(GL_LUMINANCE,       GL_RED));
-    set.insert(CopyConversion(GL_LUMINANCE,       GL_RG));
-    set.insert(CopyConversion(GL_LUMINANCE,       GL_RGB));
-    set.insert(CopyConversion(GL_LUMINANCE,       GL_RGBA));
-    set.insert(CopyConversion(GL_LUMINANCE_ALPHA, GL_RGBA));
-    set.insert(CopyConversion(GL_RED,             GL_RED));
-    set.insert(CopyConversion(GL_RED,             GL_RG));
-    set.insert(CopyConversion(GL_RED,             GL_RGB));
-    set.insert(CopyConversion(GL_RED,             GL_RGBA));
-    set.insert(CopyConversion(GL_RG,              GL_RG));
-    set.insert(CopyConversion(GL_RG,              GL_RGB));
-    set.insert(CopyConversion(GL_RG,              GL_RGBA));
-    set.insert(CopyConversion(GL_RGB,             GL_RGB));
-    set.insert(CopyConversion(GL_RGB,             GL_RGBA));
-    set.insert(CopyConversion(GL_RGBA,            GL_RGBA));
-
-    // Necessary for ANGLE back-buffers
-    set.insert(CopyConversion(GL_ALPHA,           GL_BGRA_EXT));
-    set.insert(CopyConversion(GL_LUMINANCE,       GL_BGRA_EXT));
-    set.insert(CopyConversion(GL_LUMINANCE_ALPHA, GL_BGRA_EXT));
-    set.insert(CopyConversion(GL_RED,             GL_BGRA_EXT));
-    set.insert(CopyConversion(GL_RG,              GL_BGRA_EXT));
-    set.insert(CopyConversion(GL_RGB,             GL_BGRA_EXT));
-    set.insert(CopyConversion(GL_RGBA,            GL_BGRA_EXT));
-
-    set.insert(CopyConversion(GL_RED_INTEGER,     GL_RED_INTEGER));
-    set.insert(CopyConversion(GL_RED_INTEGER,     GL_RG_INTEGER));
-    set.insert(CopyConversion(GL_RED_INTEGER,     GL_RGB_INTEGER));
-    set.insert(CopyConversion(GL_RED_INTEGER,     GL_RGBA_INTEGER));
-    set.insert(CopyConversion(GL_RG_INTEGER,      GL_RG_INTEGER));
-    set.insert(CopyConversion(GL_RG_INTEGER,      GL_RGB_INTEGER));
-    set.insert(CopyConversion(GL_RG_INTEGER,      GL_RGBA_INTEGER));
-    set.insert(CopyConversion(GL_RGB_INTEGER,     GL_RGB_INTEGER));
-    set.insert(CopyConversion(GL_RGB_INTEGER,     GL_RGBA_INTEGER));
-    set.insert(CopyConversion(GL_RGBA_INTEGER,    GL_RGBA_INTEGER));
-
-    return set;
-}
-
-bool IsValidInternalFormat(GLenum internalFormat, const Context *context)
-{
-    if (!context)
-    {
-        return false;
-    }
-
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, context-&gt;getClientVersion(), &amp;internalFormatInfo))
-    {
-        ASSERT(internalFormatInfo.mSupportFunction != NULL);
-        return internalFormatInfo.mSupportFunction(context);
-    }
-    else
-    {
-        return false;
-    }
-}
-
-bool IsValidFormat(GLenum format, GLuint clientVersion)
-{
-    if (clientVersion == 2)
-    {
-        static const FormatSet formatSet = BuildES2ValidFormatSet();
-        return formatSet.find(format) != formatSet.end();
-    }
-    else if (clientVersion == 3)
-    {
-        static const FormatSet formatSet = BuildES3ValidFormatSet();
-        return formatSet.find(format) != formatSet.end();
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsValidType(GLenum type, GLuint clientVersion)
-{
-    if (clientVersion == 2)
-    {
-        static const TypeSet typeSet = BuildES2ValidTypeSet();
-        return typeSet.find(type) != typeSet.end();
-    }
-    else if (clientVersion == 3)
-    {
-        static const TypeSet typeSet = BuildES3ValidTypeSet();
-        return typeSet.find(type) != typeSet.end();
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion)
-{
-    if (clientVersion == 2)
-    {
-        static const FormatMap &amp;formats = GetFormatMap(clientVersion);
-        FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
-
-        return (iter != formats.end()) &amp;&amp; ((internalFormat == (GLint)type) || (internalFormat == iter-&gt;second.mInternalFormat));
-    }
-    else if (clientVersion == 3)
-    {
-        static const ES3FormatSet &amp;formats = GetES3FormatSet();
-        return formats.find(FormatInfo(internalFormat, format, type)) != formats.end();
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion)
-{
-    InternalFormatInfo textureInternalFormatInfo;
-    InternalFormatInfo framebufferInternalFormatInfo;
-    if (GetInternalFormatInfo(textureInternalFormat, clientVersion, &amp;textureInternalFormatInfo) &amp;&amp;
-        GetInternalFormatInfo(frameBufferInternalFormat, clientVersion, &amp;framebufferInternalFormatInfo))
-    {
-        if (clientVersion == 2)
-        {
-            UNIMPLEMENTED();
-            return false;
-        }
-        else if (clientVersion == 3)
-        {
-            static const CopyConversionSet conversionSet = BuildValidES3CopyTexImageCombinations();
-            const CopyConversion conversion = CopyConversion(textureInternalFormatInfo.mFormat,
-                                                             framebufferInternalFormatInfo.mFormat);
-            if (conversionSet.find(conversion) != conversionSet.end())
-            {
-                // Section 3.8.5 of the GLES 3.0.3 spec states that source and destination formats
-                // must both be signed, unsigned, or fixed point and both source and destinations
-                // must be either both SRGB or both not SRGB. EXT_color_buffer_float adds allowed
-                // conversion between fixed and floating point.
-
-                if ((textureInternalFormatInfo.mColorEncoding == GL_SRGB) != (framebufferInternalFormatInfo.mColorEncoding == GL_SRGB))
-                {
-                    return false;
-                }
-
-                if (((textureInternalFormatInfo.mComponentType == GL_INT) != (framebufferInternalFormatInfo.mComponentType == GL_INT)) ||
-                    ((textureInternalFormatInfo.mComponentType == GL_UNSIGNED_INT) != (framebufferInternalFormatInfo.mComponentType == GL_UNSIGNED_INT)))
-                {
-                    return false;
-                }
-
-                if (gl::IsFloatOrFixedComponentType(textureInternalFormatInfo.mComponentType) &amp;&amp;
-                    !gl::IsFloatOrFixedComponentType(framebufferInternalFormatInfo.mComponentType))
-                {
-                    return false;
-                }
-
-                // GLES specification 3.0.3, sec 3.8.5, pg 139-140:
-                // The effective internal format of the source buffer is determined with the following rules applied in order:
-                //    * If the source buffer is a texture or renderbuffer that was created with a sized internal format then the
-                //      effective internal format is the source buffer's sized internal format.
-                //    * If the source buffer is a texture that was created with an unsized base internal format, then the
-                //      effective internal format is the source image array's effective internal format, as specified by table
-                //      3.12, which is determined from the &lt;format&gt; and &lt;type&gt; that were used when the source image array was
-                //      specified by TexImage*.
-                //    * Otherwise the effective internal format is determined by the row in table 3.17 or 3.18 where
-                //      Destination Internal Format matches internalformat and where the [source channel sizes] are consistent
-                //      with the values of the source buffer's [channel sizes]. Table 3.17 is used if the
-                //      FRAMEBUFFER_ATTACHMENT_ENCODING is LINEAR and table 3.18 is used if the FRAMEBUFFER_ATTACHMENT_ENCODING
-                //      is SRGB.
-                InternalFormatInfo sourceEffectiveFormat;
-                if (readBufferHandle != 0)
-                {
-                    // Not the default framebuffer, therefore the read buffer must be a user-created texture or renderbuffer
-                    if (gl::IsSizedInternalFormat(framebufferInternalFormatInfo.mFormat, clientVersion))
-                    {
-                        sourceEffectiveFormat = framebufferInternalFormatInfo;
-                    }
-                    else
-                    {
-                        // Renderbuffers cannot be created with an unsized internal format, so this must be an unsized-format
-                        // texture. We can use the same table we use when creating textures to get its effective sized format.
-                        GLenum effectiveFormat = gl::GetSizedInternalFormat(framebufferInternalFormatInfo.mFormat,
-                                                                            framebufferInternalFormatInfo.mType, clientVersion);
-                        gl::GetInternalFormatInfo(effectiveFormat, clientVersion, &amp;sourceEffectiveFormat);
-                    }
-                }
-                else
-                {
-                    // The effective internal format must be derived from the source framebuffer's channel sizes.
-                    // This is done in GetEffectiveInternalFormat for linear buffers (table 3.17)
-                    if (framebufferInternalFormatInfo.mColorEncoding == GL_LINEAR)
-                    {
-                        GLenum effectiveFormat;
-                        if (GetEffectiveInternalFormat(framebufferInternalFormatInfo, textureInternalFormatInfo, clientVersion, &amp;effectiveFormat))
-                        {
-                            gl::GetInternalFormatInfo(effectiveFormat, clientVersion, &amp;sourceEffectiveFormat);
-                        }
-                        else
-                        {
-                            return false;
-                        }
-                    }
-                    else if (framebufferInternalFormatInfo.mColorEncoding == GL_SRGB)
-                    {
-                        // SRGB buffers can only be copied to sized format destinations according to table 3.18
-                        if (gl::IsSizedInternalFormat(textureInternalFormat, clientVersion) &amp;&amp;
-                            (framebufferInternalFormatInfo.mRedBits   &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.mRedBits   &lt;= 8) &amp;&amp;
-                            (framebufferInternalFormatInfo.mGreenBits &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.mGreenBits &lt;= 8) &amp;&amp;
-                            (framebufferInternalFormatInfo.mBlueBits  &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.mBlueBits  &lt;= 8) &amp;&amp;
-                            (framebufferInternalFormatInfo.mAlphaBits &gt;= 1 &amp;&amp; framebufferInternalFormatInfo.mAlphaBits &lt;= 8))
-                        {
-                            gl::GetInternalFormatInfo(GL_SRGB8_ALPHA8, clientVersion, &amp;sourceEffectiveFormat);
-                        }
-                        else
-                        {
-                            return false;
-                        }
-                    }
-                    else
-                    {
-                        UNREACHABLE();
-                    }
-                }
-
-                if (gl::IsSizedInternalFormat(textureInternalFormatInfo.mFormat, clientVersion))
-                {
-                    // Section 3.8.5 of the GLES 3.0.3 spec, pg 139, requires that, if the destination format is sized,
-                    // component sizes of the source and destination formats must exactly match
-                    if (textureInternalFormatInfo.mRedBits != sourceEffectiveFormat.mRedBits ||
-                        textureInternalFormatInfo.mGreenBits != sourceEffectiveFormat.mGreenBits ||
-                        textureInternalFormatInfo.mBlueBits != sourceEffectiveFormat.mBlueBits ||
-                        textureInternalFormatInfo.mAlphaBits != sourceEffectiveFormat.mAlphaBits)
-                    {
-                        return false;
-                    }
-                }
-
-
-                return true; // A conversion function exists, and no rule in the specification has precluded conversion
-                             // between these formats.
-            }
-
-            return false;
-        }
-        else
-        {
-            UNREACHABLE();
-            return false;
-        }
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mPixelBits &gt; 0;
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion)
-{
-    const FormatMap &amp;formats = GetFormatMap(clientVersion);
-    FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
-    return (iter != formats.end()) ? iter-&gt;second.mInternalFormat : GL_NONE;
-}
-
-GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mPixelBits / 8;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mAlphaBits;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mRedBits;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mGreenBits;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mBlueBits;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mLuminanceBits;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mDepthBits;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mStencilBits;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetTypeBytes(GLenum type)
-{
-    TypeInfo typeInfo;
-    if (GetTypeInfo(type, &amp;typeInfo))
-    {
-        return typeInfo.mTypeBytes;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-bool IsSpecialInterpretationType(GLenum type)
-{
-    TypeInfo typeInfo;
-    if (GetTypeInfo(type, &amp;typeInfo))
-    {
-        return typeInfo.mSpecialInterpretation;
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsFloatOrFixedComponentType(GLenum type)
-{
-    if (type == GL_UNSIGNED_NORMALIZED ||
-        type == GL_SIGNED_NORMALIZED ||
-        type == GL_FLOAT)
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
-GLenum GetFormat(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mFormat;
-    }
-    else
-    {
-        UNREACHABLE();
-        return GL_NONE;
-    }
-}
-
-GLenum GetType(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mType;
-    }
-    else
-    {
-        UNREACHABLE();
-        return GL_NONE;
-    }
-}
-
-GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mComponentType;
-    }
-    else
-    {
-        UNREACHABLE();
-        return GL_NONE;
-    }
-}
-
-GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mComponentCount;
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mColorEncoding;
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (renderer &amp;&amp; GetInternalFormatInfo(internalFormat, renderer-&gt;getCurrentClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsColorRenderable(NULL, renderer);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsColorRenderingSupported(GLenum internalFormat, const Context *context)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (context &amp;&amp; GetInternalFormatInfo(internalFormat, context-&gt;getClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsColorRenderable(context, NULL);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (renderer &amp;&amp; GetInternalFormatInfo(internalFormat, renderer-&gt;getCurrentClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsTextureFilterable(NULL, renderer);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (context &amp;&amp; GetInternalFormatInfo(internalFormat, context-&gt;getClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsTextureFilterable(context, NULL);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (renderer &amp;&amp; GetInternalFormatInfo(internalFormat, renderer-&gt;getCurrentClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsDepthRenderable(NULL, renderer);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (context &amp;&amp; GetInternalFormatInfo(internalFormat, context-&gt;getClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsDepthRenderable(context, NULL);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (renderer &amp;&amp; GetInternalFormatInfo(internalFormat, renderer-&gt;getCurrentClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsStencilRenderable(NULL, renderer);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (context &amp;&amp; GetInternalFormatInfo(internalFormat, context-&gt;getClientVersion(), &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsStencilRenderable(context, NULL);
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment)
-{
-    ASSERT(alignment &gt; 0 &amp;&amp; isPow2(alignment));
-    return rx::roundUp(GetBlockSize(internalFormat, type, clientVersion, width, 1), static_cast&lt;GLuint&gt;(alignment));
-}
-
-GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment)
-{
-    return GetRowPitch(internalFormat, type, clientVersion, width, alignment) * height;
-}
-
-GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        if (internalFormatInfo.mIsCompressed)
-        {
-            GLsizei numBlocksWide = (width + internalFormatInfo.mCompressedBlockWidth - 1) / internalFormatInfo.mCompressedBlockWidth;
-            GLsizei numBlocksHight = (height + internalFormatInfo.mCompressedBlockHeight - 1) / internalFormatInfo.mCompressedBlockHeight;
-
-            return (internalFormatInfo.mPixelBits * numBlocksWide * numBlocksHight) / 8;
-        }
-        else
-        {
-            TypeInfo typeInfo;
-            if (GetTypeInfo(type, &amp;typeInfo))
-            {
-                if (typeInfo.mSpecialInterpretation)
-                {
-                    return typeInfo.mTypeBytes * width * height;
-                }
-                else
-                {
-                    return internalFormatInfo.mComponentCount * typeInfo.mTypeBytes * width * height;
-                }
-            }
-            else
-            {
-                UNREACHABLE();
-                return 0;
-            }
-        }
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mIsCompressed;
-    }
-    else
-    {
-        UNREACHABLE();
-        return false;
-    }
-}
-
-GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mCompressedBlockWidth;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion)
-{
-    InternalFormatInfo internalFormatInfo;
-    if (GetInternalFormatInfo(internalFormat, clientVersion, &amp;internalFormatInfo))
-    {
-        return internalFormatInfo.mCompressedBlockHeight;
-    }
-    else
-    {
-        UNREACHABLE();
-        return 0;
-    }
-}
-
-ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion)
-{
-    static const FormatMap &amp;formats = GetFormatMap(clientVersion);
-    FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
-    return (iter != formats.end()) ? iter-&gt;second.mColorWriteFunction : NULL;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2formatutilsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/formatutils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,99 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// formatutils.h: Queries for GL image formats.
-
-#ifndef LIBGLESV2_FORMATUTILS_H_
-#define LIBGLESV2_FORMATUTILS_H_
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-#include &lt;GLES2/gl2ext.h&gt;
-
-#include &quot;libGLESv2/angletypes.h&quot;
-
-typedef void (*MipGenerationFunction)(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
-                                      const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
-                                      unsigned char *destData, int destRowPitch, int destDepthPitch);
-
-typedef void (*LoadImageFunction)(int width, int height, int depth,
-                                  const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
-                                  void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
-
-typedef void (*InitializeTextureDataFunction)(int width, int height, int depth,
-                                              void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
-
-typedef void (*ColorReadFunction)(const void *source, void *dest);
-typedef void (*ColorWriteFunction)(const void *source, void *dest);
-typedef void (*ColorCopyFunction)(const void *source, void *dest);
-
-typedef void (*VertexCopyFunction)(const void *input, size_t stride, size_t count, void *output);
-
-namespace rx
-{
-
-class Renderer;
-
-}
-
-namespace gl
-{
-
-class Context;
-
-bool IsValidInternalFormat(GLenum internalFormat, const Context *context);
-bool IsValidFormat(GLenum format, GLuint clientVersion);
-bool IsValidType(GLenum type, GLuint clientVersion);
-
-bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion);
-bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion);
-
-bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion);
-GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
-
-GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion);
-GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion);
-GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion);
-GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion);
-GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion);
-GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion);
-GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion);
-GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion);
-
-GLuint GetTypeBytes(GLenum type);
-bool IsSpecialInterpretationType(GLenum type);
-bool IsFloatOrFixedComponentType(GLenum type);
-
-GLenum GetFormat(GLenum internalFormat, GLuint clientVersion);
-GLenum GetType(GLenum internalFormat, GLuint clientVersion);
-
-GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion);
-GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion);
-GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion);
-
-bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
-bool IsColorRenderingSupported(GLenum internalFormat, const Context *context);
-bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer);
-bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context);
-bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
-bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context);
-bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
-bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context);
-
-GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
-GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
-GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
-
-bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion);
-GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion);
-GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion);
-
-ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion);
-
-}
-
-#endif LIBGLESV2_FORMATUTILS_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2global_statecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,235 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// global_state.cpp : Implements functions for querying the thread-local GL and EGL state.
+
+#include &quot;libGLESv2/global_state.h&quot;
+
+#include &quot;libANGLE/Context.h&quot;
+#include &quot;libANGLE/Error.h&quot;
+
+#include &quot;common/debug.h&quot;
+#include &quot;common/platform.h&quot;
+#include &quot;common/tls.h&quot;
+
+namespace
+{
+
+static TLSIndex currentTLS = TLS_INVALID_INDEX;
+
+struct Current
+{
+    EGLint error;
+    EGLenum API;
+    egl::Display *display;
+    egl::Surface *drawSurface;
+    egl::Surface *readSurface;
+    gl::Context *context;
+};
+
+Current *AllocateCurrent()
+{
+    ASSERT(currentTLS != TLS_INVALID_INDEX);
+    if (currentTLS == TLS_INVALID_INDEX)
+    {
+        return NULL;
+    }
+
+    Current *current = new Current();
+    current-&gt;error = EGL_SUCCESS;
+    current-&gt;API = EGL_OPENGL_ES_API;
+    current-&gt;display = reinterpret_cast&lt;egl::Display*&gt;(EGL_NO_DISPLAY);
+    current-&gt;drawSurface = reinterpret_cast&lt;egl::Surface*&gt;(EGL_NO_SURFACE);
+    current-&gt;readSurface = reinterpret_cast&lt;egl::Surface*&gt;(EGL_NO_SURFACE);
+    current-&gt;context = reinterpret_cast&lt;gl::Context*&gt;(EGL_NO_CONTEXT);
+
+    if (!SetTLSValue(currentTLS, current))
+    {
+        ERR(&quot;Could not set thread local storage.&quot;);
+        return NULL;
+    }
+
+    return current;
+}
+
+void DeallocateCurrent()
+{
+    Current *current = reinterpret_cast&lt;Current*&gt;(GetTLSValue(currentTLS));
+    SafeDelete(current);
+    SetTLSValue(currentTLS, NULL);
+}
+
+Current *GetCurrentData()
+{
+    // Create a TLS index if one has not been created for this DLL
+    if (currentTLS == TLS_INVALID_INDEX)
+    {
+        currentTLS = CreateTLSIndex();
+    }
+
+    Current *current = reinterpret_cast&lt;Current*&gt;(GetTLSValue(currentTLS));
+
+    // ANGLE issue 488: when the dll is loaded after thread initialization,
+    // thread local storage (current) might not exist yet.
+    return (current ? current : AllocateCurrent());
+}
+
+#ifdef ANGLE_PLATFORM_WINDOWS
+extern &quot;C&quot; BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID)
+{
+    switch (reason)
+    {
+      case DLL_PROCESS_ATTACH:
+        currentTLS = CreateTLSIndex();
+        if (currentTLS == TLS_INVALID_INDEX)
+        {
+            return FALSE;
+        }
+        AllocateCurrent();
+        break;
+
+      case DLL_THREAD_ATTACH:
+        AllocateCurrent();
+        break;
+
+      case DLL_THREAD_DETACH:
+        DeallocateCurrent();
+        break;
+
+      case DLL_PROCESS_DETACH:
+        DeallocateCurrent();
+        if (currentTLS != TLS_INVALID_INDEX)
+        {
+            DestroyTLSIndex(currentTLS);
+            currentTLS = TLS_INVALID_INDEX;
+        }
+        break;
+    }
+
+    return TRUE;
+}
+#endif
+
+}
+
+namespace gl
+{
+
+Context *GetGlobalContext()
+{
+    Current *current = GetCurrentData();
+
+    return current-&gt;context;
+}
+
+Context *GetValidGlobalContext()
+{
+    gl::Context *context = GetGlobalContext();
+    if (context)
+    {
+        if (context-&gt;isContextLost())
+        {
+            context-&gt;recordError(gl::Error(GL_OUT_OF_MEMORY, &quot;Context has been lost.&quot;));
+            return nullptr;
+        }
+        else
+        {
+            return context;
+        }
+    }
+    return nullptr;
+}
+
+}
+
+namespace egl
+{
+
+void SetGlobalError(const Error &amp;error)
+{
+    Current *current = GetCurrentData();
+
+    current-&gt;error = error.getCode();
+}
+
+EGLint GetGlobalError()
+{
+    Current *current = GetCurrentData();
+
+    return current-&gt;error;
+}
+
+EGLenum GetGlobalAPI()
+{
+    Current *current = GetCurrentData();
+
+    return current-&gt;API;
+}
+
+void SetGlobalAPI(EGLenum API)
+{
+    Current *current = GetCurrentData();
+
+    current-&gt;API = API;
+}
+
+void SetGlobalDisplay(Display *dpy)
+{
+    Current *current = GetCurrentData();
+
+    current-&gt;display = dpy;
+}
+
+Display *GetGlobalDisplay()
+{
+    Current *current = GetCurrentData();
+
+    return current-&gt;display;
+}
+
+void SetGlobalDrawSurface(Surface *surface)
+{
+    Current *current = GetCurrentData();
+
+    current-&gt;drawSurface = surface;
+}
+
+Surface *GetGlobalDrawSurface()
+{
+    Current *current = GetCurrentData();
+
+    return current-&gt;drawSurface;
+}
+
+void SetGlobalReadSurface(Surface *surface)
+{
+    Current *current = GetCurrentData();
+
+    current-&gt;readSurface = surface;
+}
+
+Surface *GetGlobalReadSurface()
+{
+    Current *current = GetCurrentData();
+
+    return current-&gt;readSurface;
+}
+
+void SetGlobalContext(gl::Context *context)
+{
+    Current *current = GetCurrentData();
+
+    current-&gt;context = context;
+}
+
+gl::Context *GetGlobalContext()
+{
+    Current *current = GetCurrentData();
+
+    return current-&gt;context;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2global_stateh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/global_state.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+//
+// Copyright(c) 2014 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.
+//
+
+// global_state.h : Defines functions for querying the thread-local GL and EGL state.
+
+#ifndef LIBGLESV2_GLOBALSTATE_H_
+#define LIBGLESV2_GLOBALSTATE_H_
+
+#include &lt;EGL/egl.h&gt;
+
+namespace gl
+{
+class Context;
+
+Context *GetGlobalContext();
+Context *GetValidGlobalContext();
+
+}
+
+namespace egl
+{
+class Error;
+class Display;
+class Surface;
+
+void SetGlobalError(const Error &amp;error);
+EGLint GetGlobalError();
+
+void SetGlobalAPI(EGLenum API);
+EGLenum GetGlobalAPI();
+
+void SetGlobalDisplay(Display *dpy);
+Display *GetGlobalDisplay();
+
+void SetGlobalDrawSurface(Surface *surface);
+Surface *GetGlobalDrawSurface();
+
+void SetGlobalReadSurface(Surface *surface);
+Surface *GetGlobalReadSurface();
+
+void SetGlobalContext(gl::Context *context);
+gl::Context *GetGlobalContext();
+
+}
+
+#endif // LIBGLESV2_GLOBALSTATE_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,4 +1,3 @@
</span><del>-#include &quot;precompiled.h&quot;
</del><span class="cx"> //
</span><span class="cx"> // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved.
</span><span class="cx"> // Use of this source code is governed by a BSD-style license that can be
</span><span class="lines">@@ -7,10604 +6,1409 @@
</span><span class="cx"> 
</span><span class="cx"> // libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions.
</span><span class="cx"> 
</span><del>-#include &quot;common/version.h&quot;
</del><ins>+#include &quot;libGLESv2/entry_points_gles_2_0.h&quot;
+#include &quot;libGLESv2/entry_points_gles_2_0_ext.h&quot;
+#include &quot;libGLESv2/entry_points_gles_3_0.h&quot;
+#include &quot;libGLESv2/entry_points_gles_3_0_ext.h&quot;
</ins><span class="cx"> 
</span><del>-#include &quot;libGLESv2/main.h&quot;
-#include &quot;common/utilities.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/Buffer.h&quot;
-#include &quot;libGLESv2/Fence.h&quot;
-#include &quot;libGLESv2/Framebuffer.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/Program.h&quot;
-#include &quot;libGLESv2/ProgramBinary.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/Query.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/VertexArray.h&quot;
-#include &quot;libGLESv2/TransformFeedback.h&quot;
</del><ins>+#include &quot;common/event_tracer.h&quot;
</ins><span class="cx"> 
</span><del>-#include &quot;libGLESv2/validationES.h&quot;
-#include &quot;libGLESv2/validationES2.h&quot;
-#include &quot;libGLESv2/validationES3.h&quot;
-#include &quot;libGLESv2/queryconversions.h&quot;
-
</del><span class="cx"> extern &quot;C&quot;
</span><span class="cx"> {
</span><span class="cx"> 
</span><del>-// OpenGL ES 2.0 functions
-
-void __stdcall glActiveTexture(GLenum texture)
</del><ins>+void GL_APIENTRY glActiveTexture(GLenum texture)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum texture = 0x%X)&quot;, texture);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (texture &lt; GL_TEXTURE0 || texture &gt; GL_TEXTURE0 + context-&gt;getMaximumCombinedTextureImageUnits() - 1)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;setActiveSampler(texture - GL_TEXTURE0);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ActiveTexture(texture);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glAttachShader(GLuint program, GLuint shader)
</del><ins>+void GL_APIENTRY glAttachShader(GLuint program, GLuint shader)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLuint shader = %d)&quot;, program, shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (!shaderObject)
-            {
-                if (context-&gt;getProgram(shader))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (!programObject-&gt;attachShader(shaderObject))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::AttachShader(program, shader);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBeginQueryEXT(GLenum target, GLuint id)
</del><ins>+void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint %d)&quot;, target, id);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidQueryType(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (id == 0)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;beginQuery(target, id);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindAttribLocation(program, index, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
</del><ins>+void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)&quot;, program, index, name);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (strncmp(name, &quot;gl_&quot;, 3) == 0)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            programObject-&gt;bindAttributeLocation(index, name);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindBuffer(target, buffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindBuffer(GLenum target, GLuint buffer)
</del><ins>+void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint buffer = %d)&quot;, target, buffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (target)
-            {
-              case GL_ARRAY_BUFFER:
-                context-&gt;bindArrayBuffer(buffer);
-                return;
-              case GL_ELEMENT_ARRAY_BUFFER:
-                context-&gt;bindElementArrayBuffer(buffer);
-                return;
-              case GL_COPY_READ_BUFFER:
-                context-&gt;bindCopyReadBuffer(buffer);
-                return;
-              case GL_COPY_WRITE_BUFFER:
-                context-&gt;bindCopyWriteBuffer(buffer);
-                return;
-              case GL_PIXEL_PACK_BUFFER:
-                context-&gt;bindPixelPackBuffer(buffer);
-                return;
-              case GL_PIXEL_UNPACK_BUFFER:
-                context-&gt;bindPixelUnpackBuffer(buffer);
-                return;
-              case GL_UNIFORM_BUFFER:
-                context-&gt;bindGenericUniformBuffer(buffer);
-                return;
-              case GL_TRANSFORM_FEEDBACK_BUFFER:
-                context-&gt;bindGenericTransformFeedbackBuffer(buffer);
-                return;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindFramebuffer(target, framebuffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindFramebuffer(GLenum target, GLuint framebuffer)
</del><ins>+void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint framebuffer = %d)&quot;, target, framebuffer);
-
-    try
-    {
-        if (!gl::ValidFramebufferTarget(target))
-        {
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
-            {
-                context-&gt;bindReadFramebuffer(framebuffer);
-            }
-            
-            if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
-            {
-                context-&gt;bindDrawFramebuffer(framebuffer);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindRenderbuffer(target, renderbuffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindRenderbuffer(GLenum target, GLuint renderbuffer)
</del><ins>+void GL_APIENTRY glBindTexture(GLenum target, GLuint texture)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint renderbuffer = %d)&quot;, target, renderbuffer);
-
-    try
-    {
-        if (target != GL_RENDERBUFFER)
-        {
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;bindRenderbuffer(renderbuffer);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindTexture(target, texture);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindTexture(GLenum target, GLuint texture)
</del><ins>+void GL_APIENTRY glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint texture = %d)&quot;, target, texture);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture *textureObject = context-&gt;getTexture(texture);
-
-            if (textureObject &amp;&amp; textureObject-&gt;getTarget() != target &amp;&amp; texture != 0)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                context-&gt;bindTexture2D(texture);
-                return;
-              case GL_TEXTURE_CUBE_MAP:
-                context-&gt;bindTextureCubeMap(texture);
-                return;
-              case GL_TEXTURE_3D:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                context-&gt;bindTexture3D(texture);
-                return;
-              case GL_TEXTURE_2D_ARRAY:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                context-&gt;bindTexture2DArray(texture);
-                return;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BlendColor(red, green, blue, alpha);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
</del><ins>+void GL_APIENTRY glBlendEquation(GLenum mode)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)&quot;,
-          red, green, blue, alpha);
-
-    try
-    {
-        gl::Context* context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BlendEquation(mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBlendEquation(GLenum mode)
</del><ins>+void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
</ins><span class="cx"> {
</span><del>-    glBlendEquationSeparate(mode, mode);
</del><ins>+    return gl::BlendEquationSeparate(modeRGB, modeAlpha);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
</del><ins>+void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)&quot;, modeRGB, modeAlpha);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        switch (modeRGB)
-        {
-          case GL_FUNC_ADD:
-          case GL_FUNC_SUBTRACT:
-          case GL_FUNC_REVERSE_SUBTRACT:
-          case GL_MIN:
-          case GL_MAX:
-            break;
-
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        switch (modeAlpha)
-        {
-          case GL_FUNC_ADD:
-          case GL_FUNC_SUBTRACT:
-          case GL_FUNC_REVERSE_SUBTRACT:
-          case GL_MIN:
-          case GL_MAX:
-            break;
-
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        if (context)
-        {
-            context-&gt;setBlendEquation(modeRGB, modeAlpha);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BlendFunc(sfactor, dfactor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBlendFunc(GLenum sfactor, GLenum dfactor)
</del><ins>+void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
</ins><span class="cx"> {
</span><del>-    glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
</del><ins>+    return gl::BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
</del><ins>+void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)&quot;,
-          srcRGB, dstRGB, srcAlpha, dstAlpha);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        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 gl::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;
-
-          case GL_SRC_ALPHA_SATURATE:
-            if (!context || context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-            break;
-
-          default:
-            return gl::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 gl::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;
-
-          case GL_SRC_ALPHA_SATURATE:
-            if (!context || context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-            break;
-
-          default:
-            return gl::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 &amp;&amp; constantAlphaUsed)
-        {
-            ERR(&quot;Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL&quot;);
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        if (context)
-        {
-            context-&gt;setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BufferData(target, size, data, usage);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
</del><ins>+void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p, GLenum usage = %d)&quot;,
-          target, size, data, usage);
-
-    try
-    {
-        if (size &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        switch (usage)
-        {
-          case GL_STREAM_DRAW:
-          case GL_STATIC_DRAW:
-          case GL_DYNAMIC_DRAW:
-            break;
-
-          case GL_STREAM_READ:
-          case GL_STREAM_COPY:
-          case GL_STATIC_READ:
-          case GL_STATIC_COPY:
-          case GL_DYNAMIC_READ:
-          case GL_DYNAMIC_COPY:
-            if (context &amp;&amp; context-&gt;getClientVersion() &lt; 3)
-            {
-              return gl::error(GL_INVALID_ENUM);
-            }
-            break;
-
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        if (context)
-        {
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (!buffer)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            buffer-&gt;bufferData(data, size, usage);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BufferSubData(target, offset, size, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
</del><ins>+GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p)&quot;,
-          target, offset, size, data);
-
-    try
-    {
-        if (size &lt; 0 || offset &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (data == NULL)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (!buffer)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (buffer-&gt;mapped())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if ((size_t)size + offset &gt; buffer-&gt;size())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            buffer-&gt;bufferSubData(data, size, offset);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CheckFramebufferStatus(target);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLenum __stdcall glCheckFramebufferStatus(GLenum target)
</del><ins>+void GL_APIENTRY glClear(GLbitfield mask)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
-
-    try
-    {
-        if (!gl::ValidFramebufferTarget(target))
-        {
-            return gl::error(GL_INVALID_ENUM, 0);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Framebuffer *framebuffer = context-&gt;getTargetFramebuffer(target);
-            ASSERT(framebuffer);
-            return framebuffer-&gt;completeness();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
</del><ins>+    return gl::Clear(mask);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClear(GLbitfield mask)
</del><ins>+void GL_APIENTRY glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLbitfield mask = 0x%X)&quot;, mask);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Framebuffer *framebufferObject = context-&gt;getDrawFramebuffer();
-
-            if (!framebufferObject || framebufferObject-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE)
-            {
-                return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION);
-            }
-
-            if ((mask &amp; ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            context-&gt;clear(mask);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ClearColor(red, green, blue, alpha);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
</del><ins>+void GL_APIENTRY glClearDepthf(GLfloat depth)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)&quot;,
-          red, green, blue, alpha);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setClearColor(red, green, blue, alpha);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ClearDepthf(depth);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClearDepthf(GLclampf depth)
</del><ins>+void GL_APIENTRY glClearStencil(GLint s)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLclampf depth = %f)&quot;, depth);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setClearDepth(depth);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ClearStencil(s);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClearStencil(GLint s)
</del><ins>+void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint s = %d)&quot;, s);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setClearStencil(s);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ColorMask(red, green, blue, alpha);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
</del><ins>+void GL_APIENTRY glCompileShader(GLuint shader)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLboolean red = %d, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)&quot;,
-          red, green, blue, alpha);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CompileShader(shader);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCompileShader(GLuint shader)
</del><ins>+void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d)&quot;, shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (!shaderObject)
-            {
-                if (context-&gt;getProgram(shader))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            shaderObject-&gt;compile();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, 
-                                      GLint border, GLsizei imageSize, const GLvoid* data)
</del><ins>+void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, &quot; 
-          &quot;GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)&quot;,
-          target, level, internalformat, width, height, border, imageSize, data);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2TexImageParameters(context, target, level, internalformat, true, false,
-                                               0, 0, width, height, 0, GL_NONE, GL_NONE, data))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
-                                               0, 0, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
-            {
-                return;
-            }
-
-            if (imageSize &lt; 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, context-&gt;getClientVersion(), width, height))
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture = context-&gt;getTexture2D();
-                    texture-&gt;setCompressedImage(level, internalformat, width, height, imageSize, data);
-                }
-                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:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;setCompressedImage(target, level, internalformat, width, height, imageSize, data);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                                         GLenum format, GLsizei imageSize, const GLvoid* data)
</del><ins>+void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
-          &quot;GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, &quot;
-          &quot;GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)&quot;,
-          target, level, xoffset, yoffset, width, height, format, imageSize, data);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true,
-                                               xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
-                                               xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
-            {
-                return;
-            }
-
-            if (imageSize &lt; 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, context-&gt;getClientVersion(), width, height))
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture = context-&gt;getTexture2D();
-                    texture-&gt;subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
-                }
-                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:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
</del><ins>+void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, &quot;
-          &quot;GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)&quot;,
-          target, level, internalformat, x, y, width, height, border);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false,
-                                                   0, 0, x, y, width, height, border))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false,
-                                                   0, 0, 0, x, y, width, height, border))
-            {
-                return;
-            }
-
-            gl::Framebuffer *framebuffer = context-&gt;getReadFramebuffer();
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture = context-&gt;getTexture2D();
-                    texture-&gt;copyImage(level, internalformat, x, y, width, height, framebuffer);
-                }
-                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:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;copyImage(target, level, internalformat, x, y, width, height, framebuffer);
-                }
-                break;
-
-             default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
</del><ins>+GLuint GL_APIENTRY glCreateProgram(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
-          &quot;GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;,
-          target, level, xoffset, yoffset, x, y, width, height);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true,
-                                                   xoffset, yoffset, x, y, width, height, 0))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true,
-                                                   xoffset, yoffset, 0, x, y, width, height, 0))
-            {
-                return;
-            }
-
-            gl::Framebuffer *framebuffer = context-&gt;getReadFramebuffer();
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture = context-&gt;getTexture2D();
-                    texture-&gt;copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
-                }
-                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:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CreateProgram();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLuint __stdcall glCreateProgram(void)
</del><ins>+GLuint GL_APIENTRY glCreateShader(GLenum type)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            return context-&gt;createProgram();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
</del><ins>+    return gl::CreateShader(type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLuint __stdcall glCreateShader(GLenum type)
</del><ins>+void GL_APIENTRY glCullFace(GLenum mode)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum type = 0x%X)&quot;, type);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (type)
-            {
-              case GL_FRAGMENT_SHADER:
-              case GL_VERTEX_SHADER:
-                return context-&gt;createShader(type);
-              default:
-                return gl::error(GL_INVALID_ENUM, 0);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
</del><ins>+    return gl::CullFace(mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCullFace(GLenum mode)
</del><ins>+void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X)&quot;, mode);
-
-    try
-    {
-        switch (mode)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            {
-                gl::Context *context = gl::getNonLostContext();
-
-                if (context)
-                {
-                    context-&gt;setCullMode(mode);
-                }
-            }
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteBuffers(n, buffers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteBuffers(GLsizei n, const GLuint* buffers)
</del><ins>+void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* buffers = 0x%0.8p)&quot;, n, buffers);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                context-&gt;deleteBuffer(buffers[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteFramebuffers(n, framebuffers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteFencesNV(GLsizei n, const GLuint* fences)
</del><ins>+void GL_APIENTRY glDeleteProgram(GLuint program)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* fences = 0x%0.8p)&quot;, n, fences);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                context-&gt;deleteFenceNV(fences[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteProgram(program);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
</del><ins>+void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* framebuffers = 0x%0.8p)&quot;, n, framebuffers);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                if (framebuffers[i] != 0)
-                {
-                    context-&gt;deleteFramebuffer(framebuffers[i]);
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteRenderbuffers(n, renderbuffers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteProgram(GLuint program)
</del><ins>+void GL_APIENTRY glDeleteShader(GLuint shader)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d)&quot;, program);
-
-    try
-    {
-        if (program == 0)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!context-&gt;getProgram(program))
-            {
-                if(context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            context-&gt;deleteProgram(program);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteShader(shader);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
</del><ins>+void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint *ids = 0x%0.8p)&quot;, n, ids);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                context-&gt;deleteQuery(ids[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteTextures(n, textures);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
</del><ins>+void GL_APIENTRY glDepthFunc(GLenum func)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* renderbuffers = 0x%0.8p)&quot;, n, renderbuffers);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                context-&gt;deleteRenderbuffer(renderbuffers[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DepthFunc(func);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteShader(GLuint shader)
</del><ins>+void GL_APIENTRY glDepthMask(GLboolean flag)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d)&quot;, shader);
-
-    try
-    {
-        if (shader == 0)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!context-&gt;getShader(shader))
-            {
-                if(context-&gt;getProgram(shader))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            context-&gt;deleteShader(shader);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DepthMask(flag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteTextures(GLsizei n, const GLuint* textures)
</del><ins>+void GL_APIENTRY glDepthRangef(GLfloat n, GLfloat f)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* textures = 0x%0.8p)&quot;, n, textures);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                if (textures[i] != 0)
-                {
-                    context-&gt;deleteTexture(textures[i]);
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DepthRangef(n, f);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDepthFunc(GLenum func)
</del><ins>+void GL_APIENTRY glDetachShader(GLuint program, GLuint shader)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum func = 0x%X)&quot;, 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 gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setDepthFunc(func);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DetachShader(program, shader);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDepthMask(GLboolean flag)
</del><ins>+void GL_APIENTRY glDisable(GLenum cap)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLboolean flag = %u)&quot;, flag);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setDepthMask(flag != GL_FALSE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Disable(cap);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDepthRangef(GLclampf zNear, GLclampf zFar)
</del><ins>+void GL_APIENTRY glDisableVertexAttribArray(GLuint index)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLclampf zNear = %f, GLclampf zFar = %f)&quot;, zNear, zFar);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setDepthRange(zNear, zFar);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DisableVertexAttribArray(index);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDetachShader(GLuint program, GLuint shader)
</del><ins>+void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLuint shader = %d)&quot;, program, shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-            
-            if (!programObject)
-            {
-                gl::Shader *shaderByProgramHandle;
-                shaderByProgramHandle = context-&gt;getShader(program);
-                if (!shaderByProgramHandle)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-            }
-
-            if (!shaderObject)
-            {
-                gl::Program *programByShaderHandle = context-&gt;getProgram(shader);
-                if (!programByShaderHandle)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-            }
-
-            if (!programObject-&gt;detachShader(shaderObject))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawArrays(mode, first, count);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDisable(GLenum cap)
</del><ins>+void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum cap = 0x%X)&quot;, cap);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidCap(context, cap))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;setCap(cap, false);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawElements(mode, count, type, indices);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDisableVertexAttribArray(GLuint index)
</del><ins>+void GL_APIENTRY glEnable(GLenum cap)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d)&quot;, index);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setEnableVertexAttribArray(index, false);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Enable(cap);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawArrays(GLenum mode, GLint first, GLsizei count)
</del><ins>+void GL_APIENTRY glEnableVertexAttribArray(GLuint index)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)&quot;, mode, first, count);
-
-    try
-    {
-        if (count &lt; 0 || first &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        // Check for mapped buffers
-        if (context-&gt;hasMappedBuffer(GL_ARRAY_BUFFER))
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        if (context)
-        {
-            gl::TransformFeedback *curTransformFeedback = context-&gt;getCurrentTransformFeedback();
-            if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isStarted() &amp;&amp; !curTransformFeedback-&gt;isPaused() &amp;&amp;
-                curTransformFeedback-&gt;getDrawMode() != mode)
-            {
-                // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode
-                // that does not match the current transform feedback object's draw mode (if transform feedback
-                // is active), (3.0.2, section 2.14, pg 86)
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;drawArrays(mode, first, count, 0);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::EnableVertexAttribArray(index);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
</del><ins>+void GL_APIENTRY glFinish(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)&quot;, mode, first, count, primcount);
-
-    try
-    {
-        if (count &lt; 0 || first &lt; 0 || primcount &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (primcount &gt; 0)
-        {
-            gl::Context *context = gl::getNonLostContext();
-
-            // Check for mapped buffers
-            if (context-&gt;hasMappedBuffer(GL_ARRAY_BUFFER))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (context)
-            {
-                gl::TransformFeedback *curTransformFeedback = context-&gt;getCurrentTransformFeedback();
-                if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isStarted() &amp;&amp; !curTransformFeedback-&gt;isPaused() &amp;&amp;
-                    curTransformFeedback-&gt;getDrawMode() != mode)
-                {
-                    // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode
-                    // that does not match the current transform feedback object's draw mode (if transform feedback
-                    // is active), (3.0.2, section 2.14, pg 86)
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-
-                context-&gt;drawArrays(mode, first, count, primcount);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Finish();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
</del><ins>+void GL_APIENTRY glFlush(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p)&quot;,
-          mode, count, type, indices);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::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-&gt;supports32bitIndices())
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::TransformFeedback *curTransformFeedback = context-&gt;getCurrentTransformFeedback();
-            if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isStarted() &amp;&amp; !curTransformFeedback-&gt;isPaused())
-            {
-                // It is an invalid operation to call DrawElements, DrawRangeElements or DrawElementsInstanced
-                // while transform feedback is active, (3.0.2, section 2.14, pg 86)
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // Check for mapped buffers
-            if (context-&gt;hasMappedBuffer(GL_ARRAY_BUFFER) || context-&gt;hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;drawElements(mode, count, type, indices, 0);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Flush();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)
</del><ins>+void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)&quot;,
-          mode, count, type, indices, primcount);
-
-    try
-    {
-        if (count &lt; 0 || primcount &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (primcount &gt; 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-&gt;supports32bitIndices())
-                    {
-                        return gl::error(GL_INVALID_ENUM);
-                    }
-                    break;
-                  default:
-                    return gl::error(GL_INVALID_ENUM);
-                }
-
-                gl::TransformFeedback *curTransformFeedback = context-&gt;getCurrentTransformFeedback();
-                if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isStarted() &amp;&amp; !curTransformFeedback-&gt;isPaused())
-                {
-                    // It is an invalid operation to call DrawElements, DrawRangeElements or DrawElementsInstanced
-                    // while transform feedback is active, (3.0.2, section 2.14, pg 86)
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-
-                // Check for mapped buffers
-                if (context-&gt;hasMappedBuffer(GL_ARRAY_BUFFER) || context-&gt;hasMappedBuffer(GL_ELEMENT_ARRAY_BUFFER))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-
-                context-&gt;drawElements(mode, count, type, indices, primcount);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glEnable(GLenum cap)
</del><ins>+void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum cap = 0x%X)&quot;, cap);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidCap(context, cap))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;setCap(cap, true);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::FramebufferTexture2D(target, attachment, textarget, texture, level);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glEnableVertexAttribArray(GLuint index)
</del><ins>+void GL_APIENTRY glFrontFace(GLenum mode)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d)&quot;, index);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setEnableVertexAttribArray(index, true);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::FrontFace(mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glEndQueryEXT(GLenum target)
</del><ins>+void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;GLenum target = 0x%X)&quot;, target);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidQueryType(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;endQuery(target);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenBuffers(n, buffers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFinishFenceNV(GLuint fence)
</del><ins>+void GL_APIENTRY glGenerateMipmap(GLenum target)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint fence = %d)&quot;, fence);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::FenceNV *fenceObject = context-&gt;getFenceNV(fence);
-
-            if (fenceObject == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (fenceObject-&gt;isFence() != GL_TRUE)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            fenceObject-&gt;finishFence();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenerateMipmap(target);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFinish(void)
</del><ins>+void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;sync(true);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenFramebuffers(n, framebuffers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFlush(void)
</del><ins>+void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;sync(false);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenRenderbuffers(n, renderbuffers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
</del><ins>+void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, &quot;
-          &quot;GLuint renderbuffer = %d)&quot;, target, attachment, renderbuffertarget, renderbuffer);
-
-    try
-    {
-        if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER &amp;&amp; renderbuffer != 0))
-        {
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer))
-            {
-                return;
-            }
-
-            gl::Framebuffer *framebuffer = context-&gt;getTargetFramebuffer(target);
-            ASSERT(framebuffer);
-
-            if (attachment &gt;= GL_COLOR_ATTACHMENT0_EXT &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15_EXT)
-            {
-                unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-                framebuffer-&gt;setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0);
-            }
-            else
-            {
-                switch (attachment)
-                {
-                  case GL_DEPTH_ATTACHMENT:
-                    framebuffer-&gt;setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
-                    break;
-                  case GL_STENCIL_ATTACHMENT:
-                    framebuffer-&gt;setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
-                    break;
-                  case GL_DEPTH_STENCIL_ATTACHMENT:
-                    framebuffer-&gt;setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0);
-                    break;
-                  default:
-                    UNREACHABLE();
-                    break;
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenTextures(n, textures);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
</del><ins>+void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, &quot;
-          &quot;GLuint texture = %d, GLint level = %d)&quot;, target, attachment, textarget, texture, level);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2FramebufferTextureParameters(context, target, attachment, textarget, texture, level))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3FramebufferTextureParameters(context, target, attachment, textarget, texture, level, 0, false))
-            {
-                return;
-            }
-
-            if (texture == 0)
-            {
-                textarget = GL_NONE;
-            }
-
-            gl::Framebuffer *framebuffer = context-&gt;getTargetFramebuffer(target);
-
-            if (attachment &gt;= GL_COLOR_ATTACHMENT0_EXT &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15_EXT)
-            {
-                const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-                framebuffer-&gt;setColorbuffer(colorAttachment, textarget, texture, level, 0);
-            }
-            else
-            {
-                switch (attachment)
-                {
-                  case GL_DEPTH_ATTACHMENT:         framebuffer-&gt;setDepthbuffer(textarget, texture, level, 0);        break;
-                  case GL_STENCIL_ATTACHMENT:       framebuffer-&gt;setStencilbuffer(textarget, texture, level, 0);      break;
-                  case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer-&gt;setDepthStencilBuffer(textarget, texture, level, 0); break;
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetActiveAttrib(program, index, bufsize, length, size, type, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFrontFace(GLenum mode)
</del><ins>+void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X)&quot;, mode);
-
-    try
-    {
-        switch (mode)
-        {
-          case GL_CW:
-          case GL_CCW:
-            {
-                gl::Context *context = gl::getNonLostContext();
-
-                if (context)
-                {
-                    context-&gt;setFrontFace(mode);
-                }
-            }
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetActiveUniform(program, index, bufsize, length, size, type, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenBuffers(GLsizei n, GLuint* buffers)
</del><ins>+void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* buffers = 0x%0.8p)&quot;, n, buffers);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                buffers[i] = context-&gt;createBuffer();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetAttachedShaders(program, maxcount, count, shaders);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenerateMipmap(GLenum target)
</del><ins>+GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidTextureTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Texture *texture = context-&gt;getTargetTexture(target);
-
-            if (texture == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            GLenum internalFormat = texture-&gt;getBaseLevelInternalFormat();
-
-            // Internally, all texture formats are sized so checking if the format
-            // is color renderable and filterable will not fail.
-
-            bool validRenderable = (gl::IsColorRenderingSupported(internalFormat, context) ||
-                                    gl::IsSizedInternalFormat(internalFormat, context-&gt;getClientVersion()));
-
-            if (gl::IsDepthRenderingSupported(internalFormat, context) ||
-                gl::IsFormatCompressed(internalFormat, context-&gt;getClientVersion()) ||
-                !gl::IsTextureFilteringSupported(internalFormat, context) ||
-                !validRenderable)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // Non-power of 2 ES2 check
-            if (!context-&gt;supportsNonPower2Texture() &amp;&amp; (!gl::isPow2(texture-&gt;getBaseLevelWidth()) || !gl::isPow2(texture-&gt;getBaseLevelHeight())))
-            {
-                ASSERT(context-&gt;getClientVersion() &lt;= 2 &amp;&amp; (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP));
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // Cube completeness check
-            if (target == GL_TEXTURE_CUBE_MAP)
-            {
-                gl::TextureCubeMap *textureCube = static_cast&lt;gl::TextureCubeMap *&gt;(texture);
-                if (!textureCube-&gt;isCubeComplete())
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-            }
-
-            texture-&gt;generateMipmaps();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetAttribLocation(program, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenFencesNV(GLsizei n, GLuint* fences)
</del><ins>+void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* fences = 0x%0.8p)&quot;, n, fences);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                fences[i] = context-&gt;createFenceNV();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetBooleanv(pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenFramebuffers(GLsizei n, GLuint* framebuffers)
</del><ins>+void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)&quot;, n, framebuffers);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                framebuffers[i] = context-&gt;createFramebuffer();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetBufferParameteriv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenQueriesEXT(GLsizei n, GLuint* ids)
</del><ins>+GLenum GL_APIENTRY glGetError(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (n &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (GLsizei i = 0; i &lt; n; i++)
-            {
-                ids[i] = context-&gt;createQuery();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetError();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
</del><ins>+void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)&quot;, n, renderbuffers);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                renderbuffers[i] = context-&gt;createRenderbuffer();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetFloatv(pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenTextures(GLsizei n, GLuint* textures)
</del><ins>+void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* textures = 0x%0.8p)&quot;, n, textures);
-
-    try
-    {
-        if (n &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            for (int i = 0; i &lt; n; i++)
-            {
-                textures[i] = context-&gt;createTexture();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
</del><ins>+void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, GLsizei *length = 0x%0.8p, &quot;
-          &quot;GLint *size = 0x%0.8p, GLenum *type = %0.8p, GLchar *name = %0.8p)&quot;,
-          program, index, bufsize, length, size, type, name);
-
-    try
-    {
-        if (bufsize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (index &gt;= (GLuint)programObject-&gt;getActiveAttributeCount())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            programObject-&gt;getActiveAttribute(index, bufsize, length, size, type, name);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetIntegerv(pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
</del><ins>+void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, &quot;
-          &quot;GLsizei* length = 0x%0.8p, GLint* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)&quot;,
-          program, index, bufsize, length, size, type, name);
-
-    try
-    {
-        if (bufsize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (index &gt;= (GLuint)programObject-&gt;getActiveUniformCount())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            programObject-&gt;getActiveUniform(index, bufsize, length, size, type, name);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetProgramiv(program, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
</del><ins>+void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = 0x%0.8p, GLuint* shaders = 0x%0.8p)&quot;,
-          program, maxcount, count, shaders);
-
-    try
-    {
-        if (maxcount &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            return programObject-&gt;getAttachedShaders(maxcount, count, shaders);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetProgramInfoLog(program, bufsize, length, infolog);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int __stdcall glGetAttribLocation(GLuint program, const GLchar* name)
</del><ins>+void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, const GLchar* name = %s)&quot;, program, name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION, -1);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE, -1);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programObject-&gt;isLinked() || !programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION, -1);
-            }
-
-            return programBinary-&gt;getAttributeLocation(name);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, -1);
-    }
-
-    return -1;
</del><ins>+    return gl::GetRenderbufferParameteriv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetBooleanv(GLenum pname, GLboolean* params)
</del><ins>+void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)&quot;,  pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLenum nativeType;
-            unsigned int numParams = 0;
-            if (!context-&gt;getQueryParameterInfo(pname, &amp;nativeType, &amp;numParams))
-                return gl::error(GL_INVALID_ENUM);
-
-            // pname is valid, but there are no parameters to return
-            if (numParams == 0)
-                return;
-
-            if (nativeType == GL_BOOL)
-            {
-                context-&gt;getBooleanv(pname, params);
-            }
-            else
-            {
-                CastStateValues(context, nativeType, pname, numParams, params);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetShaderiv(shader, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (!gl::ValidBufferParameter(context, pname))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (!buffer)
-            {
-                // A null buffer means that &quot;0&quot; is bound to the requested buffer target
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (pname)
-            {
-              case GL_BUFFER_USAGE:
-                *params = static_cast&lt;GLint&gt;(buffer-&gt;usage());
-                break;
-              case GL_BUFFER_SIZE:
-                *params = gl::clampCast&lt;GLint&gt;(buffer-&gt;size());
-                break;
-              case GL_BUFFER_ACCESS_FLAGS:
-                *params = buffer-&gt;accessFlags();
-                break;
-              case GL_BUFFER_MAPPED:
-                *params = static_cast&lt;GLint&gt;(buffer-&gt;mapped());
-                break;
-              case GL_BUFFER_MAP_OFFSET:
-                *params = gl::clampCast&lt;GLint&gt;(buffer-&gt;mapOffset());
-                break;
-              case GL_BUFFER_MAP_LENGTH:
-                *params = gl::clampCast&lt;GLint&gt;(buffer-&gt;mapLength());
-                break;
-              default: UNREACHABLE(); break;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetShaderInfoLog(shader, bufsize, length, infolog);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLenum __stdcall glGetError(void)
</del><ins>+void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    gl::Context *context = gl::getContext();
-
-    if (context)
-    {
-        return context-&gt;getError();
-    }
-
-    return GL_NO_ERROR;
</del><ins>+    return gl::GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
</del><ins>+void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)&quot;, fence, pname, params);
-
-    try
-    {
-    
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::FenceNV *fenceObject = context-&gt;getFenceNV(fence);
-
-            if (fenceObject == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (fenceObject-&gt;isFence() != GL_TRUE)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (pname)
-            {
-              case GL_FENCE_STATUS_NV:
-              case GL_FENCE_CONDITION_NV:
-                break;
-
-              default: return gl::error(GL_INVALID_ENUM);
-            }
-
-            params[0] = fenceObject-&gt;getFencei(pname);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetShaderSource(shader, bufsize, length, source);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetFloatv(GLenum pname, GLfloat* params)
</del><ins>+const GLubyte* GL_APIENTRY glGetString(GLenum name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLenum nativeType;
-            unsigned int numParams = 0;
-            if (!context-&gt;getQueryParameterInfo(pname, &amp;nativeType, &amp;numParams))
-                return gl::error(GL_INVALID_ENUM);
-
-            // pname is valid, but that there are no parameters to return.
-            if (numParams == 0)
-                return;
-
-            if (nativeType == GL_FLOAT)
-            {
-                context-&gt;getFloatv(pname, params);
-            }
-            else
-            {
-                CastStateValues(context, nativeType, pname, numParams, params);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetString(name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
-          target, attachment, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidFramebufferTarget(target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
-              case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
-              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
-              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
-                break;
-              case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
-              case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
-              case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
-              case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
-              case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
-              case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
-              case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
-              case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
-              case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
-                if (context-&gt;getClientVersion() &gt;= 3)
-                {
-                    break;
-                }
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            // Determine if the attachment is a valid enum
-            switch (attachment)
-            {
-              case GL_BACK:
-              case GL_FRONT:
-              case GL_DEPTH:
-              case GL_STENCIL:
-              case GL_DEPTH_STENCIL_ATTACHMENT:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                break;
-
-              case GL_DEPTH_ATTACHMENT:
-              case GL_STENCIL_ATTACHMENT:
-                break;
-
-              default:
-                if (attachment &lt; GL_COLOR_ATTACHMENT0_EXT ||
-                    (attachment - GL_COLOR_ATTACHMENT0_EXT) &gt;= context-&gt;getMaximumRenderTargets())
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                break;
-            }
-
-            GLuint framebufferHandle = context-&gt;getTargetFramebufferHandle(target);
-            ASSERT(framebufferHandle != GL_INVALID_INDEX);
-            gl::Framebuffer *framebuffer = context-&gt;getFramebuffer(framebufferHandle);
-
-            GLenum attachmentType;
-            GLuint attachmentHandle;
-            GLuint attachmentLevel;
-            GLuint attachmentLayer;
-            gl::Renderbuffer *renderbuffer;
-
-            if(framebufferHandle == 0)
-            {
-                if(context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-
-                switch (attachment)
-                {
-                  case GL_BACK:
-                    attachmentType = framebuffer-&gt;getColorbufferType(0);
-                    attachmentHandle = framebuffer-&gt;getColorbufferHandle(0);
-                    attachmentLevel = framebuffer-&gt;getColorbufferMipLevel(0);
-                    attachmentLayer = framebuffer-&gt;getColorbufferLayer(0);
-                    renderbuffer = framebuffer-&gt;getColorbuffer(0);
-                    break;
-                  case GL_DEPTH:
-                    attachmentType = framebuffer-&gt;getDepthbufferType();
-                    attachmentHandle = framebuffer-&gt;getDepthbufferHandle();
-                    attachmentLevel = framebuffer-&gt;getDepthbufferMipLevel();
-                    attachmentLayer = framebuffer-&gt;getDepthbufferLayer();
-                    renderbuffer = framebuffer-&gt;getDepthbuffer();
-                    break;
-                  case GL_STENCIL:
-                    attachmentType = framebuffer-&gt;getStencilbufferType();
-                    attachmentHandle = framebuffer-&gt;getStencilbufferHandle();
-                    attachmentLevel = framebuffer-&gt;getStencilbufferMipLevel();
-                    attachmentLayer = framebuffer-&gt;getStencilbufferLayer();
-                    renderbuffer = framebuffer-&gt;getStencilbuffer();
-                    break;
-                  default:
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-            }
-            else
-            {
-                if (attachment &gt;= GL_COLOR_ATTACHMENT0_EXT &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15_EXT)
-                {
-                    const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-                    attachmentType = framebuffer-&gt;getColorbufferType(colorAttachment);
-                    attachmentHandle = framebuffer-&gt;getColorbufferHandle(colorAttachment);
-                    attachmentLevel = framebuffer-&gt;getColorbufferMipLevel(colorAttachment);
-                    attachmentLayer = framebuffer-&gt;getColorbufferLayer(colorAttachment);
-                    renderbuffer = framebuffer-&gt;getColorbuffer(colorAttachment);
-                }
-                else
-                {
-                    switch (attachment)
-                    {
-                      case GL_DEPTH_ATTACHMENT:
-                        attachmentType = framebuffer-&gt;getDepthbufferType();
-                        attachmentHandle = framebuffer-&gt;getDepthbufferHandle();
-                        attachmentLevel = framebuffer-&gt;getDepthbufferMipLevel();
-                        attachmentLayer = framebuffer-&gt;getDepthbufferLayer();
-                        renderbuffer = framebuffer-&gt;getDepthbuffer();
-                        break;
-                      case GL_STENCIL_ATTACHMENT:
-                        attachmentType = framebuffer-&gt;getStencilbufferType();
-                        attachmentHandle = framebuffer-&gt;getStencilbufferHandle();
-                        attachmentLevel = framebuffer-&gt;getStencilbufferMipLevel();
-                        attachmentLayer = framebuffer-&gt;getStencilbufferLayer();
-                        renderbuffer = framebuffer-&gt;getStencilbuffer();
-                        break;
-                      case GL_DEPTH_STENCIL_ATTACHMENT:
-                        if (framebuffer-&gt;getDepthbufferHandle() != framebuffer-&gt;getStencilbufferHandle())
-                        {
-                            return gl::error(GL_INVALID_OPERATION);
-                        }
-                        attachmentType = framebuffer-&gt;getDepthStencilbufferType();
-                        attachmentHandle = framebuffer-&gt;getDepthStencilbufferHandle();
-                        attachmentLevel = framebuffer-&gt;getDepthStencilbufferMipLevel();
-                        attachmentLayer = framebuffer-&gt;getDepthStencilbufferLayer();
-                        renderbuffer = framebuffer-&gt;getDepthStencilBuffer();
-                        break;
-                      default:
-                        return gl::error(GL_INVALID_OPERATION);
-                    }
-                }
-            }
-
-            GLenum attachmentObjectType;   // Type category
-            if (framebufferHandle == 0)
-            {
-                attachmentObjectType = GL_FRAMEBUFFER_DEFAULT;
-            }
-            else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER)
-            {
-                attachmentObjectType = attachmentType;
-            }
-            else if (gl::IsInternalTextureTarget(attachmentType, context-&gt;getClientVersion()))
-            {
-                attachmentObjectType = GL_TEXTURE;
-            }
-            else
-            {
-                UNREACHABLE();
-                return;
-            }
-
-            if (attachmentObjectType == GL_NONE)
-            {
-                // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
-                // is NONE, then querying any other pname will generate INVALID_ENUM.
-
-                // ES 3.0.2 spec pg 235 states that if the attachment type is none,
-                // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
-                // INVALID_OPERATION for all other pnames
-
-                switch (pname)
-                {
-                  case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
-                    *params = attachmentObjectType;
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
-                    if (context-&gt;getClientVersion() &lt; 3)
-                    {
-                        return gl::error(GL_INVALID_ENUM);
-                    }
-                    *params = 0;
-                    break;
-
-                  default:
-                    if (context-&gt;getClientVersion() &lt; 3)
-                    {
-                        return gl::error(GL_INVALID_ENUM);
-                    }
-                    else
-                    {
-                        gl::error(GL_INVALID_OPERATION);
-                    }
-                }
-            }
-            else
-            {
-                ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE ||
-                       attachmentObjectType == GL_FRAMEBUFFER_DEFAULT);
-                ASSERT(renderbuffer != NULL);
-
-                switch (pname)
-                {
-                  case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
-                    *params = attachmentObjectType;
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
-                    if (attachmentObjectType != GL_RENDERBUFFER &amp;&amp; attachmentObjectType != GL_TEXTURE)
-                    {
-                        return gl::error(GL_INVALID_ENUM);
-                    }
-                    *params = attachmentHandle;
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
-                    if (attachmentObjectType != GL_TEXTURE)
-                    {
-                        return gl::error(GL_INVALID_ENUM);
-                    }
-                    *params = attachmentLevel;
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
-                    if (attachmentObjectType != GL_TEXTURE)
-                    {
-                        return gl::error(GL_INVALID_ENUM);
-                    }
-                    *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0;
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
-                    *params = renderbuffer-&gt;getRedSize();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
-                    *params = renderbuffer-&gt;getGreenSize();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
-                    *params = renderbuffer-&gt;getBlueSize();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
-                    *params = renderbuffer-&gt;getAlphaSize();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
-                    *params = renderbuffer-&gt;getDepthSize();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
-                    *params = renderbuffer-&gt;getStencilSize();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
-                    if (attachment == GL_DEPTH_STENCIL)
-                    {
-                        gl::error(GL_INVALID_OPERATION);
-                    }
-                    *params = renderbuffer-&gt;getComponentType();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
-                    *params = renderbuffer-&gt;getColorEncoding();
-                    break;
-
-                  case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
-                    if (attachmentObjectType != GL_TEXTURE)
-                    {
-                        return gl::error(GL_INVALID_ENUM);
-                    }
-                    *params = attachmentLayer;
-                    break;
-
-                  default:
-                    UNREACHABLE();
-                    break;
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetTexParameterfv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLenum __stdcall glGetGraphicsResetStatusEXT(void)
</del><ins>+void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        gl::Context *context = gl::getContext();
-
-        if (context)
-        {
-            return context-&gt;getResetStatus();
-        }
-
-        return GL_NO_ERROR;
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return GL_OUT_OF_MEMORY;
-    }
</del><ins>+    return gl::GetTexParameteriv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetIntegerv(GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLenum nativeType;
-            unsigned int numParams = 0;
-            if (!context-&gt;getQueryParameterInfo(pname, &amp;nativeType, &amp;numParams))
-                return gl::error(GL_INVALID_ENUM);
-
-            // pname is valid, but there are no parameters to return
-            if (numParams == 0)
-                return;
-
-            if (nativeType == GL_INT)
-            {
-                context-&gt;getIntegerv(pname, params);
-            }
-            else
-            {
-                CastStateValues(context, nativeType, pname, numParams, params);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetUniformfv(program, location, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetProgramiv(GLuint program, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLenum pname = %d, GLint* params = 0x%0.8p)&quot;, program, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                switch (pname)
-                {
-                  case GL_ACTIVE_UNIFORM_BLOCKS:
-                  case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
-                  case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
-                  case GL_TRANSFORM_FEEDBACK_VARYINGS:
-                  case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
-                    return gl::error(GL_INVALID_ENUM);
-                }
-            }
-
-            switch (pname)
-            {
-              case GL_DELETE_STATUS:
-                *params = programObject-&gt;isFlaggedForDeletion();
-                return;
-              case GL_LINK_STATUS:
-                *params = programObject-&gt;isLinked();
-                return;
-              case GL_VALIDATE_STATUS:
-                *params = programObject-&gt;isValidated();
-                return;
-              case GL_INFO_LOG_LENGTH:
-                *params = programObject-&gt;getInfoLogLength();
-                return;
-              case GL_ATTACHED_SHADERS:
-                *params = programObject-&gt;getAttachedShadersCount();
-                return;
-              case GL_ACTIVE_ATTRIBUTES:
-                *params = programObject-&gt;getActiveAttributeCount();
-                return;
-              case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
-                *params = programObject-&gt;getActiveAttributeMaxLength();
-                return;
-              case GL_ACTIVE_UNIFORMS:
-                *params = programObject-&gt;getActiveUniformCount();
-                return;
-              case GL_ACTIVE_UNIFORM_MAX_LENGTH:
-                *params = programObject-&gt;getActiveUniformMaxLength();
-                return;
-              case GL_PROGRAM_BINARY_LENGTH_OES:
-                *params = programObject-&gt;getProgramBinaryLength();
-                return;
-              case GL_ACTIVE_UNIFORM_BLOCKS:
-                *params = programObject-&gt;getActiveUniformBlockCount();
-                return;
-              case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
-                *params = programObject-&gt;getActiveUniformBlockMaxLength();
-                break;
-              case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
-                *params = programObject-&gt;getTransformFeedbackBufferMode();
-                break;
-              case GL_TRANSFORM_FEEDBACK_VARYINGS:
-                *params = programObject-&gt;getTransformFeedbackVaryingCount();
-                break;
-              case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
-                *params = programObject-&gt;getTransformFeedbackVaryingMaxLength();
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetUniformiv(program, location, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
</del><ins>+GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)&quot;,
-          program, bufsize, length, infolog);
-
-    try
-    {
-        if (bufsize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            programObject-&gt;getInfoLog(bufsize, length, infolog);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetUniformLocation(program, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
</del><ins>+void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidQueryType(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_CURRENT_QUERY_EXT:
-                params[0] = context-&gt;getActiveQuery(target);
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetVertexAttribfv(index, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
</del><ins>+void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)&quot;, id, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Query *queryObject = context-&gt;getQuery(id, false, GL_NONE);
-
-            if (!queryObject)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (context-&gt;getActiveQuery(queryObject-&gt;getType()) == id)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch(pname)
-            {
-              case GL_QUERY_RESULT_EXT:
-                params[0] = queryObject-&gt;getResult();
-                break;
-              case GL_QUERY_RESULT_AVAILABLE_EXT:
-                params[0] = queryObject-&gt;isResultAvailable();
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetVertexAttribiv(index, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (target != GL_RENDERBUFFER)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (context-&gt;getRenderbufferHandle() == 0)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::Renderbuffer *renderbuffer = context-&gt;getRenderbuffer(context-&gt;getRenderbufferHandle());
-
-            switch (pname)
-            {
-              case GL_RENDERBUFFER_WIDTH:           *params = renderbuffer-&gt;getWidth();          break;
-              case GL_RENDERBUFFER_HEIGHT:          *params = renderbuffer-&gt;getHeight();         break;
-              case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer-&gt;getInternalFormat(); break;
-              case GL_RENDERBUFFER_RED_SIZE:        *params = renderbuffer-&gt;getRedSize();        break;
-              case GL_RENDERBUFFER_GREEN_SIZE:      *params = renderbuffer-&gt;getGreenSize();      break;
-              case GL_RENDERBUFFER_BLUE_SIZE:       *params = renderbuffer-&gt;getBlueSize();       break;
-              case GL_RENDERBUFFER_ALPHA_SIZE:      *params = renderbuffer-&gt;getAlphaSize();      break;
-              case GL_RENDERBUFFER_DEPTH_SIZE:      *params = renderbuffer-&gt;getDepthSize();      break;
-              case GL_RENDERBUFFER_STENCIL_SIZE:    *params = renderbuffer-&gt;getStencilSize();    break;
-              case GL_RENDERBUFFER_SAMPLES_ANGLE:
-                if (context-&gt;getMaxSupportedSamples() != 0)
-                {
-                    *params = renderbuffer-&gt;getSamples();
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetVertexAttribPointerv(index, pname, pointer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glHint(GLenum target, GLenum mode)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)&quot;, shader, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (!shaderObject)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (pname)
-            {
-              case GL_SHADER_TYPE:
-                *params = shaderObject-&gt;getType();
-                return;
-              case GL_DELETE_STATUS:
-                *params = shaderObject-&gt;isFlaggedForDeletion();
-                return;
-              case GL_COMPILE_STATUS:
-                *params = shaderObject-&gt;isCompiled() ? GL_TRUE : GL_FALSE;
-                return;
-              case GL_INFO_LOG_LENGTH:
-                *params = shaderObject-&gt;getInfoLogLength();
-                return;
-              case GL_SHADER_SOURCE_LENGTH:
-                *params = shaderObject-&gt;getSourceLength();
-                return;
-              case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE:
-                *params = shaderObject-&gt;getTranslatedSourceLength();
-                return;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Hint(target, mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
</del><ins>+GLboolean GL_APIENTRY glIsBuffer(GLuint buffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)&quot;,
-          shader, bufsize, length, infolog);
-
-    try
-    {
-        if (bufsize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (!shaderObject)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            shaderObject-&gt;getInfoLog(bufsize, length, infolog);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsBuffer(buffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
</del><ins>+GLboolean GL_APIENTRY glIsEnabled(GLenum cap)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = 0x%0.8p, GLint* precision = 0x%0.8p)&quot;,
-          shadertype, precisiontype, range, precision);
-
-    try
-    {
-        switch (shadertype)
-        {
-          case GL_VERTEX_SHADER:
-          case GL_FRAGMENT_SHADER:
-            break;
-          default:
-            return gl::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 gl::error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsEnabled(cap);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
</del><ins>+GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)&quot;,
-          shader, bufsize, length, source);
-
-    try
-    {
-        if (bufsize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (!shaderObject)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            shaderObject-&gt;getSource(bufsize, length, source);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsFramebuffer(framebuffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
</del><ins>+GLboolean GL_APIENTRY glIsProgram(GLuint program)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)&quot;,
-          shader, bufsize, length, source);
-
-    try
-    {
-        if (bufsize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (!shaderObject)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            shaderObject-&gt;getTranslatedSource(bufsize, length, source);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsProgram(program);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-const GLubyte* __stdcall glGetString(GLenum name)
</del><ins>+GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum name = 0x%X)&quot;, name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        switch (name)
-        {
-          case GL_VENDOR:
-            return (GLubyte*)&quot;Google Inc.&quot;;
-          case GL_RENDERER:
-            return (GLubyte*)((context != NULL) ? context-&gt;getRendererString() : &quot;ANGLE&quot;);
-          case GL_VERSION:
-            if (context-&gt;getClientVersion() == 2)
-            {
-                return (GLubyte*)&quot;OpenGL ES 2.0 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
-            }
-            else
-            {
-                return (GLubyte*)&quot;OpenGL ES 3.0 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
-            }
-          case GL_SHADING_LANGUAGE_VERSION:
-            if (context-&gt;getClientVersion() == 2)
-            {
-                return (GLubyte*)&quot;OpenGL ES GLSL ES 1.00 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
-            }
-            else
-            {
-                return (GLubyte*)&quot;OpenGL ES GLSL ES 3.00 (ANGLE &quot; ANGLE_VERSION_STRING &quot;)&quot;;
-            }
-          case GL_EXTENSIONS:
-            return (GLubyte*)((context != NULL) ? context-&gt;getCombinedExtensionsString() : &quot;&quot;);
-          default:
-            return gl::error(GL_INVALID_ENUM, (GLubyte*)NULL);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, (GLubyte*)NULL);
-    }
</del><ins>+    return gl::IsRenderbuffer(renderbuffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
</del><ins>+GLboolean GL_APIENTRY glIsShader(GLuint shader)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture *texture = context-&gt;getTargetTexture(target);
-
-            if (!texture)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_TEXTURE_MAG_FILTER:
-                *params = (GLfloat)texture-&gt;getMagFilter();
-                break;
-              case GL_TEXTURE_MIN_FILTER:
-                *params = (GLfloat)texture-&gt;getMinFilter();
-                break;
-              case GL_TEXTURE_WRAP_S:
-                *params = (GLfloat)texture-&gt;getWrapS();
-                break;
-              case GL_TEXTURE_WRAP_T:
-                *params = (GLfloat)texture-&gt;getWrapT();
-                break;
-              case GL_TEXTURE_WRAP_R:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getWrapR();
-                break;
-              case GL_TEXTURE_IMMUTABLE_FORMAT:
-                // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
-                *params = (GLfloat)(texture-&gt;isImmutable() ? GL_TRUE : GL_FALSE);
-                break;
-              case GL_TEXTURE_IMMUTABLE_LEVELS:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;immutableLevelCount();
-                break;
-              case GL_TEXTURE_USAGE_ANGLE:
-                *params = (GLfloat)texture-&gt;getUsage();
-                break;
-              case GL_TEXTURE_MAX_ANISOTROPY_EXT:
-                if (!context-&gt;supportsTextureFilterAnisotropy())
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getMaxAnisotropy();
-                break;
-              case GL_TEXTURE_SWIZZLE_R:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getSwizzleRed();
-                break;
-              case GL_TEXTURE_SWIZZLE_G:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getSwizzleGreen();
-                break;
-              case GL_TEXTURE_SWIZZLE_B:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getSwizzleBlue();
-                break;
-              case GL_TEXTURE_SWIZZLE_A:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getSwizzleAlpha();
-                break;
-              case GL_TEXTURE_BASE_LEVEL:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getBaseLevel();
-                break;
-              case GL_TEXTURE_MAX_LEVEL:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLfloat)texture-&gt;getMaxLevel();
-                break;
-              case GL_TEXTURE_MIN_LOD:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getMinLod();
-                break;
-              case GL_TEXTURE_MAX_LOD:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getMaxLod();
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsShader(shader);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
</del><ins>+GLboolean GL_APIENTRY glIsTexture(GLuint texture)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture *texture = context-&gt;getTargetTexture(target);
-
-            if (!texture)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_TEXTURE_MAG_FILTER:
-                *params = texture-&gt;getMagFilter();
-                break;
-              case GL_TEXTURE_MIN_FILTER:
-                *params = texture-&gt;getMinFilter();
-                break;
-              case GL_TEXTURE_WRAP_S:
-                *params = texture-&gt;getWrapS();
-                break;
-              case GL_TEXTURE_WRAP_T:
-                *params = texture-&gt;getWrapT();
-                break;
-              case GL_TEXTURE_WRAP_R:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getWrapR();
-                break;
-              case GL_TEXTURE_IMMUTABLE_FORMAT:
-                // Exposed to ES2.0 through EXT_texture_storage, no client version validation.
-                *params = texture-&gt;isImmutable() ? GL_TRUE : GL_FALSE;
-                break;
-              case GL_TEXTURE_IMMUTABLE_LEVELS:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;immutableLevelCount();
-                break;
-              case GL_TEXTURE_USAGE_ANGLE:
-                *params = texture-&gt;getUsage();
-                break;
-              case GL_TEXTURE_MAX_ANISOTROPY_EXT:
-                if (!context-&gt;supportsTextureFilterAnisotropy())
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLint)texture-&gt;getMaxAnisotropy();
-                break;
-              case GL_TEXTURE_SWIZZLE_R:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getSwizzleRed();
-                break;
-              case GL_TEXTURE_SWIZZLE_G:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getSwizzleGreen();
-                break;
-              case GL_TEXTURE_SWIZZLE_B:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getSwizzleBlue();
-                break;
-              case GL_TEXTURE_SWIZZLE_A:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getSwizzleAlpha();
-                break;
-              case GL_TEXTURE_BASE_LEVEL:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getBaseLevel();
-                break;
-              case GL_TEXTURE_MAX_LEVEL:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = texture-&gt;getMaxLevel();
-                break;
-              case GL_TEXTURE_MIN_LOD:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLint)texture-&gt;getMinLod();
-                break;
-              case GL_TEXTURE_MAX_LOD:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                *params = (GLint)texture-&gt;getMaxLod();
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsTexture(texture);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
</del><ins>+void GL_APIENTRY glLineWidth(GLfloat width)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)&quot;,
-          program, location, bufSize, params);
-
-    try
-    {
-        if (bufSize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject || !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;getUniformfv(location, &amp;bufSize, params))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::LineWidth(width);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params)
</del><ins>+void GL_APIENTRY glLinkProgram(GLuint program)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)&quot;, program, location, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject || !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;getUniformfv(location, NULL, params))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::LinkProgram(program);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params)
</del><ins>+void GL_APIENTRY glPixelStorei(GLenum pname, GLint param)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)&quot;, 
-          program, location, bufSize, params);
-
-    try
-    {
-        if (bufSize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject || !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;getUniformiv(location, &amp;bufSize, params))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::PixelStorei(pname, param);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params)
</del><ins>+void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)&quot;, program, location, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (program == 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject || !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;getUniformiv(location, NULL, params))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::PolygonOffset(factor, units);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int __stdcall glGetUniformLocation(GLuint program, const GLchar* name)
</del><ins>+void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d, const GLchar* name = 0x%0.8p)&quot;, program, name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (strstr(name, &quot;gl_&quot;) == name)
-        {
-            return -1;
-        }
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION, -1);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE, -1);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programObject-&gt;isLinked() || !programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION, -1);
-            }
-
-            return programBinary-&gt;getUniformLocation(name);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, -1);
-    }
-
-    return -1;
</del><ins>+    return gl::ReadPixels(x, y, width, height, format, type, pixels);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
</del><ins>+void GL_APIENTRY glReleaseShaderCompiler(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, index, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            const gl::VertexAttribute &amp;attribState = context-&gt;getVertexAttribState(index);
-
-            if (!gl::ValidateGetVertexAttribParameters(pname, context-&gt;getClientVersion()))
-            {
-                return;
-            }
-
-            if (pname == GL_CURRENT_VERTEX_ATTRIB)
-            {
-                const gl::VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getVertexAttribCurrentValue(index);
-                for (int i = 0; i &lt; 4; ++i)
-                {
-                    params[i] = currentValueData.FloatValues[i];
-                }
-            }
-            else
-            {
-                *params = attribState.querySingleParameter&lt;GLfloat&gt;(pname);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ReleaseShaderCompiler();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, index, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            const gl::VertexAttribute &amp;attribState = context-&gt;getVertexAttribState(index);
-
-            if (!gl::ValidateGetVertexAttribParameters(pname, context-&gt;getClientVersion()))
-            {
-                return;
-            }
-
-            if (pname == GL_CURRENT_VERTEX_ATTRIB)
-            {
-                const gl::VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getVertexAttribCurrentValue(index);
-                for (int i = 0; i &lt; 4; ++i)
-                {
-                    float currentValue = currentValueData.FloatValues[i];
-                    params[i] = gl::iround&lt;GLint&gt;(currentValue);
-                }
-            }
-            else
-            {
-                *params = attribState.querySingleParameter&lt;GLint&gt;(pname);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::RenderbufferStorage(target, internalformat, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
</del><ins>+void GL_APIENTRY glSampleCoverage(GLfloat value, GLboolean invert)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)&quot;, index, pname, pointer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            *pointer = const_cast&lt;GLvoid*&gt;(context-&gt;getVertexAttribPointer(index));
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::SampleCoverage(value, invert);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glHint(GLenum target, GLenum mode)
</del><ins>+void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum mode = 0x%X)&quot;, target, mode);
-
-    try
-    {
-        switch (mode)
-        {
-          case GL_FASTEST:
-          case GL_NICEST:
-          case GL_DONT_CARE:
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM); 
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-        switch (target)
-        {
-          case GL_GENERATE_MIPMAP_HINT:
-            if (context) context-&gt;setGenerateMipmapHint(mode);
-            break;
-          case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
-            if (context) context-&gt;setFragmentShaderDerivativeHint(mode);
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Scissor(x, y, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsBuffer(GLuint buffer)
</del><ins>+void GL_APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint buffer = %d)&quot;, buffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context &amp;&amp; buffer)
-        {
-            gl::Buffer *bufferObject = context-&gt;getBuffer(buffer);
-
-            if (bufferObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::ShaderBinary(n, shaders, binaryformat, binary, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsEnabled(GLenum cap)
</del><ins>+void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum cap = 0x%X)&quot;, cap);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidCap(context, cap))
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-
-            return context-&gt;getCap(cap);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, false);
-    }
-
-    return false;
</del><ins>+    return gl::ShaderSource(shader, count, string, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsFenceNV(GLuint fence)
</del><ins>+void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint fence = %d)&quot;, fence);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::FenceNV *fenceObject = context-&gt;getFenceNV(fence);
-
-            if (fenceObject == NULL)
-            {
-                return GL_FALSE;
-            }
-
-            return fenceObject-&gt;isFence();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::StencilFunc(func, ref, mask);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsFramebuffer(GLuint framebuffer)
</del><ins>+void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint framebuffer = %d)&quot;, framebuffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context &amp;&amp; framebuffer)
-        {
-            gl::Framebuffer *framebufferObject = context-&gt;getFramebuffer(framebuffer);
-
-            if (framebufferObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::StencilFuncSeparate(face, func, ref, mask);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsProgram(GLuint program)
</del><ins>+void GL_APIENTRY glStencilMask(GLuint mask)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d)&quot;, program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context &amp;&amp; program)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (programObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::StencilMask(mask);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsQueryEXT(GLuint id)
</del><ins>+void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint id = %d)&quot;, id);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            return (context-&gt;getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::StencilMaskSeparate(face, mask);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer)
</del><ins>+void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint renderbuffer = %d)&quot;, renderbuffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context &amp;&amp; renderbuffer)
-        {
-            gl::Renderbuffer *renderbufferObject = context-&gt;getRenderbuffer(renderbuffer);
-
-            if (renderbufferObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::StencilOp(fail, zfail, zpass);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsShader(GLuint shader)
</del><ins>+void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d)&quot;, shader);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context &amp;&amp; shader)
-        {
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (shaderObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::StencilOpSeparate(face, fail, zfail, zpass);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsTexture(GLuint texture)
</del><ins>+void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint texture = %d)&quot;, texture);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context &amp;&amp; texture)
-        {
-            gl::Texture *textureObject = context-&gt;getTexture(texture);
-
-            if (textureObject)
-            {
-                return GL_TRUE;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glLineWidth(GLfloat width)
</del><ins>+void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLfloat width = %f)&quot;, width);
-
-    try
-    {
-        if (width &lt;= 0.0f)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setLineWidth(width);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexParameterf(target, pname, param);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glLinkProgram(GLuint program)
</del><ins>+void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d)&quot;, program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            context-&gt;linkProgram(program);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexParameterfv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glPixelStorei(GLenum pname, GLint param)
</del><ins>+void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum pname = 0x%X, GLint param = %d)&quot;, pname, param);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            switch (pname)
-            {
-              case GL_UNPACK_ALIGNMENT:
-                if (param != 1 &amp;&amp; param != 2 &amp;&amp; param != 4 &amp;&amp; param != 8)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-
-                context-&gt;setUnpackAlignment(param);
-                break;
-
-              case GL_PACK_ALIGNMENT:
-                if (param != 1 &amp;&amp; param != 2 &amp;&amp; param != 4 &amp;&amp; param != 8)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-
-                context-&gt;setPackAlignment(param);
-                break;
-
-              case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
-                context-&gt;setPackReverseRowOrder(param != 0);
-                break;
-
-              case GL_UNPACK_IMAGE_HEIGHT:
-              case GL_UNPACK_SKIP_IMAGES:
-              case GL_UNPACK_ROW_LENGTH:
-              case GL_UNPACK_SKIP_ROWS:
-              case GL_UNPACK_SKIP_PIXELS:
-              case GL_PACK_ROW_LENGTH:
-              case GL_PACK_SKIP_ROWS:
-              case GL_PACK_SKIP_PIXELS:
-                if (context-&gt;getClientVersion() &lt; 3)
-                {
-                    return gl::error(GL_INVALID_ENUM);
-                }
-                UNIMPLEMENTED();
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexParameteri(target, pname, param);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glPolygonOffset(GLfloat factor, GLfloat units)
</del><ins>+void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLfloat factor = %f, GLfloat units = %f)&quot;, factor, units);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setPolygonOffsetParams(factor, units);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexParameteriv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
-                                GLenum format, GLenum type, GLsizei bufSize,
-                                GLvoid *data)
</del><ins>+void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, &quot;
-          &quot;GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)&quot;,
-          x, y, width, height, format, type, bufSize, data);
-
-    try
-    {
-        if (width &lt; 0 || height &lt; 0 || bufSize &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
-                                                  format, type, &amp;bufSize, data))
-            {
-                return;
-            }
-
-            context-&gt;readPixels(x, y, width, height, format, type, &amp;bufSize, data);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
-                            GLenum format, GLenum type, GLvoid* pixels)
</del><ins>+void GL_APIENTRY glUniform1f(GLint location, GLfloat x)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, &quot;
-          &quot;GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = 0x%0.8p)&quot;,
-          x, y, width, height, format, type,  pixels);
-
-    try
-    {
-        if (width &lt; 0 || height &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidateReadPixelsParameters(context, x, y, width, height,
-                                                  format, type, NULL, pixels))
-            {
-                return;
-            }
-
-            context-&gt;readPixels(x, y, width, height, format, type, NULL, pixels);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform1f(location, x);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glReleaseShaderCompiler(void)
</del><ins>+void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;()&quot;);
-
-    try
-    {
-        gl::Shader::releaseCompiler();
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform1fv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glUniform1i(GLint location, GLint x)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
-          target, samples, internalformat, width, height);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
-                                                       width, height, true))
-            {
-                return;
-            }
-
-            context-&gt;setRenderbufferStorage(width, height, internalformat, samples);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform1i(location, x);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v)
</ins><span class="cx"> {
</span><del>-    glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height);
</del><ins>+    return gl::Uniform1iv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glSampleCoverage(GLclampf value, GLboolean invert)
</del><ins>+void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLclampf value = %f, GLboolean invert = %u)&quot;, value, invert);
-
-    try
-    {
-        gl::Context* context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform2f(location, x, y);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glSetFenceNV(GLuint fence, GLenum condition)
</del><ins>+void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint fence = %d, GLenum condition = 0x%X)&quot;, fence, condition);
-
-    try
-    {
-        if (condition != GL_ALL_COMPLETED_NV)
-        {
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::FenceNV *fenceObject = context-&gt;getFenceNV(fence);
-
-            if (fenceObject == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            fenceObject-&gt;setFence(condition);    
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform2fv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;, x, y, width, height);
-
-    try
-    {
-        if (width &lt; 0 || height &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context* context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setScissorParams(x, y, width, height);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform2i(location, x, y);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
</del><ins>+void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* shaders = 0x%0.8p, GLenum binaryformat = 0x%X, &quot;
-          &quot;const GLvoid* binary = 0x%0.8p, GLsizei length = %d)&quot;,
-          n, shaders, binaryformat, binary, length);
-
-    try
-    {
-        // No binary shader formats are supported.
-        return gl::error(GL_INVALID_ENUM);
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform2iv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length)
</del><ins>+void GL_APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)&quot;,
-          shader, count, string, length);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Shader *shaderObject = context-&gt;getShader(shader);
-
-            if (!shaderObject)
-            {
-                if (context-&gt;getProgram(shader))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            shaderObject-&gt;setSource(count, string, length);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform3f(location, x, y, z);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glStencilFunc(GLenum func, GLint ref, GLuint mask)
</del><ins>+void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
</ins><span class="cx"> {
</span><del>-    glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask);
</del><ins>+    return gl::Uniform3fv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
</del><ins>+void GL_APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)&quot;, face, func, ref, mask);
-
-    try
-    {
-        switch (face)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            break;
-          default:
-            return gl::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 gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
-            {
-                context-&gt;setStencilParams(func, ref, mask);
-            }
-
-            if (face == GL_BACK || face == GL_FRONT_AND_BACK)
-            {
-                context-&gt;setStencilBackParams(func, ref, mask);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform3i(location, x, y, z);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glStencilMask(GLuint mask)
</del><ins>+void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v)
</ins><span class="cx"> {
</span><del>-    glStencilMaskSeparate(GL_FRONT_AND_BACK, mask);
</del><ins>+    return gl::Uniform3iv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glStencilMaskSeparate(GLenum face, GLuint mask)
</del><ins>+void GL_APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum face = 0x%X, GLuint mask = %d)&quot;, face, mask);
-
-    try
-    {
-        switch (face)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
-            {
-                context-&gt;setStencilWritemask(mask);
-            }
-
-            if (face == GL_BACK || face == GL_FRONT_AND_BACK)
-            {
-                context-&gt;setStencilBackWritemask(mask);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform4f(location, x, y, z, w);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
</del><ins>+void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
</ins><span class="cx"> {
</span><del>-    glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass);
</del><ins>+    return gl::Uniform4fv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
</del><ins>+void GL_APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)&quot;,
-          face, fail, zfail, zpass);
-
-    try
-    {
-        switch (face)
-        {
-          case GL_FRONT:
-          case GL_BACK:
-          case GL_FRONT_AND_BACK:
-            break;
-          default:
-            return gl::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 gl::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 gl::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 gl::error(GL_INVALID_ENUM);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (face == GL_FRONT || face == GL_FRONT_AND_BACK)
-            {
-                context-&gt;setStencilOperations(fail, zfail, zpass);
-            }
-
-            if (face == GL_BACK || face == GL_FRONT_AND_BACK)
-            {
-                context-&gt;setStencilBackOperations(fail, zfail, zpass);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform4i(location, x, y, z, w);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glTestFenceNV(GLuint fence)
</del><ins>+void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint fence = %d)&quot;, fence);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::FenceNV *fenceObject = context-&gt;getFenceNV(fence);
-
-            if (fenceObject == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_TRUE);
-            }
-
-            if (fenceObject-&gt;isFence() != GL_TRUE)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_TRUE);
-            }
-
-            return fenceObject-&gt;testFence();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        gl::error(GL_OUT_OF_MEMORY);
-    }
-    
-    return GL_TRUE;
</del><ins>+    return gl::Uniform4iv(location, count, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
-                            GLint border, GLenum format, GLenum type, const GLvoid* pixels)
</del><ins>+void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, &quot;
-          &quot;GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)&quot;,
-          target, level, internalformat, width, height, border, format, type, pixels);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2TexImageParameters(context, target, level, internalformat, false, false,
-                                               0, 0, width, height, border, format, type, pixels))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
-                                               0, 0, 0, width, height, 1, border, format, type, pixels))
-            {
-                return;
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture = context-&gt;getTexture2D();
-                    texture-&gt;setImage(level, width, height, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;setImagePosX(level, width, height, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;setImageNegX(level, width, height, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;setImagePosY(level, width, height, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;setImageNegY(level, width, height, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;setImagePosZ(level, width, height, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-              case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;setImageNegZ(level, width, height, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-              default: UNREACHABLE();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix2fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param)
</del><ins>+void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)&quot;, target, pname, param);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidateTexParamParameters(context, pname, static_cast&lt;GLint&gt;(param)))
-            {
-                return;
-            }
-
-            gl::Texture *texture = context-&gt;getTargetTexture(target);
-
-            if (!texture)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_TEXTURE_WRAP_S:               texture-&gt;setWrapS(gl::uiround&lt;GLenum&gt;(param));       break;
-              case GL_TEXTURE_WRAP_T:               texture-&gt;setWrapT(gl::uiround&lt;GLenum&gt;(param));       break;
-              case GL_TEXTURE_WRAP_R:               texture-&gt;setWrapR(gl::uiround&lt;GLenum&gt;(param));       break;
-              case GL_TEXTURE_MIN_FILTER:           texture-&gt;setMinFilter(gl::uiround&lt;GLenum&gt;(param));   break;
-              case GL_TEXTURE_MAG_FILTER:           texture-&gt;setMagFilter(gl::uiround&lt;GLenum&gt;(param));   break;
-              case GL_TEXTURE_USAGE_ANGLE:          texture-&gt;setUsage(gl::uiround&lt;GLenum&gt;(param));       break;
-              case GL_TEXTURE_MAX_ANISOTROPY_EXT:   texture-&gt;setMaxAnisotropy(param, context-&gt;getTextureMaxAnisotropy()); break;
-              case GL_TEXTURE_COMPARE_MODE:         texture-&gt;setCompareMode(gl::uiround&lt;GLenum&gt;(param)); break;
-              case GL_TEXTURE_COMPARE_FUNC:         texture-&gt;setCompareFunc(gl::uiround&lt;GLenum&gt;(param)); break;
-              case GL_TEXTURE_SWIZZLE_R:            texture-&gt;setSwizzleRed(gl::uiround&lt;GLenum&gt;(param));   break;
-              case GL_TEXTURE_SWIZZLE_G:            texture-&gt;setSwizzleGreen(gl::uiround&lt;GLenum&gt;(param)); break;
-              case GL_TEXTURE_SWIZZLE_B:            texture-&gt;setSwizzleBlue(gl::uiround&lt;GLenum&gt;(param));  break;
-              case GL_TEXTURE_SWIZZLE_A:            texture-&gt;setSwizzleAlpha(gl::uiround&lt;GLenum&gt;(param)); break;
-              case GL_TEXTURE_BASE_LEVEL:           texture-&gt;setBaseLevel(gl::iround&lt;GLint&gt;(param));      break;
-              case GL_TEXTURE_MAX_LEVEL:            texture-&gt;setMaxLevel(gl::iround&lt;GLint&gt;(param));       break;
-              case GL_TEXTURE_MIN_LOD:              texture-&gt;setMinLod(param);                            break;
-              case GL_TEXTURE_MAX_LOD:              texture-&gt;setMaxLod(param);                            break;
-              default: UNREACHABLE(); break;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix3fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
</del><ins>+void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    glTexParameterf(target, pname, (GLfloat)*params);
</del><ins>+    return gl::UniformMatrix4fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param)
</del><ins>+void GL_APIENTRY glUseProgram(GLuint program)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)&quot;, target, pname, param);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidateTexParamParameters(context, pname, param))
-            {
-                return;
-            }
-
-            gl::Texture *texture = context-&gt;getTargetTexture(target);
-
-            if (!texture)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_TEXTURE_WRAP_S:               texture-&gt;setWrapS((GLenum)param);       break;
-              case GL_TEXTURE_WRAP_T:               texture-&gt;setWrapT((GLenum)param);       break;
-              case GL_TEXTURE_WRAP_R:               texture-&gt;setWrapR((GLenum)param);       break;
-              case GL_TEXTURE_MIN_FILTER:           texture-&gt;setMinFilter((GLenum)param);   break;
-              case GL_TEXTURE_MAG_FILTER:           texture-&gt;setMagFilter((GLenum)param);   break;
-              case GL_TEXTURE_USAGE_ANGLE:          texture-&gt;setUsage((GLenum)param);       break;
-              case GL_TEXTURE_MAX_ANISOTROPY_EXT:   texture-&gt;setMaxAnisotropy((float)param, context-&gt;getTextureMaxAnisotropy()); break;
-              case GL_TEXTURE_COMPARE_MODE:         texture-&gt;setCompareMode((GLenum)param); break;
-              case GL_TEXTURE_COMPARE_FUNC:         texture-&gt;setCompareFunc((GLenum)param); break;
-              case GL_TEXTURE_SWIZZLE_R:            texture-&gt;setSwizzleRed((GLenum)param);   break;
-              case GL_TEXTURE_SWIZZLE_G:            texture-&gt;setSwizzleGreen((GLenum)param); break;
-              case GL_TEXTURE_SWIZZLE_B:            texture-&gt;setSwizzleBlue((GLenum)param);  break;
-              case GL_TEXTURE_SWIZZLE_A:            texture-&gt;setSwizzleAlpha((GLenum)param); break;
-              case GL_TEXTURE_BASE_LEVEL:           texture-&gt;setBaseLevel(param);            break;
-              case GL_TEXTURE_MAX_LEVEL:            texture-&gt;setMaxLevel(param);             break;
-              case GL_TEXTURE_MIN_LOD:              texture-&gt;setMinLod((GLfloat)param);      break;
-              case GL_TEXTURE_MAX_LOD:              texture-&gt;setMaxLod((GLfloat)param);      break;
-              default: UNREACHABLE(); break;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UseProgram(program);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
</del><ins>+void GL_APIENTRY glValidateProgram(GLuint program)
</ins><span class="cx"> {
</span><del>-    glTexParameteri(target, pname, *params);
</del><ins>+    return gl::ValidateProgram(program);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
-           target, levels, internalformat, width, height);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
-            {
-                return;
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture2d = context-&gt;getTexture2D();
-                    texture2d-&gt;storage(levels, internalformat, width, height);
-                }
-                break;
-
-              case GL_TEXTURE_CUBE_MAP:
-                {
-                    gl::TextureCubeMap *textureCube = context-&gt;getTextureCubeMap();
-                    textureCube-&gt;storage(levels, internalformat, width);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttrib1f(indx, x);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                               GLenum format, GLenum type, const GLvoid* pixels)
</del><ins>+void GL_APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
-          &quot;GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, &quot;
-          &quot;const GLvoid* pixels = 0x%0.8p)&quot;,
-           target, level, xoffset, yoffset, width, height, format, type, pixels);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3 &amp;&amp;
-                !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true,
-                                               xoffset, yoffset, width, height, 0, format, type, pixels))
-            {
-                return;
-            }
-
-            if (context-&gt;getClientVersion() &gt;= 3 &amp;&amp;
-                !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
-                                               xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels))
-            {
-                return;
-            }
-
-            // Zero sized uploads are valid but no-ops
-            if (width == 0 || height == 0)
-            {
-                return;
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture = context-&gt;getTexture2D();
-                    texture-&gt;subImage(level, xoffset, yoffset, width, height, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                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:
-                {
-                    gl::TextureCubeMap *texture = context-&gt;getTextureCubeMap();
-                    texture-&gt;subImage(target, level, xoffset, yoffset, width, height, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-
-              default:
-                UNREACHABLE();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttrib1fv(indx, values);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform1f(GLint location, GLfloat x)
</del><ins>+void GL_APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
</ins><span class="cx"> {
</span><del>-    glUniform1fv(location, 1, &amp;x);
</del><ins>+    return gl::VertexAttrib2f(indx, x, y);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
</del><ins>+void GL_APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform1fv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttrib2fv(indx, values);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform1i(GLint location, GLint x)
</del><ins>+void GL_APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
</ins><span class="cx"> {
</span><del>-    glUniform1iv(location, 1, &amp;x);
</del><ins>+    return gl::VertexAttrib3f(indx, x, y, z);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform1iv(GLint location, GLsizei count, const GLint* v)
</del><ins>+void GL_APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform1iv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttrib3fv(indx, values);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform2f(GLint location, GLfloat x, GLfloat y)
</del><ins>+void GL_APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
</ins><span class="cx"> {
</span><del>-    GLfloat xy[2] = {x, y};
-
-    glUniform2fv(location, 1, xy);
</del><ins>+    return gl::VertexAttrib4f(indx, x, y, z, w);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
</del><ins>+void GL_APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-        
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform2fv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttrib4fv(indx, values);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform2i(GLint location, GLint x, GLint y)
</del><ins>+void GL_APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
</ins><span class="cx"> {
</span><del>-    GLint xy[2] = {x, y};
-
-    glUniform2iv(location, 1, xy);
</del><ins>+    return gl::VertexAttribPointer(indx, size, type, normalized, stride, ptr);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v)
</del><ins>+void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform2iv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Viewport(x, y, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
</del><ins>+void GL_APIENTRY glReadBuffer(GLenum mode)
</ins><span class="cx"> {
</span><del>-    GLfloat xyz[3] = {x, y, z};
-
-    glUniform3fv(location, 1, xyz);
</del><ins>+    return gl::ReadBuffer(mode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
</del><ins>+void GL_APIENTRY glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform3fv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawRangeElements(mode, start, end, count, type, indices);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform3i(GLint location, GLint x, GLint y, GLint z)
</del><ins>+void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
</ins><span class="cx"> {
</span><del>-    GLint xyz[3] = {x, y, z};
-
-    glUniform3iv(location, 1, xyz);
</del><ins>+    return gl::TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v)
</del><ins>+void GL_APIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform3iv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
</del><ins>+void GL_APIENTRY glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    GLfloat xyzw[4] = {x, y, z, w};
-
-    glUniform4fv(location, 1, xyzw);
</del><ins>+    return gl::CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
</del><ins>+void GL_APIENTRY glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform4fv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
</del><ins>+void GL_APIENTRY glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
</ins><span class="cx"> {
</span><del>-    GLint xyzw[4] = {x, y, z, w};
-
-    glUniform4iv(location, 1, xyzw);
</del><ins>+    return gl::CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v)
</del><ins>+void GL_APIENTRY glGenQueries(GLsizei n, GLuint* ids)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)&quot;, location, count, v);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform4iv(location, count, v))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenQueries(n, ids);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glDeleteQueries(GLsizei n, const GLuint* ids)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (transpose != GL_FALSE &amp;&amp; context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix2fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteQueries(n, ids);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+GLboolean GL_APIENTRY glIsQuery(GLuint id)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (transpose != GL_FALSE &amp;&amp; context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix3fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsQuery(id);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glBeginQuery(GLenum target, GLuint id)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (transpose != GL_FALSE &amp;&amp; context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix4fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BeginQuery(target, id);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUseProgram(GLuint program)
</del><ins>+void GL_APIENTRY glEndQuery(GLenum target)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d)&quot;, program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject &amp;&amp; program != 0)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            if (program != 0 &amp;&amp; !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;useProgram(program);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::EndQuery(target);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glValidateProgram(GLuint program)
</del><ins>+void GL_APIENTRY glGetQueryiv(GLenum target, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %d)&quot;, program);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            programObject-&gt;validate();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetQueryiv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib1f(GLuint index, GLfloat x)
</del><ins>+void GL_APIENTRY glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLfloat x = %f)&quot;, index, x);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, 0, 0, 1 };
-            context-&gt;setVertexAttribf(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetQueryObjectuiv(id, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib1fv(GLuint index, const GLfloat* values)
</del><ins>+GLboolean GL_APIENTRY glUnmapBuffer(GLenum target)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { values[0], 0, 0, 1 };
-            context-&gt;setVertexAttribf(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UnmapBuffer(target);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
</del><ins>+void GL_APIENTRY glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)&quot;, index, x, y);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, y, 0, 1 };
-            context-&gt;setVertexAttribf(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetBufferPointerv(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib2fv(GLuint index, const GLfloat* values)
</del><ins>+void GL_APIENTRY glDrawBuffers(GLsizei n, const GLenum* bufs)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { values[0], values[1], 0, 1 };
-            context-&gt;setVertexAttribf(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawBuffers(n, bufs);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
</del><ins>+void GL_APIENTRY glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)&quot;, index, x, y, z);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, y, z, 1 };
-            context-&gt;setVertexAttribf(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix2x3fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib3fv(GLuint index, const GLfloat* values)
</del><ins>+void GL_APIENTRY glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { values[0], values[1], values[2], 1 };
-            context-&gt;setVertexAttribf(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix3x2fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
</del><ins>+void GL_APIENTRY glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)&quot;, index, x, y, z, w);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            GLfloat vals[4] = { x, y, z, w };
-            context-&gt;setVertexAttribf(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix2x4fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttrib4fv(GLuint index, const GLfloat* values)
</del><ins>+void GL_APIENTRY glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, const GLfloat* values = 0x%0.8p)&quot;, index, values);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setVertexAttribf(index, values);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix4x2fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
</del><ins>+void GL_APIENTRY glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLuint divisor = %d)&quot;, index, divisor);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setVertexAttribDivisor(index, divisor);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix3x4fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
</del><ins>+void GL_APIENTRY glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, &quot;
-          &quot;GLboolean normalized = %u, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)&quot;,
-          index, size, type, normalized, stride, ptr);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (size &lt; 1 || size &gt; 4)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        switch (type)
-        {
-          case GL_BYTE:
-          case GL_UNSIGNED_BYTE:
-          case GL_SHORT:
-          case GL_UNSIGNED_SHORT:
-          case GL_FIXED:
-          case GL_FLOAT:
-            break;
-          case GL_HALF_FLOAT:
-          case GL_INT:
-          case GL_UNSIGNED_INT:
-          case GL_INT_2_10_10_10_REV:
-          case GL_UNSIGNED_INT_2_10_10_10_REV:
-            if (context &amp;&amp; context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-            else
-            {
-                break;
-            }
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        if (stride &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) &amp;&amp; size != 4)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        if (context)
-        {
-            // [OpenGL ES 3.0.2] Section 2.8 page 24:
-            // An INVALID_OPERATION error is generated when a non-zero vertex array object
-            // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
-            // and the pointer argument is not NULL.
-            if (context-&gt;getVertexArrayHandle() != 0 &amp;&amp; context-&gt;getArrayBufferHandle() == 0 &amp;&amp; ptr != NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;setVertexAttribState(index, context-&gt;getArrayBuffer(), size, type,
-                                          normalized == GL_TRUE, false, stride, ptr);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformMatrix4x3fv(location, count, transpose, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;, x, y, width, height);
-
-    try
-    {
-        if (width &lt; 0 || height &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            context-&gt;setViewportParams(x, y, width, height);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// OpenGL ES 3.0 functions
-
-void __stdcall glReadBuffer(GLenum mode)
</del><ins>+void GL_APIENTRY glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X)&quot;, mode);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // glReadBuffer
-            UNIMPLEMENTED();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
</del><ins>+void GL_APIENTRY glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, &quot;
-          &quot;const GLvoid* indices = 0x%0.8p)&quot;, mode, start, end, count, type, indices);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // glDrawRangeElements
-            UNIMPLEMENTED();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::FramebufferTextureLayer(target, attachment, texture, level, layer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
</del><ins>+GLvoid* GL_APIENTRY glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, &quot;
-          &quot;GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, &quot;
-          &quot;GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)&quot;,
-          target, level, internalformat, width, height, depth, border, format, type, pixels);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // validateES3TexImageFormat sets the error code if there is an error
-            if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
-                                               0, 0, 0, width, height, depth, border, format, type, pixels))
-            {
-                return;
-            }
-
-            switch(target)
-            {
-              case GL_TEXTURE_3D:
-                {
-                    gl::Texture3D *texture = context-&gt;getTexture3D();
-                    texture-&gt;setImage(level, width, height, depth, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-
-              case GL_TEXTURE_2D_ARRAY:
-                {
-                    gl::Texture2DArray *texture = context-&gt;getTexture2DArray();
-                    texture-&gt;setImage(level, width, height, depth, internalformat, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::MapBufferRange(target, offset, length, access);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
</del><ins>+void GL_APIENTRY glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
-          &quot;GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, &quot;
-          &quot;GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)&quot;,
-          target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // validateES3TexImageFormat sets the error code if there is an error
-            if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
-                                               xoffset, yoffset, zoffset, width, height, depth, 0,
-                                               format, type, pixels))
-            {
-                return;
-            }
-
-            // Zero sized uploads are valid but no-ops
-            if (width == 0 || height == 0 || depth == 0)
-            {
-                return;
-            }
-
-            switch(target)
-            {
-              case GL_TEXTURE_3D:
-                {
-                    gl::Texture3D *texture = context-&gt;getTexture3D();
-                    texture-&gt;subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-
-              case GL_TEXTURE_2D_ARRAY:
-                {
-                    gl::Texture2DArray *texture = context-&gt;getTexture2DArray();
-                    texture-&gt;subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context-&gt;getUnpackState(), pixels);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::FlushMappedBufferRange(target, offset, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glBindVertexArray(GLuint array)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
-          &quot;GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;,
-          target, level, xoffset, yoffset, zoffset, x, y, width, height);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, false, xoffset, yoffset, zoffset,
-                                                   x, y, width, height, 0))
-            {
-                return;
-            }
-
-            // Zero sized copies are valid but no-ops
-            if (width == 0 || height == 0)
-            {
-                return;
-            }
-
-            gl::Framebuffer *framebuffer = context-&gt;getReadFramebuffer();
-            gl::Texture *texture = NULL;
-            switch (target)
-            {
-              case GL_TEXTURE_3D:
-                texture = context-&gt;getTexture3D();
-                break;
-
-              case GL_TEXTURE_2D_ARRAY:
-                texture = context-&gt;getTexture2DArray();
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            texture-&gt;copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindVertexArray(array);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
</del><ins>+void GL_APIENTRY glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, &quot;
-          &quot;GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, &quot;
-          &quot;const GLvoid* data = 0x%0.8p)&quot;,
-          target, level, internalformat, width, height, depth, border, imageSize, data);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (imageSize &lt; 0 || imageSize != (GLsizei)gl::GetBlockSize(internalformat, GL_UNSIGNED_BYTE, context-&gt;getClientVersion(), width, height))
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            // validateES3TexImageFormat sets the error code if there is an error
-            if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
-                                               0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data))
-            {
-                return;
-            }
-
-            switch(target)
-            {
-              case GL_TEXTURE_3D:
-                {
-                    gl::Texture3D *texture = context-&gt;getTexture3D();
-                    texture-&gt;setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
-                }
-                break;
-
-              case GL_TEXTURE_2D_ARRAY:
-                {
-                    gl::Texture2DArray *texture = context-&gt;getTexture2DArray();
-                    texture-&gt;setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteVertexArrays(n, arrays);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
</del><ins>+void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint* arrays)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, &quot;
-        &quot;GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, &quot;
-        &quot;GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)&quot;,
-        target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (imageSize &lt; 0 || imageSize != (GLsizei)gl::GetBlockSize(format, GL_UNSIGNED_BYTE, context-&gt;getClientVersion(), width, height))
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (!data)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            // validateES3TexImageFormat sets the error code if there is an error
-            if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
-                                               0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data))
-            {
-                return;
-            }
-
-            // Zero sized uploads are valid but no-ops
-            if (width == 0 || height == 0)
-            {
-                return;
-            }
-
-            switch(target)
-            {
-              case GL_TEXTURE_3D:
-                {
-                    gl::Texture3D *texture = context-&gt;getTexture3D();
-                    texture-&gt;subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
-                                                format, imageSize, data);
-                }
-                break;
-
-              case GL_TEXTURE_2D_ARRAY:
-                {
-                    gl::Texture2DArray *texture = context-&gt;getTexture2DArray();
-                    texture-&gt;subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth,
-                                                format, imageSize, data);
-                }
-                break;
-
-            default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenVertexArrays(n, arrays);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenQueries(GLsizei n, GLuint* ids)
</del><ins>+GLboolean GL_APIENTRY glIsVertexArray(GLuint array)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (n &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (GLsizei i = 0; i &lt; n; i++)
-            {
-                ids[i] = context-&gt;createQuery();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsVertexArray(array);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteQueries(GLsizei n, const GLuint* ids)
</del><ins>+void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (n &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (GLsizei i = 0; i &lt; n; i++)
-            {
-                context-&gt;deleteQuery(ids[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetIntegeri_v(target, index, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsQuery(GLuint id)
</del><ins>+void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint id = %u)&quot;, id);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_FALSE);
-            }
-
-            return (context-&gt;getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE;
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::BeginTransformFeedback(primitiveMode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBeginQuery(GLenum target, GLuint id)
</del><ins>+void GL_APIENTRY glEndTransformFeedback(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint id = %u)&quot;, target, id);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidQueryType(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (id == 0)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;beginQuery(target, id);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::EndTransformFeedback();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glEndQuery(GLenum target)
</del><ins>+void GL_APIENTRY glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidQueryType(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;endQuery(target);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindBufferRange(target, index, buffer, offset, size);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetQueryiv(GLenum target, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidQueryType(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (pname)
-            {
-              case GL_CURRENT_QUERY:
-                params[0] = context-&gt;getActiveQuery(target);
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindBufferBase(target, index, buffer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
</del><ins>+void GL_APIENTRY glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, id, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::Query *queryObject = context-&gt;getQuery(id, false, GL_NONE);
-
-            if (!queryObject)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (context-&gt;getActiveQuery(queryObject-&gt;getType()) == id)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch(pname)
-            {
-              case GL_QUERY_RESULT:
-                params[0] = queryObject-&gt;getResult();
-                break;
-              case GL_QUERY_RESULT_AVAILABLE:
-                params[0] = queryObject-&gt;isResultAvailable();
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TransformFeedbackVaryings(program, count, varyings, bufferMode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glUnmapBuffer(GLenum target)
</del><ins>+void GL_APIENTRY glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_FALSE);
-            }
-
-            return glUnmapBufferOES(target);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
</del><ins>+void GL_APIENTRY glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            glGetBufferPointervOES(target, pname, params);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttribIPointer(index, size, type, stride, pointer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawBuffers(GLsizei n, const GLenum* bufs)
</del><ins>+void GL_APIENTRY glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            glDrawBuffersEXT(n, bufs);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetVertexAttribIiv(index, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix2x3fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetVertexAttribIuiv(index, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix3x2fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttribI4i(index, x, y, z, w);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix2x4fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttribI4ui(index, x, y, z, w);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glVertexAttribI4iv(GLuint index, const GLint* v)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix4x2fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttribI4iv(index, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glVertexAttribI4uiv(GLuint index, const GLuint* v)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix3x4fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttribI4uiv(index, v);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
</del><ins>+void GL_APIENTRY glGetUniformuiv(GLuint program, GLint location, GLuint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)&quot;,
-          location, count, transpose, value);
-
-    try
-    {
-        if (count &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (location == -1)
-        {
-            return;
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniformMatrix4x3fv(location, count, transpose, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetUniformuiv(program, location, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
</del><ins>+GLint GL_APIENTRY glGetFragDataLocation(GLuint program, const GLchar *name)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, &quot;
-          &quot;GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)&quot;,
-          srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
-                                                   dstX0, dstY0, dstX1, dstY1, mask, filter,
-                                                   false))
-            {
-                return;
-            }
-
-            context-&gt;blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
-                                     mask, filter);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetFragDataLocation(program, name);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glUniform1ui(GLint location, GLuint v0)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
-        target, samples, internalformat, width, height);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat,
-                                                       width, height, false))
-            {
-                return;
-            }
-
-            context-&gt;setRenderbufferStorage(width, height, internalformat, samples);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform1ui(location, v0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
</del><ins>+void GL_APIENTRY glUniform2ui(GLint location, GLuint v0, GLuint v1)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)&quot;,
-        target, attachment, texture, level, layer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateES3FramebufferTextureParameters(context, target, attachment, GL_NONE, texture, level, layer, true))
-            {
-                return;
-            }
-
-            gl::Framebuffer *framebuffer = context-&gt;getTargetFramebuffer(target);
-            ASSERT(framebuffer);
-
-            gl::Texture *textureObject = context-&gt;getTexture(texture);
-            GLenum textarget = textureObject ? textureObject-&gt;getTarget() : GL_NONE;
-
-            if (attachment &gt;= GL_COLOR_ATTACHMENT0_EXT &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15_EXT)
-            {
-                const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-                framebuffer-&gt;setColorbuffer(colorAttachment, textarget, texture, level, layer);
-            }
-            else
-            {
-                switch (attachment)
-                {
-                case GL_DEPTH_ATTACHMENT:         framebuffer-&gt;setDepthbuffer(textarget, texture, level, layer);        break;
-                case GL_STENCIL_ATTACHMENT:       framebuffer-&gt;setStencilbuffer(textarget, texture, level, layer);      break;
-                case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer-&gt;setDepthStencilBuffer(textarget, texture, level, layer); break;
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform2ui(location, v0, v1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLvoid* __stdcall glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
</del><ins>+void GL_APIENTRY glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)&quot;,
-          target, offset, length, access);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            return glMapBufferRangeEXT(target, offset, length, access);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-    }
-
-    return NULL;
</del><ins>+    return gl::Uniform3ui(location, v0, v1, v2);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
</del><ins>+void GL_APIENTRY glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)&quot;, target, offset, length);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            glFlushMappedBufferRangeEXT(target, offset, length);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform4ui(location, v0, v1, v2, v3);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindVertexArray(GLuint array)
</del><ins>+void GL_APIENTRY glUniform1uiv(GLint location, GLsizei count, const GLuint* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint array = %u)&quot;, array);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::VertexArray *vao = context-&gt;getVertexArray(array);
-
-            if (!vao)
-            {
-                // The default VAO should always exist
-                ASSERT(array != 0);
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;bindVertexArray(array);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform1uiv(location, count, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
</del><ins>+void GL_APIENTRY glUniform2uiv(GLint location, GLsizei count, const GLuint* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)&quot;, n, arrays);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (n &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (int arrayIndex = 0; arrayIndex &lt; n; arrayIndex++)
-            {
-                if (arrays[arrayIndex] != 0)
-                {
-                    context-&gt;deleteVertexArray(arrays[arrayIndex]);
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform2uiv(location, count, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenVertexArrays(GLsizei n, GLuint* arrays)
</del><ins>+void GL_APIENTRY glUniform3uiv(GLint location, GLsizei count, const GLuint* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* arrays = 0x%0.8p)&quot;, n, arrays);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (n &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (int arrayIndex = 0; arrayIndex &lt; n; arrayIndex++)
-            {
-                arrays[arrayIndex] = context-&gt;createVertexArray();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::Uniform3uiv(location, count, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsVertexArray(GLuint array)
</del><ins>+void GL_APIENTRY glUniform4uiv(GLint location, GLsizei count, const GLuint* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint array = %u)&quot;, array);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_FALSE);
-            }
-
-            if (array == 0)
-            {
-                return GL_FALSE;
-            }
-
-            gl::VertexArray *vao = context-&gt;getVertexArray(array);
-
-            return (vao != NULL ? GL_TRUE : GL_FALSE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::Uniform4uiv(location, count, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
</del><ins>+void GL_APIENTRY glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)&quot;,
-          target, index, data);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (target)
-            {
-              case GL_TRANSFORM_FEEDBACK_BUFFER_START:
-              case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
-              case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
-                if (index &gt;= context-&gt;getMaxTransformFeedbackBufferBindings())
-                    return gl::error(GL_INVALID_VALUE);
-                break;
-              case GL_UNIFORM_BUFFER_START:
-              case GL_UNIFORM_BUFFER_SIZE:
-              case GL_UNIFORM_BUFFER_BINDING:
-                if (index &gt;= context-&gt;getMaximumCombinedUniformBufferBindings())
-                    return gl::error(GL_INVALID_VALUE);
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (!(context-&gt;getIndexedIntegerv(target, index, data)))
-            {
-                GLenum nativeType;
-                unsigned int numParams = 0;
-                if (!context-&gt;getIndexedQueryParameterInfo(target, &amp;nativeType, &amp;numParams))
-                    return gl::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_INT_64_ANGLEX)
-                {
-                    GLint64 minIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;int&gt;::min());
-                    GLint64 maxIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;int&gt;::max());
-                    GLint64 *int64Params = new GLint64[numParams];
-
-                    context-&gt;getIndexedInteger64v(target, index, int64Params);
-
-                    for (unsigned int i = 0; i &lt; numParams; ++i)
-                    {
-                        GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue);
-                        data[i] = static_cast&lt;GLint&gt;(clampedValue);
-                    }
-
-                    delete [] int64Params;
-                }
-                else
-                {
-                    UNREACHABLE();
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ClearBufferiv(buffer, drawbuffer, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBeginTransformFeedback(GLenum primitiveMode)
</del><ins>+void GL_APIENTRY glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum primitiveMode = 0x%X)&quot;, primitiveMode);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (primitiveMode)
-            {
-              case GL_TRIANGLES:
-              case GL_LINES:
-              case GL_POINTS:
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::TransformFeedback *transformFeedback = context-&gt;getCurrentTransformFeedback();
-            ASSERT(transformFeedback != NULL);
-
-            if (transformFeedback-&gt;isStarted())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (transformFeedback-&gt;isPaused())
-            {
-                transformFeedback-&gt;resume();
-            }
-            else
-            {
-                transformFeedback-&gt;start(primitiveMode);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ClearBufferuiv(buffer, drawbuffer, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glEndTransformFeedback(void)
</del><ins>+void GL_APIENTRY glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(void)&quot;);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::TransformFeedback *transformFeedback = context-&gt;getCurrentTransformFeedback();
-            ASSERT(transformFeedback != NULL);
-
-            if (!transformFeedback-&gt;isStarted())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            transformFeedback-&gt;stop();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ClearBufferfv(buffer, drawbuffer, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
</del><ins>+void GL_APIENTRY glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)&quot;,
-          target, index, buffer, offset, size);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (target)
-            {
-              case GL_TRANSFORM_FEEDBACK_BUFFER:
-                if (index &gt;= context-&gt;getMaxTransformFeedbackBufferBindings())
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-
-              case GL_UNIFORM_BUFFER:
-                if (index &gt;= context-&gt;getMaximumCombinedUniformBufferBindings())
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (buffer != 0 &amp;&amp; size &lt;= 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (target)
-            {
-              case GL_TRANSFORM_FEEDBACK_BUFFER:
-
-                // size and offset must be a multiple of 4
-                if (buffer != 0 &amp;&amp; ((offset % 4) != 0 || (size % 4) != 0))
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-
-                context-&gt;bindIndexedTransformFeedbackBuffer(buffer, index, offset, size);
-                context-&gt;bindGenericTransformFeedbackBuffer(buffer);
-                break;
-
-              case GL_UNIFORM_BUFFER:
-
-                // it is an error to bind an offset not a multiple of the alignment
-                if (buffer != 0 &amp;&amp; (offset % context-&gt;getUniformBufferOffsetAlignment()) != 0)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-
-                context-&gt;bindIndexedUniformBuffer(buffer, index, offset, size);
-                context-&gt;bindGenericUniformBuffer(buffer);
-                break;
-
-              default:
-                UNREACHABLE();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ClearBufferfi(buffer, drawbuffer, depth, stencil);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
</del><ins>+const GLubyte* GL_APIENTRY glGetStringi(GLenum name, GLuint index)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)&quot;,
-          target, index, buffer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (target)
-            {
-              case GL_TRANSFORM_FEEDBACK_BUFFER:
-                if (index &gt;= context-&gt;getMaxTransformFeedbackBufferBindings())
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-
-              case GL_UNIFORM_BUFFER:
-                if (index &gt;= context-&gt;getMaximumCombinedUniformBufferBindings())
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            switch (target)
-            {
-              case GL_TRANSFORM_FEEDBACK_BUFFER:
-                context-&gt;bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0);
-                context-&gt;bindGenericTransformFeedbackBuffer(buffer);
-                break;
-
-              case GL_UNIFORM_BUFFER:
-                context-&gt;bindIndexedUniformBuffer(buffer, index, 0, 0);
-                context-&gt;bindGenericUniformBuffer(buffer);
-                break;
-
-              default:
-                UNREACHABLE();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetStringi(name, index);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
</del><ins>+void GL_APIENTRY glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)&quot;,
-          program, count, varyings, bufferMode);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (count &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (bufferMode)
-            {
-              case GL_INTERLEAVED_ATTRIBS:
-                break;
-              case GL_SEPARATE_ATTRIBS:
-                if (static_cast&lt;GLuint&gt;(count) &gt; context-&gt;getMaxTransformFeedbackBufferBindings())
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (!gl::ValidProgram(context, program))
-            {
-                return;
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-            ASSERT(programObject);
-
-            programObject-&gt;setTransformFeedbackVaryings(count, varyings, bufferMode);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
</del><ins>+void GL_APIENTRY glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, &quot;
-          &quot;GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)&quot;,
-          program, index, bufSize, length, size, type, name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (bufSize &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (!gl::ValidProgram(context, program))
-            {
-                return;
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-            ASSERT(programObject);
-
-            if (index &gt;= static_cast&lt;GLuint&gt;(programObject-&gt;getTransformFeedbackVaryingCount()))
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            programObject-&gt;getTransformFeedbackVarying(index, bufSize, length, size, type, name);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
</del><ins>+void GL_APIENTRY glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)&quot;,
-          index, size, type, stride, pointer);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if (size &lt; 1 || size &gt; 4)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        switch (type)
-        {
-          case GL_BYTE:
-          case GL_UNSIGNED_BYTE:
-          case GL_SHORT:
-          case GL_UNSIGNED_SHORT:
-          case GL_INT:
-          case GL_UNSIGNED_INT:
-          case GL_INT_2_10_10_10_REV:
-          case GL_UNSIGNED_INT_2_10_10_10_REV:
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM);
-        }
-
-        if (stride &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) &amp;&amp; size != 4)
-        {
-            return gl::error(GL_INVALID_OPERATION);
-        }
-
-        if (context)
-        {
-            // [OpenGL ES 3.0.2] Section 2.8 page 24:
-            // An INVALID_OPERATION error is generated when a non-zero vertex array object
-            // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
-            // and the pointer argument is not NULL.
-            if (context-&gt;getVertexArrayHandle() != 0 &amp;&amp; context-&gt;getArrayBufferHandle() == 0 &amp;&amp; pointer != NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;setVertexAttribState(index, context-&gt;getArrayBuffer(), size, type, false, true,
-                                          stride, pointer);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
</del><ins>+GLuint GL_APIENTRY glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
-          index, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            const gl::VertexAttribute &amp;attribState = context-&gt;getVertexAttribState(index);
-
-            if (!gl::ValidateGetVertexAttribParameters(pname, context-&gt;getClientVersion()))
-            {
-                return;
-            }
-
-            if (pname == GL_CURRENT_VERTEX_ATTRIB)
-            {
-                const gl::VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getVertexAttribCurrentValue(index);
-                for (int i = 0; i &lt; 4; ++i)
-                {
-                    params[i] = currentValueData.IntValues[i];
-                }
-            }
-            else
-            {
-                *params = attribState.querySingleParameter&lt;GLint&gt;(pname);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetUniformBlockIndex(program, uniformBlockName);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
</del><ins>+void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)&quot;,
-          index, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            const gl::VertexAttribute &amp;attribState = context-&gt;getVertexAttribState(index);
-
-            if (!gl::ValidateGetVertexAttribParameters(pname, context-&gt;getClientVersion()))
-            {
-                return;
-            }
-
-            if (pname == GL_CURRENT_VERTEX_ATTRIB)
-            {
-                const gl::VertexAttribCurrentValueData &amp;currentValueData = context-&gt;getVertexAttribCurrentValue(index);
-                for (int i = 0; i &lt; 4; ++i)
-                {
-                    params[i] = currentValueData.UnsignedIntValues[i];
-                }
-            }
-            else
-            {
-                *params = attribState.querySingleParameter&lt;GLuint&gt;(pname);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
</del><ins>+void GL_APIENTRY glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)&quot;,
-          index, x, y, z, w);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            GLint vals[4] = { x, y, z, w };
-            context-&gt;setVertexAttribi(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
</del><ins>+void GL_APIENTRY glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)&quot;,
-          index, x, y, z, w);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            GLuint vals[4] = { x, y, z, w };
-            context-&gt;setVertexAttribu(index, vals);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribI4iv(GLuint index, const GLint* v)
</del><ins>+void GL_APIENTRY glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, const GLint* v = 0x%0.8p)&quot;, index, v);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            context-&gt;setVertexAttribi(index, v);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawArraysInstanced(mode, first, count, instanceCount);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribI4uiv(GLuint index, const GLuint* v)
</del><ins>+void GL_APIENTRY glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, const GLuint* v = 0x%0.8p)&quot;, index, v);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            context-&gt;setVertexAttribu(index, v);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawElementsInstanced(mode, count, type, indices, instanceCount);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetUniformuiv(GLuint program, GLint location, GLuint* params)
</del><ins>+GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)&quot;,
-          program, location, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (program == 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject || !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;getUniformuiv(location, NULL, params))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::FenceSync_(condition, flags);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLint __stdcall glGetFragDataLocation(GLuint program, const GLchar *name)
</del><ins>+GLboolean GL_APIENTRY glIsSync(GLsync sync)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, const GLchar *name = 0x%0.8p)&quot;,
-          program, name);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, -1);
-            }
-
-            if (program == 0)
-            {
-                return gl::error(GL_INVALID_VALUE, -1);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject || !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION, -1);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION, -1);
-            }
-
-            return programBinary-&gt;getFragDataLocation(name);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
</del><ins>+    return gl::IsSync(sync);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform1ui(GLint location, GLuint v0)
</del><ins>+void GL_APIENTRY glDeleteSync(GLsync sync)
</ins><span class="cx"> {
</span><del>-    glUniform1uiv(location, 1, &amp;v0);
</del><ins>+    return gl::DeleteSync(sync);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform2ui(GLint location, GLuint v0, GLuint v1)
</del><ins>+GLenum GL_APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
</ins><span class="cx"> {
</span><del>-    const GLuint xy[] = { v0, v1 };
-    glUniform2uiv(location, 1, xy);
</del><ins>+    return gl::ClientWaitSync(sync, flags, timeout);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
</del><ins>+void GL_APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
</ins><span class="cx"> {
</span><del>-    const GLuint xyz[] = { v0, v1, v2 };
-    glUniform3uiv(location, 1, xyz);
</del><ins>+    return gl::WaitSync(sync, flags, timeout);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
</del><ins>+void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64* params)
</ins><span class="cx"> {
</span><del>-    const GLuint xyzw[] = { v0, v1, v2, v3 };
-    glUniform4uiv(location, 1, xyzw);
</del><ins>+    return gl::GetInteger64v(pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform1uiv(GLint location, GLsizei count, const GLuint* value)
</del><ins>+void GL_APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)&quot;,
-          location, count, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform1uiv(location, count, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetSynciv(sync, pname, bufSize, length, values);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform2uiv(GLint location, GLsizei count, const GLuint* value)
</del><ins>+void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)&quot;,
-          location, count, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform2uiv(location, count, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetInteger64i_v(target, index, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform3uiv(GLint location, GLsizei count, const GLuint* value)
</del><ins>+void GL_APIENTRY glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value)&quot;,
-          location, count, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform3uiv(location, count, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetBufferParameteri64v(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniform4uiv(GLint location, GLsizei count, const GLuint* value)
</del><ins>+void GL_APIENTRY glGenSamplers(GLsizei count, GLuint* samplers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)&quot;,
-          location, count, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = context-&gt;getCurrentProgramBinary();
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;setUniform4uiv(location, count, value))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenSamplers(count, samplers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
</del><ins>+void GL_APIENTRY glDeleteSamplers(GLsizei count, const GLuint* samplers)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)&quot;,
-          buffer, drawbuffer, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (buffer)
-            {
-              case GL_COLOR:
-                if (drawbuffer &lt; 0 || drawbuffer &gt;= static_cast&lt;GLint&gt;(context-&gt;getMaximumRenderTargets()))
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-              case GL_STENCIL:
-                if (drawbuffer != 0)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;clearBufferiv(buffer, drawbuffer, value);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteSamplers(count, samplers);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
</del><ins>+GLboolean GL_APIENTRY glIsSampler(GLuint sampler)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)&quot;,
-          buffer, drawbuffer, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (buffer)
-            {
-              case GL_COLOR:
-                if (drawbuffer &lt; 0 || drawbuffer &gt;= static_cast&lt;GLint&gt;(context-&gt;getMaximumRenderTargets()))
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;clearBufferuiv(buffer, drawbuffer, value);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsSampler(sampler);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
</del><ins>+void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)&quot;,
-          buffer, drawbuffer, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (buffer)
-            {
-              case GL_COLOR:
-                if (drawbuffer &lt; 0 || drawbuffer &gt;= static_cast&lt;GLint&gt;(context-&gt;getMaximumRenderTargets()))
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-              case GL_DEPTH:
-                if (drawbuffer != 0)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;clearBufferfv(buffer, drawbuffer, value);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindSampler(unit, sampler);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
</del><ins>+void GL_APIENTRY glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)&quot;,
-          buffer, drawbuffer, depth, stencil);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (buffer)
-            {
-              case GL_DEPTH_STENCIL:
-                if (drawbuffer != 0)
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            context-&gt;clearBufferfi(buffer, drawbuffer, depth, stencil);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::SamplerParameteri(sampler, pname, param);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-const GLubyte* __stdcall glGetStringi(GLenum name, GLuint index)
</del><ins>+void GL_APIENTRY glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum name = 0x%X, GLuint index = %u)&quot;, name, index);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLubyte*&gt;(NULL));
-            }
-
-            if (name != GL_EXTENSIONS)
-            {
-                return gl::error(GL_INVALID_ENUM, reinterpret_cast&lt;GLubyte*&gt;(NULL));
-            }
-
-            if (index &gt;= context-&gt;getNumExtensions())
-            {
-                return gl::error(GL_INVALID_VALUE, reinterpret_cast&lt;GLubyte*&gt;(NULL));
-            }
-            
-            return reinterpret_cast&lt;const GLubyte*&gt;(context-&gt;getExtensionString(index));
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast&lt;GLubyte*&gt;(NULL));
-    }
-
-    return NULL;
</del><ins>+    return gl::SamplerParameteriv(sampler, pname, param);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
</del><ins>+void GL_APIENTRY glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)&quot;,
-          readTarget, writeTarget, readOffset, writeOffset, size);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, readTarget))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Buffer *readBuffer = context-&gt;getTargetBuffer(readTarget);
-            gl::Buffer *writeBuffer = context-&gt;getTargetBuffer(writeTarget);
-
-            if (!readBuffer || !writeBuffer)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (readBuffer-&gt;mapped() || writeBuffer-&gt;mapped())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (readOffset &lt; 0 || writeOffset &lt; 0 || size &lt; 0 ||
-                static_cast&lt;unsigned int&gt;(readOffset + size) &gt; readBuffer-&gt;size() ||
-                static_cast&lt;unsigned int&gt;(writeOffset + size) &gt; writeBuffer-&gt;size())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (readBuffer == writeBuffer &amp;&amp; abs(readOffset - writeOffset) &lt; size)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            // TODO: Verify that readBuffer and writeBuffer are not currently mapped (GL_INVALID_OPERATION)
-
-            // if size is zero, the copy is a successful no-op
-            if (size &gt; 0)
-            {
-                writeBuffer-&gt;copyBufferSubData(readBuffer, readOffset, writeOffset, size);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::SamplerParameterf(sampler, pname, param);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
</del><ins>+void GL_APIENTRY glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)&quot;,
-          program, uniformCount, uniformNames, uniformIndices);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (uniformCount &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programObject-&gt;isLinked() || !programBinary)
-            {
-                for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
-                {
-                    uniformIndices[uniformId] = GL_INVALID_INDEX;
-                }
-            }
-            else
-            {
-                for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
-                {
-                    uniformIndices[uniformId] = programBinary-&gt;getUniformIndex(uniformNames[uniformId]);
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::SamplerParameterfv(sampler, pname, param);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
-          program, uniformCount, uniformIndices, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (uniformCount &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            switch (pname)
-            {
-              case GL_UNIFORM_TYPE:
-              case GL_UNIFORM_SIZE:
-              case GL_UNIFORM_NAME_LENGTH:
-              case GL_UNIFORM_BLOCK_INDEX:
-              case GL_UNIFORM_OFFSET:
-              case GL_UNIFORM_ARRAY_STRIDE:
-              case GL_UNIFORM_MATRIX_STRIDE:
-              case GL_UNIFORM_IS_ROW_MAJOR:
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-
-            if (!programBinary &amp;&amp; uniformCount &gt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
-            {
-                const GLuint index = uniformIndices[uniformId];
-
-                if (index &gt;= (GLuint)programBinary-&gt;getActiveUniformCount())
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            for (int uniformId = 0; uniformId &lt; uniformCount; uniformId++)
-            {
-                const GLuint index = uniformIndices[uniformId];
-                params[uniformId] = programBinary-&gt;getActiveUniformi(index, pname);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetSamplerParameteriv(sampler, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLuint __stdcall glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
</del><ins>+void GL_APIENTRY glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)&quot;, program, uniformBlockName);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE, GL_INVALID_INDEX);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-            if (!programBinary)
-            {
-                return GL_INVALID_INDEX;
-            }
-
-            return programBinary-&gt;getUniformBlockIndex(uniformBlockName);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, 0);
-    }
-
-    return 0;
</del><ins>+    return gl::GetSamplerParameterfv(sampler, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;,
-          program, uniformBlockIndex, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-
-            if (!programBinary || uniformBlockIndex &gt;= programBinary-&gt;getActiveUniformBlockCount())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (pname)
-            {
-              case GL_UNIFORM_BLOCK_BINDING:
-                *params = static_cast&lt;GLint&gt;(programObject-&gt;getUniformBlockBinding(uniformBlockIndex));
-                break;
-
-              case GL_UNIFORM_BLOCK_DATA_SIZE:
-              case GL_UNIFORM_BLOCK_NAME_LENGTH:
-              case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
-              case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
-              case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
-              case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
-                programBinary-&gt;getActiveUniformBlockiv(uniformBlockIndex, pname, params);
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttribDivisor(index, divisor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
</del><ins>+void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)&quot;,
-          program, uniformBlockIndex, bufSize, length, uniformBlockName);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-
-            if (!programBinary || uniformBlockIndex &gt;= programBinary-&gt;getActiveUniformBlockCount())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            programBinary-&gt;getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BindTransformFeedback(target, id);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
</del><ins>+void GL_APIENTRY glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)&quot;,
-          program, uniformBlockIndex, uniformBlockBinding);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (uniformBlockBinding &gt;= context-&gt;getMaximumCombinedUniformBufferBindings())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                if (context-&gt;getShader(program))
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-                else
-                {
-                    return gl::error(GL_INVALID_VALUE);
-                }
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-
-            // if never linked, there won't be any uniform blocks
-            if (!programBinary || uniformBlockIndex &gt;= programBinary-&gt;getActiveUniformBlockCount())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            programObject-&gt;bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteTransformFeedbacks(n, ids);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
</del><ins>+void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint* ids)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)&quot;,
-          mode, first, count, instanceCount);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // glDrawArraysInstanced
-            UNIMPLEMENTED();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenTransformFeedbacks(n, ids);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
</del><ins>+GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)&quot;,
-          mode, count, type, indices, instanceCount);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // glDrawElementsInstanced
-            UNIMPLEMENTED();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsTransformFeedback(id);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLsync __stdcall glFenceSync(GLenum condition, GLbitfield flags)
</del><ins>+void GL_APIENTRY glPauseTransformFeedback(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum condition = 0x%X, GLbitfield flags = 0x%X)&quot;, condition, flags);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLsync&gt;(0));
-            }
-
-            if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE)
-            {
-                return gl::error(GL_INVALID_ENUM, reinterpret_cast&lt;GLsync&gt;(0));
-            }
-
-            if (flags != 0)
-            {
-                return gl::error(GL_INVALID_VALUE, reinterpret_cast&lt;GLsync&gt;(0));
-            }
-
-            return context-&gt;createFenceSync(condition);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast&lt;GLsync&gt;(NULL));
-    }
-
-    return NULL;
</del><ins>+    return gl::PauseTransformFeedback();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsSync(GLsync sync)
</del><ins>+void GL_APIENTRY glResumeTransformFeedback(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsync sync = 0x%0.8p)&quot;, sync);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_FALSE);
-            }
-
-            return (context-&gt;getFenceSync(sync) != NULL);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::ResumeTransformFeedback();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteSync(GLsync sync)
</del><ins>+void GL_APIENTRY glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsync sync = 0x%0.8p)&quot;, sync);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (sync != static_cast&lt;GLsync&gt;(0) &amp;&amp; !context-&gt;getFenceSync(sync))
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            context-&gt;deleteFenceSync(sync);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetProgramBinary(program, bufSize, length, binaryFormat, binary);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLenum __stdcall glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
</del><ins>+void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)&quot;,
-          sync, flags, timeout);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_WAIT_FAILED);
-            }
-
-            if ((flags &amp; ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
-            {
-                return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
-            }
-
-            gl::FenceSync *fenceSync = context-&gt;getFenceSync(sync);
-
-            if (!fenceSync)
-            {
-                return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED);
-            }
-
-            return fenceSync-&gt;clientWait(flags, timeout);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::ProgramBinary(program, binaryFormat, binary, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
</del><ins>+void GL_APIENTRY glProgramParameteri(GLuint program, GLenum pname, GLint value)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)&quot;,
-          sync, flags, timeout);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (flags != 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (timeout != GL_TIMEOUT_IGNORED)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::FenceSync *fenceSync = context-&gt;getFenceSync(sync);
-
-            if (!fenceSync)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            fenceSync-&gt;serverWait();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ProgramParameteri(program, pname, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetInteger64v(GLenum pname, GLint64* params)
</del><ins>+void GL_APIENTRY glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)&quot;,
-          pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            GLenum nativeType;
-            unsigned int numParams = 0;
-            if (!context-&gt;getQueryParameterInfo(pname, &amp;nativeType, &amp;numParams))
-                return gl::error(GL_INVALID_ENUM);
-
-            // pname is valid, but that there are no parameters to return.
-            if (numParams == 0)
-                return;
-
-            if (nativeType == GL_INT_64_ANGLEX)
-            {
-                context-&gt;getInteger64v(pname, params);
-            }
-            else
-            {
-                CastStateValues(context, nativeType, pname, numParams, params);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::InvalidateFramebuffer(target, numAttachments, attachments);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
</del><ins>+void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)&quot;,
-          sync, pname, bufSize, length, values);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (bufSize &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            gl::FenceSync *fenceSync = context-&gt;getFenceSync(sync);
-
-            if (!fenceSync)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (pname)
-            {
-              case GL_OBJECT_TYPE:     values[0] = static_cast&lt;GLint&gt;(GL_SYNC_FENCE);              break;
-              case GL_SYNC_STATUS:     values[0] = static_cast&lt;GLint&gt;(fenceSync-&gt;getStatus());     break;
-              case GL_SYNC_CONDITION:  values[0] = static_cast&lt;GLint&gt;(fenceSync-&gt;getCondition());  break;
-              case GL_SYNC_FLAGS:      values[0] = 0;                                              break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
</del><ins>+void GL_APIENTRY glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)&quot;,
-          target, index, data);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (target)
-            {
-              case GL_TRANSFORM_FEEDBACK_BUFFER_START:
-              case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
-              case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
-                if (index &gt;= context-&gt;getMaxTransformFeedbackBufferBindings())
-                    return gl::error(GL_INVALID_VALUE);
-                break;
-              case GL_UNIFORM_BUFFER_START:
-              case GL_UNIFORM_BUFFER_SIZE:
-              case GL_UNIFORM_BUFFER_BINDING:
-                if (index &gt;= context-&gt;getMaximumCombinedUniformBufferBindings())
-                    return gl::error(GL_INVALID_VALUE);
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (!(context-&gt;getIndexedInteger64v(target, index, data)))
-            {
-                GLenum nativeType;
-                unsigned int numParams = 0;
-                if (!context-&gt;getIndexedQueryParameterInfo(target, &amp;nativeType, &amp;numParams))
-                    return gl::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_INT)
-                {
-                    GLint *intParams = new GLint[numParams];
-
-                    context-&gt;getIndexedIntegerv(target, index, intParams);
-
-                    for (unsigned int i = 0; i &lt; numParams; ++i)
-                    {
-                        data[i] = static_cast&lt;GLint64&gt;(intParams[i]);
-                    }
-
-                    delete [] intParams;
-                }
-                else
-                {
-                    UNREACHABLE();
-                }
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexStorage2D(target, levels, internalformat, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
</del><ins>+void GL_APIENTRY glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)&quot;,
-          target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (!gl::ValidBufferParameter(context, pname))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (!buffer)
-            {
-                // A null buffer means that &quot;0&quot; is bound to the requested buffer target
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (pname)
-            {
-              case GL_BUFFER_USAGE:
-                *params = static_cast&lt;GLint64&gt;(buffer-&gt;usage());
-                break;
-              case GL_BUFFER_SIZE:
-                *params = buffer-&gt;size();
-                break;
-              case GL_BUFFER_ACCESS_FLAGS:
-                *params = static_cast&lt;GLint64&gt;(buffer-&gt;accessFlags());
-                break;
-              case GL_BUFFER_MAPPED:
-                *params = static_cast&lt;GLint64&gt;(buffer-&gt;mapped());
-                break;
-              case GL_BUFFER_MAP_OFFSET:
-                *params = buffer-&gt;mapOffset();
-                break;
-              case GL_BUFFER_MAP_LENGTH:
-                *params = buffer-&gt;mapLength();
-                break;
-              default: UNREACHABLE(); break;
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexStorage3D(target, levels, internalformat, width, height, depth);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenSamplers(GLsizei count, GLuint* samplers)
</del><ins>+void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei count = %d, GLuint* samplers = 0x%0.8p)&quot;, count, samplers);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (count &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (int i = 0; i &lt; count; i++)
-            {
-                samplers[i] = context-&gt;createSampler();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetInternalformativ(target, internalformat, pname, bufSize, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteSamplers(GLsizei count, const GLuint* samplers)
</del><ins>+void GL_APIENTRY glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)&quot;, count, samplers);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (count &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            for (int i = 0; i &lt; count; i++)
-            {
-                context-&gt;deleteSampler(samplers[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsSampler(GLuint sampler)
</del><ins>+void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint sampler = %u)&quot;, sampler);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_FALSE);
-            }
-
-            return context-&gt;isSampler(sampler);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindSampler(GLuint unit, GLuint sampler)
</del><ins>+void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint* fences)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint unit = %u, GLuint sampler = %u)&quot;, unit, sampler);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (sampler != 0 &amp;&amp; !context-&gt;isSampler(sampler))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (unit &gt;= context-&gt;getMaximumCombinedTextureImageUnits())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            context-&gt;bindSampler(unit, sampler);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteFencesNV(n, fences);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
</del><ins>+void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)&quot;, sampler, pname, param);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::ValidateSamplerObjectParameter(pname))
-            {
-                return;
-            }
-
-            if (!gl::ValidateTexParamParameters(context, pname, param))
-            {
-                return;
-            }
-
-            if (!context-&gt;isSampler(sampler))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;samplerParameteri(sampler, pname, param);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenFencesNV(n, fences);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
</del><ins>+GLboolean GL_APIENTRY glIsFenceNV(GLuint fence)
</ins><span class="cx"> {
</span><del>-    glSamplerParameteri(sampler, pname, *param);
</del><ins>+    return gl::IsFenceNV(fence);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
</del><ins>+GLboolean GL_APIENTRY glTestFenceNV(GLuint fence)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)&quot;, sampler, pname, param);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::ValidateSamplerObjectParameter(pname))
-            {
-                return;
-            }
-
-            if (!gl::ValidateTexParamParameters(context, pname, static_cast&lt;GLint&gt;(param)))
-            {
-                return;
-            }
-
-            if (!context-&gt;isSampler(sampler))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;samplerParameterf(sampler, pname, param);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TestFenceNV(fence);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
</del><ins>+void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
</ins><span class="cx"> {
</span><del>-    glSamplerParameterf(sampler, pname, *param);
</del><ins>+    return gl::GetFenceivNV(fence, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
</del><ins>+void GL_APIENTRY glFinishFenceNV(GLuint fence)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)&quot;, sampler, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::ValidateSamplerObjectParameter(pname))
-            {
-                return;
-            }
-
-            if (!context-&gt;isSampler(sampler))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            *params = context-&gt;getSamplerParameteri(sampler, pname);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::FinishFenceNV(fence);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
</del><ins>+void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)&quot;, sampler, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::ValidateSamplerObjectParameter(pname))
-            {
-                return;
-            }
-
-            if (!context-&gt;isSampler(sampler))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            *params = context-&gt;getSamplerParameterf(sampler, pname);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::SetFenceNV(fence, condition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glVertexAttribDivisor(GLuint index, GLuint divisor)
</del><ins>+void GL_APIENTRY glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint index = %u, GLuint divisor = %u)&quot;, index, divisor);
-
-    try
-    {
-        if (index &gt;= gl::MAX_VERTEX_ATTRIBS)
-        {
-            return gl::error(GL_INVALID_VALUE);
-        }
-
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;setVertexAttribDivisor(index, divisor);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetTranslatedShaderSourceANGLE(shader, bufsize, length, source);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glBindTransformFeedback(GLenum target, GLuint id)
</del><ins>+void GL_APIENTRY glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLuint id = %u)&quot;, target, id);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            switch (target)
-            {
-              case GL_TRANSFORM_FEEDBACK:
-                {
-                    // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1)
-                    gl::TransformFeedback *curTransformFeedback = context-&gt;getCurrentTransformFeedback();
-                    if (curTransformFeedback &amp;&amp; curTransformFeedback-&gt;isStarted() &amp;&amp; !curTransformFeedback-&gt;isPaused())
-                    {
-                        return gl::error(GL_INVALID_OPERATION);
-                    }
-
-                    // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1)
-                    if (context-&gt;getTransformFeedback(id) == NULL)
-                    {
-                        return gl::error(GL_INVALID_OPERATION);
-                    }
-
-                    context-&gt;bindTransformFeedback(id);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::TexStorage2DEXT(target, levels, internalformat, width, height);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
</del><ins>+GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, const GLuint* ids = 0x%0.8p)&quot;, n, ids);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            for (int i = 0; i &lt; n; i++)
-            {
-                context-&gt;deleteTransformFeedback(ids[i]);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetGraphicsResetStatusEXT();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGenTransformFeedbacks(GLsizei n, GLuint* ids)
</del><ins>+void GL_APIENTRY glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLsizei n = %d, GLuint* ids = 0x%0.8p)&quot;, n, ids);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            for (int i = 0; i &lt; n; i++)
-            {
-                ids[i] = context-&gt;createTransformFeedback();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ReadnPixelsEXT(x, y, width, height, format, type, bufSize, data);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glIsTransformFeedback(GLuint id)
</del><ins>+void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint id = %u)&quot;, id);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_FALSE);
-            }
-
-            return ((context-&gt;getTransformFeedback(id) != NULL) ? GL_TRUE : GL_FALSE);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::GetnUniformfvEXT(program, location, bufSize, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glPauseTransformFeedback(void)
</del><ins>+void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(void)&quot;);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::TransformFeedback *transformFeedback = context-&gt;getCurrentTransformFeedback();
-            ASSERT(transformFeedback != NULL);
-
-            // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86)
-            if (!transformFeedback-&gt;isStarted() || transformFeedback-&gt;isPaused())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            transformFeedback-&gt;pause();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetnUniformivEXT(program, location, bufSize, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glResumeTransformFeedback(void)
</del><ins>+void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint *ids)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(void)&quot;);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::TransformFeedback *transformFeedback = context-&gt;getCurrentTransformFeedback();
-            ASSERT(transformFeedback != NULL);
-
-            // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86)
-            if (!transformFeedback-&gt;isStarted() || !transformFeedback-&gt;isPaused())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            transformFeedback-&gt;resume();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GenQueriesEXT(n, ids);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
</del><ins>+void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)&quot;,
-          program, bufSize, length, binaryFormat, binary);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // glGetProgramBinary
-            UNIMPLEMENTED();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DeleteQueriesEXT(n, ids);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
</del><ins>+GLboolean GL_APIENTRY glIsQueryEXT(GLuint id)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)&quot;,
-          program, binaryFormat, binary, length);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // glProgramBinary
-            UNIMPLEMENTED();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::IsQueryEXT(id);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glProgramParameteri(GLuint program, GLenum pname, GLint value)
</del><ins>+void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint id)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)&quot;,
-          program, pname, value);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // glProgramParameteri
-            UNIMPLEMENTED();
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::BeginQueryEXT(target, id);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
</del><ins>+void GL_APIENTRY glEndQueryEXT(GLenum target)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)&quot;,
-          target, numAttachments, attachments);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
-            {
-                return;
-            }
-
-            int maxDimension = context-&gt;getMaximumRenderbufferDimension();
-            context-&gt;invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::EndQueryEXT(target);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, &quot;
-          &quot;GLint y = %d, GLsizei width = %d, GLsizei height = %d)&quot;,
-          target, numAttachments, attachments, x, y, width, height);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments))
-            {
-                return;
-            }
-
-            context-&gt;invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetQueryivEXT(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
</del><ins>+void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)&quot;,
-          target, levels, internalformat, width, height);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1))
-            {
-                return;
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    gl::Texture2D *texture2d = context-&gt;getTexture2D();
-                    texture2d-&gt;storage(levels, internalformat, width, height);
-                }
-                break;
-
-              case GL_TEXTURE_CUBE_MAP:
-                {
-                    gl::TextureCubeMap *textureCube = context-&gt;getTextureCubeMap();
-                    textureCube-&gt;storage(levels, internalformat, width);
-                }
-                break;
-
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetQueryObjectuivEXT(id, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
</del><ins>+void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, &quot;
-          &quot;GLsizei height = %d, GLsizei depth = %d)&quot;,
-          target, levels, internalformat, width, height, depth);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth))
-            {
-                return;
-            }
-
-            switch (target)
-            {
-              case GL_TEXTURE_3D:
-                {
-                    gl::Texture3D *texture3d = context-&gt;getTexture3D();
-                    texture3d-&gt;storage(levels, internalformat, width, height, depth);
-                }
-                break;
-
-              case GL_TEXTURE_2D_ARRAY:
-                {
-                    gl::Texture2DArray *texture2darray = context-&gt;getTexture2DArray();
-                    texture2darray-&gt;storage(levels, internalformat, width, height, depth);
-                }
-                break;
-
-              default:
-                UNREACHABLE();
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawBuffersEXT(n, bufs);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
</del><ins>+void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, &quot;
-          &quot;GLint* params = 0x%0.8p)&quot;,
-          target, internalformat, pname, bufSize, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::IsColorRenderingSupported(internalformat, context) &amp;&amp;
-                !gl::IsDepthRenderingSupported(internalformat, context) &amp;&amp;
-                !gl::IsStencilRenderingSupported(internalformat, context))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (target != GL_RENDERBUFFER)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (bufSize &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            switch (pname)
-            {
-              case GL_NUM_SAMPLE_COUNTS:
-                if (bufSize != 0)
-                    *params = context-&gt;getNumSampleCounts(internalformat);
-                break;
-              case GL_SAMPLES:
-                context-&gt;getSampleCounts(internalformat, bufSize, params);
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM);
-            }
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawArraysInstancedANGLE(mode, first, count, primcount);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Extension functions
-
-void __stdcall glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
-                                      GLbitfield mask, GLenum filter)
</del><ins>+void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, &quot;
-          &quot;GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, &quot;
-          &quot;GLbitfield mask = 0x%X, GLenum filter = 0x%X)&quot;,
-          srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1,
-                                                   dstX0, dstY0, dstX1, dstY1, mask, filter,
-                                                   true))
-            {
-                return;
-            }
-
-            context-&gt;blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1,
-                                     mask, filter);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::DrawElementsInstancedANGLE(mode, count, type, indices, primcount);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
-                               GLint border, GLenum format, GLenum type, const GLvoid* pixels)
</del><ins>+void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, &quot;
-          &quot;GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, &quot;
-          &quot;GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* pixels = 0x%0.8p)&quot;,
-          target, level, internalformat, width, height, depth, border, format, type, pixels);
-
-    try
-    {
-        UNIMPLEMENTED();   // FIXME
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::VertexAttribDivisorANGLE(index, divisor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, 
-                                     GLenum *binaryFormat, void *binary)
</del><ins>+void GL_APIENTRY glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum program = 0x%X, bufSize = %d, length = 0x%0.8p, binaryFormat = 0x%0.8p, binary = 0x%0.8p)&quot;,
-          program, bufSize, length, binaryFormat, binary);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject || !programObject-&gt;isLinked())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            gl::ProgramBinary *programBinary = programObject-&gt;getProgramBinary();
-
-            if (!programBinary)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!programBinary-&gt;save(binary, bufSize, length))
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            *binaryFormat = GL_PROGRAM_BINARY_ANGLE;
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glProgramBinaryOES(GLuint program, GLenum binaryFormat,
-                                  const void *binary, GLint length)
</del><ins>+void GL_APIENTRY glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)&quot;,
-          program, binaryFormat, binary, length);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Program *programObject = context-&gt;getProgram(program);
-
-            if (!programObject)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            context-&gt;setProgramBinary(program, binary, length);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::ProgramBinaryOES(program, binaryFormat, binary, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glDrawBuffersEXT(GLsizei n, const GLenum *bufs)
</del><ins>+void* GL_APIENTRY glMapBufferOES(GLenum target, GLenum access)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum n = %d, bufs = 0x%0.8p)&quot;, n, bufs);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (n &lt; 0 || (unsigned int)n &gt; context-&gt;getMaximumRenderTargets())
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (context-&gt;getDrawFramebufferHandle() == 0)
-            {
-                if (n != 1)
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-
-                if (bufs[0] != GL_NONE &amp;&amp; bufs[0] != GL_BACK)
-                {
-                    return gl::error(GL_INVALID_OPERATION);
-                }
-            }
-            else
-            {
-                for (int colorAttachment = 0; colorAttachment &lt; n; colorAttachment++)
-                {
-                    const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment;
-                    if (bufs[colorAttachment] != GL_NONE &amp;&amp; bufs[colorAttachment] != attachment)
-                    {
-                        return gl::error(GL_INVALID_OPERATION);
-                    }
-                }
-            }
-
-            gl::Framebuffer *framebuffer = context-&gt;getDrawFramebuffer();
-
-            for (int colorAttachment = 0; colorAttachment &lt; n; colorAttachment++)
-            {
-                framebuffer-&gt;setDrawBufferState(colorAttachment, bufs[colorAttachment]);
-            }
-
-            for (int colorAttachment = n; colorAttachment &lt; (int)context-&gt;getMaximumRenderTargets(); colorAttachment++)
-            {
-                framebuffer-&gt;setDrawBufferState(colorAttachment, GL_NONE);
-            }
-        }
-    }
-    catch (std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::MapBufferOES(target, access);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glGetBufferPointervOES(GLenum target, GLenum pname, void** params)
</del><ins>+GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)&quot;, target, pname, params);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!context-&gt;supportsPBOs())
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            if (pname != GL_BUFFER_MAP_POINTER)
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (!buffer || !buffer-&gt;mapped())
-            {
-                *params = NULL;
-            }
-
-            *params = buffer-&gt;mapPointer();
-        }
-    }
-    catch (std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><ins>+    return gl::UnmapBufferOES(target);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void * __stdcall glMapBufferOES(GLenum target, GLenum access)
</del><ins>+void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid **params)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLbitfield access = 0x%X)&quot;, target, access);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (buffer == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            if (access != GL_WRITE_ONLY_OES)
-            {
-                return gl::error(GL_INVALID_ENUM, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            if (buffer-&gt;mapped())
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            return buffer-&gt;mapRange(0, buffer-&gt;size(), GL_MAP_WRITE_BIT);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-    }
-
-    return NULL;
</del><ins>+    return gl::GetBufferPointervOES(target, pname, params);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GLboolean __stdcall glUnmapBufferOES(GLenum target)
</del><ins>+void* GL_APIENTRY glMapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X)&quot;, target);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM, GL_FALSE);
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (buffer == NULL || !buffer-&gt;mapped())
-            {
-                return gl::error(GL_INVALID_OPERATION, GL_FALSE);
-            }
-
-            // TODO: detect if we had corruption. if so, throw an error and return false.
-
-            buffer-&gt;unmap();
-
-            return GL_TRUE;
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, GL_FALSE);
-    }
-
-    return GL_FALSE;
</del><ins>+    return gl::MapBufferRangeEXT(target, offset, length, access);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void* __stdcall glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
</del><ins>+void GL_APIENTRY glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length)
</ins><span class="cx"> {
</span><del>-    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)&quot;,
-          target, offset, length, access);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            if (offset &lt; 0 || length &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (buffer == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            // Check for buffer overflow
-            size_t offsetSize = static_cast&lt;size_t&gt;(offset);
-            size_t lengthSize = static_cast&lt;size_t&gt;(length);
-
-            if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
-                offsetSize + lengthSize &gt; static_cast&lt;size_t&gt;(buffer-&gt;size()))
-            {
-                return gl::error(GL_INVALID_VALUE, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            // Check for invalid bits in the mask
-            GLbitfield allAccessBits = GL_MAP_READ_BIT |
-                                       GL_MAP_WRITE_BIT |
-                                       GL_MAP_INVALIDATE_RANGE_BIT |
-                                       GL_MAP_INVALIDATE_BUFFER_BIT |
-                                       GL_MAP_FLUSH_EXPLICIT_BIT |
-                                       GL_MAP_UNSYNCHRONIZED_BIT;
-
-            if (access &amp; ~(allAccessBits))
-            {
-                return gl::error(GL_INVALID_VALUE, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            if (length == 0 || buffer-&gt;mapped())
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            // Check for invalid bit combinations
-            if ((access &amp; (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT |
-                                       GL_MAP_INVALIDATE_BUFFER_BIT |
-                                       GL_MAP_UNSYNCHRONIZED_BIT;
-
-            if ((access &amp; GL_MAP_READ_BIT) != 0 &amp;&amp; (access &amp; writeOnlyBits) != 0)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            if ((access &amp; GL_MAP_WRITE_BIT) == 0 &amp;&amp; (access &amp; GL_MAP_FLUSH_EXPLICIT_BIT) != 0)
-            {
-                return gl::error(GL_INVALID_OPERATION, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-            }
-
-            return buffer-&gt;mapRange(offset, length, access);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, reinterpret_cast&lt;GLvoid*&gt;(NULL));
-    }
-
-    return NULL;
</del><ins>+    return gl::FlushMappedBufferRangeEXT(target, offset, length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void __stdcall glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length)
-{
-    EVENT(&quot;(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)&quot;, target, offset, length);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            if (offset &lt; 0 || length &lt; 0)
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            if (!gl::ValidBufferTarget(context, target))
-            {
-                return gl::error(GL_INVALID_ENUM);
-            }
-
-            gl::Buffer *buffer = context-&gt;getTargetBuffer(target);
-
-            if (buffer == NULL)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            if (!buffer-&gt;mapped() || (buffer-&gt;accessFlags() &amp; GL_MAP_FLUSH_EXPLICIT_BIT) == 0)
-            {
-                return gl::error(GL_INVALID_OPERATION);
-            }
-
-            // Check for buffer overflow
-            size_t offsetSize = static_cast&lt;size_t&gt;(offset);
-            size_t lengthSize = static_cast&lt;size_t&gt;(length);
-
-            if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) ||
-                offsetSize + lengthSize &gt; static_cast&lt;size_t&gt;(buffer-&gt;mapLength()))
-            {
-                return gl::error(GL_INVALID_VALUE);
-            }
-
-            // We do not currently support a non-trivial implementation of FlushMappedBufferRange
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY);
-    }
</del><span class="cx"> }
</span><del>-
-__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname)
-{
-    struct Extension
-    {
-        const char *name;
-        __eglMustCastToProperFunctionPointerType address;
-    };
-
-    static const Extension glExtensions[] =
-    {
-        {&quot;glTexImage3DOES&quot;, (__eglMustCastToProperFunctionPointerType)glTexImage3DOES},
-        {&quot;glBlitFramebufferANGLE&quot;, (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE},
-        {&quot;glRenderbufferStorageMultisampleANGLE&quot;, (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE},
-        {&quot;glDeleteFencesNV&quot;, (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV},
-        {&quot;glGenFencesNV&quot;, (__eglMustCastToProperFunctionPointerType)glGenFencesNV},
-        {&quot;glIsFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)glIsFenceNV},
-        {&quot;glTestFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)glTestFenceNV},
-        {&quot;glGetFenceivNV&quot;, (__eglMustCastToProperFunctionPointerType)glGetFenceivNV},
-        {&quot;glFinishFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)glFinishFenceNV},
-        {&quot;glSetFenceNV&quot;, (__eglMustCastToProperFunctionPointerType)glSetFenceNV},
-        {&quot;glGetTranslatedShaderSourceANGLE&quot;, (__eglMustCastToProperFunctionPointerType)glGetTranslatedShaderSourceANGLE},
-        {&quot;glTexStorage2DEXT&quot;, (__eglMustCastToProperFunctionPointerType)glTexStorage2DEXT},
-        {&quot;glGetGraphicsResetStatusEXT&quot;, (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT},
-        {&quot;glReadnPixelsEXT&quot;, (__eglMustCastToProperFunctionPointerType)glReadnPixelsEXT},
-        {&quot;glGetnUniformfvEXT&quot;, (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT},
-        {&quot;glGetnUniformivEXT&quot;, (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT},
-        {&quot;glGenQueriesEXT&quot;, (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT},
-        {&quot;glDeleteQueriesEXT&quot;, (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT},
-        {&quot;glIsQueryEXT&quot;, (__eglMustCastToProperFunctionPointerType)glIsQueryEXT},
-        {&quot;glBeginQueryEXT&quot;, (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT},
-        {&quot;glEndQueryEXT&quot;, (__eglMustCastToProperFunctionPointerType)glEndQueryEXT},
-        {&quot;glGetQueryivEXT&quot;, (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT},
-        {&quot;glGetQueryObjectuivEXT&quot;, (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT},
-        {&quot;glDrawBuffersEXT&quot;, (__eglMustCastToProperFunctionPointerType)glDrawBuffersEXT},
-        {&quot;glVertexAttribDivisorANGLE&quot;, (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE},
-        {&quot;glDrawArraysInstancedANGLE&quot;, (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE},
-        {&quot;glDrawElementsInstancedANGLE&quot;, (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE},
-        {&quot;glGetProgramBinaryOES&quot;, (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES},
-        {&quot;glProgramBinaryOES&quot;, (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES},
-        {&quot;glGetBufferPointervOES&quot;, (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES},
-        {&quot;glMapBufferOES&quot;, (__eglMustCastToProperFunctionPointerType)glMapBufferOES},
-        {&quot;glUnmapBufferOES&quot;, (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES},
-        {&quot;glMapBufferRangeEXT&quot;, (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT},
-        {&quot;glFlushMappedBufferRangeEXT&quot;, (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT},    };
-
-    for (unsigned int ext = 0; ext &lt; ArraySize(glExtensions); 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(&quot;(egl::Surface* surface = 0x%0.8p)&quot;,
-          surface);
-
-    try
-    {
-        gl::Context *context = gl::getNonLostContext();
-
-        if (context)
-        {
-            gl::Texture2D *textureObject = context-&gt;getTexture2D();
-            ASSERT(textureObject != NULL);
-
-            if (textureObject-&gt;isImmutable())
-            {
-                return false;
-            }
-
-            textureObject-&gt;bindTexImage(surface);
-        }
-    }
-    catch(std::bad_alloc&amp;)
-    {
-        return gl::error(GL_OUT_OF_MEMORY, false);
-    }
-
-    return true;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2def"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.def        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -144,7 +144,6 @@
</span><span class="cx">     glViewport                      @142
</span><span class="cx"> 
</span><span class="cx">     ; Extensions
</span><del>-    glTexImage3DOES                 @143
</del><span class="cx">     glBlitFramebufferANGLE          @149
</span><span class="cx">     glRenderbufferStorageMultisampleANGLE @150
</span><span class="cx">     glDeleteFencesNV                @151
</span><span class="lines">@@ -285,15 +284,7 @@
</span><span class="cx">     glTexStorage3D                  @282
</span><span class="cx">     glGetInternalformativ           @283
</span><span class="cx"> 
</span><del>-    ; EGL dependencies
-    glCreateContext                 @144 NONAME
-    glDestroyContext                @145 NONAME
-    glMakeCurrent                   @146 NONAME
-    glGetCurrentContext             @147 NONAME
-    glGetProcAddress                @148 NONAME
-    glBindTexImage                  @158 NONAME
-    glCreateRenderer                @177 NONAME
-    glDestroyRenderer               @178 NONAME
-
-    ; Setting up TRACE macro callbacks
-    SetTraceFunctionPointers        @284
</del><ins>+    ; ANGLE Platform Implementation
+    ANGLEPlatformCurrent            @290
+    ANGLEPlatformInitialize         @291
+    ANGLEPlatformShutdown           @292
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2libGLESv2rc"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/libGLESv2.rc        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">             VALUE &quot;FileDescription&quot;, &quot;ANGLE libGLESv2 Dynamic Link Library&quot;
</span><span class="cx">             VALUE &quot;FileVersion&quot;, ANGLE_VERSION_STRING
</span><span class="cx">             VALUE &quot;InternalName&quot;, &quot;libGLESv2&quot;
</span><del>-            VALUE &quot;LegalCopyright&quot;, &quot;Copyright (C) 2011 Google Inc.&quot;
</del><ins>+            VALUE &quot;LegalCopyright&quot;, &quot;Copyright (C) 2015 Google Inc.&quot;
</ins><span class="cx">             VALUE &quot;OriginalFilename&quot;, &quot;libGLESv2.dll&quot;
</span><span class="cx">             VALUE &quot;PrivateBuild&quot;, ANGLE_VERSION_STRING
</span><span class="cx">             VALUE &quot;ProductName&quot;, &quot;ANGLE libGLESv2 Dynamic Link Library&quot;
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2maincpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,180 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// 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.
-//
-
-// main.cpp: DLL entry point and management of thread-local data.
-
-#include &quot;libGLESv2/main.h&quot;
-
-#include &quot;libGLESv2/Context.h&quot;
-
-static DWORD currentTLS = TLS_OUT_OF_INDEXES;
-
-namespace gl
-{
-
-Current *AllocateCurrent()
-{
-    Current *current = (Current*)LocalAlloc(LPTR, sizeof(Current));
-
-    if (!current)
-    {
-        ERR(&quot;Could not allocate thread local storage.&quot;);
-        return NULL;
-    }
-
-    ASSERT(currentTLS != TLS_OUT_OF_INDEXES);
-    TlsSetValue(currentTLS, current);
-
-    current-&gt;context = NULL;
-    current-&gt;display = NULL;
-
-    return current;
-}
-
-void DeallocateCurrent()
-{
-    void *current = TlsGetValue(currentTLS);
-
-    if (current)
-    {
-        LocalFree((HLOCAL)current);
-    }
-}
-
-}
-
-extern &quot;C&quot; 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::AllocateCurrent();
-        }
-        break;
-      case DLL_THREAD_DETACH:
-        {
-            gl::DeallocateCurrent();
-        }
-        break;
-      case DLL_PROCESS_DETACH:
-        {
-            gl::DeallocateCurrent();
-            TlsFree(currentTLS);
-        }
-        break;
-      default:
-        break;
-    }
-
-    return TRUE;
-}
-
-namespace gl
-{
-
-Current *GetCurrentData()
-{
-    Current *current = (Current*)TlsGetValue(currentTLS);
-
-    // ANGLE issue 488: when the dll is loaded after thread initialization,
-    // thread local storage (current) might not exist yet.
-    return (current ? current : AllocateCurrent());
-}
-
-void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
-{
-    Current *current = GetCurrentData();
-
-    current-&gt;context = context;
-    current-&gt;display = display;
-
-    if (context &amp;&amp; display &amp;&amp; surface)
-    {
-        context-&gt;makeCurrent(surface);
-    }
-}
-
-Context *getContext()
-{
-    Current *current = GetCurrentData();
-
-    return current-&gt;context;
-}
-
-Context *getNonLostContext()
-{
-    Context *context = getContext();
-    
-    if (context)
-    {
-        if (context-&gt;isContextLost())
-        {
-            gl::error(GL_OUT_OF_MEMORY);
-            return NULL;
-        }
-        else
-        {
-            return context;
-        }
-    }
-    return NULL;
-}
-
-egl::Display *getDisplay()
-{
-    Current *current = GetCurrentData();
-
-    return current-&gt;display;
-}
-
-// Records an error code
-void error(GLenum errorCode)
-{
-    gl::Context *context = glGetCurrentContext();
-
-    if (context)
-    {
-        switch (errorCode)
-        {
-          case GL_INVALID_ENUM:
-            context-&gt;recordInvalidEnum();
-            TRACE(&quot;\t! Error generated: invalid enum\n&quot;);
-            break;
-          case GL_INVALID_VALUE:
-            context-&gt;recordInvalidValue();
-            TRACE(&quot;\t! Error generated: invalid value\n&quot;);
-            break;
-          case GL_INVALID_OPERATION:
-            context-&gt;recordInvalidOperation();
-            TRACE(&quot;\t! Error generated: invalid operation\n&quot;);
-            break;
-          case GL_OUT_OF_MEMORY:
-            context-&gt;recordOutOfMemory();
-            TRACE(&quot;\t! Error generated: out of memory\n&quot;);
-            break;
-          case GL_INVALID_FRAMEBUFFER_OPERATION:
-            context-&gt;recordInvalidFramebufferOperation();
-            TRACE(&quot;\t! Error generated: invalid framebuffer operation\n&quot;);
-            break;
-          default: UNREACHABLE();
-        }
-    }
-}
-
-}
-
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2mainh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/main.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,67 +0,0 @@
</span><del>-//
-// Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// main.h: Management of thread-local data.
-
-#ifndef LIBGLESV2_MAIN_H_
-#define LIBGLESV2_MAIN_H_
-
-#include &quot;common/debug.h&quot;
-
-namespace egl
-{
-class Display;
-class Surface;
-}
-
-namespace gl
-{
-class Context;
-    
-struct Current
-{
-    Context *context;
-    egl::Display *display;
-};
-
-void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface);
-
-Context *getContext();
-Context *getNonLostContext();
-egl::Display *getDisplay();
-
-void error(GLenum errorCode);
-
-template&lt;class T&gt;
-const T &amp;error(GLenum errorCode, const T &amp;returnValue)
-{
-    error(errorCode);
-
-    return returnValue;
-}
-
-}
-
-namespace rx
-{
-class Renderer;
-}
-
-extern &quot;C&quot;
-{
-// Exported functions for use by EGL
-gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, rx::Renderer *renderer, bool notifyResets, bool robustAccess);
-void glDestroyContext(gl::Context *context);
-void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
-gl::Context *glGetCurrentContext();
-rx::Renderer *glCreateRenderer(egl::Display *display, HDC hDc, EGLNativeDisplayType displayId);
-void glDestroyRenderer(rx::Renderer *renderer);
-
-__eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname);
-bool __stdcall glBindTexImage(egl::Surface *surface);
-}
-
-#endif   // LIBGLESV2_MAIN_H_
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2precompiledcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,9 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// precompiled.cpp: Precompiled header source file for libGLESv2.
-
-#include &quot;precompiled.h&quot;
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2precompiledh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/precompiled.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,53 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// precompiled.h: Precompiled header file for libGLESv2.
-
-#define GL_APICALL
-#include &lt;GLES3/gl3.h&gt;
-#include &lt;GLES3/gl3ext.h&gt;
-#include &lt;GLES2/gl2.h&gt;
-
-#define GL_GLEXT_PROTOTYPES
-#include &lt;GLES2/gl2ext.h&gt;
-
-#define EGLAPI
-#include &lt;EGL/egl.h&gt;
-
-#include &lt;assert.h&gt;
-#include &lt;cstddef&gt;
-#include &lt;float.h&gt;
-#include &lt;stdint.h&gt;
-#include &lt;intrin.h&gt;
-#include &lt;math.h&gt;
-#include &lt;stdarg.h&gt;
-#include &lt;stdlib.h&gt;
-#include &lt;stdio.h&gt;
-#include &lt;string.h&gt;
-
-#include &lt;algorithm&gt; // for std::min and std::max
-#include &lt;limits&gt;
-#include &lt;map&gt;
-#include &lt;set&gt;
-#include &lt;sstream&gt;
-#include &lt;string&gt;
-#include &lt;unordered_map&gt;
-#include &lt;vector&gt;
-
-#if defined(ANGLE_ENABLE_D3D9)
-#include &lt;d3d9.h&gt;
-#include &lt;D3Dcompiler.h&gt;
-#endif // ANGLE_ENABLE_D3D9
-
-#if defined(ANGLE_ENABLE_D3D11)
-#include &lt;D3D10_1.h&gt;
-#include &lt;D3D11.h&gt;
-#include &lt;dxgi.h&gt;
-#if !ANGLE_SKIP_DXGI_1_2_CHECK
-#include &lt;dxgi1_2.h&gt;
-#endif
-#include &lt;D3Dcompiler.h&gt;
-#endif // ANGLE_ENABLE_D3D11
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2queryconversionscpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,148 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2014 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.
-//
-
-// queryconversions.cpp: Implementation of state query cast conversions
-
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;common/utilities.h&quot;
-
-namespace gl
-{
-
-// Helper class for converting a GL type to a GLenum:
-// We can't use CastStateValueEnum generally, because of GLboolean + GLubyte overlap.
-// We restrict our use to CastStateValue, where it eliminates duplicate parameters.
-
-template &lt;typename GLType&gt;
-struct CastStateValueEnum { static GLenum mEnumForType; };
-
-template &lt;&gt; GLenum CastStateValueEnum&lt;GLint&gt;::mEnumForType      = GL_INT;
-template &lt;&gt; GLenum CastStateValueEnum&lt;GLuint&gt;::mEnumForType     = GL_UNSIGNED_INT;
-template &lt;&gt; GLenum CastStateValueEnum&lt;GLboolean&gt;::mEnumForType  = GL_BOOL;
-template &lt;&gt; GLenum CastStateValueEnum&lt;GLint64&gt;::mEnumForType    = GL_INT_64_ANGLEX;
-template &lt;&gt; GLenum CastStateValueEnum&lt;GLfloat&gt;::mEnumForType    = GL_FLOAT;
-
-template &lt;typename QueryT, typename NativeT&gt;
-QueryT CastStateValueToInt(GLenum pname, NativeT value)
-{
-    GLenum queryType = CastStateValueEnum&lt;QueryT&gt;::mEnumForType;
-    GLenum nativeType = CastStateValueEnum&lt;NativeT&gt;::mEnumForType;
-
-    if (nativeType == GL_FLOAT)
-    {
-        // RGBA color values and DepthRangeF values are converted to integer using Equation 2.4 from Table 4.5
-        if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
-        {
-            return static_cast&lt;QueryT&gt;((static_cast&lt;GLfloat&gt;(0xFFFFFFFF) * value - 1.0f) / 2.0f);
-        }
-        else
-        {
-            return gl::iround&lt;QueryT&gt;(value);
-        }
-    }
-
-    // Clamp 64-bit int values when casting to int
-    if (nativeType == GL_INT_64_ANGLEX &amp;&amp; queryType == GL_INT)
-    {
-        GLint64 minIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;GLint&gt;::min());
-        GLint64 maxIntValue = static_cast&lt;GLint64&gt;(std::numeric_limits&lt;GLint&gt;::max());
-        GLint64 clampedValue = std::max(std::min(static_cast&lt;GLint64&gt;(value), maxIntValue), minIntValue);
-        return static_cast&lt;QueryT&gt;(clampedValue);
-    }
-
-    return static_cast&lt;QueryT&gt;(value);
-}
-
-template &lt;typename QueryT, typename NativeT&gt;
-QueryT CastStateValue(GLenum pname, NativeT value)
-{
-    GLenum queryType = CastStateValueEnum&lt;QueryT&gt;::mEnumForType;
-
-    switch (queryType)
-    {
-      case GL_INT:              return CastStateValueToInt&lt;QueryT, NativeT&gt;(pname, value);
-      case GL_INT_64_ANGLEX:    return CastStateValueToInt&lt;QueryT, NativeT&gt;(pname, value);
-      case GL_FLOAT:            return static_cast&lt;QueryT&gt;(value);
-      case GL_BOOL:             return (value == static_cast&lt;NativeT&gt;(0) ? GL_FALSE : GL_TRUE);
-      default: UNREACHABLE();   return 0;
-    }
-}
-
-template &lt;typename QueryT&gt;
-void CastStateValues(Context *context, GLenum nativeType, GLenum pname,
-                     unsigned int numParams, QueryT *outParams)
-{
-    if (nativeType == GL_INT)
-    {
-        GLint *intParams = NULL;
-        intParams = new GLint[numParams];
-
-        context-&gt;getIntegerv(pname, intParams);
-
-        for (unsigned int i = 0; i &lt; numParams; ++i)
-        {
-            outParams[i] = CastStateValue&lt;QueryT&gt;(pname, intParams[i]);
-        }
-
-        delete [] intParams;
-    }
-    else if (nativeType == GL_BOOL)
-    {
-        GLboolean *boolParams = NULL;
-        boolParams = new GLboolean[numParams];
-
-        context-&gt;getBooleanv(pname, boolParams);
-
-        for (unsigned int i = 0; i &lt; numParams; ++i)
-        {
-            outParams[i] = (boolParams[i] == GL_FALSE ? static_cast&lt;QueryT&gt;(0) : static_cast&lt;QueryT&gt;(1));
-        }
-
-        delete [] boolParams;
-    }
-    else if (nativeType == GL_FLOAT)
-    {
-        GLfloat *floatParams = NULL;
-        floatParams = new GLfloat[numParams];
-
-        context-&gt;getFloatv(pname, floatParams);
-
-        for (unsigned int i = 0; i &lt; numParams; ++i)
-        {
-            outParams[i] = CastStateValue&lt;QueryT&gt;(pname, floatParams[i]);
-        }
-
-        delete [] floatParams;
-    }
-    else if (nativeType == GL_INT_64_ANGLEX)
-    {
-        GLint64 *int64Params = NULL;
-        int64Params = new GLint64[numParams];
-
-        context-&gt;getInteger64v(pname, int64Params);
-
-        for (unsigned int i = 0; i &lt; numParams; ++i)
-        {
-            outParams[i] = CastStateValue&lt;QueryT&gt;(pname, int64Params[i]);
-        }
-
-        delete [] int64Params;
-    }
-    else UNREACHABLE();
-}
-
-// Explicit template instantiation (how we export template functions in different files)
-// The calls below will make CastStateValues successfully link with the GL state query types
-// The GL state query API types are: bool, int, uint, float, int64
-
-template void CastStateValues&lt;GLboolean&gt;(Context *, GLenum, GLenum, unsigned int, GLboolean *);
-template void CastStateValues&lt;GLint&gt;(Context *, GLenum, GLenum, unsigned int, GLint *);
-template void CastStateValues&lt;GLuint&gt;(Context *, GLenum, GLenum, unsigned int, GLuint *);
-template void CastStateValues&lt;GLfloat&gt;(Context *, GLenum, GLenum, unsigned int, GLfloat *);
-template void CastStateValues&lt;GLint64&gt;(Context *, GLenum, GLenum, unsigned int, GLint64 *);
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2queryconversionsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/queryconversions.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,17 +0,0 @@
</span><del>-//
-// Copyright (c) 2014 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.
-//
-
-// queryconversions.h: Declaration of state query cast conversions
-
-namespace gl
-{
-
-// The GL state query API types are: bool, int, uint, float, int64
-template &lt;typename QueryT&gt;
-void CastStateValues(Context *context, GLenum nativeType, GLenum pname,
-                     unsigned int numParams, QueryT *outParams);
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2validationEScpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,875 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-
-// validationES.h: Validation functions for generic OpenGL ES entry point parameters
-
-#include &quot;libGLESv2/validationES.h&quot;
-#include &quot;libGLESv2/validationES2.h&quot;
-#include &quot;libGLESv2/validationES3.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/Framebuffer.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/main.h&quot;
-
-#include &quot;common/mathutil.h&quot;
-#include &quot;common/utilities.h&quot;
-
-namespace gl
-{
-
-bool ValidCap(const Context *context, GLenum cap)
-{
-    switch (cap)
-    {
-      case GL_CULL_FACE:
-      case GL_POLYGON_OFFSET_FILL:
-      case GL_SAMPLE_ALPHA_TO_COVERAGE:
-      case GL_SAMPLE_COVERAGE:
-      case GL_SCISSOR_TEST:
-      case GL_STENCIL_TEST:
-      case GL_DEPTH_TEST:
-      case GL_BLEND:
-      case GL_DITHER:
-        return true;
-      case GL_PRIMITIVE_RESTART_FIXED_INDEX:
-      case GL_RASTERIZER_DISCARD:
-        return (context-&gt;getClientVersion() &gt;= 3);
-      default:
-        return false;
-    }
-}
-
-bool ValidTextureTarget(const Context *context, GLenum target)
-{
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-      case GL_TEXTURE_CUBE_MAP:
-        return true;
-
-      case GL_TEXTURE_3D:
-      case GL_TEXTURE_2D_ARRAY:
-        return (context-&gt;getClientVersion() &gt;= 3);
-
-      default:
-        return false;
-    }
-}
-
-// This function differs from ValidTextureTarget in that the target must be
-// usable as the destination of a 2D operation-- so a cube face is valid, but
-// GL_TEXTURE_CUBE_MAP is not.
-bool ValidTexture2DDestinationTarget(const Context *context, GLenum target)
-{
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-      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:
-        return true;
-      case GL_TEXTURE_2D_ARRAY:
-      case GL_TEXTURE_3D:
-        return (context-&gt;getClientVersion() &gt;= 3);
-      default:
-        return false;
-    }
-}
-
-bool ValidFramebufferTarget(GLenum target)
-{
-    META_ASSERT(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER &amp;&amp; GL_READ_FRAMEBUFFER_ANGLE == GL_READ_FRAMEBUFFER);
-
-    switch (target)
-    {
-      case GL_FRAMEBUFFER:      return true;
-      case GL_READ_FRAMEBUFFER: return true;
-      case GL_DRAW_FRAMEBUFFER: return true;
-      default:                  return false;
-    }
-}
-
-bool ValidBufferTarget(const Context *context, GLenum target)
-{
-    switch (target)
-    {
-      case GL_ARRAY_BUFFER:
-      case GL_ELEMENT_ARRAY_BUFFER:
-        return true;
-
-      case GL_PIXEL_PACK_BUFFER:
-      case GL_PIXEL_UNPACK_BUFFER:
-      case GL_COPY_READ_BUFFER:
-      case GL_COPY_WRITE_BUFFER:
-      case GL_TRANSFORM_FEEDBACK_BUFFER:
-      case GL_UNIFORM_BUFFER:
-        return (context-&gt;getClientVersion() &gt;= 3);
-
-      default:
-        return false;
-    }
-}
-
-bool ValidBufferParameter(const Context *context, GLenum pname)
-{
-    switch (pname)
-    {
-      case GL_BUFFER_USAGE:
-      case GL_BUFFER_SIZE:
-        return true;
-
-      // GL_BUFFER_MAP_POINTER is a special case, and may only be
-      // queried with GetBufferPointerv
-      case GL_BUFFER_ACCESS_FLAGS:
-      case GL_BUFFER_MAPPED:
-      case GL_BUFFER_MAP_OFFSET:
-      case GL_BUFFER_MAP_LENGTH:
-        return (context-&gt;getClientVersion() &gt;= 3);
-
-      default:
-        return false;
-    }
-}
-
-bool ValidMipLevel(const Context *context, GLenum target, GLint level)
-{
-    int maxLevel = 0;
-    switch (target)
-    {
-      case GL_TEXTURE_2D:                  maxLevel = context-&gt;getMaximum2DTextureLevel();      break;
-      case GL_TEXTURE_CUBE_MAP:
-      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: maxLevel = context-&gt;getMaximumCubeTextureLevel();    break;
-      case GL_TEXTURE_3D:                  maxLevel = context-&gt;getMaximum3DTextureLevel();      break;
-      case GL_TEXTURE_2D_ARRAY:            maxLevel = context-&gt;getMaximum2DArrayTextureLevel(); break;
-      default: UNREACHABLE();
-    }
-
-    return level &lt; maxLevel;
-}
-
-bool ValidImageSize(const gl::Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth)
-{
-    if (level &lt; 0 || width &lt; 0 || height &lt; 0 || depth &lt; 0)
-    {
-        return false;
-    }
-
-    if (!context-&gt;supportsNonPower2Texture() &amp;&amp; (level != 0 || !gl::isPow2(width) || !gl::isPow2(height) || !gl::isPow2(depth)))
-    {
-        return false;
-    }
-
-    if (!ValidMipLevel(context, target, level))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ValidCompressedImageSize(const gl::Context *context, GLenum internalFormat, GLsizei width, GLsizei height)
-{
-    GLuint clientVersion = context-&gt;getClientVersion();
-    if (!IsFormatCompressed(internalFormat, clientVersion))
-    {
-        return false;
-    }
-
-    GLint blockWidth = GetCompressedBlockWidth(internalFormat, clientVersion);
-    GLint blockHeight = GetCompressedBlockHeight(internalFormat, clientVersion);
-    if (width  &lt; 0 || (width  &gt; blockWidth  &amp;&amp; width  % blockWidth  != 0) ||
-        height &lt; 0 || (height &gt; blockHeight &amp;&amp; height % blockHeight != 0))
-    {
-        return false;
-    }
-
-    return true;
-}
-
-bool ValidQueryType(const Context *context, GLenum queryType)
-{
-    META_ASSERT(GL_ANY_SAMPLES_PASSED == GL_ANY_SAMPLES_PASSED_EXT);
-    META_ASSERT(GL_ANY_SAMPLES_PASSED_CONSERVATIVE == GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT);
-
-    switch (queryType)
-    {
-      case GL_ANY_SAMPLES_PASSED:
-      case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
-        return true;
-      case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
-        return (context-&gt;getClientVersion() &gt;= 3);
-      default:
-        return false;
-    }
-}
-
-bool ValidProgram(const Context *context, GLuint id)
-{
-    // ES3 spec (section 2.11.1) -- &quot;Commands that accept shader or program object names will generate the
-    // error INVALID_VALUE if the provided name is not the name of either a shader or program object and
-    // INVALID_OPERATION if the provided name identifies an object that is not the expected type.&quot;
-
-    if (context-&gt;getProgram(id) != NULL)
-    {
-        return true;
-    }
-    else if (context-&gt;getShader(id) != NULL)
-    {
-        // ID is the wrong type
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-    else
-    {
-        // No shader/program object has this ID
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-}
-
-bool ValidateRenderbufferStorageParameters(const gl::Context *context, GLenum target, GLsizei samples,
-                                           GLenum internalformat, GLsizei width, GLsizei height,
-                                           bool angleExtension)
-{
-    switch (target)
-    {
-      case GL_RENDERBUFFER:
-        break;
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (width &lt; 0 || height &lt; 0 || samples &lt; 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (!gl::IsValidInternalFormat(internalformat, context))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    // ANGLE_framebuffer_multisample does not explicitly state that the internal format must be
-    // sized but it does state that the format must be in the ES2.0 spec table 4.5 which contains
-    // only sized internal formats. The ES3 spec (section 4.4.2) does, however, state that the
-    // internal format must be sized and not an integer format if samples is greater than zero.
-    if (!gl::IsSizedInternalFormat(internalformat, context-&gt;getClientVersion()))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    GLenum componentType = gl::GetComponentType(internalformat, context-&gt;getClientVersion());
-    if ((componentType == GL_UNSIGNED_INT || componentType == GL_INT) &amp;&amp; samples &gt; 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (!gl::IsColorRenderingSupported(internalformat, context) &amp;&amp;
-        !gl::IsDepthRenderingSupported(internalformat, context) &amp;&amp;
-        !gl::IsStencilRenderingSupported(internalformat, context))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (std::max(width, height) &gt; context-&gt;getMaximumRenderbufferDimension())
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    // ANGLE_framebuffer_multisample states that the value of samples must be less than or equal
-    // to MAX_SAMPLES_ANGLE (Context::getMaxSupportedSamples) while the ES3.0 spec (section 4.4.2)
-    // states that samples must be less than or equal to the maximum samples for the specified
-    // internal format.
-    if (angleExtension)
-    {
-        if (samples &gt; context-&gt;getMaxSupportedSamples())
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-    }
-    else
-    {
-        if (samples &gt; context-&gt;getMaxSupportedFormatSamples(internalformat))
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-    }
-
-    GLuint handle = context-&gt;getRenderbufferHandle();
-    if (handle == 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    return true;
-}
-
-bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum target, GLenum attachment,
-                                               GLenum renderbuffertarget, GLuint renderbuffer)
-{
-    gl::Framebuffer *framebuffer = context-&gt;getTargetFramebuffer(target);
-    GLuint framebufferHandle = context-&gt;getTargetFramebufferHandle(target);
-
-    if (!framebuffer || (framebufferHandle == 0 &amp;&amp; renderbuffer != 0))
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (attachment &gt;= GL_COLOR_ATTACHMENT0_EXT &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15_EXT)
-    {
-        const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT);
-
-        if (colorAttachment &gt;= context-&gt;getMaximumRenderTargets())
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-    }
-    else
-    {
-        switch (attachment)
-        {
-          case GL_DEPTH_ATTACHMENT:
-            break;
-          case GL_STENCIL_ATTACHMENT:
-            break;
-          case GL_DEPTH_STENCIL_ATTACHMENT:
-            if (context-&gt;getClientVersion() &lt; 3)
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-    }
-
-    // [OpenGL ES 2.0.25] Section 4.4.3 page 112
-    // [OpenGL ES 3.0.2] Section 4.4.2 page 201
-    // 'renderbuffer' must be either zero or the name of an existing renderbuffer object of
-    // type 'renderbuffertarget', otherwise an INVALID_OPERATION error is generated.
-    if (renderbuffer != 0)
-    {
-        if (!context-&gt;getRenderbuffer(renderbuffer))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    return true;
-}
-
-static bool IsPartialBlit(gl::Context *context, gl::Renderbuffer *readBuffer, gl::Renderbuffer *writeBuffer,
-                          GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
-                          GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1)
-{
-    if (srcX0 != 0 || srcY0 != 0 || dstX0 != 0 || dstY0 != 0 ||
-        dstX1 != writeBuffer-&gt;getWidth() || dstY1 != writeBuffer-&gt;getHeight() ||
-        srcX1 != readBuffer-&gt;getWidth() || srcY1 != readBuffer-&gt;getHeight())
-    {
-        return true;
-    }
-    else if (context-&gt;isScissorTestEnabled())
-    {
-        int scissorX, scissorY, scissorWidth, scissorHeight;
-        context-&gt;getScissorParams(&amp;scissorX, &amp;scissorY, &amp;scissorWidth, &amp;scissorHeight);
-
-        return scissorX &gt; 0 || scissorY &gt; 0 ||
-               scissorWidth &lt; writeBuffer-&gt;getWidth() ||
-               scissorHeight &lt; writeBuffer-&gt;getHeight();
-    }
-    else
-    {
-        return false;
-    }
-}
-
-bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
-                                       GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
-                                       GLenum filter, bool fromAngleExtension)
-{
-    switch (filter)
-    {
-      case GL_NEAREST:
-        break;
-      case GL_LINEAR:
-        if (fromAngleExtension)
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if ((mask &amp; ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (mask == 0)
-    {
-        // ES3.0 spec, section 4.3.2 specifies that a mask of zero is valid and no
-        // buffers are copied.
-        return false;
-    }
-
-    if (fromAngleExtension &amp;&amp; (srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0))
-    {
-        ERR(&quot;Scaling and flipping in BlitFramebufferANGLE not supported by this implementation.&quot;);
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    // ES3.0 spec, section 4.3.2 states that linear filtering is only available for the
-    // color buffer, leaving only nearest being unfiltered from above
-    if ((mask &amp; ~GL_COLOR_BUFFER_BIT) != 0 &amp;&amp; filter != GL_NEAREST)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (context-&gt;getReadFramebufferHandle() == context-&gt;getDrawFramebufferHandle())
-    {
-        if (fromAngleExtension)
-        {
-            ERR(&quot;Blits with the same source and destination framebuffer are not supported by this &quot;
-                &quot;implementation.&quot;);
-        }
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    gl::Framebuffer *readFramebuffer = context-&gt;getReadFramebuffer();
-    gl::Framebuffer *drawFramebuffer = context-&gt;getDrawFramebuffer();
-    if (!readFramebuffer || readFramebuffer-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE ||
-        !drawFramebuffer || drawFramebuffer-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
-    }
-
-    if (drawFramebuffer-&gt;getSamples() != 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    bool sameBounds = srcX0 == dstX0 &amp;&amp; srcY0 == dstY0 &amp;&amp; srcX1 == dstX1 &amp;&amp; srcY1 == dstY1;
-
-    GLuint clientVersion = context-&gt;getClientVersion();
-
-    if (mask &amp; GL_COLOR_BUFFER_BIT)
-    {
-        gl::Renderbuffer *readColorBuffer = readFramebuffer-&gt;getReadColorbuffer();
-        gl::Renderbuffer *drawColorBuffer = drawFramebuffer-&gt;getFirstColorbuffer();
-
-        if (readColorBuffer &amp;&amp; drawColorBuffer)
-        {
-            GLenum readInternalFormat = readColorBuffer-&gt;getActualFormat();
-            GLenum readComponentType = gl::GetComponentType(readInternalFormat, clientVersion);
-
-            for (unsigned int i = 0; i &lt; gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
-            {
-                if (drawFramebuffer-&gt;isEnabledColorAttachment(i))
-                {
-                    GLenum drawInternalFormat = drawFramebuffer-&gt;getColorbuffer(i)-&gt;getActualFormat();
-                    GLenum drawComponentType = gl::GetComponentType(drawInternalFormat, clientVersion);
-
-                    // The GL ES 3.0.2 spec (pg 193) states that:
-                    // 1) If the read buffer is fixed point format, the draw buffer must be as well
-                    // 2) If the read buffer is an unsigned integer format, the draw buffer must be as well
-                    // 3) If the read buffer is a signed integer format, the draw buffer must be as well
-                    if ( (readComponentType == GL_UNSIGNED_NORMALIZED || readComponentType == GL_SIGNED_NORMALIZED) &amp;&amp;
-                        !(drawComponentType == GL_UNSIGNED_NORMALIZED || drawComponentType == GL_SIGNED_NORMALIZED))
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-
-                    if (readComponentType == GL_UNSIGNED_INT &amp;&amp; drawComponentType != GL_UNSIGNED_INT)
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-
-                    if (readComponentType == GL_INT &amp;&amp; drawComponentType != GL_INT)
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-
-                    if (readColorBuffer-&gt;getSamples() &gt; 0 &amp;&amp; (readInternalFormat != drawInternalFormat || !sameBounds))
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-                }
-            }
-
-            if ((readComponentType == GL_INT || readComponentType == GL_UNSIGNED_INT) &amp;&amp; filter == GL_LINEAR)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-
-            if (fromAngleExtension)
-            {
-                const GLenum readColorbufferType = readFramebuffer-&gt;getReadColorbufferType();
-                if (readColorbufferType != GL_TEXTURE_2D &amp;&amp; readColorbufferType != GL_RENDERBUFFER)
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-
-                for (unsigned int colorAttachment = 0; colorAttachment &lt; gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
-                {
-                    if (drawFramebuffer-&gt;isEnabledColorAttachment(colorAttachment))
-                    {
-                        if (drawFramebuffer-&gt;getColorbufferType(colorAttachment) != GL_TEXTURE_2D &amp;&amp;
-                            drawFramebuffer-&gt;getColorbufferType(colorAttachment) != GL_RENDERBUFFER)
-                        {
-                            return gl::error(GL_INVALID_OPERATION, false);
-                        }
-
-                        if (drawFramebuffer-&gt;getColorbuffer(colorAttachment)-&gt;getActualFormat() != readColorBuffer-&gt;getActualFormat())
-                        {
-                            return gl::error(GL_INVALID_OPERATION, false);
-                        }
-                    }
-                }
-                if (readFramebuffer-&gt;getSamples() != 0 &amp;&amp; IsPartialBlit(context, readColorBuffer, drawColorBuffer,
-                                                                        srcX0, srcY0, srcX1, srcY1,
-                                                                        dstX0, dstY0, dstX1, dstY1))
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-            }
-        }
-    }
-
-    if (mask &amp; GL_DEPTH_BUFFER_BIT)
-    {
-        gl::Renderbuffer *readDepthBuffer = readFramebuffer-&gt;getDepthbuffer();
-        gl::Renderbuffer *drawDepthBuffer = drawFramebuffer-&gt;getDepthbuffer();
-
-        if (readDepthBuffer &amp;&amp; drawDepthBuffer)
-        {
-            if (readDepthBuffer-&gt;getActualFormat() != drawDepthBuffer-&gt;getActualFormat())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-
-            if (readDepthBuffer-&gt;getSamples() &gt; 0 &amp;&amp; !sameBounds)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-
-            if (fromAngleExtension)
-            {
-                if (IsPartialBlit(context, readDepthBuffer, drawDepthBuffer,
-                                  srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
-                {
-                    ERR(&quot;Only whole-buffer depth and stencil blits are supported by this implementation.&quot;);
-                    return gl::error(GL_INVALID_OPERATION, false); // only whole-buffer copies are permitted
-                }
-
-                if (readDepthBuffer-&gt;getSamples() != 0 || drawDepthBuffer-&gt;getSamples() != 0)
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-            }
-        }
-    }
-
-    if (mask &amp; GL_STENCIL_BUFFER_BIT)
-    {
-        gl::Renderbuffer *readStencilBuffer = readFramebuffer-&gt;getStencilbuffer();
-        gl::Renderbuffer *drawStencilBuffer = drawFramebuffer-&gt;getStencilbuffer();
-
-        if (readStencilBuffer &amp;&amp; drawStencilBuffer)
-        {
-            if (readStencilBuffer-&gt;getActualFormat() != drawStencilBuffer-&gt;getActualFormat())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-
-            if (readStencilBuffer-&gt;getSamples() &gt; 0 &amp;&amp; !sameBounds)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-
-            if (fromAngleExtension)
-            {
-                if (IsPartialBlit(context, readStencilBuffer, drawStencilBuffer,
-                                  srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1))
-                {
-                    ERR(&quot;Only whole-buffer depth and stencil blits are supported by this implementation.&quot;);
-                    return gl::error(GL_INVALID_OPERATION, false); // only whole-buffer copies are permitted
-                }
-
-                if (readStencilBuffer-&gt;getSamples() != 0 || drawStencilBuffer-&gt;getSamples() != 0)
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-            }
-        }
-    }
-
-    return true;
-}
-
-bool ValidateGetVertexAttribParameters(GLenum pname, int clientVersion)
-{
-    switch (pname)
-    {
-      case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
-      case GL_VERTEX_ATTRIB_ARRAY_SIZE:
-      case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
-      case GL_VERTEX_ATTRIB_ARRAY_TYPE:
-      case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
-      case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
-      case GL_CURRENT_VERTEX_ATTRIB:
-        return true;
-
-      case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
-        // Don't verify ES3 context because GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE uses
-        // the same constant.
-        META_ASSERT(GL_VERTEX_ATTRIB_ARRAY_DIVISOR == GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE);
-        return true;
-
-      case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
-        return ((clientVersion &gt;= 3) ? true : gl::error(GL_INVALID_ENUM, false));
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-}
-
-bool ValidateTexParamParameters(gl::Context *context, GLenum pname, GLint param)
-{
-    switch (pname)
-    {
-      case GL_TEXTURE_WRAP_R:
-      case GL_TEXTURE_SWIZZLE_R:
-      case GL_TEXTURE_SWIZZLE_G:
-      case GL_TEXTURE_SWIZZLE_B:
-      case GL_TEXTURE_SWIZZLE_A:
-      case GL_TEXTURE_BASE_LEVEL:
-      case GL_TEXTURE_MAX_LEVEL:
-      case GL_TEXTURE_COMPARE_MODE:
-      case GL_TEXTURE_COMPARE_FUNC:
-      case GL_TEXTURE_MIN_LOD:
-      case GL_TEXTURE_MAX_LOD:
-        if (context-&gt;getClientVersion() &lt; 3)
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-
-      default: break;
-    }
-
-    switch (pname)
-    {
-      case GL_TEXTURE_WRAP_S:
-      case GL_TEXTURE_WRAP_T:
-      case GL_TEXTURE_WRAP_R:
-        switch (param)
-        {
-          case GL_REPEAT:
-          case GL_CLAMP_TO_EDGE:
-          case GL_MIRRORED_REPEAT:
-            return true;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-
-      case GL_TEXTURE_MIN_FILTER:
-        switch (param)
-        {
-          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:
-            return true;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-
-      case GL_TEXTURE_MAG_FILTER:
-        switch (param)
-        {
-          case GL_NEAREST:
-          case GL_LINEAR:
-            return true;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-
-      case GL_TEXTURE_USAGE_ANGLE:
-        switch (param)
-        {
-          case GL_NONE:
-          case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
-            return true;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-
-      case GL_TEXTURE_MAX_ANISOTROPY_EXT:
-        if (!context-&gt;supportsTextureFilterAnisotropy())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-
-        // we assume the parameter passed to this validation method is truncated, not rounded
-        if (param &lt; 1)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-        return true;
-
-      case GL_TEXTURE_MIN_LOD:
-      case GL_TEXTURE_MAX_LOD:
-        // any value is permissible
-        return true;
-
-      case GL_TEXTURE_COMPARE_MODE:
-        // Acceptable mode parameters from GLES 3.0.2 spec, table 3.17
-        switch (param)
-        {
-          case GL_NONE:
-          case GL_COMPARE_REF_TO_TEXTURE:
-            return true;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-
-      case GL_TEXTURE_COMPARE_FUNC:
-        // Acceptable function parameters from GLES 3.0.2 spec, table 3.17
-        switch (param)
-        {
-          case GL_LEQUAL:
-          case GL_GEQUAL:
-          case GL_LESS:
-          case GL_GREATER:
-          case GL_EQUAL:
-          case GL_NOTEQUAL:
-          case GL_ALWAYS:
-          case GL_NEVER:
-            return true;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-
-      case GL_TEXTURE_SWIZZLE_R:
-      case GL_TEXTURE_SWIZZLE_G:
-      case GL_TEXTURE_SWIZZLE_B:
-      case GL_TEXTURE_SWIZZLE_A:
-        switch (param)
-        {
-          case GL_RED:
-          case GL_GREEN:
-          case GL_BLUE:
-          case GL_ALPHA:
-          case GL_ZERO:
-          case GL_ONE:
-            return true;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-
-      case GL_TEXTURE_BASE_LEVEL:
-      case GL_TEXTURE_MAX_LEVEL:
-        if (param &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-        return true;
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-}
-
-bool ValidateSamplerObjectParameter(GLenum pname)
-{
-    switch (pname)
-    {
-      case GL_TEXTURE_MIN_FILTER:
-      case GL_TEXTURE_MAG_FILTER:
-      case GL_TEXTURE_WRAP_S:
-      case GL_TEXTURE_WRAP_T:
-      case GL_TEXTURE_WRAP_R:
-      case GL_TEXTURE_MIN_LOD:
-      case GL_TEXTURE_MAX_LOD:
-      case GL_TEXTURE_COMPARE_MODE:
-      case GL_TEXTURE_COMPARE_FUNC:
-        return true;
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-}
-
-bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsizei width, GLsizei height,
-                                  GLenum format, GLenum type, GLsizei *bufSize, GLvoid *pixels)
-{
-    gl::Framebuffer *framebuffer = context-&gt;getReadFramebuffer();
-
-    if (framebuffer-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
-    }
-
-    if (context-&gt;getReadFramebufferHandle() != 0 &amp;&amp; framebuffer-&gt;getSamples() != 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    GLenum currentInternalFormat, currentFormat, currentType;
-    int clientVersion = context-&gt;getClientVersion();
-
-    // Failure in getCurrentReadFormatType indicates that no color attachment is currently bound,
-    // and attempting to read back if that's the case is an error. The error will be registered
-    // by getCurrentReadFormat.
-    // Note: we need to explicitly check for framebuffer completeness here, before we call
-    // getCurrentReadFormatType, because it generates a different (wrong) error for incomplete FBOs
-    if (!context-&gt;getCurrentReadFormatType(&amp;currentInternalFormat, &amp;currentFormat, &amp;currentType))
-        return false;
-
-    bool validReadFormat = (clientVersion &lt; 3) ? ValidES2ReadFormatType(context, format, type) :
-                                                 ValidES3ReadFormatType(context, currentInternalFormat, format, type);
-
-    if (!(currentFormat == format &amp;&amp; currentType == type) &amp;&amp; !validReadFormat)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format :
-                                 GetSizedInternalFormat(format, type, clientVersion);
-
-    GLsizei outputPitch = GetRowPitch(sizedInternalFormat, type, clientVersion, width, context-&gt;getPackAlignment());
-    // sized query sanity check
-    if (bufSize)
-    {
-        int requiredSize = outputPitch * height;
-        if (requiredSize &gt; *bufSize)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    return true;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2validationESh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,50 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// validationES.h: Validation functions for generic OpenGL ES entry point parameters
-
-#ifndef LIBGLESV2_VALIDATION_ES_H
-#define LIBGLESV2_VALIDATION_ES_H
-
-namespace gl
-{
-
-class Context;
-
-bool ValidCap(const Context *context, GLenum cap);
-bool ValidTextureTarget(const Context *context, GLenum target);
-bool ValidTexture2DDestinationTarget(const Context *context, GLenum target);
-bool ValidFramebufferTarget(GLenum target);
-bool ValidBufferTarget(const Context *context, GLenum target);
-bool ValidBufferParameter(const Context *context, GLenum pname);
-bool ValidMipLevel(const Context *context, GLenum target, GLint level);
-bool ValidImageSize(const gl::Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth);
-bool ValidCompressedImageSize(const gl::Context *context, GLenum internalFormat, GLsizei width, GLsizei height);
-bool ValidQueryType(const gl::Context *context, GLenum queryType);
-bool ValidProgram(const gl::Context *context, GLuint id);
-
-bool ValidateRenderbufferStorageParameters(const gl::Context *context, GLenum target, GLsizei samples,
-                                           GLenum internalformat, GLsizei width, GLsizei height,
-                                           bool angleExtension);
-bool ValidateFramebufferRenderbufferParameters(gl::Context *context, GLenum target, GLenum attachment,
-                                               GLenum renderbuffertarget, GLuint renderbuffer);
-
-bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
-                                       GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask,
-                                       GLenum filter, bool fromAngleExtension);
-
-bool ValidateGetVertexAttribParameters(GLenum pname, int clientVersion);
-
-bool ValidateTexParamParameters(gl::Context *context, GLenum pname, GLint param);
-
-bool ValidateSamplerObjectParameter(GLenum pname);
-
-bool ValidateReadPixelsParameters(gl::Context *context, GLint x, GLint y, GLsizei width, GLsizei height,
-                                  GLenum format, GLenum type, GLsizei *bufSize, GLvoid *pixels);
-
-}
-
-#endif // LIBGLESV2_VALIDATION_ES_H
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2validationES2cpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,1092 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-
-// validationES2.cpp: Validation functions for OpenGL ES 2.0 entry point parameters
-
-#include &quot;libGLESv2/validationES2.h&quot;
-#include &quot;libGLESv2/validationES.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/Framebuffer.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/main.h&quot;
-
-#include &quot;common/mathutil.h&quot;
-#include &quot;common/utilities.h&quot;
-
-namespace gl
-{
-
-static bool validateSubImageParams2D(bool compressed, GLsizei width, GLsizei height,
-                                     GLint xoffset, GLint yoffset, GLint level, GLenum format, GLenum type,
-                                     gl::Texture2D *texture)
-{
-    if (!texture)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (compressed != texture-&gt;isCompressed(level))
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (format != GL_NONE)
-    {
-        GLenum internalformat = gl::GetSizedInternalFormat(format, type, 2);
-        if (internalformat != texture-&gt;getInternalFormat(level))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    if (compressed)
-    {
-        if ((width % 4 != 0 &amp;&amp; width != texture-&gt;getWidth(0)) ||
-            (height % 4 != 0 &amp;&amp; height != texture-&gt;getHeight(0)))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    if (xoffset + width &gt; texture-&gt;getWidth(level) ||
-        yoffset + height &gt; texture-&gt;getHeight(level))
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    return true;
-}
-
-static bool validateSubImageParamsCube(bool compressed, GLsizei width, GLsizei height,
-                                       GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, GLenum type,
-                                       gl::TextureCubeMap *texture)
-{
-    if (!texture)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (compressed != texture-&gt;isCompressed(target, level))
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (format != GL_NONE)
-    {
-        GLenum internalformat = gl::GetSizedInternalFormat(format, type, 2);
-        if (internalformat != texture-&gt;getInternalFormat(target, level))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    if (compressed)
-    {
-        if ((width % 4 != 0 &amp;&amp; width != texture-&gt;getWidth(target, 0)) ||
-            (height % 4 != 0 &amp;&amp; height != texture-&gt;getHeight(target, 0)))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    if (xoffset + width &gt; texture-&gt;getWidth(target, level) ||
-        yoffset + height &gt; texture-&gt;getHeight(target, level))
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    return true;
-}
-
-bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
-                                   GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
-    if (!ValidImageSize(context, target, level, width, height, 1))
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (level &lt; 0 || xoffset &lt; 0 ||
-        std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width ||
-        std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (!isSubImage &amp;&amp; !isCompressed &amp;&amp; internalformat != format)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    gl::Texture *texture = NULL;
-    bool textureCompressed = false;
-    GLenum textureInternalFormat = GL_NONE;
-    GLint textureLevelWidth = 0;
-    GLint textureLevelHeight = 0;
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-        {
-            if (width &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level) ||
-                height &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            gl::Texture2D *tex2d = context-&gt;getTexture2D();
-            if (tex2d)
-            {
-                textureCompressed = tex2d-&gt;isCompressed(level);
-                textureInternalFormat = tex2d-&gt;getInternalFormat(level);
-                textureLevelWidth = tex2d-&gt;getWidth(level);
-                textureLevelHeight = tex2d-&gt;getHeight(level);
-                texture = tex2d;
-            }
-
-            if (isSubImage &amp;&amp; !validateSubImageParams2D(isCompressed, width, height, xoffset, yoffset,
-                                                        level, format, type, tex2d))
-            {
-                return false;
-            }
-
-            texture = tex2d;
-        }
-        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 (!isSubImage &amp;&amp; width != height)
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            if (width &gt; (context-&gt;getMaximumCubeTextureDimension() &gt;&gt; level) ||
-                height &gt; (context-&gt;getMaximumCubeTextureDimension() &gt;&gt; level))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            gl::TextureCubeMap *texCube = context-&gt;getTextureCubeMap();
-            if (texCube)
-            {
-                textureCompressed = texCube-&gt;isCompressed(target, level);
-                textureInternalFormat = texCube-&gt;getInternalFormat(target, level);
-                textureLevelWidth = texCube-&gt;getWidth(target, level);
-                textureLevelHeight = texCube-&gt;getHeight(target, level);
-                texture = texCube;
-            }
-
-            if (isSubImage &amp;&amp; !validateSubImageParamsCube(isCompressed, width, height, xoffset, yoffset,
-                                                          target, level, format, type, texCube))
-            {
-                return false;
-            }
-        }
-        break;
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (!texture)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (!isSubImage &amp;&amp; texture-&gt;isImmutable())
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    // Verify zero border
-    if (border != 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    GLenum actualInternalFormat = isSubImage ? textureInternalFormat : internalformat;
-    if (isCompressed)
-    {
-        if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        switch (actualInternalFormat)
-        {
-          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-            if (!context-&gt;supportsDXT1Textures())
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-            if (!context-&gt;supportsDXT3Textures())
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-            if (!context-&gt;supportsDXT5Textures())
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-    }
-    else
-    {
-        // validate &lt;type&gt; 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 gl::error(GL_INVALID_ENUM, false);
-        }
-
-        // validate &lt;format&gt; + &lt;type&gt; combinations
-        // - invalid &lt;format&gt; -&gt; sets INVALID_ENUM
-        // - invalid &lt;format&gt;+&lt;type&gt; combination -&gt; 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 gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_RED:
-              if (!context-&gt;supportsRGTextures())
-              {
-                  return gl::error(GL_INVALID_ENUM, false);
-              }
-              switch (type)
-              {
-                case GL_UNSIGNED_BYTE:
-                case GL_FLOAT:
-                case GL_HALF_FLOAT_OES:
-                  break;
-                default:
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              break;
-          case GL_RG:
-              if (!context-&gt;supportsRGTextures())
-              {
-                  return gl::error(GL_INVALID_ENUM, false);
-              }
-              switch (type)
-              {
-              case GL_UNSIGNED_BYTE:
-              case GL_FLOAT:
-              case GL_HALF_FLOAT_OES:
-                  break;
-              default:
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              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 gl::error(GL_INVALID_OPERATION, false);
-            }
-            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 gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_BGRA_EXT:
-            switch (type)
-            {
-              case GL_UNSIGNED_BYTE:
-                break;
-              default:
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            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 gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_DEPTH_STENCIL_OES:
-            switch (type)
-            {
-              case GL_UNSIGNED_INT_24_8_OES:
-                break;
-              default:
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-
-        switch (format)
-        {
-          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-            if (context-&gt;supportsDXT1Textures())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            else
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-            if (context-&gt;supportsDXT3Textures())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            else
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-            if (context-&gt;supportsDXT5Textures())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            else
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          case GL_DEPTH_COMPONENT:
-          case GL_DEPTH_STENCIL_OES:
-            if (!context-&gt;supportsDepthTextures())
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-            if (target != GL_TEXTURE_2D)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            // OES_depth_texture supports loading depth data and multiple levels,
-            // but ANGLE_depth_texture does not
-            if (pixels != NULL || level != 0)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          default:
-            break;
-        }
-
-        if (type == GL_FLOAT)
-        {
-            if (!context-&gt;supportsFloat32Textures())
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-        }
-        else if (type == GL_HALF_FLOAT_OES)
-        {
-            if (!context-&gt;supportsFloat16Textures())
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-        }
-    }
-
-    return true;
-}
-
-
-
-bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
-                                       GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height,
-                                       GLint border)
-{
-    if (!ValidTexture2DDestinationTarget(context, target))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (!gl::IsInternalTextureTarget(target, context-&gt;getClientVersion()))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (level &lt; 0 || xoffset &lt; 0 || yoffset &lt; 0 || width &lt; 0 || height &lt; 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width || std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    // Verify zero border
-    if (border != 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    // Validate dimensions based on Context limits and validate the texture
-    if (!ValidMipLevel(context, target, level))
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    gl::Framebuffer *framebuffer = context-&gt;getReadFramebuffer();
-
-    if (framebuffer-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
-    }
-
-    if (context-&gt;getReadFramebufferHandle() != 0 &amp;&amp; framebuffer-&gt;getSamples() != 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    GLenum colorbufferFormat = framebuffer-&gt;getReadColorbuffer()-&gt;getInternalFormat();
-    gl::Texture *texture = NULL;
-    GLenum textureFormat = GL_RGBA;
-
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-        {
-            if (width &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level) ||
-                height &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            gl::Texture2D *tex2d = context-&gt;getTexture2D();
-            if (tex2d)
-            {
-                if (isSubImage &amp;&amp; !validateSubImageParams2D(false, width, height, xoffset, yoffset, level, GL_NONE, GL_NONE, tex2d))
-                {
-                    return false; // error already registered by validateSubImageParams
-                }
-                texture = tex2d;
-                textureFormat = gl::GetFormat(tex2d-&gt;getInternalFormat(level), context-&gt;getClientVersion());
-            }
-        }
-        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 (!isSubImage &amp;&amp; width != height)
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            if (width &gt; (context-&gt;getMaximumCubeTextureDimension() &gt;&gt; level) ||
-                height &gt; (context-&gt;getMaximumCubeTextureDimension() &gt;&gt; level))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            gl::TextureCubeMap *texcube = context-&gt;getTextureCubeMap();
-            if (texcube)
-            {
-                if (isSubImage &amp;&amp; !validateSubImageParamsCube(false, width, height, xoffset, yoffset, target, level, GL_NONE, GL_NONE, texcube))
-                {
-                    return false; // error already registered by validateSubImageParams
-                }
-                texture = texcube;
-                textureFormat = gl::GetFormat(texcube-&gt;getInternalFormat(target, level), context-&gt;getClientVersion());
-            }
-        }
-        break;
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (!texture)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (texture-&gt;isImmutable() &amp;&amp; !isSubImage)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-
-    // [OpenGL ES 2.0.24] table 3.9
-    if (isSubImage)
-    {
-        switch (textureFormat)
-        {
-          case GL_ALPHA:
-            if (colorbufferFormat != GL_ALPHA8_EXT &amp;&amp;
-                colorbufferFormat != GL_RGBA4 &amp;&amp;
-                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                colorbufferFormat != GL_RGBA8_OES)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_LUMINANCE:
-              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGB565 &amp;&amp;
-                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                  colorbufferFormat != GL_RGBA4 &amp;&amp;
-                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                  colorbufferFormat != GL_RGBA8_OES)
-              {
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              break;
-          case GL_RED_EXT:
-              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGB565 &amp;&amp;
-                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                  colorbufferFormat != GL_RGBA4 &amp;&amp;
-                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                  colorbufferFormat != GL_RGBA8_OES)
-              {
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              break;
-          case GL_RG_EXT:
-              if (colorbufferFormat != GL_RG8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGB565 &amp;&amp;
-                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                  colorbufferFormat != GL_RGBA4 &amp;&amp;
-                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                  colorbufferFormat != GL_RGBA8_OES)
-              {
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              break;
-          case GL_RGB:
-            if (colorbufferFormat != GL_RGB565 &amp;&amp;
-                colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                colorbufferFormat != GL_RGBA4 &amp;&amp;
-                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                colorbufferFormat != GL_RGBA8_OES)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_LUMINANCE_ALPHA:
-          case GL_RGBA:
-            if (colorbufferFormat != GL_RGBA4 &amp;&amp;
-                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                colorbufferFormat != GL_RGBA8_OES)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            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 gl::error(GL_INVALID_OPERATION, false);
-          case GL_DEPTH_COMPONENT:
-          case GL_DEPTH_STENCIL_OES:
-            return gl::error(GL_INVALID_OPERATION, false);
-          default:
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-    else
-    {
-        switch (internalformat)
-        {
-          case GL_ALPHA:
-            if (colorbufferFormat != GL_ALPHA8_EXT &amp;&amp;
-                colorbufferFormat != GL_RGBA4 &amp;&amp;
-                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
-                colorbufferFormat != GL_RGBA8_OES)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_LUMINANCE:
-              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGB565 &amp;&amp;
-                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                  colorbufferFormat != GL_RGBA4 &amp;&amp;
-                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                  colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGBA8_OES)
-              {
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              break;
-          case GL_RED_EXT:
-              if (colorbufferFormat != GL_R8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RG8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGB565 &amp;&amp;
-                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                  colorbufferFormat != GL_RGBA4 &amp;&amp;
-                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                  colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGBA8_OES)
-              {
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              break;
-          case GL_RG_EXT:
-              if (colorbufferFormat != GL_RG8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGB565 &amp;&amp;
-                  colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                  colorbufferFormat != GL_RGBA4 &amp;&amp;
-                  colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                  colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
-                  colorbufferFormat != GL_RGBA8_OES)
-              {
-                  return gl::error(GL_INVALID_OPERATION, false);
-              }
-              break;
-          case GL_RGB:
-            if (colorbufferFormat != GL_RGB565 &amp;&amp;
-                colorbufferFormat != GL_RGB8_OES &amp;&amp;
-                colorbufferFormat != GL_RGBA4 &amp;&amp;
-                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
-                colorbufferFormat != GL_RGBA8_OES)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_LUMINANCE_ALPHA:
-          case GL_RGBA:
-            if (colorbufferFormat != GL_RGBA4 &amp;&amp;
-                colorbufferFormat != GL_RGB5_A1 &amp;&amp;
-                colorbufferFormat != GL_BGRA8_EXT &amp;&amp;
-                colorbufferFormat != GL_RGBA8_OES)
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            break;
-          case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-          case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-            if (context-&gt;supportsDXT1Textures())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            else
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-            if (context-&gt;supportsDXT3Textures())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            else
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            break;
-          case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-            if (context-&gt;supportsDXT5Textures())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            else
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-            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-&gt;supportsDepthTextures())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-            else
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-    }
-
-    // If width or height is zero, it is a no-op.  Return false without setting an error.
-    return (width &gt; 0 &amp;&amp; height &gt; 0);
-}
-
-bool ValidateES2TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
-                                     GLsizei width, GLsizei height)
-{
-    if (target != GL_TEXTURE_2D &amp;&amp; target != GL_TEXTURE_CUBE_MAP)
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (width &lt; 1 || height &lt; 1 || levels &lt; 1)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (target == GL_TEXTURE_CUBE_MAP &amp;&amp; width != height)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (levels != 1 &amp;&amp; levels != gl::log2(std::max(width, height)) + 1)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    GLenum format = gl::GetFormat(internalformat, context-&gt;getClientVersion());
-    GLenum type = gl::GetType(internalformat, context-&gt;getClientVersion());
-
-    if (format == GL_NONE || type == GL_NONE)
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-        if (width &gt; context-&gt;getMaximum2DTextureDimension() ||
-            height &gt; context-&gt;getMaximum2DTextureDimension())
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-        break;
-      case GL_TEXTURE_CUBE_MAP:
-        if (width &gt; context-&gt;getMaximumCubeTextureDimension() ||
-            height &gt; context-&gt;getMaximumCubeTextureDimension())
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-        break;
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (levels != 1 &amp;&amp; !context-&gt;supportsNonPower2Texture())
-    {
-        if (!gl::isPow2(width) || !gl::isPow2(height))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    switch (internalformat)
-    {
-      case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-      case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-        if (!context-&gt;supportsDXT1Textures())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-      case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
-        if (!context-&gt;supportsDXT3Textures())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-      case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
-        if (!context-&gt;supportsDXT5Textures())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-      case GL_RGBA32F_EXT:
-      case GL_RGB32F_EXT:
-      case GL_ALPHA32F_EXT:
-      case GL_LUMINANCE32F_EXT:
-      case GL_LUMINANCE_ALPHA32F_EXT:
-        if (!context-&gt;supportsFloat32Textures())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-      case GL_RGBA16F_EXT:
-      case GL_RGB16F_EXT:
-      case GL_ALPHA16F_EXT:
-      case GL_LUMINANCE16F_EXT:
-      case GL_LUMINANCE_ALPHA16F_EXT:
-        if (!context-&gt;supportsFloat16Textures())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-      case GL_R8_EXT:
-      case GL_RG8_EXT:
-      case GL_R16F_EXT:
-      case GL_RG16F_EXT:
-      case GL_R32F_EXT:
-      case GL_RG32F_EXT:
-        if (!context-&gt;supportsRGTextures())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        break;
-      case GL_DEPTH_COMPONENT16:
-      case GL_DEPTH_COMPONENT32_OES:
-      case GL_DEPTH24_STENCIL8_OES:
-        if (!context-&gt;supportsDepthTextures())
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-        if (target != GL_TEXTURE_2D)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-        // ANGLE_depth_texture only supports 1-level textures
-        if (levels != 1)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-        break;
-      default:
-        break;
-    }
-
-    gl::Texture *texture = NULL;
-    switch(target)
-    {
-      case GL_TEXTURE_2D:
-        texture = context-&gt;getTexture2D();
-        break;
-      case GL_TEXTURE_CUBE_MAP:
-        texture = context-&gt;getTextureCubeMap();
-        break;
-      default:
-        UNREACHABLE();
-    }
-
-    if (!texture || texture-&gt;id() == 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (texture-&gt;isImmutable())
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    return true;
-}
-
-bool ValidateES2FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
-                                             GLenum textarget, GLuint texture, GLint level)
-{
-    META_ASSERT(GL_DRAW_FRAMEBUFFER == GL_DRAW_FRAMEBUFFER_ANGLE &amp;&amp; GL_READ_FRAMEBUFFER == GL_READ_FRAMEBUFFER_ANGLE);
-
-    if (target != GL_FRAMEBUFFER &amp;&amp; target != GL_DRAW_FRAMEBUFFER &amp;&amp; target != GL_READ_FRAMEBUFFER)
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (attachment &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15)
-    {
-        const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0);
-        if (colorAttachment &gt;= context-&gt;getMaximumRenderTargets())
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-    }
-    else
-    {
-        switch (attachment)
-        {
-          case GL_DEPTH_ATTACHMENT:
-          case GL_STENCIL_ATTACHMENT:
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-    }
-
-    if (texture != 0)
-    {
-        gl::Texture *tex = context-&gt;getTexture(texture);
-
-        if (tex == NULL)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        switch (textarget)
-        {
-          case GL_TEXTURE_2D:
-            {
-                if (tex-&gt;getTarget() != GL_TEXTURE_2D)
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-                gl::Texture2D *tex2d = static_cast&lt;gl::Texture2D *&gt;(tex);
-                if (tex2d-&gt;isCompressed(level))
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-                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-&gt;getTarget() != GL_TEXTURE_CUBE_MAP)
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-                gl::TextureCubeMap *texcube = static_cast&lt;gl::TextureCubeMap *&gt;(tex);
-                if (texcube-&gt;isCompressed(textarget, level))
-                {
-                    return gl::error(GL_INVALID_OPERATION, false);
-                }
-                break;
-            }
-
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-
-        if (level != 0)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-    }
-
-    gl::Framebuffer *framebuffer = NULL;
-    GLuint framebufferHandle = 0;
-    if (target == GL_READ_FRAMEBUFFER)
-    {
-        framebuffer = context-&gt;getReadFramebuffer();
-        framebufferHandle = context-&gt;getReadFramebufferHandle();
-    }
-    else
-    {
-        framebuffer = context-&gt;getDrawFramebuffer();
-        framebufferHandle = context-&gt;getDrawFramebufferHandle();
-    }
-
-    if (framebufferHandle == 0 || !framebuffer)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    return true;
-}
-
-// check for combinations of format and type that are valid for ReadPixels
-bool ValidES2ReadFormatType(gl::Context *context, 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_RG_EXT:
-      case GL_RED_EXT:
-        if (!context-&gt;supportsRGTextures())
-        {
-            return false;
-        }
-        switch (type)
-        {
-          case GL_UNSIGNED_BYTE:
-            break;
-          default:
-            return false;
-        }
-        break;
-
-      default:
-        return false;
-    }
-    return true;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2validationES2h"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES2.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,35 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// validationES2.h: Validation functions for OpenGL ES 2.0 entry point parameters
-
-#ifndef LIBGLESV2_VALIDATION_ES2_H
-#define LIBGLESV2_VALIDATION_ES2_H
-
-namespace gl
-{
-
-class Context;
-
-bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
-                                   GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
-                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-
-bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLint level, GLenum internalformat, bool isSubImage,
-                                       GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height,
-                                       GLint border);
-
-bool ValidateES2TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
-                                     GLsizei width, GLsizei height);
-
-bool ValidateES2FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
-                                             GLenum textarget, GLuint texture, GLint level);
-
-bool ValidES2ReadFormatType(gl::Context *context, GLenum format, GLenum type);
-
-}
-
-#endif // LIBGLESV2_VALIDATION_ES2_H
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2validationES3cpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,868 +0,0 @@
</span><del>-#include &quot;precompiled.h&quot;
-//
-// Copyright (c) 2013 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.
-//
-
-// validationES3.cpp: Validation functions for OpenGL ES 3.0 entry point parameters
-
-#include &quot;libGLESv2/validationES3.h&quot;
-#include &quot;libGLESv2/validationES.h&quot;
-#include &quot;libGLESv2/Context.h&quot;
-#include &quot;libGLESv2/Texture.h&quot;
-#include &quot;libGLESv2/Framebuffer.h&quot;
-#include &quot;libGLESv2/Renderbuffer.h&quot;
-#include &quot;libGLESv2/formatutils.h&quot;
-#include &quot;libGLESv2/main.h&quot;
-
-#include &quot;common/mathutil.h&quot;
-
-namespace gl
-{
-
-bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
-                                   GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
-                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
-    // Validate image size
-    if (!ValidImageSize(context, target, level, width, height, depth))
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    // Verify zero border
-    if (border != 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    gl::Texture *texture = NULL;
-    bool textureCompressed = false;
-    GLenum textureInternalFormat = GL_NONE;
-    GLint textureLevelWidth = 0;
-    GLint textureLevelHeight = 0;
-    GLint textureLevelDepth = 0;
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-        {
-            if (width &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level) ||
-                height &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            gl::Texture2D *texture2d = context-&gt;getTexture2D();
-            if (texture2d)
-            {
-                textureCompressed = texture2d-&gt;isCompressed(level);
-                textureInternalFormat = texture2d-&gt;getInternalFormat(level);
-                textureLevelWidth = texture2d-&gt;getWidth(level);
-                textureLevelHeight = texture2d-&gt;getHeight(level);
-                textureLevelDepth = 1;
-                texture = texture2d;
-            }
-        }
-        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 (!isSubImage &amp;&amp; width != height)
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            if (width &gt; (context-&gt;getMaximumCubeTextureDimension() &gt;&gt; level))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            gl::TextureCubeMap *textureCube = context-&gt;getTextureCubeMap();
-            if (textureCube)
-            {
-                textureCompressed = textureCube-&gt;isCompressed(target, level);
-                textureInternalFormat = textureCube-&gt;getInternalFormat(target, level);
-                textureLevelWidth = textureCube-&gt;getWidth(target, level);
-                textureLevelHeight = textureCube-&gt;getHeight(target, level);
-                textureLevelDepth = 1;
-                texture = textureCube;
-            }
-        }
-        break;
-
-      case GL_TEXTURE_3D:
-        {
-            if (width &gt; (context-&gt;getMaximum3DTextureDimension() &gt;&gt; level) ||
-                height &gt; (context-&gt;getMaximum3DTextureDimension() &gt;&gt; level) ||
-                depth &gt; (context-&gt;getMaximum3DTextureDimension() &gt;&gt; level))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            gl::Texture3D *texture3d = context-&gt;getTexture3D();
-            if (texture3d)
-            {
-                textureCompressed = texture3d-&gt;isCompressed(level);
-                textureInternalFormat = texture3d-&gt;getInternalFormat(level);
-                textureLevelWidth = texture3d-&gt;getWidth(level);
-                textureLevelHeight = texture3d-&gt;getHeight(level);
-                textureLevelDepth = texture3d-&gt;getDepth(level);
-                texture = texture3d;
-            }
-        }
-        break;
-
-        case GL_TEXTURE_2D_ARRAY:
-          {
-              if (width &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level) ||
-                  height &gt; (context-&gt;getMaximum2DTextureDimension() &gt;&gt; level) ||
-                  depth &gt; (context-&gt;getMaximum2DArrayTextureLayers() &gt;&gt; level))
-              {
-                  return gl::error(GL_INVALID_VALUE, false);
-              }
-
-              gl::Texture2DArray *texture2darray = context-&gt;getTexture2DArray();
-              if (texture2darray)
-              {
-                  textureCompressed = texture2darray-&gt;isCompressed(level);
-                  textureInternalFormat = texture2darray-&gt;getInternalFormat(level);
-                  textureLevelWidth = texture2darray-&gt;getWidth(level);
-                  textureLevelHeight = texture2darray-&gt;getHeight(level);
-                  textureLevelDepth = texture2darray-&gt;getLayers(level);
-                  texture = texture2darray;
-              }
-          }
-          break;
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (!texture)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (texture-&gt;isImmutable() &amp;&amp; !isSubImage)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    // Validate texture formats
-    GLenum actualInternalFormat = isSubImage ? textureInternalFormat : internalformat;
-    if (isCompressed)
-    {
-        if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        if (!gl::IsFormatCompressed(actualInternalFormat, context-&gt;getClientVersion()))
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-
-        if (target == GL_TEXTURE_3D)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-    else
-    {
-        if (!gl::IsValidInternalFormat(actualInternalFormat, context) ||
-            !gl::IsValidFormat(format, context-&gt;getClientVersion()) ||
-            !gl::IsValidType(type, context-&gt;getClientVersion()))
-        {
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-
-        if (!gl::IsValidFormatCombination(actualInternalFormat, format, type, context-&gt;getClientVersion()))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        if (target == GL_TEXTURE_3D &amp;&amp; (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    // Validate sub image parameters
-    if (isSubImage)
-    {
-        if (isCompressed != textureCompressed)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        if (isCompressed)
-        {
-            if ((width % 4 != 0 &amp;&amp; width != textureLevelWidth) ||
-                (height % 4 != 0 &amp;&amp; height != textureLevelHeight))
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-        }
-
-        if (width == 0 || height == 0 || depth == 0)
-        {
-            return false;
-        }
-
-        if (xoffset &lt; 0 || yoffset &lt; 0 || zoffset &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-
-        if (std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width ||
-            std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height ||
-            std::numeric_limits&lt;GLsizei&gt;::max() - zoffset &lt; depth)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-
-        if (xoffset + width &gt; textureLevelWidth ||
-            yoffset + height &gt; textureLevelHeight ||
-            zoffset + depth &gt; textureLevelDepth)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-    }
-
-    // Check for pixel unpack buffer related API errors
-    gl::Buffer *pixelUnpackBuffer = context-&gt;getPixelUnpackBuffer();
-    if (pixelUnpackBuffer != NULL)
-    {
-        // ...the data would be unpacked from the buffer object such that the memory reads required
-        // would exceed the data store size.
-        size_t widthSize = static_cast&lt;size_t&gt;(width);
-        size_t heightSize = static_cast&lt;size_t&gt;(height);
-        size_t depthSize = static_cast&lt;size_t&gt;(depth);
-        size_t pixelBytes = static_cast&lt;size_t&gt;(gl::GetPixelBytes(actualInternalFormat, context-&gt;getClientVersion()));
-
-        if (!rx::IsUnsignedMultiplicationSafe(widthSize, heightSize) ||
-            !rx::IsUnsignedMultiplicationSafe(widthSize * heightSize, depthSize) ||
-            !rx::IsUnsignedMultiplicationSafe(widthSize * heightSize * depthSize, pixelBytes))
-        {
-            // Overflow past the end of the buffer
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        size_t copyBytes = widthSize * heightSize * depthSize * pixelBytes;
-        size_t offset = reinterpret_cast&lt;size_t&gt;(pixels);
-
-        if (!rx::IsUnsignedAdditionSafe(offset, copyBytes) || ((offset + copyBytes) &gt; static_cast&lt;size_t&gt;(pixelUnpackBuffer-&gt;size())))
-        {
-            // Overflow past the end of the buffer
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        // ...data is not evenly divisible into the number of bytes needed to store in memory a datum
-        // indicated by type.
-        size_t dataBytesPerPixel = static_cast&lt;size_t&gt;(gl::GetTypeBytes(type));
-
-        if ((offset % dataBytesPerPixel) != 0)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        // ...the buffer object's data store is currently mapped.
-        if (pixelUnpackBuffer-&gt;mapped())
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    return true;
-}
-
-bool ValidateES3CopyTexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat,
-                                       bool isSubImage, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y,
-                                       GLsizei width, GLsizei height, GLint border)
-{
-    if (!ValidTexture2DDestinationTarget(context, target))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (level &lt; 0 || xoffset &lt; 0 || yoffset &lt; 0 || zoffset &lt; 0 || width &lt; 0 || height &lt; 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (std::numeric_limits&lt;GLsizei&gt;::max() - xoffset &lt; width || std::numeric_limits&lt;GLsizei&gt;::max() - yoffset &lt; height)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (border != 0)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (!ValidMipLevel(context, target, level))
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    gl::Framebuffer *framebuffer = context-&gt;getReadFramebuffer();
-
-    if (framebuffer-&gt;completeness() != GL_FRAMEBUFFER_COMPLETE)
-    {
-        return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
-    }
-
-    if (context-&gt;getReadFramebufferHandle() != 0 &amp;&amp; framebuffer-&gt;getSamples() != 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    gl::Renderbuffer *source = framebuffer-&gt;getReadColorbuffer();
-    GLenum colorbufferInternalFormat = source-&gt;getInternalFormat();
-    gl::Texture *texture = NULL;
-    GLenum textureInternalFormat = GL_NONE;
-    bool textureCompressed = false;
-    bool textureIsDepth = false;
-    GLint textureLevelWidth = 0;
-    GLint textureLevelHeight = 0;
-    GLint textureLevelDepth = 0;
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-        {
-            gl::Texture2D *texture2d = context-&gt;getTexture2D();
-            if (texture2d)
-            {
-                textureInternalFormat = texture2d-&gt;getInternalFormat(level);
-                textureCompressed = texture2d-&gt;isCompressed(level);
-                textureIsDepth = texture2d-&gt;isDepth(level);
-                textureLevelWidth = texture2d-&gt;getWidth(level);
-                textureLevelHeight = texture2d-&gt;getHeight(level);
-                textureLevelDepth = 1;
-                texture = texture2d;
-            }
-        }
-        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:
-        {
-            gl::TextureCubeMap *textureCube = context-&gt;getTextureCubeMap();
-            if (textureCube)
-            {
-                textureInternalFormat = textureCube-&gt;getInternalFormat(target, level);
-                textureCompressed = textureCube-&gt;isCompressed(target, level);
-                textureIsDepth = false;
-                textureLevelWidth = textureCube-&gt;getWidth(target, level);
-                textureLevelHeight = textureCube-&gt;getHeight(target, level);
-                textureLevelDepth = 1;
-                texture = textureCube;
-            }
-        }
-        break;
-
-      case GL_TEXTURE_2D_ARRAY:
-        {
-            gl::Texture2DArray *texture2dArray = context-&gt;getTexture2DArray();
-            if (texture2dArray)
-            {
-                textureInternalFormat = texture2dArray-&gt;getInternalFormat(level);
-                textureCompressed = texture2dArray-&gt;isCompressed(level);
-                textureIsDepth = texture2dArray-&gt;isDepth(level);
-                textureLevelWidth = texture2dArray-&gt;getWidth(level);
-                textureLevelHeight = texture2dArray-&gt;getHeight(level);
-                textureLevelDepth = texture2dArray-&gt;getLayers(level);
-                texture = texture2dArray;
-            }
-        }
-        break;
-
-      case GL_TEXTURE_3D:
-        {
-            gl::Texture3D *texture3d = context-&gt;getTexture3D();
-            if (texture3d)
-            {
-                textureInternalFormat = texture3d-&gt;getInternalFormat(level);
-                textureCompressed = texture3d-&gt;isCompressed(level);
-                textureIsDepth = texture3d-&gt;isDepth(level);
-                textureLevelWidth = texture3d-&gt;getWidth(level);
-                textureLevelHeight = texture3d-&gt;getHeight(level);
-                textureLevelDepth = texture3d-&gt;getDepth(level);
-                texture = texture3d;
-            }
-        }
-        break;
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (!texture)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (texture-&gt;isImmutable() &amp;&amp; !isSubImage)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (textureIsDepth)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (textureCompressed)
-    {
-        if ((width % 4 != 0 &amp;&amp; width != textureLevelWidth) ||
-            (height % 4 != 0 &amp;&amp; height != textureLevelHeight))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-    if (isSubImage)
-    {
-        if (xoffset + width &gt; textureLevelWidth ||
-            yoffset + height &gt; textureLevelHeight ||
-            zoffset &gt;= textureLevelDepth)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-
-        if (!gl::IsValidCopyTexImageCombination(textureInternalFormat, colorbufferInternalFormat, context-&gt;getReadFramebufferHandle(),
-                                                context-&gt;getClientVersion()))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-    else
-    {
-        if (!gl::IsValidCopyTexImageCombination(internalformat, colorbufferInternalFormat, context-&gt;getReadFramebufferHandle(),
-                                                context-&gt;getClientVersion()))
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-    }
-
-
-
-    // If width or height is zero, it is a no-op.  Return false without setting an error.
-    return (width &gt; 0 &amp;&amp; height &gt; 0);
-}
-
-bool ValidateES3TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
-                                     GLsizei width, GLsizei height, GLsizei depth)
-{
-    if (width &lt; 1 || height &lt; 1 || depth &lt; 1 || levels &lt; 1)
-    {
-        return gl::error(GL_INVALID_VALUE, false);
-    }
-
-    if (levels &gt; gl::log2(std::max(std::max(width, height), depth)) + 1)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    gl::Texture *texture = NULL;
-    switch (target)
-    {
-      case GL_TEXTURE_2D:
-        {
-            texture = context-&gt;getTexture2D();
-
-            if (width &gt; (context-&gt;getMaximum2DTextureDimension()) ||
-                height &gt; (context-&gt;getMaximum2DTextureDimension()))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-        }
-        break;
-
-      case GL_TEXTURE_CUBE_MAP:
-        {
-            texture = context-&gt;getTextureCubeMap();
-
-            if (width != height)
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-
-            if (width &gt; (context-&gt;getMaximumCubeTextureDimension()))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-        }
-        break;
-
-      case GL_TEXTURE_3D:
-        {
-            texture = context-&gt;getTexture3D();
-
-            if (width &gt; (context-&gt;getMaximum3DTextureDimension()) ||
-                height &gt; (context-&gt;getMaximum3DTextureDimension()) ||
-                depth &gt; (context-&gt;getMaximum3DTextureDimension()))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-        }
-        break;
-
-      case GL_TEXTURE_2D_ARRAY:
-        {
-            texture = context-&gt;getTexture2DArray();
-
-            if (width &gt; (context-&gt;getMaximum2DTextureDimension()) ||
-                height &gt; (context-&gt;getMaximum2DTextureDimension()) ||
-                depth &gt; (context-&gt;getMaximum2DArrayTextureLayers()))
-            {
-                return gl::error(GL_INVALID_VALUE, false);
-            }
-        }
-        break;
-
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (!texture || texture-&gt;id() == 0)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (texture-&gt;isImmutable())
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    if (!gl::IsValidInternalFormat(internalformat, context))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (!gl::IsSizedInternalFormat(internalformat, context-&gt;getClientVersion()))
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    return true;
-}
-
-bool ValidateES3FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
-                                             GLenum textarget, GLuint texture, GLint level, GLint layer,
-                                             bool layerCall)
-{
-    if (target != GL_FRAMEBUFFER &amp;&amp; target != GL_DRAW_FRAMEBUFFER &amp;&amp; target != GL_READ_FRAMEBUFFER)
-    {
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    if (attachment &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp; attachment &lt;= GL_COLOR_ATTACHMENT15)
-    {
-        const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0);
-        if (colorAttachment &gt;= context-&gt;getMaximumRenderTargets())
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-    }
-    else
-    {
-        switch (attachment)
-        {
-          case GL_DEPTH_ATTACHMENT:
-          case GL_STENCIL_ATTACHMENT:
-          case GL_DEPTH_STENCIL_ATTACHMENT:
-            break;
-          default:
-            return gl::error(GL_INVALID_ENUM, false);
-        }
-    }
-
-    if (texture != 0)
-    {
-        gl::Texture *tex = context-&gt;getTexture(texture);
-
-        if (tex == NULL)
-        {
-            return gl::error(GL_INVALID_OPERATION, false);
-        }
-
-        if (level &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-
-        if (layer &lt; 0)
-        {
-            return gl::error(GL_INVALID_VALUE, false);
-        }
-
-        if (!layerCall)
-        {
-            switch (textarget)
-            {
-              case GL_TEXTURE_2D:
-                {
-                    if (level &gt; gl::log2(context-&gt;getMaximum2DTextureDimension()))
-                    {
-                        return gl::error(GL_INVALID_VALUE, false);
-                    }
-                    if (tex-&gt;getTarget() != GL_TEXTURE_2D)
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-                    gl::Texture2D *tex2d = static_cast&lt;gl::Texture2D *&gt;(tex);
-                    if (tex2d-&gt;isCompressed(level))
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-                    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 (level &gt; gl::log2(context-&gt;getMaximumCubeTextureDimension()))
-                    {
-                        return gl::error(GL_INVALID_VALUE, false);
-                    }
-                    if (tex-&gt;getTarget() != GL_TEXTURE_CUBE_MAP)
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-                    gl::TextureCubeMap *texcube = static_cast&lt;gl::TextureCubeMap *&gt;(tex);
-                    if (texcube-&gt;isCompressed(textarget, level))
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-                    break;
-                }
-
-              default:
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-        }
-        else
-        {
-            switch (tex-&gt;getTarget())
-            {
-              case GL_TEXTURE_2D_ARRAY:
-                {
-                    if (level &gt; gl::log2(context-&gt;getMaximum2DTextureDimension()))
-                    {
-                        return gl::error(GL_INVALID_VALUE, false);
-                    }
-
-                    if (layer &gt;= context-&gt;getMaximum2DArrayTextureLayers())
-                    {
-                        return gl::error(GL_INVALID_VALUE, false);
-                    }
-
-                    gl::Texture2DArray *texArray = static_cast&lt;gl::Texture2DArray *&gt;(tex);
-                    if (texArray-&gt;isCompressed(level))
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-
-                    break;
-                }
-
-              case GL_TEXTURE_3D:
-                {
-                    if (level &gt; gl::log2(context-&gt;getMaximum3DTextureDimension()))
-                    {
-                        return gl::error(GL_INVALID_VALUE, false);
-                    }
-
-                    if (layer &gt;= context-&gt;getMaximum3DTextureDimension())
-                    {
-                        return gl::error(GL_INVALID_VALUE, false);
-                    }
-
-                    gl::Texture3D *tex3d = static_cast&lt;gl::Texture3D *&gt;(tex);
-                    if (tex3d-&gt;isCompressed(level))
-                    {
-                        return gl::error(GL_INVALID_OPERATION, false);
-                    }
-
-                    break;
-                }
-
-              default:
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-        }
-    }
-
-    gl::Framebuffer *framebuffer = NULL;
-    GLuint framebufferHandle = 0;
-    if (target == GL_READ_FRAMEBUFFER)
-    {
-        framebuffer = context-&gt;getReadFramebuffer();
-        framebufferHandle = context-&gt;getReadFramebufferHandle();
-    }
-    else
-    {
-        framebuffer = context-&gt;getDrawFramebuffer();
-        framebufferHandle = context-&gt;getDrawFramebufferHandle();
-    }
-
-    if (framebufferHandle == 0 || !framebuffer)
-    {
-        return gl::error(GL_INVALID_OPERATION, false);
-    }
-
-    return true;
-}
-
-bool ValidES3ReadFormatType(gl::Context *context, GLenum internalFormat, GLenum format, GLenum type)
-{
-    switch (format)
-    {
-      case GL_RGBA:
-        switch (type)
-        {
-          case GL_UNSIGNED_BYTE:
-            break;
-          case GL_UNSIGNED_INT_2_10_10_10_REV:
-            if (internalFormat != GL_RGB10_A2)
-            {
-                return false;
-            }
-            break;
-          case GL_FLOAT:
-            if (gl::GetComponentType(internalFormat, 3) != GL_FLOAT)
-            {
-                return false;
-            }
-            break;
-          default:
-            return false;
-        }
-        break;
-      case GL_RGBA_INTEGER:
-        switch (type)
-        {
-          case GL_INT:
-            if (gl::GetComponentType(internalFormat, 3) != GL_INT)
-            {
-                return false;
-            }
-            break;
-          case GL_UNSIGNED_INT:
-            if (gl::GetComponentType(internalFormat, 3) != GL_UNSIGNED_INT)
-            {
-                return false;
-            }
-            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_RG_EXT:
-      case GL_RED_EXT:
-        if (!context-&gt;supportsRGTextures())
-        {
-            return false;
-        }
-        switch (type)
-        {
-        case GL_UNSIGNED_BYTE:
-            break;
-        default:
-            return false;
-        }
-        break;
-      default:
-        return false;
-    }
-    return true;
-}
-
-bool ValidateInvalidateFramebufferParameters(gl::Context *context, GLenum target, GLsizei numAttachments,
-                                             const GLenum* attachments)
-{
-    bool defaultFramebuffer = false;
-
-    switch (target)
-    {
-      case GL_DRAW_FRAMEBUFFER:
-      case GL_FRAMEBUFFER:
-        defaultFramebuffer = context-&gt;getDrawFramebufferHandle() == 0;
-        break;
-      case GL_READ_FRAMEBUFFER:
-        defaultFramebuffer = context-&gt;getReadFramebufferHandle() == 0;
-        break;
-      default:
-        return gl::error(GL_INVALID_ENUM, false);
-    }
-
-    for (int i = 0; i &lt; numAttachments; ++i)
-    {
-        if (attachments[i] &gt;= GL_COLOR_ATTACHMENT0 &amp;&amp; attachments[i] &lt;= GL_COLOR_ATTACHMENT15)
-        {
-            if (defaultFramebuffer)
-            {
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-
-            if (attachments[i] &gt;= GL_COLOR_ATTACHMENT0 + context-&gt;getMaximumRenderTargets())
-            {
-                return gl::error(GL_INVALID_OPERATION, false);
-            }
-        }
-        else
-        {
-            switch (attachments[i])
-            {
-              case GL_DEPTH_ATTACHMENT:
-              case GL_STENCIL_ATTACHMENT:
-              case GL_DEPTH_STENCIL_ATTACHMENT:
-                if (defaultFramebuffer)
-                {
-                    return gl::error(GL_INVALID_ENUM, false);
-                }
-                break;
-              case GL_COLOR:
-              case GL_DEPTH:
-              case GL_STENCIL:
-                if (!defaultFramebuffer)
-                {
-                    return gl::error(GL_INVALID_ENUM, false);
-                }
-                break;
-              default:
-                return gl::error(GL_INVALID_ENUM, false);
-            }
-        }
-    }
-
-    return true;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2validationES3h"></a>
<div class="delfile"><h4>Deleted: trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2/validationES3.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,39 +0,0 @@
</span><del>-//
-// Copyright (c) 2013 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.
-//
-
-// validationES3.h: Validation functions for OpenGL ES 3.0 entry point parameters
-
-#ifndef LIBGLESV2_VALIDATION_ES3_H
-#define LIBGLESV2_VALIDATION_ES3_H
-
-namespace gl
-{
-
-class Context;
-
-bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
-                                   GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
-                                   GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-
-bool ValidateES3CopyTexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat,
-                                       bool isSubImage, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y,
-                                       GLsizei width, GLsizei height, GLint border);
-
-bool ValidateES3TexStorageParameters(gl::Context *context, GLenum target, GLsizei levels, GLenum internalformat,
-                                     GLsizei width, GLsizei height, GLsizei depth);
-
-bool ValidateES3FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
-                                             GLenum textarget, GLuint texture, GLint level, GLint layer,
-                                             bool layerCall);
-
-bool ValidES3ReadFormatType(gl::Context *context, GLenum internalFormat, GLenum format, GLenum type);
-
-bool ValidateInvalidateFramebufferParameters(gl::Context *context, GLenum target, GLsizei numAttachments,
-                                             const GLenum* attachments);
-
-}
-
-#endif // LIBGLESV2_VALIDATION_ES3_H
</del></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrclibGLESv2gypi"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/libGLESv2.gypi (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/libGLESv2.gypi                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/libGLESv2.gypi        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,730 @@
</span><ins>+# Copyright (c) 2013 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+    'variables':
+    {
+        # These file lists are shared with the GN build.
+        'libangle_common_sources':
+        [
+            'common/MemoryBuffer.cpp',
+            'common/MemoryBuffer.h',
+            'common/Optional.h',
+            'common/angleutils.cpp',
+            'common/angleutils.h',
+            'common/debug.cpp',
+            'common/debug.h',
+            'common/mathutil.cpp',
+            'common/mathutil.h',
+            'common/platform.h',
+            'common/tls.cpp',
+            'common/tls.h',
+            'common/utilities.cpp',
+            'common/utilities.h',
+            'common/version.h',
+        ],
+        'libangle_includes':
+        [
+            '../include/angle_gl.h',
+            '../include/export.h',
+            '../include/EGL/egl.h',
+            '../include/EGL/eglext.h',
+            '../include/EGL/eglplatform.h',
+            '../include/GLES2/gl2.h',
+            '../include/GLES2/gl2ext.h',
+            '../include/GLES2/gl2platform.h',
+            '../include/GLES3/gl3.h',
+            '../include/GLES3/gl3ext.h',
+            '../include/GLES3/gl3platform.h',
+            '../include/GLSLANG/ShaderLang.h',
+            '../include/GLSLANG/ShaderVars.h',
+            '../include/KHR/khrplatform.h',
+            '../include/platform/Platform.h',
+        ],
+        'libangle_sources':
+        [
+            'common/event_tracer.cpp',
+            'common/event_tracer.h',
+            'libANGLE/AttributeMap.cpp',
+            'libANGLE/AttributeMap.h',
+            'libANGLE/BinaryStream.h',
+            'libANGLE/Buffer.cpp',
+            'libANGLE/Buffer.h',
+            'libANGLE/Caps.cpp',
+            'libANGLE/Caps.h',
+            'libANGLE/Compiler.cpp',
+            'libANGLE/Compiler.h',
+            'libANGLE/Config.cpp',
+            'libANGLE/Config.h',
+            'libANGLE/Constants.h',
+            'libANGLE/Context.cpp',
+            'libANGLE/Context.h',
+            'libANGLE/Data.cpp',
+            'libANGLE/Data.h',
+            'libANGLE/Device.cpp',
+            'libANGLE/Device.h',
+            'libANGLE/Display.cpp',
+            'libANGLE/Display.h',
+            'libANGLE/Error.cpp',
+            'libANGLE/Error.h',
+            'libANGLE/Error.inl',
+            'libANGLE/Fence.cpp',
+            'libANGLE/Fence.h',
+            'libANGLE/Float16ToFloat32.cpp',
+            'libANGLE/Framebuffer.cpp',
+            'libANGLE/Framebuffer.h',
+            'libANGLE/FramebufferAttachment.cpp',
+            'libANGLE/FramebufferAttachment.h',
+            'libANGLE/HandleAllocator.cpp',
+            'libANGLE/HandleAllocator.h',
+            'libANGLE/ImageIndex.h',
+            'libANGLE/ImageIndex.cpp',
+            'libANGLE/Platform.cpp',
+            'libANGLE/Program.cpp',
+            'libANGLE/Program.h',
+            'libANGLE/Query.cpp',
+            'libANGLE/Query.h',
+            'libANGLE/RefCountObject.cpp',
+            'libANGLE/RefCountObject.h',
+            'libANGLE/Renderbuffer.cpp',
+            'libANGLE/Renderbuffer.h',
+            'libANGLE/ResourceManager.cpp',
+            'libANGLE/ResourceManager.h',
+            'libANGLE/Sampler.cpp',
+            'libANGLE/Sampler.h',
+            'libANGLE/Shader.cpp',
+            'libANGLE/Shader.h',
+            'libANGLE/State.cpp',
+            'libANGLE/State.h',
+            'libANGLE/Surface.cpp',
+            'libANGLE/Surface.h',
+            'libANGLE/Texture.cpp',
+            'libANGLE/Texture.h',
+            'libANGLE/TransformFeedback.cpp',
+            'libANGLE/TransformFeedback.h',
+            'libANGLE/Uniform.cpp',
+            'libANGLE/Uniform.h',
+            'libANGLE/VertexArray.cpp',
+            'libANGLE/VertexArray.h',
+            'libANGLE/VertexAttribute.cpp',
+            'libANGLE/VertexAttribute.h',
+            'libANGLE/angletypes.cpp',
+            'libANGLE/angletypes.h',
+            'libANGLE/features.h',
+            'libANGLE/formatutils.cpp',
+            'libANGLE/formatutils.h',
+            'libANGLE/histogram_macros.h',
+            'libANGLE/queryconversions.cpp',
+            'libANGLE/queryconversions.h',
+            'libANGLE/renderer/BufferImpl.h',
+            'libANGLE/renderer/CompilerImpl.h',
+            'libANGLE/renderer/DeviceImpl.cpp',
+            'libANGLE/renderer/DeviceImpl.h',
+            'libANGLE/renderer/DisplayImpl.cpp',
+            'libANGLE/renderer/DisplayImpl.h',
+            'libANGLE/renderer/FenceNVImpl.h',
+            'libANGLE/renderer/FenceSyncImpl.h',
+            'libANGLE/renderer/FramebufferImpl.h',
+            'libANGLE/renderer/ImplFactory.h',
+            'libANGLE/renderer/IndexRangeCache.cpp',
+            'libANGLE/renderer/IndexRangeCache.h',
+            'libANGLE/renderer/ProgramImpl.cpp',
+            'libANGLE/renderer/ProgramImpl.h',
+            'libANGLE/renderer/QueryImpl.h',
+            'libANGLE/renderer/RenderbufferImpl.h',
+            'libANGLE/renderer/RenderbufferImpl.cpp',
+            'libANGLE/renderer/Renderer.cpp',
+            'libANGLE/renderer/Renderer.h',
+            'libANGLE/renderer/ShaderImpl.h',
+            'libANGLE/renderer/SurfaceImpl.cpp',
+            'libANGLE/renderer/SurfaceImpl.h',
+            'libANGLE/renderer/TextureImpl.h',
+            'libANGLE/renderer/TransformFeedbackImpl.h',
+            'libANGLE/renderer/VertexArrayImpl.h',
+            'libANGLE/renderer/Workarounds.h',
+            'libANGLE/validationEGL.cpp',
+            'libANGLE/validationEGL.h',
+            'libANGLE/validationES.cpp',
+            'libANGLE/validationES.h',
+            'libANGLE/validationES2.cpp',
+            'libANGLE/validationES2.h',
+            'libANGLE/validationES3.cpp',
+            'libANGLE/validationES3.h',
+            'third_party/murmurhash/MurmurHash3.cpp',
+            'third_party/murmurhash/MurmurHash3.h',
+        ],
+        'libangle_d3d_shared_sources':
+        [
+            'libANGLE/renderer/d3d/BufferD3D.cpp',
+            'libANGLE/renderer/d3d/BufferD3D.h',
+            'libANGLE/renderer/d3d/CompilerD3D.cpp',
+            'libANGLE/renderer/d3d/CompilerD3D.h',
+            'libANGLE/renderer/d3d/copyimage.cpp',
+            'libANGLE/renderer/d3d/copyimage.h',
+            'libANGLE/renderer/d3d/copyimage.inl',
+            'libANGLE/renderer/d3d/DeviceD3D.cpp',
+            'libANGLE/renderer/d3d/DeviceD3D.h',
+            'libANGLE/renderer/d3d/DisplayD3D.cpp',
+            'libANGLE/renderer/d3d/DisplayD3D.h',
+            'libANGLE/renderer/d3d/DynamicHLSL.cpp',
+            'libANGLE/renderer/d3d/DynamicHLSL.h',
+            'libANGLE/renderer/d3d/formatutilsD3D.cpp',
+            'libANGLE/renderer/d3d/formatutilsD3D.h',
+            'libANGLE/renderer/d3d/FramebufferD3D.cpp',
+            'libANGLE/renderer/d3d/FramebufferD3D.h',
+            'libANGLE/renderer/d3d/generatemip.h',
+            'libANGLE/renderer/d3d/generatemip.inl',
+            'libANGLE/renderer/d3d/HLSLCompiler.cpp',
+            'libANGLE/renderer/d3d/HLSLCompiler.h',
+            'libANGLE/renderer/d3d/ImageD3D.cpp',
+            'libANGLE/renderer/d3d/ImageD3D.h',
+            'libANGLE/renderer/d3d/imageformats.h',
+            'libANGLE/renderer/d3d/IndexBuffer.cpp',
+            'libANGLE/renderer/d3d/IndexBuffer.h',
+            'libANGLE/renderer/d3d/IndexDataManager.cpp',
+            'libANGLE/renderer/d3d/IndexDataManager.h',
+            'libANGLE/renderer/d3d/loadimage.cpp',
+            'libANGLE/renderer/d3d/loadimage.h',
+            'libANGLE/renderer/d3d/loadimage.inl',
+            'libANGLE/renderer/d3d/loadimageSSE2.cpp',
+            'libANGLE/renderer/d3d/ProgramD3D.cpp',
+            'libANGLE/renderer/d3d/ProgramD3D.h',
+            'libANGLE/renderer/d3d/RenderbufferD3D.cpp',
+            'libANGLE/renderer/d3d/RenderbufferD3D.h',
+            'libANGLE/renderer/d3d/RendererD3D.cpp',
+            'libANGLE/renderer/d3d/RendererD3D.h',
+            'libANGLE/renderer/d3d/RenderTargetD3D.h',
+            'libANGLE/renderer/d3d/RenderTargetD3D.cpp',
+            'libANGLE/renderer/d3d/ShaderD3D.cpp',
+            'libANGLE/renderer/d3d/ShaderD3D.h',
+            'libANGLE/renderer/d3d/ShaderExecutableD3D.cpp',
+            'libANGLE/renderer/d3d/ShaderExecutableD3D.h',
+            'libANGLE/renderer/d3d/SurfaceD3D.cpp',
+            'libANGLE/renderer/d3d/SurfaceD3D.h',
+            'libANGLE/renderer/d3d/SwapChainD3D.h',
+            'libANGLE/renderer/d3d/TextureD3D.cpp',
+            'libANGLE/renderer/d3d/TextureD3D.h',
+            'libANGLE/renderer/d3d/TextureStorage.cpp',
+            'libANGLE/renderer/d3d/TextureStorage.h',
+            'libANGLE/renderer/d3d/TransformFeedbackD3D.cpp',
+            'libANGLE/renderer/d3d/TransformFeedbackD3D.h',
+            'libANGLE/renderer/d3d/VertexBuffer.cpp',
+            'libANGLE/renderer/d3d/VertexBuffer.h',
+            'libANGLE/renderer/d3d/VertexDataManager.cpp',
+            'libANGLE/renderer/d3d/VertexDataManager.h',
+        ],
+        'libangle_d3d9_sources':
+        [
+            'libANGLE/renderer/d3d/d3d9/Blit9.cpp',
+            'libANGLE/renderer/d3d/d3d9/Blit9.h',
+            'libANGLE/renderer/d3d/d3d9/Buffer9.cpp',
+            'libANGLE/renderer/d3d/d3d9/Buffer9.h',
+            'libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp',
+            'libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h',
+            'libANGLE/renderer/d3d/d3d9/Fence9.cpp',
+            'libANGLE/renderer/d3d/d3d9/Fence9.h',
+            'libANGLE/renderer/d3d/d3d9/formatutils9.cpp',
+            'libANGLE/renderer/d3d/d3d9/formatutils9.h',
+            'libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp',
+            'libANGLE/renderer/d3d/d3d9/Framebuffer9.h',
+            'libANGLE/renderer/d3d/d3d9/Image9.cpp',
+            'libANGLE/renderer/d3d/d3d9/Image9.h',
+            'libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp',
+            'libANGLE/renderer/d3d/d3d9/IndexBuffer9.h',
+            'libANGLE/renderer/d3d/d3d9/Query9.cpp',
+            'libANGLE/renderer/d3d/d3d9/Query9.h',
+            'libANGLE/renderer/d3d/d3d9/Renderer9.cpp',
+            'libANGLE/renderer/d3d/d3d9/Renderer9.h',
+            'libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp',
+            'libANGLE/renderer/d3d/d3d9/renderer9_utils.h',
+            'libANGLE/renderer/d3d/d3d9/RenderTarget9.cpp',
+            'libANGLE/renderer/d3d/d3d9/RenderTarget9.h',
+            'libANGLE/renderer/d3d/d3d9/ShaderCache.h',
+            'libANGLE/renderer/d3d/d3d9/ShaderExecutable9.cpp',
+            'libANGLE/renderer/d3d/d3d9/ShaderExecutable9.h',
+            'libANGLE/renderer/d3d/d3d9/shaders/compiled/componentmaskps.h',
+            'libANGLE/renderer/d3d/d3d9/shaders/compiled/flipyvs.h',
+            'libANGLE/renderer/d3d/d3d9/shaders/compiled/luminanceps.h',
+            'libANGLE/renderer/d3d/d3d9/shaders/compiled/passthroughps.h',
+            'libANGLE/renderer/d3d/d3d9/shaders/compiled/standardvs.h',
+            'libANGLE/renderer/d3d/d3d9/SwapChain9.cpp',
+            'libANGLE/renderer/d3d/d3d9/SwapChain9.h',
+            'libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp',
+            'libANGLE/renderer/d3d/d3d9/TextureStorage9.h',
+            'libANGLE/renderer/d3d/d3d9/VertexArray9.h',
+            'libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp',
+            'libANGLE/renderer/d3d/d3d9/VertexBuffer9.h',
+            'libANGLE/renderer/d3d/d3d9/vertexconversion.h',
+            'libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp',
+            'libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h',
+        ],
+        'libangle_d3d11_sources':
+        [
+            'libANGLE/renderer/d3d/d3d11/Blit11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Blit11.h',
+            'libANGLE/renderer/d3d/d3d11/Buffer11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Buffer11.h',
+            'libANGLE/renderer/d3d/d3d11/Clear11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Clear11.h',
+            'libANGLE/renderer/d3d/d3d11/copyvertex.h',
+            'libANGLE/renderer/d3d/d3d11/copyvertex.inl',
+            'libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp',
+            'libANGLE/renderer/d3d/d3d11/DebugAnnotator11.h',
+            'libANGLE/renderer/d3d/d3d11/Fence11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Fence11.h',
+            'libANGLE/renderer/d3d/d3d11/formatutils11.cpp',
+            'libANGLE/renderer/d3d/d3d11/formatutils11.h',
+            'libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Framebuffer11.h',
+            'libANGLE/renderer/d3d/d3d11/Image11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Image11.h',
+            'libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp',
+            'libANGLE/renderer/d3d/d3d11/IndexBuffer11.h',
+            'libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp',
+            'libANGLE/renderer/d3d/d3d11/InputLayoutCache.h',
+            'libANGLE/renderer/d3d/d3d11/NativeWindow.h',
+            'libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp',
+            'libANGLE/renderer/d3d/d3d11/PixelTransfer11.h',
+            'libANGLE/renderer/d3d/d3d11/Query11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Query11.h',
+            'libANGLE/renderer/d3d/d3d11/Renderer11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Renderer11.h',
+            'libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp',
+            'libANGLE/renderer/d3d/d3d11/renderer11_utils.h',
+            'libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp',
+            'libANGLE/renderer/d3d/d3d11/RenderStateCache.h',
+            'libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp',
+            'libANGLE/renderer/d3d/d3d11/RenderTarget11.h',
+            'libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp',
+            'libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_gs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4f.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4i.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_ps_4ui.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/buffertotexture11_vs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/clearfloat11vs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/clearsint11vs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/clearuint11vs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11gs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough3d11vs.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughdepth2d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum2d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlum3d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha2d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughlumalpha3d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr2dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughr3dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg2dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrg3dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb2dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgb3dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3d11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3di11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba3dui11ps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2darrayps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef2dps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlef3dps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2darrayps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei2dps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzlei3dps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2darrayps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui2dps.h',
+            'libANGLE/renderer/d3d/d3d11/shaders/compiled/swizzleui3dps.h',
+            'libANGLE/renderer/d3d/d3d11/SwapChain11.cpp',
+            'libANGLE/renderer/d3d/d3d11/SwapChain11.h',
+            'libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp',
+            'libANGLE/renderer/d3d/d3d11/TextureStorage11.h',
+            'libANGLE/renderer/d3d/d3d11/Trim11.cpp',
+            'libANGLE/renderer/d3d/d3d11/Trim11.h',
+            'libANGLE/renderer/d3d/d3d11/VertexArray11.h',
+            'libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp',
+            'libANGLE/renderer/d3d/d3d11/VertexBuffer11.h',
+        ],
+        'libangle_d3d11_win32_sources':
+        [
+            'libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp',
+            'third_party/systeminfo/SystemInfo.cpp',
+            'third_party/systeminfo/SystemInfo.h',
+        ],
+        'libangle_d3d11_winrt_sources':
+        [
+            'libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.cpp',
+            'libANGLE/renderer/d3d/d3d11/winrt/SwapChainPanelNativeWindow.h',
+            'libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.cpp',
+            'libANGLE/renderer/d3d/d3d11/winrt/CoreWindowNativeWindow.h',
+            'libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.cpp',
+            'libANGLE/renderer/d3d/d3d11/winrt/InspectableNativeWindow.h',
+        ],
+        'libangle_gl_sources':
+        [
+            'libANGLE/renderer/gl/BufferGL.cpp',
+            'libANGLE/renderer/gl/BufferGL.h',
+            'libANGLE/renderer/gl/CompilerGL.cpp',
+            'libANGLE/renderer/gl/CompilerGL.h',
+            'libANGLE/renderer/gl/DisplayGL.cpp',
+            'libANGLE/renderer/gl/DisplayGL.h',
+            'libANGLE/renderer/gl/FenceNVGL.cpp',
+            'libANGLE/renderer/gl/FenceNVGL.h',
+            'libANGLE/renderer/gl/FenceSyncGL.cpp',
+            'libANGLE/renderer/gl/FenceSyncGL.h',
+            'libANGLE/renderer/gl/FramebufferGL.cpp',
+            'libANGLE/renderer/gl/FramebufferGL.h',
+            'libANGLE/renderer/gl/FunctionsGL.cpp',
+            'libANGLE/renderer/gl/FunctionsGL.h',
+            'libANGLE/renderer/gl/ProgramGL.cpp',
+            'libANGLE/renderer/gl/ProgramGL.h',
+            'libANGLE/renderer/gl/QueryGL.cpp',
+            'libANGLE/renderer/gl/QueryGL.h',
+            'libANGLE/renderer/gl/RenderbufferGL.cpp',
+            'libANGLE/renderer/gl/RenderbufferGL.h',
+            'libANGLE/renderer/gl/RendererGL.cpp',
+            'libANGLE/renderer/gl/RendererGL.h',
+            'libANGLE/renderer/gl/ShaderGL.cpp',
+            'libANGLE/renderer/gl/ShaderGL.h',
+            'libANGLE/renderer/gl/StateManagerGL.cpp',
+            'libANGLE/renderer/gl/StateManagerGL.h',
+            'libANGLE/renderer/gl/SurfaceGL.cpp',
+            'libANGLE/renderer/gl/SurfaceGL.h',
+            'libANGLE/renderer/gl/TextureGL.cpp',
+            'libANGLE/renderer/gl/TextureGL.h',
+            'libANGLE/renderer/gl/TransformFeedbackGL.cpp',
+            'libANGLE/renderer/gl/TransformFeedbackGL.h',
+            'libANGLE/renderer/gl/VertexArrayGL.cpp',
+            'libANGLE/renderer/gl/VertexArrayGL.h',
+            'libANGLE/renderer/gl/formatutilsgl.cpp',
+            'libANGLE/renderer/gl/formatutilsgl.h',
+            'libANGLE/renderer/gl/functionsgl_enums.h',
+            'libANGLE/renderer/gl/functionsgl_typedefs.h',
+            'libANGLE/renderer/gl/renderergl_utils.cpp',
+            'libANGLE/renderer/gl/renderergl_utils.h',
+        ],
+        'libangle_gl_wgl_sources':
+        [
+            'libANGLE/renderer/gl/wgl/DisplayWGL.cpp',
+            'libANGLE/renderer/gl/wgl/DisplayWGL.h',
+            'libANGLE/renderer/gl/wgl/FunctionsWGL.cpp',
+            'libANGLE/renderer/gl/wgl/FunctionsWGL.h',
+            'libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.cpp',
+            'libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h',
+            'libANGLE/renderer/gl/wgl/WindowSurfaceWGL.cpp',
+            'libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h',
+            'libANGLE/renderer/gl/wgl/functionswgl_typedefs.h',
+            'libANGLE/renderer/gl/wgl/wgl_utils.cpp',
+            'libANGLE/renderer/gl/wgl/wgl_utils.h',
+            'third_party/khronos/GL/wglext.h',
+        ],
+        'libglesv2_sources':
+        [
+            'common/angleutils.h',
+            'common/debug.h',
+            'libGLESv2/entry_points_egl.cpp',
+            'libGLESv2/entry_points_egl.h',
+            'libGLESv2/entry_points_egl_ext.cpp',
+            'libGLESv2/entry_points_egl_ext.h',
+            'libGLESv2/entry_points_gles_2_0.cpp',
+            'libGLESv2/entry_points_gles_2_0.h',
+            'libGLESv2/entry_points_gles_2_0_ext.cpp',
+            'libGLESv2/entry_points_gles_2_0_ext.h',
+            'libGLESv2/entry_points_gles_3_0.cpp',
+            'libGLESv2/entry_points_gles_3_0.h',
+            'libGLESv2/entry_points_gles_3_0_ext.cpp',
+            'libGLESv2/entry_points_gles_3_0_ext.h',
+            'libGLESv2/global_state.cpp',
+            'libGLESv2/global_state.h',
+            'libGLESv2/libGLESv2.cpp',
+            'libGLESv2/libGLESv2.def',
+            'libGLESv2/libGLESv2.rc',
+            'libGLESv2/resource.h',
+        ],
+        'libegl_sources':
+        [
+            'libEGL/libEGL.cpp',
+            'libEGL/libEGL.def',
+            'libEGL/libEGL.rc',
+            'libEGL/resource.h',
+        ],
+    },
+    # Everything below this is duplicated in the GN build. If you change
+    # anything also change angle/BUILD.gn
+    'targets':
+    [
+        {
+            'target_name': 'libANGLE',
+            'type': 'static_library',
+            'dependencies':
+            [
+                'translator_static',
+                'commit_id',
+                'angle_common',
+            ],
+            'includes': [ '../build/common_defines.gypi', ],
+            'include_dirs':
+            [
+                '.',
+                '../include',
+                'third_party/khronos',
+            ],
+            'sources':
+            [
+                '&lt;@(libangle_sources)',
+                '&lt;@(libangle_includes)',
+            ],
+            'defines':
+            [
+                'GL_APICALL=',
+                'GL_GLEXT_PROTOTYPES=',
+                'EGLAPI=',
+                'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ &quot;d3dcompiler_47.dll&quot;, &quot;d3dcompiler_46.dll&quot;, &quot;d3dcompiler_43.dll&quot; }',
+                'LIBANGLE_IMPLEMENTATION',
+            ],
+            'direct_dependent_settings':
+            {
+                'include_dirs':
+                [
+                    '&lt;(angle_path)/src',
+                    '&lt;(angle_path)/include',
+                ],
+                'defines':
+                [
+                    'GL_APICALL=',
+                    'GL_GLEXT_PROTOTYPES=',
+                    'EGLAPI=',
+                    'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ &quot;d3dcompiler_47.dll&quot;, &quot;d3dcompiler_46.dll&quot;, &quot;d3dcompiler_43.dll&quot; }',
+                ],
+                'conditions':
+                [
+                    ['angle_enable_d3d9==1',
+                    {
+                        'defines':
+                        [
+                            'ANGLE_ENABLE_D3D9',
+                        ],
+                    }],
+                    ['angle_enable_d3d11==1',
+                    {
+                        'defines':
+                        [
+                            'ANGLE_ENABLE_D3D11',
+                        ],
+                    }],
+                    ['angle_enable_gl==1',
+                    {
+                        'defines':
+                        [
+                            'ANGLE_ENABLE_OPENGL',
+                        ],
+                    }],
+                ],
+            },
+            'conditions':
+            [
+                ['angle_enable_d3d9==1 or angle_enable_d3d11==1',
+                {
+                    'sources':
+                    [
+                        '&lt;@(libangle_d3d_shared_sources)',
+                    ],
+                }],
+                ['angle_enable_d3d9==1',
+                {
+                    'sources':
+                    [
+                        '&lt;@(libangle_d3d9_sources)',
+                    ],
+                    'defines':
+                    [
+                        'ANGLE_ENABLE_D3D9',
+                    ],
+                    'link_settings':
+                    {
+                        'msvs_settings':
+                        {
+                            'VCLinkerTool':
+                            {
+                                'AdditionalDependencies':
+                                [
+                                    'd3d9.lib',
+                                ]
+                            }
+                        },
+                    },
+                }],
+                ['angle_enable_d3d11==1',
+                {
+                    'sources':
+                    [
+                        '&lt;@(libangle_d3d11_sources)',
+                    ],
+                    'defines':
+                    [
+                        'ANGLE_ENABLE_D3D11',
+                    ],
+                    'link_settings':
+                    {
+                        'msvs_settings':
+                        {
+                            'VCLinkerTool':
+                            {
+                                'conditions':
+                                [
+                                    ['angle_build_winrt==0',
+                                    {
+                                        'AdditionalDependencies':
+                                        [
+                                            'dxguid.lib',
+                                        ],
+                                    }],
+                                    ['angle_build_winrt==1',
+                                    {
+                                        'AdditionalDependencies':
+                                        [
+                                            'dxguid.lib',
+                                            'd3d11.lib',
+                                            'd3dcompiler.lib',
+                                        ],
+                                    }],
+                                ],
+                            }
+                        },
+                    },
+                    'conditions':
+                    [
+                        ['angle_build_winrt==1',
+                        {
+                            'sources':
+                            [
+                                '&lt;@(libangle_d3d11_winrt_sources)',
+                            ],
+                        },
+                        { # win32
+                            'sources':
+                            [
+                                '&lt;@(libangle_d3d11_win32_sources)',
+                            ],
+                        }],
+                    ],
+                }],
+                ['angle_enable_gl==1',
+                {
+                    'sources':
+                    [
+                        '&lt;@(libangle_gl_sources)',
+                    ],
+                    'defines':
+                    [
+                        'ANGLE_ENABLE_OPENGL',
+                    ],
+                    'conditions':
+                    [
+                        ['OS==&quot;win&quot;',
+                        {
+                            'sources':
+                            [
+                                '&lt;@(libangle_gl_wgl_sources)',
+                            ],
+                        }],
+                    ],
+                }],
+                ['angle_build_winrt==0 and OS==&quot;win&quot;',
+                {
+                    'dependencies':
+                    [
+                        'copy_compiler_dll'
+                    ],
+                }],
+                ['angle_build_winrt==1',
+                {
+                    'defines':
+                    [
+                        'NTDDI_VERSION=NTDDI_WINBLUE',
+                    ],
+                    'msvs_enable_winrt' : '1',
+                    'msvs_requires_importlibrary' : 'true',
+                    'msvs_settings':
+                    {
+                        'VCLinkerTool':
+                        {
+                            'EnableCOMDATFolding': '1',
+                            'OptimizeReferences': '1',
+                        }
+                    },
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+                ['OS==&quot;win&quot;',
+                {
+                    'configurations':
+                    {
+                        'Debug_Base':
+                        {
+                            'defines':
+                            [
+                                'ANGLE_ENABLE_DEBUG_ANNOTATIONS',
+                                'ANGLE_GENERATE_SHADER_DEBUG_INFO'
+                            ],
+                        },
+                    },
+                }],
+            ],
+        },
+        {
+            'target_name': 'libGLESv2',
+            'type': 'shared_library',
+            'dependencies': [ 'libANGLE' ],
+            'includes': [ '../build/common_defines.gypi', ],
+            'sources':
+            [
+                '&lt;@(libglesv2_sources)',
+            ],
+            'defines':
+            [
+                'GL_APICALL=',
+                'GL_GLEXT_PROTOTYPES=',
+                'EGLAPI=',
+                'LIBGLESV2_IMPLEMENTATION',
+            ],
+            'conditions':
+            [
+                ['angle_build_winrt==1',
+                {
+                    'msvs_enable_winrt' : '1',
+                    'msvs_requires_importlibrary' : 'true',
+                    'msvs_settings':
+                    {
+                        'VCLinkerTool':
+                        {
+                            'EnableCOMDATFolding': '1',
+                            'OptimizeReferences': '1',
+                        }
+                    },
+                }],
+                ['angle_build_winphone==1',
+                {
+                    'msvs_enable_winphone' : '1',
+                }],
+            ],
+        },
+    ],
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partycompilerArrayBoundsClamperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/third_party/compiler/ArrayBoundsClamper.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/compiler/ArrayBoundsClamper.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/compiler/ArrayBoundsClamper.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -23,11 +23,11 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef THIRD_PARTY_COMPILER_ARRAY_BOUNDS_CLAMPER_H_
-#define THIRD_PARTY_COMPILER_ARRAY_BOUNDS_CLAMPER_H_
</del><ins>+#ifndef THIRD_PARTY_COMPILER_ARRAYBOUNDSCLAMPER_H_
+#define THIRD_PARTY_COMPILER_ARRAYBOUNDSCLAMPER_H_
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;compiler/translator/InfoSink.h&quot;
</span><del>-#include &quot;compiler/translator/intermediate.h&quot;
</del><ins>+#include &quot;compiler/translator/IntermNode.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> class ArrayBoundsClamper {
</span><span class="cx"> public:
</span><span class="lines">@@ -57,4 +57,4 @@
</span><span class="cx">     bool mArrayBoundsClampDefinitionNeeded;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-#endif // THIRD_PARTY_COMPILER_ARRAY_BOUNDS_CLAMPER_H_
</del><ins>+#endif // THIRD_PARTY_COMPILER_ARRAYBOUNDSCLAMPER_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partykhronosGLwglexth"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/third_party/khronos/GL/wglext.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/khronos/GL/wglext.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/khronos/GL/wglext.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,840 @@
</span><ins>+#ifndef __wglext_h_
+#define __wglext_h_ 1
+
+#ifdef __cplusplus
+extern &quot;C&quot; {
+#endif
+
+/*
+** Copyright (c) 2013-2014 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** &quot;Materials&quot;), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 27684 $ on $Date: 2014-08-11 01:21:35 -0700 (Mon, 11 Aug 2014) $
+*/
+
+#if defined(_WIN32) &amp;&amp; !defined(APIENTRY) &amp;&amp; !defined(__CYGWIN__) &amp;&amp; !defined(__SCITECH_SNAP__)
+#define WIN32_LEAN_AND_MEAN 1
+#include &lt;windows.h&gt;
+#endif
+
+#define WGL_WGLEXT_VERSION 20140810
+
+/* Generated C header for:
+ * API: wgl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: wgl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef WGL_ARB_buffer_region
+#define WGL_ARB_buffer_region 1
+#define WGL_FRONT_COLOR_BUFFER_BIT_ARB    0x00000001
+#define WGL_BACK_COLOR_BUFFER_BIT_ARB     0x00000002
+#define WGL_DEPTH_BUFFER_BIT_ARB          0x00000004
+#define WGL_STENCIL_BUFFER_BIT_ARB        0x00000008
+typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
+typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
+typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
+typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
+VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
+BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
+BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+#endif
+#endif /* WGL_ARB_buffer_region */
+
+#ifndef WGL_ARB_context_flush_control
+#define WGL_ARB_context_flush_control 1
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB  0x2097
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
+#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
+#endif /* WGL_ARB_context_flush_control */
+
+#ifndef WGL_ARB_create_context
+#define WGL_ARB_create_context 1
+#define WGL_CONTEXT_DEBUG_BIT_ARB         0x00000001
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define WGL_CONTEXT_MAJOR_VERSION_ARB     0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB     0x2092
+#define WGL_CONTEXT_LAYER_PLANE_ARB       0x2093
+#define WGL_CONTEXT_FLAGS_ARB             0x2094
+#define ERROR_INVALID_VERSION_ARB         0x2095
+typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
+#endif
+#endif /* WGL_ARB_create_context */
+
+#ifndef WGL_ARB_create_context_profile
+#define WGL_ARB_create_context_profile 1
+#define WGL_CONTEXT_PROFILE_MASK_ARB      0x9126
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB  0x00000001
+#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define ERROR_INVALID_PROFILE_ARB         0x2096
+#endif /* WGL_ARB_create_context_profile */
+
+#ifndef WGL_ARB_create_context_robustness
+#define WGL_ARB_create_context_robustness 1
+#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define WGL_LOSE_CONTEXT_ON_RESET_ARB     0x8252
+#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define WGL_NO_RESET_NOTIFICATION_ARB     0x8261
+#endif /* WGL_ARB_create_context_robustness */
+
+#ifndef WGL_ARB_extensions_string
+#define WGL_ARB_extensions_string 1
+typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
+#endif
+#endif /* WGL_ARB_extensions_string */
+
+#ifndef WGL_ARB_framebuffer_sRGB
+#define WGL_ARB_framebuffer_sRGB 1
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB  0x20A9
+#endif /* WGL_ARB_framebuffer_sRGB */
+
+#ifndef WGL_ARB_make_current_read
+#define WGL_ARB_make_current_read 1
+#define ERROR_INVALID_PIXEL_TYPE_ARB      0x2043
+#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+HDC WINAPI wglGetCurrentReadDCARB (void);
+#endif
+#endif /* WGL_ARB_make_current_read */
+
+#ifndef WGL_ARB_multisample
+#define WGL_ARB_multisample 1
+#define WGL_SAMPLE_BUFFERS_ARB            0x2041
+#define WGL_SAMPLES_ARB                   0x2042
+#endif /* WGL_ARB_multisample */
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_ARB_pbuffer 1
+DECLARE_HANDLE(HPBUFFERARB);
+#define WGL_DRAW_TO_PBUFFER_ARB           0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB        0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB         0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB        0x2030
+#define WGL_PBUFFER_LARGEST_ARB           0x2033
+#define WGL_PBUFFER_WIDTH_ARB             0x2034
+#define WGL_PBUFFER_HEIGHT_ARB            0x2035
+#define WGL_PBUFFER_LOST_ARB              0x2036
+typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
+int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
+BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
+BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+#endif
+#endif /* WGL_ARB_pbuffer */
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_ARB_pixel_format 1
+#define WGL_NUMBER_PIXEL_FORMATS_ARB      0x2000
+#define WGL_DRAW_TO_WINDOW_ARB            0x2001
+#define WGL_DRAW_TO_BITMAP_ARB            0x2002
+#define WGL_ACCELERATION_ARB              0x2003
+#define WGL_NEED_PALETTE_ARB              0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB       0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB        0x2006
+#define WGL_SWAP_METHOD_ARB               0x2007
+#define WGL_NUMBER_OVERLAYS_ARB           0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB          0x2009
+#define WGL_TRANSPARENT_ARB               0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB     0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB   0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB    0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB   0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB   0x203B
+#define WGL_SHARE_DEPTH_ARB               0x200C
+#define WGL_SHARE_STENCIL_ARB             0x200D
+#define WGL_SHARE_ACCUM_ARB               0x200E
+#define WGL_SUPPORT_GDI_ARB               0x200F
+#define WGL_SUPPORT_OPENGL_ARB            0x2010
+#define WGL_DOUBLE_BUFFER_ARB             0x2011
+#define WGL_STEREO_ARB                    0x2012
+#define WGL_PIXEL_TYPE_ARB                0x2013
+#define WGL_COLOR_BITS_ARB                0x2014
+#define WGL_RED_BITS_ARB                  0x2015
+#define WGL_RED_SHIFT_ARB                 0x2016
+#define WGL_GREEN_BITS_ARB                0x2017
+#define WGL_GREEN_SHIFT_ARB               0x2018
+#define WGL_BLUE_BITS_ARB                 0x2019
+#define WGL_BLUE_SHIFT_ARB                0x201A
+#define WGL_ALPHA_BITS_ARB                0x201B
+#define WGL_ALPHA_SHIFT_ARB               0x201C
+#define WGL_ACCUM_BITS_ARB                0x201D
+#define WGL_ACCUM_RED_BITS_ARB            0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB          0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB           0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB          0x2021
+#define WGL_DEPTH_BITS_ARB                0x2022
+#define WGL_STENCIL_BITS_ARB              0x2023
+#define WGL_AUX_BUFFERS_ARB               0x2024
+#define WGL_NO_ACCELERATION_ARB           0x2025
+#define WGL_GENERIC_ACCELERATION_ARB      0x2026
+#define WGL_FULL_ACCELERATION_ARB         0x2027
+#define WGL_SWAP_EXCHANGE_ARB             0x2028
+#define WGL_SWAP_COPY_ARB                 0x2029
+#define WGL_SWAP_UNDEFINED_ARB            0x202A
+#define WGL_TYPE_RGBA_ARB                 0x202B
+#define WGL_TYPE_COLORINDEX_ARB           0x202C
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+#endif /* WGL_ARB_pixel_format */
+
+#ifndef WGL_ARB_pixel_format_float
+#define WGL_ARB_pixel_format_float 1
+#define WGL_TYPE_RGBA_FLOAT_ARB           0x21A0
+#endif /* WGL_ARB_pixel_format_float */
+
+#ifndef WGL_ARB_render_texture
+#define WGL_ARB_render_texture 1
+#define WGL_BIND_TO_TEXTURE_RGB_ARB       0x2070
+#define WGL_BIND_TO_TEXTURE_RGBA_ARB      0x2071
+#define WGL_TEXTURE_FORMAT_ARB            0x2072
+#define WGL_TEXTURE_TARGET_ARB            0x2073
+#define WGL_MIPMAP_TEXTURE_ARB            0x2074
+#define WGL_TEXTURE_RGB_ARB               0x2075
+#define WGL_TEXTURE_RGBA_ARB              0x2076
+#define WGL_NO_TEXTURE_ARB                0x2077
+#define WGL_TEXTURE_CUBE_MAP_ARB          0x2078
+#define WGL_TEXTURE_1D_ARB                0x2079
+#define WGL_TEXTURE_2D_ARB                0x207A
+#define WGL_MIPMAP_LEVEL_ARB              0x207B
+#define WGL_CUBE_MAP_FACE_ARB             0x207C
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
+#define WGL_FRONT_LEFT_ARB                0x2083
+#define WGL_FRONT_RIGHT_ARB               0x2084
+#define WGL_BACK_LEFT_ARB                 0x2085
+#define WGL_BACK_RIGHT_ARB                0x2086
+#define WGL_AUX0_ARB                      0x2087
+#define WGL_AUX1_ARB                      0x2088
+#define WGL_AUX2_ARB                      0x2089
+#define WGL_AUX3_ARB                      0x208A
+#define WGL_AUX4_ARB                      0x208B
+#define WGL_AUX5_ARB                      0x208C
+#define WGL_AUX6_ARB                      0x208D
+#define WGL_AUX7_ARB                      0x208E
+#define WGL_AUX8_ARB                      0x208F
+#define WGL_AUX9_ARB                      0x2090
+typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
+BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
+BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
+#endif
+#endif /* WGL_ARB_render_texture */
+
+#ifndef WGL_ARB_robustness_application_isolation
+#define WGL_ARB_robustness_application_isolation 1
+#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
+#endif /* WGL_ARB_robustness_application_isolation */
+
+#ifndef WGL_ARB_robustness_share_group_isolation
+#define WGL_ARB_robustness_share_group_isolation 1
+#endif /* WGL_ARB_robustness_share_group_isolation */
+
+#ifndef WGL_3DFX_multisample
+#define WGL_3DFX_multisample 1
+#define WGL_SAMPLE_BUFFERS_3DFX           0x2060
+#define WGL_SAMPLES_3DFX                  0x2061
+#endif /* WGL_3DFX_multisample */
+
+#ifndef WGL_3DL_stereo_control
+#define WGL_3DL_stereo_control 1
+#define WGL_STEREO_EMITTER_ENABLE_3DL     0x2055
+#define WGL_STEREO_EMITTER_DISABLE_3DL    0x2056
+#define WGL_STEREO_POLARITY_NORMAL_3DL    0x2057
+#define WGL_STEREO_POLARITY_INVERT_3DL    0x2058
+typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
+#endif
+#endif /* WGL_3DL_stereo_control */
+
+#ifndef WGL_AMD_gpu_association
+#define WGL_AMD_gpu_association 1
+#define WGL_GPU_VENDOR_AMD                0x1F00
+#define WGL_GPU_RENDERER_STRING_AMD       0x1F01
+#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
+#define WGL_GPU_FASTEST_TARGET_GPUS_AMD   0x21A2
+#define WGL_GPU_RAM_AMD                   0x21A3
+#define WGL_GPU_CLOCK_AMD                 0x21A4
+#define WGL_GPU_NUM_PIPES_AMD             0x21A5
+#define WGL_GPU_NUM_SIMD_AMD              0x21A6
+#define WGL_GPU_NUM_RB_AMD                0x21A7
+#define WGL_GPU_NUM_SPI_AMD               0x21A8
+typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
+typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
+typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
+typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
+typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
+typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef WGL_WGLEXT_PROTOTYPES
+UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
+INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
+UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
+HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
+HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
+BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
+BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
+HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
+VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* WGL_AMD_gpu_association */
+
+#ifndef WGL_ATI_pixel_format_float
+#define WGL_ATI_pixel_format_float 1
+#define WGL_TYPE_RGBA_FLOAT_ATI           0x21A0
+#endif /* WGL_ATI_pixel_format_float */
+
+#ifndef WGL_EXT_create_context_es2_profile
+#define WGL_EXT_create_context_es2_profile 1
+#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT   0x00000004
+#endif /* WGL_EXT_create_context_es2_profile */
+
+#ifndef WGL_EXT_create_context_es_profile
+#define WGL_EXT_create_context_es_profile 1
+#define WGL_CONTEXT_ES_PROFILE_BIT_EXT    0x00000004
+#endif /* WGL_EXT_create_context_es_profile */
+
+#ifndef WGL_EXT_depth_float
+#define WGL_EXT_depth_float 1
+#define WGL_DEPTH_FLOAT_EXT               0x2040
+#endif /* WGL_EXT_depth_float */
+
+#ifndef WGL_EXT_display_color_table
+#define WGL_EXT_display_color_table 1
+typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
+typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+#ifdef WGL_WGLEXT_PROTOTYPES
+GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
+GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
+GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
+VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
+#endif
+#endif /* WGL_EXT_display_color_table */
+
+#ifndef WGL_EXT_extensions_string
+#define WGL_EXT_extensions_string 1
+typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+const char *WINAPI wglGetExtensionsStringEXT (void);
+#endif
+#endif /* WGL_EXT_extensions_string */
+
+#ifndef WGL_EXT_framebuffer_sRGB
+#define WGL_EXT_framebuffer_sRGB 1
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT  0x20A9
+#endif /* WGL_EXT_framebuffer_sRGB */
+
+#ifndef WGL_EXT_make_current_read
+#define WGL_EXT_make_current_read 1
+#define ERROR_INVALID_PIXEL_TYPE_EXT      0x2043
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+HDC WINAPI wglGetCurrentReadDCEXT (void);
+#endif
+#endif /* WGL_EXT_make_current_read */
+
+#ifndef WGL_EXT_multisample
+#define WGL_EXT_multisample 1
+#define WGL_SAMPLE_BUFFERS_EXT            0x2041
+#define WGL_SAMPLES_EXT                   0x2042
+#endif /* WGL_EXT_multisample */
+
+#ifndef WGL_EXT_pbuffer
+#define WGL_EXT_pbuffer 1
+DECLARE_HANDLE(HPBUFFEREXT);
+#define WGL_DRAW_TO_PBUFFER_EXT           0x202D
+#define WGL_MAX_PBUFFER_PIXELS_EXT        0x202E
+#define WGL_MAX_PBUFFER_WIDTH_EXT         0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_EXT        0x2030
+#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT     0x2031
+#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT    0x2032
+#define WGL_PBUFFER_LARGEST_EXT           0x2033
+#define WGL_PBUFFER_WIDTH_EXT             0x2034
+#define WGL_PBUFFER_HEIGHT_EXT            0x2035
+typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
+int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
+BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
+BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
+#endif
+#endif /* WGL_EXT_pbuffer */
+
+#ifndef WGL_EXT_pixel_format
+#define WGL_EXT_pixel_format 1
+#define WGL_NUMBER_PIXEL_FORMATS_EXT      0x2000
+#define WGL_DRAW_TO_WINDOW_EXT            0x2001
+#define WGL_DRAW_TO_BITMAP_EXT            0x2002
+#define WGL_ACCELERATION_EXT              0x2003
+#define WGL_NEED_PALETTE_EXT              0x2004
+#define WGL_NEED_SYSTEM_PALETTE_EXT       0x2005
+#define WGL_SWAP_LAYER_BUFFERS_EXT        0x2006
+#define WGL_SWAP_METHOD_EXT               0x2007
+#define WGL_NUMBER_OVERLAYS_EXT           0x2008
+#define WGL_NUMBER_UNDERLAYS_EXT          0x2009
+#define WGL_TRANSPARENT_EXT               0x200A
+#define WGL_TRANSPARENT_VALUE_EXT         0x200B
+#define WGL_SHARE_DEPTH_EXT               0x200C
+#define WGL_SHARE_STENCIL_EXT             0x200D
+#define WGL_SHARE_ACCUM_EXT               0x200E
+#define WGL_SUPPORT_GDI_EXT               0x200F
+#define WGL_SUPPORT_OPENGL_EXT            0x2010
+#define WGL_DOUBLE_BUFFER_EXT             0x2011
+#define WGL_STEREO_EXT                    0x2012
+#define WGL_PIXEL_TYPE_EXT                0x2013
+#define WGL_COLOR_BITS_EXT                0x2014
+#define WGL_RED_BITS_EXT                  0x2015
+#define WGL_RED_SHIFT_EXT                 0x2016
+#define WGL_GREEN_BITS_EXT                0x2017
+#define WGL_GREEN_SHIFT_EXT               0x2018
+#define WGL_BLUE_BITS_EXT                 0x2019
+#define WGL_BLUE_SHIFT_EXT                0x201A
+#define WGL_ALPHA_BITS_EXT                0x201B
+#define WGL_ALPHA_SHIFT_EXT               0x201C
+#define WGL_ACCUM_BITS_EXT                0x201D
+#define WGL_ACCUM_RED_BITS_EXT            0x201E
+#define WGL_ACCUM_GREEN_BITS_EXT          0x201F
+#define WGL_ACCUM_BLUE_BITS_EXT           0x2020
+#define WGL_ACCUM_ALPHA_BITS_EXT          0x2021
+#define WGL_DEPTH_BITS_EXT                0x2022
+#define WGL_STENCIL_BITS_EXT              0x2023
+#define WGL_AUX_BUFFERS_EXT               0x2024
+#define WGL_NO_ACCELERATION_EXT           0x2025
+#define WGL_GENERIC_ACCELERATION_EXT      0x2026
+#define WGL_FULL_ACCELERATION_EXT         0x2027
+#define WGL_SWAP_EXCHANGE_EXT             0x2028
+#define WGL_SWAP_COPY_EXT                 0x2029
+#define WGL_SWAP_UNDEFINED_EXT            0x202A
+#define WGL_TYPE_RGBA_EXT                 0x202B
+#define WGL_TYPE_COLORINDEX_EXT           0x202C
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
+BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
+BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+#endif /* WGL_EXT_pixel_format */
+
+#ifndef WGL_EXT_pixel_format_packed_float
+#define WGL_EXT_pixel_format_packed_float 1
+#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT  0x20A8
+#endif /* WGL_EXT_pixel_format_packed_float */
+
+#ifndef WGL_EXT_swap_control
+#define WGL_EXT_swap_control 1
+typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
+typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglSwapIntervalEXT (int interval);
+int WINAPI wglGetSwapIntervalEXT (void);
+#endif
+#endif /* WGL_EXT_swap_control */
+
+#ifndef WGL_EXT_swap_control_tear
+#define WGL_EXT_swap_control_tear 1
+#endif /* WGL_EXT_swap_control_tear */
+
+#ifndef WGL_I3D_digital_video_control
+#define WGL_I3D_digital_video_control 1
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
+#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
+#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
+typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
+BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
+#endif
+#endif /* WGL_I3D_digital_video_control */
+
+#ifndef WGL_I3D_gamma
+#define WGL_I3D_gamma 1
+#define WGL_GAMMA_TABLE_SIZE_I3D          0x204E
+#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D     0x204F
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
+BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
+BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
+BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
+#endif
+#endif /* WGL_I3D_gamma */
+
+#ifndef WGL_I3D_genlock
+#define WGL_I3D_genlock 1
+#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D  0x2044
+#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
+#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
+#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
+#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
+#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
+#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
+#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
+#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D  0x204C
+typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
+typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
+BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
+BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
+BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
+BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
+BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
+BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
+BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
+BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
+BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
+BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
+BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
+#endif
+#endif /* WGL_I3D_genlock */
+
+#ifndef WGL_I3D_image_buffer
+#define WGL_I3D_image_buffer 1
+#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D   0x00000001
+#define WGL_IMAGE_BUFFER_LOCK_I3D         0x00000002
+typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
+typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
+typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
+typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
+#ifdef WGL_WGLEXT_PROTOTYPES
+LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
+BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
+BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
+BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
+#endif
+#endif /* WGL_I3D_image_buffer */
+
+#ifndef WGL_I3D_swap_frame_lock
+#define WGL_I3D_swap_frame_lock 1
+typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglEnableFrameLockI3D (void);
+BOOL WINAPI wglDisableFrameLockI3D (void);
+BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
+BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
+#endif
+#endif /* WGL_I3D_swap_frame_lock */
+
+#ifndef WGL_I3D_swap_frame_usage
+#define WGL_I3D_swap_frame_usage 1
+typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
+typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
+BOOL WINAPI wglBeginFrameTrackingI3D (void);
+BOOL WINAPI wglEndFrameTrackingI3D (void);
+BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
+#endif
+#endif /* WGL_I3D_swap_frame_usage */
+
+#ifndef WGL_NV_DX_interop
+#define WGL_NV_DX_interop 1
+#define WGL_ACCESS_READ_ONLY_NV           0x00000000
+#define WGL_ACCESS_READ_WRITE_NV          0x00000001
+#define WGL_ACCESS_WRITE_DISCARD_NV       0x00000002
+typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
+typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
+typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
+typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
+typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
+typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
+typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
+typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
+HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
+BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
+HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
+BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
+BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
+BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
+BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
+#endif
+#endif /* WGL_NV_DX_interop */
+
+#ifndef WGL_NV_DX_interop2
+#define WGL_NV_DX_interop2 1
+#endif /* WGL_NV_DX_interop2 */
+
+#ifndef WGL_NV_copy_image
+#define WGL_NV_copy_image 1
+typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+#endif /* WGL_NV_copy_image */
+
+#ifndef WGL_NV_delay_before_swap
+#define WGL_NV_delay_before_swap 1
+typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
+#endif
+#endif /* WGL_NV_delay_before_swap */
+
+#ifndef WGL_NV_float_buffer
+#define WGL_NV_float_buffer 1
+#define WGL_FLOAT_COMPONENTS_NV           0x20B0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
+#define WGL_TEXTURE_FLOAT_R_NV            0x20B5
+#define WGL_TEXTURE_FLOAT_RG_NV           0x20B6
+#define WGL_TEXTURE_FLOAT_RGB_NV          0x20B7
+#define WGL_TEXTURE_FLOAT_RGBA_NV         0x20B8
+#endif /* WGL_NV_float_buffer */
+
+#ifndef WGL_NV_gpu_affinity
+#define WGL_NV_gpu_affinity 1
+DECLARE_HANDLE(HGPUNV);
+struct _GPU_DEVICE {
+    DWORD  cb;
+    CHAR   DeviceName[32];
+    CHAR   DeviceString[128];
+    DWORD  Flags;
+    RECT   rcVirtualScreen;
+};
+typedef struct _GPU_DEVICE *PGPU_DEVICE;
+#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
+#define ERROR_MISSING_AFFINITY_MASK_NV    0x20D1
+typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
+typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
+typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
+typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
+typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
+BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
+HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
+BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
+BOOL WINAPI wglDeleteDCNV (HDC hdc);
+#endif
+#endif /* WGL_NV_gpu_affinity */
+
+#ifndef WGL_NV_multisample_coverage
+#define WGL_NV_multisample_coverage 1
+#define WGL_COVERAGE_SAMPLES_NV           0x2042
+#define WGL_COLOR_SAMPLES_NV              0x20B9
+#endif /* WGL_NV_multisample_coverage */
+
+#ifndef WGL_NV_present_video
+#define WGL_NV_present_video 1
+DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
+#define WGL_NUM_VIDEO_SLOTS_NV            0x20F0
+typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
+typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
+#ifdef WGL_WGLEXT_PROTOTYPES
+int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
+BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
+BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
+#endif
+#endif /* WGL_NV_present_video */
+
+#ifndef WGL_NV_render_depth_texture
+#define WGL_NV_render_depth_texture 1
+#define WGL_BIND_TO_TEXTURE_DEPTH_NV      0x20A3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
+#define WGL_DEPTH_TEXTURE_FORMAT_NV       0x20A5
+#define WGL_TEXTURE_DEPTH_COMPONENT_NV    0x20A6
+#define WGL_DEPTH_COMPONENT_NV            0x20A7
+#endif /* WGL_NV_render_depth_texture */
+
+#ifndef WGL_NV_render_texture_rectangle
+#define WGL_NV_render_texture_rectangle 1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
+#define WGL_TEXTURE_RECTANGLE_NV          0x20A2
+#endif /* WGL_NV_render_texture_rectangle */
+
+#ifndef WGL_NV_swap_group
+#define WGL_NV_swap_group 1
+typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
+typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
+typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
+BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
+BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
+BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
+BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
+BOOL WINAPI wglResetFrameCountNV (HDC hDC);
+#endif
+#endif /* WGL_NV_swap_group */
+
+#ifndef WGL_NV_vertex_array_range
+#define WGL_NV_vertex_array_range 1
+typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
+#ifdef WGL_WGLEXT_PROTOTYPES
+void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+void WINAPI wglFreeMemoryNV (void *pointer);
+#endif
+#endif /* WGL_NV_vertex_array_range */
+
+#ifndef WGL_NV_video_capture
+#define WGL_NV_video_capture 1
+DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
+#define WGL_UNIQUE_ID_NV                  0x20CE
+#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV    0x20CF
+typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
+typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
+typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
+UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
+BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
+BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+#endif
+#endif /* WGL_NV_video_capture */
+
+#ifndef WGL_NV_video_output
+#define WGL_NV_video_output 1
+DECLARE_HANDLE(HPVIDEODEV);
+#define WGL_BIND_TO_VIDEO_RGB_NV          0x20C0
+#define WGL_BIND_TO_VIDEO_RGBA_NV         0x20C1
+#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
+#define WGL_VIDEO_OUT_COLOR_NV            0x20C3
+#define WGL_VIDEO_OUT_ALPHA_NV            0x20C4
+#define WGL_VIDEO_OUT_DEPTH_NV            0x20C5
+#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV  0x20C6
+#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV  0x20C7
+#define WGL_VIDEO_OUT_FRAME               0x20C8
+#define WGL_VIDEO_OUT_FIELD_1             0x20C9
+#define WGL_VIDEO_OUT_FIELD_2             0x20CA
+#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2  0x20CB
+#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1  0x20CC
+typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
+typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
+BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
+BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
+BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
+BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
+BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#endif
+#endif /* WGL_NV_video_output */
+
+#ifndef WGL_OML_sync_control
+#define WGL_OML_sync_control 1
+typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
+typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
+#ifdef WGL_WGLEXT_PROTOTYPES
+BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
+BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
+INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
+INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
+BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
+BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
+#endif
+#endif /* WGL_OML_sync_control */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partymurmurhashMurmurHash3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -29,6 +29,8 @@
</span><span class="cx"> 
</span><span class="cx"> #else        // defined(_MSC_VER)
</span><span class="cx"> 
</span><ins>+// Ignore GCC force inline warnings
+#pragma GCC diagnostic ignored &quot;-Wattributes&quot;
</ins><span class="cx"> #define        FORCE_INLINE __attribute__((always_inline))
</span><span class="cx"> 
</span><span class="cx"> inline uint32_t rotl32 ( uint32_t x, int8_t r )
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partymurmurhashMurmurHash3h"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/murmurhash/MurmurHash3.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -20,4 +20,4 @@
</span><span class="cx"> 
</span><span class="cx"> //-----------------------------------------------------------------------------
</span><span class="cx"> 
</span><del>-#endif // _MURMURHASH3_H_
</del><span class="cx">\ No newline at end of file
</span><ins>+#endif // _MURMURHASH3_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partysysteminfoSystemInfocpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &lt;windows.h&gt;
+#include &quot;common/platform.h&quot;
+
+#if _WIN32_WINNT_WINBLUE
+#include &lt;versionhelpers.h&gt;
+#endif
+
+namespace rx {
+
+#ifndef _WIN32_WINNT_WINBLUE
+static bool IsWindowsVistaOrGreater()
+{
+    OSVERSIONINFOEXW osvi = { };
+    osvi.dwOSVersionInfoSize = sizeof(osvi);
+    osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_VISTA);
+    osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_VISTA);
+    DWORDLONG condition = 0;
+    VER_SET_CONDITION(condition, VER_MAJORVERSION, VER_GREATER_EQUAL);
+    VER_SET_CONDITION(condition, VER_MINORVERSION, VER_GREATER_EQUAL);
+    return !!::VerifyVersionInfoW(&amp;osvi, VER_MAJORVERSION | VER_MINORVERSION, condition);
+}
+#endif
+
+bool isWindowsVistaOrGreater()
+{
+    static bool initialized = false;
+    static bool cachedIsWindowsVistaOrGreater;
+
+    if (!initialized) {
+        initialized = true;
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+        cachedIsWindowsVistaOrGreater = true;
+#else
+        cachedIsWindowsVistaOrGreater = IsWindowsVistaOrGreater();
+#endif
+    }
+    return cachedIsWindowsVistaOrGreater;
+}
+
+} // namespace rx
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partysysteminfoSystemInfoh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/systeminfo/SystemInfo.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * Copyright (C) 2009 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef THIRD_PARTY_SYSTEMINFO_SYSTEMINFO_H_
+#define THIRD_PARTY_SYSTEMINFO_SYSTEMINFO_H_
+
+namespace rx {
+
+bool isWindowsVistaOrGreater();
+
+} // namespace rx
+
+#endif // THIRD_PARTY_SYSTEMINFO_SYSTEMINFO_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEsrcthird_partytrace_eventtrace_eventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/ThirdParty/ANGLE/src/third_party/trace_event/trace_event.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/src/third_party/trace_event/trace_event.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/ThirdParty/ANGLE/src/third_party/trace_event/trace_event.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -459,7 +459,7 @@
</span><span class="cx"> // const unsigned char*
</span><span class="cx"> //     TRACE_EVENT_API_GET_CATEGORY_ENABLED(const char* category_name)
</span><span class="cx"> #define TRACE_EVENT_API_GET_CATEGORY_ENABLED \
</span><del>-    gl::TraceGetTraceCategoryEnabledFlag
</del><ins>+    angle::GetTraceCategoryEnabledFlag
</ins><span class="cx"> 
</span><span class="cx"> // Add a trace event to the platform tracing system.
</span><span class="cx"> // void TRACE_EVENT_API_ADD_TRACE_EVENT(
</span><span class="lines">@@ -473,7 +473,7 @@
</span><span class="cx"> //                    const unsigned long long* arg_values,
</span><span class="cx"> //                    unsigned char flags)
</span><span class="cx"> #define TRACE_EVENT_API_ADD_TRACE_EVENT \
</span><del>-    gl::TraceAddTraceEvent
</del><ins>+    angle::AddTraceEvent
</ins><span class="cx"> 
</span><span class="cx"> ////////////////////////////////////////////////////////////////////////////////
</span><span class="cx"> 
</span><span class="lines">@@ -587,7 +587,7 @@
</span><span class="cx"> class TraceID {
</span><span class="cx"> public:
</span><span class="cx">     explicit TraceID(const void* id, unsigned char* flags) :
</span><del>-        m_data(static_cast&lt;unsigned long long&gt;(reinterpret_cast&lt;unsigned long&gt;(id)))
</del><ins>+        m_data(static_cast&lt;unsigned long long&gt;(reinterpret_cast&lt;uintptr_t&gt;(id)))
</ins><span class="cx">     {
</span><span class="cx">         *flags |= TRACE_EVENT_FLAG_MANGLE_ID;
</span><span class="cx">     }
</span><span class="lines">@@ -690,45 +690,48 @@
</span><span class="cx"> // store pointers to the internal c_str and pass through to the tracing API, the
</span><span class="cx"> // arg values must live throughout these procedures.
</span><span class="cx"> 
</span><del>-static inline void addTraceEvent(char phase,
-                                const unsigned char* categoryEnabled,
-                                const char* name,
-                                unsigned long long id,
-                                unsigned char flags) {
-    TRACE_EVENT_API_ADD_TRACE_EVENT(
</del><ins>+static inline angle::Platform::TraceEventHandle addTraceEvent(
+    char phase,
+    const unsigned char* categoryEnabled,
+    const char* name,
+    unsigned long long id,
+    unsigned char flags) {
+    return TRACE_EVENT_API_ADD_TRACE_EVENT(
</ins><span class="cx">         phase, categoryEnabled, name, id,
</span><span class="cx">         zeroNumArgs, 0, 0, 0,
</span><span class="cx">         flags);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;class ARG1_TYPE&gt;
</span><del>-static inline void addTraceEvent(char phase,
-                                const unsigned char* categoryEnabled,
-                                const char* name,
-                                unsigned long long id,
-                                unsigned char flags,
-                                const char* arg1Name,
-                                const ARG1_TYPE&amp; arg1Val) {
</del><ins>+static inline angle::Platform::TraceEventHandle addTraceEvent(
+    char phase,
+    const unsigned char* categoryEnabled,
+    const char* name,
+    unsigned long long id,
+    unsigned char flags,
+    const char* arg1Name,
+    const ARG1_TYPE&amp; arg1Val) {
</ins><span class="cx">     const int numArgs = 1;
</span><span class="cx">     unsigned char argTypes[1];
</span><span class="cx">     unsigned long long argValues[1];
</span><span class="cx">     setTraceValue(arg1Val, &amp;argTypes[0], &amp;argValues[0]);
</span><del>-    TRACE_EVENT_API_ADD_TRACE_EVENT(
</del><ins>+    return TRACE_EVENT_API_ADD_TRACE_EVENT(
</ins><span class="cx">         phase, categoryEnabled, name, id,
</span><span class="cx">         numArgs, &amp;arg1Name, argTypes, argValues,
</span><span class="cx">         flags);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;class ARG1_TYPE, class ARG2_TYPE&gt;
</span><del>-static inline void addTraceEvent(char phase,
-                                const unsigned char* categoryEnabled,
-                                const char* name,
-                                unsigned long long id,
-                                unsigned char flags,
-                                const char* arg1Name,
-                                const ARG1_TYPE&amp; arg1Val,
-                                const char* arg2Name,
-                                const ARG2_TYPE&amp; arg2Val) {
</del><ins>+static inline angle::Platform::TraceEventHandle addTraceEvent(
+    char phase,
+    const unsigned char* categoryEnabled,
+    const char* name,
+    unsigned long long id,
+    unsigned char flags,
+    const char* arg1Name,
+    const ARG1_TYPE&amp; arg1Val,
+    const char* arg2Name,
+    const ARG2_TYPE&amp; arg2Val) {
</ins><span class="cx">     const int numArgs = 2;
</span><span class="cx">     const char* argNames[2] = { arg1Name, arg2Name };
</span><span class="cx">     unsigned char argTypes[2];
</span><span class="lines">@@ -788,37 +791,6 @@
</span><span class="cx">     Data m_data;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-// TraceEventSamplingStateScope records the current sampling state
-// and sets a new sampling state. When the scope exists, it restores
-// the sampling state having recorded.
-template&lt;size_t BucketNumber&gt;
-class SamplingStateScope {
-public:
-    SamplingStateScope(const char* categoryAndName)
-    {
-        m_previousState = SamplingStateScope&lt;BucketNumber&gt;::current();
-        SamplingStateScope&lt;BucketNumber&gt;::set(categoryAndName);
-    }
-
-    ~SamplingStateScope()
-    {
-        SamplingStateScope&lt;BucketNumber&gt;::set(m_previousState);
-    }
-
-    // FIXME: Make load/store to traceSamplingState[] thread-safe and atomic.
-    static inline const char* current()
-    {
-        return reinterpret_cast&lt;const char*&gt;(*gl::traceSamplingState[BucketNumber]);
-    }
-    static inline void set(const char* categoryAndName)
-    {
-        *gl::traceSamplingState[BucketNumber] = reinterpret_cast&lt;long&gt;(const_cast&lt;char*&gt;(categoryAndName));
-    }
-
-private:
-    const char* m_previousState;
-};
-
</del><span class="cx"> } // namespace TraceEvent
</span><span class="cx"> 
</span><span class="cx"> } // namespace gl
</span></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilEGLWindowcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/EGLWindow.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/EGLWindow.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/EGLWindow.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,239 @@
</span><ins>+//
+// Copyright (c) 2013 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 &lt;string.h&gt;
+#include &lt;cassert&gt;
+#include &lt;vector&gt;
+
+#include &quot;EGLWindow.h&quot;
+#include &quot;OSWindow.h&quot;
+
+#ifdef _WIN32
+#include &quot;win32/Win32Timer.h&quot;
+#include &quot;win32/Win32Window.h&quot;
+#else
+#error unsupported OS.
+#endif
+
+EGLPlatformParameters::EGLPlatformParameters()
+    : renderer(EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE),
+      majorVersion(EGL_DONT_CARE),
+      minorVersion(EGL_DONT_CARE),
+      deviceType(EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE)
+{
+}
+
+EGLPlatformParameters::EGLPlatformParameters(EGLint renderer)
+    : renderer(renderer),
+      majorVersion(EGL_DONT_CARE),
+      minorVersion(EGL_DONT_CARE),
+      deviceType(EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE)
+{
+}
+
+EGLPlatformParameters::EGLPlatformParameters(EGLint renderer, EGLint majorVersion, EGLint minorVersion, EGLint useWarp)
+    : renderer(renderer),
+      majorVersion(majorVersion),
+      minorVersion(minorVersion),
+      deviceType(useWarp)
+{
+}
+
+
+EGLWindow::EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &amp;platform)
+    : mSurface(EGL_NO_SURFACE),
+      mContext(EGL_NO_CONTEXT),
+      mDisplay(EGL_NO_DISPLAY),
+      mClientVersion(glesMajorVersion),
+      mPlatform(platform),
+      mWidth(width),
+      mHeight(height),
+      mRedBits(-1),
+      mGreenBits(-1),
+      mBlueBits(-1),
+      mAlphaBits(-1),
+      mDepthBits(-1),
+      mStencilBits(-1),
+      mMultisample(false),
+      mSwapInterval(-1)
+{
+}
+
+EGLWindow::~EGLWindow()
+{
+    destroyGL();
+}
+
+void EGLWindow::swap()
+{
+    eglSwapBuffers(mDisplay, mSurface);
+}
+
+EGLConfig EGLWindow::getConfig() const
+{
+    return mConfig;
+}
+
+EGLDisplay EGLWindow::getDisplay() const
+{
+    return mDisplay;
+}
+
+EGLSurface EGLWindow::getSurface() const
+{
+    return mSurface;
+}
+
+EGLContext EGLWindow::getContext() const
+{
+    return mContext;
+}
+
+bool EGLWindow::initializeGL(OSWindow *osWindow)
+{
+    PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast&lt;PFNEGLGETPLATFORMDISPLAYEXTPROC&gt;(eglGetProcAddress(&quot;eglGetPlatformDisplayEXT&quot;));
+    if (!eglGetPlatformDisplayEXT)
+    {
+        return false;
+    }
+
+    const EGLint displayAttributes[] =
+    {
+        EGL_PLATFORM_ANGLE_TYPE_ANGLE,              mPlatform.renderer,
+        EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, mPlatform.majorVersion,
+        EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, mPlatform.minorVersion,
+        EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,       mPlatform.deviceType,
+        EGL_NONE,
+    };
+
+    mDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, osWindow-&gt;getNativeDisplay(), displayAttributes);
+    if (mDisplay == EGL_NO_DISPLAY)
+    {
+        destroyGL();
+        return false;
+    }
+
+    EGLint majorVersion, minorVersion;
+    if (!eglInitialize(mDisplay, &amp;majorVersion, &amp;minorVersion))
+    {
+        destroyGL();
+        return false;
+    }
+
+    eglBindAPI(EGL_OPENGL_ES_API);
+    if (eglGetError() != EGL_SUCCESS)
+    {
+        destroyGL();
+        return false;
+    }
+
+    const EGLint configAttributes[] =
+    {
+        EGL_RED_SIZE,       (mRedBits &gt;= 0)     ? mRedBits     : EGL_DONT_CARE,
+        EGL_GREEN_SIZE,     (mGreenBits &gt;= 0)   ? mGreenBits   : EGL_DONT_CARE,
+        EGL_BLUE_SIZE,      (mBlueBits &gt;= 0)    ? mBlueBits    : EGL_DONT_CARE,
+        EGL_ALPHA_SIZE,     (mAlphaBits &gt;= 0)   ? mAlphaBits   : EGL_DONT_CARE,
+        EGL_DEPTH_SIZE,     (mDepthBits &gt;= 0)   ? mDepthBits   : EGL_DONT_CARE,
+        EGL_STENCIL_SIZE,   (mStencilBits &gt;= 0) ? mStencilBits : EGL_DONT_CARE,
+        EGL_SAMPLE_BUFFERS, mMultisample ? 1 : 0,
+        EGL_NONE
+    };
+
+    EGLint configCount;
+    if (!eglChooseConfig(mDisplay, configAttributes, &amp;mConfig, 1, &amp;configCount) || (configCount != 1))
+    {
+        destroyGL();
+        return false;
+    }
+
+    eglGetConfigAttrib(mDisplay, mConfig, EGL_RED_SIZE, &amp;mRedBits);
+    eglGetConfigAttrib(mDisplay, mConfig, EGL_GREEN_SIZE, &amp;mGreenBits);
+    eglGetConfigAttrib(mDisplay, mConfig, EGL_BLUE_SIZE, &amp;mBlueBits);
+    eglGetConfigAttrib(mDisplay, mConfig, EGL_ALPHA_SIZE, &amp;mBlueBits);
+    eglGetConfigAttrib(mDisplay, mConfig, EGL_DEPTH_SIZE, &amp;mDepthBits);
+    eglGetConfigAttrib(mDisplay, mConfig, EGL_STENCIL_SIZE, &amp;mStencilBits);
+
+    std::vector&lt;EGLint&gt; surfaceAttributes;
+    if (strstr(eglQueryString(mDisplay, EGL_EXTENSIONS), &quot;EGL_NV_post_sub_buffer&quot;) != nullptr)
+    {
+        surfaceAttributes.push_back(EGL_POST_SUB_BUFFER_SUPPORTED_NV);
+        surfaceAttributes.push_back(EGL_TRUE);
+    }
+
+    surfaceAttributes.push_back(EGL_NONE);
+    surfaceAttributes.push_back(EGL_NONE);
+
+    mSurface = eglCreateWindowSurface(mDisplay, mConfig, osWindow-&gt;getNativeWindow(), &amp;surfaceAttributes[0]);
+    if (mSurface == EGL_NO_SURFACE)
+    {
+        eglGetError(); // Clear error and try again
+        mSurface = eglCreateWindowSurface(mDisplay, mConfig, NULL, NULL);
+    }
+
+    if (eglGetError() != EGL_SUCCESS)
+    {
+        destroyGL();
+        return false;
+    }
+
+    EGLint contextAttibutes[] =
+    {
+        EGL_CONTEXT_CLIENT_VERSION, mClientVersion,
+        EGL_NONE
+    };
+
+    mContext = eglCreateContext(mDisplay, mConfig, NULL, contextAttibutes);
+    if (eglGetError() != EGL_SUCCESS)
+    {
+        destroyGL();
+        return false;
+    }
+
+    eglMakeCurrent(mDisplay, mSurface, mSurface, mContext);
+    if (eglGetError() != EGL_SUCCESS)
+    {
+        destroyGL();
+        return false;
+    }
+
+    if (mSwapInterval != -1)
+    {
+        eglSwapInterval(mDisplay, mSwapInterval);
+    }
+
+    return true;
+}
+
+void EGLWindow::destroyGL()
+{
+    if (mSurface != EGL_NO_SURFACE)
+    {
+        assert(mDisplay != EGL_NO_DISPLAY);
+        eglDestroySurface(mDisplay, mSurface);
+        mSurface = EGL_NO_SURFACE;
+    }
+
+    if (mContext != EGL_NO_CONTEXT)
+    {
+        assert(mDisplay != EGL_NO_DISPLAY);
+        eglDestroyContext(mDisplay, mContext);
+        mContext = EGL_NO_CONTEXT;
+    }
+
+    if (mDisplay != EGL_NO_DISPLAY)
+    {
+        eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+        eglTerminate(mDisplay);
+        mDisplay = EGL_NO_DISPLAY;
+    }
+}
+
+bool EGLWindow::isGLInitialized() const
+{
+    return mSurface != EGL_NO_SURFACE &amp;&amp;
+           mContext != EGL_NO_CONTEXT &amp;&amp;
+           mDisplay != EGL_NO_DISPLAY;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilEGLWindowh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/EGLWindow.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/EGLWindow.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/EGLWindow.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,108 @@
</span><ins>+//
+// Copyright (c) 2014 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 UTIL_EGLWINDOW_H_
+#define UTIL_EGLWINDOW_H_
+
+#define GL_GLEXT_PROTOTYPES
+
+#include &lt;GLES3/gl3.h&gt;
+#include &lt;GLES3/gl3ext.h&gt;
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;GLES2/gl2ext.h&gt;
+#include &lt;EGL/egl.h&gt;
+#include &lt;EGL/eglext.h&gt;
+
+#include &lt;string&gt;
+#include &lt;list&gt;
+#include &lt;cstdint&gt;
+#include &lt;memory&gt;
+
+#include &quot;common/angleutils.h&quot;
+
+class OSWindow;
+
+// A hidden define used in some renderers (currently D3D-only)
+// to init a no-op renderer. Useful for performance testing.
+#ifndef EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
+#endif
+
+struct EGLPlatformParameters
+{
+    EGLint renderer;
+    EGLint majorVersion;
+    EGLint minorVersion;
+    EGLint deviceType;
+
+    EGLPlatformParameters();
+    explicit EGLPlatformParameters(EGLint renderer);
+    EGLPlatformParameters(EGLint renderer, EGLint majorVersion, EGLint minorVersion, EGLint deviceType);
+};
+
+class EGLWindow : angle::NonCopyable
+{
+  public:
+    EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &amp;platform);
+
+    ~EGLWindow();
+
+    void setClientVersion(EGLint glesMajorVersion) { mClientVersion = glesMajorVersion; }
+    void setWidth(size_t width) { mWidth = width; }
+    void setHeight(size_t height) { mHeight = height; }
+    void setConfigRedBits(int bits) { mRedBits = bits; }
+    void setConfigGreenBits(int bits) { mGreenBits = bits; }
+    void setConfigBlueBits(int bits) { mBlueBits = bits; }
+    void setConfigAlphaBits(int bits) { mAlphaBits = bits; }
+    void setConfigDepthBits(int bits) { mDepthBits = bits; }
+    void setConfigStencilBits(int bits) { mStencilBits = bits; }
+    void setMultisample(bool multisample) { mMultisample = multisample; }
+    void setSwapInterval(EGLint swapInterval) { mSwapInterval = swapInterval; }
+
+    void swap();
+
+    EGLint getClientVersion() const { return mClientVersion; }
+    const EGLPlatformParameters &amp;getPlatform() const { return mPlatform; }
+    EGLConfig getConfig() const;
+    EGLDisplay getDisplay() const;
+    EGLSurface getSurface() const;
+    EGLContext getContext() const;
+    size_t getWidth() const { return mWidth; }
+    size_t getHeight() const { return mHeight; }
+    int getConfigRedBits() const { return mRedBits; }
+    int getConfigGreenBits() const { return mGreenBits; }
+    int getConfigBlueBits() const { return mBlueBits; }
+    int getConfigAlphaBits() const { return mAlphaBits; }
+    int getConfigDepthBits() const { return mDepthBits; }
+    int getConfigStencilBits() const { return mStencilBits; }
+    bool isMultisample() const { return mMultisample; }
+    EGLint getSwapInterval() const { return mSwapInterval; }
+
+    bool initializeGL(OSWindow *osWindow);
+    void destroyGL();
+    bool isGLInitialized() const;
+
+  private:
+    EGLConfig mConfig;
+    EGLDisplay mDisplay;
+    EGLSurface mSurface;
+    EGLContext mContext;
+
+    EGLint mClientVersion;
+    EGLPlatformParameters mPlatform;
+    size_t mWidth;
+    size_t mHeight;
+    int mRedBits;
+    int mGreenBits;
+    int mBlueBits;
+    int mAlphaBits;
+    int mDepthBits;
+    int mStencilBits;
+    bool mMultisample;
+    EGLint mSwapInterval;
+};
+
+#endif // UTIL_EGLWINDOW_H_
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilEventh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/Event.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/Event.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/Event.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_EVENT_H
+#define SAMPLE_UTIL_EVENT_H
+
+#include &quot;keyboard.h&quot;
+#include &quot;mouse.h&quot;
+
+class Event
+{
+  public:
+    struct MoveEvent
+    {
+        int X;
+        int Y;
+    };
+
+    struct SizeEvent
+    {
+        int Width;
+        int Height;
+    };
+
+    struct KeyEvent
+    {
+        Key Code;
+        bool Alt;
+        bool Control;
+        bool Shift;
+        bool System;
+    };
+
+    struct MouseMoveEvent
+    {
+        int X;
+        int Y;
+    };
+
+    struct MouseButtonEvent
+    {
+        MouseButton Button;
+        int X;
+        int Y;
+    };
+
+    struct MouseWheelEvent
+    {
+        int Delta;
+    };
+
+    enum EventType
+    {
+        EVENT_CLOSED,                // The window requested to be closed
+        EVENT_MOVED,                 // The window has moved
+        EVENT_RESIZED,               // The window was resized
+        EVENT_LOST_FOCUS,            // The window lost the focus
+        EVENT_GAINED_FOCUS,          // The window gained the focus
+        EVENT_TEXT_ENTERED,          // A character was entered
+        EVENT_KEY_PRESSED,           // A key was pressed
+        EVENT_KEY_RELEASED,          // A key was released
+        EVENT_MOUSE_WHEEL_MOVED,     // The mouse wheel was scrolled
+        EVENT_MOUSE_BUTTON_PRESSED,  // A mouse button was pressed
+        EVENT_MOUSE_BUTTON_RELEASED, // A mouse button was released
+        EVENT_MOUSE_MOVED,           // The mouse cursor moved
+        EVENT_MOUSE_ENTERED,         // The mouse cursor entered the area of the window
+        EVENT_MOUSE_LEFT,            // The mouse cursor left the area of the window
+        EVENT_TEST,                  // Event for testing purposes
+    };
+
+    EventType Type;
+
+    union
+    {
+        MoveEvent               Move;               // Move event parameters
+        SizeEvent               Size;               // Size event parameters
+        KeyEvent                Key;                // Key event parameters
+        MouseMoveEvent          MouseMove;          // Mouse move event parameters
+        MouseButtonEvent        MouseButton;        // Mouse button event parameters
+        MouseWheelEvent         MouseWheel;         // Mouse wheel event parameters
+    };
+};
+
+#endif // SAMPLE_UTIL_EVENT_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilOSWindowcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/OSWindow.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/OSWindow.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/OSWindow.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;OSWindow.h&quot;
+
+OSWindow::OSWindow()
+    : mX(0),
+      mY(0),
+      mWidth(0),
+      mHeight(0)
+{
+}
+
+OSWindow::~OSWindow()
+{}
+
+int OSWindow::getX() const
+{
+    return mX;
+}
+
+int OSWindow::getY() const
+{
+    return mY;
+}
+
+int OSWindow::getWidth() const
+{
+    return mWidth;
+}
+
+int OSWindow::getHeight() const
+{
+    return mHeight;
+}
+
+bool OSWindow::popEvent(Event *event)
+{
+    if (mEvents.size() &gt; 0 &amp;&amp; event)
+    {
+        *event = mEvents.front();
+        mEvents.pop_front();
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+void OSWindow::pushEvent(Event event)
+{
+    switch (event.Type)
+    {
+      case Event::EVENT_MOVED:
+        mX = event.Move.X;
+        mY = event.Move.Y;
+        break;
+      case Event::EVENT_RESIZED:
+        mWidth = event.Size.Width;
+        mHeight = event.Size.Height;
+        break;
+      default:
+        break;
+    }
+
+    mEvents.push_back(event);
+}
+
+bool OSWindow::didTestEventFire()
+{
+    Event topEvent;
+    while (popEvent(&amp;topEvent))
+    {
+        if (topEvent.Type == Event::EVENT_TEST)
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilOSWindowh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/OSWindow.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/OSWindow.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/OSWindow.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_WINDOW_H
+#define SAMPLE_UTIL_WINDOW_H
+
+#include &quot;Event.h&quot;
+
+#include &lt;EGL/egl.h&gt;
+#include &lt;EGL/eglext.h&gt;
+#include &lt;list&gt;
+#include &lt;string&gt;
+
+class OSWindow
+{
+  public:
+    OSWindow();
+    virtual ~OSWindow();
+
+    virtual bool initialize(const std::string &amp;name, size_t width, size_t height) = 0;
+    virtual void destroy() = 0;
+
+    int getX() const;
+    int getY() const;
+    int getWidth() const;
+    int getHeight() const;
+
+    virtual EGLNativeWindowType getNativeWindow() const = 0;
+    virtual EGLNativeDisplayType getNativeDisplay() const = 0;
+
+    virtual void messageLoop() = 0;
+
+    bool popEvent(Event *event);
+    virtual void pushEvent(Event event);
+
+    virtual void setMousePosition(int x, int y) = 0;
+    virtual bool setPosition(int x, int y) = 0;
+    virtual bool resize(int width, int height) = 0;
+    virtual void setVisible(bool isVisible) = 0;
+
+    virtual void signalTestEvent() = 0;
+
+    // Pops events look for the test event
+    bool didTestEventFire();
+
+  protected:
+    int mX;
+    int mY;
+    int mWidth;
+    int mHeight;
+
+    std::list&lt;Event&gt; mEvents;
+};
+
+OSWindow *CreateOSWindow();
+
+#endif // SAMPLE_UTIL_WINDOW_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilTimerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/Timer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/Timer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/Timer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_TIMER_H
+#define SAMPLE_UTIL_TIMER_H
+
+class Timer
+{
+  public:
+    virtual ~Timer() {}
+    virtual void start() = 0;
+    virtual void stop() = 0;
+    virtual double getElapsedTime() const = 0;
+};
+
+Timer *CreateTimer();
+
+#endif // SAMPLE_UTIL_TIMER_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilcom_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/com_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/com_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/com_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+//
+// Copyright (c) 2014 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.
+//
+
+// com_utils.h: Utility functions for working with COM objects
+
+#ifndef UTIL_COM_UTILS_H
+#define UTIL_COM_UTILS_H
+
+template &lt;typename outType&gt;
+inline outType *DynamicCastComObject(IUnknown *object)
+{
+    outType *outObject = nullptr;
+    HRESULT result = object-&gt;QueryInterface(__uuidof(outType), reinterpret_cast&lt;void**&gt;(&amp;outObject));
+    if (SUCCEEDED(result))
+    {
+        return outObject;
+    }
+    else
+    {
+        SafeRelease(outObject);
+        return nullptr;
+    }
+}
+
+#endif // UTIL_COM_UTILS_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilkeyboardh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/keyboard.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/keyboard.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/keyboard.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_KEYBOARD_H
+#define SAMPLE_UTIL_KEYBOARD_H
+
+enum Key
+{
+    KEY_UNKNOWN,
+    KEY_A,            // The A key
+    KEY_B,            // The B key
+    KEY_C,            // The C key
+    KEY_D,            // The D key
+    KEY_E,            // The E key
+    KEY_F,            // The F key
+    KEY_G,            // The G key
+    KEY_H,            // The H key
+    KEY_I,            // The I key
+    KEY_J,            // The J key
+    KEY_K,            // The K key
+    KEY_L,            // The L key
+    KEY_M,            // The M key
+    KEY_N,            // The N key
+    KEY_O,            // The O key
+    KEY_P,            // The P key
+    KEY_Q,            // The Q key
+    KEY_R,            // The R key
+    KEY_S,            // The S key
+    KEY_T,            // The T key
+    KEY_U,            // The U key
+    KEY_V,            // The V key
+    KEY_W,            // The W key
+    KEY_X,            // The X key
+    KEY_Y,            // The Y key
+    KEY_Z,            // The Z key
+    KEY_NUM0,         // The 0 key
+    KEY_NUM1,         // The 1 key
+    KEY_NUM2,         // The 2 key
+    KEY_NUM3,         // The 3 key
+    KEY_NUM4,         // The 4 key
+    KEY_NUM5,         // The 5 key
+    KEY_NUM6,         // The 6 key
+    KEY_NUM7,         // The 7 key
+    KEY_NUM8,         // The 8 key
+    KEY_NUM9,         // The 9 key
+    KEY_ESCAPE,       // The escape key
+    KEY_LCONTROL,     // The left control key
+    KEY_LSHIFT,       // The left shift key
+    KEY_LALT,         // The left alt key
+    KEY_LSYSTEM,      // The left OS specific key: Window (Windows and Linux), Apple (MacOS X), ...
+    KEY_RCONTROL,     // The right control key
+    KEY_RSHIFT,       // The right shift key
+    KEY_RALT,         // The right alt key
+    KEY_RSYSTEM,      // The right OS specific key: Window (Windows and Linux), Apple (MacOS X), ...
+    KEY_MENU,         // The menu key
+    KEY_LBRACKET,     // The [ key
+    KEY_RBRACKET,     // The ] key
+    KEY_SEMICOLON,    // The ; key
+    KEY_COMMA,        // The , key
+    KEY_PERIOD,       // The . key
+    KEY_QUOTE,        // The ' key
+    KEY_SLASH,        // The / key
+    KEY_BACKSLASH,    // The \ key
+    KEY_TILDE,        // The ~ key
+    KEY_EQUAL,        // The = key
+    KEY_DASH,         // The - key
+    KEY_SPACE,        // The space key
+    KEY_RETURN,       // The return key
+    KEY_BACK,         // The backspace key
+    KEY_TAB,          // The tabulation key
+    KEY_PAGEUP,       // The page up key
+    KEY_PAGEDOWN,     // The page down key
+    KEY_END,          // The end key
+    KEY_HOME,         // The home key
+    KEY_INSERT,       // The insert key
+    KEY_DELETE,       // The delete key
+    KEY_ADD,          // +
+    KEY_SUBTRACT,     // -
+    KEY_MULTIPLY,     // *
+    KEY_DIVIDE,       // /
+    KEY_LEFT,         // Left arrow
+    KEY_RIGHT,        // Right arrow
+    KEY_UP,           // Up arrow
+    KEY_DOWN,         // Down arrow
+    KEY_NUMPAD0,      // The numpad 0 key
+    KEY_NUMPAD1,      // The numpad 1 key
+    KEY_NUMPAD2,      // The numpad 2 key
+    KEY_NUMPAD3,      // The numpad 3 key
+    KEY_NUMPAD4,      // The numpad 4 key
+    KEY_NUMPAD5,      // The numpad 5 key
+    KEY_NUMPAD6,      // The numpad 6 key
+    KEY_NUMPAD7,      // The numpad 7 key
+    KEY_NUMPAD8,      // The numpad 8 key
+    KEY_NUMPAD9,      // The numpad 9 key
+    KEY_F1,           // The F1 key
+    KEY_F2,           // The F2 key
+    KEY_F3,           // The F3 key
+    KEY_F4,           // The F4 key
+    KEY_F5,           // The F5 key
+    KEY_F6,           // The F6 key
+    KEY_F7,           // The F7 key
+    KEY_F8,           // The F8 key
+    KEY_F9,           // The F8 key
+    KEY_F10,          // The F10 key
+    KEY_F11,          // The F11 key
+    KEY_F12,          // The F12 key
+    KEY_F13,          // The F13 key
+    KEY_F14,          // The F14 key
+    KEY_F15,          // The F15 key
+    KEY_PAUSE,        // The pause key
+    KEY_COUNT,
+};
+
+#endif // SAMPLE_UTIL_KEYBOARD_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilmouseh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/mouse.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/mouse.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/mouse.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_MOUSE_H
+#define SAMPLE_UTIL_MOUSE_H
+
+enum MouseButton
+{
+    MOUSEBUTTON_UNKNOWN,
+    MOUSEBUTTON_LEFT,
+    MOUSEBUTTON_RIGHT,
+    MOUSEBUTTON_MIDDLE,
+    MOUSEBUTTON_BUTTON4,
+    MOUSEBUTTON_BUTTON5,
+    MOUSEBUTTON_COUNT,
+};
+
+#endif // SAMPLE_UTIL_MOUSE_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilpath_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/path_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/path_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/path_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_PATH_UTILS_H
+#define SAMPLE_UTIL_PATH_UTILS_H
+
+#include &lt;string&gt;
+
+std::string GetExecutablePath();
+std::string GetExecutableDirectory();
+
+#endif // SAMPLE_UTIL_PATH_UTILS_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilrandom_utilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/random_utils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/random_utils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/random_utils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;random_utils.h&quot;
+#include &lt;time.h&gt;
+#include &lt;cstdlib&gt;
+
+float RandomBetween(float min, float max)
+{
+    static bool randInitialized = false;
+    if (!randInitialized)
+    {
+        srand(static_cast&lt;unsigned int&gt;(time(NULL)));
+        randInitialized = true;
+    }
+
+    const size_t divisor = 10000;
+    return min + ((rand() % divisor) / static_cast&lt;float&gt;(divisor)) * (max - min);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilrandom_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/random_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/random_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/random_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+//
+// Copyright (c) 2014 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 UTIL_RANDOM_UTILS_H
+#define UTIL_RANDOM_UTILS_H
+
+float RandomBetween(float min, float max);
+
+#endif // UTIL_RANDOM_UTILS_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilshader_utilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/shader_utils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/shader_utils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/shader_utils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,125 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;shader_utils.h&quot;
+
+#include &lt;vector&gt;
+#include &lt;iostream&gt;
+#include &lt;fstream&gt;
+
+static std::string ReadFileToString(const std::string &amp;source)
+{
+    std::ifstream stream(source);
+    if (!stream)
+    {
+        std::cerr &lt;&lt; &quot;Failed to load shader file: &quot; &lt;&lt; source;
+        return &quot;&quot;;
+    }
+
+    std::string result;
+
+    stream.seekg(0, std::ios::end);
+    result.reserve(static_cast&lt;unsigned int&gt;(stream.tellg()));
+    stream.seekg(0, std::ios::beg);
+
+    result.assign((std::istreambuf_iterator&lt;char&gt;(stream)), std::istreambuf_iterator&lt;char&gt;());
+
+    return result;
+}
+
+GLuint CompileShader(GLenum type, const std::string &amp;source)
+{
+    GLuint shader = glCreateShader(type);
+
+    const char *sourceArray[1] = { source.c_str() };
+    glShaderSource(shader, 1, sourceArray, NULL);
+    glCompileShader(shader);
+
+    GLint compileResult;
+    glGetShaderiv(shader, GL_COMPILE_STATUS, &amp;compileResult);
+
+    if (compileResult == 0)
+    {
+        GLint infoLogLength;
+        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &amp;infoLogLength);
+
+        std::vector&lt;GLchar&gt; infoLog(infoLogLength);
+        glGetShaderInfoLog(shader, infoLog.size(), NULL, &amp;infoLog[0]);
+
+        std::cerr &lt;&lt; &quot;shader compilation failed: &quot; &lt;&lt; &amp;infoLog[0];
+
+        glDeleteShader(shader);
+        shader = 0;
+    }
+
+    return shader;
+}
+
+GLuint CompileShaderFromFile(GLenum type, const std::string &amp;sourcePath)
+{
+    std::string source = ReadFileToString(sourcePath);
+    if (source.empty())
+    {
+        return 0;
+    }
+
+    return CompileShader(type, source);
+}
+
+GLuint CompileProgram(const std::string &amp;vsSource, const std::string &amp;fsSource)
+{
+    GLuint program = glCreateProgram();
+
+    GLuint vs = CompileShader(GL_VERTEX_SHADER, vsSource);
+    GLuint fs = CompileShader(GL_FRAGMENT_SHADER, fsSource);
+
+    if (vs == 0 || fs == 0)
+    {
+        glDeleteShader(fs);
+        glDeleteShader(vs);
+        glDeleteProgram(program);
+        return 0;
+    }
+
+    glAttachShader(program, vs);
+    glDeleteShader(vs);
+
+    glAttachShader(program, fs);
+    glDeleteShader(fs);
+
+    glLinkProgram(program);
+
+    GLint linkStatus;
+    glGetProgramiv(program, GL_LINK_STATUS, &amp;linkStatus);
+
+    if (linkStatus == 0)
+    {
+        GLint infoLogLength;
+        glGetProgramiv(program, GL_INFO_LOG_LENGTH, &amp;infoLogLength);
+
+        std::vector&lt;GLchar&gt; infoLog(infoLogLength);
+        glGetProgramInfoLog(program, infoLog.size(), NULL, &amp;infoLog[0]);
+
+        std::cerr &lt;&lt; &quot;program link failed: &quot; &lt;&lt; &amp;infoLog[0];
+
+        glDeleteProgram(program);
+        return 0;
+    }
+
+    return program;
+}
+
+GLuint CompileProgramFromFiles(const std::string &amp;vsPath, const std::string &amp;fsPath)
+{
+    std::string vsSource = ReadFileToString(vsPath);
+    std::string fsSource = ReadFileToString(fsPath);
+    if (vsSource.empty() || fsSource.empty())
+    {
+        return 0;
+    }
+
+    return CompileProgram(vsSource, fsSource);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilshader_utilsh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/shader_utils.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/shader_utils.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/shader_utils.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_SHADER_UTILS_H
+#define SAMPLE_UTIL_SHADER_UTILS_H
+
+#define GL_GLEXT_PROTOTYPES
+
+#include &lt;GLES3/gl3.h&gt;
+#include &lt;GLES3/gl3ext.h&gt;
+#include &lt;GLES2/gl2.h&gt;
+#include &lt;GLES2/gl2ext.h&gt;
+#include &lt;EGL/egl.h&gt;
+#include &lt;EGL/eglext.h&gt;
+
+#include &lt;string&gt;
+
+#define SHADER_SOURCE(...) #__VA_ARGS__
+
+GLuint CompileShader(GLenum type, const std::string &amp;source);
+GLuint CompileShaderFromFile(GLenum type, const std::string &amp;sourcePath);
+
+GLuint CompileProgram(const std::string &amp;vsSource, const std::string &amp;fsSource);
+GLuint CompileProgramFromFiles(const std::string &amp;vsPath, const std::string &amp;fsPath);
+
+#endif // SAMPLE_UTIL_SHADER_UTILS_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutiltestfixturetypesh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/testfixturetypes.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/testfixturetypes.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/testfixturetypes.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,121 @@
</span><ins>+//
+// Copyright (c) 2014 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 UTIL_TEST_FIXTURE_TYPES_H
+#define UTIL_TEST_FIXTURE_TYPES_H
+
+#include &quot;EGLWindow.h&quot;
+
+#include &lt;EGL/egl.h&gt;
+#include &lt;EGL/eglext.h&gt;
+
+template&lt;EGLint platform, EGLint platformMajorVersion, EGLint platformMinorVersion, EGLint warp&gt;
+struct Platform
+{
+    static EGLPlatformParameters GetPlatform()
+    {
+        return EGLPlatformParameters(platform, platformMajorVersion, platformMinorVersion, warp);
+    }
+};
+
+// Typedefs of common platform types
+#define DEFINE_ANGLE_TEST_PLATFORM(name, platform, majorVersion, minorVersion, useWarp) \
+    struct name : public Platform&lt;platform, majorVersion, minorVersion, useWarp&gt; { }
+
+DEFINE_ANGLE_TEST_PLATFORM(D3D9,                   EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,     EGL_DONT_CARE, EGL_DONT_CARE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D9_REFERENCE,         EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,     EGL_DONT_CARE, EGL_DONT_CARE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
+
+DEFINE_ANGLE_TEST_PLATFORM(D3D11,                  EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,    EGL_DONT_CARE, EGL_DONT_CARE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_1,           EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               11,             1, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_0,           EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               11,             0, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_1,           EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               10,             1, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_0,           EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               10,             0, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL9_3,            EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,                9,             3, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_WARP,             EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,    EGL_DONT_CARE, EGL_DONT_CARE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_1_WARP,      EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               11,             1, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_0_WARP,      EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               11,             0, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_1_WARP,      EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               10,             1, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_0_WARP,      EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               10,             0, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL9_3_WARP,       EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,                9,             3, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
+
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_REFERENCE,        EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,    EGL_DONT_CARE, EGL_DONT_CARE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_1_REFERENCE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               11,             1, EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_0_REFERENCE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               11,             0, EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_1_REFERENCE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               10,             1, EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_0_REFERENCE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,               10,             0, EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL9_3_REFERENCE,  EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,                9,             3, EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE);
+
+DEFINE_ANGLE_TEST_PLATFORM(OPENGL,                 EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE,   EGL_DONT_CARE, EGL_DONT_CARE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+DEFINE_ANGLE_TEST_PLATFORM(OPENGLES,               EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);
+
+#undef DEFINE_ANGLE_TEST_PLATFORM
+
+// Test Fixture Type
+template&lt;GLint GLESMajorVersion, typename platformT&gt;
+struct TestFixture
+{
+    static EGLint GetGlesMajorVersion()
+    {
+        return GLESMajorVersion;
+    }
+
+    static EGLPlatformParameters GetPlatform()
+    {
+        return platformT::GetPlatform();
+    }
+};
+
+// Typedefs of common fixture types
+typedef TestFixture&lt;2, D3D9&gt;                   ES2_D3D9;
+typedef TestFixture&lt;2, D3D9_REFERENCE&gt;         ES2_D3D9_REFERENCE;
+
+typedef TestFixture&lt;2, D3D11&gt;                  ES2_D3D11;
+typedef TestFixture&lt;2, D3D11_FL11_0&gt;           ES2_D3D11_FL11_0;
+typedef TestFixture&lt;2, D3D11_FL10_1&gt;           ES2_D3D11_FL10_1;
+typedef TestFixture&lt;2, D3D11_FL10_0&gt;           ES2_D3D11_FL10_0;
+typedef TestFixture&lt;2, D3D11_FL9_3&gt;            ES2_D3D11_FL9_3;
+
+typedef TestFixture&lt;2, D3D11_WARP&gt;             ES2_D3D11_WARP;
+typedef TestFixture&lt;2, D3D11_FL11_0_WARP&gt;      ES2_D3D11_FL11_0_WARP;
+typedef TestFixture&lt;2, D3D11_FL10_1_WARP&gt;      ES2_D3D11_FL10_1_WARP;
+typedef TestFixture&lt;2, D3D11_FL10_0_WARP&gt;      ES2_D3D11_FL10_0_WARP;
+typedef TestFixture&lt;2, D3D11_FL9_3_WARP&gt;       ES2_D3D11_FL9_3_WARP;
+
+typedef TestFixture&lt;2, D3D11_REFERENCE&gt;        ES2_D3D11_REFERENCE;
+typedef TestFixture&lt;2, D3D11_FL11_0_REFERENCE&gt; ES2_D3D11_FL11_0_REFERENCE;
+typedef TestFixture&lt;2, D3D11_FL10_1_REFERENCE&gt; ES2_D3D11_FL10_1_REFERENCE;
+typedef TestFixture&lt;2, D3D11_FL10_0_REFERENCE&gt; ES2_D3D11_FL10_0_REFERENCE;
+typedef TestFixture&lt;2, D3D11_FL9_3_REFERENCE&gt;  ES2_D3D11_FL9_3_REFERENCE;
+
+typedef TestFixture&lt;2, OPENGL&gt;                 ES2_OPENGL;
+typedef TestFixture&lt;2, OPENGLES&gt;               ES2_OPENGLES;
+
+typedef TestFixture&lt;3, D3D11&gt;                  ES3_D3D11;
+typedef TestFixture&lt;3, D3D11_FL11_1&gt;           ES3_D3D11_FL11_1;
+typedef TestFixture&lt;3, D3D11_FL11_0&gt;           ES3_D3D11_FL11_0;
+typedef TestFixture&lt;3, D3D11_FL10_1&gt;           ES3_D3D11_FL10_1;
+typedef TestFixture&lt;3, D3D11_FL10_0&gt;           ES3_D3D11_FL10_0;
+
+typedef TestFixture&lt;3, D3D11_WARP&gt;             ES3_D3D11_WARP;
+typedef TestFixture&lt;3, D3D11_FL11_0_WARP&gt;      ES3_D3D11_FL11_0_WARP;
+typedef TestFixture&lt;3, D3D11_FL10_1_WARP&gt;      ES3_D3D11_FL10_1_WARP;
+typedef TestFixture&lt;3, D3D11_FL10_0_WARP&gt;      ES3_D3D11_FL10_0_WARP;
+
+typedef TestFixture&lt;3, D3D11_REFERENCE&gt;        ES3_D3D11_REFERENCE;
+typedef TestFixture&lt;3, D3D11_FL11_1_REFERENCE&gt; ES3_D3D11_FL11_1_REFERENCE;
+typedef TestFixture&lt;3, D3D11_FL11_0_REFERENCE&gt; ES3_D3D11_FL11_0_REFERENCE;
+typedef TestFixture&lt;3, D3D11_FL10_1_REFERENCE&gt; ES3_D3D11_FL10_1_REFERENCE;
+typedef TestFixture&lt;3, D3D11_FL10_0_REFERENCE&gt; ES3_D3D11_FL10_0_REFERENCE;
+
+typedef TestFixture&lt;3, OPENGL&gt;                 ES3_OPENGL;
+typedef TestFixture&lt;3, OPENGLES&gt;               ES3_OPENGLES;
+
+#define ANGLE_TYPED_TEST_CASE(testName, ...) \
+    typedef ::testing::Types&lt;__VA_ARGS__&gt; Helper##testName; \
+    TYPED_TEST_CASE(testName, Helper##testName);
+
+#endif // UTIL_TEST_FIXTURE_TYPES_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilutilgyp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/util.gyp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/util.gyp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/util.gyp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+# Copyright (c) 2014 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.
+
+{
+    'conditions':
+    [
+        ['OS==&quot;win&quot;',
+        {
+            'targets':
+            [
+                {
+                    'target_name': 'angle_util',
+                    'type': 'static_library',
+                    'includes': [ '../build/common_defines.gypi', ],
+                    'dependencies':
+                    [
+                        '&lt;(angle_path)/src/angle.gyp:angle_common',
+                        '&lt;(angle_path)/src/angle.gyp:libEGL',
+                        '&lt;(angle_path)/src/angle.gyp:libGLESv2',
+                    ],
+                    'export_dependent_settings':
+                    [
+                        '&lt;(angle_path)/src/angle.gyp:angle_common',
+                    ],
+                    'include_dirs':
+                    [
+                        '&lt;(angle_path)/include',
+                        '&lt;(angle_path)/util',
+                    ],
+                    'sources':
+                    [
+                        'com_utils.h',
+                        'keyboard.h',
+                        'mouse.h',
+                        'path_utils.h',
+                        'random_utils.cpp',
+                        'random_utils.h',
+                        'shader_utils.cpp',
+                        'shader_utils.h',
+                        'testfixturetypes.h',
+                        'EGLWindow.cpp',
+                        'EGLWindow.h',
+                        'Event.h',
+                        'OSWindow.cpp',
+                        'OSWindow.h',
+                        'Timer.h',
+                        'win32/Win32_path_utils.cpp',
+                        'win32/Win32Timer.cpp',
+                        'win32/Win32Timer.h',
+                        'win32/Win32Window.cpp',
+                        'win32/Win32Window.h',
+                    ],
+                    'msvs_disabled_warnings': [ 4201 ],
+                    'direct_dependent_settings':
+                    {
+                        'include_dirs':
+                        [
+                            '&lt;(angle_path)/include',
+                            '&lt;(angle_path)/util',
+                        ],
+                    },
+                },
+            ],
+        }],
+    ],
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilwin32Win32Timercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;win32/Win32Timer.h&quot;
+
+Win32Timer::Win32Timer()
+    : mRunning(false),
+      mStartTime(0),
+      mStopTime(0)
+{
+}
+
+void Win32Timer::start()
+{
+    LARGE_INTEGER frequency;
+    QueryPerformanceFrequency(&amp;frequency);
+    mFrequency = frequency.QuadPart;
+
+    LARGE_INTEGER curTime;
+    QueryPerformanceCounter(&amp;curTime);
+    mStartTime = curTime.QuadPart;
+
+    mRunning = true;
+}
+
+void Win32Timer::stop()
+{
+    LARGE_INTEGER curTime;
+    QueryPerformanceCounter(&amp;curTime);
+    mStopTime = curTime.QuadPart;
+
+    mRunning = false;
+}
+
+double Win32Timer::getElapsedTime() const
+{
+    LONGLONG endTime;
+    if (mRunning)
+    {
+        LARGE_INTEGER curTime;
+        QueryPerformanceCounter(&amp;curTime);
+        endTime = curTime.QuadPart;
+    }
+    else
+    {
+        endTime = mStopTime;
+    }
+
+    return static_cast&lt;double&gt;(endTime - mStartTime) / mFrequency;
+}
+
+Timer *CreateTimer()
+{
+    return new Win32Timer();
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilwin32Win32Timerh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/win32/Win32Timer.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_WIN32_TIMER_H
+#define SAMPLE_UTIL_WIN32_TIMER_H
+
+#include &quot;Timer.h&quot;
+#include &lt;windows.h&gt;
+
+class Win32Timer : public Timer
+{
+  public:
+    Win32Timer();
+
+    void start();
+    void stop();
+    double getElapsedTime() const ;
+
+  private:
+    bool mRunning;
+    LONGLONG mStartTime;
+    LONGLONG mStopTime;
+
+    LONGLONG mFrequency;
+};
+
+#endif // SAMPLE_UTIL_WIN32_TIMER_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilwin32Win32Windowcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,599 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;win32/Win32Window.h&quot;
+
+#include &lt;sstream&gt;
+
+Key VirtualKeyCodeToKey(WPARAM key, LPARAM flags)
+{
+    switch (key)
+    {
+        // Check the scancode to distinguish between left and right shift
+      case VK_SHIFT:
+        {
+            static unsigned int lShift = MapVirtualKey(VK_LSHIFT, MAPVK_VK_TO_VSC);
+            unsigned int scancode = static_cast&lt;unsigned int&gt;((flags &amp; (0xFF &lt;&lt; 16)) &gt;&gt; 16);
+            return scancode == lShift ? KEY_LSHIFT : KEY_RSHIFT;
+        }
+
+        // Check the &quot;extended&quot; flag to distinguish between left and right alt
+      case VK_MENU:       return (HIWORD(flags) &amp; KF_EXTENDED) ? KEY_RALT : KEY_LALT;
+
+        // Check the &quot;extended&quot; flag to distinguish between left and right control
+      case VK_CONTROL:    return (HIWORD(flags) &amp; KF_EXTENDED) ? KEY_RCONTROL : KEY_LCONTROL;
+
+        // Other keys are reported properly
+      case VK_LWIN:       return KEY_LSYSTEM;
+      case VK_RWIN:       return KEY_RSYSTEM;
+      case VK_APPS:       return KEY_MENU;
+      case VK_OEM_1:      return KEY_SEMICOLON;
+      case VK_OEM_2:      return KEY_SLASH;
+      case VK_OEM_PLUS:   return KEY_EQUAL;
+      case VK_OEM_MINUS:  return KEY_DASH;
+      case VK_OEM_4:      return KEY_LBRACKET;
+      case VK_OEM_6:      return KEY_RBRACKET;
+      case VK_OEM_COMMA:  return KEY_COMMA;
+      case VK_OEM_PERIOD: return KEY_PERIOD;
+      case VK_OEM_7:      return KEY_QUOTE;
+      case VK_OEM_5:      return KEY_BACKSLASH;
+      case VK_OEM_3:      return KEY_TILDE;
+      case VK_ESCAPE:     return KEY_ESCAPE;
+      case VK_SPACE:      return KEY_SPACE;
+      case VK_RETURN:     return KEY_RETURN;
+      case VK_BACK:       return KEY_BACK;
+      case VK_TAB:        return KEY_TAB;
+      case VK_PRIOR:      return KEY_PAGEUP;
+      case VK_NEXT:       return KEY_PAGEDOWN;
+      case VK_END:        return KEY_END;
+      case VK_HOME:       return KEY_HOME;
+      case VK_INSERT:     return KEY_INSERT;
+      case VK_DELETE:     return KEY_DELETE;
+      case VK_ADD:        return KEY_ADD;
+      case VK_SUBTRACT:   return KEY_SUBTRACT;
+      case VK_MULTIPLY:   return KEY_MULTIPLY;
+      case VK_DIVIDE:     return KEY_DIVIDE;
+      case VK_PAUSE:      return KEY_PAUSE;
+      case VK_F1:         return KEY_F1;
+      case VK_F2:         return KEY_F2;
+      case VK_F3:         return KEY_F3;
+      case VK_F4:         return KEY_F4;
+      case VK_F5:         return KEY_F5;
+      case VK_F6:         return KEY_F6;
+      case VK_F7:         return KEY_F7;
+      case VK_F8:         return KEY_F8;
+      case VK_F9:         return KEY_F9;
+      case VK_F10:        return KEY_F10;
+      case VK_F11:        return KEY_F11;
+      case VK_F12:        return KEY_F12;
+      case VK_F13:        return KEY_F13;
+      case VK_F14:        return KEY_F14;
+      case VK_F15:        return KEY_F15;
+      case VK_LEFT:       return KEY_LEFT;
+      case VK_RIGHT:      return KEY_RIGHT;
+      case VK_UP:         return KEY_UP;
+      case VK_DOWN:       return KEY_DOWN;
+      case VK_NUMPAD0:    return KEY_NUMPAD0;
+      case VK_NUMPAD1:    return KEY_NUMPAD1;
+      case VK_NUMPAD2:    return KEY_NUMPAD2;
+      case VK_NUMPAD3:    return KEY_NUMPAD3;
+      case VK_NUMPAD4:    return KEY_NUMPAD4;
+      case VK_NUMPAD5:    return KEY_NUMPAD5;
+      case VK_NUMPAD6:    return KEY_NUMPAD6;
+      case VK_NUMPAD7:    return KEY_NUMPAD7;
+      case VK_NUMPAD8:    return KEY_NUMPAD8;
+      case VK_NUMPAD9:    return KEY_NUMPAD9;
+      case 'A':           return KEY_A;
+      case 'Z':           return KEY_Z;
+      case 'E':           return KEY_E;
+      case 'R':           return KEY_R;
+      case 'T':           return KEY_T;
+      case 'Y':           return KEY_Y;
+      case 'U':           return KEY_U;
+      case 'I':           return KEY_I;
+      case 'O':           return KEY_O;
+      case 'P':           return KEY_P;
+      case 'Q':           return KEY_Q;
+      case 'S':           return KEY_S;
+      case 'D':           return KEY_D;
+      case 'F':           return KEY_F;
+      case 'G':           return KEY_G;
+      case 'H':           return KEY_H;
+      case 'J':           return KEY_J;
+      case 'K':           return KEY_K;
+      case 'L':           return KEY_L;
+      case 'M':           return KEY_M;
+      case 'W':           return KEY_W;
+      case 'X':           return KEY_X;
+      case 'C':           return KEY_C;
+      case 'V':           return KEY_V;
+      case 'B':           return KEY_B;
+      case 'N':           return KEY_N;
+      case '0':           return KEY_NUM0;
+      case '1':           return KEY_NUM1;
+      case '2':           return KEY_NUM2;
+      case '3':           return KEY_NUM3;
+      case '4':           return KEY_NUM4;
+      case '5':           return KEY_NUM5;
+      case '6':           return KEY_NUM6;
+      case '7':           return KEY_NUM7;
+      case '8':           return KEY_NUM8;
+      case '9':           return KEY_NUM9;
+    }
+
+    return Key(0);
+}
+
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    switch(message)
+    {
+      case WM_NCCREATE:
+        {
+            LPCREATESTRUCT pCreateStruct = reinterpret_cast&lt;LPCREATESTRUCT&gt;(lParam);
+            SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast&lt;LONG_PTR&gt;(pCreateStruct-&gt;lpCreateParams));
+            return DefWindowProcA(hWnd, message, wParam, lParam);
+        }
+    }
+
+    Win32Window *window = reinterpret_cast&lt;Win32Window*&gt;(GetWindowLongPtr(hWnd, GWLP_USERDATA));
+    if (window)
+    {
+        switch (message)
+        {
+          case WM_DESTROY:
+          case WM_CLOSE:
+            {
+                Event event;
+                event.Type = Event::EVENT_CLOSED;
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_MOVE:
+            {
+                RECT winRect;
+                GetClientRect(hWnd, &amp;winRect);
+
+                POINT topLeft;
+                topLeft.x = winRect.left;
+                topLeft.y = winRect.top;
+                ClientToScreen(hWnd, &amp;topLeft);
+
+                Event event;
+                event.Type        = Event::EVENT_MOVED;
+                event.Move.X      = topLeft.x;
+                event.Move.Y      = topLeft.y;
+                window-&gt;pushEvent(event);
+
+                break;
+            }
+
+          case WM_SIZE:
+            {
+                RECT winRect;
+                GetClientRect(hWnd, &amp;winRect);
+
+                POINT topLeft;
+                topLeft.x = winRect.left;
+                topLeft.y = winRect.top;
+                ClientToScreen(hWnd, &amp;topLeft);
+
+                POINT botRight;
+                botRight.x = winRect.right;
+                botRight.y = winRect.bottom;
+                ClientToScreen(hWnd, &amp;botRight);
+
+                Event event;
+                event.Type        = Event::EVENT_RESIZED;
+                event.Size.Width  = botRight.x - topLeft.x;
+                event.Size.Height = botRight.y - topLeft.y;
+                window-&gt;pushEvent(event);
+
+                break;
+            }
+
+          case WM_SETFOCUS:
+            {
+                Event event;
+                event.Type = Event::EVENT_GAINED_FOCUS;
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_KILLFOCUS:
+            {
+                Event event;
+                event.Type = Event::EVENT_LOST_FOCUS;
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_KEYDOWN:
+          case WM_SYSKEYDOWN:
+          case WM_KEYUP:
+          case WM_SYSKEYUP:
+            {
+                bool down = (message == WM_KEYDOWN || message == WM_SYSKEYDOWN);
+
+                Event event;
+                event.Type        = down ? Event::EVENT_KEY_PRESSED : Event::EVENT_KEY_RELEASED;
+                event.Key.Alt     = HIWORD(GetAsyncKeyState(VK_MENU))    != 0;
+                event.Key.Control = HIWORD(GetAsyncKeyState(VK_CONTROL)) != 0;
+                event.Key.Shift   = HIWORD(GetAsyncKeyState(VK_SHIFT))   != 0;
+                event.Key.System  = HIWORD(GetAsyncKeyState(VK_LWIN)) || HIWORD(GetAsyncKeyState(VK_RWIN));
+                event.Key.Code    = VirtualKeyCodeToKey(wParam, lParam);
+                window-&gt;pushEvent(event);
+
+                break;
+            }
+
+          case WM_MOUSEWHEEL:
+            {
+                Event event;
+                event.Type = Event::EVENT_MOUSE_WHEEL_MOVED;
+                event.MouseWheel.Delta = static_cast&lt;short&gt;(HIWORD(wParam)) / 120;
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_LBUTTONDOWN:
+          case WM_LBUTTONDBLCLK:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_PRESSED;
+                event.MouseButton.Button = MOUSEBUTTON_LEFT;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_LBUTTONUP:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_RELEASED;
+                event.MouseButton.Button = MOUSEBUTTON_LEFT;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_RBUTTONDOWN:
+          case WM_RBUTTONDBLCLK:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_PRESSED;
+                event.MouseButton.Button = MOUSEBUTTON_RIGHT;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+            // Mouse right button up event
+          case WM_RBUTTONUP:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_RELEASED;
+                event.MouseButton.Button = MOUSEBUTTON_RIGHT;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+            // Mouse wheel button down event
+          case WM_MBUTTONDOWN:
+          case WM_MBUTTONDBLCLK:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_PRESSED;
+                event.MouseButton.Button = MOUSEBUTTON_MIDDLE;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+            // Mouse wheel button up event
+          case WM_MBUTTONUP:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_RELEASED;
+                event.MouseButton.Button = MOUSEBUTTON_MIDDLE;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+            // Mouse X button down event
+          case WM_XBUTTONDOWN:
+          case WM_XBUTTONDBLCLK:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_PRESSED;
+                event.MouseButton.Button = (HIWORD(wParam) == XBUTTON1) ? MOUSEBUTTON_BUTTON4 : MOUSEBUTTON_BUTTON5;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+            // Mouse X button up event
+          case WM_XBUTTONUP:
+            {
+                Event event;
+                event.Type               = Event::EVENT_MOUSE_BUTTON_RELEASED;
+                event.MouseButton.Button = (HIWORD(wParam) == XBUTTON1) ? MOUSEBUTTON_BUTTON4 : MOUSEBUTTON_BUTTON5;
+                event.MouseButton.X      = static_cast&lt;short&gt;(LOWORD(lParam));
+                event.MouseButton.Y      = static_cast&lt;short&gt;(HIWORD(lParam));
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_MOUSEMOVE:
+            {
+                int mouseX = static_cast&lt;short&gt;(LOWORD(lParam));
+                int mouseY = static_cast&lt;short&gt;(HIWORD(lParam));
+
+                Event event;
+                event.Type        = Event::EVENT_MOUSE_MOVED;
+                event.MouseMove.X = mouseX;
+                event.MouseMove.Y = mouseY;
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_MOUSELEAVE:
+            {
+                Event event;
+                event.Type = Event::EVENT_MOUSE_LEFT;
+                window-&gt;pushEvent(event);
+                break;
+            }
+
+          case WM_USER:
+            {
+                Event testEvent;
+                testEvent.Type = Event::EVENT_TEST;
+                window-&gt;pushEvent(testEvent);
+                break;
+            }
+        }
+
+    }
+    return DefWindowProcA(hWnd, message, wParam, lParam);
+}
+
+Win32Window::Win32Window()
+    : mNativeWindow(0),
+      mParentWindow(0),
+      mNativeDisplay(0)
+{
+}
+
+Win32Window::~Win32Window()
+{
+    destroy();
+}
+
+bool Win32Window::initialize(const std::string &amp;name, size_t width, size_t height)
+{
+    destroy();
+
+    // Use a new window class name for ever window to ensure that a new window can be created
+    // even if the last one was not properly destroyed
+    static size_t windowIdx = 0;
+    std::ostringstream nameStream;
+    nameStream &lt;&lt; name &lt;&lt; &quot;_&quot; &lt;&lt; windowIdx++;
+
+    mParentClassName = nameStream.str();
+    mChildClassName = mParentClassName + &quot;_Child&quot;;
+
+    // Work around compile error from not defining &quot;UNICODE&quot; while Chromium does
+    const LPSTR idcArrow = MAKEINTRESOURCEA(32512);
+
+    WNDCLASSEXA parentWindowClass = { 0 };
+    parentWindowClass.cbSize = sizeof(WNDCLASSEXA);
+    parentWindowClass.style = 0;
+    parentWindowClass.lpfnWndProc = WndProc;
+    parentWindowClass.cbClsExtra = 0;
+    parentWindowClass.cbWndExtra = 0;
+    parentWindowClass.hInstance = GetModuleHandle(NULL);
+    parentWindowClass.hIcon = NULL;
+    parentWindowClass.hCursor = LoadCursorA(NULL, idcArrow);
+    parentWindowClass.hbrBackground = 0;
+    parentWindowClass.lpszMenuName = NULL;
+    parentWindowClass.lpszClassName = mParentClassName.c_str();
+    if (!RegisterClassExA(&amp;parentWindowClass))
+    {
+        return false;
+    }
+
+    WNDCLASSEXA childWindowClass = { 0 };
+    childWindowClass.cbSize = sizeof(WNDCLASSEXA);
+    childWindowClass.style = CS_OWNDC;
+    childWindowClass.lpfnWndProc = WndProc;
+    childWindowClass.cbClsExtra = 0;
+    childWindowClass.cbWndExtra = 0;
+    childWindowClass.hInstance = GetModuleHandle(NULL);
+    childWindowClass.hIcon = NULL;
+    childWindowClass.hCursor = LoadCursorA(NULL, idcArrow);
+    childWindowClass.hbrBackground = 0;
+    childWindowClass.lpszMenuName = NULL;
+    childWindowClass.lpszClassName = mChildClassName.c_str();
+    if (!RegisterClassExA(&amp;childWindowClass))
+    {
+        return false;
+    }
+
+    DWORD parentStyle = WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU;
+    DWORD parentExtendedStyle = WS_EX_APPWINDOW;
+
+    RECT sizeRect = { 0, 0, width, height };
+    AdjustWindowRectEx(&amp;sizeRect, parentStyle, FALSE, parentExtendedStyle);
+
+    mParentWindow = CreateWindowExA(parentExtendedStyle, mParentClassName.c_str(), name.c_str(), parentStyle, CW_USEDEFAULT, CW_USEDEFAULT,
+                                    sizeRect.right - sizeRect.left, sizeRect.bottom - sizeRect.top, NULL, NULL,
+                                    GetModuleHandle(NULL), this);
+
+    mNativeWindow = CreateWindowExA(0, mChildClassName.c_str(), name.c_str(), WS_CHILD, 0, 0, width, height,
+                                    mParentWindow, NULL, GetModuleHandle(NULL), this);
+
+    mNativeDisplay = GetDC(mNativeWindow);
+    if (!mNativeDisplay)
+    {
+        destroy();
+        return false;
+    }
+
+    return true;
+}
+
+void Win32Window::destroy()
+{
+    if (mNativeDisplay)
+    {
+        ReleaseDC(mNativeWindow, mNativeDisplay);
+        mNativeDisplay = 0;
+    }
+
+    if (mNativeWindow)
+    {
+        DestroyWindow(mNativeWindow);
+        mNativeWindow = 0;
+    }
+
+    if (mParentWindow)
+    {
+        DestroyWindow(mParentWindow);
+        mParentWindow = 0;
+    }
+
+    UnregisterClassA(mParentClassName.c_str(), NULL);
+    UnregisterClassA(mChildClassName.c_str(), NULL);
+}
+
+EGLNativeWindowType Win32Window::getNativeWindow() const
+{
+    return mNativeWindow;
+}
+
+EGLNativeDisplayType Win32Window::getNativeDisplay() const
+{
+    return mNativeDisplay;
+}
+
+void Win32Window::messageLoop()
+{
+    MSG msg;
+    while (PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
+    {
+        TranslateMessage(&amp;msg);
+        DispatchMessage(&amp;msg);
+    }
+}
+
+void Win32Window::setMousePosition(int x, int y)
+{
+    RECT winRect;
+    GetClientRect(mNativeWindow, &amp;winRect);
+
+    POINT topLeft;
+    topLeft.x = winRect.left;
+    topLeft.y = winRect.top;
+    ClientToScreen(mNativeWindow, &amp;topLeft);
+
+    SetCursorPos(topLeft.x + x, topLeft.y + y);
+}
+
+OSWindow *CreateOSWindow()
+{
+    return new Win32Window();
+}
+
+bool Win32Window::setPosition(int x, int y)
+{
+    if (mX == x &amp;&amp; mY == mY)
+    {
+        return true;
+    }
+
+    RECT windowRect;
+    if (!GetWindowRect(mParentWindow, &amp;windowRect))
+    {
+        return false;
+    }
+
+    if (!MoveWindow(mParentWindow, x, y, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, TRUE))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+bool Win32Window::resize(int width, int height)
+{
+    if (width == mWidth &amp;&amp; height == mHeight)
+    {
+        return true;
+    }
+
+    RECT windowRect;
+    if (!GetWindowRect(mParentWindow, &amp;windowRect))
+    {
+        return false;
+    }
+
+    RECT clientRect;
+    if (!GetClientRect(mParentWindow, &amp;clientRect))
+    {
+        return false;
+    }
+
+    LONG diffX = (windowRect.right - windowRect.left) - clientRect.right;
+    LONG diffY = (windowRect.bottom - windowRect.top) - clientRect.bottom;
+    if (!MoveWindow(mParentWindow, windowRect.left, windowRect.top, width + diffX, height + diffY, TRUE))
+    {
+        return false;
+    }
+
+    if (!MoveWindow(mNativeWindow, 0, 0, width, height, FALSE))
+    {
+        return false;
+    }
+
+    return true;
+}
+
+void Win32Window::setVisible(bool isVisible)
+{
+    int flag = (isVisible ? SW_SHOW : SW_HIDE);
+
+    ShowWindow(mParentWindow, flag);
+    ShowWindow(mNativeWindow, flag);
+}
+
+void Win32Window::pushEvent(Event event)
+{
+    OSWindow::pushEvent(event);
+
+    switch (event.Type)
+    {
+      case Event::EVENT_RESIZED:
+        MoveWindow(mNativeWindow, 0, 0, mWidth, mHeight, FALSE);
+        break;
+    }
+}
+
+void Win32Window::signalTestEvent()
+{
+    PostMessage(mNativeWindow, WM_USER, 0, 0);
+}
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilwin32Win32Windowh"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.h (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.h                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/win32/Win32Window.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,46 @@
</span><ins>+//
+// Copyright (c) 2014 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 SAMPLE_UTIL_WIN32_WINDOW_H
+#define SAMPLE_UTIL_WIN32_WINDOW_H
+
+#include &quot;OSWindow.h&quot;
+#include &lt;string&gt;
+#include &lt;windows.h&gt;
+
+class Win32Window : public OSWindow
+{
+  public:
+    Win32Window();
+    ~Win32Window();
+
+    bool initialize(const std::string &amp;name, size_t width, size_t height) override;
+    void destroy() override;
+
+    EGLNativeWindowType getNativeWindow() const override;
+    EGLNativeDisplayType getNativeDisplay() const override;
+
+    void messageLoop() override;
+
+    void pushEvent(Event event) override;
+
+    void setMousePosition(int x, int y) override;
+    bool setPosition(int x, int y) override;
+    bool resize(int width, int height) override;
+    void setVisible(bool isVisible) override;
+
+    void signalTestEvent() override;
+
+  private:
+    std::string mParentClassName;
+    std::string mChildClassName;
+
+    EGLNativeWindowType mNativeWindow;
+    EGLNativeWindowType mParentWindow;
+    EGLNativeDisplayType mNativeDisplay;
+};
+
+#endif // SAMPLE_UTIL_WINDOW_H
</ins></span></pre></div>
<a id="trunkSourceThirdPartyANGLEutilwin32Win32_path_utilscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/ThirdParty/ANGLE/util/win32/Win32_path_utils.cpp (0 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/ThirdParty/ANGLE/util/win32/Win32_path_utils.cpp                                (rev 0)
+++ trunk/Source/ThirdParty/ANGLE/util/win32/Win32_path_utils.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+//
+// Copyright (c) 2014 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 &quot;path_utils.h&quot;
+#include &lt;array&gt;
+#include &lt;windows.h&gt;
+
+std::string GetExecutablePath()
+{
+    std::array&lt;char, MAX_PATH&gt; executableFileBuf;
+    DWORD executablePathLen = GetModuleFileNameA(NULL, executableFileBuf.data(), executableFileBuf.size());
+    return (executablePathLen &gt; 0 ? std::string(executableFileBuf.data()) : &quot;&quot;);
+}
+
+std::string GetExecutableDirectory()
+{
+    std::string executablePath = GetExecutablePath();
+    size_t lastPathSepLoc = executablePath.find_last_of(&quot;\\/&quot;);
+    return (lastPathSepLoc != std::string::npos) ? executablePath.substr(0, lastPathSepLoc) : &quot;&quot;;
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -3051,21 +3051,29 @@
</span><span class="cx">     )
</span><span class="cx"> 
</span><span class="cx">     list(APPEND ANGLESupport_SOURCES
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/common/blocklayout.cpp
</del><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/common/angleutils.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/common/debug.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/common/event_tracer.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/common/mathutil.cpp
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/common/RefCountObject.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/common/shadervars.cpp
</del><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/common/MemoryBuffer.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/common/utilities.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/common/tls.cpp
</ins><span class="cx"> 
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ArrayReturnValueToOutParameter.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ASTMetadataHLSL.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/blocklayout.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/blocklayoutHLSL.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/BuiltInFunctionEmulator.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/CallDAG.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/CodeGen.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Compiler.cpp
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/DetectCallDepth.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/DetectDiscontinuity.cpp
</del><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Diagnostics.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/DirectiveHandler.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/EmulatePrecision.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/glslang_lex.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/glslang_tab.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ForLoopUnroll.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/FlagStd140Structs.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/InfoSink.cpp
</span><span class="lines">@@ -3075,36 +3083,46 @@
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/InitializeVariables.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Intermediate.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/IntermTraverse.cpp
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Intermediate.cpp
</del><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/IntermNode.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/intermOut.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/LoopInfo.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Operator.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/OutputESSL.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/OutputGLSL.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/OutputGLSLBase.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/OutputHLSL.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/parseConst.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ParseContext.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/PoolAlloc.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/PruneEmptyDeclarations.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/QualifierAlive.cpp
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/RemoveTree.cpp
</del><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/RegenerateStructNames.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/RemoveSwitchFallThrough.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/RewriteElseBlocks.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/SearchSymbol.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/SeparateArrayInitialization.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/SeparateDeclarations.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ShaderLang.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ShaderVars.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/SimplifyArrayAssignment.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/StructureHLSL.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/SymbolTable.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/TranslatorESSL.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/TranslatorGLSL.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/TranslatorHLSL.cpp
</span><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/Types.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/UnfoldShortCircuit.cpp
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/UnfoldShortCircuitAST.cpp
</del><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/UniformHLSL.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/util.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/UtilsHLSL.cpp
+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ValidateLimitations.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ValidateOutputs.cpp
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ValidateLimitations.cpp
</del><ins>+        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ValidateSwitch.cpp
</ins><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/VariableInfo.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/VariablePacker.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/VersionGLSL.cpp
</span><del>-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/compilerdebug.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/glslang_lex.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/glslang_tab.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/intermOut.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/parseConst.cpp
-        ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/util.cpp
</del><span class="cx"> 
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/depgraph/DependencyGraph.cpp
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/depgraph/DependencyGraphBuilder.cpp
</span><span class="lines">@@ -3129,16 +3147,6 @@
</span><span class="cx">         ${THIRDPARTY_DIR}/ANGLE/src/third_party/compiler/ArrayBoundsClamper.cpp
</span><span class="cx">     )
</span><span class="cx"> 
</span><del>-    if (WIN32)
-        list(APPEND ANGLESupport_SOURCES
-            ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ossource_win.cpp
-        )
-    else ()
-        list(APPEND ANGLESupport_SOURCES
-            ${THIRDPARTY_DIR}/ANGLE/src/compiler/translator/ossource_posix.cpp
-        )
-    endif ()
-
</del><span class="cx">     list(APPEND WebCore_SOURCES
</span><span class="cx">         platform/graphics/ANGLEWebKitBridge.cpp
</span><span class="cx">         platform/graphics/FormatConverter.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/ChangeLog        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-06-30  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        Update ANGLE to b11e2483742db884bd0af41f78f528240577356b.
+        https://bugs.webkit.org/show_bug.cgi?id=145010
+
+        Reviewed by Dean Jackson.
+
+        * CMakeLists.txt:
+        * platform/graphics/ANGLEWebKitBridge.cpp:
+        (WebCore::appendSymbol):
+        (WebCore::getStructInfo):
+        (WebCore::getSymbolInfo):
+        (WebCore::ANGLEWebKitBridge::cleanupCompilers):
+        (WebCore::ANGLEWebKitBridge::compileShaderSource):
+        (WebCore::getValidationResultValue): Deleted.
+        * platform/graphics/ANGLEWebKitBridge.h:
+        (WebCore::ANGLEShaderSymbol::isSampler):
+        * platform/graphics/GraphicsContext3D.h:
+        (WebCore::GraphicsContext3D::SymbolInfo::SymbolInfo):
+        * platform/graphics/mac/GraphicsContext3DMac.mm:
+        * platform/graphics/opengl/Extensions3DOpenGL.cpp:
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::checkVaryingsPacking):
+        (WebCore::GraphicsContext3D::precisionsMatch):
+        Update WebCore to reflect changes in ANGLE.
+
</ins><span class="cx"> 2015-06-30  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Frame flattening: Hit-testing an iframe could end up destroying the associated inline tree context.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsANGLEWebKitBridgecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -33,114 +33,90 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-// Temporary typedef to support an incompatible change in the ANGLE API.
-#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION &lt; 108
-typedef int ANGLEGetInfoType;
-#else
-typedef size_t ANGLEGetInfoType;
-#endif
</del><ins>+// FIXME: This is awful. Get rid of ANGLEWebKitBridge completely and call the libANGLE API directly to validate shaders.
</ins><span class="cx"> 
</span><del>-inline static ANGLEGetInfoType getValidationResultValue(const ShHandle compiler, ShShaderInfo shaderInfo)
</del><ins>+static void appendSymbol(const sh::ShaderVariable&amp; variable, ANGLEShaderSymbolType symbolType, Vector&lt;ANGLEShaderSymbol&gt;&amp; symbols, const std::string&amp; name, const std::string&amp; mappedName)
</ins><span class="cx"> {
</span><del>-    ANGLEGetInfoType value = 0;
-    ShGetInfo(compiler, shaderInfo, &amp;value);
-    return value;
</del><ins>+    LOG(WebGL, &quot;Map shader symbol %s -&gt; %s\n&quot;, name.c_str(), mappedName.c_str());
+    
+    symbols.append(ANGLEShaderSymbol({symbolType, name.c_str(), mappedName.c_str(), variable.type, variable.arraySize, variable.precision, variable.staticUse}));
+    
+    if (variable.isArray()) {
+        for (unsigned i = 0; i &lt; variable.elementCount(); i++) {
+            std::string arrayBrackets = &quot;[&quot; + std::to_string(i) + &quot;]&quot;;
+            std::string arrayName = name + arrayBrackets;
+            std::string arrayMappedName = mappedName + arrayBrackets;
+            LOG(WebGL, &quot;Map shader symbol %s -&gt; %s\n&quot;, arrayName.c_str(), arrayMappedName.c_str());
+            
+            symbols.append({symbolType, arrayName.c_str(), arrayMappedName.c_str(), variable.type, variable.arraySize, variable.precision, variable.staticUse});
+        }
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool getSymbolInfo(ShHandle compiler, ShShaderInfo symbolType, Vector&lt;ANGLEShaderSymbol&gt;&amp; symbols)
</del><ins>+static void getStructInfo(const sh::ShaderVariable&amp; field, ANGLEShaderSymbolType symbolType, Vector&lt;ANGLEShaderSymbol&gt;&amp; symbols, const std::string&amp; namePrefix, const std::string&amp; mappedNamePrefix)
</ins><span class="cx"> {
</span><del>-    ShShaderInfo symbolMaxNameLengthType;
</del><ins>+    std::string name = namePrefix + '.' + field.name;
+    std::string mappedName = mappedNamePrefix + '.' + field.mappedName;
+    
+    if (field.isStruct()) {
+        for (const auto&amp; subfield : field.fields) {
+            // ANGLE restricts the depth of structs, which prevents stack overflow errors in this recursion.
+            getStructInfo(subfield, symbolType, symbols, name, mappedName);
+        }
+    } else
+        appendSymbol(field, symbolType, symbols, name, mappedName);
+}
</ins><span class="cx"> 
</span><ins>+static void getSymbolInfo(const sh::ShaderVariable&amp; variable, ANGLEShaderSymbolType symbolType, Vector&lt;ANGLEShaderSymbol&gt;&amp; symbols)
+{
+    if (variable.isStruct()) {
+        if (variable.isArray()) {
+            for (unsigned i = 0; i &lt; variable.elementCount(); i++) {
+                std::string arrayBrackets = &quot;[&quot; + std::to_string(i) + &quot;]&quot;;
+                std::string arrayName = variable.name + arrayBrackets;
+                std::string arrayMappedName = variable.mappedName + arrayBrackets;
+                for (const auto&amp; field : variable.fields)
+                    getStructInfo(field, symbolType, symbols, arrayName, arrayMappedName);
+            }
+        } else {
+            for (const auto&amp; field : variable.fields)
+                getStructInfo(field, symbolType, symbols, variable.name, variable.mappedName);
+        }
+    } else
+        appendSymbol(variable, symbolType, symbols, variable.name, variable.mappedName);
+}
+
+static bool getSymbolInfo(ShHandle compiler, ANGLEShaderSymbolType symbolType, Vector&lt;ANGLEShaderSymbol&gt;&amp; symbols)
+{
</ins><span class="cx">     switch (symbolType) {
</span><del>-    case SH_ACTIVE_ATTRIBUTES:
-        symbolMaxNameLengthType = SH_ACTIVE_ATTRIBUTE_MAX_LENGTH;
</del><ins>+    case SHADER_SYMBOL_TYPE_UNIFORM: {
+        auto uniforms = ShGetUniforms(compiler);
+        if (!uniforms)
+            return false;
+        for (const auto&amp; uniform : *uniforms)
+            getSymbolInfo(uniform, symbolType, symbols);
</ins><span class="cx">         break;
</span><del>-    case SH_ACTIVE_UNIFORMS:
-        symbolMaxNameLengthType = SH_ACTIVE_UNIFORM_MAX_LENGTH;
</del><ins>+    }
+    case SHADER_SYMBOL_TYPE_VARYING: {
+        auto varyings = ShGetVaryings(compiler);
+        if (!varyings)
+            return false;
+        for (const auto&amp; varying : *varyings)
+            getSymbolInfo(varying, symbolType, symbols);
</ins><span class="cx">         break;
</span><del>-    case SH_VARYINGS:
-        symbolMaxNameLengthType = SH_VARYING_MAX_LENGTH;
</del><ins>+    }
+    case SHADER_SYMBOL_TYPE_ATTRIBUTE: {
+        auto attributes = ShGetAttributes(compiler);
+        if (!attributes)
+            return false;
+        for (const auto&amp; attribute : *attributes)
+            getSymbolInfo(attribute, symbolType, symbols);
</ins><span class="cx">         break;
</span><ins>+    }
</ins><span class="cx">     default:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx">         return false;
</span><span class="cx">     }
</span><del>-
-    ANGLEGetInfoType numSymbols = getValidationResultValue(compiler, symbolType);
-
-    ANGLEGetInfoType maxNameLength = getValidationResultValue(compiler, symbolMaxNameLengthType);
-    if (maxNameLength &lt;= 1)
-        return false;
-
-    ANGLEGetInfoType maxMappedNameLength = getValidationResultValue(compiler, SH_MAPPED_NAME_MAX_LENGTH);
-    if (maxMappedNameLength &lt;= 1)
-        return false;
-
-    // The maximum allowed symbol name length is 256 characters.
-    Vector&lt;char, 256&gt; nameBuffer(maxNameLength);
-    Vector&lt;char, 256&gt; mappedNameBuffer(maxMappedNameLength);
-    
-    for (ANGLEGetInfoType i = 0; i &lt; numSymbols; ++i) {
-        ANGLEShaderSymbol symbol;
-        ANGLEGetInfoType nameLength = 0;
-        ShPrecisionType precision;
-        int staticUse;
-        switch (symbolType) {
-        case SH_ACTIVE_ATTRIBUTES:
-            symbol.symbolType = SHADER_SYMBOL_TYPE_ATTRIBUTE;
-            ShGetVariableInfo(compiler, symbolType, i, &amp;nameLength, &amp;symbol.size, &amp;symbol.dataType, &amp;precision, &amp;staticUse, nameBuffer.data(), mappedNameBuffer.data());
-            break;
-        case SH_ACTIVE_UNIFORMS:
-            symbol.symbolType = SHADER_SYMBOL_TYPE_UNIFORM;
-            ShGetVariableInfo(compiler, symbolType, i, &amp;nameLength, &amp;symbol.size, &amp;symbol.dataType, &amp;precision, &amp;staticUse, nameBuffer.data(), mappedNameBuffer.data());
-            break;
-        case SH_VARYINGS:
-            symbol.symbolType = SHADER_SYMBOL_TYPE_VARYING;
-            ShGetVariableInfo(compiler, symbolType, i, &amp;nameLength, &amp;symbol.size, &amp;symbol.dataType, &amp;precision, &amp;staticUse, nameBuffer.data(), mappedNameBuffer.data());
-            break;
-        default:
-            ASSERT_NOT_REACHED();
-            return false;
-        }
-        if (!nameLength)
-            return false;
-        
-        // The ShGetActive* calls above are guaranteed to produce null-terminated strings for
-        // nameBuffer and mappedNameBuffer. Also, the character set for symbol names
-        // is a subset of Latin-1 as specified by the OpenGL ES Shading Language, Section 3.1 and
-        // WebGL, Section &quot;Characters Outside the GLSL Source Character Set&quot;.
-
-        String name = String(nameBuffer.data());
-        String mappedName = String(mappedNameBuffer.data());
-        LOG(WebGL, &quot;Map shader symbol %s -&gt; %s\n&quot;, name.utf8().data(), mappedName.utf8().data());
-        
-        // ANGLE returns array names in the format &quot;array[0]&quot;.
-        // The only way to know if a symbol is an array is to check if it ends with &quot;[0]&quot;.
-        // We can't check the size because regular symbols and arrays of length 1 both have a size of 1.
-        symbol.isArray = name.endsWith(&quot;[0]&quot;) &amp;&amp; mappedName.endsWith(&quot;[0]&quot;);
-        if (symbol.isArray) {
-            // Add a symbol for the array name without the &quot;[0]&quot; suffix.
-            name.truncate(name.length() - 3);
-            mappedName.truncate(mappedName.length() - 3);
-        }
-
-        symbol.name = name;
-        symbol.mappedName = mappedName;
-        symbol.precision = precision;
-        symbol.staticUse = staticUse;
-        symbols.append(symbol);
-    
-        if (symbol.isArray) {
-            // Add symbols for each array element.
-            symbol.isArray = false;
-            for (int i = 0; i &lt; symbol.size; i++) {
-                String arrayBrackets = &quot;[&quot; + String::number(i) + &quot;]&quot;;
-                symbol.name = name + arrayBrackets;
-                symbol.mappedName = mappedName + arrayBrackets;
-                symbols.append(symbol);
-            }
-        }
-    }
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -164,10 +140,10 @@
</span><span class="cx"> {
</span><span class="cx">     if (m_fragmentCompiler)
</span><span class="cx">         ShDestruct(m_fragmentCompiler);
</span><del>-    m_fragmentCompiler = 0;
</del><ins>+    m_fragmentCompiler = nullptr;
</ins><span class="cx">     if (m_vertexCompiler)
</span><span class="cx">         ShDestruct(m_vertexCompiler);
</span><del>-    m_vertexCompiler = 0;
</del><ins>+    m_vertexCompiler = nullptr;
</ins><span class="cx"> 
</span><span class="cx">     builtCompilers = false;
</span><span class="cx"> }
</span><span class="lines">@@ -183,8 +159,8 @@
</span><span class="cx"> bool ANGLEWebKitBridge::compileShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String&amp; translatedShaderSource, String&amp; shaderValidationLog, Vector&lt;ANGLEShaderSymbol&gt;&amp; symbols, int extraCompileOptions)
</span><span class="cx"> {
</span><span class="cx">     if (!builtCompilers) {
</span><del>-        m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, m_shaderSpec, m_shaderOutput, &amp;m_resources);
-        m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, m_shaderSpec, m_shaderOutput, &amp;m_resources);
</del><ins>+        m_fragmentCompiler = ShConstructCompiler(GL_FRAGMENT_SHADER, m_shaderSpec, m_shaderOutput, &amp;m_resources);
+        m_vertexCompiler = ShConstructCompiler(GL_VERTEX_SHADER, m_shaderSpec, m_shaderOutput, &amp;m_resources);
</ins><span class="cx">         if (!m_fragmentCompiler || !m_vertexCompiler) {
</span><span class="cx">             cleanupCompilers();
</span><span class="cx">             return false;
</span><span class="lines">@@ -204,31 +180,21 @@
</span><span class="cx"> 
</span><span class="cx">     bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE | SH_VARIABLES | extraCompileOptions);
</span><span class="cx">     if (!validateSuccess) {
</span><del>-        int logSize = getValidationResultValue(compiler, SH_INFO_LOG_LENGTH);
-        if (logSize &gt; 1) {
-            auto logBuffer = std::make_unique&lt;char[]&gt;(logSize);
-            if (logBuffer) {
-                ShGetInfoLog(compiler, logBuffer.get());
-                shaderValidationLog = logBuffer.get();
-            }
-        }
</del><ins>+        const std::string&amp; log = ShGetInfoLog(compiler);
+        if (log.length())
+            shaderValidationLog = log.c_str();
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int translationLength = getValidationResultValue(compiler, SH_OBJECT_CODE_LENGTH);
-    if (translationLength &gt; 1) {
-        auto translationBuffer = std::make_unique&lt;char[]&gt;(translationLength);
-        if (!translationBuffer)
-            return false;
-        ShGetObjectCode(compiler, translationBuffer.get());
-        translatedShaderSource = translationBuffer.get();
-    }
</del><ins>+    const std::string&amp; objectCode = ShGetObjectCode(compiler);
+    if (objectCode.length())
+        translatedShaderSource = objectCode.c_str();
</ins><span class="cx">     
</span><del>-    if (!getSymbolInfo(compiler, SH_ACTIVE_ATTRIBUTES, symbols))
</del><ins>+    if (!getSymbolInfo(compiler, SHADER_SYMBOL_TYPE_ATTRIBUTE, symbols))
</ins><span class="cx">         return false;
</span><del>-    if (!getSymbolInfo(compiler, SH_ACTIVE_UNIFORMS, symbols))
</del><ins>+    if (!getSymbolInfo(compiler, SHADER_SYMBOL_TYPE_UNIFORM, symbols))
</ins><span class="cx">         return false;
</span><del>-    if (!getSymbolInfo(compiler, SH_VARYINGS, symbols))
</del><ins>+    if (!getSymbolInfo(compiler, SHADER_SYMBOL_TYPE_VARYING, symbols))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsANGLEWebKitBridgeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -29,6 +29,14 @@
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &lt;OpenGLES/ES2/glext.h&gt;
+#elif PLATFORM(MAC)
+#include &lt;OpenGL/gl.h&gt;
+#elif PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN)
+#include &quot;OpenGLShims.h&quot;
+#endif
+
</ins><span class="cx"> #if !PLATFORM(GTK) &amp;&amp; !PLATFORM(EFL) &amp;&amp; !PLATFORM(WIN) &amp;&amp; !defined(BUILDING_WITH_CMAKE)
</span><span class="cx"> #include &quot;ANGLE/ShaderLang.h&quot;
</span><span class="cx"> #elif PLATFORM(WIN) &amp;&amp; !defined(BUILDING_WITH_CMAKE)
</span><span class="lines">@@ -40,8 +48,8 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> enum ANGLEShaderType {
</span><del>-    SHADER_TYPE_VERTEX = SH_VERTEX_SHADER,
-    SHADER_TYPE_FRAGMENT = SH_FRAGMENT_SHADER,
</del><ins>+    SHADER_TYPE_VERTEX = GL_VERTEX_SHADER,
+    SHADER_TYPE_FRAGMENT = GL_FRAGMENT_SHADER,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> enum ANGLEShaderSymbolType {
</span><span class="lines">@@ -54,19 +62,20 @@
</span><span class="cx">     ANGLEShaderSymbolType symbolType;
</span><span class="cx">     String name;
</span><span class="cx">     String mappedName;
</span><del>-    ShDataType dataType;
-    int size;
-    bool isArray;
-    ShPrecisionType precision;
</del><ins>+    sh::GLenum dataType;
+    unsigned size;
+    sh::GLenum precision;
</ins><span class="cx">     int staticUse;
</span><span class="cx"> 
</span><span class="cx">     bool isSampler() const
</span><span class="cx">     {
</span><span class="cx">         return symbolType == SHADER_SYMBOL_TYPE_UNIFORM
</span><del>-            &amp;&amp; (dataType == SH_SAMPLER_2D
-            || dataType == SH_SAMPLER_CUBE
-            || dataType == SH_SAMPLER_2D_RECT_ARB
-            || dataType == SH_SAMPLER_EXTERNAL_OES);
</del><ins>+            &amp;&amp; (dataType == GL_SAMPLER_2D
+            || dataType == GL_SAMPLER_CUBE
+#if !PLATFORM(IOS)
+            || dataType == GL_SAMPLER_2D_RECT_ARB
+#endif
+            );
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsContext3Dh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -1314,12 +1314,12 @@
</span><span class="cx">         SymbolInfo()
</span><span class="cx">             : type(0)
</span><span class="cx">             , size(0)
</span><del>-            , precision(SH_PRECISION_UNDEFINED)
</del><ins>+            , precision(GL_NONE) // Invalid precision.
</ins><span class="cx">             , staticUse(0)
</span><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        SymbolInfo(GC3Denum type, int size, const String&amp; mappedName, ShPrecisionType precision, int staticUse)
</del><ins>+        SymbolInfo(GC3Denum type, int size, const String&amp; mappedName, sh::GLenum precision, int staticUse)
</ins><span class="cx">             : type(type)
</span><span class="cx">             , size(size)
</span><span class="cx">             , mappedName(mappedName)
</span><span class="lines">@@ -1336,7 +1336,7 @@
</span><span class="cx">         GC3Denum type;
</span><span class="cx">         int size;
</span><span class="cx">         String mappedName;
</span><del>-        ShPrecisionType precision;
</del><ins>+        sh::GLenum precision;
</ins><span class="cx">         int staticUse;
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacGraphicsContext3DMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;BlockExceptions.h&quot;
</span><span class="cx"> 
</span><del>-#include &lt;ANGLE/ShaderLang.h&gt;
</del><span class="cx"> #include &quot;CanvasRenderingContext.h&quot;
</span><span class="cx"> #include &lt;CoreGraphics/CGBitmapContext.h&gt;
</span><span class="cx"> #include &quot;Extensions3DOpenGL.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglExtensions3DOpenGLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -33,10 +33,8 @@
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-#include &lt;ANGLE/ShaderLang.h&gt;
</del><span class="cx"> #include &lt;OpenGLES/ES2/glext.h&gt;
</span><span class="cx"> #elif PLATFORM(MAC)
</span><del>-#include &lt;ANGLE/ShaderLang.h&gt;
</del><span class="cx"> #include &lt;OpenGL/gl.h&gt;
</span><span class="cx"> #elif PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN)
</span><span class="cx"> #include &quot;OpenGLShims.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsopenglGraphicsContext3DOpenGLCommoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (186168 => 186169)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp        2015-07-01 06:15:23 UTC (rev 186168)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp        2015-07-01 06:17:20 UTC (rev 186169)
</span><span class="lines">@@ -359,7 +359,7 @@
</span><span class="cx">         const auto&amp; fragmentSymbol = fragmentEntry.varyingMap.find(symbolName);
</span><span class="cx">         if (fragmentSymbol != fragmentEntry.varyingMap.end()) {
</span><span class="cx">             ShVariableInfo symbolInfo;
</span><del>-            symbolInfo.type = static_cast&lt;ShDataType&gt;((fragmentSymbol-&gt;value).type);
</del><ins>+            symbolInfo.type = (fragmentSymbol-&gt;value).type;
</ins><span class="cx">             // The arrays are already split up.
</span><span class="cx">             symbolInfo.size = (fragmentSymbol-&gt;value).size;
</span><span class="cx">             combinedVaryings.add(symbolName, symbolInfo);
</span><span class="lines">@@ -397,7 +397,7 @@
</span><span class="cx">     const auto&amp; vertexEntry = m_shaderSourceMap.find(vertexShader)-&gt;value;
</span><span class="cx">     const auto&amp; fragmentEntry = m_shaderSourceMap.find(fragmentShader)-&gt;value;
</span><span class="cx"> 
</span><del>-    HashMap&lt;String, ShPrecisionType&gt; vertexSymbolPrecisionMap;
</del><ins>+    HashMap&lt;String, sh::GLenum&gt; vertexSymbolPrecisionMap;
</ins><span class="cx"> 
</span><span class="cx">     for (const auto&amp; entry : vertexEntry.uniformMap)
</span><span class="cx">         vertexSymbolPrecisionMap.add(entry.value.mappedName, entry.value.precision);
</span></span></pre>
</div>
</div>

</body>
</html>